[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30920] branches: I ran into merging issues with my last branch, so I' m re-branching from a working copy of trunk that has the changes applied.
Mitchell Stokes
mogurijin at gmail.com
Sat Jul 31 10:03:26 CEST 2010
Revision: 30920
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30920
Author: moguri
Date: 2010-07-31 10:03:25 +0200 (Sat, 31 Jul 2010)
Log Message:
-----------
I ran into merging issues with my last branch, so I'm re-branching from a working copy of trunk that has the changes applied. This should clean things up again.
Modified Paths:
--------------
branches/soc-2010-moguri-2/release/scripts/ui/properties_material.py
branches/soc-2010-moguri-2/source/blender/blenkernel/BKE_material.h
branches/soc-2010-moguri-2/source/blender/blenkernel/intern/material.c
branches/soc-2010-moguri-2/source/blender/blenloader/intern/readfile.c
branches/soc-2010-moguri-2/source/blender/blenloader/intern/writefile.c
branches/soc-2010-moguri-2/source/blender/editors/render/render_intern.h
branches/soc-2010-moguri-2/source/blender/editors/render/render_ops.c
branches/soc-2010-moguri-2/source/blender/editors/render/render_shading.c
branches/soc-2010-moguri-2/source/blender/gpu/GPU_extensions.h
branches/soc-2010-moguri-2/source/blender/gpu/GPU_material.h
branches/soc-2010-moguri-2/source/blender/gpu/SConscript
branches/soc-2010-moguri-2/source/blender/gpu/intern/gpu_codegen.c
branches/soc-2010-moguri-2/source/blender/gpu/intern/gpu_codegen.h
branches/soc-2010-moguri-2/source/blender/gpu/intern/gpu_draw.c
branches/soc-2010-moguri-2/source/blender/gpu/intern/gpu_extensions.c
branches/soc-2010-moguri-2/source/blender/gpu/intern/gpu_material.c
branches/soc-2010-moguri-2/source/blender/makesdna/DNA_material_types.h
branches/soc-2010-moguri-2/source/blender/makesrna/intern/rna_material.c
branches/soc-2010-moguri-2/source/gameengine/Converter/BL_BlenderDataConversion.cpp
branches/soc-2010-moguri-2/source/gameengine/Ketsji/BL_BlenderShader.cpp
branches/soc-2010-moguri-2/source/gameengine/Ketsji/BL_BlenderShader.h
branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_BlenderMaterial.h
branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
branches/soc-2010-moguri-2/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
Added Paths:
-----------
branches/soc-2010-moguri-2/
Copied: branches/soc-2010-moguri-2 (from rev 30919, trunk/blender)
Modified: branches/soc-2010-moguri-2/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/release/scripts/ui/properties_material.py 2010-07-31 08:03:25 UTC (rev 30920)
@@ -778,7 +778,54 @@
col.prop(halo, "flares_sub", text="Subflares")
col.prop(halo, "flare_subsize", text="Subsize")
+class MATERIAL_PT_shaders(MaterialButtonsPanel):
+ bl_label = "Custom Shaders"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ def poll(self, context):
+ 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
+ col = layout.column()
+
+ mat = active_node_mat(context.material)
+
+ col.prop(mat, "use_external_shaders")
+
+ if mat.use_external_shaders:
+ col.prop(mat, "vertex_shader")
+ col.prop(mat, "geometry_shader")
+ col.prop(mat, "fragment_shader")
+ else:
+ col.prop(mat, "vertex_text")
+ col.prop(mat, "geometry_text")
+ col.prop(mat, "fragment_text")
+
+ col.prop(mat, "geometry_input")
+ col.prop(mat, "geometry_output")
+
+ col.operator("material.force_update", text="Reload Shaders")
+
+ col.label(text="Custom Uniforms:")
+ row = layout.row()
+ col = row.column()
+ col.template_list(mat, "uniforms", mat, "active_uniform_index")
+ col = row.column(align=True)
+ col.operator("material.uniform_add", icon='ZOOMIN', text="")
+ col.operator("material.uniform_remove", icon='ZOOMOUT', text="").index = mat.active_uniform_index
+
+ lay = mat.active_uniform
+ if lay:
+ row = layout.row()
+ row.prop(lay, "name")
+ row.prop(lay, "type", text="")
+ if hasattr(lay, "value"):
+ row = layout.row()
+ row.prop(lay, "value")
+
class VolumeButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -959,6 +1006,7 @@
MATERIAL_PT_options,
MATERIAL_PT_shadow,
MATERIAL_PT_transp_game,
+ MATERIAL_PT_shaders,
MATERIAL_MT_sss_presets,
MATERIAL_MT_specials,
Modified: branches/soc-2010-moguri-2/source/blender/blenkernel/BKE_material.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_material.h 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/source/blender/blenkernel/BKE_material.h 2010-07-31 08:03:25 UTC (rev 30920)
@@ -45,6 +45,7 @@
void free_material(struct Material *sc);
void test_object_materials(struct ID *id);
void init_material(struct Material *ma);
+void init_custom_uniform(struct CustomUniform *cu);
struct Material *add_material(char *name);
struct Material *copy_material(struct Material *ma);
struct Material *give_node_material(struct Material *ma); /* returns node material or self */
Modified: branches/soc-2010-moguri-2/source/blender/blenkernel/intern/material.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/material.c 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/source/blender/blenkernel/intern/material.c 2010-07-31 08:03:25 UTC (rev 30920)
@@ -85,6 +85,10 @@
if(ma->ramp_col) MEM_freeN(ma->ramp_col);
if(ma->ramp_spec) MEM_freeN(ma->ramp_spec);
+
+ if(ma->csi.vert_text) MEM_freeN(ma->csi.vert_text);
+ if(ma->csi.frag_text) MEM_freeN(ma->csi.frag_text);
+ if(ma->csi.geom_text) MEM_freeN(ma->csi.geom_text);
BKE_free_animdata((ID *)ma);
@@ -187,8 +191,18 @@
ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RAYBIAS|MA_TANGENT_STR|MA_ZTRANSP;
ma->shade_flag= MA_APPROX_OCCLUSION;
ma->preview = NULL;
+
+ ma->csi.flag= 0;
+ ma->csi.geom_in= MA_CS_GEOM_IN_TRIS;
+ ma->csi.geom_out= MA_CS_GEOM_OUT_TRIANGLE_STRIP;
}
+void init_custom_uniform(CustomUniform *cu)
+{
+ strcpy(&cu->name[0], "Uniform");
+ cu->type = MA_UNF_FLOAT;
+}
+
Material *add_material(char *name)
{
Material *ma;
Modified: branches/soc-2010-moguri-2/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/source/blender/blenloader/intern/readfile.c 2010-07-31 08:03:25 UTC (rev 30920)
@@ -2862,6 +2862,7 @@
{
Material *ma;
MTex *mtex;
+ CustomUniform *cu;
int a;
ma= main->mat.first;
@@ -2886,7 +2887,20 @@
if(ma->nodetree)
lib_link_ntree(fd, &ma->id, ma->nodetree);
-
+
+ ma->csi.vert_text= newlibadr(fd, ma->id.lib, ma->csi.vert_text);
+ ma->csi.frag_text= newlibadr(fd, ma->id.lib, ma->csi.frag_text);
+ ma->csi.geom_text= newlibadr(fd, ma->id.lib, ma->csi.geom_text);
+
+ cu = ma->csi.uniforms.first;
+
+ while(cu) {
+ if(cu->type==MA_UNF_SAMPLER2D)
+ cu->data= newlibadr(fd, ma->id.lib, cu->data);
+
+ cu = cu->next;
+ }
+
ma->id.flag -= LIB_NEEDLINK;
}
ma= ma->id.next;
@@ -2906,6 +2920,7 @@
ma->ramp_col= newdataadr(fd, ma->ramp_col);
ma->ramp_spec= newdataadr(fd, ma->ramp_spec);
+ link_list(fd, &ma->csi.uniforms);
ma->nodetree= newdataadr(fd, ma->nodetree);
if(ma->nodetree)
@@ -10854,6 +10869,7 @@
}
+ /* put 2.50 compatibility code here until next subversion bump */
if (main->versionfile < 253)
{
Object *ob;
@@ -11118,6 +11134,18 @@
/* put compatibility code here until next subversion bump */
{
+ Material *mat;
+
+
+ /* geometry shader flags */
+ for(mat= main->mat.first; mat; mat= mat->id.next) {
+ if (mat->csi.geom_in == 0)
+ {
+ mat->csi.flag = 0;
+ mat->csi.geom_in = MA_CS_GEOM_IN_TRIS;
+ mat->csi.geom_out = MA_CS_GEOM_OUT_TRIANGLE_STRIP;
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@ -11641,6 +11669,10 @@
}
expand_doit(fd, mainvar, ma->ipo); // XXX depreceated - old animation system
+
+ /*expand_doit(fd, mainvar, ma->vert_text);
+ expand_doit(fd, mainvar, ma->frag_text);
+ expand_doit(fd, mainvar, ma->geom_text);*/
if(ma->adt)
expand_animdata(fd, mainvar, ma->adt);
Modified: branches/soc-2010-moguri-2/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/source/blender/blenloader/intern/writefile.c 2010-07-31 08:03:25 UTC (rev 30920)
@@ -1679,6 +1679,19 @@
mywrite(wd, MYWRITE_FLUSH, 0);
}
+static void write_uniforms(WriteData *wd, ListBase *lb)
+{
+ CustomUniform *cu;
+
+ cu= lb->first;
+
+ while(cu) {
+ writestruct(wd, DATA, "CustomUniform", 1, cu);
+
+ cu= cu->next;
+ }
+}
+
static void write_materials(WriteData *wd, ListBase *idbase)
{
Material *ma;
@@ -1704,6 +1717,12 @@
if(ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col);
if(ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec);
+
+ if(ma->csi.vert_text) writestruct(wd, DATA, "Text", 1, ma->csi.vert_text);
+ if(ma->csi.frag_text) writestruct(wd, DATA, "Text", 1, ma->csi.frag_text);
+ if(ma->csi.geom_text) writestruct(wd, DATA, "Text", 1, ma->csi.geom_text);
+
+ write_uniforms(wd, &ma->csi.uniforms);
/* nodetree is integral part of material, no libdata */
if(ma->nodetree) {
@@ -2761,4 +2780,4 @@
return !error;
}
-#endif /* !__APPLE__ */
+#endif /* !__APPLE__ */
\ No newline at end of file
Modified: branches/soc-2010-moguri-2/source/blender/editors/render/render_intern.h
===================================================================
--- trunk/blender/source/blender/editors/render/render_intern.h 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/source/blender/editors/render/render_intern.h 2010-07-31 08:03:25 UTC (rev 30920)
@@ -47,6 +47,9 @@
void MATERIAL_OT_copy(struct wmOperatorType *ot);
void MATERIAL_OT_paste(struct wmOperatorType *ot);
+void MATERIAL_OT_uniform_add(struct wmOperatorType *ot);
+void MATERIAL_OT_uniform_remove(struct wmOperatorType *ot);
+void MATERIAL_OT_force_update(struct wmOperatorType *ot);
void SCENE_OT_render_layer_add(struct wmOperatorType *ot);
void SCENE_OT_render_layer_remove(struct wmOperatorType *ot);
Modified: branches/soc-2010-moguri-2/source/blender/editors/render/render_ops.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_ops.c 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/source/blender/editors/render/render_ops.c 2010-07-31 08:03:25 UTC (rev 30920)
@@ -53,6 +53,9 @@
WM_operatortype_append(MATERIAL_OT_copy);
WM_operatortype_append(MATERIAL_OT_paste);
+ WM_operatortype_append(MATERIAL_OT_uniform_add);
+ WM_operatortype_append(MATERIAL_OT_uniform_remove);
+ WM_operatortype_append(MATERIAL_OT_force_update);
WM_operatortype_append(SCENE_OT_render_layer_add);
WM_operatortype_append(SCENE_OT_render_layer_remove);
Modified: branches/soc-2010-moguri-2/source/blender/editors/render/render_shading.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_shading.c 2010-07-31 03:52:50 UTC (rev 30919)
+++ branches/soc-2010-moguri-2/source/blender/editors/render/render_shading.c 2010-07-31 08:03:25 UTC (rev 30920)
@@ -1062,7 +1062,91 @@
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+static int uniform_add_exec(bContext *C, wmOperator *op)
+{
+ Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
+ CustomUniform *cu= MEM_callocN(sizeof(CustomUniform), "New Uniform");
+ init_custom_uniform(cu);
+
+ BLI_addtail(&ma->csi.uniforms, cu);
+
+ return OPERATOR_FINISHED;
+}
+
+void MATERIAL_OT_uniform_add(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Add Uniform";
+ ot->idname= "MATERIAL_OT_uniform_add";
+ ot->description= "Add a new uniform value";
+
+ /* api callbacks */
+ ot->exec= uniform_add_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list