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.
This commit is contained in:
2018-05-23 08:20:46 +02:00
parent f5f66d4901
commit 44f78c95be
18 changed files with 121 additions and 55 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -65,6 +65,7 @@
#include "WM_api.h"
#include "WM_types.h"
#include "WM_toolsystem.h"
#include "screen_intern.h"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -54,6 +54,7 @@
#include "WM_api.h"
#include "WM_types.h"
#include "WM_toolsystem.h"
#include "view3d_intern.h" /* own include */

View File

@@ -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"

View File

@@ -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);

View File

@@ -87,6 +87,7 @@ set(SRC
WM_api.h
WM_keymap.h
WM_toolsystem.h
WM_types.h
wm.h
wm_cursors.h

View File

@@ -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

View File

@@ -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__ */

View File

@@ -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"

View File

@@ -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"

View File

@@ -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);

View File

@@ -78,6 +78,7 @@
#include "ED_datafiles.h"
#include "WM_api.h"
#include "WM_toolsystem.h"
#include "RNA_define.h"