Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_modes.c
| Show All 24 Lines | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_workspace_types.h" | #include "DNA_workspace_types.h" | ||||
| #include "BLI_kdopbvh.h" | #include "BLI_kdopbvh.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "PIL_time.h" | |||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_gpencil_modifier.h" | #include "BKE_gpencil_modifier.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| ▲ Show 20 Lines • Show All 389 Lines • ▼ Show 20 Lines | if (!ED_view3d_autodist_simple(region, mval, global_loc, 0, NULL)) { | ||||
| return; | return; | ||||
| } | } | ||||
| UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; | UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; | ||||
| copy_v3_v3(ups->average_stroke_accum, global_loc); | copy_v3_v3(ups->average_stroke_accum, global_loc); | ||||
| ups->average_stroke_counter = 1; | ups->average_stroke_counter = 1; | ||||
| ups->last_stroke_valid = true; | ups->last_stroke_valid = true; | ||||
| } | } | ||||
| static void object_transfer_mode_overlay_flash_animation_start(bContext *C, Object *ob_dst) | |||||
| { | |||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | |||||
| Object *ob_dst_eval = DEG_get_evaluated_object(depsgraph, ob_dst); | |||||
| ob_dst_eval->runtime.overlay_flash_start_time = PIL_check_seconds_timer(); | |||||
| } | |||||
| static bool object_transfer_mode_to_base(bContext *C, wmOperator *op, Base *base_dst) | static bool object_transfer_mode_to_base(bContext *C, wmOperator *op, Base *base_dst) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| if (base_dst == NULL) { | if (base_dst == NULL) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| Show All 21 Lines | if (ED_object_mode_set_ex(C, OB_MODE_OBJECT, true, op->reports)) { | ||||
| BKE_view_layer_base_select_and_set_active(view_layer, base); | BKE_view_layer_base_select_and_set_active(view_layer, base); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); | DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); | ||||
| ED_undo_push(C, "Change Active"); | ED_undo_push(C, "Change Active"); | ||||
| ob_dst_orig = DEG_get_original_object(ob_dst); | ob_dst_orig = DEG_get_original_object(ob_dst); | ||||
| ED_object_mode_set_ex(C, last_mode, true, op->reports); | ED_object_mode_set_ex(C, last_mode, true, op->reports); | ||||
| object_transfer_mode_overlay_flash_animation_start(C, ob_dst); | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | ||||
| WM_toolsystem_update_from_context_view3d(C); | WM_toolsystem_update_from_context_view3d(C); | ||||
| mode_transfered = true; | mode_transfered = true; | ||||
| } | } | ||||
| ED_undo_group_end(C); | ED_undo_group_end(C); | ||||
| return mode_transfered; | return mode_transfered; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines | |||||