Skip to content

Commit

Permalink
Merge pull request #3073 from t3du/ArrayIndex
Browse files Browse the repository at this point in the history
Array Index Node: expose From param
  • Loading branch information
luboslenco authored Nov 22, 2024
2 parents 22cc2a5 + a9a29a2 commit 88af401
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Sources/armory/logicnode/ArrayIndexNode.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ArrayIndexNode extends LogicNode {
var array: Array<Dynamic> = inputs[0].get();
array = array.map(item -> Std.string(item));
var value: Dynamic = inputs[1].get();
var from: Int = inputs[2].get();

return array.indexOf(Std.string(value));
return array.indexOf(Std.string(value), from);
}
}
9 changes: 8 additions & 1 deletion blender/arm/logicnode/array/LN_array_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ class ArrayIndexNode(ArmLogicTreeNode):
"""Returns the array index of the given value."""
bl_idname = 'LNArrayIndexNode'
bl_label = 'Array Index'
arm_version = 1
arm_version = 2

def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmDynamicSocket', 'Value')
self.add_input('ArmIntSocket', 'From')

self.add_output('ArmIntSocket', 'Index')

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

return NodeReplacement.Identity(self)

0 comments on commit 88af401

Please sign in to comment.