diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-23 09:20:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-23 09:23:16 +0300 |
commit | 44f78c95be133db75d439d4e4d5d6fdd5720f463 (patch) | |
tree | 7db73acab84e526760eb61d59061293268120fe0 | |
parent | f5f66d4901ef6636fdc2aeb6596f57717928e61a (diff) |
Cleanup: move toolsystem into own include
Many files using the window manager don't access the tool-system.
This avoids rebuilding many files when the tool-system changes.
18 files changed, 121 insertions, 55 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 364a85c4248..7a4898ec287 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -112,6 +112,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "object_intern.h" // own include diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 6197457293f..7fc3cb8863f 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -82,6 +82,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "RNA_access.h" #include "RNA_define.h" diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 1688e45d98c..dc5c9be04c8 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -52,6 +52,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "ED_screen.h" #include "ED_screen_types.h" diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 35d916e403d..a054949df22 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -65,6 +65,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "WM_toolsystem.h" #include "screen_intern.h" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6a32fdecfad..0479af3c58f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -74,6 +74,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "RNA_access.h" #include "RNA_define.h" diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 3c3df2067ab..311587d6b53 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -69,6 +69,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "ED_object.h" #include "ED_mesh.h" diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 709d6d4c690..5acc1cd0c6a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -77,6 +77,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "ED_sculpt.h" #include "ED_object.h" diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index d52ff1259cf..d8bcc9de2e2 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -69,6 +69,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "RE_engine.h" #include "RE_pipeline.h" diff --git a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c index 909b5ed11ca..8c3b28ffdd8 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c @@ -54,6 +54,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "WM_toolsystem.h" #include "view3d_intern.h" /* own include */ diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c index 863ec1af15b..891d9cf67f1 100644 --- a/source/blender/editors/transform/transform_manipulator_3d.c +++ b/source/blender/editors/transform/transform_manipulator_3d.c @@ -65,6 +65,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" #include "ED_armature.h" #include "ED_curve.h" diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 53056c6cc5d..af9a200c3b9 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -53,6 +53,8 @@ #include "RNA_access.h" +#include "WM_toolsystem.h" + static void rna_window_update_all(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { WM_main_add_notifier(NC_WINDOW, NULL); diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index d74cf15d78b..8fc46b6ce3f 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -87,6 +87,7 @@ set(SRC WM_api.h WM_keymap.h + WM_toolsystem.h WM_types.h wm.h wm_cursors.h diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index bda22929ce8..9e47179c615 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -69,7 +69,6 @@ struct ImageFormatData; struct ARegion; struct ScrArea; struct Main; -struct bToolDef; struct ViewLayer; struct GPUViewport; @@ -602,57 +601,6 @@ bool WM_event_is_tablet(const struct wmEvent *event); bool WM_event_is_ime_switch(const struct wmEvent *event); #endif -/* wm_toolsystem.c */ - -/* Values that define a categoey of active tool. */ -typedef struct bToolKey { int space_type; int mode; } bToolKey; - -struct bToolRef *WM_toolsystem_ref_from_context(struct bContext *C); -struct bToolRef *WM_toolsystem_ref_find(struct WorkSpace *workspace, const bToolKey *tkey); -bool WM_toolsystem_ref_ensure( - struct WorkSpace *workspace, const bToolKey *tkey, - struct bToolRef **r_tref); - -struct bToolRef_Runtime *WM_toolsystem_runtime_from_context(struct bContext *C); -struct bToolRef_Runtime *WM_toolsystem_runtime_find(struct WorkSpace *workspace, const bToolKey *tkey); - -void WM_toolsystem_unlink(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey); -void WM_toolsystem_refresh(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey); -void WM_toolsystem_reinit(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey); - -void WM_toolsystem_unlink_all(struct bContext *C, struct WorkSpace *workspace); -void WM_toolsystem_refresh_all(struct bContext *C, struct WorkSpace *workspace); -void WM_toolsystem_reinit_all(struct bContext *C, struct wmWindow *win); - -void WM_toolsystem_ref_set_from_runtime( - struct bContext *C, struct WorkSpace *workspace, struct bToolRef *tref, - const struct bToolRef_Runtime *tool, const char *idname); - -void WM_toolsystem_init(struct bContext *C); - -int WM_toolsystem_mode_from_spacetype( - struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa, - int space_type); -bool WM_toolsystem_key_from_context( - struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa, - bToolKey *tkey); -void WM_toolsystem_update_from_context( - struct bContext *C, - struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa); - -void WM_toolsystem_update_from_context_view3d(struct bContext *C); - -bool WM_toolsystem_active_tool_is_brush(const struct bContext *C); - -void WM_toolsystem_do_msg_notify_tag_refresh( - struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); - -struct IDProperty *WM_toolsystem_ref_properties_ensure_idprops(struct bToolRef *tref); -void WM_toolsystem_ref_properties_ensure(struct bToolRef *tref, struct wmOperatorType *ot, struct PointerRNA *ptr); - -void WM_toolsystem_ref_properties_init_for_keymap( - struct bToolRef *tref, struct PointerRNA *dst_ptr, struct PointerRNA *src_ptr, struct wmOperatorType *ot); - /* wm_tooltip.c */ typedef struct ARegion *(*wmTooltipInitFn)(struct bContext *, struct ARegion *, bool *); @@ -664,9 +612,6 @@ void WM_tooltip_clear(struct bContext *C, struct wmWindow *win); void WM_tooltip_init(struct bContext *C, struct wmWindow *win); void WM_tooltip_refresh(struct bContext *C, struct wmWindow *win); -void WM_toolsystem_refresh_screen_area(struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa); -void WM_toolsystem_refresh_screen_all(struct Main *bmain); - #ifdef __cplusplus } #endif diff --git a/source/blender/windowmanager/WM_toolsystem.h b/source/blender/windowmanager/WM_toolsystem.h new file mode 100644 index 00000000000..2eb07d68afa --- /dev/null +++ b/source/blender/windowmanager/WM_toolsystem.h @@ -0,0 +1,102 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ +#ifndef __WM_TOOLSYSTEM_H__ +#define __WM_TOOLSYSTEM_H__ + +/** \file blender/windowmanager/WM_toolsystem.h + * \ingroup wm + */ + +/* dna-savable wmStructs here */ +#include "BLI_compiler_attrs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct bContext; +struct bToolRef_Runtime; +struct IDProperty; +struct wmMsgSubscribeKey; +struct wmMsgSubscribeValue; +struct wmOperatorType; +struct PointerRNA; +struct ScrArea; +struct Main; + +/* wm_toolsystem.c */ + +/* Values that define a categoey of active tool. */ +typedef struct bToolKey { int space_type; int mode; } bToolKey; + +struct bToolRef *WM_toolsystem_ref_from_context(struct bContext *C); +struct bToolRef *WM_toolsystem_ref_find(struct WorkSpace *workspace, const bToolKey *tkey); +bool WM_toolsystem_ref_ensure( + struct WorkSpace *workspace, const bToolKey *tkey, + struct bToolRef **r_tref); + +struct bToolRef_Runtime *WM_toolsystem_runtime_from_context(struct bContext *C); +struct bToolRef_Runtime *WM_toolsystem_runtime_find(struct WorkSpace *workspace, const bToolKey *tkey); + +void WM_toolsystem_unlink(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey); +void WM_toolsystem_refresh(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey); +void WM_toolsystem_reinit(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey); + +void WM_toolsystem_unlink_all(struct bContext *C, struct WorkSpace *workspace); +void WM_toolsystem_refresh_all(struct bContext *C, struct WorkSpace *workspace); +void WM_toolsystem_reinit_all(struct bContext *C, struct wmWindow *win); + +void WM_toolsystem_ref_set_from_runtime( + struct bContext *C, struct WorkSpace *workspace, struct bToolRef *tref, + const struct bToolRef_Runtime *tool, const char *idname); + +void WM_toolsystem_init(struct bContext *C); + +int WM_toolsystem_mode_from_spacetype( + struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa, + int space_type); +bool WM_toolsystem_key_from_context( + struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa, + bToolKey *tkey); +void WM_toolsystem_update_from_context( + struct bContext *C, + struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa); + +void WM_toolsystem_update_from_context_view3d(struct bContext *C); + +bool WM_toolsystem_active_tool_is_brush(const struct bContext *C); + +void WM_toolsystem_do_msg_notify_tag_refresh( + struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); + +struct IDProperty *WM_toolsystem_ref_properties_ensure_idprops(struct bToolRef *tref); +void WM_toolsystem_ref_properties_ensure(struct bToolRef *tref, struct wmOperatorType *ot, struct PointerRNA *ptr); + +void WM_toolsystem_ref_properties_init_for_keymap( + struct bToolRef *tref, struct PointerRNA *dst_ptr, struct PointerRNA *src_ptr, struct wmOperatorType *ot); + +void WM_toolsystem_refresh_screen_area(struct WorkSpace *workspace, struct Scene *scene, struct ScrArea *sa); +void WM_toolsystem_refresh_screen_all(struct Main *bmain); + +#ifdef __cplusplus +} +#endif + +#endif /* __WM_TOOLSYSTEM_API_H__ */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index d541a4ae044..7004416517d 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -80,6 +80,8 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" + #include "wm.h" #include "wm_window.h" #include "wm_event_system.h" diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 721ea158d51..7fb115a1f28 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -129,6 +129,8 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" + #include "wm.h" #include "wm_files.h" #include "wm_window.h" diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index f07e6d00d19..d734fee05ae 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -53,6 +53,7 @@ #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" +#include "WM_toolsystem.h" /* own include */ static void toolsystem_reinit_with_toolref( bContext *C, WorkSpace *UNUSED(workspace), bToolRef *tref); diff --git a/source/creator/creator.c b/source/creator/creator.c index 918563dc73b..77afdf17e68 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -78,6 +78,7 @@ #include "ED_datafiles.h" #include "WM_api.h" +#include "WM_toolsystem.h" #include "RNA_define.h" |