Isotropix Forums

Maintaining context hierarchy upon import

Clarisse related tips and tricks

Maintaining context hierarchy upon import

Unread postby shadow92 » Tue Jan 14, 2020 5:19 pm

Hey folks,
I was wondering if there is a way how to maintain a context hierarchy of imported project into another one instead of it collapsing into a context named after imported project.
Im not sure if it's clear enough like this, so I will provide an example:

In my scenes I use a predefined set of contexts, such as:

Project
scene
objects/materials/textures/lights
<==== these are on same level, couldn't think of better way how to describe the structure

Now let's say I have an empty scene with context set up like on example above. I have another project, let's say KB3D_Assets. This project would contain only KB3D buildings, textures and materials, structured according the same hierarchy as above (geometry in "objects", materials in "materials", etc). Purpose of it is to act as import-ready project, so I can create it once and then put it into my projects whenever I need without the need of starting from scratch.

My problem is that when I import this KB3D project into my main one, instead of "merging" the same contexts together (just like folders in Windows, for example), it creates a new context under Project/Scene called "KB3D_Assets", with it's hierarchy and all the content inside of it.

I hope it's clear what Im attempting to do from this. Can it be achieved? How would you go about it?

Entire purpose of this is to have a library of import-ready assets such as those from KB3D, or some set of trees, whatever. Just to create it once and then just import it whenever needed, without breaking the context structure etc.

Thanks!

EDIT: I tried also using a command ix.cmds.MergeProject, but it doesnt merge the contexts together, instead it creates context named like "objects1", "materials1", etc...

EDIT2: It looks like using commands to rename and move contexts to correct place could be the way to do it (I want use commands instead of doing it manually so I can save that script to shelf). I can import project, rename context, delete context using ix.cmds commands, however I cant figure out how to Copy/Paste or cut/paste context from one location to another using ix.cmds. Any idea? I cant find it anywhere.
shadow92
 
Posts: 18
Joined: Wed Jun 13, 2018 12:46 am

Re: Maintaining context hierarchy upon import

Unread postby dboude » Wed Jan 15, 2020 9:54 am

Hi,

Copy, Cut, Paste are application commands. It starts with ix.application.

You have some example here :

https://forum.isotropix.com/viewtopic.php?f=21&t=4039&p=17750&hilit=copy+paste#p17750

Cheers
Démian
Isotropix
Technical Artist - Clarisse Specialist
User avatar
dboude
 
Posts: 1342
Joined: Mon Jul 03, 2017 10:51 am

Re: Maintaining context hierarchy upon import

Unread postby shadow92 » Sat Jan 18, 2020 11:08 am

Hey dboude,
thanks for you reply. And sorry for a delay in my answer - I did not actually understand the function of those scripts in link you provided, to be honest. I could not make it work that way,
however I managed it to work with ix.cmds.MoveItemsTo, which does exactly what I was looking for. And, what is important, it does not break the link between assigned materials.

But I have other question related to this - I'm using my dropbox path to import these scenes and I noticed clarisse messes up the file path upon import:

Script says
ix.cmds.ImportProject(["C:\Dropbox\my name\Clarisse Scenes\..."])

And I get an error:
Failed to import project 'C:\Dropboxmy name\Clarisse Scenes\...'.

As you can see it replaces part of the path with  for some reason
Last edited by shadow92 on Sun Jan 19, 2020 1:45 am, edited 1 time in total.
shadow92
 
Posts: 18
Joined: Wed Jun 13, 2018 12:46 am

Re: Maintaining context hierarchy upon import

Unread postby shadow92 » Sat Jan 18, 2020 6:21 pm

Found the answer on discord (thanks Yanik):

proper path should be like:
ix.cmds.ImportProject([r"C:\Dropbox\my name\Clarisse Scenes\..."])

notice the r added before the opening quotation mark of the filename. It is a raw string, otherwise it can mess up the path name
shadow92
 
Posts: 18
Joined: Wed Jun 13, 2018 12:46 am

Re: Maintaining context hierarchy upon import

Unread postby dboude » Mon Jan 20, 2020 9:24 am

Cool that you found a way to do what you want.

Cheers
Démian
Isotropix
Technical Artist - Clarisse Specialist
User avatar
dboude
 
Posts: 1342
Joined: Mon Jul 03, 2017 10:51 am


Return to Tips and Tricks