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^^
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 !