diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-01-17 02:53:11 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-01-17 02:53:11 +0300 |
commit | c1cf33c8aa1d9fd5f8d36231f4a28da63ce0e5e0 (patch) | |
tree | eab94699866be5af61bc8c847f5aa222d21e50d1 /source/blender/editors/mesh/editmesh_tools.c | |
parent | ef93f8a36e39a67f5d25b0332a6d40e261a6d793 (diff) |
RNA
* Added more compact property definitions, with a single function.
Only used by operators at the moment, would need to tweak regular
expressions a bit more to use it also for other RNA definitions.
* The operator properties defined now were completed a bit more but
still have many issues that need to be adressed, specifically;
* Some properties that should be booleans or enums are defined as
ints, note that ints are only for numeric values, not bitflags
or multiple choice.
* Soft/hard limits and default values of many properties are not
well defined still,
* Inconsistent naming, especially for example mouse locations or
bounds are named differently in different places. Also mouse
locations and other vector like properties should become a single
vector property instead of multiple X/Y properties.
* Almost no properties have descriptions, these would be good to
have for docs and tooltips.
So, please verify that the properties of the operators you wrote are
well defined.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_tools.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index e801210102d..ad56ebd5f50 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -6317,7 +6317,7 @@ static int subdivide_multi_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"Number_of_cuts"), 0); + esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"number_cuts"), 0); ED_undo_push(C, "Subdivide Multi"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -6341,7 +6341,7 @@ void MESH_OT_subdivide_multi(wmOperatorType *ot) /* props */ - RNA_def_property_int_default(RNA_def_property(ot->srna, "Number_of_cuts", PROP_INT, PROP_NONE), 4); + RNA_def_int(ot->srna, "number_cuts", 4, 0, 100, "Number of Cuts", "", 0, INT_MAX); } static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op) @@ -6350,7 +6350,7 @@ static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - esubdivideflag(obedit, em, 1, -(RNA_float_get(op->ptr,"Rand_fac")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"Number_of_cuts"), 0); + esubdivideflag(obedit, em, 1, -(RNA_float_get(op->ptr, "random_factor")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr, "number_cuts"), 0); ED_undo_push(C, "Subdivide Multi Fractal"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -6371,11 +6371,9 @@ void MESH_OT_subdivide_multi_fractal(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; - /* props */ - - RNA_def_property_int_default(RNA_def_property(ot->srna, "Number_of_cuts", PROP_INT, PROP_NONE), 4); - RNA_def_property_float_default(RNA_def_property(ot->srna, "Rand_fac", PROP_FLOAT, PROP_NONE), 5.0); - + /* properties */ + RNA_def_int(ot->srna, "number_cuts", 4, 0, 100, "Number of Cuts", "", 0, INT_MAX); + RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f); } static int subdivide_smooth_exec(bContext *C, wmOperator *op) @@ -6384,7 +6382,7 @@ static int subdivide_smooth_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - esubdivideflag(obedit, em, 1, 0.292f*RNA_float_get(op->ptr,"Smooth"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0); + esubdivideflag(obedit, em, 1, 0.292f*RNA_float_get(op->ptr, "smoothness"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0); ED_undo_push(C, "Subdivide Smooth"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -6406,5 +6404,5 @@ void MESH_OT_subdivide_smooth(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - RNA_def_property_float_default(RNA_def_property(ot->srna, "Smooth", PROP_FLOAT, PROP_NONE), 5.0); -}
\ No newline at end of file + RNA_def_float(ot->srna, "smoothness", 5.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX); +} |