Load Render Setup JSON file with python

Load Render Setup JSON file with python

Anonymous
Not applicable
6,742 Views
6 Replies
Message 1 of 7

Load Render Setup JSON file with python

Anonymous
Not applicable

Hello all,

 

Is there a python method to load my exported (JSON file) Renderlayer setup with python?

All I can see with "echo all commands" on are the UI commands, which are not useful.

 

I have to say that the Documentation for the new Render Setup system is realy minimal.

 

Thanks in advance!

 

Cheers,

 

David

 

0 Likes
Accepted solutions (1)
6,743 Views
6 Replies
Replies (6)
Message 2 of 7

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

I am looking into this now. I'll need to talk with our engineers about this. It might be a little bit delay because of holiday. Sorry for the inconvenience.

 

Yours,

Li

0 Likes
Message 3 of 7

Anonymous
Not applicable

Hi Li,

 

Thanks you for your response.

Waiting for your feedback!

 

Cheers,

 

David

0 Likes
Message 4 of 7

cheng_xi_li
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

Sorry for keeping you waiting. I've got a solution for you now.

 

import maya.app.renderSetup.model.renderSetup as renderSetup

import json

"""import is decode(jsonObject, importOption, optionalPrefix)
jsonObject is the json string you'll need to import.
importOption could be DECODE_AND_RENAME, DECODE_AND_MERGE, DECODE_AND_OVERWRITE
The optionalPrefix could be none if you don't want a prefix and it is only working with DECODE_AND_RENAME option
"""
def importRenderSetup(filename):
    with open(filename, "r") as file:
        renderSetup.instance().decode(json.load(file), renderSetup.DECODE_AND_OVERWRITE, None)

Hope it helps.

 

Yours,

Li

Message 5 of 7

stormpostproduction
Explorer
Explorer

Hi Li,

 

Thank you very much!

This is exactly what I was looking for!

 

Cheers,

 

David

0 Likes
Message 6 of 7

deven.saxenaP7BD5
Enthusiast
Enthusiast

Hello,

Is there a way to rename the render layer upon import?

What I am trying to do is to export a template_wall render layer and import it via Json and rename it to "wall_01".

0 Likes
Message 7 of 7

pablo.valladares.r
Contributor
Contributor

im try to import a json file like the script to add a render layer but I don't have idea to insert the string of the name of the file "script.json" from the RSTemplates folder
could somebody helpmeet, thank you.

0 Likes