Blender  V2.93
rna_screen.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <stddef.h>
22 #include <stdlib.h>
23 
24 #include "RNA_define.h"
25 #include "RNA_enum_types.h"
26 
27 #include "rna_internal.h"
28 
29 #include "DNA_scene_types.h"
30 #include "DNA_screen_types.h"
31 #include "DNA_workspace_types.h"
32 
33 #include "ED_info.h"
34 
36  {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""},
37  {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""},
38  {RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""},
39  {RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""},
40  {RGN_TYPE_UI, "UI", 0, "UI", ""},
41  {RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""},
42  {RGN_TYPE_TOOL_PROPS, "TOOL_PROPS", 0, "Tool Properties", ""},
43  {RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""},
44  {RGN_TYPE_HUD, "HUD", 0, "Floating Region", ""},
45  {RGN_TYPE_NAV_BAR, "NAVIGATION_BAR", 0, "Navigation Bar", ""},
46  {RGN_TYPE_EXECUTE, "EXECUTE", 0, "Execute Buttons", ""},
47  {RGN_TYPE_FOOTER, "FOOTER", 0, "Footer", ""},
48  {RGN_TYPE_TOOL_HEADER, "TOOL_HEADER", 0, "Tool Header", ""},
49  {0, NULL, 0, NULL, NULL},
50 };
51 
52 #include "ED_screen.h"
53 
54 #include "WM_api.h"
55 #include "WM_types.h"
56 
57 #ifdef RNA_RUNTIME
58 
59 # include "RNA_access.h"
60 
61 # include "BKE_global.h"
62 # include "BKE_screen.h"
63 # include "BKE_workspace.h"
64 
65 # include "DEG_depsgraph.h"
66 
67 # include "UI_view2d.h"
68 
69 # ifdef WITH_PYTHON
70 # include "BPY_extern.h"
71 # endif
72 
73 static void rna_Screen_bar_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
74 {
75  bScreen *screen = (bScreen *)ptr->data;
76  screen->do_draw = true;
77  screen->do_refresh = true;
78 }
79 
80 static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
81 {
82  bScreen *screen = (bScreen *)ptr->data;
83 
84  /* the settings for this are currently only available from a menu in the TimeLine,
85  * hence refresh=SPACE_ACTION, as timeline is now in there
86  */
88 }
89 
90 static bool rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr))
91 {
92  /* can be NULL on file load, T42619 */
93  wmWindowManager *wm = G_MAIN->wm.first;
94  return wm ? (ED_screen_animation_playing(wm) != NULL) : 0;
95 }
96 
97 static bool rna_Screen_is_scrubbing_get(PointerRNA *ptr)
98 {
99  bScreen *screen = (bScreen *)ptr->data;
100  return screen->scrubbing;
101 }
102 
103 static int rna_region_alignment_get(PointerRNA *ptr)
104 {
105  ARegion *region = ptr->data;
106  return RGN_ALIGN_ENUM_FROM_MASK(region->alignment);
107 }
108 
109 static bool rna_Screen_fullscreen_get(PointerRNA *ptr)
110 {
111  bScreen *screen = (bScreen *)ptr->data;
112  return (screen->state == SCREENMAXIMIZED);
113 }
114 
115 static int rna_Area_type_get(PointerRNA *ptr)
116 {
117  ScrArea *area = (ScrArea *)ptr->data;
118  /* Usually 'spacetype' is used. It lags behind a bit while switching area
119  * type though, then we use 'butspacetype' instead (T41435). */
120  return (area->butspacetype == SPACE_EMPTY) ? area->spacetype : area->butspacetype;
121 }
122 
123 static void rna_Area_type_set(PointerRNA *ptr, int value)
124 {
125  if (ELEM(value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
126  /* Special case: An area can not be set to show the top-bar editor (or
127  * other global areas). However it should still be possible to identify
128  * its type from Python. */
129  return;
130  }
131 
132  ScrArea *area = (ScrArea *)ptr->data;
133  /* Empty areas are locked. */
134  if ((value == SPACE_EMPTY) || (area->spacetype == SPACE_EMPTY)) {
135  return;
136  }
137 
138  area->butspacetype = value;
139 }
140 
141 static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
142 {
143  bScreen *screen = (bScreen *)ptr->owner_id;
144  ScrArea *area = (ScrArea *)ptr->data;
145 
146  /* Running update without having called 'set', see: T64049 */
147  if (area->butspacetype == SPACE_EMPTY) {
148  return;
149  }
150 
152  wmWindow *win;
153  /* XXX this call still use context, so we trick it to work in the right context */
154  for (win = wm->windows.first; win; win = win->next) {
155  if (screen == WM_window_get_active_screen(win)) {
156  wmWindow *prevwin = CTX_wm_window(C);
157  ScrArea *prevsa = CTX_wm_area(C);
158  ARegion *prevar = CTX_wm_region(C);
159 
160  CTX_wm_window_set(C, win);
163 
164  ED_area_newspace(C, area, area->butspacetype, true);
166 
167  /* Unset so that rna_Area_type_get uses spacetype instead. */
168  area->butspacetype = SPACE_EMPTY;
169 
170  /* It is possible that new layers becomes visible. */
171  if (area->spacetype == SPACE_VIEW3D) {
173  }
174 
175  CTX_wm_window_set(C, prevwin);
176  CTX_wm_area_set(C, prevsa);
177  CTX_wm_region_set(C, prevar);
178  break;
179  }
180  }
181 }
182 
183 static const EnumPropertyItem *rna_Area_ui_type_itemf(bContext *C,
184  PointerRNA *ptr,
185  PropertyRNA *UNUSED(prop),
186  bool *r_free)
187 {
188  EnumPropertyItem *item = NULL;
189  int totitem = 0;
190 
191  ScrArea *area = (ScrArea *)ptr->data;
192  const EnumPropertyItem *item_from = rna_enum_space_type_items;
193  if (area->spacetype != SPACE_EMPTY) {
194  item_from += 1; /* +1 to skip SPACE_EMPTY */
195  }
196 
197  for (; item_from->identifier; item_from++) {
198  if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
199  continue;
200  }
201 
202  SpaceType *st = item_from->identifier[0] ? BKE_spacetype_from_id(item_from->value) : NULL;
203  int totitem_prev = totitem;
204  if (st && st->space_subtype_item_extend != NULL) {
205  st->space_subtype_item_extend(C, &item, &totitem);
206  while (totitem_prev < totitem) {
207  item[totitem_prev++].value |= item_from->value << 16;
208  }
209  }
210  else {
211  RNA_enum_item_add(&item, &totitem, item_from);
212  item[totitem_prev++].value = item_from->value << 16;
213  }
214  }
215  RNA_enum_item_end(&item, &totitem);
216  *r_free = true;
217 
218  return item;
219 }
220 
221 static int rna_Area_ui_type_get(PointerRNA *ptr)
222 {
223  ScrArea *area = ptr->data;
224  /* This is for the Python API which may inspect empty areas. */
225  if (UNLIKELY(area->spacetype == SPACE_EMPTY)) {
226  return SPACE_EMPTY;
227  }
228  const int area_type = rna_Area_type_get(ptr);
229  const bool area_changing = area->butspacetype != SPACE_EMPTY;
230  int value = area_type << 16;
231 
232  /* Area->type can be NULL when not yet initialized (for example when accessed
233  * through the outliner or API when not visible), or it can be wrong while
234  * the area type is changing.
235  * So manually do the lookup in those cases, but do not actually change area->type
236  * since that prevents a proper exit when the area type is changing.
237  * Logic copied from `ED_area_init()`.*/
238  SpaceType *type = area->type;
239  if (type == NULL || area_changing) {
240  type = BKE_spacetype_from_id(area_type);
241  if (type == NULL) {
243  }
244  BLI_assert(type != NULL);
245  }
246  if (type->space_subtype_item_extend != NULL) {
247  value |= area_changing ? area->butspacetype_subtype : type->space_subtype_get(area);
248  }
249  return value;
250 }
251 
252 static void rna_Area_ui_type_set(PointerRNA *ptr, int value)
253 {
254  ScrArea *area = ptr->data;
255  const int space_type = value >> 16;
256  /* Empty areas are locked. */
257  if ((space_type == SPACE_EMPTY) || (area->spacetype == SPACE_EMPTY)) {
258  return;
259  }
260  SpaceType *st = BKE_spacetype_from_id(space_type);
261 
262  rna_Area_type_set(ptr, space_type);
263 
264  if (st && st->space_subtype_item_extend != NULL) {
265  area->butspacetype_subtype = value & 0xffff;
266  }
267 }
268 
269 static void rna_Area_ui_type_update(bContext *C, PointerRNA *ptr)
270 {
271  ScrArea *area = ptr->data;
272  SpaceType *st = BKE_spacetype_from_id(area->butspacetype);
273 
274  rna_Area_type_update(C, ptr);
275 
276  if ((area->type == st) && (st->space_subtype_item_extend != NULL)) {
277  st->space_subtype_set(area, area->butspacetype_subtype);
278  }
279  area->butspacetype_subtype = 0;
280 
282 }
283 
284 static PointerRNA rna_Region_data_get(PointerRNA *ptr)
285 {
286  bScreen *screen = (bScreen *)ptr->owner_id;
287  ARegion *region = ptr->data;
288 
289  if (region->regiondata != NULL) {
290  if (region->regiontype == RGN_TYPE_WINDOW) {
291  /* We could make this static, it wont change at run-time. */
293  if (region->type == BKE_regiontype_from_id(st, region->regiontype)) {
294  PointerRNA newptr;
295  RNA_pointer_create(&screen->id, &RNA_RegionView3D, region->regiondata, &newptr);
296  return newptr;
297  }
298  }
299  }
300  return PointerRNA_NULL;
301 }
302 
303 static void rna_View2D_region_to_view(struct View2D *v2d, float x, float y, float result[2])
304 {
305  UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]);
306 }
307 
308 static void rna_View2D_view_to_region(
309  struct View2D *v2d, float x, float y, bool clip, int result[2])
310 {
311  if (clip) {
312  UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]);
313  }
314  else {
315  UI_view2d_view_to_region(v2d, x, y, &result[0], &result[1]);
316  }
317 }
318 
319 static const char *rna_Screen_statusbar_info_get(struct bScreen *UNUSED(screen),
320  Main *bmain,
321  bContext *C)
322 {
324 }
325 
326 #else
327 
328 /* Area.spaces */
329 static void rna_def_area_spaces(BlenderRNA *brna, PropertyRNA *cprop)
330 {
331  StructRNA *srna;
332  PropertyRNA *prop;
333 
334  RNA_def_property_srna(cprop, "AreaSpaces");
335  srna = RNA_def_struct(brna, "AreaSpaces", NULL);
336  RNA_def_struct_sdna(srna, "ScrArea");
337  RNA_def_struct_ui_text(srna, "Area Spaces", "Collection of spaces");
338 
339  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
340  RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
341  RNA_def_property_struct_type(prop, "Space");
342  RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area");
343 }
344 
345 static void rna_def_area_api(StructRNA *srna)
346 {
347  FunctionRNA *func;
348  PropertyRNA *parm;
349 
350  RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
351 
352  func = RNA_def_function(srna, "header_text_set", "ED_area_status_text");
353  RNA_def_function_ui_description(func, "Set the header status text");
354  parm = RNA_def_string(
355  func, "text", NULL, 0, "Text", "New string for the header, None clears the text");
358 }
359 
360 static void rna_def_area(BlenderRNA *brna)
361 {
362  StructRNA *srna;
363  PropertyRNA *prop;
364 
365  srna = RNA_def_struct(brna, "Area", NULL);
366  RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
367  RNA_def_struct_sdna(srna, "ScrArea");
368 
369  prop = RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
370  RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
371  RNA_def_property_struct_type(prop, "Space");
373  "Spaces",
374  "Spaces contained in this area, the first being the active space "
375  "(NOTE: Useful for example to restore a previously used 3D view space "
376  "in a certain area to get the old view orientation)");
377  rna_def_area_spaces(brna, prop);
378 
379  prop = RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
380  RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
381  RNA_def_property_struct_type(prop, "Region");
382  RNA_def_property_ui_text(prop, "Regions", "Regions this area is subdivided in");
383 
384  prop = RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
386  RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header");
387 
388  /* Note on space type use of #SPACE_EMPTY, this is not visible to the user,
389  * and script authors should be able to assign this value, however the value may be set
390  * and needs to be read back by script authors.
391  *
392  * This happens when an area is full-screen (when #ScrArea.full is set).
393  * in this case reading the empty value is needed, but it should never be set, see: T87187. */
394  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
395  RNA_def_property_enum_sdna(prop, NULL, "spacetype");
398  RNA_def_property_enum_funcs(prop, "rna_Area_type_get", "rna_Area_type_set", NULL);
399  RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
402  RNA_def_property_update(prop, 0, "rna_Area_type_update");
403 
404  prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
405  RNA_def_property_enum_items(prop, DummyRNA_NULL_items); /* in fact dummy */
408  prop, "rna_Area_ui_type_get", "rna_Area_ui_type_set", "rna_Area_ui_type_itemf");
409  RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
412  RNA_def_property_update(prop, 0, "rna_Area_ui_type_update");
413 
414  prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
415  RNA_def_property_int_sdna(prop, NULL, "totrct.xmin");
418  prop, "X Position", "The window relative vertical location of the area");
419 
420  prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
421  RNA_def_property_int_sdna(prop, NULL, "totrct.ymin");
424  prop, "Y Position", "The window relative horizontal location of the area");
425 
426  prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
427  RNA_def_property_int_sdna(prop, NULL, "winx");
429  RNA_def_property_ui_text(prop, "Width", "Area width");
430 
431  prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
432  RNA_def_property_int_sdna(prop, NULL, "winy");
434  RNA_def_property_ui_text(prop, "Height", "Area height");
435 
436  rna_def_area_api(srna);
437 }
438 
439 static void rna_def_view2d_api(StructRNA *srna)
440 {
441  FunctionRNA *func;
442  PropertyRNA *parm;
443 
444  static const float view_default[2] = {0.0f, 0.0f};
445  static const int region_default[2] = {0.0f, 0.0f};
446 
447  func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view");
448  RNA_def_function_ui_description(func, "Transform region coordinates to 2D view");
449  parm = RNA_def_float(func, "x", 0, -FLT_MAX, FLT_MAX, "x", "Region x coordinate", -10000, 10000);
451  parm = RNA_def_float(func, "y", 0, -FLT_MAX, FLT_MAX, "y", "Region y coordinate", -10000, 10000);
453  parm = RNA_def_float_array(func,
454  "result",
455  2,
456  view_default,
457  -FLT_MAX,
458  FLT_MAX,
459  "Result",
460  "View coordinates",
461  -10000.0f,
462  10000.0f);
464  RNA_def_function_output(func, parm);
465 
466  func = RNA_def_function(srna, "view_to_region", "rna_View2D_view_to_region");
467  RNA_def_function_ui_description(func, "Transform 2D view coordinates to region");
468  parm = RNA_def_float(
469  func, "x", 0.0f, -FLT_MAX, FLT_MAX, "x", "2D View x coordinate", -10000.0f, 10000.0f);
471  parm = RNA_def_float(
472  func, "y", 0.0f, -FLT_MAX, FLT_MAX, "y", "2D View y coordinate", -10000.0f, 10000.0f);
474  RNA_def_boolean(func, "clip", 1, "Clip", "Clip coordinates to the visible region");
475  parm = RNA_def_int_array(func,
476  "result",
477  2,
478  region_default,
479  INT_MIN,
480  INT_MAX,
481  "Result",
482  "Region coordinates",
483  -10000,
484  10000);
486  RNA_def_function_output(func, parm);
487 }
488 
489 static void rna_def_view2d(BlenderRNA *brna)
490 {
491  StructRNA *srna;
492  /* PropertyRNA *prop; */
493 
494  srna = RNA_def_struct(brna, "View2D", NULL);
495  RNA_def_struct_ui_text(srna, "View2D", "Scroll and zoom for a 2D region");
496  RNA_def_struct_sdna(srna, "View2D");
497 
498  /* TODO more View2D properties could be exposed here (read-only) */
499 
500  rna_def_view2d_api(srna);
501 }
502 
503 static void rna_def_region(BlenderRNA *brna)
504 {
505  StructRNA *srna;
506  PropertyRNA *prop;
507 
508  static const EnumPropertyItem alignment_types[] = {
509  {RGN_ALIGN_NONE, "NONE", 0, "None", "Don't use any fixed alignment, fill available space"},
510  {RGN_ALIGN_TOP, "TOP", 0, "Top", ""},
511  {RGN_ALIGN_BOTTOM, "BOTTOM", 0, "Bottom", ""},
512  {RGN_ALIGN_LEFT, "LEFT", 0, "Left", ""},
513  {RGN_ALIGN_RIGHT, "RIGHT", 0, "Right", ""},
514  {RGN_ALIGN_HSPLIT, "HORIZONTAL_SPLIT", 0, "Horizontal Split", ""},
515  {RGN_ALIGN_VSPLIT, "VERTICAL_SPLIT", 0, "Vertical Split", ""},
517  "FLOAT",
518  0,
519  "Float",
520  "Region floats on screen, doesn't use any fixed alignment"},
522  "QUAD_SPLIT",
523  0,
524  "Quad Split",
525  "Region is split horizontally and vertically"},
526  {0, NULL, 0, NULL, NULL},
527  };
528 
529  srna = RNA_def_struct(brna, "Region", NULL);
530  RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area");
531  RNA_def_struct_sdna(srna, "ARegion");
532 
533  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
534  RNA_def_property_enum_sdna(prop, NULL, "regiontype");
537  RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
538 
539  prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
540  RNA_def_property_int_sdna(prop, NULL, "winrct.xmin");
543  prop, "X Position", "The window relative vertical location of the region");
544 
545  prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
546  RNA_def_property_int_sdna(prop, NULL, "winrct.ymin");
549  prop, "Y Position", "The window relative horizontal location of the region");
550 
551  prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
552  RNA_def_property_int_sdna(prop, NULL, "winx");
554  RNA_def_property_ui_text(prop, "Width", "Region width");
555 
556  prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
557  RNA_def_property_int_sdna(prop, NULL, "winy");
559  RNA_def_property_ui_text(prop, "Height", "Region height");
560 
561  prop = RNA_def_property(srna, "view2d", PROP_POINTER, PROP_NONE);
562  RNA_def_property_pointer_sdna(prop, NULL, "v2d");
565  RNA_def_property_ui_text(prop, "View2D", "2D view of the region");
566 
567  prop = RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
569  RNA_def_property_enum_items(prop, alignment_types);
570  RNA_def_property_enum_funcs(prop, "rna_region_alignment_get", NULL, NULL);
571  RNA_def_property_ui_text(prop, "Alignment", "Alignment of the region within the area");
572 
573  prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
576  prop, "Region Data", "Region specific data (the type depends on the region type)");
577  RNA_def_property_struct_type(prop, "AnyType");
578  RNA_def_property_pointer_funcs(prop, "rna_Region_data_get", NULL, NULL, NULL);
579 
580  RNA_def_function(srna, "tag_redraw", "ED_region_tag_redraw");
581 }
582 
583 static void rna_def_screen(BlenderRNA *brna)
584 {
585  StructRNA *srna;
586  PropertyRNA *prop;
587 
588  FunctionRNA *func;
589  PropertyRNA *parm;
590 
591  srna = RNA_def_struct(brna, "Screen", "ID");
592  RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
594  srna, "Screen", "Screen data-block, defining the layout of areas in a window");
595  RNA_def_struct_ui_icon(srna, ICON_WORKSPACE);
596 
597  /* collections */
598  prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
599  RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
600  RNA_def_property_struct_type(prop, "Area");
601  RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into");
602 
603  /* readonly status indicators */
604  prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
606  RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
607  RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");
608 
609  prop = RNA_def_property(srna, "is_scrubbing", PROP_BOOLEAN, PROP_NONE);
611  RNA_def_property_boolean_funcs(prop, "rna_Screen_is_scrubbing_get", NULL);
613  prop, "User is Scrubbing", "True when the user is scrubbing through time");
614 
615  prop = RNA_def_property(srna, "is_temporary", PROP_BOOLEAN, PROP_NONE);
617  RNA_def_property_boolean_sdna(prop, NULL, "temp", 1);
618  RNA_def_property_ui_text(prop, "Temporary", "");
619 
620  prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
622  RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
623  RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen");
624 
625  /* Status Bar. */
626 
627  prop = RNA_def_property(srna, "show_statusbar", PROP_BOOLEAN, PROP_NONE);
629  RNA_def_property_ui_text(prop, "Show Status Bar", "Show status bar");
630  RNA_def_property_update(prop, 0, "rna_Screen_bar_update");
631 
632  func = RNA_def_function(srna, "statusbar_info", "rna_Screen_statusbar_info_get");
634  parm = RNA_def_string(func, "statusbar_info", NULL, 0, "Status Bar Info", "");
635  RNA_def_function_return(func, parm);
636 
637  /* Define Anim Playback Areas */
638  prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
639  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
640  RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
641  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
642 
643  prop = RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
644  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
645  RNA_def_property_ui_text(prop, "All 3D Viewports", "");
646  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
647 
648  prop = RNA_def_property(srna, "use_follow", PROP_BOOLEAN, PROP_NONE);
649  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_FOLLOW);
650  RNA_def_property_ui_text(prop, "Follow", "Follow current frame in editors");
651  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
652 
653  prop = RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
654  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
655  RNA_def_property_ui_text(prop, "Animation Editors", "");
656  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
657 
658  prop = RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
659  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
660  RNA_def_property_ui_text(prop, "Property Editors", "");
661  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
662 
663  prop = RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
664  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
665  RNA_def_property_ui_text(prop, "Image Editors", "");
666  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
667 
668  prop = RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
669  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
670  RNA_def_property_ui_text(prop, "Sequencer Editors", "");
671  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
672 
673  prop = RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
674  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
675  RNA_def_property_ui_text(prop, "Node Editors", "");
676  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
677 
678  prop = RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
679  RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
680  RNA_def_property_ui_text(prop, "Clip Editors", "");
681  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
682 }
683 
685 {
686  rna_def_screen(brna);
687  rna_def_area(brna);
688  rna_def_region(brna);
689  rna_def_view2d(brna);
690 }
691 
692 #endif
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
void CTX_wm_region_set(bContext *C, struct ARegion *region)
Definition: context.c:985
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1044
void CTX_wm_window_set(bContext *C, struct wmWindow *win)
Definition: context.c:942
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
void CTX_wm_area_set(bContext *C, struct ScrArea *area)
Definition: context.c:973
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
#define G_MAIN
Definition: BKE_global.h:232
struct SpaceType * BKE_spacetype_from_id(int spaceid)
Definition: screen.c:382
struct ARegionType * BKE_regiontype_from_id(const struct SpaceType *st, int regionid)
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define UNUSED(x)
#define UNLIKELY(x)
#define ELEM(...)
void DEG_on_visible_update(struct Main *bmain, const bool do_time)
#define RGN_ALIGN_ENUM_FROM_MASK(align)
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ RGN_ALIGN_HSPLIT
@ RGN_ALIGN_VSPLIT
@ RGN_ALIGN_NONE
@ RGN_ALIGN_FLOAT
@ RGN_ALIGN_QSPLIT
@ SCREENMAXIMIZED
@ HEADER_NO_PULLDOWN
@ TIME_SEQ
@ TIME_ALL_IMAGE_WIN
@ TIME_ALL_BUTS_WIN
@ TIME_FOLLOW
@ TIME_REGION
@ TIME_ALL_3D_WIN
@ TIME_CLIPS
@ TIME_NODES
@ TIME_ALL_ANIM_WIN
@ SCREEN_COLLAPSE_STATUSBAR
@ RGN_TYPE_CHANNELS
@ RGN_TYPE_TOOL_HEADER
@ RGN_TYPE_EXECUTE
@ RGN_TYPE_UI
@ RGN_TYPE_TEMPORARY
@ RGN_TYPE_WINDOW
@ RGN_TYPE_HUD
@ RGN_TYPE_PREVIEW
@ RGN_TYPE_NAV_BAR
@ RGN_TYPE_FOOTER
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ RGN_TYPE_TOOL_PROPS
@ SPACE_STATUSBAR
@ SPACE_TOPBAR
@ SPACE_EMPTY
@ SPACE_VIEW3D
const char * ED_info_statusbar_string(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer)
Definition: info_stats.c:656
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:745
void ED_screen_animation_timer_update(struct bScreen *screen, int redraws)
Definition: screen_edit.c:1602
void ED_area_newspace(struct bContext *C, ScrArea *area, int type, const bool skip_region_exit)
Definition: area.c:2375
bScreen * ED_screen_animation_playing(const struct wmWindowManager *wm)
void ED_area_tag_refresh(ScrArea *area)
Definition: area.c:774
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ FUNC_USE_MAIN
Definition: RNA_types.h:576
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_CONTEXT_UPDATE
Definition: RNA_types.h:254
@ PROP_ANIMATABLE
Definition: RNA_types.h:188
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_UNSIGNED
Definition: RNA_types.h:129
#define C
Definition: RandGen.cpp:39
bool UI_view2d_view_to_region_clip(const struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void UI_view2d_view_to_region(const struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
#define ND_SPACE_TIME
Definition: WM_types.h:426
#define NC_SPACE
Definition: WM_types.h:293
return(oflags[bm->toolflag_index].f &oflag) !=0
Scene scene
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3825
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2762
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3643
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:4065
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
Definition: rna_define.c:2127
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
Definition: rna_define.c:4327
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2971
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2791
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3251
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4470
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4416
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1267
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3675
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2348
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
const EnumPropertyItem DummyRNA_NULL_items[]
Definition: rna_rna.c:40
static void rna_def_view2d(BlenderRNA *brna)
Definition: rna_screen.c:489
static void rna_def_area(BlenderRNA *brna)
Definition: rna_screen.c:360
static void rna_def_view2d_api(StructRNA *srna)
Definition: rna_screen.c:439
const EnumPropertyItem rna_enum_region_type_items[]
Definition: rna_screen.c:35
static void rna_def_region(BlenderRNA *brna)
Definition: rna_screen.c:503
static void rna_def_area_spaces(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_screen.c:329
static void rna_def_area_api(StructRNA *srna)
Definition: rna_screen.c:345
void RNA_def_screen(BlenderRNA *brna)
Definition: rna_screen.c:684
static void rna_def_screen(BlenderRNA *brna)
Definition: rna_screen.c:583
const EnumPropertyItem rna_enum_space_type_items[]
Definition: rna_space.c:72
short alignment
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
void(* space_subtype_item_extend)(struct bContext *C, EnumPropertyItem **item, int *totitem)
Definition: BKE_screen.h:127
void(* space_subtype_set)(struct ScrArea *area, int value)
Definition: BKE_screen.h:126
char do_refresh
short redraws_flag
char scrubbing
struct wmWindow * next
PointerRNA * ptr
Definition: wm_files.c:3157
bScreen * WM_window_get_active_screen(const wmWindow *win)
Definition: wm_window.c:2372