Load .mov in scene with python (MotionBuilder 2014)


#1

Hello,

I am currenlty writting a script that creates a camera, load a video (.mov, that has the same name that my current scene) and apply the video to the camera front plate.

So far the camera part works, but I can’t import the video inside my scene (and google has given me no help :/).

Here is my script :

#Creation of reference camera

referenceCamera = FBCamera(‘Reference’)
referenceCamera.Show = True
#referenceCamera.Selected = True

#Define camera translation and rotation

referenceCamera.SetVector(FBVector3d(0,300,0))
referenceCamera.SetVector( FBVector3d( -90, 90, -90 ), FBModelTransformationType.kModelRotation )

#Define directories

currentFBXFullPath = FBApplication().FBXFileName
currentFBXFolder = os.path.dirname(currentFBXFullPath)
videoFolder = currentFBXFolder + “\VIDEOS\”
currentVideoFullPath = videoFolder + os.path.basename(currentFBXFullPath).replace(".fbx",".mov")

#Import Video
videoReference = FBVideoClip(currentVideoFullPath)
videoReference.Show = True

Here I get no error but I have no video in my scene.
Anybody has any idea of the module to use or why I have no error but no video is loaded in my scene?

Thank you


#2

    videoFolder = currentFBXFolder + "\VIDEOS\\"
    

Here you’re using the backslash, so the python thinks that this \V is some escape character.
Use:
videoFolder = currentFBXFolder + r"\VIDEOS\"
expression and try it again.
You should also run a basic check like:


   [b]if not os.path.exists(currentVideoFullPath[/b]):
   	print "File {0} not found!!!".format([b]currentVideoFullPath[/b])