[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27582] trunk/blender: Fixed a crash switching to brush texture nodes
Matt Ebb
matt at mke3.net
Wed Mar 17 23:54:55 CET 2010
Revision: 27582
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27582
Author: broken
Date: 2010-03-17 23:54:55 +0100 (Wed, 17 Mar 2010)
Log Message:
-----------
Fixed a crash switching to brush texture nodes
Also removed some python code to check for node materials within the material and texture properties. It seems to go fine without it, and this should be handled by context instead.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/properties_material.py
trunk/blender/release/scripts/ui/properties_texture.py
trunk/blender/release/scripts/ui/space_node.py
trunk/blender/source/blender/editors/space_node/node_edit.c
Modified: trunk/blender/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py 2010-03-17 21:38:53 UTC (rev 27581)
+++ trunk/blender/release/scripts/ui/properties_material.py 2010-03-17 22:54:55 UTC (rev 27582)
@@ -23,19 +23,7 @@
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"
preset_subdir = "sss"
@@ -148,14 +136,14 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
Modified: trunk/blender/release/scripts/ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_texture.py 2010-03-17 21:38:53 UTC (rev 27581)
+++ trunk/blender/release/scripts/ui/properties_texture.py 2010-03-17 22:54:55 UTC (rev 27582)
@@ -44,19 +44,8 @@
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
Modified: trunk/blender/release/scripts/ui/space_node.py
===================================================================
--- trunk/blender/release/scripts/ui/space_node.py 2010-03-17 21:38:53 UTC (rev 27581)
+++ trunk/blender/release/scripts/ui/space_node.py 2010-03-17 22:54:55 UTC (rev 27582)
@@ -55,7 +55,10 @@
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")
Modified: trunk/blender/source/blender/editors/space_node/node_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_edit.c 2010-03-17 21:38:53 UTC (rev 27581)
+++ trunk/blender/source/blender/editors/space_node/node_edit.c 2010-03-17 22:54:55 UTC (rev 27582)
@@ -401,11 +401,13 @@
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 @@
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)
More information about the Bf-blender-cvs
mailing list