XPresso - Filename Question

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2013
XPresso - Filename Question

I have some basic experience with XPresso and am trying to create something that will change the filename of the render based upon an object's visibility.

Basically to make the rendered filename 1 of 3 different names depending on which of the 3 objects is visible.

Could someone please either explain how I could do this, or throw a quick XPresso file together to show me as an example?

Thanks!
 
  04 April 2013
you will need your renderdata object for that. Open the render settings and drag the
the targeted renderdata from the render settings list in the right bottom corner into
your xpresso view. you will end up with the renderdata baseList2D referenced in an
object node. now you can access the object node like any other node, including
writing the render path.

building up the final render path string might get a bit clunky in xpresso, but i think
there are some nodes in the system presets to help you with that (never used them).
i personally would do the whole thing in a python node/tag/script, as this would be
much quicker.
 
  04 April 2013
I should have been a little more specific... I was already able to do as you stated. I put the renderdata tag into XPresso. My problem now is working out something to change it from one filename to another.

I've tried all kinds of tags and all they seem to output is a True/False... 0/1 etc.

I can't seem to work out a system with an input switch, or float slider to switch the filename between 2 or more options.

I have no idea how to write a python script.
 
  04 April 2013
Not sure what you mean with that :

Originally Posted by defluxx: My problem now is working out something to change it from one filename to another.I've tried all kinds of tags and all they seem to output is a True/False... 0/1 etc.


a possible python scipt would look something like that:

http://codepad.org/vDQZ7Idf

import c4d, os

def main():
    inex   = op[c4d.ID_USERDATA,1]
    string = op[c4d.ID_USERDATA,2]
    objlst = []

    if isinstance(inex, c4d.InExcludeData):
        for n in xrange(inex.GetObjectCount()):
            objlst.append(inex.ObjectFromIndex(doc, n))
        
        rd           = doc.GetActiveRenderData()
        folder, file = os.path.split(rd[c4d.RDATA_PATH])
        rpath        = os.path.join(folder,string)
        
        for obj in objlst:
            orm = obj.GetRenderMode()
            if orm == 1: state = 'HID'
            else: state = 'VIS'  
            rpath = '{0}_{1}-{2}'.format(rpath, obj.GetName(), state)
        
        rd[c4d.RDATA_PATH] = rpath


it is meant to be used as a python tag. create a python tag, select the tag and
open the add user data dialog. add two elements in the order 1.InExclude and
2.String. The names do not matter, only the order does. The first element is a
list where you can drag the objects into which should be considered, the second
one is base name. it will produce something like that.

Path\BaseName_Obj1-State_Obj2-State..._ObjN-State

\\user\Folder\foo_Cube-HID_Cube.1-VIS_Cube.2-VIS

edit: it uses the render visibilty state as the agrument for the whole method.
and it respects the set path in your rdata. so the string is really just the
basename.

when you have set your render path to '\\somepath\somefile.ext' the output
will be '\\somepath\basename_objectpostfix.ext'

Last edited by littledevil : 04 April 2013 at 03:23 PM.
 
  04 April 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:30 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.