diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py index 13bfd7a7f5d..d178df7d79e 100644 --- a/release/scripts/ui/properties_material.py +++ b/release/scripts/ui/properties_material.py @@ -23,18 +23,6 @@ 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" @@ -148,14 +136,14 @@ class MATERIAL_PT_shading(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, context): - mat = active_node_mat(context.material) + 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 = active_node_mat(context.material) + mat = context.material wide_ui = context.region.width > narrowui if mat.type in ('SURFACE', 'WIRE'): @@ -259,14 +247,14 @@ class MATERIAL_PT_options(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, context): - mat = active_node_mat(context.material) + 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 = active_node_mat(context.material) + mat = context.material wide_ui = context.region.width > narrowui split = layout.split() @@ -305,14 +293,14 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, 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 self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = active_node_mat(context.material) + mat = context.material wide_ui = context.region.width > narrowui split = layout.split() @@ -342,14 +330,14 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, 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 self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = active_node_mat(context.material) + mat = context.material wide_ui = context.region.width > narrowui split = layout.split() @@ -413,14 +401,14 @@ class MATERIAL_PT_specular(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def poll(self, 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 self.COMPAT_ENGINES) def draw(self, context): layout = self.layout - mat = active_node_mat(context.material) + mat = context.material wide_ui = context.region.width > narrowui layout.active = (not mat.shadeless) @@ -483,12 +471,12 @@ class MATERIAL_PT_sss(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER'} def poll(self, 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 self.COMPAT_ENGINES) def draw_header(self, context): - mat = active_node_mat(context.material) + mat = context.material sss = mat.subsurface_scattering self.layout.active = (not mat.shadeless) @@ -497,7 +485,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel): def draw(self, context): layout = self.layout - mat = active_node_mat(context.material) + mat = context.material sss = mat.subsurface_scattering wide_ui = context.region.width > narrowui @@ -535,19 +523,19 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER'} def poll(self, 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 self.COMPAT_ENGINES) def draw_header(self, context): - raym = active_node_mat(context.material).raytrace_mirror + raym = context.material.raytrace_mirror self.layout.prop(raym, "enabled", text="") def draw(self, context): layout = self.layout - mat = active_node_mat(context.material) + mat = context.material raym = mat.raytrace_mirror wide_ui = context.region.width > narrowui @@ -594,19 +582,19 @@ class MATERIAL_PT_transp(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_RENDER'} def poll(self, 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 self.COMPAT_ENGINES) def draw_header(self, context): - mat = active_node_mat(context.material) + mat = context.material self.layout.prop(mat, "transparency", text="") def draw(self, context): layout = self.layout - mat = active_node_mat(context.material) + mat = context.material rayt = mat.raytrace_transparency wide_ui = context.region.width > narrowui @@ -661,19 +649,19 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel): COMPAT_ENGINES = {'BLENDER_GAME'} def poll(self, context): - mat = active_node_mat(context.material) + mat = context.material engine = context.scene.render.engine return mat and (engine in self.COMPAT_ENGINES) def draw_header(self, context): - mat = active_node_mat(context.material) + mat = context.material self.layout.prop(mat, "transparency", text="") def draw(self, context): layout = self.layout - mat = active_node_mat(context.material) + mat = context.material rayt = mat.raytrace_transparency wide_ui = context.region.width > narrowui diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py index 4616fc5f8ab..2894761e7ac 100644 --- a/release/scripts/ui/properties_texture.py +++ b/release/scripts/ui/properties_texture.py @@ -44,19 +44,8 @@ class TEXTURE_MT_envmap_specials(bpy.types.Menu): layout.operator("texture.envmap_clear_all", icon='FILE_REFRESH') -def active_node_mat(mat): - if mat: - mat_node = mat.active_node_material - if mat_node: - return mat_node - else: - return mat - - return None - - def context_tex_datablock(context): - idblock = active_node_mat(context.material) + idblock = context.material if idblock: return idblock diff --git a/release/scripts/ui/space_node.py b/release/scripts/ui/space_node.py index f510235a39d..9f6b127347b 100644 --- a/release/scripts/ui/space_node.py +++ b/release/scripts/ui/space_node.py @@ -55,7 +55,10 @@ class NODE_HT_header(bpy.types.Header): snode_id = snode.id id_from = snode.id_from if id_from: - layout.template_ID(id_from, "active_texture", new="texture.new") + if snode.texture_type == 'BRUSH': + layout.template_ID(id_from, "texture", new="texture.new") + else: + layout.template_ID(id_from, "active_texture", new="texture.new") if snode_id: layout.prop(snode_id, "use_nodes") diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 473f706f6f8..7a5757e99d2 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -401,11 +401,13 @@ void snode_set_context(SpaceNode *snode, Scene *scene) snode->from= (ID*)give_current_material(ob, ob->actcol); /* from is not set fully for material nodes, should be ID + Node then */ + snode->id= &tx->id; } } else if(snode->texfrom==SNODE_TEX_WORLD) { tx= give_current_world_texture(scene->world); snode->from= (ID *)scene->world; + snode->id= &tx->id; } else { Brush *brush= NULL; @@ -415,11 +417,12 @@ void snode_set_context(SpaceNode *snode, Scene *scene) else brush= paint_brush(&scene->toolsettings->imapaint.paint); - snode->from= (ID *)brush; - tx= give_current_brush_texture(brush); + if (brush) { + snode->from= (ID *)brush; + tx= give_current_brush_texture(brush); + snode->id= &tx->id; + } } - - snode->id= &tx->id; } if(snode->id)