|
Blender
V2.93
|
#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 "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_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.
Functions | |
High Level Mode Operations | |
| static const char * | object_mode_op_string (eObjectMode mode) |
| bool | ED_object_mode_compat_test (const Object *ob, eObjectMode mode) |
| bool | ED_object_mode_compat_set (bContext *C, Object *ob, eObjectMode mode, ReportList *reports) |
Generic Mode Enter/Exit | |
Supports exiting a mode without it being in the current context. This could be done for entering modes too if it's needed. | |
| bool | ED_object_mode_set_ex (bContext *C, eObjectMode mode, bool use_undo, ReportList *reports) |
| bool | ED_object_mode_set (bContext *C, eObjectMode mode) |
| static bool | ed_object_mode_generic_exit_ex (struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, bool only_test) |
| static void | ed_object_posemode_set_for_weight_paint_ex (bContext *C, Main *bmain, Object *ob_arm, const bool is_mode_set) |
| void | ED_object_posemode_set_for_weight_paint (bContext *C, Main *bmain, Object *ob, const bool is_mode_set) |
| void | ED_object_mode_generic_exit (struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob) |
| bool | ED_object_mode_generic_has_data (struct Depsgraph *depsgraph, struct Object *ob) |
Transfer Mode | |
Enters the same mode of the current active object in another object, leaving the mode of the current object. | |
| static bool | object_transfer_mode_poll (bContext *C) |
| static void | object_transfer_mode_reposition_view_pivot (bContext *C, const int mval[2]) |
| static bool | object_transfer_mode_to_base (bContext *C, wmOperator *op, Base *base_dst) |
| static int | object_transfer_mode_modal (bContext *C, wmOperator *op, const wmEvent *event) |
| static int | object_transfer_mode_invoke (bContext *C, wmOperator *op, const wmEvent *event) |
| void | OBJECT_OT_transfer_mode (wmOperatorType *ot) |
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 | ( | bContext * | C, |
| Object * | ob, | ||
| eObjectMode | mode, | ||
| 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 165 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 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 | ||
| ) |
Checks the mode to be set is compatible with the object should be made into a generic function
Definition at line 116 of file object_modes.c.
References OB_ARMATURE, OB_CURVE, 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_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 391 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 245 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 399 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 235 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(), 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 195 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 361 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 329 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 71 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_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 545 of file object_modes.c.
References wmOperatorType::description, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, object_transfer_mode_invoke(), object_transfer_mode_modal(), object_transfer_mode_poll(), OPTYPE_REGISTER, ot, wmOperatorType::poll, RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_object().
|
static |
Definition at line 519 of file object_modes.c.
References C, CTX_data_active_object(), CTX_wm_window(), ED_view3d_give_base_under_cursor(), ED_workspace_status_text(), Object::mode, wmEvent::mval, OB_MODE_ALL_PAINT, object_transfer_mode_reposition_view_pivot(), object_transfer_mode_to_base(), OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, wmOperator::ptr, RNA_boolean_get(), TIP_, WM_CURSOR_EYEDROPPER, WM_cursor_modal_set(), and WM_event_add_modal_handler().
Referenced by OBJECT_OT_transfer_mode().
|
static |
Definition at line 484 of file object_modes.c.
References BKE_screen_find_main_region_at_xy(), C, CTX_wm_screen(), CTX_wm_window(), ED_view3d_give_base_under_cursor(), ED_workspace_status_text(), KM_PRESS, LEFTMOUSE, NULL, object_transfer_mode_to_base(), OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, RIGHTMOUSE, SPACE_VIEW3D, wmEvent::type, wmEvent::val, ARegion::winrct, WM_cursor_modal_restore(), wmEvent::x, rcti::xmin, wmEvent::y, and rcti::ymin.
Referenced by OBJECT_OT_transfer_mode().
|
static |
Definition at line 413 of file object_modes.c.
References C, CTX_data_active_object(), CTX_wm_region_view3d(), Object::mode, and OB_MODE_SCULPT.
Referenced by OBJECT_OT_transfer_mode().
|
static |
Definition at line 423 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 438 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_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, wmOperator::reports, scene, WM_event_add_notifier(), and WM_toolsystem_update_from_context_view3d().
Referenced by object_transfer_mode_invoke(), and object_transfer_mode_modal().