[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28894] branches/render25: =New feature: material id renderpass=

Joseph Eagar joeedh at gmail.com
Thu May 20 19:41:34 CEST 2010


Revision: 28894
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28894
Author:   joeedh
Date:     2010-05-20 19:41:34 +0200 (Thu, 20 May 2010)

Log Message:
-----------
=New feature: material id renderpass=

Works exactly like the object id pass; to use, 
assign a Pass Index in the material Options panel.

Modified Paths:
--------------
    branches/render25/release/scripts/ui/properties_material.py
    branches/render25/release/scripts/ui/properties_render.py
    branches/render25/source/blender/blenkernel/BKE_node.h
    branches/render25/source/blender/blenkernel/intern/node.c
    branches/render25/source/blender/editors/space_outliner/outliner.c
    branches/render25/source/blender/makesdna/DNA_material_types.h
    branches/render25/source/blender/makesdna/DNA_scene_types.h
    branches/render25/source/blender/makesrna/intern/rna_material.c
    branches/render25/source/blender/makesrna/intern/rna_render.c
    branches/render25/source/blender/makesrna/intern/rna_scene.c
    branches/render25/source/blender/nodes/intern/CMP_nodes/CMP_image.c
    branches/render25/source/blender/render/extern/include/RE_shader_ext.h
    branches/render25/source/blender/render/intern/source/convertblender.c
    branches/render25/source/blender/render/intern/source/result.c
    branches/render25/source/blender/render/intern/source/shadeinput.c

Modified: branches/render25/release/scripts/ui/properties_material.py
===================================================================
--- branches/render25/release/scripts/ui/properties_material.py	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/release/scripts/ui/properties_material.py	2010-05-20 17:41:34 UTC (rev 28894)
@@ -277,19 +277,10 @@
         col.prop(mat, "use_sky")
         col.prop(mat, "exclude_mist")
         col.prop(mat, "invert_z")
-        sub = col.row()
-        sub.prop(mat, "z_offset")
-        sub.active = mat.transparency and mat.transparency_method == 'Z_TRANSPARENCY'
-        sub = col.column(align=True)
-        sub.label(text="Light Group:")
-        sub.prop(mat, "light_group", text="")
-        row = sub.row()
-        row.active = bool(mat.light_group)
-        row.prop(mat, "light_group_exclusive", text="Exclusive")
-        row.prop(mat, "light_group_local", text="Local")
 
         if wide_ui:
             col = split.column()
+            
         col.prop(mat, "face_texture")
         sub = col.column()
         sub.active = mat.face_texture
@@ -299,7 +290,30 @@
         col.prop(mat, "vertex_color_light")
         col.prop(mat, "object_color")
 
+        if wide_ui:
+            sub = layout.row()
+        else:
+            sub = layout
+        
+        col = sub.column()
+        
+        subcol = col.column()
+        subcol.prop(mat, "z_offset")
+        subcol.active = mat.transparency and mat.transparency_method == 'Z_TRANSPARENCY'
+        
+        col.prop(mat, "pass_index")
 
+        col = sub.column(align=True)
+        col.label(text="Light Group:")
+        col.prop(mat, "light_group", text="")
+        
+        col = col.column(align=True)
+        col.active = bool(mat.light_group)
+        col.prop(mat, "light_group_exclusive", text="Exclusive")
+        col.prop(mat, "light_group_local", text="Local")
+        
+
+
 class MATERIAL_PT_shadow(MaterialButtonsPanel):
     bl_label = "Shadow"
     bl_default_closed = True

Modified: branches/render25/release/scripts/ui/properties_render.py
===================================================================
--- branches/render25/release/scripts/ui/properties_render.py	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/release/scripts/ui/properties_render.py	2010-05-20 17:41:34 UTC (rev 28894)
@@ -141,6 +141,7 @@
         col.prop(rl, "pass_uv")
         col.prop(rl, "pass_mist")
         col.prop(rl, "pass_object_index")
+        col.prop(rl, "pass_material_index")
         col.prop(rl, "pass_color")
 
         if wide_ui:

Modified: branches/render25/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/render25/source/blender/blenkernel/BKE_node.h	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/blenkernel/BKE_node.h	2010-05-20 17:41:34 UTC (rev 28894)
@@ -297,6 +297,7 @@
 #define RRES_OUT_MIST		15
 #define RRES_OUT_EMIT		16
 #define RRES_OUT_ENV		17
+#define RRES_OUT_INDEXMA	18
 
 /* note: types are needed to restore callbacks, don't change values */
 #define CMP_NODE_VIEWER		201

Modified: branches/render25/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/node.c	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/blenkernel/intern/node.c	2010-05-20 17:41:34 UTC (rev 28894)
@@ -2829,7 +2829,9 @@
 	if(!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL;
 	sock= BLI_findlink(&node->outputs, RRES_OUT_ENV);
 	if(!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL;
-	
+	sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXMA);
+	if(!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL;
+
 }
 
 /* based on rules, force sockets hidden always */

Modified: branches/render25/source/blender/editors/space_outliner/outliner.c
===================================================================
--- branches/render25/source/blender/editors/space_outliner/outliner.c	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/editors/space_outliner/outliner.c	2010-05-20 17:41:34 UTC (rev 28894)
@@ -476,6 +476,10 @@
 	te->name= "Index Object";
 	te->directdata= &srl->passflag;
 	
+	te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA));
+	te->name= "Index Material";
+	te->directdata= &srl->passflag;
+
 	te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA));
 	te->name= "Color";
 	te->directdata= &srl->passflag;

Modified: branches/render25/source/blender/makesdna/DNA_material_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_material_types.h	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/makesdna/DNA_material_types.h	2010-05-20 17:41:34 UTC (rev 28894)
@@ -77,13 +77,15 @@
 	struct AnimData *adt;	/* animation data (must be immediately after id for utilities to use it) */ 
 	
 	short material_type, flag;	
-	/* note, keep this below synced with render_types.h */
+	
+	/* note, keep this below synced with RE_shader_ext.h */
 	float r, g, b;
 	float specr, specg, specb;
-	float mirr, mirg, mirb, pad;
+	float mirr, mirg, mirb;
 	float amb, emit, ang, spectra, ray_mirror;
 	float alpha, ref, spec, zoffs, add;
 	float translucency;
+	int index; /*for material index pass*/
 	/* end synced with render_types.h */
 	
 	struct VolumeSettings vol;

Modified: branches/render25/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_scene_types.h	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/makesdna/DNA_scene_types.h	2010-05-20 17:41:34 UTC (rev 28894)
@@ -197,6 +197,7 @@
 #define SCE_PASS_RAYHITS		(1<<15)
 #define SCE_PASS_EMIT			(1<<16)
 #define SCE_PASS_ENVIRONMENT	(1<<17)
+#define SCE_PASS_INDEXMA		(1<<18)
 
 /* note, srl->passflag is treestore element 'nr' in outliner, short still... */
 

Modified: branches/render25/source/blender/makesrna/intern/rna_material.c
===================================================================
--- branches/render25/source/blender/makesrna/intern/rna_material.c	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/makesrna/intern/rna_material.c	2010-05-20 17:41:34 UTC (rev 28894)
@@ -1765,6 +1765,11 @@
 	RNA_def_property_ui_text(prop, "Use Textures", "Enable/Disable each texture");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
+	prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "index");
+	RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexMA render pass");
+	RNA_def_property_update(prop, NC_MATERIAL, NULL);
+
 	rna_def_material_colors(srna);
 	rna_def_material_diffuse(srna);
 	rna_def_material_specularity(srna);

Modified: branches/render25/source/blender/makesrna/intern/rna_render.c
===================================================================
--- branches/render25/source/blender/makesrna/intern/rna_render.c	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/makesrna/intern/rna_render.c	2010-05-20 17:41:34 UTC (rev 28894)
@@ -374,6 +374,7 @@
 		{SCE_PASS_MIST, "MIST", 0, "Mist", ""},
 		{SCE_PASS_EMIT, "EMIT", 0, "Emit", ""},
 		{SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
+		{SCE_PASS_INDEXMA, "MATERIAL_INDEX", 0, "Material Index", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
 	srna= RNA_def_struct(brna, "RenderPass", NULL);

Modified: branches/render25/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/render25/source/blender/makesrna/intern/rna_scene.c	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/makesrna/intern/rna_scene.c	2010-05-20 17:41:34 UTC (rev 28894)
@@ -1341,6 +1341,12 @@
 	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
+	prop= RNA_def_property(srna, "pass_material_index", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
+	RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
+	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
 	prop= RNA_def_property(srna, "pass_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
 	RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass");

Modified: branches/render25/source/blender/nodes/intern/CMP_nodes/CMP_image.c
===================================================================
--- branches/render25/source/blender/nodes/intern/CMP_nodes/CMP_image.c	2010-05-20 17:36:59 UTC (rev 28893)
+++ branches/render25/source/blender/nodes/intern/CMP_nodes/CMP_image.c	2010-05-20 17:41:34 UTC (rev 28894)
@@ -51,6 +51,7 @@
 	{	SOCK_VALUE, 0, "Mist",		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_RGBA, 0, "Emit",		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	SOCK_RGBA, 0, "Environment",0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_VALUE, 0, "IndexMA",	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
@@ -187,7 +188,9 @@
 	if(out[RRES_OUT_EMIT]->hasoutput)
 		out[RRES_OUT_EMIT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_EMIT);
 	if(out[RRES_OUT_ENV]->hasoutput)
-		out[RRES_OUT_ENV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_ENVIRONMENT);
+		out[RRES_OUT_ENV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA);
+	if(out[RRES_OUT_INDEXMA]->hasoutput)
+		out[RRES_OUT_INDEXMA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA);
 };
 
 
@@ -299,7 +302,7 @@
 	  CompBuf *buf;
 	  int buftype= CB_VEC3;
 
-	  if(ELEM3(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST))
+	  if(ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_INDEXMA, SCE_PASS_MIST))
 		 buftype= CB_VAL;
 	  else if(passcode==SCE_PASS_VECTOR)
 		 buftype= CB_VEC4;
@@ -352,6 +355,8 @@
 	   out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list