Isotropix Forums

Manipulate a Clarisse project that is not currently open

Clarisse Scripting related topics

Manipulate a Clarisse project that is not currently open

Unread postby bvz2000 » Sat Apr 04, 2020 8:37 pm

Recently our asset publishing system got into a bit of trouble because it was directly manipulating the underlying .project files in a way that introduced some issues when using these files.

Is there a way to use the python Clarisse API to manipulate files that are not currently open? Whether directly in a python interpreter, or running within Clarisse?

-----------------------------------------------------------
Specifically, here is our use case:

A user publishes an asset. An asset is essentially just a portion of a Clarisse project, along with any files it references on disk.

The act of publishing exports the portion of the Clarisse project as its own file to a specific location. Any files that are referenced by this project are also copied to this location.

This exported project is then manipulated so that all the file paths get converted to use a relative path ($PDIR) to point to the new location of its referenced files.

Any referenced projects within this exported project are also treated the same way (the project files are copied to the new location, the files it references are copied to the new location, and that project is updated to point to these new files). This happens recursively so that nested references are preserved.

It is imperative that the original projects not be altered. So all of this manipulation occurs on projects that are not currently open within Clarisse. The end user, just working within their original Clarisse project, will never see their local working copy change in any way. The published asset, however, is also completely self contained and can be moved around on disk from one location to another (thanks to $PDIR).

In order to accomplish all of this (way back in the days of Clarisse 2.0) we wrote code that would directly manipulate the underlying .project text files. That is no longer the ideal way to go about it (I think), so I would like to start using the API to manipulate these files. But that will only work if I can do so without changing or even closing the currently open file. And that would mean modifying these files without actually opening them (at least in the current Clarisse session).

Is there any way to do this? Or is there another way of doing the above that anyone can suggest that preserves the requirement that these files be manipulated, but the current session of Clarisse not be changed in any way?

Thanks!
bvz2000
 
Posts: 415
Joined: Thu Nov 13, 2014 6:05 pm

Re: Manipulate a Clarisse project that is not currently open

Unread postby sam » Wed Apr 08, 2020 9:26 am

Hi Ben,

Sure, why don't you use CNODE for that? It is exactly meant to do stuff like that besides rendering. You have the interactive mode or the ability to run scripts in it.
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 1498
Joined: Fri Jan 25, 2013 11:33 pm


Return to Scripting