2018-05-23 08:20:46 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2020-08-07 09:50:34 +02:00
|
|
|
#pragma once
|
2018-05-23 08:20:46 +02:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup wm
|
2018-05-23 08:20:46 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* dna-savable wmStructs here */
|
|
|
|
#include "BLI_compiler_attrs.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct IDProperty;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Main;
|
2018-05-23 08:20:46 +02:00
|
|
|
struct PointerRNA;
|
|
|
|
struct ScrArea;
|
2018-10-02 15:39:20 +10:00
|
|
|
struct StructRNA;
|
2018-10-26 15:05:07 +11:00
|
|
|
struct WorkSpace;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
|
|
|
struct bToolRef_Runtime;
|
|
|
|
struct wmMsgSubscribeKey;
|
|
|
|
struct wmMsgSubscribeValue;
|
|
|
|
struct wmOperatorType;
|
2018-05-23 08:20:46 +02:00
|
|
|
|
2021-06-24 15:56:58 +10:00
|
|
|
/* wm_toolsystem.c */
|
2018-05-23 08:20:46 +02:00
|
|
|
|
2020-01-22 14:54:44 +01:00
|
|
|
#define WM_TOOLSYSTEM_SPACE_MASK \
|
|
|
|
((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ))
|
2021-02-14 20:58:04 +11:00
|
|
|
/* Values that define a category of active tool. */
|
2019-04-17 06:17:24 +02:00
|
|
|
typedef struct bToolKey {
|
|
|
|
int space_type;
|
|
|
|
int mode;
|
|
|
|
} bToolKey;
|
2018-05-23 08:20:46 +02:00
|
|
|
|
|
|
|
struct bToolRef *WM_toolsystem_ref_from_context(struct bContext *C);
|
|
|
|
struct bToolRef *WM_toolsystem_ref_find(struct WorkSpace *workspace, const bToolKey *tkey);
|
2019-04-17 06:17:24 +02:00
|
|
|
bool WM_toolsystem_ref_ensure(struct WorkSpace *workspace,
|
|
|
|
const bToolKey *tkey,
|
|
|
|
struct bToolRef **r_tref);
|
2019-11-14 17:29:42 +11:00
|
|
|
|
|
|
|
struct bToolRef *WM_toolsystem_ref_set_by_id_ex(struct bContext *C,
|
|
|
|
struct WorkSpace *workspace,
|
|
|
|
const bToolKey *tkey,
|
|
|
|
const char *name,
|
|
|
|
bool cycle);
|
|
|
|
struct bToolRef *WM_toolsystem_ref_set_by_id(struct bContext *C, const char *name);
|
2018-05-23 08:20:46 +02:00
|
|
|
|
|
|
|
struct bToolRef_Runtime *WM_toolsystem_runtime_from_context(struct bContext *C);
|
2019-04-17 06:17:24 +02:00
|
|
|
struct bToolRef_Runtime *WM_toolsystem_runtime_find(struct WorkSpace *workspace,
|
|
|
|
const bToolKey *tkey);
|
2018-05-23 08:20:46 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void WM_toolsystem_ref_set_from_runtime(struct bContext *C,
|
|
|
|
struct WorkSpace *workspace,
|
|
|
|
struct bToolRef *tref,
|
2020-09-04 20:59:13 +02:00
|
|
|
const struct bToolRef_Runtime *tref_rt,
|
2019-04-17 06:17:24 +02:00
|
|
|
const char *idname);
|
2018-05-23 08:20:46 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void WM_toolsystem_ref_sync_from_context(struct Main *bmain,
|
|
|
|
struct WorkSpace *workspace,
|
|
|
|
struct bToolRef *tref);
|
2018-11-07 08:42:15 +11:00
|
|
|
|
2018-05-23 08:20:46 +02:00
|
|
|
void WM_toolsystem_init(struct bContext *C);
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
int WM_toolsystem_mode_from_spacetype(struct ViewLayer *view_layer,
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area,
|
2019-04-17 06:17:24 +02:00
|
|
|
int space_type);
|
|
|
|
bool WM_toolsystem_key_from_context(struct ViewLayer *view_layer,
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area,
|
2019-04-17 06:17:24 +02:00
|
|
|
bToolKey *tkey);
|
2018-05-23 08:20:46 +02:00
|
|
|
|
|
|
|
void WM_toolsystem_update_from_context_view3d(struct bContext *C);
|
2019-04-17 06:17:24 +02:00
|
|
|
void WM_toolsystem_update_from_context(struct bContext *C,
|
|
|
|
struct WorkSpace *workspace,
|
|
|
|
struct ViewLayer *view_layer,
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area);
|
2018-05-23 08:20:46 +02:00
|
|
|
|
|
|
|
bool WM_toolsystem_active_tool_is_brush(const struct bContext *C);
|
|
|
|
|
2019-06-28 18:47:47 +10:00
|
|
|
void WM_toolsystem_do_msg_notify_tag_refresh(struct bContext *C,
|
|
|
|
struct wmMsgSubscribeKey *msg_key,
|
|
|
|
struct wmMsgSubscribeValue *msg_val);
|
|
|
|
|
2018-05-23 08:20:46 +02:00
|
|
|
struct IDProperty *WM_toolsystem_ref_properties_ensure_idprops(struct bToolRef *tref);
|
2019-04-17 06:17:24 +02:00
|
|
|
void WM_toolsystem_ref_properties_ensure_ex(struct bToolRef *tref,
|
|
|
|
const char *idname,
|
|
|
|
struct StructRNA *type,
|
|
|
|
struct PointerRNA *r_ptr);
|
2018-10-02 15:39:20 +10:00
|
|
|
|
|
|
|
#define WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, r_ptr) \
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
|
2019-01-23 15:36:10 +11:00
|
|
|
#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr) \
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_toolsystem_ref_properties_ensure_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
|
2019-01-23 15:36:10 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
bool WM_toolsystem_ref_properties_get_ex(struct bToolRef *tref,
|
|
|
|
const char *idname,
|
|
|
|
struct StructRNA *type,
|
|
|
|
struct PointerRNA *r_ptr);
|
2019-01-23 15:36:10 +11:00
|
|
|
#define WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr) \
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_toolsystem_ref_properties_get_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
|
2019-01-23 15:36:10 +11:00
|
|
|
#define WM_toolsystem_ref_properties_get_from_gizmo_group(tref, gzgroup, r_ptr) \
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_toolsystem_ref_properties_get_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
|
2018-05-23 08:20:46 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void WM_toolsystem_ref_properties_init_for_keymap(struct bToolRef *tref,
|
|
|
|
struct PointerRNA *dst_ptr,
|
|
|
|
struct PointerRNA *src_ptr,
|
|
|
|
struct wmOperatorType *ot);
|
2018-05-23 08:20:46 +02:00
|
|
|
|
2018-10-29 20:20:16 +11:00
|
|
|
void WM_toolsystem_refresh_active(struct bContext *C);
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void WM_toolsystem_refresh_screen_area(struct WorkSpace *workspace,
|
|
|
|
struct ViewLayer *view_layer,
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area);
|
2018-05-23 08:20:46 +02:00
|
|
|
void WM_toolsystem_refresh_screen_all(struct Main *bmain);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|