Dynamic Paint:

* Some ui and rna tweaking.
* Effects ui panel is no longer visible for non-paint surfaces.
This commit is contained in:
Miika Hamalainen 2011-07-03 14:01:57 +00:00
parent fdc59b8a40
commit 901f24716b
5 changed files with 27 additions and 19 deletions

@ -132,6 +132,7 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, bpy.types.Panel):
layout.separator() layout.separator()
if (surface.surface_type == "PAINT"): if (surface.surface_type == "PAINT"):
layout.label(text="Wetmap drying:")
split = layout.split(percentage=0.8) split = layout.split(percentage=0.8)
split.prop(surface, "dry_speed", text="Dry Time") split.prop(surface, "dry_speed", text="Dry Time")
split.prop(surface, "use_dry_log", text="Slow") split.prop(surface, "use_dry_log", text="Slow")
@ -206,16 +207,23 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, bpy.types.Panel):
col.label(text="UV layer:") col.label(text="UV layer:")
col.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="") col.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="")
col.separator()
col = layout.column() col = layout.column()
col.prop(surface, "image_output_path", text="Output directory") col.prop(surface, "image_output_path", text="Output directory")
col.prop(surface, "image_fileformat", text="Image Format:") col.prop(surface, "image_fileformat", text="Image Format")
col.separator()
if (surface.surface_type == "PAINT"): if (surface.surface_type == "PAINT"):
split = col.split()
col = split.column()
col.prop(surface, "do_output1", text="Output Paintmaps:") col.prop(surface, "do_output1", text="Output Paintmaps:")
sub = col.column() sub = split.column()
sub.prop(surface, "premultiply", text="Premultiply alpha")
sub.active = surface.do_output1
sub = layout.column()
sub.active = surface.do_output1 sub.active = surface.do_output1
sub.prop(surface, "output_name", text="Filename: ") sub.prop(surface, "output_name", text="Filename: ")
sub.prop(surface, "premultiply", text="Premultiply alpha")
col = layout.column()
col.prop(surface, "do_output2", text="Output Wetmaps:") col.prop(surface, "do_output2", text="Output Wetmaps:")
sub = col.column() sub = col.column()
sub.active = surface.do_output2 sub.active = surface.do_output2
@ -241,7 +249,7 @@ class PHYSICS_PT_dp_effects(PhysicButtonsPanel, bpy.types.Panel):
if ((not md) or (md.dynamicpaint_type != 'CANVAS')): if ((not md) or (md.dynamicpaint_type != 'CANVAS')):
return False; return False;
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return surface and (surface.surface_format != "PTEX") return surface and (surface.surface_type == "PAINT")
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout

@ -69,7 +69,7 @@ void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct Dyn
void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface); void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
void dynamicPaint_clearSurface(DynamicPaintSurface *surface); void dynamicPaint_clearSurface(DynamicPaintSurface *surface);
int dynamicPaint_resetSurface(struct DynamicPaintSurface *surface); int dynamicPaint_resetSurface(struct DynamicPaintSurface *surface);
int dynamicPaint_surfaceHasPreview(DynamicPaintSurface *surface); int dynamicPaint_surfaceHasColorPreview(DynamicPaintSurface *surface);
void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface); void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface);
void dynamicPaintSurface_setUniqueName(DynamicPaintSurface *surface, char *basename); void dynamicPaintSurface_setUniqueName(DynamicPaintSurface *surface, char *basename);

@ -90,7 +90,6 @@
struct Object; struct Object;
struct Scene; struct Scene;
struct DerivedMesh; struct DerivedMesh;
//struct DynamicPaintModifierData;
/* /*
* Init predefined antialias jitter data * Init predefined antialias jitter data
@ -217,10 +216,11 @@ static int dynamicPaint_surfaceNumOfPoints(DynamicPaintSurface *surface)
} }
/* checks whether surface's format/type has realtime preview */ /* checks whether surface's format/type has realtime preview */
int dynamicPaint_surfaceHasPreview(DynamicPaintSurface *surface) { int dynamicPaint_surfaceHasColorPreview(DynamicPaintSurface *surface) {
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return 0; if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return 0;
else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) { else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) return 0; if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
surface->type == MOD_DPAINT_SURFACE_T_WAVE) return 0;
else return 1; else return 1;
} }
else return 1; else return 1;
@ -247,7 +247,7 @@ static void dynamicPaint_resetPreview(DynamicPaintCanvasSettings *canvas)
int done=0; int done=0;
for(; surface; surface=surface->next) { for(; surface; surface=surface->next) {
if (!done && dynamicPaint_surfaceHasPreview(surface)) { if (!done && dynamicPaint_surfaceHasColorPreview(surface)) {
surface->flags |= MOD_DPAINT_PREVIEW; surface->flags |= MOD_DPAINT_PREVIEW;
done=1; done=1;
} }
@ -295,7 +295,7 @@ void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface) {
} }
/* update preview */ /* update preview */
if (dynamicPaint_surfaceHasPreview(surface)) if (dynamicPaint_surfaceHasColorPreview(surface))
dynamicPaint_setPreview(surface); dynamicPaint_setPreview(surface);
else else
dynamicPaint_resetPreview(surface->canvas); dynamicPaint_resetPreview(surface->canvas);

@ -2138,7 +2138,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
sprintf(name_final, "%s (%s)",name,enum_name); sprintf(name_final, "%s (%s)",name,enum_name);
uiItemL(sub, name_final, icon); uiItemL(sub, name_final, icon);
if (dynamicPaint_surfaceHasPreview(surface)) { if (dynamicPaint_surfaceHasColorPreview(surface)) {
uiBlockSetEmboss(block, UI_EMBOSSN); uiBlockSetEmboss(block, UI_EMBOSSN);
uiDefIconButR(block, OPTION, 0, (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON, uiDefIconButR(block, OPTION, 0, (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON,
0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL); 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL);

@ -434,8 +434,8 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
prop= RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE); prop= RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spread_speed"); RNA_def_property_float_sdna(prop, NULL, "spread_speed");
RNA_def_property_range(prop, 0.01, 5.0); RNA_def_property_range(prop, 0.001, 10.0);
RNA_def_property_ui_range(prop, 0.001, 20.0, 1, 2); RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
RNA_def_property_ui_text(prop, "Spread Speed", "How fast spread effect moves on the canvas surface."); RNA_def_property_ui_text(prop, "Spread Speed", "How fast spread effect moves on the canvas surface.");
prop= RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
@ -448,8 +448,8 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
prop= RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE); prop= RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "shrink_speed"); RNA_def_property_float_sdna(prop, NULL, "shrink_speed");
RNA_def_property_range(prop, 0.01, 5.0); RNA_def_property_range(prop, 0.001, 10.0);
RNA_def_property_ui_range(prop, 0.01, 20.0, 1, 2); RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
RNA_def_property_ui_text(prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface."); RNA_def_property_ui_text(prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface.");
prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
@ -527,7 +527,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
prop= RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE); prop= RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "wave_spring"); RNA_def_property_float_sdna(prop, NULL, "wave_spring");
RNA_def_property_range(prop, 0.01, 1.0); RNA_def_property_range(prop, 0.001, 1.0);
RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2); RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero."); RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero.");
@ -627,7 +627,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE); prop= RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "alpha"); RNA_def_property_float_sdna(prop, NULL, "alpha");
RNA_def_property_range(prop, 0.0, 10.0); RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2); RNA_def_property_ui_range(prop, 0.0, 10.0, 5, 2);
RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha."); RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha.");
prop= RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
@ -646,7 +646,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE); prop= RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "wetness"); RNA_def_property_float_sdna(prop, NULL, "wetness");
RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 3); RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
RNA_def_property_ui_text(prop, "Paint Wetness", "Paint Wetness. Visible in wet map. Some effects only affect wet paint."); RNA_def_property_ui_text(prop, "Paint Wetness", "Paint Wetness. Visible in wet map. Some effects only affect wet paint.");
prop= RNA_def_property(srna, "paint_erase", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "paint_erase", PROP_BOOLEAN, PROP_NONE);
@ -662,7 +662,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE); prop= RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "wave_factor"); RNA_def_property_float_sdna(prop, NULL, "wave_factor");
RNA_def_property_range(prop, -2.0, 2.0); RNA_def_property_range(prop, -2.0, 2.0);
RNA_def_property_ui_range(prop, -1.0, 1.0, 1, 2); RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave strenght of this brush."); RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave strenght of this brush.");
/* /*