[Bf-extensions-cvs] [8143153c] master: texture slots WIP
Maurice Raybaud
noreply at git.blender.org
Fri Aug 16 10:51:59 CEST 2019
Commit: 8143153cfdb292aeeca392253f7a489ae48051c2
Author: Maurice Raybaud
Date: Fri Aug 16 10:51:50 2019 +0200
Branches: master
https://developer.blender.org/rBA8143153cfdb292aeeca392253f7a489ae48051c2
texture slots WIP
===================================================================
M render_povray/ui.py
===================================================================
diff --git a/render_povray/ui.py b/render_povray/ui.py
index dff42e80..c1408153 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -303,6 +303,32 @@ def locate_docpath():
return pov_documents
return ""
+def pov_context_tex_datablock(context):
+ idblock = context.material
+ if idblock:
+ return active_node_mat(idblock)
+
+ idblock = context.lamp
+ if idblock:
+ return idblock
+
+ idblock = context.world
+ if idblock:
+ return idblock
+
+ idblock = context.brush
+ if idblock:
+ return idblock
+
+ idblock = context.line_style
+ if idblock:
+ return idblock
+
+ if context.particle_system:
+ idblock = context.particle_system.settings
+
+ return idblock
+
class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -1571,6 +1597,16 @@ class MATERIAL_PT_povray_replacement_text(MaterialButtonsPanel, Panel):
col.label(text="Replace properties with:")
col.prop(mat.pov, "replacement_text", text="")
+class TEXTURE_MT_specials(bpy.types.Menu):
+ bl_label = "Texture Specials"
+ COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("texture.slot_copy", icon='COPYDOWN')
+ layout.operator("texture.slot_paste", icon='PASTEDOWN')
+
class MATERIAL_TEXTURE_SLOTS_UL_List(UIList):
"""Texture Slots UIList."""
@@ -1630,7 +1666,7 @@ class TEXTURE_PT_POV_context_texture(TextureButtonsPanel, Panel):
context.light or
context.texture or
context.line_style or
- context.particle_system or
+ context.particle_system or
isinstance(context.space_data.pin_id, ParticleSettings) or
context.texture_user) and
(engine in cls.COMPAT_ENGINES))
@@ -1651,15 +1687,19 @@ class TEXTURE_PT_POV_context_texture(TextureButtonsPanel, Panel):
spacedependant = wld
lgt = getattr(context, "light", None)
if lgt != None:
- spacedependant = lgt
+ spacedependant = lgt
+
+
+ #idblock = context.particle_system.settings
+
tex = getattr(context, "texture", None)
if tex != None:
spacedependant = tex
-
- idblock = context_tex_datablock(context)
+ scene = context.scene
+ idblock = scene.pov#pov_context_tex_datablock(context)
pin_id = space.pin_id
#spacedependant.use_limited_texture_context = True
@@ -1704,11 +1744,13 @@ class TEXTURE_PT_POV_context_texture(TextureButtonsPanel, Panel):
pov = getattr(context, "pov", None)
active_texture_index = getattr(spacedependant, "active_texture_index", None)
+ print (pov)
+ print(idblock)
print(active_texture_index)
row = layout.row()
row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots",
- idblock, "active_texture_index", rows=2)
+ idblock, "active_texture_index", rows=2, maxrows=16, type="DEFAULT")
# row.template_list("WORLD_TEXTURE_SLOTS_UL_List", "texture_slots", world,
# world.texture_slots, world, "active_texture_index", rows=2)
@@ -1737,6 +1779,52 @@ class TEXTURE_PT_POV_context_texture(TextureButtonsPanel, Panel):
else:
split.label(text="Type:")
+class TEXTURE_PT_colors(TextureButtonsPanel, Panel):
+ bl_label = "Colors"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "use_color_ramp", text="Ramp")
+ if tex.use_color_ramp:
+ layout.template_color_ramp(tex, "color_ramp", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="RGB Multiply:")
+ sub = col.column(align=True)
+ sub.prop(tex, "factor_red", text="R")
+ sub.prop(tex, "factor_green", text="G")
+ sub.prop(tex, "factor_blue", text="B")
+
+ col = split.column()
+ col.label(text="Adjust:")
+ col.prop(tex, "intensity")
+ col.prop(tex, "contrast")
+ col.prop(tex, "saturation")
+
+ col = layout.column()
+ col.prop(tex, "use_clamp", text="Clamp")
+
+# Texture Slot Panels #
+
+
+class TextureSlotPanel(TextureButtonsPanel):
+ COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ if not hasattr(context, "texture_slot"):
+ return False
+
+ engine = context.scene.render.engine
+ return TextureButtonsPanel.poll(cls, context) and (engine in cls.COMPAT_ENGINES)
+
class TEXTURE_PT_povray_type(TextureButtonsPanel, Panel):
bl_label = "POV-ray Textures"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1991,6 +2079,214 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, Panel):
row.prop(tex.pov, "warp_turbulence_z", text="Z")
row.prop(tex.pov, "modifier_omega", text="Omega")
+class TEXTURE_PT_influence(TextureSlotPanel, Panel):
+ bl_label = "Influence"
+ COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ idblock = context_tex_datablock(context)
+ if isinstance(idblock, Brush):
+ return False
+
+ if not getattr(context, "texture_slot", None):
+ return False
+
+ engine = context.scene.render.engine
+ return (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+
+ layout = self.layout
+
+ idblock = context_tex_datablock(context)
+
+ tex = context.texture_slot
+
+ def factor_but(layout, toggle, factor, name):
+ row = layout.row(align=True)
+ row.prop(tex, toggle, text="")
+ sub = row.row(align=True)
+ sub.active = getattr(tex, toggle)
+ sub.prop(tex, factor, text=name, slider=True)
+ return sub # XXX, temp. use_map_normal needs to override.
+
+ if isinstance(idblock, Material):
+ if idblock.type in {'SURFACE', 'WIRE'}:
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Diffuse:")
+ factor_but(col, "use_map_diffuse", "diffuse_factor", "Intensity")
+ factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
+ factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
+ factor_but(col, "use_map_translucency", "translucency_factor", "Translucency")
+
+ col.label(text="Specular:")
+ factor_but(col, "use_map_specular", "specular_factor", "Intensity")
+ factor_but(col, "use_map_color_spec", "specular_color_factor", "Color")
+ factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
+
+ col = split.column()
+ col.label(text="Shading:")
+ factor_but(col, "use_map_ambient", "ambient_factor", "Ambient")
+ factor_but(col, "use_map_emit", "emit_factor", "Emit")
+ factor_but(col, "use_map_mirror", "mirror_factor", "Mirror")
+ factor_but(col, "use_map_raymir", "raymir_factor", "Ray Mirror")
+
+ col.label(text="Geometry:")
+ # XXX replace 'or' when displacement is fixed to not rely on normal influence value.
+ sub_tmp = factor_but(col, "use_map_normal", "normal_factor", "Normal")
+ sub_tmp.active = (tex.use_map_normal or tex.use_map_displacement)
+ # END XXX
+
+ factor_but(col, "use_map_warp", "warp_factor", "Warp")
+ factor_but(col, "use_map_displacement", "displacement_factor", "Displace")
+
+ # ~ sub = col.column()
+ # ~ sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
+ #~ sub.prop(tex, "default_value", text="Amount", slider=True)
+ elif idblock.type == 'HALO':
+ layout.label(text="Halo:")
+
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
+ factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
+
+ col = split.column()
+ factor_but(col, "use_map_raymir", "raymir_factor", "Size")
+ factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
+ factor_but(col, "use_map_translucency", "translucency_factor", "Add")
+ elif idblock.type == 'VOLUME':
+ layout.label(text="Volume:")
+
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_density", "density_factor", "Density")
+ factor_but(col, "use_map_emission", "emission_factor", "Emission")
+ factor_but(col, "use_map_scatter", "scattering_factor", "Scattering")
+ factor_but(col, "use_map_reflect", "reflection_factor", "Reflection")
+
+ col = split.column()
+ col.label(text=" ")
+ factor_but(col, "use_map_color_emission", "emission_color_factor", "Emission Color")
+ factor_but(col, "use_map_color_transmission", "transmission_color_factor", "Transmission Color")
+ factor_but(col, "use_map_color_reflection", "reflection_color_factor", "Reflection Color")
+
+ layout.label(text="Geometry:")
+
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_warp", "warp_factor", "Warp")
+
+ col = split.column()
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list