uncle808us opened this issue on Jul 14, 2021 ยท 13 posts
HartyBart posted Thu, 15 July 2021 at 10:04 AM
Thanks for the complement. It sounds like you're a Poser comics maker, and that's why you need the real-time preview renders?
Here is a working and tested 1.2 version of the above script. It tries to clear as much as possible of the clutter off a Preview render, and works with a parented Grouping box in the scene. Thanks to RedPhantom for the working solution, which is now encapsulated in this script.
# Clear PREVIEW scene of unwanted guide gunk, before auto-rendering to PREVIEW. Then restore.
# Your Poser 11 scene is assumed to have it it a GROUND and one visible GROUP box.
# Version 1.2 working and with Grouping fix - thanks to RedPhantom for this part of the solution.
import poser
scene = poser.Scene()
# Turn off PREVIEW visibility of "Grouping 1" grouping box.
# To do this we first select the Grouping box by its given internal name
# and set it as the current actor
scene.SelectActor(scene.Actor("Grouping 1"))
actor = scene.ActorByInternalName("Grouping 1")
# We set its Display Object mode to Texture Shaded in the Viewport.
poser.ProcessCommand(1409)
# We set its Transparency from 0 to 1 - which makes it invisible in the Viewport and in PREVIEW.
# To call this we have to use internal "Transparency_Max" label not the obvious "Transparency" label.
# Not sure this part is done "right", but it works.
materials = actor.Materials()[0]
materials.SetTransparencyMax(1.0)
scene.DrawAll()
# Grouping box can still be manually selected and used, but is now invisible to the Viewport
# and to PREVIEW, while its parented items remain visible. We will have the script restore the
# Grouping box later, after a PREVIEW render has been made.
# We now ensure all our scene lights do not display their guide-wires or wireframes in PREVIEW.
if (scene):
lights = scene.Lights()
for light in lights:
if (light.LightOn()):
light.SetOnOff(0)
else: light.SetOnOff(0)
# We then try to ensure current selection's DisplayOrigin guides (aka 'axis wires' or 'green rods'
# or sometimes a 'purple ball') are off in PREVIEW. These can be left on by accident or can be
# auto-activated on coming back from SKETCH Designer to the Viewport for a PREVIEW render (bug?).
for actor in scene.Actors():
actor.SetDisplayOrigin(0)
# It's possible the above bit may not work except in certain circumstances (i.e. coming back to
# a Preview viewport after making a Sketch render, and finding a purple DisplayOrigin ball),
# and thus ideally you have no such DisplayOrigin points visible in your scene when you render.
# Now we hide all Deformers in the scene, such as magnets, force fields, waves. Visibility of
# these is restored later.
poser.ProcessCommand(1471)
# Select the GROUND to make absolutely sure no bounding boxes, figure circles or similar are
# displaying on figures or props. GROUND must be present in the scene, but nearly always is.
scene.SelectActor(scene.Actor("GROUND"))
# Have OpenGL redraw the cleaned PREVIEW scene viewport, ready for rendering.
scene.DrawAll()
# Auto-render the scene to PREVIEW according to your currently-set dpi resolution and render size.
scene.SetCurrentRenderEngine(poser.kRenderEngineCodePREVIEW)
scene.Render()
# GROUND is still selected. Re-select the Grouping box ready to reverse its invisibility.
scene.SelectActor(scene.Actor("Grouping 1"))
actor = scene.ActorByInternalName("Grouping 1")
# Now restore transparency on the Grouping box.
materials = actor.Materials()[0]
materials.SetTransparencyMax(0.0)
# Then have the Grouping box go back to its original wireframe Display Mode.
poser.ProcessCommand(1421)
# Finally, unhide all Deformers in the scene, such as magnets, force fields, waves.
poser.ProcessCommand(1470)
# Redraw the restored scene.
scene.DrawAll()
Still to do - work out how to cope with a scene with two or more Grouping boxes in it. Make the DisplayOrigin section work better. But for now, enjoy.
Learn the Secrets of Poser 11 and Line-art Filters.