From ed6aa96fb0ee9816b94afccb3c295716ad8f4f35 Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Fri, 10 Sep 2021 01:07:52 +0200 Subject: [PATCH 1/6] create tween float node --- Sources/armory/logicnode/TweenFloatNode.hx | 114 +++++++++++++++++++ blender/arm/logicnode/math/LN_tween_float.py | 54 +++++++++ 2 files changed, 168 insertions(+) create mode 100644 Sources/armory/logicnode/TweenFloatNode.hx create mode 100644 blender/arm/logicnode/math/LN_tween_float.py diff --git a/Sources/armory/logicnode/TweenFloatNode.hx b/Sources/armory/logicnode/TweenFloatNode.hx new file mode 100644 index 00000000..c28fd331 --- /dev/null +++ b/Sources/armory/logicnode/TweenFloatNode.hx @@ -0,0 +1,114 @@ +package armory.logicnode; + +import iron.system.Tween; + +class TweenFloatNode extends LogicNode { + + public var property0:String; + + public var anim: TAnim; + public var fromValue:Float = 0.0; + public var toValue:Float = 1.0; + public var duration:Float = 1.0; + + public function new(tree:LogicTree) { + super(tree); + } + + override function run(from:Int) { + + if(from == 0){ + + if(anim != null){ + Tween.stop(anim); + } + + fromValue = inputs[2].get(); + toValue = inputs[3].get(); + duration = inputs[4].get(); + var type:Dynamic = Linear; + + switch (property0) { + case "Linear": + type = Linear; + case "SineIn": + type = SineIn; + case "SineOut": + type = SineOut; + case "SineInOut": + type = SineInOut; + case "QuadIn": + type = QuadIn; + case "QuadOut": + type = QuadOut; + case "QuadInOut": + type = QuadInOut; + case "CubicIn": + type = CubicIn; + case "CubicOut": + type = CubicOut; + case "CubicInOut": + type = CubicInOut; + case "QuartIn": + type = QuartIn; + case "QuartOut": + type = QuartOut; + case "QuartInOut": + type = QuartInOut; + case "QuintIn": + type = QuintIn; + case "QuintOut": + type = QuintOut; + case "QuintInOut": + type = QuintInOut; + case "ExpoIn": + type = ExpoIn; + case "ExpoOut": + type = ExpoOut; + case "ExpoInOut": + type = ExpoInOut; + case "CircIn": + type = CircIn; + case "CircOut": + type = CircOut; + case "CircInOut": + type = CircInOut; + case "BackIn": + type = BackIn; + case "BackOut": + type = BackOut; + case "BackInOut": + type = BackInOut; + } + + anim = Tween.to({ + target: this, + props: { fromValue: toValue }, + duration: duration, + ease: type, + tick: update, + done: done + }); + } + else{ + if(anim != null){ + Tween.stop(anim); + } + } + + runOutput(1); + } + + override function get(from: Int): Dynamic { + if(from == 0) return fromValue; + return null; + } + + function update() { + runOutput(2); + } + + function done() { + runOutput(3); + } +} \ No newline at end of file diff --git a/blender/arm/logicnode/math/LN_tween_float.py b/blender/arm/logicnode/math/LN_tween_float.py new file mode 100644 index 00000000..14f3f1f0 --- /dev/null +++ b/blender/arm/logicnode/math/LN_tween_float.py @@ -0,0 +1,54 @@ +from arm.logicnode.arm_nodes import * + +class TweenFloatNode( ArmLogicTreeNode): + '''Tween a float value''' + bl_idname = 'LNTweenFloatNode' + bl_label = 'Tween Float' + arm_version = 1 + + property0: HaxeEnumProperty( + 'property0', + items = [('Linear', 'Linear', 'Linear'), + ('SineIn', 'SineIn', 'SineIn'), + ('SineOut', 'SineOut', 'SineOut'), + ('SineInOut', 'SineInOut', 'SineInOut'), + ('QuadIn', 'QuadIn', 'QuadIn'), + ('QuadOut', 'QuadOut', 'QuadOut'), + ('QuadInOut', 'QuadInOut', 'QuadInOut'), + ('CubicIn', 'CubicIn', 'CubicIn'), + ('CubicOut', 'CubicOut', 'CubicOut'), + ('CubicInOut', 'CubicInOut', 'CubicInOut'), + ('QuartIn', 'QuartIn', 'QuartIn'), + ('QuartOut', 'QuartOut', 'QuartOut'), + ('QuartInOut', 'QuartInOut', 'QuartInOut'), + ('QuintIn', 'QuintIn', 'QuintIn'), + ('QuintOut', 'QuintOut', 'QuintOut'), + ('QuintInOut', 'QuintInOut', 'QuintInOut'), + ('ExpoIn', 'ExpoIn', 'ExpoIn'), + ('ExpoOut', 'ExpoOut', 'ExpoOut'), + ('ExpoInOut', 'ExpoInOut', 'ExpoInOut'), + ('CircIn', 'CircIn', 'CircIn'), + ('CircOut', 'CircOut', 'CircOut'), + ('CircInOut', 'CircInOut', 'CircInOut'), + ('BackIn', 'BackIn', 'BackIn'), + ('BackOut', 'BackOut', 'BackOut'), + ('BackInOut', 'BackInOut', 'BackInOut')], + name='', default='Linear') + + def init(self, context): + self.add_input('ArmNodeSocketAction', 'Start') + self.add_input('ArmNodeSocketAction', 'Stop') + self.add_input('ArmFloatSocket', 'From', default_value = 0.0) + self.add_input('ArmFloatSocket', 'To', default_value = 0.0) + self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) + + self.add_output('ArmFloatSocket', 'Tween') + self.add_output('ArmNodeSocketAction', 'Out') + self.add_output('ArmNodeSocketAction', 'Tick') + self.add_output('ArmNodeSocketAction', 'Done') + + def draw_buttons(self, context, layout): + layout.prop(self, 'property0') + + def draw_label(self) -> str: + return f'{self.bl_label}: {self.property0}' \ No newline at end of file From 62294c8bb4db24f10cae894bbc82b819d3183b73 Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Fri, 10 Sep 2021 01:08:12 +0200 Subject: [PATCH 2/6] create tween rotation node --- Sources/armory/logicnode/TweenRotationNode.hx | 116 ++++++++++++++++++ .../arm/logicnode/math/LN_tween_rotation.py | 54 ++++++++ 2 files changed, 170 insertions(+) create mode 100644 Sources/armory/logicnode/TweenRotationNode.hx create mode 100644 blender/arm/logicnode/math/LN_tween_rotation.py diff --git a/Sources/armory/logicnode/TweenRotationNode.hx b/Sources/armory/logicnode/TweenRotationNode.hx new file mode 100644 index 00000000..0758af65 --- /dev/null +++ b/Sources/armory/logicnode/TweenRotationNode.hx @@ -0,0 +1,116 @@ +package armory.logicnode; + +import iron.math.Quat; +import iron.system.Tween; + +class TweenRotationNode extends LogicNode { + + public var property0:String; + + public var anim: TAnim; + public var fromValue:Quat = new Quat(); + public var toValue:Quat = new Quat(); + public var duration:Float = 1.0; + + public function new(tree:LogicTree) { + super(tree); + } + + override function run(from:Int) { + + if(from == 0){ + + if(anim != null){ + Tween.stop(anim); + } + + fromValue = inputs[2].get(); + toValue = inputs[3].get(); + duration = inputs[4].get(); + var type:Dynamic = Linear; + + switch (property0) { + case "Linear": + type = Linear; + case "SineIn": + type = SineIn; + case "SineOut": + type = SineOut; + case "SineInOut": + type = SineInOut; + case "QuadIn": + type = QuadIn; + case "QuadOut": + type = QuadOut; + case "QuadInOut": + type = QuadInOut; + case "CubicIn": + type = CubicIn; + case "CubicOut": + type = CubicOut; + case "CubicInOut": + type = CubicInOut; + case "QuartIn": + type = QuartIn; + case "QuartOut": + type = QuartOut; + case "QuartInOut": + type = QuartInOut; + case "QuintIn": + type = QuintIn; + case "QuintOut": + type = QuintOut; + case "QuintInOut": + type = QuintInOut; + case "ExpoIn": + type = ExpoIn; + case "ExpoOut": + type = ExpoOut; + case "ExpoInOut": + type = ExpoInOut; + case "CircIn": + type = CircIn; + case "CircOut": + type = CircOut; + case "CircInOut": + type = CircInOut; + case "BackIn": + type = BackIn; + case "BackOut": + type = BackOut; + case "BackInOut": + type = BackInOut; + } + + anim = Tween.to({ + target: this, + props: { fromValue: toValue }, + duration: duration, + ease: type, + tick: update, + done: done + }); + } + else{ + if(anim != null){ + Tween.stop(anim); + } + + } + + runOutput(1); + } + + override function get(from: Int): Dynamic { + if(from == 0) return fromValue; + return null; + } + + function update() { + runOutput(2); + } + + function done() { + runOutput(3); + } +} \ No newline at end of file diff --git a/blender/arm/logicnode/math/LN_tween_rotation.py b/blender/arm/logicnode/math/LN_tween_rotation.py new file mode 100644 index 00000000..2cdfd4b8 --- /dev/null +++ b/blender/arm/logicnode/math/LN_tween_rotation.py @@ -0,0 +1,54 @@ +from arm.logicnode.arm_nodes import * + +class TweenFloatNode( ArmLogicTreeNode): + '''Tween rotation''' + bl_idname = 'LNTweenRotationNode' + bl_label = 'Tween Rotation' + arm_version = 1 + + property0: HaxeEnumProperty( + 'property0', + items = [('Linear', 'Linear', 'Linear'), + ('SineIn', 'SineIn', 'SineIn'), + ('SineOut', 'SineOut', 'SineOut'), + ('SineInOut', 'SineInOut', 'SineInOut'), + ('QuadIn', 'QuadIn', 'QuadIn'), + ('QuadOut', 'QuadOut', 'QuadOut'), + ('QuadInOut', 'QuadInOut', 'QuadInOut'), + ('CubicIn', 'CubicIn', 'CubicIn'), + ('CubicOut', 'CubicOut', 'CubicOut'), + ('CubicInOut', 'CubicInOut', 'CubicInOut'), + ('QuartIn', 'QuartIn', 'QuartIn'), + ('QuartOut', 'QuartOut', 'QuartOut'), + ('QuartInOut', 'QuartInOut', 'QuartInOut'), + ('QuintIn', 'QuintIn', 'QuintIn'), + ('QuintOut', 'QuintOut', 'QuintOut'), + ('QuintInOut', 'QuintInOut', 'QuintInOut'), + ('ExpoIn', 'ExpoIn', 'ExpoIn'), + ('ExpoOut', 'ExpoOut', 'ExpoOut'), + ('ExpoInOut', 'ExpoInOut', 'ExpoInOut'), + ('CircIn', 'CircIn', 'CircIn'), + ('CircOut', 'CircOut', 'CircOut'), + ('CircInOut', 'CircInOut', 'CircInOut'), + ('BackIn', 'BackIn', 'BackIn'), + ('BackOut', 'BackOut', 'BackOut'), + ('BackInOut', 'BackInOut', 'BackInOut')], + name='', default='Linear') + + def init(self, context): + self.add_input('ArmNodeSocketAction', 'Start') + self.add_input('ArmNodeSocketAction', 'Stop') + self.add_input('ArmRotationSocket', 'From') + self.add_input('ArmRotationSocket', 'To') + self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) + + self.add_output('ArmRotationSocket', 'Tween') + self.add_output('ArmNodeSocketAction', 'Out') + self.add_output('ArmNodeSocketAction', 'Tick') + self.add_output('ArmNodeSocketAction', 'Done') + + def draw_buttons(self, context, layout): + layout.prop(self, 'property0') + + def draw_label(self) -> str: + return f'{self.bl_label}: {self.property0}' \ No newline at end of file From eb5ef993095b23ce768721bd14e1ee693a0163b0 Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Fri, 10 Sep 2021 01:08:31 +0200 Subject: [PATCH 3/6] create tween vector node --- Sources/armory/logicnode/TweenVectorNode.hx | 116 ++++++++++++++++++ blender/arm/logicnode/math/LN_tween_vector.py | 54 ++++++++ 2 files changed, 170 insertions(+) create mode 100644 Sources/armory/logicnode/TweenVectorNode.hx create mode 100644 blender/arm/logicnode/math/LN_tween_vector.py diff --git a/Sources/armory/logicnode/TweenVectorNode.hx b/Sources/armory/logicnode/TweenVectorNode.hx new file mode 100644 index 00000000..e106479f --- /dev/null +++ b/Sources/armory/logicnode/TweenVectorNode.hx @@ -0,0 +1,116 @@ +package armory.logicnode; + +import iron.math.Vec4; +import iron.system.Tween; + +class TweenVectorNode extends LogicNode { + + public var property0:String; + + public var anim: TAnim; + public var fromValue:Vec4 = new Vec4(); + public var toValue:Vec4 = new Vec4(); + public var duration:Float = 1.0; + + public function new(tree:LogicTree) { + super(tree); + } + + override function run(from:Int) { + + if(from == 0){ + + if(anim != null){ + Tween.stop(anim); + } + + fromValue = inputs[2].get(); + toValue = inputs[3].get(); + duration = inputs[4].get(); + var type:Dynamic = Linear; + + switch (property0) { + case "Linear": + type = Linear; + case "SineIn": + type = SineIn; + case "SineOut": + type = SineOut; + case "SineInOut": + type = SineInOut; + case "QuadIn": + type = QuadIn; + case "QuadOut": + type = QuadOut; + case "QuadInOut": + type = QuadInOut; + case "CubicIn": + type = CubicIn; + case "CubicOut": + type = CubicOut; + case "CubicInOut": + type = CubicInOut; + case "QuartIn": + type = QuartIn; + case "QuartOut": + type = QuartOut; + case "QuartInOut": + type = QuartInOut; + case "QuintIn": + type = QuintIn; + case "QuintOut": + type = QuintOut; + case "QuintInOut": + type = QuintInOut; + case "ExpoIn": + type = ExpoIn; + case "ExpoOut": + type = ExpoOut; + case "ExpoInOut": + type = ExpoInOut; + case "CircIn": + type = CircIn; + case "CircOut": + type = CircOut; + case "CircInOut": + type = CircInOut; + case "BackIn": + type = BackIn; + case "BackOut": + type = BackOut; + case "BackInOut": + type = BackInOut; + } + + anim = Tween.to({ + target: this, + props: { fromValue: toValue }, + duration: duration, + ease: type, + tick: update, + done: done + }); + } + else{ + if(anim != null){ + Tween.stop(anim); + } + + } + + runOutput(1); + } + + override function get(from: Int): Dynamic { + if(from == 0) return fromValue; + return null; + } + + function update() { + runOutput(2); + } + + function done() { + runOutput(3); + } +} \ No newline at end of file diff --git a/blender/arm/logicnode/math/LN_tween_vector.py b/blender/arm/logicnode/math/LN_tween_vector.py new file mode 100644 index 00000000..9d60ed2d --- /dev/null +++ b/blender/arm/logicnode/math/LN_tween_vector.py @@ -0,0 +1,54 @@ +from arm.logicnode.arm_nodes import * + +class TweenVectorNode( ArmLogicTreeNode): + '''Tween a vector value''' + bl_idname = 'LNTweenVectorNode' + bl_label = 'Tween Vector' + arm_version = 1 + + property0: HaxeEnumProperty( + 'property0', + items = [('Linear', 'Linear', 'Linear'), + ('SineIn', 'SineIn', 'SineIn'), + ('SineOut', 'SineOut', 'SineOut'), + ('SineInOut', 'SineInOut', 'SineInOut'), + ('QuadIn', 'QuadIn', 'QuadIn'), + ('QuadOut', 'QuadOut', 'QuadOut'), + ('QuadInOut', 'QuadInOut', 'QuadInOut'), + ('CubicIn', 'CubicIn', 'CubicIn'), + ('CubicOut', 'CubicOut', 'CubicOut'), + ('CubicInOut', 'CubicInOut', 'CubicInOut'), + ('QuartIn', 'QuartIn', 'QuartIn'), + ('QuartOut', 'QuartOut', 'QuartOut'), + ('QuartInOut', 'QuartInOut', 'QuartInOut'), + ('QuintIn', 'QuintIn', 'QuintIn'), + ('QuintOut', 'QuintOut', 'QuintOut'), + ('QuintInOut', 'QuintInOut', 'QuintInOut'), + ('ExpoIn', 'ExpoIn', 'ExpoIn'), + ('ExpoOut', 'ExpoOut', 'ExpoOut'), + ('ExpoInOut', 'ExpoInOut', 'ExpoInOut'), + ('CircIn', 'CircIn', 'CircIn'), + ('CircOut', 'CircOut', 'CircOut'), + ('CircInOut', 'CircInOut', 'CircInOut'), + ('BackIn', 'BackIn', 'BackIn'), + ('BackOut', 'BackOut', 'BackOut'), + ('BackInOut', 'BackInOut', 'BackInOut')], + name='', default='Linear') + + def init(self, context): + self.add_input('ArmNodeSocketAction', 'Start') + self.add_input('ArmNodeSocketAction', 'Stop') + self.add_input('ArmVectorSocket', 'From') + self.add_input('ArmVectorSocket', 'To') + self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) + + self.add_output('ArmVectorSocket', 'Tween') + self.add_output('ArmNodeSocketAction', 'Out') + self.add_output('ArmNodeSocketAction', 'Tick') + self.add_output('ArmNodeSocketAction', 'Done') + + def draw_buttons(self, context, layout): + layout.prop(self, 'property0') + + def draw_label(self) -> str: + return f'{self.bl_label}: {self.property0}' \ No newline at end of file From 05465bcea1be701fb5e676399a3b2cc312c5c886 Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Mon, 13 Sep 2021 22:30:39 +0200 Subject: [PATCH 4/6] minor clean-up --- Sources/armory/logicnode/TweenRotationNode.hx | 4 ++-- Sources/armory/logicnode/TweenVectorNode.hx | 4 ++-- blender/arm/logicnode/math/LN_tween_float.py | 2 +- blender/arm/logicnode/math/LN_tween_rotation.py | 2 +- blender/arm/logicnode/math/LN_tween_vector.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/armory/logicnode/TweenRotationNode.hx b/Sources/armory/logicnode/TweenRotationNode.hx index 0758af65..5811be7c 100644 --- a/Sources/armory/logicnode/TweenRotationNode.hx +++ b/Sources/armory/logicnode/TweenRotationNode.hx @@ -24,8 +24,8 @@ class TweenRotationNode extends LogicNode { Tween.stop(anim); } - fromValue = inputs[2].get(); - toValue = inputs[3].get(); + fromValue.setFrom(inputs[2].get()); + toValue.setFrom(inputs[3].get()); duration = inputs[4].get(); var type:Dynamic = Linear; diff --git a/Sources/armory/logicnode/TweenVectorNode.hx b/Sources/armory/logicnode/TweenVectorNode.hx index e106479f..90f0ad23 100644 --- a/Sources/armory/logicnode/TweenVectorNode.hx +++ b/Sources/armory/logicnode/TweenVectorNode.hx @@ -24,8 +24,8 @@ class TweenVectorNode extends LogicNode { Tween.stop(anim); } - fromValue = inputs[2].get(); - toValue = inputs[3].get(); + fromValue.setFrom(inputs[2].get()); + toValue.setFrom(inputs[3].get()); duration = inputs[4].get(); var type:Dynamic = Linear; diff --git a/blender/arm/logicnode/math/LN_tween_float.py b/blender/arm/logicnode/math/LN_tween_float.py index 14f3f1f0..8b5a0f85 100644 --- a/blender/arm/logicnode/math/LN_tween_float.py +++ b/blender/arm/logicnode/math/LN_tween_float.py @@ -42,7 +42,7 @@ class TweenFloatNode( ArmLogicTreeNode): self.add_input('ArmFloatSocket', 'To', default_value = 0.0) self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) - self.add_output('ArmFloatSocket', 'Tween') + self.add_output('ArmFloatSocket', 'Value') self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') self.add_output('ArmNodeSocketAction', 'Done') diff --git a/blender/arm/logicnode/math/LN_tween_rotation.py b/blender/arm/logicnode/math/LN_tween_rotation.py index 2cdfd4b8..143b9cea 100644 --- a/blender/arm/logicnode/math/LN_tween_rotation.py +++ b/blender/arm/logicnode/math/LN_tween_rotation.py @@ -42,7 +42,7 @@ class TweenFloatNode( ArmLogicTreeNode): self.add_input('ArmRotationSocket', 'To') self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) - self.add_output('ArmRotationSocket', 'Tween') + self.add_output('ArmRotationSocket', 'Value') self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') self.add_output('ArmNodeSocketAction', 'Done') diff --git a/blender/arm/logicnode/math/LN_tween_vector.py b/blender/arm/logicnode/math/LN_tween_vector.py index 9d60ed2d..babd7a4b 100644 --- a/blender/arm/logicnode/math/LN_tween_vector.py +++ b/blender/arm/logicnode/math/LN_tween_vector.py @@ -42,7 +42,7 @@ class TweenVectorNode( ArmLogicTreeNode): self.add_input('ArmVectorSocket', 'To') self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) - self.add_output('ArmVectorSocket', 'Tween') + self.add_output('ArmVectorSocket', 'Value') self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') self.add_output('ArmNodeSocketAction', 'Done') From 0ce0c5c1158b65c3ebb2fc9bbfc40a781385defd Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Mon, 13 Sep 2021 22:48:32 +0200 Subject: [PATCH 5/6] change socket order --- Sources/armory/logicnode/TweenFloatNode.hx | 8 ++++---- Sources/armory/logicnode/TweenRotationNode.hx | 8 ++++---- Sources/armory/logicnode/TweenVectorNode.hx | 8 ++++---- blender/arm/logicnode/math/LN_tween_float.py | 2 +- blender/arm/logicnode/math/LN_tween_rotation.py | 2 +- blender/arm/logicnode/math/LN_tween_vector.py | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Sources/armory/logicnode/TweenFloatNode.hx b/Sources/armory/logicnode/TweenFloatNode.hx index c28fd331..8e8f2515 100644 --- a/Sources/armory/logicnode/TweenFloatNode.hx +++ b/Sources/armory/logicnode/TweenFloatNode.hx @@ -96,19 +96,19 @@ class TweenFloatNode extends LogicNode { } } - runOutput(1); + runOutput(0); } override function get(from: Int): Dynamic { - if(from == 0) return fromValue; + if(from == 3) return fromValue; return null; } function update() { - runOutput(2); + runOutput(1); } function done() { - runOutput(3); + runOutput(2); } } \ No newline at end of file diff --git a/Sources/armory/logicnode/TweenRotationNode.hx b/Sources/armory/logicnode/TweenRotationNode.hx index 5811be7c..31a3bb76 100644 --- a/Sources/armory/logicnode/TweenRotationNode.hx +++ b/Sources/armory/logicnode/TweenRotationNode.hx @@ -98,19 +98,19 @@ class TweenRotationNode extends LogicNode { } - runOutput(1); + runOutput(0); } override function get(from: Int): Dynamic { - if(from == 0) return fromValue; + if(from == 3) return fromValue; return null; } function update() { - runOutput(2); + runOutput(1); } function done() { - runOutput(3); + runOutput(2); } } \ No newline at end of file diff --git a/Sources/armory/logicnode/TweenVectorNode.hx b/Sources/armory/logicnode/TweenVectorNode.hx index 90f0ad23..76382286 100644 --- a/Sources/armory/logicnode/TweenVectorNode.hx +++ b/Sources/armory/logicnode/TweenVectorNode.hx @@ -98,19 +98,19 @@ class TweenVectorNode extends LogicNode { } - runOutput(1); + runOutput(0); } override function get(from: Int): Dynamic { - if(from == 0) return fromValue; + if(from == 3) return fromValue; return null; } function update() { - runOutput(2); + runOutput(1); } function done() { - runOutput(3); + runOutput(2); } } \ No newline at end of file diff --git a/blender/arm/logicnode/math/LN_tween_float.py b/blender/arm/logicnode/math/LN_tween_float.py index 8b5a0f85..53e50db3 100644 --- a/blender/arm/logicnode/math/LN_tween_float.py +++ b/blender/arm/logicnode/math/LN_tween_float.py @@ -42,10 +42,10 @@ class TweenFloatNode( ArmLogicTreeNode): self.add_input('ArmFloatSocket', 'To', default_value = 0.0) self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) - self.add_output('ArmFloatSocket', 'Value') self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') self.add_output('ArmNodeSocketAction', 'Done') + self.add_output('ArmFloatSocket', 'Value') def draw_buttons(self, context, layout): layout.prop(self, 'property0') diff --git a/blender/arm/logicnode/math/LN_tween_rotation.py b/blender/arm/logicnode/math/LN_tween_rotation.py index 143b9cea..24ca1309 100644 --- a/blender/arm/logicnode/math/LN_tween_rotation.py +++ b/blender/arm/logicnode/math/LN_tween_rotation.py @@ -42,10 +42,10 @@ class TweenFloatNode( ArmLogicTreeNode): self.add_input('ArmRotationSocket', 'To') self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) - self.add_output('ArmRotationSocket', 'Value') self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') self.add_output('ArmNodeSocketAction', 'Done') + self.add_output('ArmRotationSocket', 'Value') def draw_buttons(self, context, layout): layout.prop(self, 'property0') diff --git a/blender/arm/logicnode/math/LN_tween_vector.py b/blender/arm/logicnode/math/LN_tween_vector.py index babd7a4b..ec4a4eb0 100644 --- a/blender/arm/logicnode/math/LN_tween_vector.py +++ b/blender/arm/logicnode/math/LN_tween_vector.py @@ -42,10 +42,10 @@ class TweenVectorNode( ArmLogicTreeNode): self.add_input('ArmVectorSocket', 'To') self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) - self.add_output('ArmVectorSocket', 'Value') self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') self.add_output('ArmNodeSocketAction', 'Done') + self.add_output('ArmVectorSocket', 'Value') def draw_buttons(self, context, layout): layout.prop(self, 'property0') From ca966588ffa4fe1fdcb220029d144eb8f6948373 Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Mon, 13 Sep 2021 23:10:31 +0200 Subject: [PATCH 6/6] add documentation --- blender/arm/logicnode/math/LN_tween_float.py | 23 +++++++++++++++++-- .../arm/logicnode/math/LN_tween_rotation.py | 23 +++++++++++++++++-- blender/arm/logicnode/math/LN_tween_vector.py | 23 +++++++++++++++++-- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/blender/arm/logicnode/math/LN_tween_float.py b/blender/arm/logicnode/math/LN_tween_float.py index 53e50db3..27b626e7 100644 --- a/blender/arm/logicnode/math/LN_tween_float.py +++ b/blender/arm/logicnode/math/LN_tween_float.py @@ -1,7 +1,26 @@ from arm.logicnode.arm_nodes import * class TweenFloatNode( ArmLogicTreeNode): - '''Tween a float value''' + '''Tween a float value + + @input Start: Start tweening + + @input Stop: Stop a tweening. tweening can be re-started via the `Start`input + + @input From: Tween start value + + @input To: Tween final value + + @input Duration: Duartion of the tween in seconds + + @output Out: Executed immidiately after `Start` or `Stop` is called + + @output Tick: Executed at every time step in the tween duration + + @output Done: Executed when tween is successfully completed. Not executed if tweening is stopped mid-way + + @output Value: Current tween value + ''' bl_idname = 'LNTweenFloatNode' bl_label = 'Tween Float' arm_version = 1 @@ -40,7 +59,7 @@ class TweenFloatNode( ArmLogicTreeNode): self.add_input('ArmNodeSocketAction', 'Stop') self.add_input('ArmFloatSocket', 'From', default_value = 0.0) self.add_input('ArmFloatSocket', 'To', default_value = 0.0) - self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) + self.add_input('ArmFloatSocket', 'Duration', default_value = 1.0) self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') diff --git a/blender/arm/logicnode/math/LN_tween_rotation.py b/blender/arm/logicnode/math/LN_tween_rotation.py index 24ca1309..1e113cbd 100644 --- a/blender/arm/logicnode/math/LN_tween_rotation.py +++ b/blender/arm/logicnode/math/LN_tween_rotation.py @@ -1,7 +1,26 @@ from arm.logicnode.arm_nodes import * class TweenFloatNode( ArmLogicTreeNode): - '''Tween rotation''' + '''Tween rotation + + @input Start: Start tweening + + @input Stop: Stop a tweening. tweening can be re-started via the `Start`input + + @input From: Tween start value + + @input To: Tween final value + + @input Duration: Duartion of the tween in seconds + + @output Out: Executed immidiately after `Start` or `Stop` is called + + @output Tick: Executed at every time step in the tween duration + + @output Done: Executed when tween is successfully completed. Not executed if tweening is stopped mid-way + + @output Value: Current tween value + ''' bl_idname = 'LNTweenRotationNode' bl_label = 'Tween Rotation' arm_version = 1 @@ -40,7 +59,7 @@ class TweenFloatNode( ArmLogicTreeNode): self.add_input('ArmNodeSocketAction', 'Stop') self.add_input('ArmRotationSocket', 'From') self.add_input('ArmRotationSocket', 'To') - self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) + self.add_input('ArmFloatSocket', 'Duration', default_value = 1.0) self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick') diff --git a/blender/arm/logicnode/math/LN_tween_vector.py b/blender/arm/logicnode/math/LN_tween_vector.py index ec4a4eb0..928c6133 100644 --- a/blender/arm/logicnode/math/LN_tween_vector.py +++ b/blender/arm/logicnode/math/LN_tween_vector.py @@ -1,7 +1,26 @@ from arm.logicnode.arm_nodes import * class TweenVectorNode( ArmLogicTreeNode): - '''Tween a vector value''' + '''Tween a vector value + + @input Start: Start tweening + + @input Stop: Stop a tweening. tweening can be re-started via the `Start`input + + @input From: Tween start value + + @input To: Tween final value + + @input Duration: Duartion of the tween in seconds + + @output Out: Executed immidiately after `Start` or `Stop` is called + + @output Tick: Executed at every time step in the tween duration + + @output Done: Executed when tween is successfully completed. Not executed if tweening is stopped mid-way + + @output Value: Current tween value + ''' bl_idname = 'LNTweenVectorNode' bl_label = 'Tween Vector' arm_version = 1 @@ -40,7 +59,7 @@ class TweenVectorNode( ArmLogicTreeNode): self.add_input('ArmNodeSocketAction', 'Stop') self.add_input('ArmVectorSocket', 'From') self.add_input('ArmVectorSocket', 'To') - self.add_input('ArmFloatSocket', 'Time', default_value = 1.0) + self.add_input('ArmFloatSocket', 'Duration', default_value = 1.0) self.add_output('ArmNodeSocketAction', 'Out') self.add_output('ArmNodeSocketAction', 'Tick')