0

I'd like to use python to setup a Vicon streaming device in Motionbuilder 2017.

Vicon Stream Device | Download Page

from pyfbsdk import*

app = FBApplication()
scene = FBSystem().Scene

# Find the device
viconStreamingDevice = FBCreateObject( 'Browsing/Templates/Devices','Vicon Stream Device', "Vicon Stream Device")

# Import the device to the current file
scene.Devices.append(viconStreamingDevice)

# Execute the Device?
# ...

When I click\drag the device into my scene from the asset browser it works correctly. If I use the python script above, the device appears in the scene but doesn't work properly. The images below show what the navigator looks like when I select the device.

Vicon Stream Device | Click\Drag Into Scene

Vicon Stream Device | Python Script

Device information is missing and "model binding:" is greyed out. In addition the scene becomes very fragile and will crash soon after running the script.

What's the difference between click\dragging and using the python script above? Is there a way to import the Vicon Streaming Device to Motionbuilder using python?


Answer Info Below ( Based on Paul Boots Suggestion )

I ended up initializing the device manually and connecting it to a Vicon Shogun session I had open. I set the device offline and saved the file. Below is the code I used in my script to merge the device into the required scenes.

viconStreamDevice = r"D:\ViconStreamDevice.fbx"
MOptions = FBFbxOptions( True, viconStreamDevice )
app.FileMerge( viconStreamDevice, False, MOptions )
Purp
  • 91
  • 1
  • 3
  • 10

1 Answers1

0

I had similar issues with adding devices in a c++ tool. My work around was to create a template file containing my device and open that from the c++ code. You can try same trick using python.

Paul Boots
  • 16
  • 3
  • Thanks Paul, this works. Do you happen to know the reason why creating the device with Python\C++ doesn't work? Or what the difference is between that and a user click and dragging it into the scene is? – Purp Jun 14 '18 at 21:23
  • Hi MB, No, I haven't been able to figure out why this doesn't work. The template based work around is good enough for me as well. – Paul Boots Aug 30 '18 at 20:07