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).
Ah, indeed it is http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentmgr_dz#a_1a0b5cf8cc56392f37addd0fdb0843bd81
This seems to work, ata very quick test:
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
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:
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. :(
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.
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.
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:
Is this correct?
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.
Thanks, Richard. I changed that line too.
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?
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?
With nothing but a G8F blank figure loaded in the scene, I get this in the Script IDE window:
(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.
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.
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.
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?
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.
You could try inserting various print ( value ); lines to track what it is doing (or use the debugger) and see where it is stopping.
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.
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.
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.