add node to set shape key value
This commit is contained in:
parent
d4f9982768
commit
b7cafbb4e3
23
Sources/armory/logicnode/SetObjectShapeKeyNode.hx
Normal file
23
Sources/armory/logicnode/SetObjectShapeKeyNode.hx
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package armory.logicnode;
|
||||||
|
|
||||||
|
import iron.object.MeshObject;
|
||||||
|
|
||||||
|
class SetObjectShapeKeyNode extends LogicNode {
|
||||||
|
|
||||||
|
public function new(tree: LogicTree) {
|
||||||
|
super(tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
override function run(from: Int) {
|
||||||
|
var object: Dynamic = inputs[1].get();
|
||||||
|
var shapeKey: String = inputs[2].get();
|
||||||
|
var value: Dynamic = inputs[3].get();
|
||||||
|
|
||||||
|
if (object == null) return;
|
||||||
|
var sk = cast(object, MeshObject).morphTarget;
|
||||||
|
if(sk == null) return;
|
||||||
|
|
||||||
|
sk.setMorphValue(shapeKey, value);
|
||||||
|
runOutput(0);
|
||||||
|
}
|
||||||
|
}
|
16
blender/arm/logicnode/object/LN_set_object_shape_key.py
Normal file
16
blender/arm/logicnode/object/LN_set_object_shape_key.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from arm.logicnode.arm_nodes import *
|
||||||
|
|
||||||
|
class SetObjectShapeKeyNode(ArmLogicTreeNode):
|
||||||
|
"""Sets shape key value of the object"""
|
||||||
|
bl_idname = 'LNSetObjectShapeKeyNode'
|
||||||
|
bl_label = 'Set Object Shape Key'
|
||||||
|
arm_section = 'props'
|
||||||
|
arm_version = 1
|
||||||
|
|
||||||
|
def arm_init(self, context):
|
||||||
|
self.add_input('ArmNodeSocketAction', 'In')
|
||||||
|
self.add_input('ArmNodeSocketObject', 'Object')
|
||||||
|
self.add_input('ArmStringSocket', 'Shape Key')
|
||||||
|
self.add_input('ArmFloatSocket', 'Value')
|
||||||
|
|
||||||
|
self.add_output('ArmNodeSocketAction', 'Out')
|
Loading…
Reference in a new issue