add node to set shape key value

This commit is contained in:
QuantumCoderQC 2021-10-27 20:49:59 +02:00
parent d4f9982768
commit b7cafbb4e3
2 changed files with 39 additions and 0 deletions

View 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);
}
}

View 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')