Scene name

djigneodjigneo Posts: 283

How can you retrieve the title (file name) of the scene?

I'm trying to use

Scene.getFilename()

But that returns "". Using the debugger, I see nothing obvious on Scene or any of its ancestors. (Yes, my scene is saved and has a title.)

Any clues?

Here's my test script:

function GetSceneName() {
 var oScene = Scene; 
 var sSceneName = Scene.getFilename(); 
 
 return sSceneName;
}
print(String("Scene name = '%1'").arg(GetSceneName()));

Here's the output:
Executing Script...
Scene name = ''
Result: 
Script executed in 0 secs 1 msecs.
Post edited by djigneo on

Comments

  • djigneodjigneo Posts: 283
    edited December 1969

    For the benefit of others reading this thread, the tl;dr is:
    It doesn't work because that's a deprecated feature. Maybe in an upcoming release there'll be a proper way to do it.

    In my case, I think I have a work-around, so I'm good.

    Thanks, Richard.

  • V3DigitimesV3Digitimes Posts: 3,051
    djigneo said:

    For the benefit of others reading this thread, the tl;dr is:
    It doesn't work because that's a deprecated feature. Maybe in an upcoming release there'll be a proper way to do it.

    In my case, I think I have a work-around, so I'm good.

    Thanks, Richard.

    Hi djigneo, did you have your "work-around" working? I'd need to catch my scene name, but I still cannot do it, I'm interesting to see if there is a trick! Thanks!

  • djigneodjigneo Posts: 283

    My workaround was that I already had the filename stored in a variable since my script was opening the scene anyway, so I could use that. I haven't found any other way to get to the filename / scene name of an already open scene. I'm certainly interested if anyone ends up finding a solution.

  • V3DigitimesV3Digitimes Posts: 3,051

    Lucky you!!!

    Well ...

    I think the best I have to do is to report this part of my project until the equivalent of "scene.getfilename()" re-becomes scriptable.

    Thanks a lot for the info!

     

Sign In or Register to comment.