Area :: Header
Interested in making Indie games?

Register for a Meet the Experts webinar with Digital-Tutors today!
Discussion Groups

Python

Reply
Member
DavidJamesBailey
Posts: 3
Registered: ‎11-09-2008

Connecting and setting values on Macros in relation constraint

64 Views, 5 Replies
12-02-2010 04:02 AM
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?
Please use plain text.
Valued Contributor
rig_vader
Posts: 78
Registered: ‎08-30-2006

Re: Connecting and setting values on Macros in relation constraint

12-07-2010 04:16 AM in reply to: DavidJamesBailey
Are you using FBConnect() to make the connections?
Please use plain text.
Member
DavidJamesBailey
Posts: 3
Registered: ‎11-09-2008

Re: Connecting and setting values on Macros in relation constraint

12-07-2010 07:31 AM 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!
Please use plain text.
Valued Contributor
rig_vader
Posts: 78
Registered: ‎08-30-2006

Re: Connecting and setting values on Macros in relation constraint

12-07-2010 08:58 AM in reply to: DavidJamesBailey
I'm sure I have some code connecting macros somewhere.. I'll try to find it and post
Please use plain text.
Valued Contributor
rig_vader
Posts: 78
Registered: ‎08-30-2006

Re: Connecting and setting values on Macros in relation constraint

12-08-2010 12:45 AM 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
Please use plain text.
Mentor
middlek
Posts: 190
Registered: ‎08-23-2006

Re: Connecting and setting values on Macros in relation constraint

12-11-2010 10:44 AM in reply to: DavidJamesBailey
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 | ANIMATION TECHNICAL ARTIST
Please use plain text.