Blender
V3.3
|
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_workspace_types.h"
#include "BLI_kdopbvh.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "ED_armature.h"
#include "ED_gpencil.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_transform_snap_object_context.h"
#include "ED_undo.h"
#include "ED_view3d.h"
#include "WM_toolsystem.h"
#include "ED_object.h"
#include "object_intern.h"
Go to the source code of this file.
General utils to handle mode switching, actual mode switching logic is per-object type.
Definition in file object_modes.c.
bool ED_object_mode_compat_set | ( | struct bContext * | C, |
struct Object * | ob, | ||
eObjectMode | mode, | ||
struct ReportList * | reports | ||
) |
Sets the mode to a compatible state (use before entering the mode).
This is so each mode's exec function can call
Definition at line 161 of file object_modes.c.
References BKE_reportf(), C, ELEM, Object::mode, wmOperatorType::name, NULL, OB_MODE_OBJECT, object_mode_op_string(), ot, RPT_ERROR, WM_OP_EXEC_REGION_WIN, WM_operator_name_call(), and WM_operatortype_find().
Referenced by blender::ed::sculpt_paint::curves_sculptmode_toggle_exec(), editmode_toggle_exec(), particle_edit_toggle_exec(), posemode_exec(), sculpt_mode_toggle_exec(), texture_paint_toggle_exec(), vpaint_mode_toggle_exec(), and wpaint_mode_toggle_exec().
bool ED_object_mode_compat_test | ( | const Object * | ob, |
eObjectMode | mode | ||
) |
Definition at line 104 of file object_modes.c.
References ED_object_particle_edit_mode_supported(), OB_ARMATURE, OB_CURVES, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL, OB_LATTICE, OB_MBALL, OB_MESH, OB_MODE_EDIT, OB_MODE_EDIT_GPENCIL, OB_MODE_OBJECT, OB_MODE_PAINT_GPENCIL, OB_MODE_PARTICLE_EDIT, OB_MODE_POSE, OB_MODE_SCULPT, OB_MODE_SCULPT_CURVES, OB_MODE_SCULPT_GPENCIL, OB_MODE_TEXTURE_PAINT, OB_MODE_VERTEX_GPENCIL, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_GPENCIL, OB_MODE_WEIGHT_PAINT, OB_SURF, and Object::type.
Referenced by ED_object_mode_set_ex(), and object_transfer_mode_to_base().
void ED_object_mode_generic_exit | ( | struct Main * | bmain, |
struct Depsgraph * | depsgraph, | ||
struct Scene * | scene, | ||
struct Object * | ob | ||
) |
Definition at line 387 of file object_modes.c.
References depsgraph, ed_object_mode_generic_exit_ex(), and scene.
Referenced by ed_object_select_pick(), sculpt_undosys_step_decode(), and tree_element_object_activate().
|
static |
Use for changing works-paces or changing active object. Caller can check OB_MODE_ALL_MODE_DATA to test if this needs to be run.
Definition at line 241 of file object_modes.c.
References BKE_object_is_in_editmode(), BLI_assert, depsgraph, ED_object_editmode_exit_ex(), ED_object_gpencil_exit(), ED_object_particle_edit_mode_exit_ex(), ED_object_posemode_exit_ex(), ED_object_sculptmode_exit_ex(), ED_object_texture_paint_mode_exit_ex(), ED_object_vpaintmode_exit_ex(), ED_object_wpaintmode_exit_ex(), EM_FREEDATA, Object::mode, SculptSession::mode_type, NULL, OB_GPENCIL, OB_MODE_ALL_MODE_DATA, OB_MODE_EDIT, OB_MODE_OBJECT, OB_MODE_PARTICLE_EDIT, OB_MODE_POSE, OB_MODE_SCULPT, OB_MODE_TEXTURE_PAINT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, Object::pose, scene, Object::sculpt, and Object::type.
Referenced by ED_object_mode_generic_exit(), and ED_object_mode_generic_has_data().
Definition at line 395 of file object_modes.c.
References depsgraph, ed_object_mode_generic_exit_ex(), and NULL.
bool ED_object_mode_set | ( | bContext * | C, |
eObjectMode | mode | ||
) |
Definition at line 231 of file object_modes.c.
References C, ED_object_mode_set_ex(), and NULL.
Referenced by do_outliner_item_mode_toggle_generic(), ED_editors_init(), ED_object_jump_to_bone(), ED_workspace_change(), blender::io::obj::exporter_main(), insert_key_exec(), view3d_object_mode_menu(), and workspace_change_update().
bool ED_object_mode_set_ex | ( | bContext * | C, |
eObjectMode | mode, | ||
bool | use_undo, | ||
ReportList * | reports | ||
) |
Definition at line 191 of file object_modes.c.
References BKE_reportf(), C, CTX_data_view_layer(), CTX_wm_manager(), ED_object_mode_compat_test(), Object::mode, wmOperatorType::name, NULL, OB_GPENCIL, OB_MODE_EDIT, OB_MODE_EDIT_GPENCIL, OB_MODE_OBJECT, OBACT, object_mode_op_string(), wmWindowManager::op_undo_depth, ot, RPT_ERROR, Object::type, WM_OP_EXEC_REGION_WIN, WM_operator_name_call_ptr(), and WM_operatortype_find().
Referenced by ED_object_mode_set(), image_undosys_step_decode(), object_mode_set_exec(), and object_transfer_mode_to_base().
void ED_object_posemode_set_for_weight_paint | ( | bContext * | C, |
Main * | bmain, | ||
Object * | ob, | ||
const bool | is_mode_set | ||
) |
Definition at line 357 of file object_modes.c.
References BKE_gpencil_modifiers_get_virtual_modifierlist(), BKE_modifiers_get_virtual_modifierlist(), C, ed_object_posemode_set_for_weight_paint_ex(), eGpencilModifierType_Armature, eModifierType_Armature, GpencilModifierData::next, ModifierData::next, OB_GPENCIL, ArmatureGpencilModifierData::object, ArmatureModifierData::object, GpencilModifierData::type, ModifierData::type, and Object::type.
Referenced by gpencil_weightmode_toggle_exec(), and wpaint_mode_toggle_exec().
|
static |
Definition at line 325 of file object_modes.c.
References BASE_SELECTED, BASE_VISIBLE, BKE_view_layer_base_find(), C, CTX_data_view_layer(), CTX_wm_view3d(), ED_object_posemode_enter_ex(), ED_object_posemode_exit_ex(), Base::flag, Object::mode, NULL, and OB_MODE_POSE.
Referenced by ED_object_posemode_set_for_weight_paint().
|
static |
Definition at line 60 of file object_modes.c.
References NULL, OB_MODE_EDIT, OB_MODE_EDIT_GPENCIL, OB_MODE_PAINT_GPENCIL, OB_MODE_PARTICLE_EDIT, OB_MODE_POSE, OB_MODE_SCULPT, OB_MODE_SCULPT_CURVES, OB_MODE_SCULPT_GPENCIL, OB_MODE_TEXTURE_PAINT, OB_MODE_VERTEX_GPENCIL, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_GPENCIL, and OB_MODE_WEIGHT_PAINT.
Referenced by ED_object_mode_compat_set(), and ED_object_mode_set_ex().
void OBJECT_OT_transfer_mode | ( | wmOperatorType * | ot | ) |
Definition at line 511 of file object_modes.c.
References wmOperatorType::cursor_pending, wmOperatorType::description, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, object_transfer_mode_invoke(), object_transfer_mode_poll(), OPTYPE_DEPENDS_ON_CURSOR, OPTYPE_REGISTER, ot, wmOperatorType::poll, RNA_def_boolean(), wmOperatorType::srna, and WM_CURSOR_EYEDROPPER.
Referenced by ED_operatortypes_object().
Definition at line 434 of file object_modes.c.
References C, CTX_data_depsgraph_pointer(), DEG_get_evaluated_object(), depsgraph, Object_Runtime::overlay_mode_transfer_start_time, PIL_check_seconds_timer(), and Object::runtime.
Referenced by object_transfer_mode_to_base().
|
static |
Definition at line 493 of file object_modes.c.
References C, CTX_data_active_object(), ED_view3d_give_base_under_cursor(), Object::mode, wmEvent::mval, OB_MODE_ALL_PAINT, object_transfer_mode_reposition_view_pivot(), object_transfer_mode_to_base(), OPERATOR_CANCELLED, and OPERATOR_FINISHED.
Referenced by OBJECT_OT_transfer_mode().
Definition at line 409 of file object_modes.c.
References C, CTX_data_active_object(), CTX_wm_region_view3d(), Object::mode, and OB_MODE_OBJECT.
Referenced by OBJECT_OT_transfer_mode().
Definition at line 419 of file object_modes.c.
References UnifiedPaintSettings::average_stroke_accum, UnifiedPaintSettings::average_stroke_counter, C, copy_v3_v3(), CTX_data_scene(), CTX_wm_region(), ED_view3d_autodist_simple(), UnifiedPaintSettings::last_stroke_valid, NULL, scene, Scene::toolsettings, and ToolSettings::unified_paint_settings.
Referenced by object_transfer_mode_invoke().
|
static |
Definition at line 441 of file object_modes.c.
References BKE_view_layer_base_deselect_all(), BKE_view_layer_base_find(), BKE_view_layer_base_select_and_set_active(), C, CTX_data_active_object(), CTX_data_scene(), CTX_data_view_layer(), DEG_get_original_object(), DEG_id_tag_update(), ED_object_mode_compat_test(), ED_object_mode_set_ex(), ED_outliner_select_sync_from_object_tag(), ED_undo_group_begin(), ED_undo_group_end(), ED_undo_push(), Scene::id, ID_RECALC_SELECT, if(), Object::mode, NC_SCENE, ND_OB_SELECT, NULL, OB_MODE_OBJECT, Base::object, object_overlay_mode_transfer_animation_start(), wmOperator::ptr, wmOperator::reports, RNA_boolean_get(), scene, WM_event_add_notifier(), and WM_toolsystem_update_from_context_view3d().
Referenced by object_transfer_mode_invoke().