Import mp4 files as an object Using Python

Import mp4 files as an object Using Python

Anonymous
Not applicable
2,233 Views
3 Replies
Message 1 of 4

Import mp4 files as an object Using Python

Anonymous
Not applicable

Hey guys I have a question pertaining to mp4

 

From what I can see from tutorials and such there seems to be a way for Maya to import mp4 using the actual program itself (file->import etc.). I was wondering if it was possible to do the same thing but within a script. So far I've seen things like launch() but that just launches the video separate from maya. I wish to have it so that it creates an .mp4 object within the workspace if that makes sense

 

Thanks

Accepted solutions (1)
2,234 Views
3 Replies
Replies (3)
Message 2 of 4

stuzzz
Collaborator
Collaborator

Here's a quick script for "importing" a video to a file node.

 

path = "PathToMyVideo"

filenode = cmds.createNode("file")
cmds.setAttr("%s.fileTextureName" % filenode, path, typ="string")

 

Message 3 of 4

Anonymous
Not applicable

Hey, thanks for the reply,

 

I tried running your script but I don't see anything being created in the outliner (which I'm assuming is what is suppose to happen right?)

Screenshot_1.jpg

0 Likes
Message 4 of 4

stuzzz
Collaborator
Collaborator
Accepted solution

Sorry buddy, I missed your notification.

 

By creating a file node, you are not supposed to see it in Outliner unless Display-> DagObjectsOnly is unticked. 

It's in your scene anyway. To name of your node in encapsulated in the "filenode" variable so to select it just type:

 

cmds.select(filenode, replace=True)