[Sidefx-houdini-list] Changing paths from mantra -P at render time

Sandy Sutherland sandy.maillists at gmail.com
Thu Apr 12 11:59:06 EDT 2018


Yep sorry Matthew - trying to type up the email probably missed them.

Entire code below -

import mantra
import os


def _temp_path():
    return 'C:/Users/sandys/TESTRENDER'


def _new_path(path):
    return '{0}/{1}'.format(_temp_path(), path.split('/')[-1])


def _valid_path(path):
    if path.startswith('/mnt') or os.environ['PROJECT'] in path or
os.environ['OUTPUT'] in path or os.environ['IFD'] in path:
        if _temp_path() not in path:
            return True
    return False


def filterPlane():
    currpath = mantra.property('image:filename')[0]
    if currpath and _valid_path(currpath):
        newpath = _new_path(currpath)
        print '***************** switch out image path {0} with {1}
*****************'.format(currpath, newpath)
        mantra.setproperty('image:filename', newpath.split())
    aovpath = mantra.property('plane:planefile')[0]
    if aovpath and _valid_path(aovpath):
        newpath = _new_path(aovpath)
        print '***************** switch out AOV path {0} with {1}
*****************'.format(aovpath, newpath)
        mantra.setproperty('plane:planefile', newpath.split())




On 12 April 2018 at 16:37, Matthew Kearney <shadow.matte at gmail.com> wrote:

> Hey Sandy!
>
> Might just be a typo but you appear to have some quotes missing (see red
> text):
>
> mantra.setproperty(plane:planefile, newpath.split())
>
> Matt.
>
> On 12 April 2018 at 17:34, Sandy Sutherland <sandy.maillists at gmail.com>
> wrote:
>
> > Hi All,
> >
> > We are in progress with a complete revamp of the publishing and
> versioning
> > toolset here.
> >
> > One thing I am investigating is switching paths at render time, so as to
> > publish.
> >
> > Right now mantra -P using the below snippet works, but when I try the
> same
> > with aovs, it is doing strange things, and is actually breaking the
> python
> > script I create - actually messes it up.
> >
> > Change Image path -
> >
> > def filterPlane():
> >     currpath = mantra.property('image:filename')[0]
> >     # Do new path stuff
> >     mantra.setproperty('image:filename', newpath.split())
> >
> >
> > If I use -
> >     currpath = mantra.property('plane:planefile')[0]
> >     # Do new path stuff
> >     mantra.setproperty(plane:planefile, newpath.split())
> >
> > Everything goes haywire.
> >
> > Any suggestions?
> >
> > Thanks
> >
> > Sandy
> > _______________________________________________
> > Sidefx-houdini-list mailing list
> > Sidefx-houdini-list at sidefx.com
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >
>
>
>
> --
>
> *MATT KEARNEY*
> "*Reality is merely an illusion, albeit a persistent one.*" - Albert
> Einstein.
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>


More information about the Sidefx-houdini-list mailing list