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 / Add Device via Python
  RSS 2.0 ATOM  

Add Device via Python
Rate this thread
 
62764
 
Permlink of this thread  
avatar
  • Location: Orange County, CA
  • Total Posts: 4
  • Joined: 22 August 2006 09:36 PM

Hey all,

I have a question regarding Device addition to a scene via Python. I can’t seem to find anything anywhere. I would like to add a device and then be able to toggle it online or offline if needed.

I saw a post on here from 2008 that stated it was NOT possible without using the FileMerge() command and loading in a saved scene with the device. This will not work for my case. Just wondering if there is such a command in MoBu 2012.

Thanks!

-Brian



Replies: 0
avatar
  • Ollie_D
  • Posted: 17 January 2012 07:26 PM

Still the same I’m afraid.  You are not able to create devices from Python, only modify them once they are there.  As you mentioned, the only way is to merge in a file that has a device in it. 

As it is not always guaranteed that bringing in a device will connect to the desired hardware, especially if you have more than one piece of hardware plugged in.  The best work around I had was to have the user create the device, ensure that it is working with the desired piece of hardware, then run the script, using whatever handle you want to get the device (selection, naming etc).  That way it guarantees that the device is there and working and ready for scripted manipulation.



Replies: 0
avatar
  • koneal
  • Posted: 25 January 2012 02:36 AM

We’ve been getting around this using the FBCreateObject Command and it seems to work without a problem. (In 2010+)

Something like:

lTC FBCreateObject("Browsing/Templates/Devices","LTC""TestLTC")

FBSystem().Scene.Devices.append(lTC)

lTC.RecordMode True

This still has the limitation that all of the properties on standard MB devices that are contained in the UI Layout of the device are not available unless they are in the property list. However you can at least get to online/live/record + information area and anything in the property list.

Cheers,
Kevin



Kevin O’Neal
Ubisoft
Montreal, Quebec

Replies: 0