*added capsule metaball as cylinder blob pov primitive

*Added the following pov keywords to object properties tab:
hollow, double_illuminate, sturm (for Metaballs and lathe), no_shadow, no_image, no_reflection, no_radiosity, inverse, hierarchy
*fixed hair location bug.
This commit is contained in:
Maurice Raybaud 2017-08-16 18:28:18 +02:00
parent 795b722bde
commit 6f8d64cc75
4 changed files with 102 additions and 8 deletions

View File

@ -1618,6 +1618,14 @@ class RenderPovSettingsTexture(PropertyGroup):
###############################################################################
class RenderPovSettingsObject(PropertyGroup):
# Pov inside_vector used for CSG
inside_vector = FloatVectorProperty(
name="CSG Inside Vector", description="Direction to shoot CSG inside test rays at",
precision=4, step=0.01, min=0, soft_max=1,
default=(0.001, 0.001, 0.5),
options={'ANIMATABLE'},
subtype='XYZ')
# Importance sampling
importance_value = FloatProperty(
name="Radiosity Importance",
@ -2056,6 +2064,19 @@ class RenderPovSettingsObject(PropertyGroup):
description = "",
default = 1.0)
###############################################################################
# Modifiers POV properties.
###############################################################################
#class RenderPovSettingsModifier(PropertyGroup):
boolean_mod = EnumProperty(
name="Operation",
description="Choose the type of calculation for Boolean modifier",
items=(("BMESH", "Use the BMesh Boolean Solver", ""),
("CARVE", "Use the Carve Boolean Solver", ""),
("POV", "Use Pov-Ray Constructive Solid Geometry", "")),
default="BMESH")
#################Avogadro
# filename_ext = ".png"
@ -2200,6 +2221,7 @@ def register():
bpy.types.NODE_HT_header.append(ui.menu_func_nodes)
nodeitems_utils.register_node_categories("POVRAYNODES", node_categories)
bpy.types.Scene.pov = PointerProperty(type=RenderPovSettingsScene)
#bpy.types.Modifier.pov = PointerProperty(type=RenderPovSettingsModifier)
bpy.types.Material.pov = PointerProperty(type=RenderPovSettingsMaterial)
bpy.types.Texture.pov = PointerProperty(type=RenderPovSettingsTexture)
bpy.types.Object.pov = PointerProperty(type=RenderPovSettingsObject)
@ -2211,6 +2233,7 @@ def register():
def unregister():
del bpy.types.Scene.pov
del bpy.types.Material.pov
#del bpy.types.Modifier.pov
del bpy.types.Texture.pov
del bpy.types.Object.pov
del bpy.types.Camera.pov

View File

@ -983,7 +983,7 @@ class POVRAY_OT_isosurface_box_add(bpy.types.Operator):
bpy.ops.object.mode_set(mode="OBJECT")
ob.pov.object_as = "ISOSURFACE"
ob.pov.contained_by = 'box'
ob.name = 'Isosurface'
ob.name = 'PovIsosurfaceBox'
return {'FINISHED'}
class POVRAY_OT_isosurface_sphere_add(bpy.types.Operator):
@ -1006,7 +1006,7 @@ class POVRAY_OT_isosurface_sphere_add(bpy.types.Operator):
bpy.ops.object.shade_smooth()
ob.pov.object_as = "ISOSURFACE"
ob.pov.contained_by = 'sphere'
ob.name = 'Isosurface'
ob.name = 'PovIsosurfaceSphere'
return {'FINISHED'}
class POVRAY_OT_sphere_sweep_add(bpy.types.Operator):
@ -1040,7 +1040,7 @@ class POVRAY_OT_blob_add(bpy.types.Operator):
layers[0] = True
bpy.ops.object.metaball_add(type = 'BALL',layers = layers)
ob = context.object
ob.name = "Blob"
ob.name = "PovBlob"
return {'FINISHED'}

View File

@ -287,6 +287,20 @@ def write_global_setting(scene,file):
file.write("}\n")
def write_object_modifiers(scene,ob,File):
'''XXX WIP
onceCSG = 0
for mod in ob.modifiers:
if onceCSG == 0:
if mod :
if mod.type == 'BOOLEAN':
if ob.pov.boolean_mod == "POV":
File.write("\tinside_vector <%.6g, %.6g, %.6g>\n" %
(ob.pov.inside_vector[0],
ob.pov.inside_vector[1],
ob.pov.inside_vector[2]))
onceCSG = 1
'''
if ob.pov.hollow:
File.write("\thollow\n")
if ob.pov.double_illuminate:
@ -3190,13 +3204,15 @@ def write_pov(filename, scene=None, info_callback=None):
writeObjectMaterial(material, ob)
except IndexError:
print(me)
# POV object inside_vector and modifiers such as
# hollow / sturm / double_illuminate etc.
write_object_modifiers(scene,ob,file)
#Importance for radiosity sampling added here:
tabWrite("radiosity { \n")
tabWrite("importance %3g \n" % importance)
tabWrite("}\n")
# POV object modifiers such as hollow / sturm / double_illuminate etc.
write_object_modifiers(scene,ob,file)
tabWrite("}\n") # End of mesh block

View File

@ -143,6 +143,17 @@ for member in dir(properties_physics_dynamicpaint):
pass
del properties_physics_dynamicpaint
# Example of wrapping every class 'as is'
from bl_ui import properties_data_modifier
for member in dir(properties_data_modifier):
subclass = getattr(properties_data_modifier, member)
try:
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except:
pass
del properties_data_modifier
# Example of wrapping every class 'as is' except some
from bl_ui import properties_material
for member in dir(properties_material):
@ -229,6 +240,17 @@ class RenderButtonsPanel():
rd = context.scene.render
return (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
class ModifierButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "modifier"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
@classmethod
def poll(cls, context):
mods = context.object.modifiers
rd = context.scene.render
return mods and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
class MaterialButtonsPanel():
bl_space_type = 'PROPERTIES'
@ -802,6 +824,36 @@ class RENDER_PT_povray_media(WorldButtonsPanel, bpy.types.Panel):
## rd = scene.render
##
## layout.active = scene.pov.baking_enable
'''XXX WIP preparing for CSG
class MODIFIERS_PT_povray_modifiers(ModifierButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#def draw_header(self, context):
#scene = context.scene
#self.layout.prop(scene.pov, "boolean_mod", text="")
def draw(self, context):
scene = context.scene
layout = self.layout
ob = context.object
mod = ob.modifiers
col = layout.column()
# Find Boolean Modifiers for displaying CSG option
onceCSG = 0
for mod in ob.modifiers:
if onceCSG == 0:
if mod :
if mod.type == 'BOOLEAN':
col.prop(ob.pov, "boolean_mod")
onceCSG = 1
if ob.pov.boolean_mod == "POV":
split = layout.split()
col = layout.column()
# Inside Vector for CSG
col.prop(ob.pov, "inside_vector")
'''
class MATERIAL_PT_povray_activate_node(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Activate Node Settings"
@ -1281,7 +1333,7 @@ class TEXTURE_PT_povray_tex_gamma(TextureButtonsPanel, bpy.types.Panel):
# col.prop(tex.pov, "replacement_text", text="")
class OBJECT_PT_povray_obj_importance(ObjectButtonsPanel, bpy.types.Panel):
class OBJECT_PT_povray_obj_parameters(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@ -1296,7 +1348,10 @@ class OBJECT_PT_povray_obj_importance(ObjectButtonsPanel, bpy.types.Panel):
obj = context.object
col = layout.column()
split = layout.split()
col = split.column(align=True)
col.label(text="Radiosity:")
col.prop(obj.pov, "importance_value", text="Importance")
col.label(text="Photons:")