Last active
June 30, 2016 16:01
-
-
Save EricTRocks/e8c4525b505a2ca8a902553c43722c9f to your computer and use it in GitHub Desktop.
Get default value from instanced Fabric node in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FabricEngine.Core | |
import json | |
# import FabricEngine.Core.CAPI as capi | |
client = FabricEngine.Core.createClient({'guarded': True}) | |
client.loadExtension('Math') | |
client.loadExtension('Kraken') | |
registeredTypes = client.RT.types | |
typeDescs = client.RT.getRegisteredTypes() | |
host = client.DFG.host | |
opBinding = host.createBindingToPreset("Kraken.Solvers.Biped.BipedFootSolver2") | |
node = opBinding.getExec() | |
portTypeMap = { | |
0: 'In', | |
1: 'IO', | |
2: 'Out' | |
} | |
portCount = node.getExecPortCount() | |
for i in xrange(portCount): | |
portName = node.getExecPortName(i) | |
portConnectionType = portTypeMap[node.getExecPortType(i)] | |
rtVal = opBinding.getArgValue(portName) | |
portDataType = rtVal.getTypeName().getSimpleType() | |
defVal = node.getPortDefaultValue(portName, portDataType) | |
print "Port Name: " + portName | |
print "Connection Type: " + portConnectionType | |
print "Current Value: " | |
print rtVal | |
print "Port Data Type: " + portDataType | |
print "Default Value: " | |
print defVal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment