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/editors/physics/dynamicpaint_ops.c
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/editors/physics/dynamicpaint_ops.c')
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c23
1 files changed, 13 insertions, 10 deletions
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", "");
}