diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-22 18:50:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-22 18:50:16 +0300 |
commit | 30efa59b0dfb9b437a14b1a29d79575e31cef9a8 (patch) | |
tree | ce1946da496c68946db7a95e213f207292fb4888 /release/scripts/ui/properties_material.py | |
parent | 21174f28a9cbe2d08b64310e54f734bba6eb1ddb (diff) |
Fix node material properties not showing correct, the code here should not
be removed, because some panels use the parent materials while others use
the nested materials.
Diffstat (limited to 'release/scripts/ui/properties_material.py')
-rw-r--r-- | release/scripts/ui/properties_material.py | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py index d178df7d79e..13bfd7a7f5d 100644 --- a/release/scripts/ui/properties_material.py +++ b/release/scripts/ui/properties_material.py @@ -23,6 +23,18 @@ from rna_prop_ui import PropertyPanel narrowui = 180 +def active_node_mat(mat): + # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate + # which settings from node-materials are used + if mat: + mat_node = mat.active_node_material + if mat_node: + return mat_node + else: + return mat + + return None + class MATERIAL_MT_sss_presets(bpy.types.Menu): bl_label = "SSS Presets" @@ -136,14 +148,14 @@ class MATERIAL_PT_shading(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) wide_ui = context.region.width > narrowui if mat.type in ('SURFACE', 'WIRE'): @@ -247,14 +259,14 @@ class MATERIAL_PT_options(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) wide_ui = context.region.width > narrowui split = layout.split() @@ -293,14 +305,14 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) wide_ui = context.region.width > narrowui split = layout.split() @@ -330,14 +342,14 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) wide_ui = context.region.width > narrowui split = layout.split() @@ -401,14 +413,14 @@ class MATERIAL_PT_specular(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) wide_ui = context.region.width > narrowui layout.active = (not mat.shadeless) @@ -471,12 +483,12 @@ class MATERIAL_PT_sss(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) def draw_header(self, context): - mat = context.material + mat = active_node_mat(context.material) sss = mat.subsurface_scattering self.layout.active = (not mat.shadeless) @@ -485,7 +497,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel): def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) sss = mat.subsurface_scattering wide_ui = context.region.width > narrowui @@ -523,19 +535,19 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) def draw_header(self, context): - raym = context.material.raytrace_mirror + raym = active_node_mat(context.material).raytrace_mirror self.layout.prop(raym, "enabled", text="") def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) raym = mat.raytrace_mirror wide_ui = context.region.width > narrowui @@ -582,19 +594,19 @@ class MATERIAL_PT_transp(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) def draw_header(self, context): - mat = context.material + mat = active_node_mat(context.material) self.layout.prop(mat, "transparency", text="") def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) rayt = mat.raytrace_transparency wide_ui = context.region.width > narrowui @@ -649,19 +661,19 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_GAME'} def poll(self, context): - mat = context.material + mat = active_node_mat(context.material) engine = context.scene.render.engine return mat and (engine in self.COMPAT_ENGINES) def draw_header(self, context): - mat = context.material + mat = active_node_mat(context.material) self.layout.prop(mat, "transparency", text="") def draw(self, context): layout = self.layout - mat = context.material + mat = active_node_mat(context.material) rayt = mat.raytrace_transparency wide_ui = context.region.width > narrowui |