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 / finding a namespace from a selected character from a drop down list...
  RSS 2.0 ATOM  

finding a namespace from a selected character from a drop down list...
Rate this thread
 
61987
 
Permlink of this thread  
avatar
  • Location: Horsham, UK
  • Total Posts: 23
  • Joined: 14 April 2009 11:10 AM

Ok - I have a simple list of characters in my scene displayed in a drop down box… Selecting a character returns the value of the character as per the initial list derived from:

charList = []
scene = FBSystem().Scene
charList = scene.Characters

So I can populate a variable with an individual character…

However - the reason for doing this is to run an export script I have specifically for the chosen character - all the characters in my scene are duplicated apart from namespaces…

How do I find the Namespace of the selected character...? When I try:

varSelectedCharacter.LongName

...all I get is the name as it appears in the Navigator list...?

HELP...!!!



Replies: 0
avatar
  • OmniZ3D
  • Posted: 20 November 2011 05:42 AM

You’ll want to split the string being returned by the LongName to just include the namespace.
You’re probably getting something like “rig 1:Character” and you just want “rig 1”
Try the following

charList []
scene 
FBSystem().Scene
charList 
scene.Characters

for char in charList:
    
theNameSpace char.LongName.split(":")[0]
    
print theNameSpace

Seems like there should be an easier way to get the namespace...like getNameSpace()
the pyMoBu module has just that…
http://www.scottenglert.com/pymo...s.PMBComponent-class.html

Hope this helped :)



Replies: 1
/userdata/avatar/h2fen3w5h_StinkySitThumb.jpg

Thanks Omni...!!

Author: Thaddeus Darwin

Replied: 07 December 2011 02:45 AM