Merge pull request #2368 from t3du/master

add Not Equal to Gate Node
This commit is contained in:
Lubos Lenco 2021-10-26 16:50:04 +02:00 committed by GitHub
commit fabb4c0c3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -19,6 +19,8 @@ class GateNode extends LogicNode {
switch (property0) {
case "Equal":
cond = Std.isOfType(v1, Vec4) ? v1.equals(v2) : v1 == v2;
case "Not Equal":
cond = Std.isOfType(v1, Vec4) ? !v1.equals(v2) : v1 != v2;
case "Almost Equal":
cond = Std.isOfType(v1, Vec4) ? v1.almostEquals(v2, property1) : Math.abs(v1 - v2) < property1;
case "Greater":

View file

@ -11,7 +11,7 @@ def remove_extra_inputs(self, context):
class GateNode(ArmLogicTreeNode):
"""Logic nodes way to do "if" statements. When activated, it
compares if its two inputs are being Equal, Greater Equal,
Less Equal, Not Equal or Between regardless of variable type, and passes
Less Equal, Not Equal, or Between, regardless of variable type, and passes
through its active input to the output that matches the result of
the comparison.
@ -25,6 +25,7 @@ class GateNode(ArmLogicTreeNode):
property0: HaxeEnumProperty(
'property0',
items = [('Equal', 'Equal', 'Equal'),
('Not Equal', 'Not Equal', 'Not Equal'),
('Almost Equal', 'Almost Equal', 'Almost Equal'),
('Greater', 'Greater', 'Greater'),
('Greater Equal', 'Greater Equal', 'Greater Equal'),
@ -62,7 +63,7 @@ class GateNode(ArmLogicTreeNode):
op.socket_type = 'ArmDynamicSocket'
op2 = row.operator('arm.node_remove_input', text='', icon='X', emboss=True)
op2.node_index = str(id(self))
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.arm_version not in (0, 1):
raise LookupError()