It looks like you're new here. If you want to get involved, click one of these buttons!
I've been meaning to make a video for this but haven't had much time but I have a snippet that I created as a test for some recent Kraken work and thought it'd be useful to post here.
What's awesome about Fabric is that you can create KL types in Python. You can even call methods on these types as well. Imagine you had an IK Solver KL type and needed to set it's arguments and evaluate the solver and get it's solved outputs, all from Python. Well, YOU CAN!
For this example though I'm just going to show how to create simple types, create a Canvas Op, and set it's ports via RTVals. Users can expand on this as a lesson.
# =============================== # Softimage Python Script, easily converted to Maya # =============================== import json import FabricEngine.Core as fabric si = Application log = LogMessage sel = si.Selection # Create Null to host Canvas Op on scnRoot = si.ActiveProject3.ActiveScene.Root null = scnRoot.AddNull("myCanvasHost") # Create Canvas Op and port of Scalar Array type canvasOpPath = si.FabricCanvasOpApply(null.FullName, "", True, "", "") si.FabricCanvasAddPort(canvasOpPath, "", "inScalar", "In", "Scalar", "", "") # Load Fabric Client in Python, load Math Ext, and create RTVal Scalar Array client = fabric.createClient() client.loadExtension("Math") # Create RTVal Scalar array and fill it with a Python list rtVal = client.RT.types.Scalar.createArray([3, 2, 1]) # Convert RTVal to JSON object type and then to string scalarArray = rtVal.getJSON().getSimpleType() # Set the Scalar Array on the Canvas Port with string si.FabricCanvasSetArgValue(canvasOpPath, "inScalar", "Scalar", scalarArray) client.close()
With the above script you can replace the Python list
[3,21] with a list that is generated from values inside Softimage, say some Envelope weights for a bone that is driving a mesh, and feed that data back into a Canvas Op on a port.
Hope this helps people tinker a bit.
Kraken Rigging Framework
©Copyright 2017 Fabric Software Inc. All rights reserved. | Privacy