ue4plugins / MobuLiveLink

Plugin for MotionBuilder that send data to Unreal Engine
MIT License
152 stars 51 forks source link

How to add scene skeletons with python scripting #24

Open pabloviera15 opened 2 years ago

pabloviera15 commented 2 years ago

Hello,

Mobu 2022 scenes are being corrupted when saved with "UE - LiveLink", so we are trying to automate the device adding process to save the scenes without the device and easily add it with one click in the scene when needed.

We're trying to automate the streamed object list in Mobu using python2. For each MoCap shooting we have a list of skeletal meshes that are driven by "Optitrack LiveLink" on my Mobu scene, we would like to automate the process of adding the retargeted skeletal meshes to the "UE - LiveLink" device.

We've managed to create a "UE - LiveLink" device via scripting and add it to the scene having the device stored as a variable but haven't been able to add any skeletal mesh as a new object using python, could you please help me find the right function to achieve this? We've been trying to use this function " PropertyAdd( (FBComponent)arg1, (FBProperty)arg2) " but no luck so far.

Here's our code:

Import required libraries

import pyfbsdk as fb from pyfbsdk import FBSystem, FBDevice

Create Live Link device and add to the scene

UeLL = FBCreateObject("Browsing/Templates/Devices","UE - LiveLink", "UE - LiveLink") fb.FBSystem().Scene.Devices.append(UeLL)

Here are some of my attempts to add an scene skeleton to the device

michael is the name of the skeleton in the scene that I'm trying to add

objRig1 = pyfbsdk.FBFindModelByLabelName("michael") UeLL.PropertyAdd(objRig1.Components, UeLL.PropertyList[1]) UeLL.PropertyAdd(objRig1, 1) UeLL.PropertyAdd(objRig1, FBModelSkeleton)

I hope someone can help me with this, have a nice one!

P. C.

klateralus commented 2 years ago

It looks like LiveLink Device doesn't have a python support at all and it should be implemented. I've checked the documentation for this git and sounds doable.