Layouts and Scenes

Is there any way to save the viewport layouts with a scene? Suppose I have a vertical scene 1440x2160, for example. Is there any way to save the scene such that it loads with the viewport panel set to 2 Right, 1 Left?

I suppose a postload script could do it if I know how to set the viewport from a script. :) Thinking about it now, I suppose a script could also set the top right panel to Camera 2 and the left panel to Camera 1 and so forth.

So I suppose now this question is "can this be done without scripting?" 

Comments

  • crosswindcrosswind Posts: 10,314

    Nope, I'm afraid it cannot be done without scripting ~ 

    Besides, a Scene supports no Post Load script other than Post Open script in Preferences > Scene tab > Post Open... and this function is Scene independent, i.e. you have to add some suffix to the DUF file name so as to add  the conditional check in the script to decide which scene or which type of scene loads which Layout ~

  • jmucchiellojmucchiello Posts: 2,304
    edited September 23

    I've started a script. Now the next question. I know F2/Scenes has a spot for post loading a script. Is there anyway to put an autoload script in the scene's DUF? Also, the begin/accept undo doesn't work.

    I want to have two of these scripts. One to set LEFT_RIGHT2 and one for TOP_BOTTOM2. I suppose the script could find the aspect ratio of the scene. But that's something for version 2 or 3. ;)

    
    (function(){
        var vpm = MainWindow.getViewportMgr();
        if (!vpm) {
            print("Could not find Viewport Manager.");
            return;
        }
    
        beginUndo();
        vpm.setLayout(DzViewportMgr.LEFT_RIGHT2);
        var ds = vpm.findUserDrawStyle("Texture Shaded");
    
        for (i = 0; i < vpm.getNumViewports(); ++i) {
            var vp = vpm.getViewport(i);
            if (vp) {
                var v3d = vp.get3DViewport();
                if (v3d && ds) {
                    v3d.setDrawStyle(ds);
                }
            }
        }
    
        var tool = vpm.findTool("DzPickTool");
        if (tool != null) vpm.setActiveTool(tool);
    
        acceptUndo("Load vertical layout");
    
    })()
    
    
    Post edited by jmucchiello on
  • crosswindcrosswind Posts: 10,314

    Ah, yeah! You can refer to this sample to add a data element of Post Load script into a Scene:  https://docs.daz3d.com/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/elements/post_load_script_data_item_add/start

    Then within the Post Load script, load the layout that you want ~  That should be a better way ~ like the product : Camera Magic Plus

    Your script works but unfortunately Undo stack doesn't support the action of switching Viewport layout ~ If you switch it under Window > Viewports, there'll be no Undo stack either ~~

  • jmucchiellojmucchiello Posts: 2,304

    Oh, of course. I forgot the undo doesn't keep layout stuff.

Sign In or Register to comment.