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 / Selecting Handles Through Python
  RSS 2.0 ATOM  

Selecting Handles Through Python
Rate this thread
 
32645
 
Permlink of this thread  
avatar
  • forestg
  • Posted: 31 July 2009 04:03 AM
  • Total Posts: 86
  • Joined: 30 January 2009 04:54 PM

Hi there,

ok, here is a noobie question for you Python experts:

i want to have a way to toggle visibility on multiple handles at once.
i guess there are many ways to do it but i was thinkg of : creating a custom property on a ‘master ctrl’ object. this property will be ‘action’ type which will trigger a script though the relations/script device.

i have to do it through python since visibility is not animatable for handles.

i want to turn off 2d and 3d visibility.

doing all this in 2009.

the major problem is two fold: i have no way of selecting the handle without creating one(the fbHandle class creates a new one each time) + visibility doesn’t seem to be exposed or isn’t listed in FBClass attributes.....

:(

help please

thank you.

GF



Replies: 0
avatar
  • koneal
  • Posted: 31 July 2009 04:44 AM

Hey,

Have you tried just selecting it, and changing the show property?

Try:

FBFindModelByName('Handle')
x
.Selected True
x
.Show False

The handle needs a unique name though. There’s a bug that’s been bothering me where the handle will get renamed if you rename it’s follow object in the UI but it changes to a non-unique name matching the follow object…

If this isn’t what you’re looking for, let me know.

Kevin



Kevin O’Neal
Ubisoft
Montreal, Quebec

Replies: 1
/userdata/avatar/avatar_282997.jpg

Hi Kevin,

sorry for the delay and thanks for your suggestion.

Unfortunately, i had already tried thhat before and it doesn’t work, well, in any case, in 2009 it won’t work, python doesn’t return an error but it doesn’t affect the 2d vis or 3d vis of the handle in question.. PLus, what i wanted was to have a ‘seeking’ function in my script, instead of defining all of them. Just something that searches for all handles in the scene.

Author: forestg

Replied: 13 August 2009 02:01 AM  
avatar
  • forestg
  • Posted: 13 August 2009 02:52 AM

ok,

made some research and homework, here’s what i’ve got now:

from pyfbsdk import *
lApplication = FBApplication()

for h in FBSystem().Scene.Handles:
Vis = h.PropertyList.Find("Show Handles")
if Vis.Data == False:
Vis.Data = True

now i just need a way to break so the script will be a toggling one.(meaning if false, true, if true = false) in programming terms a sort of flipflop.

can anyone give me a pointer on this?

thank you very much. thanks from a very noob.



Replies: 1
/userdata/avatar/avatar_282997.jpg

Forget it

Got it:

from pyfbsdk import *
lApplication = FBApplication()

count = 0


for h in FBSystem().Scene.Handles:
Vis = h.PropertyList.Find("Show Handles")
if Vis.Data == False:
Vis.Data = True
count = +1
if Vis.Data == True and count == 1:
break
if Vis.Data == True and count == 0:
Vis.Data = False

Author: forestg

Replied: 13 August 2009 03:13 AM