Skip to content

Commit

Permalink
Merge pull request #2934 from MoritzBrueckner/fix-node-updates
Browse files Browse the repository at this point in the history
Fix node update routines for Gate and Array Float nodes
  • Loading branch information
luboslenco authored Oct 2, 2023
2 parents 3de406a + 34cc5d8 commit bf9e4da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
17 changes: 14 additions & 3 deletions blender/arm/logicnode/array/LN_array_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ def synchronize_from_master(self, master_node: ArmLogicVariableNodeMixin):
inp.default_value_raw = master_node.inputs[i].get_default_value()

def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.arm_version not in (0, 2):
if self.arm_version < 0 or self.arm_version > 2:
raise LookupError()

return NodeReplacement.Identity(self)

newnode = node_tree.nodes.new(FloatArrayNode.bl_idname)
for inp_old in self.inputs:
inp_new = newnode.add_input('ArmFloatSocket', inp_old.name)
inp_new.hide = self.arm_logic_id != ''
inp_new.enabled = self.arm_logic_id != ''
inp_new.default_value_raw = inp_old.get_default_value()
NodeReplacement.replace_input_socket(node_tree, inp_old, inp_new)

NodeReplacement.replace_output_socket(node_tree, self.outputs[0], newnode.outputs[0])
NodeReplacement.replace_output_socket(node_tree, self.outputs[1], newnode.outputs[1])

return newnode
9 changes: 4 additions & 5 deletions blender/arm/logicnode/logic/LN_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ def draw_buttons(self, context, layout):
column.enabled = False

def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.arm_version not in (0, 2):
raise LookupError()

if self.arm_version == 1 or self.arm_version == 2:
return NodeReplacement(
'LNGateNode', self.arm_version, 'LNGateNode', 2,
'LNGateNode', self.arm_version, 'LNGateNode', 3,
in_socket_mapping={0:0, 1:1, 2:2}, out_socket_mapping={0:0, 1:1}
)
)
else:
raise LookupError()

0 comments on commit bf9e4da

Please sign in to comment.