Need help navigating a folder structure

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

Need help navigating a folder structure

Post by Pete » 18 Mar 2015, 11: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, 15:31
Skype: csaezmargotta
Location: Sydney, Australia
Contact:

Re: Need help navigating a folder structure

Post by csaez » 18 Mar 2015, 12: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: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Need help navigating a folder structure

Post by rray » 18 Mar 2015, 13: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 Jan 5th 2024

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

Re: Need help navigating a folder structure

Post by Pete » 18 Mar 2015, 23:38

Ahhh cool! Thanks guys, that's perfect!

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests