File > Save Last Draw bitmap / can a script access that?

Is it possible to get the draw buffer that is written by Menu > File > Save Last Draw,
or at least to trigger that save function from a script?

My script currently does [...].get3DViewport().captureImage(),
but this is not the same thing (tools overlays, render aspect ratio, ...)

Thanks for any insights

Comments

  • There are a couple of samples that may help you if you want the action:

    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/actions/action_find_classname/start
    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/actions/action_trigger/start

    If you want the raw data for further processing I don't know if that is possible, other than by saving a file and then loading it back in.

  • cajhincajhin Posts: 154

    Thanks Richard, once more I'm impressed by the breadth and depth of your knowledge (or your search skills - do you have a private search engine??)

    Close, but no cigar. Triggering the action "DzSaveLastDrawAction" does not accept any parameters, so "save the draw pane to file, then load that file" always opens
    "Save Image" dialog, where the user must navigate to the correct folder and save the temp file with the correct filename. Nope...

    Well, it was worth a try.

  • Try http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/rendering/render_drawstyle/start

    (these, by the way, come from Rob not me - though I do now recall some of the relevant samples without prompting.)

  • I know it's been a while so I don't know if you're still looking for your answer, but I found myself trying to to the same thing yesterday and your post nudged me in the right direction.  So, if it helps:

    var outPath = "IMAGE PATH";var vp = MainWindow.getViewportMgr()		.getActiveViewport()		.get3DViewport();// Turn off aspect frame so it's not shown in the output imagevp.aspectOn = false;// Find the position and size of the aspect frame over the viewportvar iDim = [vp.getAspectFrameRect().x,	vp.getAspectFrameRect().y,	vp.getAspectFrameRect().width,	vp.getAspectFrameRect().height];// Capture the viewport and then output a copy of just the portion inside the aspect framevar img = vp.captureImage().copy(iDim[0],iDim[1],iDim[2],iDim[3]);img.save(outPath);vp.aspectOn = true;

    I also encountered a couple of other issues, such as the menu icon overlapping the draw even with most things on auto-hide.  To get around this, I grabbed the pane manager object, undocked the viewport pane and resized it taller than the aspect frame enough that the menu icon did not overlap.  Also good for if you wanted a larger version of the draw; I use for Iray preview so pop out, resize, wait for draw and then save, and return everything to normal.

    I did find grouped nodes had those annoying crosshairs, of course, so I also added a couple of steps to clear any selection and unparent anything under a group node before the draw and reparent them back again afterwards and restore the selection.  Might find other steps are needed if you have any other things with indicators that hang around even when not selected.

    Bit more of a pain than just triggering the Save Last Draw action, but it got me where I needed to be.

Sign In or Register to comment.