[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37622] branches/soc-2011-carrot: Dynamic Paint:
Miika Hamalainen
miika.hamalainen at kolumbus.fi
Sat Jun 18 20:41:21 CEST 2011
Revision: 37622
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37622
Author: miikah
Date: 2011-06-18 18:41:20 +0000 (Sat, 18 Jun 2011)
Log Message:
-----------
Dynamic Paint:
* Added vertex weight painting.
* Added dissolve/fade setting for every surface type.
* Restored image format and displace type selection for image sequences.
* Fixed a possible crash when OpenMP enabled.
* Attempt to fix surface rna paths.
* Fixed compile warnings.
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/blenkernel/intern/pointcache.c
branches/soc-2011-carrot/source/blender/makesrna/intern/rna_dynamicpaint.c
branches/soc-2011-carrot/source/blender/modifiers/intern/MOD_dynamicpaint.c
branches/soc-2011-carrot/source/blender/render/intern/source/render_texture.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-06-18 16:50:54 UTC (rev 37621)
+++ branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py 2011-06-18 18:41:20 UTC (rev 37622)
@@ -49,9 +49,9 @@
if md.dynamicpaint_type == 'CANVAS':
canvas = md.canvas_settings
- surface = canvas.active_surface
+ surface = canvas.canvas_surfaces.active
row = layout.row()
- row.template_list(canvas, "canvas_surfaces", canvas, "active_index", rows=2)
+ row.template_list(canvas, "canvas_surfaces", canvas.canvas_surfaces, "active_index", rows=2)
col = row.column(align=True)
col.operator("dpaint.surface_slot_add", icon='ZOOMIN', text="")
@@ -113,31 +113,35 @@
@classmethod
def poll(cls, context):
md = context.dynamic_paint
- return md and (md.dynamicpaint_type == 'CANVAS') and (context.dynamic_paint.canvas_settings.active_surface)
+ return md and (md.dynamicpaint_type == 'CANVAS') and (context.dynamic_paint.canvas_settings.canvas_surfaces.active)
def draw(self, context):
layout = self.layout
canvas = context.dynamic_paint.canvas_settings
- surface = canvas.active_surface
+ surface = canvas.canvas_surfaces.active
ob = context.object
layout.prop(surface, "surface_type", expand=False)
if (surface.surface_type == "PAINT"):
layout.prop(surface, "initial_color", expand=False)
- col = layout.split(percentage=0.33)
- col.prop(surface, "use_dissolve", text="Dissolve:")
- sub = col.column()
+ split = layout.split(percentage=0.8)
+ split.prop(surface, "dry_speed", text="Dry Time")
+ split.prop(surface, "use_dry_log", text="Slow")
+
+ if (surface.surface_type != "IWAVE"):
+ if (surface.surface_type == "DISPLACE"):
+ layout.prop(surface, "use_dissolve", text="Dissolve:")
+ elif (surface.surface_type == "WEIGHT"):
+ layout.prop(surface, "use_dissolve", text="Fade:")
+ else:
+ layout.prop(surface, "use_dissolve", text="Dissolve:")
+ sub = layout.column()
sub.active = surface.use_dissolve
- sub.prop(surface, "dissolve_speed", text="Time")
-
- if (surface.surface_type == "DISPLACE"):
- col = layout.split(percentage=0.33)
- col.prop(surface, "use_dissolve", text="Flatten:")
- sub = col.column()
- sub.active = surface.use_dissolve
- sub.prop(surface, "dissolve_speed", text="Time")
+ split = sub.split(percentage=0.8)
+ split.prop(surface, "dissolve_speed", text="Time")
+ split.prop(surface, "use_dissolve_log", text="Slow")
layout.label(text="Brush Group:")
layout.prop(surface, "brush_group", text="")
@@ -152,14 +156,14 @@
md = context.dynamic_paint
if ((not md) or (md.dynamicpaint_type != 'CANVAS')):
return 0
- surface = context.dynamic_paint.canvas_settings.active_surface
+ surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return (surface and (not (surface.surface_format=="VERTEX" and surface.surface_type=="DISPLACE") ))
def draw(self, context):
layout = self.layout
canvas = context.dynamic_paint.canvas_settings
- surface = canvas.active_surface
+ surface = canvas.canvas_surfaces.active
ob = context.object
# vertex format outputs
@@ -174,6 +178,8 @@
row.prop_search(surface, "output_name2", ob.data, "vertex_colors", text="Wetmap layer: ")
#col = row.column(align=True)
#col.operator("dpaint.output_add", icon='ZOOMIN', text="")
+ if (surface.surface_type == "WEIGHT"):
+ layout.prop_search(surface, "output_name", ob, "vertex_groups", text="Vertex Group: ")
# image format outputs
if (surface.surface_format == "IMAGE"):
@@ -189,34 +195,14 @@
col.prop(surface, "output_name2", text="Wetmap: ")
if (surface.surface_type == "DISPLACE"):
col.prop(surface, "output_name", text="Filename: ")
+ col.prop(surface, "disp_type", text="Displace Type")
+
+ col.prop(surface, "image_fileformat", text="Image Format:")
layout.separator()
layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT')
if len(canvas.ui_info) != 0:
layout.label(text=canvas.ui_info)
-#
-# layout.separator()
-#
-# col = layout.column()
-# col.prop(surface, "output_wet")
-# sub = col.column()
-# sub.active = surface.output_wet
-# sub.prop(surface, "wet_output_path", text="")
-#
-# layout.separator()
-#
-# col = layout.column()
-# col.prop(surface, "output_disp")
-# sub = col.column()
-# sub.active = surface.output_disp
-# sub.prop(surface, "displace_output_path", text="")
-# sub.prop(surface, "displacement", text="Strength")
-#
-# split = sub.split()
-# sub = split.column()
-# sub.prop(surface, "disp_type", text="Type")
-# sub = split.column()
-# sub.prop(surface, "disp_format", text="Format")
class PHYSICS_PT_dp_effects(PhysicButtonsPanel, bpy.types.Panel):
@@ -228,14 +214,14 @@
md = context.dynamic_paint
if ((not md) or (md.dynamicpaint_type != 'CANVAS')):
return False;
- surface = context.dynamic_paint.canvas_settings.active_surface
+ surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return surface and (surface.surface_format != "VERTEX")
def draw(self, context):
layout = self.layout
canvas = context.dynamic_paint.canvas_settings
- surface = canvas.active_surface
+ surface = canvas.canvas_surfaces.active
layout.prop(surface, "effect_ui", expand=True)
@@ -266,12 +252,12 @@
def poll(cls, context):
md = context.dynamic_paint
return md and (md.dynamicpaint_type == 'CANVAS') and \
- (md.canvas_settings.active_surface) and (md.canvas_settings.active_surface.uses_cache)
+ (md.canvas_settings.canvas_surfaces.active) and (md.canvas_settings.canvas_surfaces.active.uses_cache)
def draw(self, context):
layout = self.layout
- surface = context.dynamic_paint.canvas_settings.active_surface
+ surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
cache = surface.point_cache
point_cache_ui(self, context, cache, (cache.is_baked is False), 'DYNAMIC_PAINT')
Modified: branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c 2011-06-18 16:50:54 UTC (rev 37621)
+++ branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c 2011-06-18 18:41:20 UTC (rev 37622)
@@ -32,6 +32,7 @@
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_colortools.h"
+#include "BKE_deform.h"
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_dynamicpaint.h"
@@ -399,7 +400,7 @@
surface->pointcache->step = 1;
/* Set initial values */
- surface->flags = MOD_DPAINT_ANTIALIAS | MOD_DPAINT_MULALPHA | MOD_DPAINT_DRY_LOG | MOD_DPAINT_ACTIVE | MOD_DPAINT_PREVIEW;
+ surface->flags = MOD_DPAINT_ANTIALIAS | MOD_DPAINT_MULALPHA | MOD_DPAINT_DRY_LOG | MOD_DPAINT_DISSOLVE_LOG | MOD_DPAINT_ACTIVE | MOD_DPAINT_PREVIEW;
surface->effect = 0;
surface->effect_ui = 1;
@@ -471,7 +472,7 @@
pmd->brush->wetness = 1.0f;
pmd->brush->paint_distance = 0.1f;
- pmd->brush->proximity_falloff = MOD_DPAINT_PRFALL_SHARP;
+ pmd->brush->proximity_falloff = MOD_DPAINT_PRFALL_SMOOTH;
pmd->brush->displace_distance = 0.5f;
pmd->brush->prox_displace_strength = 0.5f;
@@ -737,14 +738,16 @@
MFace *mface = result->getFaceArray(result);
int numOfFaces = result->getNumFaces(result);
- int i,j;
+ int i;
PaintPoint* pPoint = (PaintPoint*)surface->data->type_data;
MCol *col;
/* paint is stored on dry and wet layers, so mix final color first */
float *fcolor = MEM_callocN(sizeof(float)*surface->data->total_points*4, "Temp paint color");
+
+ #pragma omp parallel for schedule(static)
for (i=0; i<surface->data->total_points; i++) {
- j=i*4;
+ int j=i*4;
/* If dry layer already has a color, blend it */
if (pPoint[i].alpha) {
float invAlpha = 1.0f - pPoint[i].e_alpha;
@@ -770,6 +773,7 @@
if (!col) col = CustomData_add_layer(&result->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numOfFaces);
if (col) {
+ #pragma omp parallel for schedule(static)
for (i=0; i<numOfFaces; i++) {
int j=0;
float invAlpha;
@@ -809,6 +813,7 @@
/* paint layer */
col = CustomData_get_layer_named(&dm->faceData, CD_MCOL, surface->output_name);
if (col) {
+ #pragma omp parallel for schedule(static)
for (i=0; i<numOfFaces; i++) {
int j=0;
for (; j<((mface[i].v4)?4:3); j++) {
@@ -827,6 +832,7 @@
/* wet layer */
col = CustomData_get_layer_named(&dm->faceData, CD_MCOL, surface->output_name2);
if (col) {
+ #pragma omp parallel for schedule(static)
for (i=0; i<numOfFaces; i++) {
int j=0;
@@ -859,8 +865,79 @@
CDDM_calc_normals(result);
}
+
/* vertex group paint */
else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
+ int defgrp_index = defgroup_name_index(ob, surface->output_name);
+ MDeformVert *dvert = result->getVertDataArray(result, CD_MDEFORMVERT);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list