2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2007 Blender Foundation. All rights reserved. */
|
2011-02-25 14:04:21 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup wm
|
2011-02-25 14:04:21 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmWindow;
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
2018-07-14 23:16:34 +02:00
|
|
|
#include "gizmo/wm_gizmo_wmapi.h"
|
2016-10-07 16:34:55 +02:00
|
|
|
|
2020-07-28 16:32:30 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
typedef struct wmPaintCursor {
|
|
|
|
|
struct wmPaintCursor *next, *prev;
|
2009-01-24 16:59:55 +00:00
|
|
|
|
|
|
|
|
void *customdata;
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*poll)(struct bContext *C);
|
2009-01-24 16:59:55 +00:00
|
|
|
void (*draw)(bContext *C, int, int, void *customdata);
|
2018-10-25 16:06:47 +11:00
|
|
|
|
|
|
|
|
short space_type;
|
|
|
|
|
short region_type;
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
} wmPaintCursor;
|
|
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Cause a delayed #WM_exit()
|
|
|
|
|
* call to avoid leaking memory when trying to exit from within operators.
|
|
|
|
|
*/
|
2018-03-22 23:09:19 +01:00
|
|
|
void wm_exit_schedule_delayed(const bContext *C);
|
|
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Context is allowed to be NULL, do not free wm itself (lib_id.c).
|
|
|
|
|
*/
|
2007-12-24 18:27:28 +00:00
|
|
|
extern void wm_close_and_free(bContext *C, wmWindowManager *);
|
|
|
|
|
extern void wm_close_and_free_all(bContext *C, ListBase *);
|
|
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* On startup, it adds all data, for matching.
|
|
|
|
|
*/
|
2017-11-09 04:57:14 +01:00
|
|
|
extern void wm_add_default(struct Main *bmain, bContext *C);
|
2009-05-30 04:16:24 +00:00
|
|
|
extern void wm_clear_default_size(bContext *C);
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* register to windowmanager for redo or macro */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Called on event handling by `event_system.c`.
|
|
|
|
|
*
|
|
|
|
|
* All operations get registered in the windowmanager here.
|
|
|
|
|
*/
|
2009-07-16 00:50:27 +00:00
|
|
|
void wm_operator_register(bContext *C, wmOperator *op);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
|
/* wm_operator.c, for init/exit */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
void wm_operatortype_free(void);
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Called on initialize #WM_init().
|
|
|
|
|
*/
|
2007-12-24 18:27:28 +00:00
|
|
|
void wm_operatortype_init(void);
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Default key-map for windows and screens, only call once per WM.
|
|
|
|
|
*/
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void wm_window_keymap(wmKeyConfig *keyconf);
|
2018-07-13 12:15:18 +02:00
|
|
|
void wm_operatortypes_register(void);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
/* wm_gesture.c */
|
2022-04-04 13:17:03 +10:00
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/* called in wm_draw.c */
|
|
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
void wm_gesture_draw(struct wmWindow *win);
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
2022-03-04 13:31:16 +11:00
|
|
|
* Use for line gesture.
|
2021-12-08 17:12:41 +11:00
|
|
|
*/
|
2020-03-06 16:22:28 +01:00
|
|
|
void wm_gesture_tag_redraw(struct wmWindow *win);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-10-20 13:58:53 +00:00
|
|
|
/* wm_jobs.c */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hard-coded to event #TIMERJOBS.
|
|
|
|
|
*/
|
2020-03-06 16:22:28 +01:00
|
|
|
void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt);
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Kill job entirely, also removes timer itself.
|
|
|
|
|
*/
|
2021-03-15 14:06:38 +11:00
|
|
|
void wm_jobs_timer_end(wmWindowManager *wm, wmTimer *wt);
|
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
|
|
|
|
2009-10-20 13:58:53 +00:00
|
|
|
/* wm_files.c */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Run the auto-save timer action.
|
|
|
|
|
*/
|
2020-03-06 16:22:28 +01:00
|
|
|
void wm_autosave_timer(struct Main *bmain, wmWindowManager *wm, wmTimer *wt);
|
2021-03-15 14:21:33 +11:00
|
|
|
void wm_autosave_timer_begin(struct wmWindowManager *wm);
|
2021-03-15 14:06:38 +11:00
|
|
|
void wm_autosave_timer_end(wmWindowManager *wm);
|
2009-10-20 13:58:53 +00:00
|
|
|
void wm_autosave_delete(void);
|
|
|
|
|
|
2019-08-15 01:12:58 +10:00
|
|
|
/* wm_splash_screen.c */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
2019-08-15 01:12:58 +10:00
|
|
|
void WM_OT_splash(wmOperatorType *ot);
|
2020-05-12 14:28:32 -07:00
|
|
|
void WM_OT_splash_about(wmOperatorType *ot);
|
2019-08-15 01:12:58 +10:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* wm_stereo.c */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
2018-04-27 10:22:37 +02:00
|
|
|
void wm_stereo3d_draw_sidebyside(wmWindow *win, int view);
|
|
|
|
|
void wm_stereo3d_draw_topbottom(wmWindow *win, int view);
|
|
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* If needed, adjust \a r_mouse_xy
|
|
|
|
|
* so that drawn cursor and handled mouse position are matching visually.
|
|
|
|
|
*/
|
2021-10-21 16:44:07 +11:00
|
|
|
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int r_mouse_xy[2]);
|
2015-04-06 10:40:12 -03:00
|
|
|
int wm_stereo3d_set_exec(bContext *C, wmOperator *op);
|
|
|
|
|
int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *event);
|
|
|
|
|
void wm_stereo3d_set_draw(bContext *C, wmOperator *op);
|
2015-04-07 15:42:44 -03:00
|
|
|
bool wm_stereo3d_set_check(bContext *C, wmOperator *op);
|
2015-04-06 10:40:12 -03:00
|
|
|
void wm_stereo3d_set_cancel(bContext *C, wmOperator *op);
|
|
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Initialize operator properties.
|
|
|
|
|
*/
|
2014-04-03 11:04:02 +11:00
|
|
|
void wm_open_init_load_ui(wmOperator *op, bool use_prefs);
|
|
|
|
|
void wm_open_init_use_scripts(wmOperator *op, bool use_prefs);
|
|
|
|
|
|
2020-07-28 16:32:30 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|