94
97
static int rna_Screen_is_animation_playing_get(PointerRNA *ptr)
96
bScreen *sc = (bScreen*)ptr->data;
97
return (sc->animtimer != NULL);
99
return (ED_screen_animation_playing(G.main->wm.first) != NULL);
100
102
static int rna_Screen_fullscreen_get(PointerRNA *ptr)
102
bScreen *sc = (bScreen*)ptr->data;
104
bScreen *sc = (bScreen *)ptr->data;
103
105
return (sc->full != 0);
106
108
static void rna_Area_type_set(PointerRNA *ptr, int value)
108
ScrArea *sa = (ScrArea*)ptr->data;
110
ScrArea *sa = (ScrArea *)ptr->data;
109
111
sa->butspacetype = value;
112
114
static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
114
ScrArea *sa = (ScrArea*)ptr->data;
116
ED_area_newspace(C, sa, sa->butspacetype); /* XXX - this uses the window */
117
ED_area_tag_redraw(sa);
116
wmWindowManager *wm = CTX_wm_manager(C);
118
bScreen *sc = (bScreen *)ptr->id.data;
119
ScrArea *sa = (ScrArea *)ptr->data;
121
/* XXX this call still use context, so we trick it to work in the right context */
122
for (win = wm->windows.first; win; win = win->next) {
123
if (sc == win->screen) {
124
wmWindow *prevwin = CTX_wm_window(C);
125
ScrArea *prevsa = CTX_wm_area(C);
126
ARegion *prevar = CTX_wm_region(C);
128
CTX_wm_window_set(C, win);
129
CTX_wm_area_set(C, sa);
130
CTX_wm_region_set(C, NULL);
132
ED_area_newspace(C, sa, sa->butspacetype);
133
ED_area_tag_redraw(sa);
135
CTX_wm_window_set(C, prevwin);
136
CTX_wm_area_set(C, prevsa);
137
CTX_wm_region_set(C, prevar);
143
static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2])
145
UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]);
148
static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, int clip, int result[2])
151
UI_view2d_view_to_region(v2d, x, y, &result[0], &result[1]);
153
UI_view2d_to_region_no_clip(v2d, x, y, &result[0], &result[1]);
172
208
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
173
209
RNA_def_property_update(prop, 0, "rna_Area_type_update");
211
prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
212
RNA_def_property_int_sdna(prop, NULL, "totrct.xmin");
213
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
214
RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the area");
216
prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
217
RNA_def_property_int_sdna(prop, NULL, "totrct.ymin");
218
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
219
RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the area");
175
221
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
176
222
RNA_def_property_int_sdna(prop, NULL, "winx");
177
223
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
189
235
RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
238
static void rna_def_view2d_api(StructRNA *srna)
243
static const float view_default[2] = {0.0f, 0.0f};
244
static const int region_default[2] = {0.0f, 0.0f};
246
func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view");
247
RNA_def_function_ui_description(func, "Transform region coordinates to 2D view");
248
parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
249
RNA_def_property_flag(parm, PROP_REQUIRED);
250
parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
251
RNA_def_property_flag(parm, PROP_REQUIRED);
252
parm = RNA_def_float_array(func, "result", 2, view_default, -FLT_MAX, FLT_MAX, "Result", "View coordinates", -10000.0f, 10000.0f);
253
RNA_def_property_flag(parm, PROP_THICK_WRAP);
254
RNA_def_function_output(func, parm);
256
func = RNA_def_function(srna, "view_to_region", "rna_View2D_view_to_region");
257
RNA_def_function_ui_description(func, "Transform 2D view coordinates to region");
258
parm = RNA_def_float(func, "x", 0.0f, -FLT_MAX, FLT_MAX, "x", "2D View x coordinate", -10000.0f, 10000.0f);
259
RNA_def_property_flag(parm, PROP_REQUIRED);
260
parm = RNA_def_float(func, "y", 0.0f, -FLT_MAX, FLT_MAX, "y", "2D View y coordinate", -10000.0f, 10000.0f);
261
RNA_def_property_flag(parm, PROP_REQUIRED);
262
RNA_def_boolean(func, "clip", 1, "Clip", "Clip coordinates to the visible region");
263
parm = RNA_def_int_array(func, "result", 2, region_default, INT_MIN, INT_MAX, "Result", "Region coordinates", -10000, 10000);
264
RNA_def_property_flag(parm, PROP_THICK_WRAP);
265
RNA_def_function_output(func, parm);
268
static void rna_def_view2d(BlenderRNA *brna)
271
/* PropertyRNA *prop; */
273
srna = RNA_def_struct(brna, "View2D", NULL);
274
RNA_def_struct_ui_text(srna, "View2D", "Scroll and zoom for a 2D region");
275
RNA_def_struct_sdna(srna, "View2D");
277
/* TODO more View2D properties could be exposed here (read-only) */
279
rna_def_view2d_api(srna);
192
282
static void rna_def_region(BlenderRNA *brna)
209
299
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
210
300
RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
302
prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
303
RNA_def_property_int_sdna(prop, NULL, "winrct.xmin");
304
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
305
RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the region");
307
prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
308
RNA_def_property_int_sdna(prop, NULL, "winrct.ymin");
309
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
310
RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the region");
212
312
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
213
313
RNA_def_property_int_sdna(prop, NULL, "winx");
214
314
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
255
361
prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
256
362
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
257
363
RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
258
RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximised, filling this screen");
364
RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximized, filling this screen");
260
366
/* Define Anim Playback Areas */
261
367
prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
262
368
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
263
369
RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
264
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
370
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
266
372
prop = RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
267
373
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
268
374
RNA_def_property_ui_text(prop, "All 3D View Editors", "");
269
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
375
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
271
377
prop = RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
272
378
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
273
379
RNA_def_property_ui_text(prop, "Animation Editors", "");
274
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
380
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
276
382
prop = RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
277
383
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
278
384
RNA_def_property_ui_text(prop, "Property Editors", "");
279
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
385
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
281
387
prop = RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
282
388
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
283
389
RNA_def_property_ui_text(prop, "Image Editors", "");
284
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
390
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
286
392
prop = RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
287
393
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
288
394
RNA_def_property_ui_text(prop, "Sequencer Editors", "");
289
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
395
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
291
397
prop = RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
292
398
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
293
399
RNA_def_property_ui_text(prop, "Node Editors", "");
294
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
400
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
296
402
prop = RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
297
403
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
298
404
RNA_def_property_ui_text(prop, "Clip Editors", "");
299
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
405
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
302
408
void RNA_def_screen(BlenderRNA *brna)