Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
graphic:python:maya [2019/06/13 01:16]
ying [Pipeline]
graphic:python:maya [2019/07/08 03:43] (current)
ying [Render Related]
Line 1825: Line 1825:
   * the '​defaultRenderGlobals'​ object, it contains everything in render setting, and can be accessed through this object <code python>   * the '​defaultRenderGlobals'​ object, it contains everything in render setting, and can be accessed through this object <code python>
 cmds.select('​defaultRenderGlobals'​) cmds.select('​defaultRenderGlobals'​)
 +
 +# get current scene name
 +cur_scene = cmds.file(q=1,​ sn=1, shn=1)
 +if cur_scene == '':​
 +    cur_scene = '​untitled'​
 +    print('​Not Name Yet')
 +else:
 +    cur_scene = cur_scene.rsplit('​.',​1)[0]
 +# get render global output name, update to custom name format
 +cur_img_prefix = cmds.getAttr('​defaultRenderGlobals.imageFilePrefix'​)
 +
 +if '<​Scene>'​ in cur_img_prefix:​
 +    result_txt = cur_img_prefix.replace('<​Scene>',​ cur_scene.rsplit('​_',​1)[0])
 +    cmds.setAttr('​defaultRenderGlobals.imageFilePrefix',​result_txt , type='​string'​ )
 </​code>​ </​code>​
     * it maps all the setting in Render Setting - Common Tab,     * it maps all the setting in Render Setting - Common Tab,