Page MenuHome

mat_panel.diff

Authored By
Ervin Weber (lusque)
Nov 13 2013, 3:27 PM
Size
12 KB
Subscribers
None

mat_panel.diff

Index: properties_material.py
===================================================================
--- properties_material.py (revision 34598)
+++ properties_material.py (working copy)
@@ -34,6 +34,16 @@
return None
+def check_material(mat):
+ if mat is not None:
+ if mat.use_nodes:
+ if mat.active_node_material is not None:
+ return True
+ return False
+ return True
+ return False
+
+
class MATERIAL_MT_sss_presets(bpy.types.Menu):
bl_label = "SSS Presets"
preset_subdir = "sss"
@@ -116,7 +126,14 @@
elif mat:
split.template_ID(space, "pin_id")
split.separator()
-
+
+ if mat and mat.use_nodes:
+ row = layout.row()
+ row.label(text="", icon='NODETREE')
+ if mat.active_node_material:
+ row.prop(mat.active_node_material, "name", text="")
+ else:
+ row.label(text="No material node selected")
if mat:
layout.prop(mat, "type", expand=True)
@@ -129,16 +146,75 @@
self.layout.template_preview(context.material)
+class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Render Pipeline Options"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'VOLUME')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self. layout
+
+ mat = context.material
+
+ if mat.type in ('SURFACE', 'WIRE'):
+
+ row = layout.row()
+ row.prop(mat, "use_transparency")
+ sub = row.column()
+ sub.prop(mat, "offset_z")
+ sub.active = mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
+
+ row = layout.row()
+ row.active = mat.use_transparency
+ row.prop(mat, "transparency_method", expand=True)
+
+ layout.separator()
+
+ split = layout.split()
+ col = split.column()
+
+ col.prop(mat, "use_raytrace")
+ col.prop(mat, "use_full_oversampling")
+ col.prop(mat, "use_sky")
+ col.prop(mat, "invert_z")
+
+ col = split.column()
+
+ col.prop(mat, "use_cast_shadows_only", text="Cast Only")
+ col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
+ col.prop(mat, "use_cast_buffer_shadows")
+ col.prop(mat, "use_cast_approximate")
+
+ elif mat.type == 'VOLUME':
+
+ row = layout.row()
+ row.prop(mat, "transparency_method", expand=True)
+
+ row = layout.row()
+ row.prop(mat, "use_raytrace")
+ row.prop(mat, "use_full_oversampling")
+
+
class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Diffuse"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
def draw(self, context):
layout = self.layout
@@ -202,10 +278,14 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
def draw(self, context):
layout = self.layout
@@ -267,10 +347,14 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
def draw(self, context):
layout = self.layout
@@ -302,25 +386,20 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
- def draw_header(self, context):
- mat = active_node_mat(context.material)
-
- self.layout.prop(mat, "use_transparency", text="")
-
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
-
- row = layout.row()
- row.active = mat.use_transparency and (not mat.use_shadeless)
- row.prop(mat, "transparency_method", expand=True)
-
+
split = layout.split()
col = split.column()
@@ -364,11 +443,14 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
raym = active_node_mat(context.material).raytrace_mirror
self.layout.prop(raym, "use", text="")
@@ -422,11 +504,14 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
@@ -633,10 +718,14 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
def draw(self, context):
layout = self.layout
@@ -645,14 +734,7 @@
split = layout.split()
col = split.column()
- col.prop(mat, "use_raytrace")
- col.prop(mat, "use_full_oversampling")
- col.prop(mat, "use_sky")
col.prop(mat, "use_mist")
- col.prop(mat, "invert_z")
- sub = col.row()
- sub.prop(mat, "offset_z")
- sub.active = mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
sub = col.column(align=True)
sub.label(text="Light Group:")
sub.prop(mat, "light_group", text="")
@@ -678,10 +760,14 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
def draw(self, context):
layout = self.layout
@@ -693,11 +779,8 @@
col.prop(mat, "use_shadows", text="Receive")
col.prop(mat, "use_transparent_shadows", text="Receive Transparent")
col.prop(mat, "use_only_shadow", text="Shadows Only")
- col.prop(mat, "use_cast_shadows_only", text="Cast Only")
- col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
col = split.column()
- col.prop(mat, "use_cast_buffer_shadows")
sub = col.column()
sub.active = mat.use_cast_buffer_shadows
sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
@@ -705,7 +788,6 @@
sub = col.column()
sub.active = (not mat.use_ray_shadow_bias)
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
- col.prop(mat, "use_cast_approximate")
class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
@@ -715,31 +797,21 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
- def draw_header(self, context):
- mat = active_node_mat(context.material)
-
- self.layout.prop(mat, "use_transparency", text="")
-
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- rayt = mat.raytrace_transparency
+ layout.prop(mat, "alpha")
- row = layout.row()
- row.active = mat.use_transparency and (not mat.use_shadeless)
- row.prop(mat, "transparency_method", expand=True)
- split = layout.split()
-
- col = split.column()
- col.prop(mat, "alpha")
-
-
class VolumeButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -830,18 +902,6 @@
sub.prop(vol, "ms_intensity")
-class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
- bl_label = "Transparency"
- COMPAT_ENGINES = {'BLENDER_RENDER'}
-
- def draw(self, context):
- layout = self.layout
-
- mat = context.material # dont use node material
-
- layout.prop(mat, "transparency_method", expand=True)
-
-
class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Integration"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -868,7 +928,17 @@
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
bl_options = {'DEFAULT_CLOSED'}
-
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self,context):
+ if context.material and context.material.use_nodes:
+ self.layout.label(text="", icon='NODETREE')
+
def draw(self, context):
layout = self.layout
@@ -877,8 +947,6 @@
split = layout.split()
col = split.column()
- col.prop(mat, "use_raytrace")
- col.prop(mat, "use_full_oversampling")
col.prop(mat, "use_mist")
col = split.column()
@@ -903,4 +971,4 @@
pass
if __name__ == "__main__":
- register()
+ register()
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f8/0a/d8d98f53db4613e53b1dd02884c5

Event Timeline