Ways to add a scene saved by script to the "Open Recent" Menu. [Solved]

V3DigitimesV3Digitimes Posts: 3,062

Hello!

I've modified this sript provided by Rob: http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/file_io/save_duf_scene/start for some of my scripts, and my scripts works as intended. BUT the last little touch I would like to add to them is the possiblity to reload the saved scene from the "Open Recent" menu of Daz Studio when scenes are saved by a script, which is presently not the case. For now, the scene saved by script do not appear in this menu.

I don't know at which level this addition to the "open recent" occurs. For now I have found nothing in the "App.getAssetIOMgr()", but maybe this is somewhere else.

I have another solution which would be to locate the AppData/Roaming of users and to "auto edit" via script the "RecentFiles.txt" but I really hesitate doing this... I don't like touching what's in the AppData, and I'm not even sure I'm allowed to do this. :(

Does any one know if it is possible to script the addition of a file to the recent list without scripting the modification of the "RecentFiles.txt", and in this case, can give me some clues to know in which direction I have to look for?

Thanks in advance!

Post edited by V3Digitimes on

Comments

  • rbtwhizrbtwhiz Posts: 2,217

    My apologies for not being around much in the last few months to answer questions, I haven't had time for much more than crunching on 4.9 for a while now.


    To answer your question... Yes, it is possible to add files to the File > Open Recent menu through script without directly editing the "RecentFiles.txt" file. More specifically, you can use DzContentMgr::addRecentFile() like so:

    var oContentMgr = App.getContentMgr();var sFile = oContentMgr.findFile( "People/Genesis 3 Female/Characters/Olympia 7.duf" );if( !sFile.isEmpty() ){	oContentMgr.addRecentFile( sFile );}

    This function automatically checks the list of recent files for the file being added (which you can retrieve using DzContentMgr::getRecentFileList()), moves the position of a file within the list if it was already there and is being added again, and emits the DzContentMgr::recentFileListChanged() signal so that any listeners can react accordingly.

    -Rob

    (Yes, I do realize that this post is the only published documentation of this API at the moment. I have been working on a significant update to the Object Index section of the Scripting documentation, which includes this and much more. Unfortunately, due to what I can only surmise was a recent failed Windows Update that corrupted the MBR of the primary drive in one of my home machines and removed files that are critical to the OS, I am currently rebuilding said machine from scratch with new drives—OS, development environment, supporting applications and configurations, etc. Fortunately, after manually rebuilding the MBR on the affected drive, I have been able to recover all of my working files.)

     

  • V3DigitimesV3Digitimes Posts: 3,062

    Thank you a lot Rob!!! yes

    I added this to my scripts, and of course, it works perfectly. So the missing line was indeed a kind of an "App.something.dosomething()"...

    No worry if sometimes you're not too much available, I know you're very busy!

    I'm sorry about your windows udpate issue. Gosh, when things like this occur it is a real nightmare! I'm happy for you you recovered everything.

    Thanks for all your help during 2015, and I please take my best wishes for a great 2016 year !!!

Sign In or Register to comment.