Need help navigating a folder structure

Discussions concerning programming of SOFTIMAGE©
User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Need help navigating a folder structure

Post by Pete » 18 Mar 2015, 10:53

Hi there,

Hey I'm having a bit of trouble with this script that should be pretty straight forward but I'm not very good at navigating order structures outside of xsi through scripting.
I want to save a file in a directory that is outside of the project and I don't really want to use specific directly names (so I can reuse it on other projects).

Image

I'm starting off from within Project_XSI and I want to save into Project_Unity
I can get the project folder with with var ScenePath = Application.ActiveProject2.Path+"" but does anyone have any suggestions on where I could go from there?

Sorry it's a little hard to explain, but if anyone has any suggestions it would be great!
Thanks,
Pete

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 13:31
Skype: csaezmargotta
Location: Sydney, Australia

Re: Need help navigating a folder structure

Post by csaez » 18 Mar 2015, 11:53

Hi Pete,

I don't have Softimage in front of me, but looks like an easy task for python.
The snippet below should print the path to the parent directory of the current project.

Code: Select all

import os
from sipyutils import si

project_path = si().ActiveProject2.Path
parent_path = os.path.join(project_path, "..")
print os.path.normpath(parent_path)  # prints normalized path
Hope this helps,
Cheers!

User avatar
rray
Moderator
Posts: 1810
Joined: 26 Sep 2009, 13:51
Location: Bonn, Germany

Re: Need help navigating a folder structure

Post by rray » 18 Mar 2015, 12:03

yes, ".." for parent directory can be a part of the path, it should work the same in any scripting language if you have a path like

var ScenePath = Application.ActiveProject2.Path+""

do..

var path_pic_in_other_folder = ScenePath +"\\..\\Project_Unity\\hihih.jpg"
softimage resources section updated Sep 26th 2026

User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Re: Need help navigating a folder structure

Post by Pete » 18 Mar 2015, 22:38

Ahhh cool! Thanks guys, that's perfect!