Load .mov in scene with python (MotionBuilder 2014)

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  12 December 2014
Load .mov in scene with python (MotionBuilder 2014)

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
 
  12 December 2014

    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:

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

Last edited by kroopson : 12 December 2014 at 11:02 AM.
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:51 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.