|
Blender V4.3
|
Go to the source code of this file.
Classes | |
| struct | bToolKey |
Macros | |
| #define | WM_TOOLSYSTEM_SPACE_MASK ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ)) |
| #define | WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE ((1 << SPACE_IMAGE) | (1 << SPACE_SEQ)) |
| #define | WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, r_ptr) WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr) |
| #define | WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr) WM_toolsystem_ref_properties_ensure_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr) |
| #define | WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr) WM_toolsystem_ref_properties_get_ex(tref, (ot)->idname, (ot)->srna, r_ptr) |
| #define | WM_toolsystem_ref_properties_get_from_gizmo_group(tref, gzgroup, r_ptr) WM_toolsystem_ref_properties_get_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr) |
| #define WM_toolsystem_ref_properties_ensure_from_gizmo_group | ( | tref, | |
| gzgroup, | |||
| r_ptr ) WM_toolsystem_ref_properties_ensure_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr) |
Definition at line 123 of file WM_toolsystem.hh.
Referenced by gizmo_mesh_extrude_refresh(), gizmo_mesh_spin_init_draw_prepare(), gizmo_mesh_spin_init_refresh(), and transform_from_gizmo_invoke().
| #define WM_toolsystem_ref_properties_ensure_from_operator | ( | tref, | |
| ot, | |||
| r_ptr ) WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr) |
Definition at line 121 of file WM_toolsystem.hh.
| #define WM_toolsystem_ref_properties_get_from_gizmo_group | ( | tref, | |
| gzgroup, | |||
| r_ptr ) WM_toolsystem_ref_properties_get_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr) |
Definition at line 132 of file WM_toolsystem.hh.
Referenced by tool_generic_create_gizmo().
| #define WM_toolsystem_ref_properties_get_from_operator | ( | tref, | |
| ot, | |||
| r_ptr ) WM_toolsystem_ref_properties_get_ex(tref, (ot)->idname, (ot)->srna, r_ptr) |
Definition at line 130 of file WM_toolsystem.hh.
Referenced by WM_gizmo_operator_invoke().
| #define WM_TOOLSYSTEM_SPACE_MASK ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ)) |
Definition at line 30 of file WM_toolsystem.hh.
Referenced by ED_area_init(), toolsystem_active_tool_from_context_or_view3d(), toolsystem_key_from_context_or_view3d(), toolsystem_ref_set_by_brush_type(), wm_draw_window_offscreen(), WM_toolsystem_ref_find(), WM_toolsystem_ref_from_context(), WM_toolsystem_ref_set_by_id_ex(), WM_toolsystem_refresh_active(), WM_toolsystem_reinit_all(), and WM_window_cursor_keymap_status_refresh().
| #define WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE ((1 << SPACE_IMAGE) | (1 << SPACE_SEQ)) |
Space-types that define their own "mode" (as returned by WM_toolsystem_mode_from_spacetype).
Definition at line 35 of file WM_toolsystem.hh.
Referenced by toolsystem_ref_set_by_brush_type(), and WM_toolsystem_ref_set_by_id_ex().
Activate the brush through the tool system. This will call BKE_paint_brush_set() with brush, but it will also switch to the tool appropriate for this brush type (if necessary) and update the current tool-brush references to remember the last used brush for that tool.
Definition at line 277 of file wm_toolsystem.cc.
References BKE_paint_brush_poll(), BKE_paint_brush_set(), BKE_paint_get_brush_type_from_paintmode(), BKE_paintmode_get_active_from_context(), BLI_assert_unreachable, bToolRef_Runtime::brush_type, brush_type_identifier_get(), brush_type_matches_active_tool(), bToolRef::runtime, toolsystem_active_tool_from_context_or_view3d(), toolsystem_brush_type_binding_update(), toolsystem_main_brush_binding_update_from_active(), toolsystem_ref_set_by_brush_type(), and WM_toolsystem_ref_set_by_id().
Referenced by blender::ed::sculpt_paint::brush_asset_activate_exec(), and blender::ed::sculpt_paint::brush_asset_save_as_exec().
| bool WM_toolsystem_active_tool_has_custom_cursor | ( | const bContext * | C | ) |
Definition at line 1099 of file wm_toolsystem.cc.
References bToolRef_Runtime::cursor, WM_CURSOR_DEFAULT, and WM_toolsystem_runtime_from_context().
Referenced by blender::ed::greasepencil::brush_cursor_poll().
| bool WM_toolsystem_active_tool_is_brush | ( | const bContext * | C | ) |
For paint modes to support non-brush tools.
Definition at line 1093 of file wm_toolsystem.cc.
References bToolRef_Runtime::flag, TOOLREF_FLAG_USE_BRUSHES, and WM_toolsystem_runtime_from_context().
Referenced by blender::ed::greasepencil::brush_cursor_poll(), brush_drawcursor(), brush_edit_poll(), blender::ed::sculpt_paint::grease_pencil_brush_stroke_poll(), blender::ed::greasepencil::grease_pencil_poll_vertex_cursor(), blender::ed::greasepencil::grease_pencil_poll_weight_cursor(), blender::ed::sculpt_paint::grease_pencil_sculpt_paint_poll(), blender::ed::sculpt_paint::grease_pencil_vertex_brush_stroke_poll(), blender::ed::sculpt_paint::grease_pencil_weight_brush_stroke_poll(), image_paint_poll_ex(), blender::ed::greasepencil::keymap_grease_pencil_brush_stroke_poll(), blender::ed::greasepencil::keymap_grease_pencil_fill_tool_poll(), vertex_paint_poll_ex(), and weight_paint_poll_ex().
| void WM_toolsystem_do_msg_notify_tag_refresh | ( | bContext * | C, |
| wmMsgSubscribeKey * | msg_key, | ||
| wmMsgSubscribeValue * | msg_val ) |
Follow wmMsgNotifyFn spec.
Definition at line 1105 of file wm_toolsystem.cc.
References BLI_findindex(), CTX_data_main(), ListBase::first, wmWindow::next, bToolKey::space_type, wmMsgSubscribeValue::user_data, Main::wm, WM_toolsystem_mode_from_spacetype(), WM_toolsystem_refresh(), WM_toolsystem_refresh_screen_area(), WM_window_get_active_scene(), WM_window_get_active_screen(), WM_window_get_active_view_layer(), and WM_window_get_active_workspace().
Referenced by view3d_main_region_message_subscribe().
| void WM_toolsystem_init | ( | const bContext * | C | ) |
Definition at line 629 of file wm_toolsystem.cc.
References BLI_assert, CTX_data_main(), CTX_wm_window(), LISTBASE_FOREACH, MEM_SAFE_FREE, and Main::workspaces.
Referenced by wm_file_read_post().
| bool WM_toolsystem_key_from_context | ( | const Scene * | scene, |
| ViewLayer * | view_layer, | ||
| ScrArea * | area, | ||
| bToolKey * | tkey ) |
Definition at line 700 of file wm_toolsystem.cc.
References bToolKey::mode, SPACE_EMPTY, bToolKey::space_type, and WM_toolsystem_mode_from_spacetype().
Referenced by WM_toolsystem_ref_set_by_id().
| int WM_toolsystem_mode_from_spacetype | ( | const Scene * | scene, |
| ViewLayer * | view_layer, | ||
| ScrArea * | area, | ||
| int | space_type ) |
Definition at line 662 of file wm_toolsystem.cc.
References BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), CTX_data_mode_enum_ex(), CTX_MODE_OBJECT, Object::mode, SpaceImage::mode, OBEDIT_FROM_OBACT, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, SPACE_VIEW3D, and SpaceSeq::view.
Referenced by toolsystem_active_tool_from_context_or_view3d(), toolsystem_key_from_context_or_view3d(), toolsystem_refresh_screen_from_active_tool(), WM_toolsystem_do_msg_notify_tag_refresh(), WM_toolsystem_key_from_context(), WM_toolsystem_ref_from_context(), WM_toolsystem_refresh_active(), WM_toolsystem_refresh_screen_area(), WM_toolsystem_reinit_all(), WM_toolsystem_update_from_context(), wm_toolsystem_update_from_context_view3d_impl(), and WM_window_cursor_keymap_status_refresh().
Definition at line 107 of file wm_toolsystem.cc.
References BLI_addhead(), MEM_callocN, bToolKey::mode, bToolRef::mode, bToolKey::space_type, bToolRef::space_type, WorkSpace::tools, and WM_toolsystem_ref_find().
Referenced by toolsystem_reinit_ensure_toolref().
Definition at line 90 of file wm_toolsystem.cc.
References BLI_assert, LISTBASE_FOREACH, bToolKey::mode, bToolKey::space_type, WorkSpace::tools, and WM_TOOLSYSTEM_SPACE_MASK.
Referenced by toolsystem_active_tool_from_context_or_view3d(), toolsystem_ref_set_by_brush_type(), WM_toolsystem_ref_ensure(), WM_toolsystem_ref_from_context(), WM_toolsystem_ref_set_by_id_ex(), WM_toolsystem_refresh(), WM_toolsystem_refresh_active(), WM_toolsystem_reinit(), WM_toolsystem_reinit_all(), WM_toolsystem_runtime_find(), WM_toolsystem_unlink(), and WM_window_cursor_keymap_status_refresh().
Definition at line 61 of file wm_toolsystem.cc.
References BLI_assert, CTX_data_scene(), CTX_data_view_layer(), CTX_wm_area(), CTX_wm_workspace(), bToolRef::runtime, bToolKey::space_type, WM_toolsystem_mode_from_spacetype(), WM_toolsystem_ref_find(), and WM_TOOLSYSTEM_SPACE_MASK.
Referenced by ED_image_paint_brush_type_update_sticky_shading_color(), ED_image_paint_brush_type_use_canvas(), gizmo_mesh_extrude_refresh(), gizmo_mesh_spin_init_draw_prepare(), gizmo_mesh_spin_init_refresh(), image_paint_brush_type_shading_color_follows_last_used_tool(), blender::ed::greasepencil::keymap_grease_pencil_brush_stroke_poll(), tool_generic_create_gizmo(), toolsystem_active_tool_from_context_or_view3d(), transform_from_gizmo_invoke(), WM_gizmo_operator_invoke(), wm_handler_operator_call(), and WM_toolsystem_runtime_from_context().
| void WM_toolsystem_ref_properties_ensure_ex | ( | bToolRef * | tref, |
| const char * | idname, | ||
| StructRNA * | type, | ||
| PointerRNA * | r_ptr ) |
Definition at line 1171 of file wm_toolsystem.cc.
References idprops_ensure_named_group(), RNA_pointer_create(), and WM_toolsystem_ref_properties_ensure_idprops().
| IDProperty * WM_toolsystem_ref_properties_ensure_idprops | ( | bToolRef * | tref | ) |
Definition at line 1152 of file wm_toolsystem.cc.
References blender::bke::idprop::create_group(), bToolRef::idname, idprops_ensure_named_group(), and bToolRef::properties.
Referenced by WM_toolsystem_ref_properties_ensure_ex().
| bool WM_toolsystem_ref_properties_get_ex | ( | bToolRef * | tref, |
| const char * | idname, | ||
| StructRNA * | type, | ||
| PointerRNA * | r_ptr ) |
Definition at line 1160 of file wm_toolsystem.cc.
References IDP_GetPropertyFromGroup(), RNA_pointer_create(), and WM_toolsystem_ref_properties_get_idprops().
| IDProperty * WM_toolsystem_ref_properties_get_idprops | ( | bToolRef * | tref | ) |
Definition at line 1143 of file wm_toolsystem.cc.
References bToolRef::idname, IDP_GetPropertyFromGroup(), and bToolRef::properties.
Referenced by WM_toolsystem_ref_properties_get_ex(), and WM_toolsystem_ref_properties_init_for_keymap().
| void WM_toolsystem_ref_properties_init_for_keymap | ( | bToolRef * | tref, |
| PointerRNA * | dst_ptr, | ||
| PointerRNA * | src_ptr, | ||
| wmOperatorType * | ot ) |
Definition at line 1181 of file wm_toolsystem.cc.
References blender::bke::idprop::create_group(), PointerRNA::data, wmOperatorType::idname, IDP_CopyProperty(), IDP_GetPropertyFromGroup(), IDP_MergeGroup(), ot, and WM_toolsystem_ref_properties_get_idprops().
Referenced by view3d_interactive_add_modal(), and wm_handler_operator_call().
Definition at line 913 of file wm_toolsystem.cc.
References CTX_data_scene(), CTX_data_view_layer(), CTX_wm_area(), CTX_wm_workspace(), WM_toolsystem_key_from_context(), and WM_toolsystem_ref_set_by_id_ex().
Referenced by WM_toolsystem_activate_brush_and_tool().
| bToolRef * WM_toolsystem_ref_set_by_id_ex | ( | bContext * | C, |
| WorkSpace * | workspace, | ||
| const bToolKey * | tkey, | ||
| const char * | name, | ||
| bool | cycle ) |
Definition at line 872 of file wm_toolsystem.cc.
References BLI_assert, CTX_data_main(), CTX_wm_area(), bToolRef::idname, ot, RNA_boolean_set(), RNA_enum_set(), RNA_string_set(), bToolKey::space_type, STREQ, toolsystem_refresh_screen_from_active_tool(), WM_OP_EXEC_DEFAULT, WM_operator_name_call_ptr(), WM_operator_properties_create_ptr(), WM_operator_properties_free(), WM_operatortype_find(), WM_toolsystem_ref_find(), WM_TOOLSYSTEM_SPACE_MASK, and WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE.
Referenced by toolsystem_reinit_with_toolref(), and WM_toolsystem_ref_set_by_id().
| void WM_toolsystem_ref_set_from_runtime | ( | bContext * | C, |
| WorkSpace * | workspace, | ||
| bToolRef * | tref, | ||
| const bToolRef_Runtime * | tref_rt, | ||
| const char * | idname ) |
Definition at line 532 of file wm_toolsystem.cc.
References wmWindow::addmousemove, CTX_data_main(), CTX_wm_message_bus(), CTX_wm_window(), bToolRef_Runtime::flag, wmGizmoGroupType::flag, bToolRef_Runtime::gizmo_group, WorkSpace::id, bToolRef::idname, bToolRef::idname_fallback, bToolRef_Runtime::keymap_fallback, MEM_callocN, bToolRef::runtime, STRNCPY, wmWindow::tag_cursor_refresh, TOOLREF_FLAG_FALLBACK_KEYMAP, toolsystem_ref_link(), toolsystem_refresh_screen_from_active_tool(), toolsystem_unlink_ref(), WM_gizmogrouptype_find(), WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP, and WM_msg_publish_rna_prop.
Sync the internal active state of a tool back into the tool system, this is needed for active brushes where the real active state is not stored in the tool system.
Definition at line 595 of file wm_toolsystem.cc.
References BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), ParticleEditSettings::brushtype, CTX_MODE_PARTICLE, bToolRef_Runtime::data_block, ListBase::first, EnumPropertyItem::identifier, bToolRef::idname, LISTBASE_FOREACH, bToolRef::mode, Object::mode, EnumPropertyItem::name, OB_MODE_PARTICLE_EDIT, ToolSettings::particle, RNA_enum_from_value(), rna_enum_particle_edit_hair_brush_items, bToolRef::runtime, SNPRINTF, bToolRef::space_type, SPACE_VIEW3D, STREQ, STRNCPY, wmWindowManager::windows, Main::wm, WM_window_get_active_scene(), WM_window_get_active_view_layer(), and WM_window_get_active_workspace().
Definition at line 465 of file wm_toolsystem.cc.
References toolsystem_refresh_ref(), and WM_toolsystem_ref_find().
Referenced by WM_toolsystem_do_msg_notify_tag_refresh().
| void WM_toolsystem_refresh_active | ( | bContext * | C | ) |
Use to update the active tool (shown in the top bar) in the least disruptive way.
This is a little involved since there may be multiple valid active tools depending on the mode and space type.
Used when undoing since the active mode may have changed.
Definition at line 721 of file wm_toolsystem.cc.
References BKE_workspace_id_tag_all_visible(), CTX_data_main(), CTX_wm_area(), CTX_wm_area_set(), CTX_wm_region(), CTX_wm_region_set(), CTX_wm_window(), CTX_wm_window_set(), ListBase::first, ID_TAG_DOIT, LISTBASE_FOREACH, bToolRef::runtime, bToolKey::space_type, toolsystem_refresh_ref(), toolsystem_reinit_ensure_toolref(), Main::wm, WM_toolsystem_mode_from_spacetype(), WM_toolsystem_ref_find(), WM_TOOLSYSTEM_SPACE_MASK, WM_window_get_active_scene(), WM_window_get_active_screen(), WM_window_get_active_view_layer(), WM_window_get_active_workspace(), and Main::workspaces.
Referenced by ed_undo_step_post().
Definition at line 501 of file wm_toolsystem.cc.
References BLI_assert, LISTBASE_FOREACH, WorkSpace::tools, and toolsystem_refresh_ref().
| void WM_toolsystem_refresh_screen_all | ( | Main * | bmain | ) |
Definition at line 833 of file wm_toolsystem.cc.
References ListBase::first, LISTBASE_FOREACH, Main::wm, and WM_toolsystem_refresh_screen_window().
Referenced by ed_undo_step_post().
| bool WM_toolsystem_refresh_screen_area | ( | WorkSpace * | workspace, |
| const Scene * | scene, | ||
| ViewLayer * | view_layer, | ||
| ScrArea * | area ) |
Definition at line 792 of file wm_toolsystem.cc.
References LISTBASE_FOREACH, bToolRef::runtime, WorkSpace::tools, and WM_toolsystem_mode_from_spacetype().
Referenced by ED_area_init(), WM_toolsystem_do_msg_notify_tag_refresh(), and WM_toolsystem_refresh_screen_window().
| void WM_toolsystem_refresh_screen_window | ( | wmWindow * | win | ) |
Definition at line 814 of file wm_toolsystem.cc.
References LISTBASE_FOREACH, SPACE_TYPE_NUM, WorkSpace::tools, WM_toolsystem_refresh_screen_area(), WM_window_get_active_scene(), WM_window_get_active_screen(), WM_window_get_active_view_layer(), and WM_window_get_active_workspace().
Referenced by ED_screen_scene_change(), and WM_toolsystem_refresh_screen_all().
Definition at line 477 of file wm_toolsystem.cc.
References toolsystem_reinit_ref(), and WM_toolsystem_ref_find().
Definition at line 508 of file wm_toolsystem.cc.
References LISTBASE_FOREACH, bToolKey::space_type, bToolRef::tag, toolsystem_reinit_ref(), WM_toolsystem_mode_from_spacetype(), WM_toolsystem_ref_find(), WM_TOOLSYSTEM_SPACE_MASK, WM_window_get_active_scene(), WM_window_get_active_screen(), WM_window_get_active_view_layer(), and WM_window_get_active_workspace().
| bToolRef_Runtime * WM_toolsystem_runtime_find | ( | WorkSpace * | workspace, |
| const bToolKey * | tkey ) |
Definition at line 101 of file wm_toolsystem.cc.
References bToolRef::runtime, and WM_toolsystem_ref_find().
| bToolRef_Runtime * WM_toolsystem_runtime_from_context | ( | const bContext * | C | ) |
Definition at line 84 of file wm_toolsystem.cc.
References bToolRef::runtime, and WM_toolsystem_ref_from_context().
Referenced by ED_gizmo_poll_or_unlink_delayed_from_tool_ex(), view3d_ruler_poll(), WM_toolsystem_active_tool_has_custom_cursor(), and WM_toolsystem_active_tool_is_brush().
Definition at line 185 of file wm_toolsystem.cc.
References bToolRef::runtime, toolsystem_unlink_ref(), and WM_toolsystem_ref_find().
Operate on all active tools.
Definition at line 485 of file wm_toolsystem.cc.
References LISTBASE_FOREACH, WorkSpace::tools, and toolsystem_unlink_ref().
| void WM_toolsystem_update_from_context | ( | bContext * | C, |
| WorkSpace * | workspace, | ||
| const Scene * | scene, | ||
| ViewLayer * | view_layer, | ||
| ScrArea * | area ) |
Definition at line 1082 of file wm_toolsystem.cc.
References bToolKey::space_type, toolsystem_key_ensure_check(), toolsystem_reinit_ensure_toolref(), and WM_toolsystem_mode_from_spacetype().
Referenced by wm_draw_window_offscreen().
| void WM_toolsystem_update_from_context_view3d | ( | bContext * | C | ) |
Definition at line 1049 of file wm_toolsystem.cc.
References BLI_listbase_is_single(), CTX_data_main(), CTX_wm_area(), CTX_wm_area_set(), CTX_wm_region(), CTX_wm_region_set(), CTX_wm_window(), CTX_wm_window_set(), CTX_wm_workspace(), ListBase::first, LISTBASE_FOREACH, wmWindowManager::windows, Main::wm, wm_toolsystem_update_from_context_view3d_impl(), and WM_window_get_active_workspace().
Referenced by blender::ed::sculpt_paint::curves_sculptmode_toggle_exec(), ed_object_select_pick(), blender::ed::object::editmode_toggle_exec(), blender::ed::object::object_transfer_mode_invoke(), blender::ed::greasepencil::paintmode_toggle_exec(), particle_edit_toggle_exec(), blender::ed::object::posemode_exec(), blender::ed::sculpt_paint::sculpt_mode_toggle_exec(), blender::ed::greasepencil::sculptmode_toggle_exec(), texture_paint_toggle_exec(), blender::ed::greasepencil::vertexmode_toggle_exec(), vpaint_mode_toggle_exec(), blender::ed::greasepencil::weightmode_toggle_exec(), and wpaint_mode_toggle_exec().