Setting default layout

I am trying to set the default layout through python.

my Code is:

subprocess.call([rvpushPath, ‘-tag’, ‘test’, ‘merge’, ‘[’, srcPath + ‘/’ +_, ‘-in’, ‘2’, ‘]’, ‘-view’, ‘defaultLayout’])

While using this code, RV loads the media in the defaultLayout. However, its also giving me an error that it is not able to load the -view and defaultLayout as media.

ERROR:

INFO: trying brute force to find an image reader for -view
ERROR: Open of ‘-view’ failed: unsupported media type.
INFO: -view
INFO: trying brute force to find an image reader for defaultLayout
ERROR: Open of ‘defaultLayout’ failed: unsupported media type.
INFO: defaultLayout

Please let me know, How to fix that.

Also, after loading the media in the layout. I have to ‘Align the start frame’. Please let me know the tags for setting this attribute.

Thanks,
Amiy

2 Likes

Hey Amiy,

Thank you for messaging us!

It looks like you might have a syntax issue happening with the srcPath + ‘/’ +_,. I’m not sure what you’re trying to do there, but I’d pass a srcPath that already has a /_ at the end if that’s what you’re parsing in. Either that or try quoting the “_”?

Here’s a command that works for me:

subprocess.call([“/Applications/RV.app/Contents/MacOS/rvpush”, “-tag”, “test”, “merge”, “[”, “/Users/zalipya/Documents/Test Media/multi-layer-part.#.exr”, “-in”, “2”, “]”, “-view”, “defaultLayout”])

Thanks,
Alexa

1 Like

Hi Alexa,

I tried this

subprocess.call([rvpushPath,'-tag', 'test', 'merge', '[', 'C:/Users/ashrivastava/Downloads/test/1.mov', '-in', '2',']', '-view', 'defaultLayout', ])

Result is the same.

Thanks
Amiy

1 Like

I found a solution for this issue. I was doing a loop with -view tag.
It seems that the -view tag is only going to work in the first instance of RV. If I send the same tag in the loop its giving me the error and try to load -view tag as an input field.

Is there a way to check if the RV is loaded with the -tag ‘test’ with rvpush?

Thanks,
Amiy

1 Like

Hey Amiy,

So looks like you might have to accomplish this in two steps.

For the rvpush merge command there’s no way to supply command line arguments outside of media arguments (the ones you can supply in [ and ]). However, you can use rvpush url to use command-line args. Unfortunately rvpush url doesn’t allow to append to the same session…

So you can do a hybrid:

rvpush -tag test merge some/media.mov
rvpush -tag test merge other/media.mov
rvpush -tag test url rvlink:// -view defaultLayout

This should work.

Let us know what you think!

Thanks,
Alexa

1 Like

Hi Alexa,

Its working.

Please let me know the arguments to align the first frame and set the spacing in the default layout.

Thanks,
Amiy

2 Likes

Hey Amiy,

It’s not exposed via the command line but you can still hack your way into evaluating mu/Python through command-line:

rv … -pyeval “import rv;rv.commands.setIntProperty(‘defaultLayout_stack.mode.alignStartFrames’, [1], True);rv.commands.setFloatProperty(‘defaultLayout_stack.layout.spacing’, [0.4], True)”

However, as you can see it’s pretty ugly. If you want to avoid doing this, I’d recommend sending an event instead like -sendEvent process-layout and then bind an RV plugin that will listen to external-process-layout event and set your values via plugin. That way a user won’t have to remember how to do this, and there will be less likelihood of messing it up.

Thanks,
Alexa

1 Like