Anyway to set startup scene to Most Recent?

As always, forgive me if this has been asked before. I did do a pretty elaborate search, and didn't find anything.

I have a very simple question:

Is there any way to get Studio to set its default startup scene to the "most recent" scene worked on? While I don't particularly mind hitting my File -> Open Recent -> (Scene Name) routine, it does get a little tedious, especially if (for instance) Studio has crashed, and was then restarted.

Preference dialogue options show that I can set my startup scene to just about any static file, but I question why in today's age of frequent autosave and state-save technology, we don't have the ability to set our startup scene to "Most Recent" and just be done with it.

(I could also ask about why no autosave, but based on my searches, that's a whole ravine full of kettles of fish.)

Thanks!

Comments

  • I'm not sure if the most recent scene is accessible to scripting, but if it is you can set DS to run a script that would get and attempt to load the last scene loaded. I'm not sure if the list is updated on loading or on closing though, if the latter a crash woudl mask it (and of course if it didn't then a scene that crashed on load might be a fiddle to resolve).

  • This seems to work, ata  very quick test:

    // Load most recent file// Get the content manager from the applicationvar oContentMgr = App.getContentMgr();// set up an empty container for the recent file listvar aRecentFiles = [];// if we have the content manager, get the recent file listif ( oContentMgr ) {	aRecentFiles = oContentMgr.getRecentFileList();}// now if we managed to get the file list, and if there was at least one recent file,// aRecentFiles should have at least one member.// If not it will still be emptyif ( aRecentFiles.length > 0  ) {	// try opening the first entry (not merging, hence the false value 	// to override the default behaviour)	oContentMgr.openNativeFile( aRecentFiles[ 0 ] , false );} 

    Just ave that as a .dsa file, make sure it works, and once happy set it as your default load item instead of a scene file.

  • Sweet!

    I'll give this a shot later and see how it works. :D

  • ChronopunkChronopunk Posts: 292
    edited September 2020

    Hm. It seems to break right on the first command line.

    I'm checking it out in the Script IDE within Studio and the debugger gives the following:
     

    Debugger commands start with a . (period).

    Any other input will be evaluated by the script interpreter.
    Type ".help" for help.

    4 var oContentMgr = App.getContentMgr();

    Seems to think that App.getContentMgr is the start of a debugger command and throws an error every time I launch the script.

    For now, I'm going to just set it to open to the file I'm working on. Scripting isn't my forte, I'm afraid. I'm good at reading debug logs and finding things my old colleagues used to miss, but actual scripting and I have a sordid and troubled past. :(

    Post edited by Chronopunk on
  • Although now it seems that I've got a problem with Studio hanging every time I quit the application when I set it to my current work scene.

    Wheee.

  • Which version of DS? I thought maybe I'd messed it up when amplifying some of my comments, but it works if pasted into the ScriptIDE in 4.12.1.118 for me. Make sure it is copying the whole thing - my firsta ttempt missed the final } so it wouldn't even parse correctly.

  • macleanmaclean Posts: 2,438

    Yes, it was missing the final brace }

    Now it works.

    I already have a default dome scene which loads when DS opens, so I changed the last line

    oContentMgr.openNativeFile( aRecentFiles[ 0 ] , false );}

    to

    oContentMgr.openNativeFile( aRecentFiles[ 1 ] , false );}

    which opens my 2nd-last scene

    I *think* that's right. Well, it works.... I guess I could do a 2 -5 set for when I'm working day in day out on promo scenes

  • maclean said:

    Yes, it was missing the final brace }

    Now it works.

    I already have a default dome scene which loads when DS opens, so I changed the last line

    oContentMgr.openNativeFile( aRecentFiles[ 0 ] , false );}

    to

    oContentMgr.openNativeFile( aRecentFiles[ 1 ] , false );}

    which opens my 2nd-last scene

    I *think* that's right. Well, it works.... I guess I could do a 2 -5 set for when I'm working day in day out on promo scenes

    That should work, but I'd make the checker

    if ( aRecentFiles.length > 1  ) {

    to be sure that there is a second entry.

  • ChronopunkChronopunk Posts: 292
    edited September 2020

    Which version of DS? I thought maybe I'd messed it up when amplifying some of my comments, but it works if pasted into the ScriptIDE in 4.12.1.118 for me. Make sure it is copying the whole thing - my firsta ttempt missed the final } so it wouldn't even parse correctly.

    4.12.1.118

    I think I have it set up right now, if I'm intepreting your and maclean's commentary properly, there should be a } at the end of the second to last line making the entire script (comments included), look like this:

    // Load the most recent file

    // Get the content manager from the application
    var oContentMgr = App.getContentMgr();

    // set up an empty container for the recent file list
    var aRecentFiles = [];

    // if we have the content manager, get the recent file list
    if ( oContentMgr ) {
        aRecentFiles = oContentMgr.getRecentFileList ();
    }

    // now if we managed to get the file list, and if there was at least one recent file,
    // aRecentFiles should have at least one member.
    // If not it will still be empty
    if ( aRecentFiles.length > 0 ) {
        // try opening the first entry (not merging, hence the false value
        // to override the default behavior)
        oContentMgr.openNativeFile( aRecentFiles[ 0 ] , false );}
    }

    Is this correct?

    Post edited by Chronopunk on
  • No, the code is correct as it stands (or is for me) - I just meant I'd failed to copy the last } across to the ScriptIDE when I tested the posted version earlier.

  • macleanmaclean Posts: 2,438

    Thanks, Richard. I changed that line too.

  • No, the code is correct as it stands (or is for me) - I just meant I'd failed to copy the last } across to the ScriptIDE when I tested the posted version earlier.

    Ah, okay, because I copied it exactly as you wrote it originally and it didn't work. I even left the comments in so I could make sure I knew what was happening where.

    So it should look thusly, yes?

    // Load the most recent file

    // Get the content manager from the application
    var oContentMgr = App.getContentMgr();

    // set up an empty container for the recent file list
    var aRecentFiles = [];

    // if we have the content manager, get the recent file list
    if ( oContentMgr ) {
        aRecentFiles = oContentMgr.getRecentFileList ();
    }

    // now if we managed to get the file list, and if there was at least one recent file,
    // aRecentFiles should have at least one member.
    // If not it will still be empty
    if ( aRecentFiles.length > 0 ) {
        // try opening the first entry (not merging, hence the false value
        // to override the default behavior)
        oContentMgr.openNativeFile( aRecentFiles[ 0 ] , false );
    }

    I admit some confusion, because when I debug the script in the ScriptIDE, I get that bit I posted earlier about the .getContentMgr error in the debugger.

    Unless there's something super obvious I'm missing?

  • No, the code is correct as it stands (or is for me) - I just meant I'd failed to copy the last } across to the ScriptIDE when I tested the posted version earlier.

    Ah, okay, because I copied it exactly as you wrote it originally and it didn't work. I even left the comments in so I could make sure I knew what was happening where.

    So it should look thusly, yes?

    // Load the most recent file

    // Get the content manager from the application
    var oContentMgr = App.getContentMgr();

    // set up an empty container for the recent file list
    var aRecentFiles = [];

    // if we have the content manager, get the recent file list
    if ( oContentMgr ) {
        aRecentFiles = oContentMgr.getRecentFileList ();
    }

    // now if we managed to get the file list, and if there was at least one recent file,
    // aRecentFiles should have at least one member.
    // If not it will still be empty
    if ( aRecentFiles.length > 0 ) {
        // try opening the first entry (not merging, hence the false value
        // to override the default behavior)
        oContentMgr.openNativeFile( aRecentFiles[ 0 ] , false );
    }

    I admit some confusion, because when I debug the script in the ScriptIDE, I get that bit I posted earlier about the .getContentMgr error in the debugger.

    Unless there's something super obvious I'm missing?

    So you just paste it into the ScriptIDE edit window and click the Execute button?

  • ChronopunkChronopunk Posts: 292
    edited September 2020

    So you just paste it into the ScriptIDE edit window and click the Execute button?

    With nothing but a G8F blank figure loaded in the scene, I get this in the Script IDE window:

    Executing Script...
    /src/sdksource/fileinput/dzassetdaz.cpp(6681): 
    Could not find target property for formula: 
    Genesis8Female:/data/DAZ%203D/Genesis%208/Female/Morphs/Raiya/Alison/FHMAlison.dsf#FHMAlison?value in file :
     /data/DAZ%203D/Genesis%208/Female/Morphs/Raiya/Alison/eJCMAlisonEyesClosedR.dsf
    /src/sdksource/fileinput/dzassetdaz.cpp(6681):
     Could not find target property for formula:
     Genesis8Female:/data/DAZ%203D/Genesis%208/Female/Morphs/Raiya/Alison/FHMAlison.dsf#FHMAlison?value in file :
     /data/DAZ%203D/Genesis%208/Female/Morphs/Raiya/Alison/eJCMAlisonEyesClosedL.dsf
    Result: true
    Script executed in 3 secs 377 msecs.

    (I added some carriage returns there to keep the quote text from flying off the page)

    So it looks as though it's executing, but it's also trying to find source data that I know is installed. WHY it's trying to find this data in a completely blank figure, I have no idea.

    When I try it with just a single straight up Genesis 1 figure, I get maybe ten times this many "could not find target property for formula" errors.

    Oh, and Richard, to answer your previous question (sorry, I thought I had but I did not, and I apologize), I'm on 4.12.1.118 Pro 64-Bit.

    I've just restarted my laptop and will try the script again, just to see if that helps.

    Post edited by Chronopunk on
  • It's working now. It didn't every time I tried since the first time, but it is now.

    Log still shows it's looking for those morphs, which is strange, but that may be resolved by a simple clean-and-re-up from DIMM.

    Thanks for bearing with me. :)

  • It's not looking for morphs - those morphs have formulas (ERC Links) pointing to other properties, and it's those DS can't find. Assuming ti isn't a bad reference then since you don't have the target property installed you don't need the link, and the warning is harmless.

  • It's not looking for morphs - those morphs have formulas (ERC Links) pointing to other properties, and it's those DS can't find. Assuming ti isn't a bad reference then since you don't have the target property installed you don't need the link, and the warning is harmless.

    Seems a little odd to me that it would throw warnings like that on something that's verifiably installed, but as it's working now, I'm not going to question it.

    Though, I do admit i'm still curious as to why it's doing that.

  • ChronopunkChronopunk Posts: 292

    So, necro-ing this thread because... after moving over to my new Win10 box, and ensuring that I copied the script over, it no longer works!

    I entered it into the IDE Script editor exactly as before. Aaaaand. Nope.

    I can't think of a good reason why it shouldn't work. But it doesn't.

    Thoughts?

  • Richard HaseltineRichard Haseltine Posts: 100,680

    Does it give an error? Are there any entries in the recent files list?

  • ChronopunkChronopunk Posts: 292

    Richard Haseltine said:

    Does it give an error? Are there any entries in the recent files list?

    No errors, and yes, the scene that I've been working on is listed in the recent files list.

    I'm genuinely stumped. I may nuke the script and rebuild it, just to give it that "clean slate" space.

  • Richard HaseltineRichard Haseltine Posts: 100,680

    You could try inserting various print ( value ); lines to track what it is doing (or use the debugger) and see where it is stopping.

  • ChronopunkChronopunk Posts: 292

    It seems to have an issue with line 5, but it's had that since day one.

    I'll try later tonight after dealing with my daily post-surgery recovery routine and see what I can come up with.

  • ChronopunkChronopunk Posts: 292

    Well, as an update, the script still don't work. Copied directly into the new .dsa file and ensured that I had a scene in the recent files menu, and.... nope.

    I'm stumped.

  • ChronopunkChronopunk Posts: 292

    NEVER MIND.

    I'm an idiot.

    Okay, not so much an idiot as just extremely forgetful. I blame the lingering after effects of my surgery and the brain-fry that comes from prepping to start a new job

    I forgot to set it into the "load file" section of the application's preferences.

    Working fine, now.

    D'oh.

Sign In or Register to comment.