2011-02-23 10:52:22 +00:00
|
|
|
/*
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00: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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup RNA
|
2011-02-27 20:20:01 +00:00
|
|
|
*/
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-03-15 14:32:29 +00:00
|
|
|
|
2017-12-01 15:47:24 +01:00
|
|
|
#include "BKE_workspace.h"
|
2018-11-16 11:24:49 +11:00
|
|
|
#include "BKE_keyconfig.h"
|
2017-12-01 15:47:24 +01:00
|
|
|
|
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
|
|
|
#include "RNA_access.h"
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
#include "RNA_define.h"
|
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
|
|
|
#include "RNA_enum_types.h"
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
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
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
2019-01-26 20:41:52 +11:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem event_keymouse_value_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{KM_PRESS, "PRESS", 0, "Press", ""},
|
|
|
|
|
{KM_RELEASE, "RELEASE", 0, "Release", ""},
|
|
|
|
|
{KM_CLICK, "CLICK", 0, "Click", ""},
|
|
|
|
|
{KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
|
|
|
|
|
{KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
|
2019-05-22 13:22:45 +10:00
|
|
|
/* Used for NDOF and trackpad events. */
|
|
|
|
|
{KM_NOTHING, "NOTHING", 0, "Nothing", ""},
|
2019-04-17 06:17:24 +02:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
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
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem event_tweak_value_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{EVT_GESTURE_N, "NORTH", 0, "North", ""},
|
|
|
|
|
{EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
|
|
|
|
|
{EVT_GESTURE_E, "EAST", 0, "East", ""},
|
|
|
|
|
{EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
|
|
|
|
|
{EVT_GESTURE_S, "SOUTH", 0, "South", ""},
|
|
|
|
|
{EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
|
|
|
|
|
{EVT_GESTURE_W, "WEST", 0, "West", ""},
|
|
|
|
|
{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem event_tweak_type_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
|
|
|
|
|
{EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
|
|
|
|
|
{EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
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
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem event_mouse_type_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
|
|
|
|
|
{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
|
|
|
|
|
{RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
|
|
|
|
|
{BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""},
|
|
|
|
|
{BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""},
|
|
|
|
|
{BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6", ""},
|
|
|
|
|
{BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{TABLET_STYLUS, "PEN", 0, "Pen", ""},
|
|
|
|
|
{TABLET_ERASER, "ERASER", 0, "Eraser", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""},
|
|
|
|
|
{MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""},
|
|
|
|
|
{MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""},
|
|
|
|
|
{MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""},
|
2020-01-28 11:29:38 +01:00
|
|
|
{MOUSESMARTZOOM, "MOUSESMARTZOOM", 0, "Mouse/Trackpad Smart Zoom", ""},
|
2019-04-17 06:17:24 +02:00
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
|
|
|
|
|
{WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
|
|
|
|
|
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
|
|
|
|
|
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
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
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem event_timer_type_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{TIMER, "TIMER", 0, "Timer", ""},
|
|
|
|
|
{TIMER0, "TIMER0", 0, "Timer 0", ""},
|
|
|
|
|
{TIMER1, "TIMER1", 0, "Timer 1", ""},
|
|
|
|
|
{TIMER2, "TIMER2", 0, "Timer 2", ""},
|
|
|
|
|
{TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", ""},
|
|
|
|
|
{TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", ""},
|
|
|
|
|
{TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", ""},
|
|
|
|
|
{TIMERREGION, "TIMERREGION", 0, "Timer Region", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
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
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem event_textinput_type_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2013-05-02 19:43:52 +00:00
|
|
|
};
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem event_ndof_type_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""},
|
|
|
|
|
/* buttons on all 3dconnexion devices */
|
|
|
|
|
{NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""},
|
|
|
|
|
{NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""},
|
|
|
|
|
/* view buttons */
|
|
|
|
|
{NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "Top", ""},
|
|
|
|
|
{NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "Bottom", ""},
|
|
|
|
|
{NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "Left", ""},
|
|
|
|
|
{NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "Right", ""},
|
|
|
|
|
{NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""},
|
|
|
|
|
{NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""},
|
|
|
|
|
/* more views */
|
|
|
|
|
{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "Isometric 1", ""},
|
|
|
|
|
{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "Isometric 2", ""},
|
|
|
|
|
/* 90 degree rotations */
|
|
|
|
|
{NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""},
|
|
|
|
|
{NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "Spin CW", ""},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "Spin CCW", ""},
|
|
|
|
|
{NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "Tilt CW", ""},
|
|
|
|
|
{NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "Tilt CCW", ""},
|
|
|
|
|
/* device control */
|
|
|
|
|
{NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "Rotate", ""},
|
|
|
|
|
{NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "Pan/Zoom", ""},
|
|
|
|
|
{NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""},
|
|
|
|
|
{NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""},
|
|
|
|
|
{NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""},
|
|
|
|
|
/* keyboard emulation */
|
|
|
|
|
{NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "Esc"},
|
|
|
|
|
{NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "Alt"},
|
|
|
|
|
{NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "Shift"},
|
|
|
|
|
{NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "Ctrl"},
|
|
|
|
|
/* general-purpose buttons */
|
|
|
|
|
{NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""},
|
|
|
|
|
{NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""},
|
|
|
|
|
{NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "Button 3", ""},
|
|
|
|
|
{NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "Button 4", ""},
|
|
|
|
|
{NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "Button 5", ""},
|
|
|
|
|
{NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "Button 6", ""},
|
|
|
|
|
{NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "Button 7", ""},
|
|
|
|
|
{NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""},
|
|
|
|
|
{NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""},
|
|
|
|
|
{NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""},
|
|
|
|
|
{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""},
|
|
|
|
|
{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""},
|
|
|
|
|
{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2016-08-18 00:21:55 -04:00
|
|
|
#endif /* RNA_RUNTIME */
|
2011-07-21 21:40:00 +00:00
|
|
|
|
2010-12-01 13:18:24 +00:00
|
|
|
/* not returned: CAPSLOCKKEY, UNKNOWNKEY */
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_event_type_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Note we abuse 'tooltip' message here to store a 'compact' form of some (too) long names. */
|
|
|
|
|
{0, "NONE", 0, "", ""},
|
|
|
|
|
{LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", "LMB"},
|
|
|
|
|
{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", "MMB"},
|
|
|
|
|
{RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", "RMB"},
|
|
|
|
|
{BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4 Mouse", "MB4"},
|
|
|
|
|
{BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", "MB5"},
|
|
|
|
|
{BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6 Mouse", "MB6"},
|
|
|
|
|
{BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7 Mouse", "MB7"},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{TABLET_STYLUS, "PEN", 0, "Pen", ""},
|
|
|
|
|
{TABLET_ERASER, "ERASER", 0, "Eraser", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", "MsMov"},
|
|
|
|
|
{INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "In-between Move", "MsSubMov"},
|
|
|
|
|
{MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", "MsPan"},
|
|
|
|
|
{MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", "MsZoom"},
|
|
|
|
|
{MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", "MsRot"},
|
2020-01-28 11:29:38 +01:00
|
|
|
{MOUSESMARTZOOM, "MOUSESMARTZOOM", 0, "Mouse/Trackpad Smart Zoom", "MsSmartZoom"},
|
2019-04-17 06:17:24 +02:00
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", "WhUp"},
|
|
|
|
|
{WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", "WhDown"},
|
|
|
|
|
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", "WhIn"},
|
|
|
|
|
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", "WhOut"},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", "TwkL"},
|
|
|
|
|
{EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", "TwkM"},
|
|
|
|
|
{EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", "TwkR"},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{AKEY, "A", 0, "A", ""},
|
|
|
|
|
{BKEY, "B", 0, "B", ""},
|
|
|
|
|
{CKEY, "C", 0, "C", ""},
|
|
|
|
|
{DKEY, "D", 0, "D", ""},
|
|
|
|
|
{EKEY, "E", 0, "E", ""},
|
|
|
|
|
{FKEY, "F", 0, "F", ""},
|
|
|
|
|
{GKEY, "G", 0, "G", ""},
|
|
|
|
|
{HKEY, "H", 0, "H", ""},
|
|
|
|
|
{IKEY, "I", 0, "I", ""},
|
|
|
|
|
{JKEY, "J", 0, "J", ""},
|
|
|
|
|
{KKEY, "K", 0, "K", ""},
|
|
|
|
|
{LKEY, "L", 0, "L", ""},
|
|
|
|
|
{MKEY, "M", 0, "M", ""},
|
|
|
|
|
{NKEY, "N", 0, "N", ""},
|
|
|
|
|
{OKEY, "O", 0, "O", ""},
|
|
|
|
|
{PKEY, "P", 0, "P", ""},
|
|
|
|
|
{QKEY, "Q", 0, "Q", ""},
|
|
|
|
|
{RKEY, "R", 0, "R", ""},
|
|
|
|
|
{SKEY, "S", 0, "S", ""},
|
|
|
|
|
{TKEY, "T", 0, "T", ""},
|
|
|
|
|
{UKEY, "U", 0, "U", ""},
|
|
|
|
|
{VKEY, "V", 0, "V", ""},
|
|
|
|
|
{WKEY, "W", 0, "W", ""},
|
|
|
|
|
{XKEY, "X", 0, "X", ""},
|
|
|
|
|
{YKEY, "Y", 0, "Y", ""},
|
|
|
|
|
{ZKEY, "Z", 0, "Z", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{ZEROKEY, "ZERO", 0, "0", ""},
|
|
|
|
|
{ONEKEY, "ONE", 0, "1", ""},
|
|
|
|
|
{TWOKEY, "TWO", 0, "2", ""},
|
|
|
|
|
{THREEKEY, "THREE", 0, "3", ""},
|
|
|
|
|
{FOURKEY, "FOUR", 0, "4", ""},
|
|
|
|
|
{FIVEKEY, "FIVE", 0, "5", ""},
|
|
|
|
|
{SIXKEY, "SIX", 0, "6", ""},
|
|
|
|
|
{SEVENKEY, "SEVEN", 0, "7", ""},
|
|
|
|
|
{EIGHTKEY, "EIGHT", 0, "8", ""},
|
|
|
|
|
{NINEKEY, "NINE", 0, "9", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", "CtrlL"},
|
|
|
|
|
{LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", "AltL"},
|
|
|
|
|
{LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", "ShiftL"},
|
|
|
|
|
{RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", "AltR"},
|
|
|
|
|
{RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", "CtrlR"},
|
|
|
|
|
{RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{OSKEY, "OSKEY", 0, "OS Key", "Cmd"},
|
2019-12-10 16:54:47 +11:00
|
|
|
{APPKEY, "APP", 0, "Application", "App"},
|
2019-04-17 06:17:24 +02:00
|
|
|
{GRLESSKEY, "GRLESS", 0, "Grless", ""},
|
|
|
|
|
{ESCKEY, "ESC", 0, "Esc", ""},
|
|
|
|
|
{TABKEY, "TAB", 0, "Tab", ""},
|
|
|
|
|
{RETKEY, "RET", 0, "Return", "Enter"},
|
|
|
|
|
{SPACEKEY, "SPACE", 0, "Spacebar", "Space"},
|
|
|
|
|
{LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""},
|
|
|
|
|
{BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", "BkSpace"},
|
|
|
|
|
{DELKEY, "DEL", 0, "Delete", "Del"},
|
|
|
|
|
{SEMICOLONKEY, "SEMI_COLON", 0, ";", ""},
|
|
|
|
|
{PERIODKEY, "PERIOD", 0, ".", ""},
|
|
|
|
|
{COMMAKEY, "COMMA", 0, ",", ""},
|
|
|
|
|
{QUOTEKEY, "QUOTE", 0, "\"", ""},
|
|
|
|
|
{ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""},
|
|
|
|
|
{MINUSKEY, "MINUS", 0, "-", ""},
|
|
|
|
|
{PLUSKEY, "PLUS", 0, "+", ""},
|
|
|
|
|
{SLASHKEY, "SLASH", 0, "/", ""},
|
|
|
|
|
{BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""},
|
|
|
|
|
{EQUALKEY, "EQUAL", 0, "=", ""},
|
|
|
|
|
{LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""},
|
|
|
|
|
{RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""},
|
|
|
|
|
{LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", "←"},
|
|
|
|
|
{DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", "↓"},
|
|
|
|
|
{RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", "→"},
|
|
|
|
|
{UPARROWKEY, "UP_ARROW", 0, "Up Arrow", "↑"},
|
|
|
|
|
{PAD2, "NUMPAD_2", 0, "Numpad 2", "Pad2"},
|
|
|
|
|
{PAD4, "NUMPAD_4", 0, "Numpad 4", "Pad4"},
|
|
|
|
|
{PAD6, "NUMPAD_6", 0, "Numpad 6", "Pad6"},
|
|
|
|
|
{PAD8, "NUMPAD_8", 0, "Numpad 8", "Pad8"},
|
|
|
|
|
{PAD1, "NUMPAD_1", 0, "Numpad 1", "Pad1"},
|
|
|
|
|
{PAD3, "NUMPAD_3", 0, "Numpad 3", "Pad3"},
|
|
|
|
|
{PAD5, "NUMPAD_5", 0, "Numpad 5", "Pad5"},
|
|
|
|
|
{PAD7, "NUMPAD_7", 0, "Numpad 7", "Pad7"},
|
|
|
|
|
{PAD9, "NUMPAD_9", 0, "Numpad 9", "Pad9"},
|
|
|
|
|
{PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", "Pad."},
|
|
|
|
|
{PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", "Pad/"},
|
|
|
|
|
{PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", "Pad*"},
|
|
|
|
|
{PAD0, "NUMPAD_0", 0, "Numpad 0", "Pad0"},
|
|
|
|
|
{PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", "Pad-"},
|
|
|
|
|
{PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", "PadEnter"},
|
|
|
|
|
{PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", "Pad+"},
|
|
|
|
|
{F1KEY, "F1", 0, "F1", ""},
|
|
|
|
|
{F2KEY, "F2", 0, "F2", ""},
|
|
|
|
|
{F3KEY, "F3", 0, "F3", ""},
|
|
|
|
|
{F4KEY, "F4", 0, "F4", ""},
|
|
|
|
|
{F5KEY, "F5", 0, "F5", ""},
|
|
|
|
|
{F6KEY, "F6", 0, "F6", ""},
|
|
|
|
|
{F7KEY, "F7", 0, "F7", ""},
|
|
|
|
|
{F8KEY, "F8", 0, "F8", ""},
|
|
|
|
|
{F9KEY, "F9", 0, "F9", ""},
|
|
|
|
|
{F10KEY, "F10", 0, "F10", ""},
|
|
|
|
|
{F11KEY, "F11", 0, "F11", ""},
|
|
|
|
|
{F12KEY, "F12", 0, "F12", ""},
|
|
|
|
|
{F13KEY, "F13", 0, "F13", ""},
|
|
|
|
|
{F14KEY, "F14", 0, "F14", ""},
|
|
|
|
|
{F15KEY, "F15", 0, "F15", ""},
|
|
|
|
|
{F16KEY, "F16", 0, "F16", ""},
|
|
|
|
|
{F17KEY, "F17", 0, "F17", ""},
|
|
|
|
|
{F18KEY, "F18", 0, "F18", ""},
|
|
|
|
|
{F19KEY, "F19", 0, "F19", ""},
|
2020-01-15 13:19:32 +11:00
|
|
|
{F20KEY, "F20", 0, "F20", ""},
|
|
|
|
|
{F21KEY, "F21", 0, "F21", ""},
|
|
|
|
|
{F22KEY, "F22", 0, "F22", ""},
|
|
|
|
|
{F23KEY, "F23", 0, "F23", ""},
|
|
|
|
|
{F24KEY, "F24", 0, "F24", ""},
|
2019-04-17 06:17:24 +02:00
|
|
|
{PAUSEKEY, "PAUSE", 0, "Pause", ""},
|
|
|
|
|
{INSERTKEY, "INSERT", 0, "Insert", "Ins"},
|
|
|
|
|
{HOMEKEY, "HOME", 0, "Home", ""},
|
|
|
|
|
{PAGEUPKEY, "PAGE_UP", 0, "Page Up", "PgUp"},
|
|
|
|
|
{PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", "PgDown"},
|
|
|
|
|
{ENDKEY, "END", 0, "End", ""},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ">/||"},
|
|
|
|
|
{MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", "Stop"},
|
|
|
|
|
{MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", "|<<"},
|
|
|
|
|
{MEDIALAST, "MEDIA_LAST", 0, "Media Last", ">>|"},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", "TxtIn"},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""},
|
|
|
|
|
{TIMER, "TIMER", 0, "Timer", "Tmr"},
|
|
|
|
|
{TIMER0, "TIMER0", 0, "Timer 0", "Tmr0"},
|
|
|
|
|
{TIMER1, "TIMER1", 0, "Timer 1", "Tmr1"},
|
|
|
|
|
{TIMER2, "TIMER2", 0, "Timer 2", "Tmr2"},
|
|
|
|
|
{TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", "TmrJob"},
|
|
|
|
|
{TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", "TmrSave"},
|
|
|
|
|
{TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", "TmrReport"},
|
|
|
|
|
{TIMERREGION, "TIMERREGION", 0, "Timer Region", "TmrReg"},
|
|
|
|
|
{0, "", 0, NULL, NULL},
|
|
|
|
|
{NDOF_MOTION, "NDOF_MOTION", 0, "NDOF Motion", "NdofMov"},
|
|
|
|
|
/* buttons on all 3dconnexion devices */
|
|
|
|
|
{NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "NDOF Menu", "NdofMenu"},
|
|
|
|
|
{NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "NDOF Fit", "NdofFit"},
|
|
|
|
|
/* view buttons */
|
|
|
|
|
{NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "NDOF Top", "Ndof↑"},
|
|
|
|
|
{NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "NDOF Bottom", "Ndof↓"},
|
|
|
|
|
{NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "NDOF Left", "Ndof←"},
|
|
|
|
|
{NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "NDOF Right", "Ndof→"},
|
|
|
|
|
{NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "NDOF Front", "NdofFront"},
|
|
|
|
|
{NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "NDOF Back", "NdofBack"},
|
|
|
|
|
/* more views */
|
|
|
|
|
{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "NDOF Isometric 1", "NdofIso1"},
|
|
|
|
|
{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "NDOF Isometric 2", "NdofIso2"},
|
|
|
|
|
/* 90 degree rotations */
|
|
|
|
|
{NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "NDOF Roll CW", "NdofRCW"},
|
|
|
|
|
{NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "NDOF Roll CCW", "NdofRCCW"},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "NDOF Spin CW", "NdofSCW"},
|
|
|
|
|
{NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "NDOF Spin CCW", "NdofSCCW"},
|
|
|
|
|
{NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "NDOF Tilt CW", "NdofTCW"},
|
|
|
|
|
{NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "NDOF Tilt CCW", "NdofTCCW"},
|
|
|
|
|
/* device control */
|
|
|
|
|
{NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "NDOF Rotate", "NdofRot"},
|
|
|
|
|
{NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "NDOF Pan/Zoom", "NdofPanZoom"},
|
|
|
|
|
{NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "NDOF Dominant", "NdofDom"},
|
|
|
|
|
{NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "NDOF Plus", "Ndof+"},
|
|
|
|
|
{NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "NDOF Minus", "Ndof-"},
|
|
|
|
|
/* keyboard emulation */
|
|
|
|
|
{NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "NDOF Esc", "NdofEsc"},
|
|
|
|
|
{NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "NDOF Alt", "NdofAlt"},
|
|
|
|
|
{NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "NDOF Shift", "NdofShift"},
|
|
|
|
|
{NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "NDOF Ctrl", "NdofCtrl"},
|
|
|
|
|
/* general-purpose buttons */
|
|
|
|
|
{NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "NDOF Button 1", "NdofB1"},
|
|
|
|
|
{NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "NDOF Button 2", "NdofB2"},
|
|
|
|
|
{NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "NDOF Button 3", "NdofB3"},
|
|
|
|
|
{NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "NDOF Button 4", "NdofB4"},
|
|
|
|
|
{NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "NDOF Button 5", "NdofB5"},
|
|
|
|
|
{NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "NDOF Button 6", "NdofB6"},
|
|
|
|
|
{NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "NDOF Button 7", "NdofB7"},
|
|
|
|
|
{NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "NDOF Button 8", "NdofB8"},
|
|
|
|
|
{NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "NDOF Button 9", "NdofB9"},
|
|
|
|
|
{NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "NDOF Button 10", "NdofB10"},
|
|
|
|
|
{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "NDOF Button A", "NdofBA"},
|
|
|
|
|
{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", "NdofBB"},
|
|
|
|
|
{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", "NdofBC"},
|
|
|
|
|
/* Action Zones. */
|
|
|
|
|
{EVT_ACTIONZONE_AREA, "ACTIONZONE_AREA", 0, "ActionZone Area", "AZone Area"},
|
|
|
|
|
{EVT_ACTIONZONE_REGION, "ACTIONZONE_REGION", 0, "ActionZone Region", "AZone Region"},
|
|
|
|
|
{EVT_ACTIONZONE_FULLSCREEN,
|
|
|
|
|
"ACTIONZONE_FULLSCREEN",
|
|
|
|
|
0,
|
|
|
|
|
"ActionZone Fullscreen",
|
|
|
|
|
"AZone FullScr"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_event_value_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{KM_PRESS, "PRESS", 0, "Press", ""},
|
|
|
|
|
{KM_RELEASE, "RELEASE", 0, "Release", ""},
|
|
|
|
|
{KM_CLICK, "CLICK", 0, "Click", ""},
|
|
|
|
|
{KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
|
|
|
|
|
{KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
|
|
|
|
|
{EVT_GESTURE_N, "NORTH", 0, "North", ""},
|
|
|
|
|
{EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
|
|
|
|
|
{EVT_GESTURE_E, "EAST", 0, "East", ""},
|
|
|
|
|
{EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
|
|
|
|
|
{EVT_GESTURE_S, "SOUTH", 0, "South", ""},
|
|
|
|
|
{EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
|
|
|
|
|
{EVT_GESTURE_W, "WEST", 0, "West", ""},
|
|
|
|
|
{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
|
2019-05-22 13:22:45 +10:00
|
|
|
{KM_NOTHING, "NOTHING", 0, "Nothing", ""},
|
2019-04-17 06:17:24 +02:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2013-09-11 21:27:14 +00:00
|
|
|
};
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_keymap_propvalue_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{0, "NONE", 0, "", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-11-14 22:43:42 +00:00
|
|
|
|
2018-12-12 21:39:55 +11:00
|
|
|
/* Mask event types used in keymap items. */
|
|
|
|
|
const EnumPropertyItem rna_enum_event_type_mask_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{EVT_TYPE_MASK_KEYBOARD_MODIFIER, "KEYBOARD_MODIFIER", 0, "Keyboard Modifier", ""},
|
|
|
|
|
{EVT_TYPE_MASK_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
|
|
|
|
|
{EVT_TYPE_MASK_MOUSE_WHEEL, "MOUSE_WHEEL", 0, "Mouse Wheel", ""},
|
|
|
|
|
{EVT_TYPE_MASK_MOUSE_GESTURE, "MOUSE_GESTURE", 0, "Mouse Gesture", ""},
|
|
|
|
|
{EVT_TYPE_MASK_MOUSE_BUTTON, "MOUSE_BUTTON", 0, "Mouse Button", ""},
|
|
|
|
|
{EVT_TYPE_MASK_MOUSE, "MOUSE", 0, "Mouse", ""},
|
|
|
|
|
{EVT_TYPE_MASK_NDOF, "NDOF", 0, "NDOF", ""},
|
|
|
|
|
{EVT_TYPE_MASK_TWEAK, "TWEAK", 0, "Tweak", ""},
|
|
|
|
|
{EVT_TYPE_MASK_ACTIONZONE, "ACTIONZONE", 0, "Action Zone", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2018-12-12 21:39:55 +11:00
|
|
|
};
|
|
|
|
|
|
2011-11-14 16:05:44 +00:00
|
|
|
#if 0
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem keymap_modifiers_items[] = {
|
2019-04-17 08:24:14 +02:00
|
|
|
{KM_ANY, "ANY", 0, "Any", ""},
|
|
|
|
|
{0, "NONE", 0, "None", ""},
|
|
|
|
|
{1, "FIRST", 0, "First", ""},
|
|
|
|
|
{2, "SECOND", 0, "Second", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2011-11-14 16:05:44 +00:00
|
|
|
#endif
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2013-09-11 21:27:14 +00:00
|
|
|
#ifndef RNA_RUNTIME
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem operator_flag_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{OPTYPE_REGISTER,
|
|
|
|
|
"REGISTER",
|
|
|
|
|
0,
|
|
|
|
|
"Register",
|
|
|
|
|
"Display in the info window and support the redo toolbar panel"},
|
|
|
|
|
{OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
|
|
|
|
|
{OPTYPE_UNDO_GROUPED,
|
|
|
|
|
"UNDO_GROUPED",
|
|
|
|
|
0,
|
|
|
|
|
"Grouped Undo",
|
|
|
|
|
"Push a single undo event for repetead instances of this operator"},
|
|
|
|
|
{OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
|
|
|
|
|
{OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
|
2019-05-29 00:48:48 +10:00
|
|
|
{OPTYPE_GRAB_CURSOR_XY,
|
2019-04-17 06:17:24 +02:00
|
|
|
"GRAB_CURSOR",
|
|
|
|
|
0,
|
|
|
|
|
"Grab Pointer",
|
|
|
|
|
"Use so the operator grabs the mouse focus, enables wrapping when continuous grab "
|
|
|
|
|
"is enabled"},
|
2019-05-29 00:48:48 +10:00
|
|
|
{OPTYPE_GRAB_CURSOR_X, "GRAB_CURSOR_X", 0, "Grab Pointer X", "Grab, only warping the X axis"},
|
|
|
|
|
{OPTYPE_GRAB_CURSOR_Y, "GRAB_CURSOR_Y", 0, "Grab Pointer Y", "Grab, only warping the Y axis"},
|
2019-04-17 06:17:24 +02:00
|
|
|
{OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
|
|
|
|
|
{OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2013-09-11 21:27:14 +00:00
|
|
|
#endif
|
2010-03-01 00:03:51 +00:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_operator_return_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{OPERATOR_RUNNING_MODAL,
|
|
|
|
|
"RUNNING_MODAL",
|
|
|
|
|
0,
|
|
|
|
|
"Running Modal",
|
|
|
|
|
"Keep the operator running with blender"},
|
|
|
|
|
{OPERATOR_CANCELLED,
|
|
|
|
|
"CANCELLED",
|
|
|
|
|
0,
|
|
|
|
|
"Cancelled",
|
2019-11-13 13:42:01 +03:00
|
|
|
"The operator exited without doing anything, so no undo entry should be pushed"},
|
2019-04-17 06:17:24 +02:00
|
|
|
{OPERATOR_FINISHED,
|
|
|
|
|
"FINISHED",
|
|
|
|
|
0,
|
|
|
|
|
"Finished",
|
2019-11-13 13:42:01 +03:00
|
|
|
"The operator exited after completing its action"},
|
2019-04-17 06:17:24 +02:00
|
|
|
/* used as a flag */
|
|
|
|
|
{OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
|
|
|
|
|
{OPERATOR_INTERFACE, "INTERFACE", 0, "Interface", "Handled but not executed (popup menus)"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-12-07 00:16:57 +00:00
|
|
|
|
2017-11-23 13:58:05 +01:00
|
|
|
const EnumPropertyItem rna_enum_operator_property_tags[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{OP_PROP_TAG_ADVANCED,
|
|
|
|
|
"ADVANCED",
|
|
|
|
|
0,
|
|
|
|
|
"Advanced",
|
|
|
|
|
"The property is advanced so UI is suggested to hide it"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2017-11-23 13:58:05 +01:00
|
|
|
};
|
|
|
|
|
|
2009-12-10 16:52:44 +00:00
|
|
|
/* flag/enum */
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_wm_report_items[] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
{RPT_DEBUG, "DEBUG", 0, "Debug", ""},
|
|
|
|
|
{RPT_INFO, "INFO", 0, "Info", ""},
|
|
|
|
|
{RPT_OPERATOR, "OPERATOR", 0, "Operator", ""},
|
|
|
|
|
{RPT_PROPERTY, "PROPERTY", 0, "Property", ""},
|
|
|
|
|
{RPT_WARNING, "WARNING", 0, "Warning", ""},
|
|
|
|
|
{RPT_ERROR, "ERROR", 0, "Error", ""},
|
|
|
|
|
{RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},
|
|
|
|
|
{RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""},
|
|
|
|
|
{RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-12-10 16:52:44 +00:00
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include <assert.h>
|
2010-12-07 08:27:20 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "BLI_string_utils.h"
|
2019-01-26 20:41:52 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "WM_api.h"
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "DNA_object_types.h"
|
|
|
|
|
# include "DNA_workspace_types.h"
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "ED_screen.h"
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "UI_interface.h"
|
2013-06-01 04:06:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "BKE_global.h"
|
|
|
|
|
# include "BKE_idprop.h"
|
2009-05-20 09:52:02 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# include "MEM_guardedalloc.h"
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
# include "BPY_extern.h"
|
|
|
|
|
# endif
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2008-12-16 20:03:28 +00:00
|
|
|
static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
wmWindowManager *wm = (wmWindowManager *)ptr->owner_id;
|
2008-12-16 20:03:28 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (wm) {
|
|
|
|
|
IDProperty *properties = (IDProperty *)ptr->data;
|
|
|
|
|
for (wmOperator *op = wm->operators.last; op; op = op->prev) {
|
|
|
|
|
if (op->properties == properties) {
|
|
|
|
|
return op;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return NULL;
|
2008-12-16 20:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = rna_OperatorProperties_find_operator(ptr);
|
2008-12-16 20:03:28 +00:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (op) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return op->type->srna;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
return ptr->type;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, bool create)
|
2009-05-20 09:52:02 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
if (create && !ptr->data) {
|
|
|
|
|
IDPropertyTemplate val = {0};
|
|
|
|
|
ptr->data = IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group");
|
|
|
|
|
}
|
2009-05-20 09:52:02 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return ptr->data;
|
2009-05-20 09:52:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-16 20:03:28 +00:00
|
|
|
static void rna_Operator_name_get(PointerRNA *ptr, char *value)
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
|
|
|
|
strcpy(value, op->type->name);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Operator_name_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
|
|
|
|
return strlen(op->type->name);
|
2008-12-16 20:03:28 +00:00
|
|
|
}
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_Operator_has_reports_get(PointerRNA *ptr)
|
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
|
|
|
|
return (op->reports && op->reports->list.first);
|
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-27 18:45:48 +10:00
|
|
|
static PointerRNA rna_Operator_options_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_OperatorOptions, ptr->data);
|
2015-04-27 18:45:48 +10:00
|
|
|
}
|
|
|
|
|
|
2009-02-02 19:57:57 +00:00
|
|
|
static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
|
2008-12-31 13:16:37 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = (wmOperator *)ptr->data;
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties);
|
2008-12-31 13:16:37 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-05 00:19:33 +00:00
|
|
|
static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
|
2009-12-05 19:27:26 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperatorTypeMacro *otmacro = (wmOperatorTypeMacro *)ptr->data;
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(otmacro->idname, true);
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties);
|
2009-12-05 19:27:26 +00:00
|
|
|
}
|
2009-06-21 14:30:59 +00:00
|
|
|
|
2009-06-23 00:41:55 +00:00
|
|
|
static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
|
2009-06-21 14:30:59 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const wmEvent *event = ptr->data;
|
|
|
|
|
value[0] = event->ascii;
|
|
|
|
|
value[1] = '\0';
|
2009-06-21 14:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Event_ascii_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const wmEvent *event = ptr->data;
|
|
|
|
|
return (event->ascii) ? 1 : 0;
|
2009-06-21 14:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-23 07:03:57 +00:00
|
|
|
static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* utf8 buf isn't \0 terminated */
|
|
|
|
|
const wmEvent *event = ptr->data;
|
|
|
|
|
size_t len = 0;
|
2011-10-23 07:03:57 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (event->utf8_buf[0]) {
|
|
|
|
|
BLI_str_utf8_as_unicode_and_size(event->utf8_buf, &len);
|
|
|
|
|
if (len > 0) {
|
|
|
|
|
memcpy(value, event->utf8_buf, len);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-10-23 07:03:57 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
value[len] = '\0';
|
2011-10-23 07:03:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_Event_unicode_length(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
const wmEvent *event = ptr->data;
|
|
|
|
|
if (event->utf8_buf[0]) {
|
|
|
|
|
/* invalid value is checked on assignment so we don't need to account for this */
|
|
|
|
|
return BLI_str_utf8_size(event->utf8_buf);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2011-10-23 07:03:57 +00:00
|
|
|
}
|
|
|
|
|
|
2014-07-14 16:59:35 +03:00
|
|
|
static float rna_Event_pressure_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const wmEvent *event = ptr->data;
|
|
|
|
|
return WM_event_tablet_data(event, NULL, NULL);
|
2014-07-14 17:49:00 +03:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_Event_is_tablet_get(PointerRNA *ptr)
|
2014-07-14 17:49:00 +03:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const wmEvent *event = ptr->data;
|
|
|
|
|
return WM_event_is_tablet(event);
|
2014-07-14 17:49:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Event_tilt_get(PointerRNA *ptr, float *values)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmEvent *event = ptr->data;
|
|
|
|
|
WM_event_tablet_data(event, NULL, values);
|
2014-07-14 16:59:35 +03:00
|
|
|
}
|
|
|
|
|
|
2013-06-01 04:06:38 +00:00
|
|
|
static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
struct uiPopupMenu *pup = ptr->data;
|
|
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2013-06-01 04:06:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA rptr;
|
2019-08-23 09:52:12 +02:00
|
|
|
RNA_pointer_create(ptr->owner_id, &RNA_UILayout, layout, &rptr);
|
2013-06-01 04:06:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return rptr;
|
2013-06-01 04:06:38 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-22 17:16:39 +02:00
|
|
|
static PointerRNA rna_PopoverMenu_layout_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
struct uiPopover *pup = ptr->data;
|
|
|
|
|
uiLayout *layout = UI_popover_layout(pup);
|
2018-04-22 17:16:39 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA rptr;
|
2019-08-23 09:52:12 +02:00
|
|
|
RNA_pointer_create(ptr->owner_id, &RNA_UILayout, layout, &rptr);
|
2018-04-22 17:16:39 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return rptr;
|
2018-04-22 17:16:39 +02:00
|
|
|
}
|
|
|
|
|
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
static PointerRNA rna_PieMenu_layout_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
struct uiPieMenu *pie = ptr->data;
|
|
|
|
|
uiLayout *layout = UI_pie_menu_layout(pie);
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA rptr;
|
2019-08-23 09:52:12 +02:00
|
|
|
RNA_pointer_create(ptr->owner_id, &RNA_UILayout, layout, &rptr);
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return rptr;
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_Window_scene_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (value.data == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
win->new_scene = value.data;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Window_scene_update(bContext *C, PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
|
wmWindow *win = ptr->data;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* exception: must use context so notifier gets to the right window */
|
|
|
|
|
if (win->new_scene) {
|
|
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
BPy_BEGIN_ALLOW_THREADS;
|
|
|
|
|
# endif
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_window_set_active_scene(bmain, C, win, win->new_scene);
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
BPy_END_ALLOW_THREADS;
|
|
|
|
|
# endif
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, win->new_scene);
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (G.debug & G_DEBUG) {
|
2019-04-17 06:17:24 +02:00
|
|
|
printf("scene set %p\n", win->new_scene);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
win->new_scene = NULL;
|
|
|
|
|
}
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_Window_workspace_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
|
|
|
|
return rna_pointer_inherit_refine(
|
|
|
|
|
ptr, &RNA_WorkSpace, BKE_workspace_active_get(win->workspace_hook));
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_Window_workspace_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
2009-06-30 19:10:14 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = (wmWindow *)ptr->data;
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* disallow ID-browsing away from temp screens */
|
|
|
|
|
if (WM_window_is_temp_screen(win)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (value.data == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* exception: can't set workspaces inside of area/region handlers */
|
|
|
|
|
win->workspace_hook->temp_workspace_store = value.data;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Window_workspace_update(bContext *C, PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
|
|
|
|
WorkSpace *new_workspace = win->workspace_hook->temp_workspace_store;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* exception: can't set screens inside of area/region handlers,
|
|
|
|
|
* and must use context so notifier gets to the right window */
|
|
|
|
|
if (new_workspace) {
|
|
|
|
|
WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
|
|
|
|
|
win->workspace_hook->temp_workspace_store = NULL;
|
|
|
|
|
}
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PointerRNA rna_Window_screen_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
|
|
|
|
return rna_pointer_inherit_refine(
|
|
|
|
|
ptr, &RNA_Screen, BKE_workspace_active_screen_get(win->workspace_hook));
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_Window_screen_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
|
|
|
|
WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
|
|
|
|
|
WorkSpaceLayout *layout_new;
|
|
|
|
|
const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
|
2015-08-26 13:59:46 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* disallow ID-browsing away from temp screens */
|
|
|
|
|
if (screen->temp) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (value.data == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* exception: can't set screens inside of area/region handlers */
|
|
|
|
|
layout_new = BKE_workspace_layout_find(workspace, value.data);
|
|
|
|
|
win->workspace_hook->temp_layout_store = layout_new;
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
2013-06-03 04:06:54 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
bScreen *screen = (bScreen *)value.owner_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
return !screen->temp;
|
2013-06-03 04:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
static void rna_workspace_screen_update(bContext *C, PointerRNA *ptr)
|
2009-06-30 19:10:14 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
|
|
|
|
WorkSpaceLayout *layout_new = win->workspace_hook->temp_layout_store;
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* exception: can't set screens inside of area/region handlers,
|
|
|
|
|
* and must use context so notifier gets to the right window */
|
|
|
|
|
if (layout_new) {
|
|
|
|
|
WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
|
|
|
|
|
win->workspace_hook->temp_layout_store = NULL;
|
|
|
|
|
}
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2017-12-01 15:47:24 +01:00
|
|
|
static PointerRNA rna_Window_view_layer_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
|
|
|
|
Scene *scene = WM_window_get_active_scene(win);
|
|
|
|
|
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
|
|
|
|
|
PointerRNA scene_ptr;
|
2017-12-01 15:47:24 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_id_pointer_create(&scene->id, &scene_ptr);
|
|
|
|
|
return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, view_layer);
|
2017-12-01 15:47:24 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_Window_view_layer_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
2017-12-01 15:47:24 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindow *win = ptr->data;
|
|
|
|
|
ViewLayer *view_layer = value.data;
|
2017-12-01 15:47:24 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_window_set_active_view_layer(win, view_layer);
|
2017-12-01 15:47:24 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
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
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (kmi->ptr) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return *(kmi->ptr);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */
|
|
|
|
|
return PointerRNA_NULL;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
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
|
|
|
|
2019-05-02 11:42:46 +10:00
|
|
|
return WM_keymap_item_map_type_get(kmi);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
|
|
|
|
|
|
|
|
|
|
if (value != map_type) {
|
|
|
|
|
switch (value) {
|
|
|
|
|
case KMI_TYPE_KEYBOARD:
|
|
|
|
|
kmi->type = AKEY;
|
|
|
|
|
kmi->val = KM_PRESS;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_TWEAK:
|
|
|
|
|
kmi->type = EVT_TWEAK_L;
|
|
|
|
|
kmi->val = KM_ANY;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_MOUSE:
|
|
|
|
|
kmi->type = LEFTMOUSE;
|
|
|
|
|
kmi->val = KM_PRESS;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_TEXTINPUT:
|
|
|
|
|
kmi->type = KM_TEXTINPUT;
|
|
|
|
|
kmi->val = KM_NOTHING;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_TIMER:
|
|
|
|
|
kmi->type = TIMER;
|
|
|
|
|
kmi->val = KM_NOTHING;
|
|
|
|
|
break;
|
|
|
|
|
case KMI_TYPE_NDOF:
|
|
|
|
|
kmi->type = NDOF_MOTION;
|
|
|
|
|
kmi->val = KM_NOTHING;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
/* assumes value to be an enum from rna_enum_event_type_items */
|
2012-10-20 14:13:14 +00:00
|
|
|
/* function makes sure keymodifiers are only valid keys, ESC keeps it unaltered */
|
|
|
|
|
static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
|
|
|
|
|
/* XXX, this should really be managed in an _itemf function,
|
|
|
|
|
* giving a list of valid enums, then silently changing them when they are set is not
|
|
|
|
|
* a good precedent, don't do this unless you have a good reason! */
|
|
|
|
|
if (value == ESCKEY) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else if (value >= AKEY) {
|
|
|
|
|
kmi->keymodifier = value;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
kmi->keymodifier = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C),
|
|
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PropertyRNA *UNUSED(prop),
|
|
|
|
|
bool *UNUSED(r_free))
|
|
|
|
|
{
|
|
|
|
|
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
|
|
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (map_type == KMI_TYPE_MOUSE) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return event_mouse_type_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
if (map_type == KMI_TYPE_TWEAK) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return event_tweak_type_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
if (map_type == KMI_TYPE_TIMER) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return event_timer_type_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
if (map_type == KMI_TYPE_NDOF) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return event_ndof_type_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
if (map_type == KMI_TYPE_TEXTINPUT) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return event_textinput_type_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
return rna_enum_event_type_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C),
|
|
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PropertyRNA *UNUSED(prop),
|
|
|
|
|
bool *UNUSED(r_free))
|
|
|
|
|
{
|
|
|
|
|
int map_type = rna_wmKeyMapItem_map_type_get(ptr);
|
|
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return event_keymouse_value_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
if (map_type == KMI_TYPE_TWEAK) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return event_tweak_value_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
return rna_enum_event_value_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C,
|
|
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PropertyRNA *UNUSED(prop),
|
|
|
|
|
bool *UNUSED(r_free))
|
|
|
|
|
{
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
wmKeyConfig *kc;
|
|
|
|
|
wmKeyMap *km;
|
|
|
|
|
|
|
|
|
|
for (kc = wm->keyconfigs.first; kc; kc = kc->next) {
|
|
|
|
|
for (km = kc->keymaps.first; km; km = km->next) {
|
|
|
|
|
/* only check if it's a modal keymap */
|
|
|
|
|
if (km->modal_items) {
|
|
|
|
|
wmKeyMapItem *kmi;
|
|
|
|
|
for (kmi = km->items.first; kmi; kmi = kmi->next) {
|
|
|
|
|
if (kmi == ptr->data) {
|
|
|
|
|
return km->modal_items;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rna_enum_keymap_propvalue_items; /* ERROR */
|
2009-11-14 22:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_KeyMapItem_any_get(PointerRNA *ptr)
|
2009-11-15 19:25:34 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (kmi->shift == KM_ANY && kmi->ctrl == KM_ANY && kmi->alt == KM_ANY && kmi->oskey == KM_ANY) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2009-11-15 19:25:34 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_KeyMapItem_any_set(PointerRNA *ptr, bool value)
|
2009-11-15 19:25:34 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
2009-11-15 19:25:34 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (value) {
|
|
|
|
|
kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = KM_ANY;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = 0;
|
|
|
|
|
}
|
2009-11-15 19:25:34 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_KeyMapItem_shift_get(PointerRNA *ptr)
|
2015-04-10 11:03:47 -03:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->shift != 0;
|
2015-04-10 11:03:47 -03:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_KeyMapItem_ctrl_get(PointerRNA *ptr)
|
2015-04-10 11:03:47 -03:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->ctrl != 0;
|
2015-04-10 11:03:47 -03:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_KeyMapItem_alt_get(PointerRNA *ptr)
|
2015-04-10 11:03:47 -03:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->alt != 0;
|
2015-04-10 11:03:47 -03:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_KeyMapItem_oskey_get(PointerRNA *ptr)
|
2015-04-10 11:03:47 -03:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
|
|
|
|
|
return kmi->oskey != 0;
|
2015-04-10 11:03:47 -03:00
|
|
|
}
|
2009-11-15 19:25:34 +00:00
|
|
|
|
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
|
|
|
static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindowManager *wm = ptr->data;
|
|
|
|
|
wmKeyConfig *kc;
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
kc = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
|
2013-07-19 10:40:06 +00:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!kc) {
|
2019-04-17 06:17:24 +02:00
|
|
|
kc = wm->defaultconf;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
|
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
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
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
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindowManager *wm = ptr->data;
|
|
|
|
|
wmKeyConfig *kc = value.data;
|
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
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (kc) {
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_keyconfig_set_active(wm, kc->idname);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
2018-11-16 11:24:49 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Key Config Preferences
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_wmKeyConfig_preferences_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyConfig *kc = ptr->data;
|
|
|
|
|
wmKeyConfigPrefType_Runtime *kpt_rt = BKE_keyconfig_pref_type_find(kc->idname, true);
|
|
|
|
|
if (kpt_rt) {
|
|
|
|
|
wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(&U, kc->idname);
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, kpt_rt->ext.srna, kpt->prop);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return PointerRNA_NULL;
|
|
|
|
|
}
|
2018-11-16 11:24:49 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static IDProperty *rna_wmKeyConfigPref_idprops(PointerRNA *ptr, bool create)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
if (create && !ptr->data) {
|
|
|
|
|
IDPropertyTemplate val = {0};
|
|
|
|
|
ptr->data = IDP_New(IDP_GROUP, &val, "RNA_KeyConfigPreferences group");
|
|
|
|
|
}
|
|
|
|
|
return ptr->data;
|
2018-11-16 11:24:49 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_wmKeyConfigPref_unregister(Main *UNUSED(bmain), StructRNA *type)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyConfigPrefType_Runtime *kpt_rt = RNA_struct_blender_type_get(type);
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!kpt_rt) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_struct_free_extension(type, &kpt_rt->ext);
|
|
|
|
|
RNA_struct_free(&BLENDER_RNA, type);
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Possible we're not in the preferences if they have been reset. */
|
|
|
|
|
BKE_keyconfig_pref_type_remove(kpt_rt);
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* update while blender is running */
|
|
|
|
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
2018-11-16 11:24:49 +11:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
|
|
|
|
|
ReportList *reports,
|
|
|
|
|
void *data,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
StructValidateFunc validate,
|
|
|
|
|
StructCallbackFunc call,
|
|
|
|
|
StructFreeFunc free)
|
2018-11-16 11:24:49 +11:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
|
|
|
|
|
wmKeyConfigPref dummy_kpt = {NULL};
|
|
|
|
|
PointerRNA dummy_ptr;
|
|
|
|
|
// int have_function[1];
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* setup dummy keyconf-prefs & keyconf-prefs type to store static properties in */
|
|
|
|
|
RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_ptr);
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* validate the python class */
|
2019-06-04 00:21:57 +10:00
|
|
|
if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return NULL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
STRNCPY(dummy_kpt_rt.idname, dummy_kpt.idname);
|
|
|
|
|
if (strlen(identifier) >= sizeof(dummy_kpt_rt.idname)) {
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
RPT_ERROR,
|
|
|
|
|
"Registering key-config preferences class: '%s' is too long, maximum length is %d",
|
|
|
|
|
identifier,
|
|
|
|
|
(int)sizeof(dummy_kpt_rt.idname));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* check if we have registered this keyconf-prefs type before, and remove it */
|
|
|
|
|
kpt_rt = BKE_keyconfig_pref_type_find(dummy_kpt.idname, true);
|
|
|
|
|
if (kpt_rt && kpt_rt->ext.srna) {
|
|
|
|
|
rna_wmKeyConfigPref_unregister(bmain, kpt_rt->ext.srna);
|
|
|
|
|
}
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* create a new keyconf-prefs type */
|
|
|
|
|
kpt_rt = MEM_mallocN(sizeof(wmKeyConfigPrefType_Runtime), "keyconfigpreftype");
|
|
|
|
|
memcpy(kpt_rt, &dummy_kpt_rt, sizeof(dummy_kpt_rt));
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
BKE_keyconfig_pref_type_add(kpt_rt);
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
kpt_rt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_KeyConfigPreferences);
|
|
|
|
|
kpt_rt->ext.data = data;
|
|
|
|
|
kpt_rt->ext.call = call;
|
|
|
|
|
kpt_rt->ext.free = free;
|
|
|
|
|
RNA_struct_blender_type_set(kpt_rt->ext.srna, kpt_rt);
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
// kpt_rt->draw = (have_function[0]) ? header_draw : NULL;
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* update while blender is running */
|
|
|
|
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return kpt_rt->ext.srna;
|
2018-11-16 11:24:49 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* placeholder, doesn't do anything useful yet */
|
|
|
|
|
static StructRNA *rna_wmKeyConfigPref_refine(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
return (ptr->type) ? ptr->type : &RNA_KeyConfigPreferences;
|
2018-11-16 11:24:49 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
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
|
|
|
static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
WM_operator_py_idname(value, kmi->idname);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
char pyname[OP_MAX_TYPENAME];
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_operator_py_idname(pyname, kmi->idname);
|
|
|
|
|
return strlen(pyname);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
char idname[OP_MAX_TYPENAME];
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_operator_bl_idname(idname, value);
|
2009-12-02 04:12:16 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (!STREQ(idname, kmi->idname)) {
|
|
|
|
|
BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
|
2009-12-14 14:27:38 +00:00
|
|
|
|
2019-05-02 11:42:46 +10:00
|
|
|
WM_keymap_item_properties_reset(kmi, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
2009-12-16 10:13:26 +00:00
|
|
|
static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
2019-06-04 15:50:15 +02:00
|
|
|
strcpy(value, ot ? WM_operatortype_name(ot, kmi->ptr) : kmi->idname);
|
2009-12-16 10:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
2019-06-04 15:50:15 +02:00
|
|
|
return strlen(ot ? WM_operatortype_name(ot, kmi->ptr) : kmi->idname);
|
2009-12-16 10:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
|
2010-12-06 02:42:59 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
return kmi->id < 0;
|
2010-12-06 02:42:59 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_wmClipboard_get(PointerRNA *UNUSED(ptr), char *value)
|
2010-08-25 03:44:13 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
char *pbuf;
|
|
|
|
|
int pbuf_len;
|
2010-08-25 03:44:13 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
pbuf = WM_clipboard_text_get(false, &pbuf_len);
|
|
|
|
|
if (pbuf) {
|
|
|
|
|
memcpy(value, pbuf, pbuf_len + 1);
|
|
|
|
|
MEM_freeN(pbuf);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
value[0] = '\0';
|
|
|
|
|
}
|
2010-08-25 03:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static int rna_wmClipboard_length(PointerRNA *UNUSED(ptr))
|
2010-08-25 03:44:13 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
char *pbuf;
|
|
|
|
|
int pbuf_len;
|
2010-08-25 03:44:13 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
pbuf = WM_clipboard_text_get(false, &pbuf_len);
|
|
|
|
|
if (pbuf) {
|
|
|
|
|
MEM_freeN(pbuf);
|
|
|
|
|
}
|
2010-08-25 03:44:13 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return pbuf_len;
|
2010-08-25 03:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value)
|
2010-08-25 03:44:13 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_clipboard_text_set((void *)value, false);
|
2010-08-25 03:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
# ifdef WITH_PYTHON
|
2013-01-22 06:16:49 +00:00
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool rna_operator_poll_cb(bContext *C, wmOperatorType *ot)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
extern FunctionRNA rna_Operator_poll_func;
|
2011-10-19 22:40:03 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA ptr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
bool visible;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
|
|
|
|
|
func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_create(&list, &ptr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
ot->ext.call(C, &ptr, func, &list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_get_lookup(&list, "visible", &ret);
|
|
|
|
|
visible = *(bool *)ret;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_free(&list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return visible;
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
2017-06-09 07:13:35 +10:00
|
|
|
static int rna_operator_execute_cb(bContext *C, wmOperator *op)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
extern FunctionRNA rna_Operator_execute_func;
|
2011-10-19 22:40:03 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
int result;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
|
|
|
|
func = &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
|
|
|
|
result = *(int *)ret;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_free(&list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return result;
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
2010-09-17 09:27:31 +00:00
|
|
|
/* same as execute() but no return value */
|
2017-06-09 07:13:35 +10:00
|
|
|
static bool rna_operator_check_cb(bContext *C, wmOperator *op)
|
2010-09-17 09:27:31 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
extern FunctionRNA rna_Operator_check_func;
|
2011-10-19 22:40:03 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
bool result;
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
|
|
|
|
func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
|
|
|
|
result = (*(bool *)ret) != 0;
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_free(&list);
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return result;
|
2010-09-17 09:27:31 +00:00
|
|
|
}
|
|
|
|
|
|
2017-06-09 07:13:35 +10:00
|
|
|
static int rna_operator_invoke_cb(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
extern FunctionRNA rna_Operator_invoke_func;
|
2011-10-19 22:40:03 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
int result;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
|
|
|
|
func = &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "event", &event);
|
|
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
|
|
|
|
result = *(int *)ret;
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_free(&list);
|
2009-12-24 16:10:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return result;
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
2010-02-21 11:56:00 +00:00
|
|
|
/* same as invoke */
|
2017-06-09 07:13:35 +10:00
|
|
|
static int rna_operator_modal_cb(bContext *C, wmOperator *op, const wmEvent *event)
|
2010-02-21 11:56:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
extern FunctionRNA rna_Operator_modal_func;
|
2011-10-19 22:40:03 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
int result;
|
2010-02-21 11:56:00 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
|
|
|
|
func = &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
|
2010-02-21 11:56:00 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "event", &event);
|
|
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2010-02-21 11:56:00 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
|
|
|
|
result = *(int *)ret;
|
2010-02-21 11:56:00 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_free(&list);
|
2010-02-21 11:56:00 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
return result;
|
2010-02-21 11:56:00 +00:00
|
|
|
}
|
|
|
|
|
|
2017-06-09 07:13:35 +10:00
|
|
|
static void rna_operator_draw_cb(bContext *C, wmOperator *op)
|
2009-12-24 21:17:14 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
extern FunctionRNA rna_Operator_draw_func;
|
2011-10-19 22:40:03 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
2009-12-24 21:17:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
|
|
|
|
func = &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
|
2009-12-24 21:17:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2009-12-24 21:17:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_free(&list);
|
2009-12-24 21:17:14 +00:00
|
|
|
}
|
2009-12-24 19:50:43 +00:00
|
|
|
|
2011-03-17 07:02:02 +00:00
|
|
|
/* same as exec(), but call cancel */
|
2017-06-09 07:13:35 +10:00
|
|
|
static void rna_operator_cancel_cb(bContext *C, wmOperator *op)
|
2011-03-17 07:02:02 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
extern FunctionRNA rna_Operator_cancel_func;
|
2011-10-19 22:40:03 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
PointerRNA opr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
2011-03-17 07:02:02 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
|
|
|
|
func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
|
2011-03-17 07:02:02 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_create(&list, &opr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
op->type->ext.call(C, &opr, func, &list);
|
2011-03-17 07:02:02 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_parameter_list_free(&list);
|
2011-03-17 07:02:02 +00:00
|
|
|
}
|
|
|
|
|
|
2019-09-06 16:26:10 +03:00
|
|
|
static char *rna_operator_description_cb(bContext *C, wmOperatorType *ot, PointerRNA *prop_ptr)
|
|
|
|
|
{
|
|
|
|
|
extern FunctionRNA rna_Operator_description_func;
|
|
|
|
|
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
ParameterList list;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
void *ret;
|
|
|
|
|
char *result;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
|
|
|
|
|
func = &rna_Operator_description_func; /* RNA_struct_find_function(&ptr, "description"); */
|
|
|
|
|
|
|
|
|
|
RNA_parameter_list_create(&list, &ptr, func);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "context", &C);
|
|
|
|
|
RNA_parameter_set_lookup(&list, "properties", prop_ptr);
|
|
|
|
|
ot->ext.call(C, &ptr, func, &list);
|
|
|
|
|
|
|
|
|
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
|
|
|
|
result = (char *)ret;
|
|
|
|
|
|
|
|
|
|
if (result && result[0]) {
|
|
|
|
|
result = BLI_strdup(result);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RNA_parameter_list_free(&list);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-09 07:13:35 +10:00
|
|
|
static void rna_Operator_unregister(struct Main *bmain, StructRNA *type);
|
2009-12-24 19:50:43 +00:00
|
|
|
|
2017-06-09 07:13:35 +10:00
|
|
|
/* bpy_operator_wrap.c */
|
|
|
|
|
extern void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata);
|
|
|
|
|
extern void BPY_RNA_operator_macro_wrapper(wmOperatorType *ot, void *userdata);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static StructRNA *rna_Operator_register(Main *bmain,
|
|
|
|
|
ReportList *reports,
|
|
|
|
|
void *data,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
StructValidateFunc validate,
|
|
|
|
|
StructCallbackFunc call,
|
|
|
|
|
StructFreeFunc free)
|
|
|
|
|
{
|
|
|
|
|
wmOperatorType dummyot = {NULL};
|
|
|
|
|
wmOperator dummyop = {NULL};
|
|
|
|
|
PointerRNA dummyotr;
|
2019-09-06 16:26:10 +03:00
|
|
|
int have_function[8];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
char idname[OP_MAX_TYPENAME];
|
|
|
|
|
char name[OP_MAX_TYPENAME];
|
|
|
|
|
char description[RNA_DYN_DESCR_MAX];
|
|
|
|
|
char translation_context[RNA_DYN_DESCR_MAX];
|
|
|
|
|
char undo_group[OP_MAX_TYPENAME];
|
|
|
|
|
} temp_buffers;
|
|
|
|
|
|
|
|
|
|
/* setup dummy operator & operator type to store static properties in */
|
|
|
|
|
dummyop.type = &dummyot;
|
2019-07-02 22:17:22 +10:00
|
|
|
dummyot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */
|
|
|
|
|
dummyot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */
|
|
|
|
|
dummyot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */
|
2019-04-17 06:17:24 +02:00
|
|
|
dummyot.translation_context =
|
2019-07-02 22:17:22 +10:00
|
|
|
temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */
|
|
|
|
|
dummyot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr);
|
|
|
|
|
|
|
|
|
|
/* clear in case they are left unset */
|
|
|
|
|
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
|
|
|
|
|
temp_buffers.undo_group[0] = '\0';
|
|
|
|
|
/* We have to set default op context! */
|
|
|
|
|
strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
|
|
|
|
|
|
|
|
|
/* validate the python class */
|
2019-06-04 00:21:57 +10:00
|
|
|
if (validate(&dummyotr, data, have_function) != 0) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return NULL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
/* check if we have registered this operator type before, and remove it */
|
|
|
|
|
{
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ot && ot->ext.srna) {
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_Operator_unregister(bmain, ot->ext.srna);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char idname_conv[sizeof(dummyop.idname)];
|
|
|
|
|
WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
|
|
|
|
|
|
|
|
|
|
if (!RNA_struct_available_or_report(reports, idname_conv)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert foo.bar to FOO_OT_bar
|
|
|
|
|
* allocate all strings at once. */
|
|
|
|
|
{
|
|
|
|
|
const char *strings[] = {
|
|
|
|
|
idname_conv,
|
|
|
|
|
temp_buffers.name,
|
|
|
|
|
temp_buffers.description,
|
|
|
|
|
temp_buffers.translation_context,
|
|
|
|
|
temp_buffers.undo_group,
|
|
|
|
|
};
|
|
|
|
|
char *strings_table[ARRAY_SIZE(strings)];
|
|
|
|
|
BLI_string_join_array_by_sep_char_with_tableN(
|
|
|
|
|
'\0', strings_table, strings, ARRAY_SIZE(strings));
|
|
|
|
|
|
|
|
|
|
dummyot.idname = strings_table[0]; /* allocated string stored here */
|
|
|
|
|
dummyot.name = strings_table[1];
|
|
|
|
|
dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
|
|
|
|
|
dummyot.translation_context = strings_table[3];
|
|
|
|
|
dummyot.undo_group = strings_table[4];
|
|
|
|
|
BLI_assert(ARRAY_SIZE(strings) == 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* XXX, this doubles up with the operator name [#29666]
|
|
|
|
|
* for now just remove from dir(bpy.types) */
|
|
|
|
|
|
|
|
|
|
/* create a new operator type */
|
|
|
|
|
dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
|
2019-08-14 23:29:46 +10:00
|
|
|
|
|
|
|
|
/* Operator properties are registered separately. */
|
|
|
|
|
RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_struct_property_tags(dummyot.ext.srna, rna_enum_operator_property_tags);
|
|
|
|
|
RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
|
|
|
|
|
dummyot.ext.data = data;
|
|
|
|
|
dummyot.ext.call = call;
|
|
|
|
|
dummyot.ext.free = free;
|
|
|
|
|
|
|
|
|
|
dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
|
|
|
|
|
dummyot.exec = (have_function[1]) ? rna_operator_execute_cb : NULL;
|
|
|
|
|
dummyot.check = (have_function[2]) ? rna_operator_check_cb : NULL;
|
|
|
|
|
dummyot.invoke = (have_function[3]) ? rna_operator_invoke_cb : NULL;
|
|
|
|
|
dummyot.modal = (have_function[4]) ? rna_operator_modal_cb : NULL;
|
|
|
|
|
dummyot.ui = (have_function[5]) ? rna_operator_draw_cb : NULL;
|
|
|
|
|
dummyot.cancel = (have_function[6]) ? rna_operator_cancel_cb : NULL;
|
2019-09-06 16:26:10 +03:00
|
|
|
dummyot.get_description = (have_function[7]) ? rna_operator_description_cb : NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_operatortype_append_ptr(BPY_RNA_operator_wrapper, (void *)&dummyot);
|
|
|
|
|
|
|
|
|
|
/* update while blender is running */
|
|
|
|
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
|
|
|
|
|
|
|
|
|
return dummyot.ext.srna;
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
2017-06-09 07:13:35 +10:00
|
|
|
static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const char *idname;
|
|
|
|
|
wmOperatorType *ot = RNA_struct_blender_type_get(type);
|
|
|
|
|
wmWindowManager *wm;
|
2017-06-09 07:13:35 +10:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!ot) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2017-06-09 07:13:35 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* update while blender is running */
|
|
|
|
|
wm = bmain->wm.first;
|
|
|
|
|
if (wm) {
|
|
|
|
|
WM_operator_stack_clear(wm);
|
2017-06-09 07:13:35 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_operator_handlers_clear(wm, ot);
|
|
|
|
|
}
|
|
|
|
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
2017-06-09 07:13:35 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_struct_free_extension(type, &ot->ext);
|
2017-06-09 07:13:35 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
idname = ot->idname;
|
|
|
|
|
WM_operatortype_remove_ptr(ot);
|
2017-06-09 07:13:35 +10:00
|
|
|
|
2019-04-22 02:48:05 +10:00
|
|
|
/* Not to be confused with the RNA_struct_free that WM_operatortype_remove calls,
|
|
|
|
|
* they are 2 different srna's. */
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_struct_free(&BLENDER_RNA, type);
|
2017-08-11 19:09:03 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
MEM_freeN((void *)idname);
|
2017-06-09 07:13:35 +10:00
|
|
|
}
|
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
static void **rna_Operator_instance(PointerRNA *ptr)
|
2011-05-18 11:21:10 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = ptr->data;
|
|
|
|
|
return &op->py_instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static StructRNA *rna_MacroOperator_register(Main *bmain,
|
|
|
|
|
ReportList *reports,
|
|
|
|
|
void *data,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
StructValidateFunc validate,
|
|
|
|
|
StructCallbackFunc call,
|
|
|
|
|
StructFreeFunc free)
|
|
|
|
|
{
|
|
|
|
|
wmOperatorType dummyot = {NULL};
|
|
|
|
|
wmOperator dummyop = {NULL};
|
|
|
|
|
PointerRNA dummyotr;
|
|
|
|
|
int have_function[4];
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
char idname[OP_MAX_TYPENAME];
|
|
|
|
|
char name[OP_MAX_TYPENAME];
|
|
|
|
|
char description[RNA_DYN_DESCR_MAX];
|
|
|
|
|
char translation_context[RNA_DYN_DESCR_MAX];
|
|
|
|
|
char undo_group[OP_MAX_TYPENAME];
|
|
|
|
|
} temp_buffers;
|
|
|
|
|
|
|
|
|
|
/* setup dummy operator & operator type to store static properties in */
|
|
|
|
|
dummyop.type = &dummyot;
|
2019-07-02 22:17:22 +10:00
|
|
|
dummyot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */
|
|
|
|
|
dummyot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */
|
|
|
|
|
dummyot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */
|
2019-04-17 06:17:24 +02:00
|
|
|
dummyot.translation_context =
|
2019-07-02 22:17:22 +10:00
|
|
|
temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */
|
|
|
|
|
dummyot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr);
|
|
|
|
|
|
|
|
|
|
/* clear in case they are left unset */
|
|
|
|
|
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
|
|
|
|
|
temp_buffers.undo_group[0] = '\0';
|
|
|
|
|
/* We have to set default op context! */
|
|
|
|
|
strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
|
|
|
|
|
|
|
|
|
/* validate the python class */
|
2019-06-04 00:21:57 +10:00
|
|
|
if (validate(&dummyotr, data, have_function) != 0) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return NULL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
if (strlen(identifier) >= sizeof(dummyop.idname)) {
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
RPT_ERROR,
|
|
|
|
|
"Registering operator class: '%s' is too long, maximum length is %d",
|
|
|
|
|
identifier,
|
|
|
|
|
(int)sizeof(dummyop.idname));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check if we have registered this operator type before, and remove it */
|
|
|
|
|
{
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ot && ot->ext.srna) {
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_Operator_unregister(bmain, ot->ext.srna);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char idname_conv[sizeof(dummyop.idname)];
|
|
|
|
|
WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
|
|
|
|
|
|
|
|
|
|
if (!RNA_struct_available_or_report(reports, idname_conv)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert foo.bar to FOO_OT_bar
|
|
|
|
|
* allocate all strings at once. */
|
|
|
|
|
{
|
|
|
|
|
const char *strings[] = {
|
|
|
|
|
idname_conv,
|
|
|
|
|
temp_buffers.name,
|
|
|
|
|
temp_buffers.description,
|
|
|
|
|
temp_buffers.translation_context,
|
|
|
|
|
temp_buffers.undo_group,
|
|
|
|
|
};
|
|
|
|
|
char *strings_table[ARRAY_SIZE(strings)];
|
|
|
|
|
BLI_string_join_array_by_sep_char_with_tableN(
|
|
|
|
|
'\0', strings_table, strings, ARRAY_SIZE(strings));
|
|
|
|
|
|
|
|
|
|
dummyot.idname = strings_table[0]; /* allocated string stored here */
|
|
|
|
|
dummyot.name = strings_table[1];
|
|
|
|
|
dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
|
|
|
|
|
dummyot.translation_context = strings_table[3];
|
|
|
|
|
dummyot.undo_group = strings_table[4];
|
|
|
|
|
BLI_assert(ARRAY_SIZE(strings) == 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* XXX, this doubles up with the operator name [#29666]
|
|
|
|
|
* for now just remove from dir(bpy.types) */
|
|
|
|
|
|
|
|
|
|
/* create a new operator type */
|
|
|
|
|
dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
|
|
|
|
|
RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
|
|
|
|
|
dummyot.ext.data = data;
|
|
|
|
|
dummyot.ext.call = call;
|
|
|
|
|
dummyot.ext.free = free;
|
|
|
|
|
|
|
|
|
|
dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
|
|
|
|
|
dummyot.ui = (have_function[3]) ? rna_operator_draw_cb : NULL;
|
|
|
|
|
|
|
|
|
|
WM_operatortype_append_macro_ptr(BPY_RNA_operator_macro_wrapper, (void *)&dummyot);
|
|
|
|
|
|
|
|
|
|
/* update while blender is running */
|
|
|
|
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
|
|
|
|
|
|
|
|
|
return dummyot.ext.srna;
|
|
|
|
|
}
|
|
|
|
|
# endif /* WITH_PYTHON */
|
2009-12-30 22:14:32 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
static StructRNA *rna_Operator_refine(PointerRNA *opr)
|
2009-12-24 16:10:26 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = (wmOperator *)opr->data;
|
|
|
|
|
return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Operator;
|
2009-12-24 16:10:26 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
static StructRNA *rna_MacroOperator_refine(PointerRNA *opr)
|
2009-12-30 22:14:32 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *op = (wmOperator *)opr->data;
|
|
|
|
|
return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Macro;
|
2009-12-30 22:14:32 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-07 08:27:20 +00:00
|
|
|
/* just to work around 'const char *' warning and to ensure this is a python op */
|
|
|
|
|
static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
|
|
|
|
char *str = (char *)data->type->idname;
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!str[0]) {
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
assert(!"setting the bl_idname on a non-builtin operator");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2010-12-07 08:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
|
|
|
|
char *str = (char *)data->type->name;
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!str[0]) {
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
assert(!"setting the bl_label on a non-builtin operator");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2010-12-07 08:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-15 14:32:29 +00:00
|
|
|
static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
|
|
|
|
char *str = (char *)data->type->translation_context;
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!str[0]) {
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
assert(!"setting the bl_translation_context on a non-builtin operator");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2013-03-15 14:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-07 08:27:20 +00:00
|
|
|
static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
|
|
|
|
char *str = (char *)data->type->description;
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!str[0]) {
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
assert(!"setting the bl_description on a non-builtin operator");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2010-12-07 08:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
Implement grouped undo option for operators
This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group.
The main usage is for animation, so you can change frames to inspect the
poses, and revert the previous pose without having to roll back tons of
"change frame" operator, or even see the undo stack full.
This complements rB13ee9b8e
Design with help by Sergey Sharybin.
Reviewers: sergey, mont29
Reviewed By: mont29, sergey
Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker
Differential Revision: https://developer.blender.org/D2330
2016-11-15 11:50:11 +01:00
|
|
|
static void rna_Operator_bl_undo_group_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmOperator *data = (wmOperator *)(ptr->data);
|
|
|
|
|
char *str = (char *)data->type->undo_group;
|
2019-06-04 00:21:57 +10:00
|
|
|
if (!str[0]) {
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-17 06:17:24 +02:00
|
|
|
assert(!"setting the bl_undo_group on a non-builtin operator");
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
Implement grouped undo option for operators
This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group.
The main usage is for animation, so you can change frames to inspect the
poses, and revert the previous pose without having to roll back tons of
"change frame" operator, or even see the undo stack full.
This complements rB13ee9b8e
Design with help by Sergey Sharybin.
Reviewers: sergey, mont29
Reviewed By: mont29, sergey
Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker
Differential Revision: https://developer.blender.org/D2330
2016-11-15 11:50:11 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-26 21:30:08 +00:00
|
|
|
static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMapItem *kmi = ptr->data;
|
|
|
|
|
WM_keyconfig_update_tag(NULL, kmi);
|
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
2010-08-02 16:27:41 +00:00
|
|
|
#else /* RNA_RUNTIME */
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2015-04-27 18:45:48 +10:00
|
|
|
/**
|
2019-04-22 02:48:05 +10:00
|
|
|
* expose ``Operator.options`` as its own type so we can control each flags use
|
|
|
|
|
* (some are read-only).
|
2015-04-27 18:45:48 +10:00
|
|
|
*/
|
|
|
|
|
static void rna_def_operator_options_runtime(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2015-04-27 18:45:48 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "OperatorOptions", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Operator Options", "Runtime options");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmOperator");
|
2015-04-27 18:45:48 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "is_grab_cursor", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_GRAB_CURSOR);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Grab Cursor", "True when the cursor is grabbed");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2015-04-27 18:45:48 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "is_invoke", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_INVOKE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Invoke", "True when invoked (even if only the execute callbacks available)");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2015-04-27 18:53:45 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "is_repeat", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_REPEAT);
|
2019-06-24 21:41:17 +10:00
|
|
|
RNA_def_property_ui_text(prop, "Repeat", "True when run from the 'Adjust Last Operation' panel");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_repeat_last", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_REPEAT_LAST);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Repeat Call", "True when run from the operator 'Repeat Last'");
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2015-04-27 18:53:45 +10:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "use_cursor_region", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_CURSOR_REGION);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Focus Region", "Enable to use the region under the cursor for modal execution");
|
2015-04-27 18:45:48 +10:00
|
|
|
}
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
static void rna_def_operator(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "Operator", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Operator", "Storage of an operator being executed, or registered after execution");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmOperator");
|
|
|
|
|
RNA_def_struct_refine_func(srna, "rna_Operator_refine");
|
|
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
RNA_def_struct_register_funcs(
|
|
|
|
|
srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance");
|
|
|
|
|
# endif
|
|
|
|
|
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
|
|
|
|
RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Has Reports",
|
|
|
|
|
"Operator has a set of reports (warnings and errors) from last execution");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "UILayout");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "options", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorOptions");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Operator_options_get", NULL, NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Options", "Runtime options");
|
|
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->idname");
|
|
|
|
|
/* else it uses the pointer size!. -3 because '.' -> '_OT_' */
|
|
|
|
|
RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME - 3);
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->name");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
|
|
|
|
|
RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->description");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type->flag");
|
|
|
|
|
RNA_def_property_enum_items(prop, operator_flag_items);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "macros", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "macro", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Macro");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Macros", "");
|
|
|
|
|
|
|
|
|
|
RNA_api_operator(srna);
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "OperatorProperties", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
|
|
|
|
|
RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
|
|
|
|
|
RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
|
|
|
|
|
RNA_def_struct_property_tags(srna, rna_enum_operator_property_tags);
|
|
|
|
|
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
|
2019-05-13 12:36:39 +03:00
|
|
|
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-05 19:27:26 +00:00
|
|
|
static void rna_def_macro_operator(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "Macro", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna,
|
|
|
|
|
"Macro Operator",
|
|
|
|
|
"Storage of a macro operator being executed, or registered after execution");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmOperator");
|
|
|
|
|
RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine");
|
|
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
RNA_def_struct_register_funcs(
|
|
|
|
|
srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance");
|
|
|
|
|
# endif
|
|
|
|
|
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
|
|
|
|
RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->idname");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->name");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
|
|
|
|
|
RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->description");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
|
|
|
|
|
RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
|
|
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set");
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type->flag");
|
|
|
|
|
RNA_def_property_enum_items(prop, operator_flag_items);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
|
|
|
|
|
|
|
|
|
|
RNA_api_macro(srna);
|
2009-12-05 19:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_operator_type_macro(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2009-12-05 19:27:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "OperatorMacro", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmOperatorTypeMacro");
|
2009-12-05 19:27:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); */
|
|
|
|
|
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
|
|
|
|
|
/* RNA_def_property_string_sdna(prop, NULL, "idname"); */
|
|
|
|
|
/* RNA_def_property_ui_text(prop, "Name", "Name of the sub operator"); */
|
|
|
|
|
/* RNA_def_struct_name_property(srna, prop); */
|
2009-12-05 19:27:26 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_OperatorMacro_properties_get", NULL, NULL, NULL);
|
2009-12-05 19:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
static void rna_def_operator_utils(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Operator Mouse Path", "Mouse path values for operators that record such paths");
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_IDPROPERTY);
|
|
|
|
|
RNA_def_property_array(prop, 2);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Location", "Mouse location");
|
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_IDPROPERTY);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Time", "Time of mouse location");
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2009-06-05 16:11:35 +00:00
|
|
|
static void rna_def_operator_filelist_element(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2011-04-13 02:47:52 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Operator File List Element", "");
|
2011-04-13 02:47:52 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_IDPROPERTY);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of a file or directory within a file list");
|
2009-06-05 16:11:35 +00:00
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-06-21 14:30:59 +00:00
|
|
|
static void rna_def_event(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "Event", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmEvent");
|
|
|
|
|
|
|
|
|
|
RNA_define_verify_sdna(0); /* not in sdna */
|
|
|
|
|
|
|
|
|
|
/* strings */
|
|
|
|
|
prop = RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "unicode", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Event_unicode_get", "rna_Event_unicode_length", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Unicode", "Single unicode character for this event");
|
|
|
|
|
|
|
|
|
|
/* enums */
|
|
|
|
|
prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "val");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_value_items);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_type_items);
|
|
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Type", "");
|
|
|
|
|
|
|
|
|
|
/* mouse */
|
|
|
|
|
prop = RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "x");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mouse X Position", "The window relative horizontal location of the mouse");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "y");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mouse Y Position", "The window relative vertical location of the mouse");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "mval[0]");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mouse X Position", "The region relative horizontal location of the mouse");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "mval[1]");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mouse Y Position", "The region relative vertical location of the mouse");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "prevx");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mouse Previous X Position", "The window relative horizontal location of the mouse");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "prevy");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_Event_pressure_get", NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_XYZ_LENGTH);
|
|
|
|
|
RNA_def_property_array(prop, 2);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_Event_tilt_get", NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Tablet Tilt", "The pressure of the tablet or zeroes if no tablet present");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_tablet", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Event_is_tablet_get", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Is Tablet", "The event has tablet data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_mouse_absolute", PROP_BOOLEAN, PROP_NONE);
|
2020-01-10 16:54:17 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "tablet.is_motion_absolute", 1);
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Absolute Motion", "The last motion event was an absolute input");
|
|
|
|
|
|
|
|
|
|
/* modifiers */
|
|
|
|
|
prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "shift", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Shift", "True when the Shift key is held");
|
2019-05-13 17:57:13 +02:00
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_WINDOWMANAGER);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Ctrl", "True when the Ctrl key is held");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "alt", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Alt", "True when the Alt/Option key is held");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held");
|
|
|
|
|
|
|
|
|
|
RNA_define_verify_sdna(1); /* not in sdna */
|
2009-06-21 14:30:59 +00:00
|
|
|
}
|
2009-06-05 16:11:35 +00:00
|
|
|
|
2011-03-28 04:55:24 +00:00
|
|
|
static void rna_def_timer(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2011-03-28 04:55:24 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "Timer", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Timer", "Window event timer");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmTimer");
|
2011-03-28 04:55:24 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_define_verify_sdna(0); /* not in sdna */
|
2011-03-28 04:55:24 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* could wrap more, for now this is enough */
|
|
|
|
|
prop = RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "timestep");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Time Step", "");
|
2011-03-28 04:55:24 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "delta");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
|
2011-03-28 04:55:24 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "duration");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
|
2011-03-28 04:55:24 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_define_verify_sdna(1); /* not in sdna */
|
2011-03-28 04:55:24 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void rna_def_popup_menu_wrapper(BlenderRNA *brna,
|
|
|
|
|
const char *rna_type,
|
|
|
|
|
const char *c_type,
|
|
|
|
|
const char *layout_get_fn)
|
2013-06-01 04:06:38 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2013-06-01 04:06:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, rna_type, NULL);
|
|
|
|
|
/* UI name isn't visible, name same as type. */
|
|
|
|
|
RNA_def_struct_ui_text(srna, rna_type, "");
|
|
|
|
|
RNA_def_struct_sdna(srna, c_type);
|
2013-06-01 04:06:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_define_verify_sdna(0); /* not in sdna */
|
2013-06-01 04:06:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* could wrap more, for now this is enough */
|
|
|
|
|
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "UILayout");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, layout_get_fn, NULL, NULL, NULL);
|
2013-06-01 04:06:38 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_define_verify_sdna(1); /* not in sdna */
|
2013-06-01 04:06:38 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-22 10:49:45 +02:00
|
|
|
static void rna_def_popupmenu(BlenderRNA *brna)
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_def_popup_menu_wrapper(brna, "UIPopupMenu", "uiPopupMenu", "rna_PopupMenu_layout_get");
|
2018-04-22 10:49:45 +02:00
|
|
|
}
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
|
2018-04-22 17:16:39 +02:00
|
|
|
static void rna_def_popovermenu(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_def_popup_menu_wrapper(brna, "UIPopover", "uiPopover", "rna_PopoverMenu_layout_get");
|
2018-04-22 17:16:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-04-22 10:49:45 +02:00
|
|
|
static void rna_def_piemenu(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_def_popup_menu_wrapper(brna, "UIPieMenu", "uiPieMenu", "rna_PieMenu_layout_get");
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
static void rna_def_window_stereo3d(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "Stereo3dDisplay", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "Stereo3dFormat");
|
|
|
|
|
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Stereo 3D Display", "Settings for stereo 3D display");
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_stereo3d_display_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Display Mode", "");
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_stereo3d_anaglyph_type_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Anaglyph Type", "");
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_stereo3d_interlace_type_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Interlace Type", "");
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa");
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
|
2009-06-30 19:10:14 +00:00
|
|
|
static void rna_def_window(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "Window", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Window", "Open window");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmWindow");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Parent Window", "Active workspace and scene follow this window");
|
|
|
|
|
|
|
|
|
|
rna_def_window_stereo3d(brna);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_scene_set", NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the window");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Window_scene_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "workspace", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "WorkSpace");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Workspace", "Active workspace showing in the window");
|
|
|
|
|
RNA_def_property_pointer_funcs(
|
|
|
|
|
prop, "rna_Window_workspace_get", "rna_Window_workspace_set", NULL, NULL);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Window_workspace_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Screen");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Screen", "Active workspace screen showing in the window");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
"rna_Window_screen_get",
|
|
|
|
|
"rna_Window_screen_set",
|
|
|
|
|
NULL,
|
|
|
|
|
"rna_Window_screen_assign_poll");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL | PROP_EDITABLE | PROP_CONTEXT_UPDATE);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_workspace_screen_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ViewLayer");
|
|
|
|
|
RNA_def_property_pointer_funcs(
|
|
|
|
|
prop, "rna_Window_view_layer_get", "rna_Window_view_layer_set", NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Active View Layer", "The active workspace view layer showing in the window");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "posx");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "X Position", "Horizontal location of the window");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "posy");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Y Position", "Vertical location of the window");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "sizex");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Width", "Window width");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "sizey");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Height", "Window height");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "stereo_3d_display", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Stereo3dDisplay");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Stereo 3D Display", "Settings for stereo 3d display");
|
|
|
|
|
|
|
|
|
|
RNA_api_window(srna);
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2010-08-23 22:16:45 +00:00
|
|
|
/* curve.splines */
|
|
|
|
|
static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "KeyConfigurations");
|
|
|
|
|
srna = RNA_def_struct(brna, "KeyConfigurations", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmWindowManager");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
"rna_WindowManager_active_keyconfig_get",
|
|
|
|
|
"rna_WindowManager_active_keyconfig_set",
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "addonconf");
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Add-on Key Configuration",
|
|
|
|
|
"Key configuration that can be extended by add-ons, and is added to the active "
|
|
|
|
|
"configuration when handling events");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "userconf");
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"User Key Configuration",
|
|
|
|
|
"Final key configuration that combines keymaps from the active and add-on configurations, "
|
|
|
|
|
"and can be edited by the user");
|
|
|
|
|
|
|
|
|
|
RNA_api_keyconfigs(srna);
|
2010-08-23 22:16:45 +00:00
|
|
|
}
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
static void rna_def_windowmanager(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "WindowManager", "ID");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna,
|
|
|
|
|
"Window Manager",
|
|
|
|
|
"Window manager data-block defining open windows and other user interface data");
|
|
|
|
|
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmWindowManager");
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Operator");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Operators", "Operator registry");
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Window");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Windows", "Open windows");
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfig");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
|
|
|
|
|
rna_def_wm_keyconfigs(brna, prop);
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
prop = RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_funcs(
|
|
|
|
|
prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Text Clipboard", "");
|
2010-08-25 03:44:13 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_api_wm(srna);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2010-04-03 22:09:44 +00:00
|
|
|
/* keyconfig.items */
|
|
|
|
|
static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_property_srna(cprop, "KeyMapItems");
|
|
|
|
|
srna = RNA_def_struct(brna, "KeyMapItems", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmKeyMap");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
|
2010-04-03 22:09:44 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_api_keymapitems(srna);
|
2010-08-30 13:50:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
2010-08-30 13:50:59 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_property_srna(cprop, "KeyMaps");
|
|
|
|
|
srna = RNA_def_struct(brna, "KeyMaps", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmKeyConfig");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
|
2010-08-30 13:50:59 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_api_keymaps(srna);
|
2010-04-03 22:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
2018-11-16 11:24:49 +11:00
|
|
|
static void rna_def_keyconfig_prefs(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
srna = RNA_def_struct(brna, "KeyConfigPreferences", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Key-Config Preferences", "");
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmKeyConfigPref"); /* WARNING: only a bAddon during registration */
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_struct_refine_func(srna, "rna_wmKeyConfigPref_refine");
|
|
|
|
|
RNA_def_struct_register_funcs(
|
|
|
|
|
srna, "rna_wmKeyConfigPref_register", "rna_wmKeyConfigPref_unregister", NULL);
|
|
|
|
|
RNA_def_struct_idprops_func(srna, "rna_wmKeyConfigPref_idprops");
|
|
|
|
|
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); /* Mandatory! */
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* registration */
|
|
|
|
|
RNA_define_verify_sdna(0);
|
|
|
|
|
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "idname");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_REGISTER);
|
|
|
|
|
RNA_define_verify_sdna(1);
|
2018-11-16 11:24:49 +11:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static void rna_def_keyconfig(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem map_type_items[] = {
|
|
|
|
|
{KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
|
|
|
|
|
{KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
|
|
|
|
|
{KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
|
|
|
|
|
{KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""},
|
|
|
|
|
{KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
|
|
|
|
|
{KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* KeyConfig */
|
|
|
|
|
srna = RNA_def_struct(brna, "KeyConfig", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmKeyConfig");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "idname");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of the key configuration");
|
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyMap");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
|
|
|
|
|
rna_def_wm_keymaps(brna, prop);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "User Defined", "Indicates that a keyconfig was defined by the user");
|
|
|
|
|
|
|
|
|
|
/* Collection active property */
|
|
|
|
|
prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyConfigPreferences");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_wmKeyConfig_preferences_get", NULL, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
RNA_api_keyconfig(srna);
|
|
|
|
|
|
|
|
|
|
/* KeyMap */
|
|
|
|
|
srna = RNA_def_struct(brna, "KeyMap", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmKeyMap");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "idname");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of the key map");
|
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "owner_id");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Owner", "Internal owner");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "spaceid");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_space_type_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "regionid");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_region_type_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "items", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "KeyMapItem");
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Items", "Items in the keymap, linking an operator to an input event");
|
|
|
|
|
rna_def_keymap_items(brna, prop);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER_MODIFIED);
|
|
|
|
|
RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Modal Keymap",
|
|
|
|
|
"Indicates that a keymap is used for translate modal events for an operator");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Items Expanded", "Expanded in the user interface");
|
|
|
|
|
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_CHILDREN_EXPANDED);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in the user interface");
|
|
|
|
|
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
|
|
|
|
|
|
|
|
|
RNA_api_keymap(srna);
|
|
|
|
|
|
|
|
|
|
/* KeyMapItem */
|
|
|
|
|
srna = RNA_def_struct(brna, "KeyMapItem", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "wmKeyMapItem");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "idname");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event");
|
|
|
|
|
RNA_def_property_string_funcs(prop,
|
|
|
|
|
"rna_wmKeyMapItem_idname_get",
|
|
|
|
|
"rna_wmKeyMapItem_idname_length",
|
|
|
|
|
"rna_wmKeyMapItem_idname_set");
|
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
/* this is in fact the operator name, but if the operator can't be found we
|
|
|
|
|
* fallback on the operator ID */
|
|
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of operator (translated) to call on input event");
|
|
|
|
|
RNA_def_property_string_funcs(
|
|
|
|
|
prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "OperatorProperties");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "maptype");
|
|
|
|
|
RNA_def_property_enum_items(prop, map_type_items);
|
|
|
|
|
RNA_def_property_enum_funcs(
|
|
|
|
|
prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_type_items);
|
|
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Type", "Type of event");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "val");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_value_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Value", "");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "id");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "ID", "ID of the item");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_get", "rna_KeyMapItem_any_set");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_shift_get", NULL);
|
|
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "shift"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
|
|
|
|
RNA_def_property_ui_text(prop, "Shift", "Shift key pressed");
|
2019-05-13 17:57:13 +02:00
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_WINDOWMANAGER);
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_ctrl_get", NULL);
|
|
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
|
|
|
|
RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_alt_get", NULL);
|
|
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "alt"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
|
|
|
|
RNA_def_property_ui_text(prop, "Alt", "Alt key pressed");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_oskey_get", NULL);
|
|
|
|
|
/* RNA_def_property_enum_sdna(prop, NULL, "oskey"); */
|
|
|
|
|
/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
|
|
|
|
|
RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_event_type_items);
|
|
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, "rna_wmKeyMapItem_keymodifier_set", NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Expanded", "Show key map event and property details in the user interface");
|
|
|
|
|
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "propvalue");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_keymap_propvalue_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Property Value", "The value this event translates to in a modal keymap");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item");
|
|
|
|
|
RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"User Defined",
|
|
|
|
|
"Is this keymap item user defined (doesn't just replace a builtin item)");
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL);
|
|
|
|
|
|
|
|
|
|
RNA_api_keymapitem(srna);
|
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
|
|
|
}
|
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
void RNA_def_wm(BlenderRNA *brna)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
rna_def_operator(brna);
|
|
|
|
|
rna_def_operator_options_runtime(brna);
|
|
|
|
|
rna_def_operator_utils(brna);
|
|
|
|
|
rna_def_operator_filelist_element(brna);
|
|
|
|
|
rna_def_macro_operator(brna);
|
|
|
|
|
rna_def_operator_type_macro(brna);
|
|
|
|
|
rna_def_event(brna);
|
|
|
|
|
rna_def_timer(brna);
|
|
|
|
|
rna_def_popupmenu(brna);
|
|
|
|
|
rna_def_popovermenu(brna);
|
|
|
|
|
rna_def_piemenu(brna);
|
|
|
|
|
rna_def_window(brna);
|
|
|
|
|
rna_def_windowmanager(brna);
|
|
|
|
|
rna_def_keyconfig_prefs(brna);
|
|
|
|
|
rna_def_keyconfig(brna);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
2010-08-02 16:27:41 +00:00
|
|
|
#endif /* RNA_RUNTIME */
|