POV: Fix POV specific primitives

Using object.update_tag() as pov specific object typing property set from python would not be visible from depsgraph before file save, causing mesh proxies to export rather than their pure untesselated pov shapes.
This commit is contained in:
Maurice Raybaud 2022-05-01 18:45:27 +02:00
parent 478f0466d5
commit 015248ed8d
4 changed files with 28 additions and 11 deletions

View File

@ -27,13 +27,13 @@ render_gui.py :
Display properties from render_properties.py for user to change them
render.py :
Translate render properties (Blender and POV native) to POV, ini file and bash
Translate render properties (Blender and POV native) to POV, ini file and CLI
__------------------Z__
_--¨¨] | __ __ _____________||
_-¨7____/ | | °|° | ||
(===========|=| | |=============||
`-(@)@)--------------------(@)(@)-'
`-,_(@)(@)----------------(@)(@)-'
############################################# LAYOUT ##############################################
scenography_properties.py
@ -49,7 +49,7 @@ scenography.py
_--¨¨] | __ __ _____________|||____________________|
_-¨7____/ | | °|° | ||| |
(===========|=| | |=============|||====================|
`-(@)@)--------------------(@)(@)-^-(@)(@)--------(@)(@)-
`-,_(@)(@)----------------(@)(@)-'^-(@)(@)--------(@)(@)'
############################################### MODEL #############################################
model_properties.py :
@ -80,7 +80,7 @@ model_primitives_topology.py :
_--¨¨] | __ __ _____________|||____________________|||____________________
_-¨7____/ | | °|° | ||| |||
(===========|=| | |=============|||====================|||====================
`-(@)@)--------------------(@)(@)-^-(@)(@)--------(@)(@)-^-(@)(@)--------(@)(@)
`-,_(@)(@)----------------(@)(@)-'^-(@)(@)--------(@)(@)-^-(@)(@)--------(@)(@)
############################################ SHADING #############################################
shading_properties.py :
@ -111,7 +111,7 @@ texturing_procedural.py :
_--¨¨] | __ __ _____________|||____________________|||____________________|||________________
_-¨7____/ | | °|° | ||| ||| |||
(===========|=| | |=============|||====================|||====================|||================
`-(@)@)--------------------(@)(@)-^-(@)(@)--------(@)(@)-^-(@)(@)--------(@)(@)-^-(@)(@)----------
`-,_(@)(@)----------------(@)(@)-'^-(@)(@)--------(@)(@)-^-(@)(@)--------(@)(@)-^-(@)(@)----------
############################################ VFX/TECH #############################################
particles_properties.py :

View File

@ -351,14 +351,13 @@ def objects_loop(
% povdataname,
)
continue # Don't render empty object but this is later addition, watch it.
if mesh_eval_exported := model_poly_topology.export_mesh(file, ob, povdataname,
if ob.pov.object_as:
pass
else:
model_poly_topology.export_mesh(file, ob, povdataname,
material_names_dictionary,
unpacked_images,
tab_level, tab_write, linebreaksinlists):
pass # XXX Caution pass may write both proxy mesh and primitive, so propagate a test
# for non mesh_eval_exported or switch back other primitives before meshes
else:
continue
tab_level, tab_write, linebreaksinlists)
# ------------ Povray Primitives ------------ #
# Also implicit elif (continue) clauses and sorted after mesh

View File

@ -126,6 +126,7 @@ class POV_OT_plane_add(Operator):
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.object.shade_smooth()
ob.pov.object_as = "PLANE"
ob.update_tag() # as prop set via python not updated in depsgraph
return {"FINISHED"}
@ -154,6 +155,7 @@ class POV_OT_box_add(Operator):
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")
ob.pov.object_as = "BOX"
ob.update_tag() # as prop set via python not updated in depsgraph
return {"FINISHED"}
@ -180,6 +182,7 @@ def pov_cylinder_define(context, op, ob, radius, loc, loc_cap):
ob.pov.cylinder_location_cap = vec
ob.data.use_auto_smooth = True
ob.pov.object_as = "CYLINDER"
ob.update_tag() # as prop set via python not updated in depsgraph
else:
ob.location = loc
@ -326,6 +329,7 @@ def pov_sphere_define(context, op, ob, loc):
ob.data.use_auto_smooth = True
bpy.ops.object.shade_smooth()
ob.pov.object_as = "SPHERE"
ob.update_tag() # as prop set via python not updated in depsgraph
class POV_OT_sphere_add(Operator):
@ -379,6 +383,7 @@ class POV_OT_sphere_add(Operator):
# bpy.ops.object.mode_set(mode="OBJECT")
# bpy.ops.object.shade_smooth()
# ob.pov.object_as = "SPHERE"
# ob.update_tag() # as prop set via python not updated in depsgraph
# ob.name = ob.data.name = 'PovSphere'
# return {'FINISHED'}
@ -469,6 +474,7 @@ def pov_cone_define(context, op, ob):
ob.data.use_auto_smooth = True
bpy.ops.object.shade_smooth()
ob.pov.object_as = "CONE"
ob.update_tag() # as prop set via python not updated in depsgraph
class POV_OT_cone_add(Operator):
"""Add the representation of POV cone using pov_cone_define() function."""
@ -584,6 +590,7 @@ class POV_OT_rainbow_add(Operator):
ob.data.energy = 0
ob.name = ob.data.name = "PovRainbow"
ob.pov.object_as = "RAINBOW"
ob.update_tag() # as prop set via python not updated in depsgraph
# obj = context.object
bpy.ops.object.constraint_add(type="DAMPED_TRACK")
@ -656,6 +663,7 @@ def pov_torus_define(context, op, ob):
ob.data.auto_smooth_angle = 0.6
bpy.ops.object.shade_smooth()
ob.pov.object_as = "TORUS"
ob.update_tag() # as prop set via python not updated in depsgraph
class POV_OT_torus_add(Operator):
"""Add the representation of POV torus using using pov_torus_define() function."""

View File

@ -56,6 +56,7 @@ class POV_OT_lathe_add(Operator):
mod = ob.modifiers[-1]
mod.axis = "Y"
mod.show_render = False
ob.update_tag() # as prop set via python not updated in depsgraph
return {"FINISHED"}
@ -173,6 +174,7 @@ def pov_superellipsoid_define(context, op, ob):
ob.data.auto_smooth_angle = 1.3
bpy.ops.object.shade_smooth()
ob.pov.object_as = "SUPERELLIPSOID"
ob.update_tag() # as prop set via python not updated in depsgraph
class POV_OT_superellipsoid_add(Operator):
"""Add the representation of POV superellipsoid using the pov_superellipsoid_define()."""
@ -376,6 +378,7 @@ def pov_supertorus_define(context, op, ob):
ob.pov.st_cross = st_n2
ob.pov.st_ie = st_ie
ob.pov.st_edit = st_edit
ob.update_tag() # as prop set via python not updated in depsgraph
class POV_OT_supertorus_add(Operator):
@ -624,6 +627,7 @@ def pov_isosurface_view_define(context, op, ob, loc):
ob.pov.isosurface_eq = eq
ob.pov.contained_by = "box"
bpy.ops.object.mode_set(mode="OBJECT")
ob.update_tag() # as prop set via python not updated in depsgraph
class POV_OT_isosurface_add(Operator):
@ -722,6 +726,7 @@ class POV_OT_isosurface_box_add(Operator):
ob.pov.object_as = "ISOSURFACE_NODE"
ob.pov.contained_by = "box"
ob.name = "PovIsosurfaceBox"
ob.update_tag() # as prop set via python not updated in depsgraph
return {"FINISHED"}
@ -752,6 +757,7 @@ class POV_OT_isosurface_sphere_add(Operator):
ob.pov.object_as = "ISOSURFACE_NODE"
ob.pov.contained_by = "sphere"
ob.name = "PovIsosurfaceSphere"
ob.update_tag() # as prop set via python not updated in depsgraph
return {"FINISHED"}
@ -960,6 +966,7 @@ class POV_OT_height_field_add(bpy.types.Operator, ImportHelper):
# POV-Ray will soon use only forwards slashes on every OS and already can
forward_impath = impath.replace(os.sep, "/")
ob.pov.hf_filename = forward_impath
ob.update_tag() # as prop set via python not updated in depsgraph
return {"FINISHED"}
@ -1047,6 +1054,8 @@ def pov_parametric_define(context, op, ob):
ob.data.auto_smooth_angle = 0.6
bpy.ops.object.shade_smooth()
ob.pov.object_as = "PARAMETRIC"
ob.update_tag() # as prop set via python not updated in depsgraph
return{'FINISHED'}
class POV_OT_parametric_add(Operator):
"""Add the representation of POV parametric surfaces using pov_parametric_define() function."""
@ -1174,6 +1183,7 @@ class POV_OT_polygon_to_circle_add(Operator):
#ob.data.auto_smooth_angle = 0.1
#bpy.ops.object.shade_smooth()
ob.pov.object_as = "POLYCIRCLE"
ob.update_tag() # as prop set via python not updated in depsgraph
return {"FINISHED"}