Flame Forum
Welcome to Autodesk’s Flame Family (Flame, Flare, Flame Assist, Lustre) Forums. Share your knowledge, ask questions, and explore popular Flame topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cache imported media with Python

2 REPLIES 2
Reply
Message 1 of 3
jonas.lindfors
372 Views, 2 Replies

Cache imported media with Python

Hi,

 

I'm importing an image sequence with python and when it's imported I want to cache the media, but I can't get it to work..

 

This is my code:

 

import flame


#path to image sequence

clip_path = '/mnt/VFX_PROJECTS/path_to_my_sequence/200_010_PLATE_v001.[1001-1015].exr'

 

# Grabbing a folder in library

folder = flame.project.current_project.current_workspace.libraries[1].folders[0]

 

# importing the clip (which works fine)
imported_clip = flame.import_clips(clip_path, folder)[0]

 

# trying to cache the clip
imported_clip.cache_media()

 

And it errors out with

RuntimeError: Clip no longer exist.

 

Does anyone know what I'm doing wrong here?

 

I'm on Flame 2020.1 / linux

 

Thanks,

Jonas

Tags (2)
2 REPLIES 2
Message 2 of 3
stefan-g
in reply to: jonas.lindfors

Hello,

I'm far from a python expert so please forgive my approximations ...

I originally thought that your imported_clip object only existed at import time.

I tried the following (replacing the end of your script) and it worked:

my_clip = flame.project.current_project.current_workspace.libraries[1].folders[0].clips[0]

print "my_clip name: ", my_clip.name

my_clip.cache_media()

 

BUT ... then i tried again your version, only living the line defining 'my_clip' from my added stuff...
And it worked! Somehow defining 'my_clip' (as the clip you just imported) revived your 'imported_clip'
Don't know what's going on ... 

Stefan

Message 3 of 3
jonas.lindfors
in reply to: stefan-g

Hi Stefan, thanks for this!

 

Interesting. So if I understand you correctly, you defined my_clip variable pointing to:

flame.project.current_project.current_workspace.libraries[1].folders[0].clips[0]

 

And then you could still  use the original variable which I called "imported_clip" ?

 

I will definitely try this out.

 

Using flame.project.current_project.current_workspace.libraries[1].folders[0].clips[0] would not necessarily give me the clip that I just imported, but instead the first clip in the list of clips in that folder. But I guess I could always use that list and loop to find the clip that I just imported otherwise.

 

Thanks a lot, will try it out as soon as I get my hands on one of our Flames again hehe.. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report