Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Connecting and setting values on Macros in relation constraint
  RSS 2.0 ATOM  

Connecting and setting values on Macros in relation constraint
Rate this thread
 
50060
 
Permlink of this thread  
avatar
  • Total Posts: 3
  • Joined: 09 November 2008 06:43 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?



Replies: 0
avatar
  • Nenox
  • Posted: 06 December 2010 11:16 PM

Are you using FBConnect() to make the connections?



Replies: 1
/img/forum/dark/default_avatar.png

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!

Author: DavidJamesBailey

Replied: 07 December 2010 02:31 AM  
avatar
  • Nenox
  • Posted: 07 December 2010 03:58 AM

I’m sure I have some code connecting macros somewhere.. I’ll try to find it and post



Replies: 1
/img/forum/dark/default_avatar.png

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

Author: Nenox

Replied: 07 December 2010 07:45 PM  
avatar

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 DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn

Replies: 0