Download

Maya LiveView to Unreal

Hi,
I’m currently diving in the unreal api to and I have a hard time getting my head around it.
What i’m trying to do is from Maya, telling unreal to initiate a live link connection, creating a cineCameraActor and add a livelink component and look throught it in the unreal view.
the part to send command to unreal from Maya is done and I can initiate the live link connection and create a cam.
I have several in conveniences with my current script. First I didn’t found a way to prevent the creationof a new livelink conenction if there is already one, so, when I’m trying things up, connections adds up^^
image
the other problem, is that I can’t set a name for my camera
and I’m blocking on the component side. I’m not sure what functions I need to call.

def mayaViewToUnreal():
# - Main Function
initLiveLink()

spawnedCam = createCam()

liveLinkToCam(cam=spawnedCam)

def initLiveLink():
# - Init the liveLink connection
machine_name = socket.gethostname()
busFinder = unreal.LiveLinkMessageBusFinder()
provider = unreal.ProviderPollResult(name=‘Maya Live Link’, machine_name=machine_name)
busFinder.connect_to_provider(provider)

def createCam():
# - Create the cam
cam = unreal.CineCameraActor
camLocation = unreal.Vector(0,0,0)
spawnedCam = unreal.EditorLevelLibrary.spawn_actor_from_class(actor_class=cam, location=camLocation)
# print(spawnedCam)
# print(spawnedCam.get_cine_camera_component())
return(spawnedCam)

def liveLinkToCam(cam):
# - add the liveLink component
liveLinkComp = unreal.LiveLinkComponentController()
liveLinkComp.set_editor_property.component_to_control(cam)
# liveLinkComp.k2_attach_to(cam, socket_name=“None”, attach_type=unreal.AttachLocation.KEEP_RELATIVE_OFFSET, weld_simulated_bodies=True)

Any help is welcome, thanks !

So, I have found how to rename my camera, I just have to change the tag. But I’m still blocked when trying to attach a componnent. I created a LiveLinkComponentControler. the componnet should have a component_to_control attribute, but when I try to set the attribute, I get an error 'object has no attribute ‘component_to_control’
I tried the function attach_to_component, but I get an error too ‘liveLinkComp.attach_to_component(sceneComponent,socket_name=camSocket, location_rule=attachementRule, rotation_rule=attachementRule, scale_rule=attachementRule,weld_simulated_bodies=False)
LogPython: Error: AttributeError: ‘LiveLinkComponent’ object has no attribute ‘attach_to_component’’

So my question is, what am I doing wrong, in the component creation or in the object method to attach a new component