<COMObject <unknown>> es correcto, porque es un objeto. No es como MEL que todo es un string.
Este codigo si funciona:
from win32com.client import constants
xsi = Application
xsiPrint = xsi.LogMessage
def setupDorrito():
if xsi.Selection.Count < 1:
xsiPrint("Select an component!",constants.siError)
return False
root = xsi.ActiveSceneRoot
#create cluster constrained null, setup its look
clsCnsNull = root.AddNull("clsCnsNull")
clsCnsNull.primary_icon.value = 0
clsCnsNull.size.value = 0.1
clsCnsNull.shadow_icon.value = 7
clsCnsNull.shadow_colour_custom.value = 1
clsCnsNull.B.value = 1
clsCnsNull.G.value = 0.5
#make cluster from selection
subComponent = xsi.Selection(0).SubComponent
cnsCls = subComponent.CreateCluster("cnsCls")
#constrain object to cluster
cns = clsCnsNull.Kinematics.AddConstraint("ObjectToCluster",cnsCls)
cns.Parameters("tangent").Value = True
cns.Parameters("dirx").Value = 0
cns.Parameters("diry").Value = -1
cns.Parameters("upvct_active").Value = True
cns.Parameters("upx").Value = 1
cns.Parameters("upy").Value = 0
#make dorrito
dorrito = root.AddNull("dorrito")
dorrito.primary_icon.value = 0
dorrito.size.value = 0.2
dorrito.shadow_icon.value = 8
dorrito.shadow_colour_custom.value = 1
dorrito.G.value = 1
dorrito.shadow_offsetX.value = 0.1
dorrito.shadow_scaleX.value = 0
clsCnsNull.AddChild(dorrito)
dorrito.kinematics.local.transform = XSIMath.CreateTransform()
setupDorrito()
y
from win32com.client import constants
xsi = Application
xsiPrint = xsi.LogMessage
# You add the dorito as a deformer, then select the parent and then the dorito null, then run:
def setupStaticState():
defList = []
clsList = []
for i in xrange(0,len(xsi.Selection),2):
clsList.append(xsi.Selection(i))
defList.append(xsi.Selection(i+1))
for a,b in zip(defList,clsList):
defKineState = a.Properties("Static_KineState")
clsKine = b.Properties("Kinematics")
defKineState.Parameters("orix").AddExpression(clsKine.FullName + ".global.rotx")
defKineState.Parameters("oriy").AddExpression(clsKine.FullName + ".global.roty")
defKineState.Parameters("oriz").AddExpression(clsKine.FullName + ".global.rotz")
defKineState.Parameters("posx").AddExpression(clsKine.FullName + ".global.posx")
defKineState.Parameters("posy").AddExpression(clsKine.FullName + ".global.posy")
defKineState.Parameters("posz").AddExpression(clsKine.FullName + ".global.posz")
# Steven forgot to do scaling. (It's important!)
defKineState.Parameters("sclx").AddExpression(clsKine.FullName + ".global.sclx")
defKineState.Parameters("scly").AddExpression(clsKine.FullName + ".global.scly")
defKineState.Parameters("sclz").AddExpression(clsKine.FullName + ".global.sclz")
setupStaticState()