2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-11-29 01:04:15 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-29 01:04:15 +00:00
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation (2008), Nathan Letwory
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_screen.c
|
|
|
|
|
* \ingroup RNA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2008-11-29 01:04:15 +00:00
|
|
|
#include <stdlib.h>
|
2010-01-01 20:50:58 +00:00
|
|
|
#include <stddef.h>
|
2008-11-29 01:04:15 +00:00
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
2009-10-13 17:50:14 +00:00
|
|
|
#include "RNA_enum_types.h"
|
2008-11-29 01:04:15 +00:00
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
|
2009-04-01 12:43:07 +00:00
|
|
|
EnumPropertyItem region_type_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""},
|
|
|
|
|
{RGN_TYPE_HEADER, "HEADER", 0, "Header", ""},
|
|
|
|
|
{RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""},
|
|
|
|
|
{RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""},
|
|
|
|
|
{RGN_TYPE_UI, "UI", 0, "UI", ""},
|
2010-01-01 20:50:58 +00:00
|
|
|
{RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""},
|
|
|
|
|
{RGN_TYPE_TOOL_PROPS, "TOOL_PROPS", 0, "Tool Properties", ""},
|
2009-12-15 17:53:17 +00:00
|
|
|
{RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2009-04-01 12:43:07 +00:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
#include "ED_screen.h"
|
|
|
|
|
|
2009-06-30 19:10:14 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2011-02-01 23:41:01 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2012-01-06 17:32:20 +00:00
|
|
|
#include "BKE_global.h"
|
2014-01-23 19:27:59 +06:00
|
|
|
#include "BKE_depsgraph.h"
|
2011-02-01 23:41:01 +00:00
|
|
|
|
2012-08-08 16:44:16 +00:00
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
2014-02-17 12:33:00 +06:00
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
|
# include "BPY_extern.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-06-30 19:10:14 +00:00
|
|
|
static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bScreen *sc = (bScreen *)ptr->data;
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (value.data == NULL)
|
2009-06-30 19:10:14 +00:00
|
|
|
return;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
sc->newscene = value.data;
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
2011-09-06 17:18:50 +00:00
|
|
|
static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr)
|
2009-06-30 19:10:14 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bScreen *sc = (bScreen *)ptr->data;
|
2009-06-30 19:10:14 +00:00
|
|
|
|
2012-01-06 17:32:20 +00:00
|
|
|
/* exception: must use context so notifier gets to the right window */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (sc->newscene) {
|
2014-02-17 12:33:00 +06:00
|
|
|
#ifdef WITH_PYTHON
|
2014-02-17 19:29:37 +11:00
|
|
|
BPy_BEGIN_ALLOW_THREADS;
|
2014-02-17 12:33:00 +06:00
|
|
|
#endif
|
|
|
|
|
|
2012-03-07 16:43:42 +00:00
|
|
|
ED_screen_set_scene(C, sc, sc->newscene);
|
2014-02-17 12:33:00 +06:00
|
|
|
|
|
|
|
|
#ifdef WITH_PYTHON
|
2014-02-17 19:29:37 +11:00
|
|
|
BPy_END_ALLOW_THREADS;
|
2014-02-17 12:33:00 +06:00
|
|
|
#endif
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, sc->newscene);
|
2012-01-06 17:32:20 +00:00
|
|
|
|
2012-03-31 00:59:17 +00:00
|
|
|
if (G.debug & G_DEBUG)
|
2012-01-06 17:32:20 +00:00
|
|
|
printf("scene set %p\n", sc->newscene);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
sc->newscene = NULL;
|
2009-06-30 19:10:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-08 03:25:53 +00:00
|
|
|
static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2011-02-01 23:41:01 +00:00
|
|
|
{
|
2012-03-08 03:25:53 +00:00
|
|
|
bScreen *screen = (bScreen *)ptr->data;
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2011-02-01 23:41:01 +00:00
|
|
|
/* the settings for this are currently only available from a menu in the TimeLine, hence refresh=SPACE_TIME */
|
|
|
|
|
ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_TIME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static int rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr))
|
2009-08-16 15:34:30 +00:00
|
|
|
{
|
2014-11-17 20:07:25 +01:00
|
|
|
/* can be NULL on file load, T42619 */
|
|
|
|
|
wmWindowManager *wm = G.main->wm.first;
|
|
|
|
|
return wm ? (ED_screen_animation_playing(wm) != NULL) : 0;
|
2009-08-16 15:34:30 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-08 07:12:06 +00:00
|
|
|
static int rna_Screen_fullscreen_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bScreen *sc = (bScreen *)ptr->data;
|
2014-10-14 15:05:44 -03:00
|
|
|
return (sc->state == SCREENMAXIMIZED);
|
2009-12-08 07:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
2013-06-10 11:08:37 +00:00
|
|
|
/* UI compatible list: should not be needed, but for now we need to keep EMPTY
|
|
|
|
|
* at least in the static version of this enum for python scripts. */
|
2013-06-10 10:37:24 +00:00
|
|
|
static EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
|
2014-01-04 18:08:43 +11:00
|
|
|
PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
|
2013-06-10 10:37:24 +00:00
|
|
|
{
|
2013-06-10 11:08:37 +00:00
|
|
|
/* +1 to skip SPACE_EMPTY */
|
|
|
|
|
return space_type_items + 1;
|
2013-06-10 10:37:24 +00:00
|
|
|
}
|
|
|
|
|
|
2014-08-15 08:43:00 +10:00
|
|
|
static int rna_Area_type_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
ScrArea *sa = (ScrArea *)ptr->data;
|
|
|
|
|
/* read from this instead of 'spacetype' for correct reporting: T41435 */
|
|
|
|
|
return sa->butspacetype;
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-13 17:50:14 +00:00
|
|
|
static void rna_Area_type_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
ScrArea *sa = (ScrArea *)ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
sa->butspacetype = value;
|
2009-10-13 17:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
|
|
|
|
|
{
|
2012-05-02 13:09:26 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
wmWindow *win;
|
2012-05-12 11:01:29 +00:00
|
|
|
bScreen *sc = (bScreen *)ptr->id.data;
|
|
|
|
|
ScrArea *sa = (ScrArea *)ptr->data;
|
2009-10-13 17:50:14 +00:00
|
|
|
|
2012-05-02 13:09:26 +00:00
|
|
|
/* XXX this call still use context, so we trick it to work in the right context */
|
2012-05-12 11:01:29 +00:00
|
|
|
for (win = wm->windows.first; win; win = win->next) {
|
|
|
|
|
if (sc == win->screen) {
|
2012-05-02 13:09:26 +00:00
|
|
|
wmWindow *prevwin = CTX_wm_window(C);
|
|
|
|
|
ScrArea *prevsa = CTX_wm_area(C);
|
|
|
|
|
ARegion *prevar = CTX_wm_region(C);
|
|
|
|
|
|
|
|
|
|
CTX_wm_window_set(C, win);
|
|
|
|
|
CTX_wm_area_set(C, sa);
|
|
|
|
|
CTX_wm_region_set(C, NULL);
|
|
|
|
|
|
|
|
|
|
ED_area_newspace(C, sa, sa->butspacetype);
|
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
|
|
2014-01-23 19:27:59 +06:00
|
|
|
/* It is possible that new layers becomes visible. */
|
|
|
|
|
if (sa->spacetype == SPACE_VIEW3D) {
|
2014-04-01 11:34:00 +11:00
|
|
|
DAG_on_visible_update(CTX_data_main(C), false);
|
2014-01-23 19:27:59 +06:00
|
|
|
}
|
|
|
|
|
|
2012-05-02 13:09:26 +00:00
|
|
|
CTX_wm_window_set(C, prevwin);
|
|
|
|
|
CTX_wm_area_set(C, prevsa);
|
|
|
|
|
CTX_wm_region_set(C, prevar);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-13 17:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2])
|
2012-08-08 16:44:16 +00:00
|
|
|
{
|
|
|
|
|
UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, int clip, int result[2])
|
2012-08-08 16:44:16 +00:00
|
|
|
{
|
|
|
|
|
if (clip)
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]);
|
2012-08-08 16:44:16 +00:00
|
|
|
else
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region(v2d, x, y, &result[0], &result[1]);
|
2012-08-08 16:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-29 01:04:15 +00:00
|
|
|
#else
|
|
|
|
|
|
2011-05-19 15:18:40 +00:00
|
|
|
/* Area.spaces */
|
|
|
|
|
static void rna_def_area_spaces(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "AreaSpaces");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "AreaSpaces", NULL);
|
2011-05-19 15:18:40 +00:00
|
|
|
RNA_def_struct_sdna(srna, "ScrArea");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Area Spaces", "Collection of spaces");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
2011-05-19 15:18:40 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
|
|
|
|
|
RNA_def_property_struct_type(prop, "Space");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area");
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-16 15:34:30 +00:00
|
|
|
static void rna_def_area(BlenderRNA *brna)
|
2008-11-29 13:57:19 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
2009-01-15 04:22:23 +00:00
|
|
|
PropertyRNA *prop;
|
2010-10-02 21:02:40 +00:00
|
|
|
FunctionRNA *func;
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Area", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
|
2008-11-29 13:57:19 +00:00
|
|
|
RNA_def_struct_sdna(srna, "ScrArea");
|
2009-01-15 04:22:23 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
|
2009-01-15 04:22:23 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Space");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Spaces",
|
2011-09-30 08:10:53 +00:00
|
|
|
"Spaces contained in this area, the first being the active space "
|
|
|
|
|
"(NOTE: Useful for example to restore a previously used 3D view space "
|
|
|
|
|
"in a certain area to get the old view orientation)");
|
2011-05-19 15:18:40 +00:00
|
|
|
rna_def_area_spaces(brna, prop);
|
2009-01-15 04:22:23 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
|
2009-01-15 04:22:23 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Region");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Regions", "Regions this area is subdivided in");
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", HEADER_NO_PULLDOWN);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
2009-10-13 17:50:14 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "spacetype");
|
|
|
|
|
RNA_def_property_enum_items(prop, space_type_items);
|
2013-09-29 13:25:42 +00:00
|
|
|
RNA_def_property_enum_default(prop, SPACE_VIEW3D);
|
2014-08-15 08:43:00 +10:00
|
|
|
RNA_def_property_enum_funcs(prop, "rna_Area_type_get", "rna_Area_type_set", "rna_Area_type_itemf");
|
2013-06-09 16:18:23 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
|
2009-12-08 17:23:48 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
|
2013-06-09 16:18:23 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2009-10-13 17:50:14 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Area_type_update");
|
|
|
|
|
|
2012-06-18 12:48:51 +00:00
|
|
|
prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "totrct.xmin");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the area");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "totrct.ymin");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the area");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
|
2011-03-29 05:49:34 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "winx");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Width", "Area width");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
|
2011-03-29 05:49:34 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "winy");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Height", "Area height");
|
|
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
|
2010-10-02 21:02:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
|
2010-10-02 21:02:40 +00:00
|
|
|
RNA_def_function_ui_description(func, "Set the header text");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
|
2008-11-29 13:57:19 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 16:44:16 +00:00
|
|
|
static void rna_def_view2d_api(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
static const float view_default[2] = {0.0f, 0.0f};
|
|
|
|
|
static const int region_default[2] = {0.0f, 0.0f};
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view");
|
|
|
|
|
RNA_def_function_ui_description(func, "Transform region coordinates to 2D view");
|
|
|
|
|
parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm = RNA_def_float_array(func, "result", 2, view_default, -FLT_MAX, FLT_MAX, "Result", "View coordinates", -10000.0f, 10000.0f);
|
|
|
|
|
RNA_def_property_flag(parm, PROP_THICK_WRAP);
|
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "view_to_region", "rna_View2D_view_to_region");
|
|
|
|
|
RNA_def_function_ui_description(func, "Transform 2D view coordinates to region");
|
|
|
|
|
parm = RNA_def_float(func, "x", 0.0f, -FLT_MAX, FLT_MAX, "x", "2D View x coordinate", -10000.0f, 10000.0f);
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
parm = RNA_def_float(func, "y", 0.0f, -FLT_MAX, FLT_MAX, "y", "2D View y coordinate", -10000.0f, 10000.0f);
|
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
RNA_def_boolean(func, "clip", 1, "Clip", "Clip coordinates to the visible region");
|
|
|
|
|
parm = RNA_def_int_array(func, "result", 2, region_default, INT_MIN, INT_MAX, "Result", "Region coordinates", -10000, 10000);
|
|
|
|
|
RNA_def_property_flag(parm, PROP_THICK_WRAP);
|
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_view2d(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
/* PropertyRNA *prop; */
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "View2D", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "View2D", "Scroll and zoom for a 2D region");
|
|
|
|
|
RNA_def_struct_sdna(srna, "View2D");
|
|
|
|
|
|
|
|
|
|
/* TODO more View2D properties could be exposed here (read-only) */
|
|
|
|
|
|
|
|
|
|
rna_def_view2d_api(srna);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-15 04:22:23 +00:00
|
|
|
static void rna_def_region(BlenderRNA *brna)
|
2008-11-29 13:57:19 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
2009-07-16 00:50:27 +00:00
|
|
|
PropertyRNA *prop;
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Region", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area");
|
2008-11-29 13:57:19 +00:00
|
|
|
RNA_def_struct_sdna(srna, "ARegion");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
|
2009-07-16 00:50:27 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "swinid");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Region ID", "Unique ID for this region");
|
2009-12-19 21:33:25 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
2010-01-01 20:50:58 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "regiontype");
|
|
|
|
|
RNA_def_property_enum_items(prop, region_type_items);
|
2009-12-19 21:33:25 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
|
2009-11-11 20:42:18 +00:00
|
|
|
|
2012-06-18 12:48:51 +00:00
|
|
|
prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "winrct.xmin");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the region");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "winrct.ymin");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the region");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
|
2009-11-11 20:42:18 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "winx");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Width", "Region width");
|
2009-11-11 20:42:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
|
2009-11-11 20:42:18 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "winy");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Height", "Region height");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-08-08 16:44:16 +00:00
|
|
|
prop = RNA_def_property(srna, "view2d", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "v2d");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "View2D", "2D view of the region");
|
|
|
|
|
|
2010-11-20 05:11:10 +00:00
|
|
|
RNA_def_function(srna, "tag_redraw", "ED_region_tag_redraw");
|
2008-11-29 13:57:19 +00:00
|
|
|
}
|
|
|
|
|
|
2009-08-16 15:34:30 +00:00
|
|
|
static void rna_def_screen(BlenderRNA *brna)
|
2008-11-29 01:04:15 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Screen", "ID");
|
2009-01-15 04:22:23 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Screen", "Screen data-block, defining the layout of areas in a window");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN);
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2011-02-01 23:41:01 +00:00
|
|
|
/* pointers */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
|
2010-08-03 05:14:59 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL, NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen");
|
2011-09-06 17:18:50 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
|
2009-06-30 19:10:14 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Screen_scene_update");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2011-02-01 23:41:01 +00:00
|
|
|
/* collections */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
|
2009-01-15 04:22:23 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
|
2009-01-10 22:57:33 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Area");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2011-02-01 23:41:01 +00:00
|
|
|
/* readonly status indicators */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
|
2009-08-16 15:34:30 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-08-18 07:14:10 +00:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
|
2009-12-08 07:12:06 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
|
2014-10-14 15:05:44 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2011-02-01 23:41:01 +00:00
|
|
|
/* Define Anim Playback Areas */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
|
2011-02-01 23:41:01 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
|
2011-02-01 23:41:01 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
|
|
|
|
|
RNA_def_property_ui_text(prop, "All 3D View Editors", "");
|
2015-02-05 22:14:38 +01:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_follow", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_FOLLOW);
|
2015-02-12 22:05:47 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Follow", "Follow current frame in editors");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
|
2011-02-01 23:41:01 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Animation Editors", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
|
2011-02-01 23:41:01 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Property Editors", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
|
2011-02-01 23:41:01 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Image Editors", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
|
2011-02-01 23:41:01 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Sequencer Editors", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2011-05-19 15:18:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
|
2011-02-01 23:41:01 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Node Editors", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2011-11-07 12:55:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Clip Editors", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
|
2008-11-29 13:57:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_def_screen(BlenderRNA *brna)
|
|
|
|
|
{
|
2009-08-16 15:34:30 +00:00
|
|
|
rna_def_screen(brna);
|
|
|
|
|
rna_def_area(brna);
|
2009-01-15 04:22:23 +00:00
|
|
|
rna_def_region(brna);
|
2012-08-08 16:44:16 +00:00
|
|
|
rna_def_view2d(brna);
|
2008-11-29 01:04:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|