[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23664] trunk/blender: Material buttons now view the active node material shading settings.
Campbell Barton
ideasman42 at gmail.com
Tue Oct 6 17:31:25 CEST 2009
Revision: 23664
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23664
Author: campbellbarton
Date: 2009-10-06 17:31:25 +0200 (Tue, 06 Oct 2009)
Log Message:
-----------
Material buttons now view the active node material shading settings.
Selecting a material in the node tree sets this as the active material and the buttons view redraws.
Added rna prop material.active_node_material
Currently its not clear what settings are used by the node material and the base material (needs some tedious research) so I made most panels use the node material with the exceptions of volumetrics, physics and halo settings.
We'll probably need to split the panels up to do this properly.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/buttons_material.py
trunk/blender/source/blender/blenkernel/BKE_node.h
trunk/blender/source/blender/blenkernel/intern/node.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
trunk/blender/source/blender/editors/space_node/node_select.c
trunk/blender/source/blender/makesrna/intern/rna_material.c
Modified: trunk/blender/release/scripts/ui/buttons_material.py
===================================================================
--- trunk/blender/release/scripts/ui/buttons_material.py 2009-10-06 15:01:46 UTC (rev 23663)
+++ trunk/blender/release/scripts/ui/buttons_material.py 2009-10-06 15:31:25 UTC (rev 23664)
@@ -1,6 +1,17 @@
import bpy
+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
+
+ return None
+
+
class MaterialButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
@@ -74,14 +85,14 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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)
if mat.type in ('SURFACE', 'WIRE'):
split = layout.split()
@@ -117,7 +128,7 @@
def draw(self, context):
layout = self.layout
- mat = context.material
+ mat = context.material # dont use node material
tan = mat.strand
split = layout.split()
@@ -152,7 +163,7 @@
def draw(self, context):
layout = self.layout
- phys = context.material.physics
+ phys = context.material.physics # dont use node material
split = layout.split()
@@ -171,14 +182,14 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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)
split = layout.split()
@@ -211,14 +222,14 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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)
split = layout.split()
@@ -244,14 +255,14 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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)
split = layout.split()
@@ -298,14 +309,14 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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)
layout.active = (not mat.shadeless)
@@ -351,12 +362,12 @@
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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)
@@ -365,7 +376,7 @@
def draw(self, context):
layout = self.layout
- mat = context.material
+ mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
layout.active = sss.enabled
@@ -396,19 +407,19 @@
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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.itemR(raym, "enabled", text="")
def draw(self, context):
layout = self.layout
- mat = context.material
+ mat = active_node_mat(context.material)
raym = mat.raytrace_mirror
layout.active = raym.enabled
@@ -451,19 +462,19 @@
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- mat = context.material
+ mat = active_node_mat(context.material)
engine = context.scene.render_data.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.itemR(mat, "transparency", text="")
def draw(self, context):
layout = self.layout
- mat = context.material
+ mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
row = layout.row()
@@ -517,7 +528,7 @@
def draw(self, context):
layout = self.layout
- mat = context.material
+ mat = context.material # dont use node material
halo = mat.halo
split = layout.split()
@@ -569,7 +580,7 @@
def draw(self, context):
layout = self.layout
- mat = context.material
+ mat = context.material # dont use node material
halo = mat.halo
layout.active = halo.flare_mode
@@ -618,8 +629,7 @@
def draw(self, context):
layout = self.layout
- mat = context.material
- vol = context.material.volume
+ vol = context.material.volume # dont use node material
split = layout.split()
row = split.row()
@@ -635,7 +645,7 @@
def draw(self, context):
layout = self.layout
- vol = context.material.volume
+ vol = context.material.volume # dont use node material
split = layout.split()
@@ -660,7 +670,7 @@
def draw(self, context):
layout = self.layout
- vol = context.material.volume
+ vol = context.material.volume # dont use node material
split = layout.split()
@@ -695,7 +705,7 @@
def draw(self, context):
layout = self.layout
- mat = context.material
+ mat = context.material # dont use node material
layout.itemR(mat, "transparency_method", expand=True)
@@ -707,7 +717,7 @@
def draw(self, context):
layout = self.layout
- vol = context.material.volume
+ vol = context.material.volume # dont use node material
split = layout.split()
Modified: trunk/blender/source/blender/blenkernel/BKE_node.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_node.h 2009-10-06 15:01:46 UTC (rev 23663)
+++ trunk/blender/source/blender/blenkernel/BKE_node.h 2009-10-06 15:31:25 UTC (rev 23664)
@@ -181,6 +181,7 @@
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node);
struct bNode *nodeGetActive(struct bNodeTree *ntree);
struct bNode *nodeGetActiveID(struct bNodeTree *ntree, short idtype);
+int nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id);
void nodeClearActiveID(struct bNodeTree *ntree, short idtype);
void NodeTagChanged(struct bNodeTree *ntree, struct bNode *node);
Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/node.c 2009-10-06 15:01:46 UTC (rev 23663)
+++ trunk/blender/source/blender/blenkernel/intern/node.c 2009-10-06 15:31:25 UTC (rev 23664)
@@ -1575,6 +1575,37 @@
return node;
}
+int nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
+{
+ bNode *node;
+ int ok= FALSE;
+
+ if(ntree==NULL) return ok;
+
+ /* check for group edit */
+ for(node= ntree->nodes.first; node; node= node->next)
+ if(node->flag & NODE_GROUP_EDIT)
+ break;
+
+ if(node)
+ ntree= (bNodeTree*)node->id;
+
+ /* now find active node with this id */
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->id && GS(node->id->name)==idtype) {
+ if(id && ok==FALSE && node->id==id) {
+ node->flag |= NODE_ACTIVE_ID;
+ ok= TRUE;
+ } else {
+ node->flag &= ~NODE_ACTIVE_ID;
+ }
+ }
+ }
+
+ return ok;
+}
+
+
/* two active flags, ID nodes have special flag for buttons display */
void nodeClearActiveID(bNodeTree *ntree, short idtype)
{
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2009-10-06 15:01:46 UTC (rev 23663)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2009-10-06 15:31:25 UTC (rev 23664)
@@ -1100,17 +1100,15 @@
for(md= modifiers_getVirtualModifierList(ob); md; md= md->next) {
if(md->type == eModifierType_Multires) {
- MultiresModifierData *mmd;
+ MultiresModifierData *mmd= (MultiresModifierData*)md;
/* Check if any of the modifiers after multires are active
* if not it can use the multires struct */
- ModifierData *md_next;
- for (md_next= md->next; md_next; md_next= md_next->next) {
- if(md_next->mode & eModifierMode_Realtime)
+ for (md= md->next; md; md= md->next) {
+ if(md->mode & eModifierMode_Realtime)
return NULL;
}
- mmd = (MultiresModifierData*)md;
if(mmd->lvl != 1)
return mmd;
}
Modified: trunk/blender/source/blender/editors/space_node/node_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_select.c 2009-10-06 15:01:46 UTC (rev 23663)
+++ trunk/blender/source/blender/editors/space_node/node_select.c 2009-10-06 15:31:25 UTC (rev 23664)
@@ -38,6 +38,7 @@
#include "BKE_context.h"
#include "BKE_node.h"
#include "BKE_global.h"
+#include "BKE_utildefines.h"
#include "BLI_rect.h"
@@ -55,7 +56,7 @@
#include "node_intern.h"
-static void node_mouse_select(SpaceNode *snode, ARegion *ar, short *mval, short extend)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list