diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-16 08:19:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-16 08:19:48 +0400 |
commit | b380dd9378707bbf4a45ed456d49f28cf762b882 (patch) | |
tree | 4f6513ef26bf3f48af9ac7b16f69eeb47827fd0a /source/blender/windowmanager | |
parent | 23626e0149f25f13855735bbb7f65121e0c40ca0 (diff) |
fix [#36537] "Grid Floor Scaling" can have some unexpected behaviour on new objects
curves and metaballs now behave the same as meshes wrt grid scaling.
remove WM_operator_view3d_distance_invoke(), and replace with a function called from exec which initializes defaults, this way operators can have their own invoke functions.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 40 |
2 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index ce4513425d4..f9c18a3e0a2 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -186,7 +186,7 @@ void WM_event_timer_sleep(struct wmWindowManager *wm, struct wmWindow *win, str /* operator api, default callbacks */ /* invoke callback, uses enum property named "type" */ -int WM_operator_view3d_distance_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); +void WM_operator_view3d_unit_defaults(struct bContext *C, struct wmOperator *op); int WM_operator_smooth_viewtx_get(const struct wmOperator *op); int WM_menu_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index de4b864ac1e..1e984649ca7 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -892,33 +892,33 @@ void WM_operator_properties_free(PointerRNA *ptr) /* ************ default op callbacks, exported *********** */ -int WM_operator_view3d_distance_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *UNUSED(event)) +void WM_operator_view3d_unit_defaults(struct bContext *C, struct wmOperator *op) { - Scene *scene = CTX_data_scene(C); - View3D *v3d = CTX_wm_view3d(C); + if (op->flag & OP_IS_INVOKE) { + Scene *scene = CTX_data_scene(C); + View3D *v3d = CTX_wm_view3d(C); - const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) : ED_scene_grid_scale(scene, NULL); + const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) : ED_scene_grid_scale(scene, NULL); - /* always run, so the values are initialized, - * otherwise we may get differ behavior when (dia != 1.0) */ - RNA_STRUCT_BEGIN (op->ptr, prop) - { - if (RNA_property_type(prop) == PROP_FLOAT) { - PropertySubType pstype = RNA_property_subtype(prop); - if (pstype == PROP_DISTANCE) { - /* we don't support arrays yet */ - BLI_assert(RNA_property_array_check(prop) == FALSE); - /* initialize */ - if (!RNA_property_is_set_ex(op->ptr, prop, FALSE)) { - const float value = RNA_property_float_get_default(op->ptr, prop) * dia; - RNA_property_float_set(op->ptr, prop, value); + /* always run, so the values are initialized, + * otherwise we may get differ behavior when (dia != 1.0) */ + RNA_STRUCT_BEGIN (op->ptr, prop) + { + if (RNA_property_type(prop) == PROP_FLOAT) { + PropertySubType pstype = RNA_property_subtype(prop); + if (pstype == PROP_DISTANCE) { + /* we don't support arrays yet */ + BLI_assert(RNA_property_array_check(prop) == FALSE); + /* initialize */ + if (!RNA_property_is_set_ex(op->ptr, prop, FALSE)) { + const float value = RNA_property_float_get_default(op->ptr, prop) * dia; + RNA_property_float_set(op->ptr, prop, value); + } } } } + RNA_STRUCT_END; } - RNA_STRUCT_END; - - return op->type->exec(C, op); } int WM_operator_smooth_viewtx_get(const wmOperator *op) |