Isotropix Forums

[PYTHON] First Post - Basic Pipeline Questions

Clarisse Scripting related topics

[PYTHON] First Post - Basic Pipeline Questions

Unread postby sshrestha » Thu Aug 31, 2017 3:16 pm

Hi,

This is my first post here and my first attempt at integrating Clarisse into our pipeline. So, please forgive these noob questions that may already have been asked!

First question - Where's the technical API documentation? The Technical Reference section seems to be sparse and only stubs. I'm checking this on the 3.0 docs site.

Also, I'm looking at the log and using the same commands that Clarisse prints in my test scripts. F.e. to create a new context I use:

Code: Select all
myContext_obj = ix.cmds.CreateContext("myContext", "Global", "project://scene")


While this runs, it does not really return a myContext_obj object to me. Am I supposed to use another module instead of cmds? I was hoping that the clarisse API was more pythonic or PyMEL style so I may be looking at the wrong place.

Clarisse looks like fun though!

Thanks,
Sachin
sshrestha
 
Posts: 7
Joined: Fri Jan 29, 2016 1:16 pm

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby bvaldes » Thu Aug 31, 2017 4:06 pm

Hi,

The Scripting documentation is not online. To find it you have to press F1 inside Clarisse to open the standard doc then on the left menu click on Reference then to Scripting/API.

The CreateContext() function works as expected. Inside of Clarisse if you print an item you get the path of the item instead of a class instance or something similar. If you print the type of myContext_obj, you will see <class 'framework.OfContext'>. So the item is a context, not a simple string. You can then have access to all the functions related to this kind of object.

The Python functions inside of Clarisse are wrapped from C++. It can be confusing at the beginning because it's not really pythonic but if you are comfortable with POO it's quick to master.

Cheers
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 160
Joined: Mon Sep 26, 2016 11:44 am

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby sshrestha » Thu Aug 31, 2017 6:34 pm

Thanks Benoit for providing some context. I'll check out the local docs.

Thanks,
Sachin
sshrestha
 
Posts: 7
Joined: Fri Jan 29, 2016 1:16 pm

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby sshrestha » Fri Sep 01, 2017 1:04 pm

Hi,

I have another question. I'm trying to figure out if I can template nodes/project files in clarisse using certain property tags. F.e. I have created a smart group node and in the Rule section I currently define:

Code: Select all
project://<asset_name>/<pipeline_step>/*

where asset_name could be Rock (which is the first context) and pipeline_step could be MODEL (which is the next context under it).

However, to create a template which can automagically build this path, I was wondering if clarisse can use tags or some sort of property. For e.g. if I'm already in a context, then is there an internal variable or tag that the smart group can refer to? I tried relative unix style paths like:

Code: Select all
project://../../*

but it doesn't seem to work and doesn't make sense either since there would different nodes under project. I'm trying this so I can avoid having to fill this path through a script every time we build a clarisse project for each asset.

Please let me know if there are alternatives to this I may be unaware of.

Thanks,
Sachin
sshrestha
 
Posts: 7
Joined: Fri Jan 29, 2016 1:16 pm

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby bvaldes » Fri Sep 01, 2017 2:44 pm

Hi,

You were almost there! To work inside of a context you just have to use "./" like in a terminal on a Unix OS.
Clarisse will translate this symbol by the path of the group item. So if you want to grab all the items inside of the current context, you just have to write: "./*" inside of the rule attribute.

Cheers
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 160
Joined: Mon Sep 26, 2016 11:44 am

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby sshrestha » Fri Sep 01, 2017 2:53 pm

Aah great! That works. I was trying it within the path itself which does not seem to be a valid option in clarisse. Also, if I build an incorrect path, Clarisse does not seem to warn me with any error outputs in the log. Is there a full debug mode for that?

Also, besides python, is there an expression language within clarisse that can reference its internal node attributes? F.e. when I change the rule on a group node, I see this in the command log:

Code: Select all
["project://ClarisseRock/NEU/bendy_filter.rule[0]"]


So can one access the current node name or attribute (like .rule) in an expression form? This would be very powerful for pipeline.

Thanks much,
Sachin
sshrestha
 
Posts: 7
Joined: Fri Jan 29, 2016 1:16 pm

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby bvaldes » Mon Sep 04, 2017 2:45 pm

Hi,

Indeed there is no warn if there is nothing concerned by the rule. That's because we want groups dynamic so even if, for now, nothing can be grabbed by the group, at any time it can change.

About expression inside of attribute, the feature is on our roadmap.
I don't really understand what you want to do but you can interact with attributes directly in python (set values, get values...).

Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 160
Joined: Mon Sep 26, 2016 11:44 am

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby sshrestha » Tue Sep 05, 2017 1:06 pm

bvaldes wrote:About expression inside of attribute, the feature is on our roadmap.
I don't really understand what you want to do but you can interact with attributes directly in python (set values, get values...).

Yes, I'm aware I can interact with attributes directly in python. I wanted to use expressions in templates similar to Katana's CEL or Gaffer's expressions. I guess I can use python scripts for now.
sshrestha
 
Posts: 7
Joined: Fri Jan 29, 2016 1:16 pm

Re: [PYTHON] First Post - Basic Pipeline Questions

Unread postby sshrestha » Wed Sep 06, 2017 9:39 am

Hi,

Besides using the unix style relative pathing, is there a built in variable like $CTX for the current context that I can use in filepath attributes?

Thanks,
Sachin
sshrestha
 
Posts: 7
Joined: Fri Jan 29, 2016 1:16 pm


Return to Scripting
cron