Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change render file name prefix with python

3 REPLIES 3
Reply
Message 1 of 4
InvisioMedia
987 Views, 3 Replies

Change render file name prefix with python

Hi,

 

  our scripts before were setting the render file name prefix with python from the scene name, but lately it doesn't work anymore.  Can you tell me how to achieve that please?

 

Many thanks

3 REPLIES 3
Message 2 of 4
Kahylan
in reply to: InvisioMedia

Hi!

 

That depends on how the render gets triggeret in the script. Would you mind posting the code snipped that names the rendered files and starts the render?

Message 3 of 4
InvisioMedia
in reply to: InvisioMedia

 

cmds.setAttr('defaultRenderGlobals.imageFilePrefix', '<RenderLayer>/<Version>/%s_%s_%s_<RenderLayer>_<Version>'%(project,seq,sceneName), type='string')

 

For some reason it was working all the time before, and not anymore.  I am wondering if a change in the maya api has affected this, I know new tokens were introduced as well at some point.

 

Message 4 of 4
Kahylan
in reply to: InvisioMedia

Hi!

 

The code you posted works. But depending on what renderengine you are using, the acutal renderer could overwrite the name. Did you change anything in that regard?

 

Also I can't see the way you are defining your "sceneName" variable, since that one seems to be the one causing problems. When I need the scene name as a variable I usually use the os library to do so. Something like this:

import maya.cmds as cmds
import os

filepath = cmds.file(q=True, sn=True)
filename = os.path.basename(filepath)
sceneName, extention = os.path.splitext(filename)

 

Are there any specific errors you get when you try to rename your file prefix?

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

Post to forums  

Autodesk Design & Make Report