Blender
V3.3
|
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_ID.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_idprop.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_workspace.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
Go to the source code of this file.
Experimental tool-system>
Definition in file wm_toolsystem.c.
|
static |
Definition at line 850 of file wm_toolsystem.c.
References IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_New(), IDP_ReplaceInGroup_ex(), IDProperty::name, NULL, STRNCPY, and IDProperty::type.
Referenced by WM_toolsystem_ref_properties_ensure_ex(), and WM_toolsystem_ref_properties_ensure_idprops().
|
static |
Definition at line 689 of file wm_toolsystem.c.
References CTX_MODE_EDIT_TEXT, CTX_MODE_PAINT_GPENCIL, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT, CTX_MODE_PARTICLE, CTX_MODE_SCULPT, CTX_MODE_SCULPT_CURVES, CTX_MODE_SCULPT_GPENCIL, CTX_MODE_VERTEX_GPENCIL, CTX_MODE_WEIGHT_GPENCIL, bToolKey::mode, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE, SEQ_VIEW_SEQUENCE_PREVIEW, SI_MODE_PAINT, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, bToolKey::space_type, and SPACE_VIEW3D.
Referenced by toolsystem_reinit_ensure_toolref().
Definition at line 422 of file wm_toolsystem.c.
References ELEM, bToolKey::mode, SI_MODE_PAINT, SI_MODE_UV, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, bToolKey::space_type, and SPACE_VIEW3D.
Referenced by WM_toolsystem_update_from_context().
Definition at line 137 of file wm_toolsystem.c.
References BKE_brush_add(), BKE_brush_sculpt_reset(), BKE_brush_tool_get, BKE_brush_tool_set, BKE_libblock_find_name(), BKE_paint_brush_set(), BKE_paint_ensure_from_paintmode(), BKE_paint_get_active_from_paintmode(), BKE_paint_get_tool_enum_from_paintmode(), BKE_paint_toolslots_brush_get(), BKE_paintmode_get_from_tool(), BLI_assert, ParticleEditSettings::brushtype, C, CLOG_WARN, CTX_data_main(), CTX_MODE_PARTICLE, bToolRef_Runtime::data_block, ListBase::first, wmGizmoGroupType::flag, bToolRef_Runtime::gizmo_group, wmGizmoGroupType::gzmap_params, ID_BR, LISTBASE_FOREACH, bToolRef::mode, NULL, Paint_Runtime::ob_mode, PAINT_MODE_INVALID, PAINT_MODE_SCULPT, ToolSettings::particle, RNA_enum_from_identifier(), rna_enum_particle_edit_hair_brush_items, Paint::runtime, bToolRef::runtime, scene, bToolRef::space_type, SPACE_VIEW3D, Scene::toolsettings, EnumPropertyItem::value, wmWindowManager::windows, Main::wm, WM_gizmo_group_type_ensure_ptr(), WM_gizmoconfig_update_tag_group_type_init(), WM_gizmogrouptype_find(), WM_GIZMOGROUPTYPE_TOOL_INIT, WM_gizmomaptype_ensure(), WM_LOG_TOOLS, WM_window_get_active_scene(), and WM_window_get_active_workspace().
Referenced by toolsystem_refresh_ref(), and WM_toolsystem_ref_set_from_runtime().
Definition at line 217 of file wm_toolsystem.c.
References C, NULL, bToolRef::runtime, and toolsystem_ref_link().
Referenced by WM_toolsystem_refresh(), WM_toolsystem_refresh_active(), and WM_toolsystem_refresh_all().
|
static |
Definition at line 603 of file wm_toolsystem.c.
References blender::compositor::area(), bScreen::areabase, ListBase::first, LISTBASE_FOREACH, bToolRef::mode, bToolRef::space_type, Main::wm, WM_toolsystem_mode_from_spacetype(), WM_window_get_active_screen(), WM_window_get_active_view_layer(), and WM_window_get_active_workspace().
Referenced by WM_toolsystem_ref_set_by_id_ex(), and WM_toolsystem_ref_set_from_runtime().
|
static |
Run after changing modes.
Definition at line 745 of file wm_toolsystem.c.
References C, bToolRef::idname, NULL, STRNCPY, toolsystem_default_tool(), toolsystem_reinit_with_toolref(), and WM_toolsystem_ref_ensure().
Referenced by WM_toolsystem_refresh_active(), WM_toolsystem_update_from_context(), and wm_toolsystem_update_from_context_view3d_impl().
Definition at line 233 of file wm_toolsystem.c.
References C, and toolsystem_reinit_with_toolref().
Referenced by WM_toolsystem_reinit(), and WM_toolsystem_reinit_all().
|
static |
Referenced by toolsystem_reinit_ensure_toolref(), and toolsystem_reinit_ref().
|
static |
Definition at line 680 of file wm_toolsystem.c.
References C, bToolRef::idname, bToolRef::mode, bToolRef::space_type, bToolKey::space_type, and WM_toolsystem_ref_set_by_id_ex().
|
static |
Definition at line 117 of file wm_toolsystem.c.
References C, CTX_data_main(), bToolRef_Runtime::gizmo_group, NULL, bToolRef::runtime, WM_gizmo_group_remove_by_tool(), and WM_gizmogrouptype_find().
Referenced by WM_toolsystem_ref_set_from_runtime(), WM_toolsystem_unlink(), and WM_toolsystem_unlink_all().
Definition at line 817 of file wm_toolsystem.c.
References C, bToolRef_Runtime::data_block, and WM_toolsystem_runtime_from_context().
Referenced by brush_drawcursor(), brush_edit_poll(), gpencil_brush_cursor_poll(), gpencil_stroke_paintmode_poll_with_tool(), gpencil_stroke_sculptmode_poll_with_tool(), gpencil_stroke_vertexmode_poll_with_tool(), gpencil_stroke_weightmode_poll_with_tool(), image_paint_poll_ex(), vertex_paint_poll_ex(), and weight_paint_poll_ex().
void WM_toolsystem_do_msg_notify_tag_refresh | ( | bContext * | C, |
wmMsgSubscribeKey * | UNUSEDmsg_key, | ||
wmMsgSubscribeValue * | msg_val | ||
) |
Definition at line 823 of file wm_toolsystem.c.
References blender::compositor::area(), bScreen::areabase, BLI_findindex(), C, CTX_data_main(), ListBase::first, wmWindow::next, NULL, 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_screen(), WM_window_get_active_view_layer(), and WM_window_get_active_workspace().
Referenced by view3d_main_region_message_subscribe().
Definition at line 407 of file wm_toolsystem.c.
References BLI_assert, C, CTX_data_main(), CTX_wm_window(), LISTBASE_FOREACH, MEM_SAFE_FREE, NULL, and Main::workspaces.
Referenced by wm_file_read_post().
Definition at line 474 of file wm_toolsystem.c.
References blender::compositor::area(), bToolKey::mode, NULL, SPACE_EMPTY, bToolKey::space_type, and WM_toolsystem_mode_from_spacetype().
Referenced by WM_toolsystem_ref_set_by_id().
Definition at line 440 of file wm_toolsystem.c.
References blender::compositor::area(), CTX_data_mode_enum_ex(), CTX_MODE_OBJECT, Object::mode, SpaceImage::mode, NULL, OBACT, OBEDIT_FROM_OBACT, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, SPACE_VIEW3D, and SpaceSeq::view.
Referenced by 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().
bool WM_toolsystem_ref_ensure | ( | struct WorkSpace * | workspace, |
const bToolKey * | tkey, | ||
bToolRef ** | r_tref | ||
) |
Definition at line 100 of file wm_toolsystem.c.
References BLI_addhead(), MEM_callocN, bToolRef::mode, bToolKey::mode, bToolRef::space_type, bToolKey::space_type, WorkSpace::tools, and WM_toolsystem_ref_find().
Referenced by toolsystem_reinit_ensure_toolref().
Definition at line 83 of file wm_toolsystem.c.
References BLI_assert, LISTBASE_FOREACH, bToolKey::mode, NULL, bToolKey::space_type, WorkSpace::tools, and WM_TOOLSYSTEM_SPACE_MASK.
Referenced by 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 57 of file wm_toolsystem.c.
References blender::compositor::area(), BLI_assert, C, CTX_data_view_layer(), CTX_wm_area(), CTX_wm_workspace(), NULL, bToolKey::space_type, WM_toolsystem_mode_from_spacetype(), WM_toolsystem_ref_find(), and WM_TOOLSYSTEM_SPACE_MASK.
Referenced by ED_paint_tool_update_sticky_shading_color(), ED_paint_tool_use_canvas(), gizmo_mesh_extrude_refresh(), gizmo_mesh_spin_init_draw_prepare(), gizmo_mesh_spin_init_refresh(), paint_tool_shading_color_follows_last_used_tool(), tool_generic_create_gizmo(), 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 891 of file wm_toolsystem.c.
References idprops_ensure_named_group(), NULL, RNA_pointer_create(), type, and WM_toolsystem_ref_properties_ensure_idprops().
IDProperty* WM_toolsystem_ref_properties_ensure_idprops | ( | bToolRef * | tref | ) |
Definition at line 871 of file wm_toolsystem.c.
References bToolRef::idname, IDP_GROUP, IDP_New(), idprops_ensure_named_group(), NULL, 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 880 of file wm_toolsystem.c.
References IDP_GetPropertyFromGroup(), NULL, RNA_pointer_create(), type, and WM_toolsystem_ref_properties_get_idprops().
IDProperty* WM_toolsystem_ref_properties_get_idprops | ( | bToolRef * | tref | ) |
Definition at line 862 of file wm_toolsystem.c.
References bToolRef::idname, IDP_GetPropertyFromGroup(), NULL, 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 901 of file wm_toolsystem.c.
References PointerRNA::data, wmOperatorType::idname, IDP_CopyProperty(), IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_MergeGroup(), IDP_New(), NULL, ot, and WM_toolsystem_ref_properties_get_idprops().
Referenced by view3d_interactive_add_modal(), and wm_handler_operator_call().
Definition at line 668 of file wm_toolsystem.c.
References blender::compositor::area(), C, CTX_data_view_layer(), CTX_wm_area(), CTX_wm_workspace(), NULL, WM_toolsystem_key_from_context(), and WM_toolsystem_ref_set_by_id_ex().
Referenced by brush_generic_tool_set().
bToolRef* WM_toolsystem_ref_set_by_id_ex | ( | bContext * | C, |
WorkSpace * | workspace, | ||
const bToolKey * | tkey, | ||
const char * | name, | ||
bool | cycle | ||
) |
Definition at line 627 of file wm_toolsystem.c.
References blender::compositor::area(), BLI_assert, C, CTX_data_main(), CTX_wm_area(), bToolRef::idname, NULL, 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 | ( | struct bContext * | C, |
struct WorkSpace * | workspace, | ||
bToolRef * | tref, | ||
const bToolRef_Runtime * | tref_rt, | ||
const char * | idname | ||
) |
Definition at line 292 of file wm_toolsystem.c.
References wmWindow::addmousemove, C, 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, NULL, 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.
void WM_toolsystem_ref_sync_from_context | ( | struct Main * | bmain, |
struct WorkSpace * | workspace, | ||
struct bToolRef * | tref | ||
) |
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 355 of file wm_toolsystem.c.
References BKE_brush_tool_get, BKE_paint_get_active_from_paintmode(), BKE_paint_get_tool_enum_from_paintmode(), BKE_paintmode_get_from_tool(), Paint::brush, ParticleEditSettings::brushtype, CTX_MODE_PARTICLE, bToolRef_Runtime::data_block, ListBase::first, EnumPropertyItem::identifier, bToolRef::idname, LISTBASE_FOREACH, Object::mode, bToolRef::mode, EnumPropertyItem::name, NULL, OB_MODE_PARTICLE_EDIT, OBACT, ToolSettings::particle, RNA_enum_from_value(), rna_enum_particle_edit_hair_brush_items, bToolRef::runtime, scene, SNPRINTF, bToolRef::space_type, SPACE_VIEW3D, STREQ, STRNCPY, Scene::toolsettings, wmWindowManager::windows, Main::wm, WM_window_get_active_scene(), WM_window_get_active_view_layer(), and WM_window_get_active_workspace().
Definition at line 225 of file wm_toolsystem.c.
References C, toolsystem_refresh_ref(), and WM_toolsystem_ref_find().
Referenced by WM_toolsystem_do_msg_notify_tag_refresh().
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 492 of file wm_toolsystem.c.
References blender::compositor::area(), bScreen::areabase, BKE_workspace_id_tag_all_visible(), C, 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, LIB_TAG_DOIT, LISTBASE_FOREACH, NULL, 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_screen(), WM_window_get_active_view_layer(), WM_window_get_active_workspace(), and Main::workspaces.
Referenced by ed_undo_step_post().
Definition at line 261 of file wm_toolsystem.c.
References BLI_assert, C, LISTBASE_FOREACH, WorkSpace::tools, and toolsystem_refresh_ref().
Definition at line 593 of file wm_toolsystem.c.
References ListBase::first, LISTBASE_FOREACH, Main::wm, and WM_toolsystem_refresh_screen_window().
Referenced by ed_undo_step_post().
void WM_toolsystem_refresh_screen_area | ( | WorkSpace * | workspace, |
ViewLayer * | view_layer, | ||
ScrArea * | area | ||
) |
Definition at line 560 of file wm_toolsystem.c.
References blender::compositor::area(), LISTBASE_FOREACH, NULL, 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().
Definition at line 575 of file wm_toolsystem.c.
References blender::compositor::area(), bScreen::areabase, LISTBASE_FOREACH, NULL, SPACE_TYPE_NUM, WorkSpace::tools, WM_toolsystem_refresh_screen_area(), 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 237 of file wm_toolsystem.c.
References C, toolsystem_reinit_ref(), and WM_toolsystem_ref_find().
Definition at line 268 of file wm_toolsystem.c.
References blender::compositor::area(), bScreen::areabase, C, 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_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 94 of file wm_toolsystem.c.
References NULL, bToolRef::runtime, and WM_toolsystem_ref_find().
struct bToolRef_Runtime* WM_toolsystem_runtime_from_context | ( | struct bContext * | C | ) |
Definition at line 77 of file wm_toolsystem.c.
References C, NULL, bToolRef::runtime, and WM_toolsystem_ref_from_context().
Referenced by ED_gizmo_poll_or_unlink_delayed_from_tool_ex(), view3d_ruler_poll(), and WM_toolsystem_active_tool_is_brush().
Definition at line 129 of file wm_toolsystem.c.
References C, bToolRef::runtime, toolsystem_unlink_ref(), and WM_toolsystem_ref_find().
Operate on all active tools.
Definition at line 245 of file wm_toolsystem.c.
References C, LISTBASE_FOREACH, WorkSpace::tools, and toolsystem_unlink_ref().
void WM_toolsystem_update_from_context | ( | bContext * | C, |
WorkSpace * | workspace, | ||
ViewLayer * | view_layer, | ||
ScrArea * | area | ||
) |
Definition at line 803 of file wm_toolsystem.c.
References blender::compositor::area(), C, NULL, bToolKey::space_type, toolsystem_key_ensure_check(), toolsystem_reinit_ensure_toolref(), and WM_toolsystem_mode_from_spacetype().
Referenced by wm_draw_window_offscreen().
Definition at line 772 of file wm_toolsystem.c.
References BLI_listbase_is_single(), C, 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(), editmode_toggle_exec(), gpencil_editmode_toggle_exec(), gpencil_paintmode_toggle_exec(), gpencil_sculptmode_toggle_exec(), gpencil_vertexmode_toggle_exec(), gpencil_weightmode_toggle_exec(), object_transfer_mode_to_base(), particle_edit_toggle_exec(), posemode_exec(), sculpt_mode_toggle_exec(), texture_paint_toggle_exec(), vpaint_mode_toggle_exec(), and wpaint_mode_toggle_exec().
|
static |
Definition at line 761 of file wm_toolsystem.c.
References C, CTX_data_view_layer(), NULL, bToolKey::space_type, SPACE_VIEW3D, toolsystem_reinit_ensure_toolref(), and WM_toolsystem_mode_from_spacetype().
Referenced by WM_toolsystem_update_from_context_view3d().