[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40092] branches/soc-2011-carrot: Dynamic Paint:

Miika Hamalainen miika.hamalainen at kolumbus.fi
Sat Sep 10 10:55:44 CEST 2011


Revision: 40092
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40092
Author:   miikah
Date:     2011-09-10 08:55:44 +0000 (Sat, 10 Sep 2011)
Log Message:
-----------
Dynamic Paint:
* Enabled modifier "Apply" button since it can now be used to apply displacement or output layers to the mesh.
* Default surface output names are now unique in case canvas has multiple surfaces of same type.
* Merged "face aligned" and "non-closed" brush options to a single "Project" toggle, available for "Proximity" brushes.
* Added more icons to user interface selections.
* Increased default proximity distance.
* Set proximity falloff ramp to only affect alpha by default.
* Removed some no longer required render ext. functions.
* Fix: geometry node vertex alpha didn't work unless "Vertex Color Paint/Light" was enabled from material.

Modified Paths:
--------------
    branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
    branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c
    branches/soc-2011-carrot/source/blender/editors/interface/interface_templates.c
    branches/soc-2011-carrot/source/blender/makesdna/DNA_dynamicpaint_types.h
    branches/soc-2011-carrot/source/blender/makesdna/DNA_modifier_types.h
    branches/soc-2011-carrot/source/blender/makesrna/intern/rna_dynamicpaint.c
    branches/soc-2011-carrot/source/blender/makesrna/intern/rna_modifier.c
    branches/soc-2011-carrot/source/blender/nodes/intern/SHD_util.c
    branches/soc-2011-carrot/source/blender/render/extern/include/RE_shader_ext.h
    branches/soc-2011-carrot/source/blender/render/intern/source/render_texture.c
    branches/soc-2011-carrot/source/blender/render/intern/source/shadeinput.c
    branches/soc-2011-carrot/source/blenderplayer/bad_level_call_stubs/stubs.c

Modified: branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
===================================================================
--- branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py	2011-09-10 08:43:11 UTC (rev 40091)
+++ branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py	2011-09-10 08:55:44 UTC (rev 40092)
@@ -202,40 +202,6 @@
         layout.label(text="Brush Group:")
         layout.prop(surface, "brush_group", text="")
 
-class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, bpy.types.Panel):
-    bl_label = "Dynamic Paint: Initial Color"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, context):
-        md = context.dynamic_paint
-        if (not (md and (md.ui_type == "CANVAS") and (md.canvas_settings))):
-            return 0
-        surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
-        return (surface and surface.surface_type=="PAINT")
-
-    def draw(self, context):
-        layout = self.layout
-
-        canvas = context.dynamic_paint.canvas_settings
-        surface = canvas.canvas_surfaces.active
-        ob = context.object
-
-        layout.prop(surface, "init_color_type", expand=False)
-        layout.separator()
-
-        # dissolve
-        if (surface.init_color_type == "COLOR"):
-            layout.prop(surface, "init_color")
-            
-        if (surface.init_color_type == "TEXTURE"):
-            layout.prop(surface, "init_texture")
-            layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Layer:")
-        
-        if (surface.init_color_type == "VERTEXCOLOR"):
-            layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer: ")
-
-
 class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, bpy.types.Panel):
     bl_label = "Dynamic Paint: Output"
     bl_options = {'DEFAULT_CLOSED'}
@@ -323,8 +289,40 @@
             layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT')
             if len(canvas.ui_info) != 0:
                 layout.label(text=canvas.ui_info)
-		
 
+class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, bpy.types.Panel):
+    bl_label = "Dynamic Paint: Initial Color"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        md = context.dynamic_paint
+        if (not (md and (md.ui_type == "CANVAS") and (md.canvas_settings))):
+            return 0
+        surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
+        return (surface and surface.surface_type=="PAINT")
+
+    def draw(self, context):
+        layout = self.layout
+
+        canvas = context.dynamic_paint.canvas_settings
+        surface = canvas.canvas_surfaces.active
+        ob = context.object
+
+        layout.prop(surface, "init_color_type", expand=False)
+        layout.separator()
+
+        # dissolve
+        if (surface.init_color_type == "COLOR"):
+            layout.prop(surface, "init_color")
+            
+        if (surface.init_color_type == "TEXTURE"):
+            layout.prop(surface, "init_texture")
+            layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Layer:")
+        
+        if (surface.init_color_type == "VERTEXCOLOR"):
+            layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer: ")
+
 class PHYSICS_PT_dp_effects(PhysicButtonsPanel, bpy.types.Panel):
     bl_label = "Dynamic Paint: Effects"
     bl_options = {'DEFAULT_CLOSED'}
@@ -427,7 +425,7 @@
             split = layout.row().split(percentage=0.4)
             sub = split.column()
             sub.prop(brush, "accept_nonclosed")
-            if brush.accept_nonclosed:
+            if brush.prox_project:
                 sub = split.column()
                 sub.prop(brush, "ray_dir")
                 
@@ -436,13 +434,17 @@
             col.prop(brush, "paint_distance", text="Paint Distance")
             split = layout.row().split(percentage=0.4)
             sub = split.column()
-            if (brush.paint_source != 'POINT'):
-                sub.prop(brush, "prox_facealigned")
+            if brush.paint_source == 'DISTANCE':
+                sub.prop(brush, "prox_project")
+            if brush.paint_source == "VOLDIST":
+                sub.prop(brush, "prox_inverse")
+                
             sub = split.column()
+            if brush.paint_source == 'DISTANCE':
+                column = sub.column()
+                column.active = brush.prox_project
+                column.prop(brush, "ray_dir")
             sub.prop(brush, "prox_falloff")
-            if brush.paint_source == "VOLDIST":
-                col = layout.row().column()
-                col.prop(brush, "prox_inverse")
             if brush.prox_falloff == "RAMP":
                 col = layout.row().column()
                 col.separator()

Modified: branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c	2011-09-10 08:43:11 UTC (rev 40091)
+++ branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c	2011-09-10 08:55:44 UTC (rev 40092)
@@ -298,44 +298,6 @@
 	}
 }
 
-/* change surface data to defaults on new type */
-void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface)
-{
-	if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
-		surface->output_name[0]='\0';
-		surface->output_name2[0]='\0';
-		surface->flags |= MOD_DPAINT_ANTIALIAS;
-		surface->disp_clamp = 1.0f;
-	}
-	else {
-		sprintf(surface->output_name, "dp_");
-		strcpy(surface->output_name2,surface->output_name);
-		surface->flags &= ~MOD_DPAINT_ANTIALIAS;
-		surface->disp_clamp = 0.0f;
-	}
-
-	if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
-		strcat(surface->output_name,"paintmap");
-		strcat(surface->output_name2,"wetmap");
-	}
-	else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
-		strcat(surface->output_name,"displace");
-	}
-	else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
-		strcat(surface->output_name,"weight");
-	}
-	else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
-		strcat(surface->output_name,"wave");
-		strcat(surface->output_name2,"foam");
-	}
-
-	/* update preview */
-	if (dynamicPaint_surfaceHasColorPreview(surface))
-		dynamicPaint_setPreview(surface);
-	else
-		dynamicPaint_resetPreview(surface->canvas);
-}
-
 int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int index)
 {
 	char *name;
@@ -359,12 +321,38 @@
 	return 0;
 }
 
-static int surfaceDublicateNameExists(void *arg, const char *name)
+static int surface_duplicateOutputExists(void *arg, const char *name)
 {
 	DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg;
 	DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
 
 	for(; surface; surface=surface->next) {
+		if (surface!=t_surface && surface->type==t_surface->type &&
+			surface->format==t_surface->format) {
+			if (surface->output_name[0]!='\0' && !strcmp(name, surface->output_name)) return 1;
+			if (surface->output_name2[0]!='\0' && !strcmp(name, surface->output_name2)) return 1;
+		}
+	}
+	return 0;
+}
+
+void surface_setUniqueOutputName(DynamicPaintSurface *surface, char *basename, int output)
+{
+	char name[64];
+	strncpy(name, basename, 62); /* in case basename is surface->name use a copy */
+	if (!output)
+		BLI_uniquename_cb(surface_duplicateOutputExists, surface, name, '.', surface->output_name, sizeof(surface->output_name));
+	if (output)
+		BLI_uniquename_cb(surface_duplicateOutputExists, surface, name, '.', surface->output_name2, sizeof(surface->output_name2));
+}
+
+
+static int surface_duplicateNameExists(void *arg, const char *name)
+{
+	DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg;
+	DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
+
+	for(; surface; surface=surface->next) {
 		if (surface!=t_surface && !strcmp(name, surface->name)) return 1;
 	}
 	return 0;
@@ -374,9 +362,50 @@
 {
 	char name[64];
 	strncpy(name, basename, 62); /* in case basename is surface->name use a copy */
-	BLI_uniquename_cb(surfaceDublicateNameExists, surface, name, '.', surface->name, sizeof(surface->name));
+	BLI_uniquename_cb(surface_duplicateNameExists, surface, name, '.', surface->name, sizeof(surface->name));
 }
 
+
+/* change surface data to defaults on new type */
+void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface)
+{
+	if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
+		surface->output_name[0]='\0';
+		surface->output_name2[0]='\0';
+		surface->flags |= MOD_DPAINT_ANTIALIAS;
+		surface->disp_clamp = 1.0f;
+	}
+	else {
+		sprintf(surface->output_name, "dp_");
+		strcpy(surface->output_name2,surface->output_name);
+		surface->flags &= ~MOD_DPAINT_ANTIALIAS;
+		surface->disp_clamp = 0.0f;
+	}
+
+	if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
+		strcat(surface->output_name,"paintmap");
+		strcat(surface->output_name2,"wetmap");
+		surface_setUniqueOutputName(surface, surface->output_name2, 1);
+	}
+	else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
+		strcat(surface->output_name,"displace");
+	}
+	else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
+		strcat(surface->output_name,"weight");
+	}
+	else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
+		strcat(surface->output_name,"wave");
+	}
+
+	surface_setUniqueOutputName(surface, surface->output_name, 0);
+
+	/* update preview */
+	if (dynamicPaint_surfaceHasColorPreview(surface))
+		dynamicPaint_setPreview(surface);
+	else
+		dynamicPaint_resetPreview(surface->canvas);
+}
+
 static int surface_totalSamples(DynamicPaintSurface *surface)
 {
 	if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ &&
@@ -1025,7 +1054,7 @@
 
 			pmd->brush->psys = NULL;
 
-			pmd->brush->flags = MOD_DPAINT_ABS_ALPHA;
+			pmd->brush->flags = MOD_DPAINT_ABS_ALPHA | MOD_DPAINT_RAMP_ALPHA;
 			pmd->brush->collision = MOD_DPAINT_COL_VOLUME;
 			
 			pmd->brush->mat = NULL;
@@ -1035,7 +1064,7 @@
 			pmd->brush->alpha = 1.0f;
 			pmd->brush->wetness = 1.0f;
 
-			pmd->brush->paint_distance = 0.1f;
+			pmd->brush->paint_distance = 1.0f;
 			pmd->brush->proximity_falloff = MOD_DPAINT_PRFALL_SMOOTH;
 
 			pmd->brush->particle_radius = 0.2f;
@@ -3318,8 +3347,6 @@

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list