Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-14 10:46:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-14 10:46:07 +0400
commit11a7a406fb799843bc016e515d81a1c93d6d152e (patch)
treebd7363bad7fafca8fa417c4148d4c7e104ed9eda /source/blender
parentf4745763514a51bf841fc2c344d62242bdc297da (diff)
DPAINT_OT_output_toggle operator was using an index option for what was really a toggle between 2 values, changed its index option to an enum.
if a value other than 1/0 was given it would use an uninitialized pointer too (compiler warning, review should pick up this stuff). also renamed some RNA attrs: output_name --> output_name_a output_name2 --> output_name_b do_output1 --> use_output_a do_output2 --> use_output_b do_smudge --> use_smudge max_velocity --> velocity_max
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_dynamicpaint.h2
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c6
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c23
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c13
4 files changed, 24 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h
index d7e0f8bdaae..a4a810ba177 100644
--- a/source/blender/blenkernel/BKE_dynamicpaint.h
+++ b/source/blender/blenkernel/BKE_dynamicpaint.h
@@ -64,7 +64,7 @@ void dynamicPaint_freeSurfaceData(struct DynamicPaintSurface *surface);
void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
int dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface);
-int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int index);
+int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int output);
void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface);
void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename);
void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas);
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index ebbe57a6f81..5066b558c5a 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -279,13 +279,13 @@ static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface)
}
}
-int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int index)
+int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int output)
{
char *name;
- if (index == 0)
+ if (output == 0)
name = surface->output_name;
- else if (index == 1)
+ else if (output == 1)
name = surface->output_name2;
else
return 0;
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 550da63d7aa..f30ff9c08e9 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -197,24 +197,23 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot)
static int output_toggle_exec(bContext *C, wmOperator *op)
{
-
Object *ob = CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Scene *scene = CTX_data_scene(C);
DynamicPaintSurface *surface;
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
- int index= RNA_int_get(op->ptr, "index");
+ int output= RNA_enum_get(op->ptr, "output"); /* currently only 1/0 */
if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED;
surface = get_activeSurface(pmd->canvas);
/* if type is already enabled, toggle it off */
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
- int exists = dynamicPaint_outputLayerExists(surface, ob, index);
- char *name;
+ int exists = dynamicPaint_outputLayerExists(surface, ob, output);
+ const char *name;
- if (index == 0)
+ if (output == 0)
name = surface->output_name;
- else if (index == 1)
+ else
name = surface->output_name2;
/* Vertex Color Layer */
@@ -226,8 +225,9 @@ static int output_toggle_exec(bContext *C, wmOperator *op)
}
/* Vertex Weight Layer */
else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
- if (!exists)
+ if (!exists) {
ED_vgroup_add_name(ob, name);
+ }
else {
bDeformGroup *defgroup = defgroup_find_name(ob, name);
if (defgroup) ED_vgroup_delete(ob, defgroup);
@@ -240,7 +240,11 @@ static int output_toggle_exec(bContext *C, wmOperator *op)
void DPAINT_OT_output_toggle(wmOperatorType *ot)
{
- PropertyRNA *prop;
+ static EnumPropertyItem prop_output_toggle_types[] = {
+ {0, "A", 0, "Output A", ""},
+ {1, "B", 0, "Output B", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
/* identifiers */
ot->name= "Toggle Output Layer";
@@ -255,8 +259,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- prop= RNA_def_int(ot->srna, "index", 0, 0, 1, "Index", "", 0, 1);
- ot->prop= prop;
+ ot->prop= RNA_def_enum(ot->srna, "output", prop_output_toggle_types, 0, "Output Toggle", "");
}
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index 00a73afb789..974f8602440 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -553,20 +553,20 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");
/* output for primary surface data */
- prop= RNA_def_property(srna, "output_name", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "output_name");
RNA_def_property_ui_text(prop, "Output name", "");
- prop= RNA_def_property(srna, "do_output1", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1);
RNA_def_property_ui_text(prop, "Save layer", "Output name");
/* output for secondary sufrace data */
- prop= RNA_def_property(srna, "output_name2", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "output_name2");
RNA_def_property_ui_text(prop, "Output name", "Output name");
- prop= RNA_def_property(srna, "do_output2", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2);
RNA_def_property_ui_text(prop, "Save layer", "");
@@ -774,7 +774,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves. Use 0.0 to disable");
- prop= RNA_def_property(srna, "do_smudge", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
RNA_def_property_ui_text(prop, "Do Smudge", "Makes this brush to smudge existing paint as it moves");
@@ -783,7 +783,8 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
- prop= RNA_def_property(srna, "max_velocity", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_velocity");
RNA_def_property_range(prop, 0.0001, 10.0);
RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence. (Blender units per frame)");