0

Resolution change when loading new video into RV, Python

Hi, I've got a python package that uses menu items to load a group of shots. I'm hoping to scale down the resolution of all the shots (proportionally to the number of them) in order to save memory and be able to keep more shots in the cache simultaneously.

I've looked through the Mu documentation, but I don't see any commands for changing the resolution. I feel like there must be one, since you can do it from the menu bar incredibly easily, once you're inside RV. I see the setScale(float) function, but that just sets the display scale, and won't help me deal with my memory limitations.

Any help is appreciated!

 

Thanks,

Ray

댓글 3개

  • 0
    Avatar
    Seth Rosenthal

    Hey Ray,

    In this case you want to change the geometry.scale property on the relevant RVFormat node. The code in python would look something like this:

    rv.commands.setFloatProperty("#RVFormat.geometry.scale", [0.5], True)

    The #RVFormat notation will apply the change to any current RVFormat nodes. So for example if you are in a stack or layout mode it would apply to all of the sources there. If you are in a sequence it would apply to the current source.

    Changing properties is one of the key ways you can interact with the RV session. The other big ones are binding to events and calling commands in the API. You can learn more about properties by looking at the node reference in the Reference Manual, chapter 13.

    One good way to figure out this kind of thing is to check how RV does it in the menus (in this case Image->Image Resolution menu item) and the search for that text from the menu item in the .mu code that comes with RV. That will show you how we are doing it. The conversion from Mu to Python is usually straightforward once you've worked through a few examples.

    Cheers,

    Seth

  • 0
    Avatar
    Ray K

    Hi Seth, thanks for the reply! The RVFormat node looks like it's exactly what I need, however, when I try to execute rv.commands.setFloatProperty("#RVFormat.geometry.scale", [0.5], True) or any similar command that references a node, I get "invalid property name" exceptions (caused by the node reference string).

    I see the code in rvui.mu corresponding to the Image->Image Resolution menu item, and it's not doing anything ontop of what I'm trying to do (as far as I can tell anyway), so I'm not sure what the problem is. It seems like a really generic error, like I don't have the right modules imported, but I think all I should need is rv.commands, which I have.

    Sorry if this is a trivial problem, I'm new to Python and RV.

     

    Thanks,

    Ray



     

  • 0
    Avatar
    Ray K

    Ah so I figured out the cause of that error: I was trying to change the resolution of the sources too soon after adding them. Not sure what has to happen before I am allowed to change the source resolution, but I'll look into it, since I basically want to set the resolution on load. Thanks again for the help Seth!

    Ray

댓글을 남기려면 로그인하세요.