diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2018-07-03 09:42:12 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2018-07-03 09:42:12 +0300 |
commit | a754d222baa46d4c37e38e17fbc2df77de7ffe3b (patch) | |
tree | c2e198e18d7df574b41007d665dd7d54e34667f1 /source/blender/editors/object | |
parent | 54aaceaabcad3419adb2c65c3aa6bf655329661e (diff) | |
parent | 08836b73fe2768093e85746875c8d361b4014067 (diff) |
Merge branch 'hair_guides' into tmp_hair_curves
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.c | 9 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 7 | ||||
-rw-r--r-- | source/blender/editors/object/object_data_transfer.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 12 | ||||
-rw-r--r-- | source/blender/editors/object/object_facemap_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_intern.h | 5 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 24 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 24 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_shapekey.c | 9 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 75 |
13 files changed, 90 insertions, 94 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index ac3f8d58de8..a8c3c905dd4 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -333,7 +333,8 @@ bool ED_object_add_generic_get_opts(bContext *C, wmOperator *op, const char view /* Get layers! */ { - int a, layer_values[20]; + int a; + bool layer_values[20]; if (!layer) layer = &_layer; @@ -1660,7 +1661,7 @@ static void curvetomesh(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object } } -static int convert_poll(bContext *C) +static bool convert_poll(bContext *C) { Scene *scene = CTX_data_scene(C); Base *base_act = CTX_data_active_base(C); @@ -2475,7 +2476,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot) /**************************** Join *************************/ -static int join_poll(bContext *C) +static bool join_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -2527,7 +2528,7 @@ void OBJECT_OT_join(wmOperatorType *ot) /**************************** Join as Shape Key*************************/ -static int join_shapes_poll(bContext *C) +static bool join_shapes_poll(bContext *C) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 3b5a8d190ff..d7bef459b82 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -578,7 +578,7 @@ static const EnumPropertyItem constraint_owner_items[] = { {0, NULL, 0, NULL, NULL}}; -static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) +static bool edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", rna_type); Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C); @@ -606,7 +606,7 @@ static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) return 1; } -static int edit_constraint_poll(bContext *C) +static bool edit_constraint_poll(bContext *C) { return edit_constraint_poll_generic(C, &RNA_Constraint); } @@ -1265,7 +1265,7 @@ void ED_object_constraint_dependency_tag_update(Main *bmain, Object *ob, bConstr DEG_relations_tag_update(bmain); } -static int constraint_poll(bContext *C) +static bool constraint_poll(bContext *C) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); return (ptr.id.data && ptr.data); @@ -2102,4 +2102,3 @@ void POSE_OT_ik_clear(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } - diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 788f0826848..f56fd560946 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -442,7 +442,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op) /* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */ /* Note this context poll is only really partial, it cannot check for all possible invalid cases. */ -static int data_transfer_poll(bContext *C) +static bool data_transfer_poll(bContext *C) { Object *ob = ED_object_active_context(C); ID *data = (ob) ? ob->data : NULL; @@ -610,7 +610,7 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot) * or as a DataTransfer modifier tool. */ -static int datalayout_transfer_poll(bContext *C) +static bool datalayout_transfer_poll(bContext *C) { return (edit_modifier_poll_generic(C, &RNA_DataTransferModifier, (1 << OB_MESH)) || data_transfer_poll(C)); } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index e14842c0daa..0ca797e43b6 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -148,7 +148,7 @@ Object *ED_object_active_context(bContext *C) /* ********************** object hiding *************************** */ -static int object_hide_poll(bContext *C) +static bool object_hide_poll(bContext *C) { if (CTX_wm_space_outliner(C) != NULL) { return ED_outliner_collections_editor_poll(C); @@ -714,7 +714,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int editmode_toggle_poll(bContext *C) +static bool editmode_toggle_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -1325,7 +1325,7 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot) /* --------- */ -static int object_update_paths_poll(bContext *C) +static bool object_update_paths_poll(bContext *C) { if (ED_operator_object_active_editable(C)) { Object *ob = ED_object_active_context(C); @@ -1494,7 +1494,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) return (done) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -static int shade_poll(bContext *C) +static bool shade_poll(bContext *C) { return (CTX_data_edit_object(C) == NULL); } @@ -1581,7 +1581,7 @@ static const EnumPropertyItem *object_mode_set_itemsf( return item; } -static int object_mode_set_poll(bContext *C) +static bool object_mode_set_poll(bContext *C) { /* Since Grease Pencil editmode is also handled here, * we have a special exception for allowing this operator @@ -1779,7 +1779,7 @@ bool ED_object_editmode_calc_active_center(Object *obedit, const bool select_onl return false; } -static int move_to_collection_poll(bContext *C) +static bool move_to_collection_poll(bContext *C) { if (CTX_wm_space_outliner(C) != NULL) { return ED_outliner_collections_editor_poll(C); diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c index c5882560083..a561556bba0 100644 --- a/source/blender/editors/object/object_facemap_ops.c +++ b/source/blender/editors/object/object_facemap_ops.c @@ -163,14 +163,14 @@ static void object_facemap_swap(Object *ob, int num1, int num2) object_fmap_swap_object_mode(ob, num1, num2); } -static int face_map_supported_poll(bContext *C) +static bool face_map_supported_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; return (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib); } -static int face_map_supported_edit_mode_poll(bContext *C) +static bool face_map_supported_edit_mode_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 6a3cb9aa097..392fde4ceec 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -434,7 +434,7 @@ static void object_hook_select(Object *ob, HookModifierData *hmd) /* special poll operators for hook operators */ /* TODO: check for properties window modifier context too as alternative? */ -static int hook_op_edit_poll(bContext *C) +static bool hook_op_edit_poll(bContext *C) { Object *obedit = CTX_data_edit_object(C); @@ -917,4 +917,3 @@ void OBJECT_OT_hook_select(wmOperatorType *ot) RNA_def_enum_funcs(prop, hook_mod_itemf); RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE); } - diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 19e9c4c1aa7..e9e3c4de5d6 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -145,8 +145,8 @@ void COLLECTION_OT_objects_add_active(struct wmOperatorType *ot); void COLLECTION_OT_objects_remove_active(struct wmOperatorType *ot); /* object_modifier.c */ -int edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag); -int edit_modifier_poll(struct bContext *C); +bool edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag); +bool edit_modifier_poll(struct bContext *C); void edit_modifier_properties(struct wmOperatorType *ot); int edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op); struct ModifierData *edit_modifier_property_get(struct wmOperator *op, struct Object *ob, int type); @@ -274,4 +274,3 @@ void OBJECT_OT_data_transfer(struct wmOperatorType *ot); void OBJECT_OT_datalayout_transfer(struct wmOperatorType *ot); #endif /* __OBJECT_INTERN_H__ */ - diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 5e753c458c6..d9fefd2b5a9 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -641,7 +641,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices"); vertexCos = BKE_curve_nurbs_vertexCos_get(&cu->nurb, &numVerts); - modifier_deformVerts_DM_deprecated(md, &mectx, NULL, vertexCos, numVerts); + modifier_deformVerts(md, &mectx, NULL, vertexCos, numVerts); BK_curve_nurbs_vertexCos_apply(&cu->nurb, vertexCos); MEM_freeN(vertexCos); @@ -819,7 +819,7 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot) /************************ generic functions for operators using mod names and data context *********************/ -int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) +bool edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) { PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type); Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C); @@ -841,7 +841,7 @@ int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag return 1; } -int edit_modifier_poll(bContext *C) +bool edit_modifier_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_Modifier, 0); } @@ -1146,7 +1146,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot) /************* multires delete higher levels operator ****************/ -static int multires_poll(bContext *C) +static bool multires_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1 << OB_MESH)); } @@ -1475,13 +1475,13 @@ static void modifier_skin_customdata_delete(Object *ob) CustomData_free_layer_active(&me->vdata, CD_MVERT_SKIN, me->totvert); } -static int skin_poll(bContext *C) +static bool skin_poll(bContext *C) { return (!CTX_data_edit_object(C) && edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH))); } -static int skin_edit_poll(bContext *C) +static bool skin_edit_poll(bContext *C) { return (CTX_data_edit_object(C) && edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH))); @@ -1849,7 +1849,7 @@ void OBJECT_OT_skin_armature_create(wmOperatorType *ot) } /************************ delta mush bind operator *********************/ -static int correctivesmooth_poll(bContext *C) +static bool correctivesmooth_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_CorrectiveSmoothModifier, 0); } @@ -1917,7 +1917,7 @@ void OBJECT_OT_correctivesmooth_bind(wmOperatorType *ot) /************************ mdef bind operator *********************/ -static int meshdeform_poll(bContext *C) +static bool meshdeform_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, 0); } @@ -2013,7 +2013,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot) /****************** explode refresh operator *********************/ -static int explode_poll(bContext *C) +static bool explode_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_ExplodeModifier, 0); } @@ -2061,7 +2061,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot) /****************** ocean bake operator *********************/ -static int ocean_bake_poll(bContext *C) +static bool ocean_bake_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_OceanModifier, 0); } @@ -2279,7 +2279,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot) /************************ LaplacianDeform bind operator *********************/ -static int laplaciandeform_poll(bContext *C) +static bool laplaciandeform_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0); } @@ -2355,7 +2355,7 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot) /************************ sdef bind operator *********************/ -static int surfacedeform_bind_poll(bContext *C) +static bool surfacedeform_bind_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_SurfaceDeformModifier, 0); } diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 4687e400491..676098f9f2d 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -279,7 +279,7 @@ void ED_operatormacros_object(void) } -static int object_mode_poll(bContext *C) +static bool object_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); return (!ob || ob->mode == OB_MODE_OBJECT); @@ -300,7 +300,9 @@ void ED_keymap_object(wmKeyConfig *keyconf) kmi = WM_keymap_add_menu_pie(keymap, "VIEW3D_MT_object_mode_pie", TABKEY, KM_CLICK_DRAG, 0, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "OBJECT_OT_origin_set", CKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_CTRL, 0); +#endif /* Object Mode ---------------------------------------------------------------- */ /* Note: this keymap gets disabled in non-objectmode, */ @@ -321,7 +323,9 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); +#endif kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0); RNA_enum_set_identifier(NULL, kmi->ptr, "direction", "PARENT"); @@ -340,14 +344,19 @@ void ED_keymap_object(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "extend", true); WM_keymap_verify_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); +#endif WM_keymap_verify_item(keymap, "OBJECT_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_verify_item(keymap, "OBJECT_OT_track_set", TKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_verify_item(keymap, "OBJECT_OT_track_clear", TKEY, KM_PRESS, KM_ALT, 0); +#endif +#ifdef USE_WM_KEYMAP_27X WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); - +#endif kmi = WM_keymap_add_item(keymap, "OBJECT_OT_location_clear", GKEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "clear_delta", false); @@ -356,11 +365,12 @@ void ED_keymap_object(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "OBJECT_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "clear_delta", false); +#ifdef USE_WM_KEYMAP_27X WM_keymap_verify_item(keymap, "OBJECT_OT_origin_clear", OKEY, KM_PRESS, KM_ALT, 0); +#endif kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "use_global", false); - kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "use_global", true); @@ -371,19 +381,25 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); +#endif WM_keymap_add_menu(keymap, "VIEW3D_MT_object_apply", AKEY, KM_PRESS, KM_CTRL, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_add_menu(keymap, "VIEW3D_MT_make_single_user", UKEY, KM_PRESS, 0, 0); +#endif WM_keymap_add_menu(keymap, "VIEW3D_MT_make_links", LKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move_linked", DKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "OBJECT_OT_convert", CKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_make_local", LKEY, KM_PRESS, 0, 0); +#endif /* XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith */ WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0); @@ -398,7 +414,9 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0); +#ifdef USE_WM_KEYMAP_27X WM_keymap_verify_item(keymap, "OBJECT_OT_data_transfer", TKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); +#endif /* XXX No more available 'T' shortcuts... :/ */ /* WM_keymap_verify_item(keymap, "OBJECT_OT_datalayout_transfer", TKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f2e996237cf..324b6eca34a 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -118,7 +118,7 @@ /*********************** Make Vertex Parent Operator ************************/ -static int vertex_parent_set_poll(bContext *C) +static bool vertex_parent_set_poll(bContext *C) { return ED_operator_editmesh(C) || ED_operator_editsurfcurve(C) || ED_operator_editlattice(C); } @@ -2343,7 +2343,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op) new_ob->id.override_static->flag &= ~STATICOVERRIDE_AUTO; } /* We still want to store all objects' current override status (i.e. change of parent). */ - BKE_override_static_operations_create(&new_ob->id, true); + BKE_override_static_operations_create(bmain, &new_ob->id, true); } } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; @@ -2387,7 +2387,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op) return success ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -static int make_override_static_poll(bContext *C) +static bool make_override_static_poll(bContext *C) { Object *obact = CTX_data_active_object(C); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 7d7871c0326..b1dee812f45 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -134,7 +134,7 @@ void ED_object_base_activate(bContext *C, Base *base) /********************** Selection Operators **********************/ -static int objects_selectable_poll(bContext *C) +static bool objects_selectable_poll(bContext *C) { /* we don't check for linked scenes here, selection is * still allowed then for inspection of scene */ diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 4f985293ec3..5e66dc00fd2 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -224,14 +224,14 @@ static bool object_shape_key_mirror(bContext *C, Object *ob, /********************** shape key operators *********************/ -static int shape_key_mode_poll(bContext *C) +static bool shape_key_mode_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && ob->mode != OB_MODE_EDIT); } -static int shape_key_mode_exists_poll(bContext *C) +static bool shape_key_mode_exists_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -242,7 +242,7 @@ static int shape_key_mode_exists_poll(bContext *C) (BKE_keyblock_from_object(ob) != NULL); } -static int shape_key_move_poll(bContext *C) +static bool shape_key_move_poll(bContext *C) { /* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */ Object *ob = ED_object_context(C); @@ -253,7 +253,7 @@ static int shape_key_move_poll(bContext *C) ob->mode != OB_MODE_EDIT && key && key->totkey > 1); } -static int shape_key_poll(bContext *C) +static bool shape_key_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -502,4 +502,3 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", ""); } - diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index a6f688c49fb..ca5c000819d 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -63,7 +63,6 @@ #include "BKE_layer.h" #include "BKE_modifier.h" #include "BKE_report.h" -#include "BKE_DerivedMesh.h" #include "BKE_object_deform.h" #include "BKE_object.h" #include "BKE_lattice.h" @@ -1258,27 +1257,6 @@ static void getVerticalAndHorizontalChange( changes[index][1] = len_v3v3(projA, projB); } -/* I need the derived mesh to be forgotten so the positions are recalculated - * with weight changes (see dm_deform_recalc) */ -static void dm_deform_clear(DerivedMesh *dm, Object *ob) -{ - if (ob->derivedDeform && (ob->derivedDeform) == dm) { - ob->derivedDeform->needsFree = 1; - ob->derivedDeform->release(ob->derivedDeform); - ob->derivedDeform = NULL; - } - else if (dm) { - dm->needsFree = 1; - dm->release(dm); - } -} - -/* recalculate the deformation */ -static DerivedMesh *dm_deform_recalc(Depsgraph *depsgraph, Scene *scene, Object *ob) -{ - return mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); -} - /* by changing nonzero weights, try to move a vertex in me->mverts with index 'index' to * distToBe distance away from the provided plane strength can change distToBe so that it moves * towards distToBe by that percentage cp changes how much the weights are adjusted @@ -1292,7 +1270,7 @@ static void moveCloserToDistanceFromPlane( Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *me, int index, float norm[3], float coord[3], float d, float distToBe, float strength, float cp) { - DerivedMesh *dm; + Mesh *me_deform; MDeformWeight *dw; MVert m; MDeformVert *dvert = me->dvert + index; @@ -1316,8 +1294,8 @@ static void moveCloserToDistanceFromPlane( float originalDistToBe = distToBe; do { wasChange = false; - dm = dm_deform_recalc(depsgraph, scene, ob); - dm->getVert(dm, index, &m); + me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); + m = me_deform->mvert[index]; copy_v3_v3(oldPos, m.co); distToStart = dot_v3v3(norm, oldPos) + d; @@ -1335,8 +1313,10 @@ static void moveCloserToDistanceFromPlane( continue; } for (k = 0; k < 2; k++) { - if (dm) { - dm_deform_clear(dm, ob); dm = NULL; + if (me_deform) { + /* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs! + * Better to over-free and recompute a bit. */ + BKE_object_free_derived_caches(ob); } oldw = dw->weight; if (k) { @@ -1354,8 +1334,8 @@ static void moveCloserToDistanceFromPlane( if (dw->weight > 1) { dw->weight = 1; } - dm = dm_deform_recalc(depsgraph, scene, ob); - dm->getVert(dm, index, &m); + me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); + m = me_deform->mvert[index]; getVerticalAndHorizontalChange(norm, d, coord, oldPos, distToStart, m.co, changes, dists, i); dw->weight = oldw; if (!k) { @@ -1449,8 +1429,10 @@ static void moveCloserToDistanceFromPlane( if (oldw == dw->weight) { wasChange = false; } - if (dm) { - dm_deform_clear(dm, ob); dm = NULL; + if (me_deform) { + /* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs! + * Better to over-free and recompute a bit. */ + BKE_object_free_derived_caches(ob); } } } while (wasChange && ((distToStart - distToBe) / fabsf(distToStart - distToBe) == @@ -1482,11 +1464,10 @@ static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distTo MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints"); int k; - DerivedMesh *dm = mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); + Mesh *me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); k = count; while (k--) { - dm->getVert(dm, verts[k], &m); - p[k] = m; + p[k] = me_deform->mvert[verts[k]]; } if (count >= 3) { @@ -1494,7 +1475,7 @@ static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distTo float coord[3]; float norm[3]; getSingleCoordinate(p, count, coord); - dm->getVert(dm, i, &m); + m = me_deform->mvert[i]; sub_v3_v3v3(norm, m.co, coord); mag = normalize_v3(norm); if (mag) { /* zeros fix */ @@ -2485,7 +2466,7 @@ static void vgroup_assign_verts(Object *ob, const float weight) /********************** vertex group operators *********************/ -static int vertex_group_poll(bContext *C) +static bool vertex_group_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2496,7 +2477,7 @@ static int vertex_group_poll(bContext *C) ob->defbase.first); } -static int vertex_group_supported_poll(bContext *C) +static bool vertex_group_supported_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2504,7 +2485,7 @@ static int vertex_group_supported_poll(bContext *C) data && !ID_IS_LINKED(data)); } -static int vertex_group_mesh_poll(bContext *C) +static bool vertex_group_mesh_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2515,7 +2496,7 @@ static int vertex_group_mesh_poll(bContext *C) ob->defbase.first); } -static int UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C) +static bool UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2523,7 +2504,7 @@ static int UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C) } -static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) +static bool UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2535,7 +2516,7 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) } /* editmode _or_ weight paint vertex sel */ -static int vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const short ob_type_flag) +static bool vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const short ob_type_flag) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2570,25 +2551,25 @@ static int vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const } #if 0 -static int vertex_group_vert_poll(bContext *C) +static bool vertex_group_vert_poll(bContext *C) { return vertex_group_vert_poll_ex(C, false, 0); } #endif -static int vertex_group_mesh_vert_poll(bContext *C) +static bool vertex_group_mesh_vert_poll(bContext *C) { return vertex_group_vert_poll_ex(C, false, (1 << OB_MESH)); } -static int vertex_group_vert_select_poll(bContext *C) +static bool vertex_group_vert_select_poll(bContext *C) { return vertex_group_vert_poll_ex(C, true, 0); } #if 0 -static int vertex_group_mesh_vert_select_poll(bContext *C) +static bool vertex_group_mesh_vert_select_poll(bContext *C) { return vertex_group_vert_poll_ex(C, true, (1 << OB_MESH)); } @@ -2596,7 +2577,7 @@ static int vertex_group_mesh_vert_select_poll(bContext *C) /* editmode _or_ weight paint vertex sel and active group unlocked */ -static int vertex_group_vert_select_unlocked_poll(bContext *C) +static bool vertex_group_vert_select_unlocked_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2619,7 +2600,7 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C) return 1; } -static int vertex_group_vert_select_mesh_poll(bContext *C) +static bool vertex_group_vert_select_mesh_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; |