MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connecting and setting values on Macros in relation constraint

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
656 Views, 5 Replies

Connecting and setting values on Macros in relation constraint

Hi there,

I am having trouble making connections and setting values on Macro boxes within a relation constraint with python. When trying to create a connection there is no error but nothing happens, and when trying to write data to an input it will error:

AttributeError: 'NoneType' object has no attribute 'WriteData'

I have tried changing the 'Input' and 'Output' names but cannot find a way to make it work. Any ideas?
5 REPLIES 5
Message 2 of 6
rig_vader
in reply to: Anonymous

Are you using FBConnect() to make the connections?
Message 3 of 6
Anonymous
in reply to: rig_vader

Yes I use FBConnect() to try and make the connections between the Macro boxes, it doesn't work, but it works fine between any other type of Box!
Message 4 of 6
rig_vader
in reply to: Anonymous

I'm sure I have some code connecting macros somewhere.. I'll try to find it and post
Message 5 of 6
rig_vader
in reply to: rig_vader

I think I might have hooked up macros from python at some point.. but unfortunately I'm hazy on the when and how. I could not find anything in my code base, but I remember having the same issue - I think I must have choosen a workflow that did not require me to hook up macros from Python. Sorry
Message 6 of 6
middlek
in reply to: Anonymous

The main issue with not being able to connect to Macro box within a relation constraint is the name you are passing here, is not finding the name:

ConnectBox(inputOutput, 'Output', inputOutput1, 'Input')

You either need to use the function:

FBAnimationNode FindByLabel
(
str 
pNodeLabel
 ) 


Returns the animation node from its label.
Parameters:

pNodeLabel 
Label of the searched animation node.

Returns:
AnimationNode found.

Or you need to look to see what the auto generated names are by MotionBuilder, like this:

lMacro = lRelation.CreateFunctionBox('My Macros', 'HelperBoneControl')
lRelation.SetBoxPosition(lMacro,300,200)

#Testing what the real Animation Node names are, they don't reflect what is in the UI for Macros
lMacroIN = lMacro.AnimationNodeInGet().Nodes
for lAnimationNode in lMacroIN:
print "IN: (%s) " % (lAnimationNode.UserName)

lMacroOUT = lMacro.AnimationNodeOutGet().Nodes
for lAnimationNode in lMacroOUT:
print "OUT: (%s) " % (lAnimationNode.UserName)

lMacroIn = FindAnimationNode( lMacro.AnimationNodeInGet(), 'MacroInput0' )
lMacroOut = FindAnimationNode( lMacro.AnimationNodeOutGet(), 'MacroOutput1' )

~Kristine
KRISTINE MIDDLEMISS | SENIOR MOTION CAPTURE ENGINEER

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report