Material nodes wip, various refactoring

This commit is contained in:
barsdeveloper
2023-04-25 22:31:21 +02:00
parent dd25a75c02
commit b96746d1d9
36 changed files with 776 additions and 538 deletions

View File

@@ -101,14 +101,14 @@ export default class NodeElement extends ISelectableDraggableElement {
*/
static getTypeTemplate(nodeEntity) {
if (
nodeEntity.getClass() === Configuration.nodeType.callFunction
|| nodeEntity.getClass() === Configuration.nodeType.commutativeAssociativeBinaryOperator
|| nodeEntity.getClass() === Configuration.nodeType.callArrayFunction
nodeEntity.getClass() === Configuration.paths.callFunction
|| nodeEntity.getClass() === Configuration.paths.commutativeAssociativeBinaryOperator
|| nodeEntity.getClass() === Configuration.paths.callArrayFunction
) {
const memberParent = nodeEntity.FunctionReference?.MemberParent?.path ?? ""
if (
memberParent === "/Script/Engine.KismetMathLibrary"
|| memberParent === "/Script/Engine.KismetArrayLibrary"
memberParent === Configuration.paths.kismetMathLibrary
|| memberParent === Configuration.paths.kismetArrayLibrary
) {
if (nodeEntity.FunctionReference.MemberName?.startsWith("Conv_")) {
return VariableConversionNodeTemplate
@@ -133,23 +133,23 @@ export default class NodeElement extends ISelectableDraggableElement {
return VariableOperationNodeTemplate
}
}
if (memberParent === "/Script/Engine.BlueprintSetLibrary") {
if (memberParent === Configuration.paths.blueprintSetLibrary) {
return VariableOperationNodeTemplate
}
if (memberParent === "/Script/Engine.BlueprintMapLibrary") {
if (memberParent === Configuration.paths.blueprintMapLibrary) {
return VariableOperationNodeTemplate
}
}
switch (nodeEntity.getClass()) {
case Configuration.nodeType.comment:
case Configuration.paths.comment:
return CommentNodeTemplate
case Configuration.nodeType.createDelegate:
case Configuration.paths.createDelegate:
return NodeTemplate
case Configuration.nodeType.promotableOperator:
case Configuration.paths.promotableOperator:
return VariableOperationNodeTemplate
case Configuration.nodeType.knot: return KnotNodeTemplate
case Configuration.nodeType.variableGet: return VariableAccessNodeTemplate
case Configuration.nodeType.variableSet: return VariableAccessNodeTemplate
case Configuration.paths.knot: return KnotNodeTemplate
case Configuration.paths.variableGet: return VariableAccessNodeTemplate
case Configuration.paths.variableSet: return VariableAccessNodeTemplate
}
if (nodeEntity.isEvent()) {
return EventNodeTemplate

View File

@@ -50,10 +50,10 @@ export default class PinElement extends IElement {
"name": NamePinTemplate,
"real": RealPinTemplate,
"string": StringPinTemplate,
[Configuration.nodeType.linearColor]: LinearColorPinTemplate,
[Configuration.nodeType.rotator]: RotatorPinTemplate,
[Configuration.nodeType.vector]: VectorPinTemplate,
[Configuration.nodeType.vector2D]: Vector2DPinTemplate,
[Configuration.paths.linearColor]: LinearColorPinTemplate,
[Configuration.paths.rotator]: RotatorPinTemplate,
[Configuration.paths.vector]: VectorPinTemplate,
[Configuration.paths.vector2D]: Vector2DPinTemplate,
}
static properties = {
@@ -104,6 +104,12 @@ export default class PinElement extends IElement {
attribute: "data-direction",
reflect: true,
},
connectable: {
type: Boolean,
converter: Utility.booleanConverter,
attribute: "data-connectable",
reflect: true,
}
}
/** @type {NodeElement} */
@@ -151,6 +157,7 @@ export default class PinElement extends IElement {
this.isLinked = false
this.pinDirection = entity.isInput() ? "input" : entity.isOutput() ? "output" : "hidden"
this.nodeElement = /** @type {NodeElement} */(nodeElement)
this.connectable = !entity.bNotConnectable
}
setup() {