let assetPath = "";
let defaultPolygonPath = "assets/";
let polygonNameHeader = "polygon_";
let polygonName = "";
Editor.Panel.extend({
style: `
:host { margin: 5px; }
h2 { color: #f90; }
.bottom {
height: 30px;
}
`,
template: `
Auto Set Blend
1. 把要檢查的節點拉進來(會連全部子節點一起掃描)
2. 會自動把Dst Blend是DST_ALPHA的改為ONE
要檢查的Node
Blend:
Src Blend Factor
Old:
New:
修改
`,
$: {
/** Node */
node: "#node",
/** 確定按鈕 */
set: "#set",
/** */
label_Blend_Factor: "#label_Blend_Factor",
/** */
Blend: "#Blend",
/** */
Blend_Factor_Old: "#Blend_Factor_Old",
Blend_Factor_New: "#Blend_Factor_New",
},
ready() {
Editor.Ipc.sendToMain("blendset:panel-load-finish");
this.BtnClick();
this.selectBlendChange();
},
/** 保存按鈕點擊事件 */
BtnClick() {
this.$set.addEventListener("confirm", () => {
if (!this.$node._value) {
Editor.error("請拖曳 Node 到視窗");
return;
}
Editor.Ipc.sendToMain("blendset:set-click", this.$node, this.$Blend.value, this.$Blend_Factor_Old.value, this.$Blend_Factor_New.value);
// Editor.Ipc.sendToMain("blendset:set-click", this.$asset);
});
},
selectBlendChange() {
// var selectedValue = event.detail.value;
// Editor.log(`selectedValue: ${selectedValue}`);
this.$Blend.addEventListener("confirm", () => {
// Editor.log(`Blend: ${this.$Blend.value}`);
switch (this.$Blend.value) {
case "srcBlendFactor":
this.$label_Blend_Factor.innerText = "Src Blend Factor";
break;
case "dstBlendFactor":
this.$label_Blend_Factor.innerText = "Dst Blend Factor";
break;
}
});
},
messages: {
"setDefault": function (event, ...agrs) {
let Data = JSON.parse(agrs[0]);
let node_uuid = Data["node_uuid"];
// Editor.log(`agrs: ${agrs[0]}`);
// Editor.log(`node_uuid: ${node_uuid}`);
if (node_uuid && node_uuid !== "") {
this.$node.value = node_uuid;
}
if (event.reply) {
//if no error, the first argument should be null
event.reply(null, "Fine, thank you!");
}
}
}
});