Isotropix Forums

Get current project from CNode script

Clarisse Scripting related topics

Get current project from CNode script

Unread postby briansilva » Mon Mar 09, 2020 2:27 pm

Hello! I'm running CNode with a script parameter, i.e.:

Code: Select all
cnode my_scene.project -script my_script.py


In my_script, I'm trying to get the current project filename, but get_current_project_filename is returning an empty string:

Code: Select all
cur_proj = ix.application.get_current_project_filename()


Is this a bug, or is there a different way I should get this in a CNode context?
briansilva
 
Posts: 52
Joined: Mon Mar 25, 2019 12:43 pm

Re: Get current project from CNode script

Unread postby anemoff » Mon Mar 09, 2020 3:36 pm

Hi!

It's a bug, please make a bug report. The function `get_current_project_filename` works in Clarisse but not in CNode.

You can work around this bug using the OfVars PDIR and PNAME:
Code: Select all
vars = ix.application.get_factory().get_vars()
pdir = vars.get('PDIR').get_string()
pname = vars.get('PNAME').get_string()
project_file_name = pdir + '/' + pname + '.project'


Cheers
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 282
Joined: Wed Jan 13, 2016 10:10 am

Re: Get current project from CNode script

Unread postby briansilva » Tue Mar 10, 2020 11:45 am

Thanks Anthony!

Bug report submitted, and cheers for the workaround!
briansilva
 
Posts: 52
Joined: Mon Mar 25, 2019 12:43 pm


Return to Scripting
cron