4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008)
22 * ***** END GPL LICENSE BLOCK *****
25 /** \file blender/makesrna/intern/rna_space.c
32 #include "MEM_guardedalloc.h"
34 #include "RNA_access.h"
35 #include "RNA_define.h"
37 #include "rna_internal.h"
41 #include "DNA_action_types.h"
42 #include "DNA_key_types.h"
43 #include "DNA_node_types.h"
44 #include "DNA_object_types.h"
45 #include "DNA_space_types.h"
46 #include "DNA_sequence_types.h"
47 #include "DNA_view3d_types.h"
52 #include "RNA_enum_types.h"
54 EnumPropertyItem space_type_items[] = {
55 {SPACE_EMPTY, "EMPTY", 0, "Empty", ""},
56 {SPACE_VIEW3D, "VIEW_3D", 0, "3D View", ""},
57 {SPACE_IPO, "GRAPH_EDITOR", 0, "Graph Editor", ""},
58 {SPACE_OUTLINER, "OUTLINER", 0, "Outliner", ""},
59 {SPACE_BUTS, "PROPERTIES", 0, "Properties", ""},
60 {SPACE_FILE, "FILE_BROWSER", 0, "File Browser", ""},
61 {SPACE_IMAGE, "IMAGE_EDITOR", 0, "Image Editor", ""},
62 {SPACE_INFO, "INFO", 0, "Info", ""},
63 {SPACE_SEQ, "SEQUENCE_EDITOR", 0, "Sequence Editor", ""},
64 {SPACE_TEXT, "TEXT_EDITOR", 0, "Text Editor", ""},
65 //{SPACE_IMASEL, "IMAGE_BROWSER", 0, "Image Browser", ""},
66 {SPACE_SOUND, "AUDIO_WINDOW", 0, "Audio Window", ""},
67 {SPACE_ACTION, "DOPESHEET_EDITOR", 0, "DopeSheet Editor", ""},
68 {SPACE_NLA, "NLA_EDITOR", 0, "NLA Editor", ""},
69 {SPACE_SCRIPT, "SCRIPTS_WINDOW", 0, "Scripts Window", ""},
70 {SPACE_TIME, "TIMELINE", 0, "Timeline", ""},
71 {SPACE_NODE, "NODE_EDITOR", 0, "Node Editor", ""},
72 {SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""},
73 {SPACE_CONSOLE, "CONSOLE", 0, "Python Console", ""},
74 {SPACE_USERPREF, "USER_PREFERENCES", 0, "User Preferences", ""},
75 {0, NULL, 0, NULL, NULL}};
77 static EnumPropertyItem draw_channels_items[] = {
78 {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
79 {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"},
80 {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
81 {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer",
82 "Draw Z-buffer associated with image (mapped from camera clip start to end)"},
83 {0, NULL, 0, NULL, NULL}};
85 static EnumPropertyItem transform_orientation_items[] = {
86 {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"},
87 {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"},
88 {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
89 {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal",
90 "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"},
91 {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"},
92 {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
93 {0, NULL, 0, NULL, NULL}};
95 EnumPropertyItem autosnap_items[] = {
96 {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
97 {SACTSNAP_STEP, "STEP", 0, "Time Step", "Snap to 1.0 frame/second intervals"},
98 {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames/seconds (nla-action time)"},
99 {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"},
100 {0, NULL, 0, NULL, NULL}};
102 EnumPropertyItem viewport_shade_items[] = {
103 {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"},
104 {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
105 {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"},
106 //{OB_SHADED, "SHADED", ICON_SMOOTH, "Shaded", "Display the object solid, with preview shading interpolated at vertices"},
107 {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Textured", "Display the object solid, with face-assigned textures"},
108 {0, NULL, 0, NULL, NULL}};
112 #include "DNA_anim_types.h"
113 #include "DNA_scene_types.h"
114 #include "DNA_screen_types.h"
116 #include "BLI_math.h"
118 #include "BKE_screen.h"
119 #include "BKE_animsys.h"
120 #include "BKE_brush.h"
121 #include "BKE_colortools.h"
122 #include "BKE_context.h"
123 #include "BKE_depsgraph.h"
124 #include "BKE_paint.h"
126 #include "ED_image.h"
128 #include "ED_screen.h"
129 #include "ED_view3d.h"
130 #include "ED_sequencer.h"
132 #include "IMB_imbuf_types.h"
134 static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
136 SpaceLink *space= (SpaceLink*)ptr->data;
138 switch(space->spacetype) {
140 return &RNA_SpaceView3D;
142 return &RNA_SpaceGraphEditor;
144 return &RNA_SpaceOutliner;
146 return &RNA_SpaceProperties;
148 return &RNA_SpaceFileBrowser;
150 return &RNA_SpaceImageEditor;
152 return &RNA_SpaceInfo;
154 return &RNA_SpaceSequenceEditor;
156 return &RNA_SpaceTextEditor;
158 // return &RNA_SpaceImageBrowser;
160 return &RNA_SpaceAudioWindow;*/
162 return &RNA_SpaceDopeSheetEditor;
164 return &RNA_SpaceNLA;
166 return &RNA_SpaceScriptsWindow;*/
168 return &RNA_SpaceTimeline;
170 return &RNA_SpaceNodeEditor;
172 return &RNA_SpaceLogicEditor;
174 return &RNA_SpaceConsole;
176 return &RNA_SpaceUserPreferences;
182 static ScrArea *rna_area_from_space(PointerRNA *ptr)
184 bScreen *sc = (bScreen*)ptr->id.data;
185 SpaceLink *link= (SpaceLink*)ptr->data;
188 for(sa=sc->areabase.first; sa; sa=sa->next)
189 if(BLI_findindex(&sa->spacedata, link) != -1)
195 static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **sa_r, ARegion **ar_r)
197 bScreen *sc = (bScreen*)ptr->id.data;
200 void *regiondata= ptr->data;
205 for(sa=sc->areabase.first; sa; sa=sa->next) {
206 for(ar=sa->regionbase.first; ar; ar=ar->next) {
207 if(ar->regiondata == regiondata) {
216 static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr)
218 Scene *scene = ((bScreen*)ptr->id.data)->scene;
219 View3D *v3d= (View3D*)ptr->data;
221 if (v3d->twmode < V3D_MANIP_CUSTOM)
222 return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, NULL);
224 return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation,
225 BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM));
228 EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
231 ListBase *transform_spaces;
232 TransformOrientation *ts= NULL;
233 EnumPropertyItem tmp = {0, "", 0, "", ""};
234 EnumPropertyItem *item= NULL;
235 int i = V3D_MANIP_CUSTOM, totitem= 0;
237 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_GLOBAL);
238 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_NORMAL);
239 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_GIMBAL);
240 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_LOCAL);
241 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_VIEW);
243 if (ptr->type == &RNA_SpaceView3D)
244 scene = ((bScreen*)ptr->id.data)->scene;
246 scene = CTX_data_scene(C); /* can't use scene from ptr->id.data because that enum is also used by operators */
249 transform_spaces = &scene->transform_spaces;
250 ts = transform_spaces->first;
255 RNA_enum_item_add_separator(&item, &totitem);
257 for(; ts; ts = ts->next) {
258 tmp.identifier = ts->name;
261 RNA_enum_item_add(&item, &totitem, &tmp);
265 RNA_enum_item_end(&item, &totitem);
272 static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int value)
274 View3D *v3d= (View3D*)(ptr->data);
275 bScreen *sc= (bScreen*)ptr->id.data;
277 v3d->scenelock = value;
281 v3d->lay= sc->scene->lay;
282 /* seek for layact */
285 if(v3d->lay & (1<<bit)) {
291 v3d->camera= sc->scene->camera;
295 static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values)
297 View3D *v3d= (View3D*)(ptr->data);
298 bScreen *sc= (bScreen*)ptr->id.data;
299 Scene *scene= (Scene *)sc->scene;
300 float *loc = give_cursor(scene, v3d);
302 copy_v3_v3(values, loc);
305 static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values)
307 View3D *v3d= (View3D*)(ptr->data);
308 bScreen *sc= (bScreen*)ptr->id.data;
309 Scene *scene= (Scene *)sc->scene;
310 float *cursor = give_cursor(scene, v3d);
312 copy_v3_v3(cursor, values);
315 static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
317 View3D *v3d= (View3D*)(ptr->data);
319 v3d->lay= ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact);
322 static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
324 DAG_on_visible_update(bmain, FALSE);
327 static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
329 if (U.uiflag & USER_LOCKAROUND) {
330 View3D *v3d_act= (View3D*)(ptr->data);
332 /* TODO, space looper */
334 for(screen= bmain->screen.first; screen; screen= screen->id.next) {
336 for(sa= screen->areabase.first; sa; sa= sa->next) {
338 for(sl= sa->spacedata.first; sl ;sl= sl->next) {
339 if(sl->spacetype==SPACE_VIEW3D) {
340 View3D *v3d= (View3D *)sl;
341 if (v3d != v3d_act) {
342 v3d->around= v3d_act->around;
343 v3d->flag= (v3d->flag & ~V3D_ALIGN) | (v3d_act->flag & V3D_ALIGN);
344 ED_area_tag_redraw_regiontype(sa, RGN_TYPE_HEADER);
353 static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
355 View3D *v3d= (View3D*)(ptr->data);
356 ScrArea *sa= rna_area_from_space(ptr);
357 void *regiondata= NULL;
359 ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
360 ARegion *ar= regionbase->last; /* always last in list, weak .. */
361 regiondata= ar->regiondata;
364 return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
367 static PointerRNA rna_SpaceView3D_region_quadview_get(PointerRNA *ptr)
369 View3D *v3d= (View3D*)(ptr->data);
370 ScrArea *sa= rna_area_from_space(ptr);
371 void *regiondata= NULL;
373 ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
374 ARegion *ar= regionbase->last; /* always before last in list, weak .. */
376 ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL;
378 regiondata= ar->regiondata;
382 return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
385 static void rna_RegionView3D_quadview_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
390 rna_area_region_from_regiondata(ptr, &sa, &ar);
391 if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
392 ED_view3d_quadview_update(sa, ar, FALSE);
395 /* same as above but call clip==TRUE */
396 static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
401 rna_area_region_from_regiondata(ptr, &sa, &ar);
402 if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
403 ED_view3d_quadview_update(sa, ar, TRUE);
406 static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values)
408 RegionView3D *rv3d= (RegionView3D *)(ptr->data);
409 negate_v3_v3(values, rv3d->ofs);
412 static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values)
414 RegionView3D *rv3d= (RegionView3D *)(ptr->data);
415 negate_v3_v3(rv3d->ofs, values);
418 static void rna_RegionView3D_view_rotation_get(PointerRNA *ptr, float *values)
420 RegionView3D *rv3d= (RegionView3D *)(ptr->data);
421 invert_qt_qt(values, rv3d->viewquat);
424 static void rna_RegionView3D_view_rotation_set(PointerRNA *ptr, const float *values)
426 RegionView3D *rv3d= (RegionView3D *)(ptr->data);
427 invert_qt_qt(rv3d->viewquat, values);
430 static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values)
432 RegionView3D *rv3d= (RegionView3D *)(ptr->data);
433 negate_v3_v3(rv3d->ofs, values);
434 ED_view3d_from_m4((float (*)[4])values, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
437 /* Space Image Editor */
439 static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
441 return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
444 static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
446 paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
448 ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
451 static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)
453 SpaceImage *sima= (SpaceImage*)(ptr->data);
454 return ED_space_image_show_render(sima);
457 static int rna_SpaceImageEditor_show_paint_get(PointerRNA *ptr)
459 SpaceImage *sima= (SpaceImage*)(ptr->data);
460 return ED_space_image_show_paint(sima);
463 static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
465 SpaceImage *sima= (SpaceImage*)(ptr->data);
466 bScreen *sc= (bScreen*)ptr->id.data;
467 return ED_space_image_show_uvedit(sima, sc->scene->obedit);
470 static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
472 SpaceImage *sima= (SpaceImage*)(ptr->data);
473 bScreen *sc= (bScreen*)ptr->id.data;
475 ED_space_image_set(NULL, sima, sc->scene, sc->scene->obedit, (Image*)value.data);
478 static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr,
479 PropertyRNA *UNUSED(prop), int *free)
481 SpaceImage *sima= (SpaceImage*)ptr->data;
482 EnumPropertyItem *item= NULL;
485 int zbuf, alpha, totitem= 0;
487 ibuf= ED_space_image_acquire_buffer(sima, &lock);
489 alpha= ibuf && (ibuf->channels == 4);
490 zbuf= ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1));
492 ED_space_image_release_buffer(sima, lock);
495 return draw_channels_items;
497 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
500 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_USE_ALPHA);
501 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ALPHA);
504 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF);
507 RNA_enum_item_end(&item, &totitem);
513 static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values)
515 SpaceImage *sima= (SpaceImage*)ptr->data;
519 values[0] = values[1] = 1;
522 sa= rna_area_from_space(ptr); /* can be NULL */
523 ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
525 ED_space_image_zoom(sima, ar, &values[0], &values[1]);
529 static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values)
531 SpaceImage *sima= (SpaceImage*)ptr->data;
533 if (sima->flag & SI_COORDFLOATS) {
534 copy_v2_v2(values, sima->cursor);
537 ED_space_image_size(sima, &w, &h);
539 values[0] = sima->cursor[0] * w;
540 values[1] = sima->cursor[1] * h;
544 static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const float *values)
546 SpaceImage *sima= (SpaceImage*)ptr->data;
548 if (sima->flag & SI_COORDFLOATS) {
549 copy_v2_v2(sima->cursor, values);
552 ED_space_image_size(sima, &w, &h);
554 sima->cursor[0] = values[0] / w;
555 sima->cursor[1] = values[1] / h;
559 static void rna_SpaceImageEditor_curves_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
561 SpaceImage *sima= (SpaceImage*)ptr->data;
565 ibuf= ED_space_image_acquire_buffer(sima, &lock);
567 curvemapping_do_ibuf(sima->cumap, ibuf);
568 ED_space_image_release_buffer(sima, lock);
570 WM_main_add_notifier(NC_IMAGE, sima->image);
573 static void rna_SpaceImageEditor_scopes_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
575 SpaceImage *sima= (SpaceImage*)ptr->data;
579 ibuf= ED_space_image_acquire_buffer(sima, &lock);
581 scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT);
582 WM_main_add_notifier(NC_IMAGE, sima->image);
584 ED_space_image_release_buffer(sima, lock);
587 /* Space Text Editor */
589 static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value)
591 SpaceText *st= (SpaceText*)(ptr->data);
597 static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
599 SpaceText *st= (SpaceText*)(ptr->data);
601 st->text= value.data;
603 WM_main_add_notifier(NC_TEXT|NA_SELECTED, st->text);
606 static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
608 SpaceText *st= (SpaceText*)ptr->data;
611 WM_main_add_notifier(NC_TEXT|NA_EDITED, st->text);
615 /* Space Properties */
617 /* note: this function exists only to avoid id refcounting */
618 static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value)
620 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
621 sbuts->pinid= value.data;
624 static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
626 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
629 return ID_code_to_RNA_type(GS(sbuts->pinid->name));
634 static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
636 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
637 ID *id = sbuts->pinid;
640 sbuts->flag &= ~SB_PIN_CONTEXT;
644 switch (GS(id->name)) {
646 WM_main_add_notifier(NC_MATERIAL|ND_SHADING, NULL);
649 WM_main_add_notifier(NC_TEXTURE, NULL);
652 WM_main_add_notifier(NC_WORLD, NULL);
655 WM_main_add_notifier(NC_LAMP, NULL);
661 static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value)
663 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
666 sbuts->mainbuser = value;
669 static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
671 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
678 static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
680 ConsoleLine *ci= (ConsoleLine*)ptr->data;
681 strcpy(value, ci->line);
684 static int rna_ConsoleLine_body_length(PointerRNA *ptr)
686 ConsoleLine *ci= (ConsoleLine*)ptr->data;
690 static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value)
692 ConsoleLine *ci= (ConsoleLine*)ptr->data;
693 int len= strlen(value);
695 if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */
697 ci->line= MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
698 ci->len_alloc= len + 1;
700 memcpy(ci->line, value, len + 1);
703 if(ci->cursor > len) /* clamp the cursor */
707 static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max)
709 ConsoleLine *ci= (ConsoleLine*)ptr->data;
712 *max= ci->len; /* intentionally _not_ -1 */
715 /* Space Dopesheet */
717 static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA value)
719 SpaceAction *saction= (SpaceAction*)(ptr->data);
720 bAction *act = (bAction*)value.data;
722 if ((act == NULL) || (act->idroot == 0)) {
723 /* just set if we're clearing the action or if the action is "amorphous" still */
724 saction->action= act;
727 /* action to set must strictly meet the mode criteria... */
728 if (saction->mode == SACTCONT_ACTION) {
729 /* currently, this is "object-level" only, until we have some way of specifying this */
730 if (act->idroot == ID_OB)
731 saction->action = act;
733 printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n",
736 else if (saction->mode == SACTCONT_SHAPEKEY) {
737 /* as the name says, "shapekey-level" only... */
738 if (act->idroot == ID_KE)
739 saction->action = act;
741 printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n",
745 printf("ACK: who's trying to set an action while not in a mode displaying a single Action only?\n");
750 static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
752 SpaceAction *saction= (SpaceAction*)(ptr->data);
753 Object *obact= (scene->basact)? scene->basact->object: NULL;
755 /* we must set this action to be the one used by active object (if not pinned) */
756 if (obact/* && saction->pin == 0*/) {
757 AnimData *adt = NULL;
759 if (saction->mode == SACTCONT_ACTION) {
760 // TODO: context selector could help decide this with more control?
761 adt= BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
763 else if (saction->mode == SACTCONT_SHAPEKEY) {
764 Key *key = ob_get_key(obact);
766 adt= BKE_id_add_animdata(&key->id); /* this only adds if non-existant */
771 /* fix id-count of action we're replacing */
772 id_us_min(&adt->action->id);
774 /* show new id-count of action we're replacing */
775 adt->action= saction->action;
776 id_us_plus(&adt->action->id);
779 /* force depsgraph flush too */
780 DAG_id_tag_update(&obact->id, OB_RECALC_OB|OB_RECALC_DATA);
784 static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
786 SpaceAction *saction= (SpaceAction*)(ptr->data);
787 Object *obact= (scene->basact)? scene->basact->object: NULL;
789 /* special exceptions for ShapeKey Editor mode */
790 if (saction->mode == SACTCONT_SHAPEKEY) {
791 Key *key = ob_get_key(obact);
793 /* 1) update the action stored for the editor */
795 saction->action = (key->adt)? key->adt->action : NULL;
797 saction->action = NULL;
799 /* 2) enable 'show sliders' by default, since one of the main
800 * points of the ShapeKey Editor is to provide a one-stop shop
801 * for controlling the shapekeys, whose main control is the value
803 saction->flag |= SACTION_SLIDERS;
805 /* make sure action stored is valid */
806 else if (saction->mode == SACTCONT_ACTION) {
807 /* 1) update the action stored for the editor */
808 // TODO: context selector could help decide this with more control?
810 saction->action = (obact->adt)? obact->adt->action : NULL;
812 saction->action = NULL;
816 /* Space Graph Editor */
818 static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
820 ScrArea *sa= rna_area_from_space(ptr);
822 /* after changing view mode, must force recalculation of F-Curve colors
823 * which can only be achieved using refresh as opposed to redraw
825 ED_area_tag_refresh(sa);
828 static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr)
830 SpaceIpo *sipo= (SpaceIpo*)(ptr->data);
831 return (sipo->ghostCurves.first != NULL);
834 static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
836 ScrArea *sa= rna_area_from_space(ptr);
837 ED_area_tag_refresh(sa);
840 static float rna_BackgroundImage_opacity_get(PointerRNA *ptr)
842 BGpic *bgpic= (BGpic *)ptr->data;
843 return 1.0f-bgpic->blend;
846 static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
848 BGpic *bgpic= (BGpic *)ptr->data;
849 bgpic->blend = 1.0f - value;
852 /* Space Node Editor */
854 static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value)
856 SpaceNode *snode= (SpaceNode*)ptr->data;
857 bNodeTree *ntree= (bNodeTree*)value.data;
859 /* exclude group trees, only trees of the active type */
860 return (ntree->nodetype==0 && ntree->type == snode->treetype);
863 static void rna_SpaceNodeEditor_node_tree_update(Main *bmain, Scene *scene, PointerRNA *ptr)
865 SpaceNode *snode= (SpaceNode*)ptr->data;
867 ED_node_tree_update(snode, scene);
870 static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr),
871 PropertyRNA *UNUSED(prop), int *free)
873 Scene *scene = CTX_data_scene(C);
874 Object *ob = CTX_data_active_object(C);
875 EnumPropertyItem *item= NULL;
876 EnumPropertyItem tmp= {0, "", 0, "", ""};
880 if(ob->type == OB_LAMP) {
881 tmp.value = SB_TEXC_MAT_OR_LAMP;
882 tmp.description = "Show Lamp Textures";
883 tmp.identifier = "LAMP";
884 tmp.icon = ICON_LAMP_POINT;
885 RNA_enum_item_add(&item, &totitem, &tmp);
887 else if(ob->totcol) {
888 tmp.value = SB_TEXC_MAT_OR_LAMP;
889 tmp.description = "Show Material Textures";
890 tmp.identifier = "MATERIAL";
891 tmp.icon = ICON_MATERIAL;
892 RNA_enum_item_add(&item, &totitem, &tmp);
895 if(ob->particlesystem.first) {
896 tmp.value = SB_TEXC_PARTICLES;
897 tmp.description = "Show Particle Textures";
898 tmp.identifier = "PARTICLE";
899 tmp.icon = ICON_PARTICLES;
900 RNA_enum_item_add(&item, &totitem, &tmp);
904 if(scene && scene->world) {
905 tmp.value = SB_TEXC_WORLD;
906 tmp.description = "Show World Textures";
907 tmp.identifier = "WORLD";
908 tmp.icon = ICON_WORLD;
909 RNA_enum_item_add(&item, &totitem, &tmp);
912 tmp.value = SB_TEXC_BRUSH;
913 tmp.description = "Show Brush Textures";
914 tmp.identifier = "BRUSH";
915 tmp.icon = ICON_BRUSH_DATA;
916 RNA_enum_item_add(&item, &totitem, &tmp);
918 RNA_enum_item_end(&item, &totitem);
926 static void rna_def_space(BlenderRNA *brna)
931 srna= RNA_def_struct(brna, "Space", NULL);
932 RNA_def_struct_sdna(srna, "SpaceLink");
933 RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area");
934 RNA_def_struct_refine_func(srna, "rna_Space_refine");
936 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
937 RNA_def_property_enum_sdna(prop, NULL, "spacetype");
938 RNA_def_property_enum_items(prop, space_type_items);
939 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
940 RNA_def_property_ui_text(prop, "Type", "Space data type");
943 static void rna_def_space_image_uv(BlenderRNA *brna)
948 static EnumPropertyItem sticky_mode_items[] = {
949 {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"},
950 {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location",
951 "Select UVs that are at the same location and share a mesh vertex"},
952 {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex",
953 "Select UVs that share mesh vertex, irrespective if they are in the same location"},
954 {0, NULL, 0, NULL, NULL}};
956 static EnumPropertyItem dt_uv_items[] = {
957 {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"},
958 {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"},
959 {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"},
960 {SI_UVDT_WHITE, "WHITE", 0, "White", "Draw white edges"},
961 {0, NULL, 0, NULL, NULL}};
963 static EnumPropertyItem dt_uvstretch_items[] = {
964 {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
965 {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
966 {0, NULL, 0, NULL, NULL}};
968 static EnumPropertyItem pivot_items[] = {
969 {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
970 {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
971 {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
972 {0, NULL, 0, NULL, NULL}};
974 srna= RNA_def_struct(brna, "SpaceUVEditor", NULL);
975 RNA_def_struct_sdna(srna, "SpaceImage");
976 RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
977 RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space");
980 prop= RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
981 RNA_def_property_enum_sdna(prop, NULL, "sticky");
982 RNA_def_property_enum_items(prop, sticky_mode_items);
983 RNA_def_property_ui_text(prop, "Sticky Selection Mode",
984 "Automatically select also UVs sharing the same vertex as the ones being selected");
985 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
988 prop= RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE);
989 RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
990 RNA_def_property_enum_items(prop, dt_uv_items);
991 RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for drawing UV edges");
992 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
994 prop= RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE);
995 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
996 RNA_def_property_ui_text(prop, "Draw Smooth Edges", "Draw UV edges anti-aliased");
997 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
999 prop= RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE);
1000 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
1001 RNA_def_property_ui_text(prop, "Draw Stretch",
1002 "Draw faces colored according to the difference in shape between UVs and "
1003 "their 3D coordinates (blue for low distortion, red for high distortion)");
1004 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1006 prop= RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE);
1007 RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
1008 RNA_def_property_enum_items(prop, dt_uvstretch_items);
1009 RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw");
1010 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1012 prop= RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE);
1013 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW);
1014 RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges after modifiers are applied");
1015 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1017 prop= RNA_def_property(srna, "show_other_objects", PROP_BOOLEAN, PROP_NONE);
1018 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_OTHER);
1019 RNA_def_property_ui_text(prop, "Draw Other Objects", "Draw other selected objects that share the same image");
1020 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1022 prop= RNA_def_property(srna, "show_normalized_coords", PROP_BOOLEAN, PROP_NONE);
1023 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
1024 RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels");
1025 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1027 prop= RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
1028 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWFACES);
1029 RNA_def_property_ui_text(prop, "Draw Faces", "Draw faces over the image");
1030 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1032 prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
1033 RNA_def_property_array(prop, 2);
1034 RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
1035 "rna_SpaceImageEditor_cursor_location_set", NULL);
1036 RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
1037 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1039 /* todo: move edge and face drawing options here from G.f */
1041 prop= RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
1042 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
1043 RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing");
1044 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1046 prop= RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
1047 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
1048 RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing");
1049 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1051 prop= RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
1052 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
1053 RNA_def_property_ui_text(prop, "Live Unwrap",
1054 "Continuously unwrap the selected UV island while transforming pinned vertices");
1055 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1057 prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
1058 RNA_def_property_enum_sdna(prop, NULL, "around");
1059 RNA_def_property_enum_items(prop, pivot_items);
1060 RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
1061 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1064 static void rna_def_space_outliner(BlenderRNA *brna)
1069 static EnumPropertyItem display_mode_items[] = {
1070 {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", "Display datablocks in all scenes"},
1071 {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", "Display datablocks in current scene"},
1072 {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display datablocks in visible layers"},
1073 {SO_SELECTED, "SELECTED", 0, "Selected", "Display datablocks of selected objects"},
1074 {SO_ACTIVE, "ACTIVE", 0, "Active", "Display datablocks of active object"},
1075 {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", "Display datablocks of all objects of same type as selected object"},
1076 {SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their datablocks"},
1077 {SO_LIBRARIES, "LIBRARIES", 0, "Libraries", "Display libraries"},
1078 {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence datablocks"},
1079 {SO_DATABLOCKS, "DATABLOCKS", 0, "Datablocks", "Display raw datablocks"},
1080 {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", "Display the user preference datablocks"},
1081 {SO_KEYMAP, "KEYMAPS", 0, "Key Maps", "Display keymap datablocks"},
1082 {0, NULL, 0, NULL, NULL}};
1084 srna= RNA_def_struct(brna, "SpaceOutliner", "Space");
1085 RNA_def_struct_sdna(srna, "SpaceOops");
1086 RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
1088 prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
1089 RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
1090 RNA_def_property_enum_items(prop, display_mode_items);
1091 RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
1092 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
1094 prop= RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
1095 RNA_def_property_string_sdna(prop, NULL, "search_string");
1096 RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
1097 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
1099 prop= RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE);
1100 RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE);
1101 RNA_def_property_ui_text(prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string");
1102 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
1104 prop= RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE);
1105 RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE);
1106 RNA_def_property_ui_text(prop, "Complete Matches Only", "Only use complete matches of search string");
1107 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
1109 prop= RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
1110 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
1111 RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");
1112 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
1115 static void rna_def_background_image(BlenderRNA *brna)
1120 /* note: combinations work but dont flip so arnt that useful */
1121 static EnumPropertyItem bgpic_axis_items[] = {
1122 {0, "", 0, "X Axis", ""},
1123 {(1<<RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"},
1124 {(1<<RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", "Show background image while looking to the right"},
1125 /*{(1<<RV3D_VIEW_LEFT)|(1<<RV3D_VIEW_RIGHT), "LEFT_RIGHT", 0, "Left/Right", ""},*/
1126 {0, "", 0, "Y Axis", ""},
1127 {(1<<RV3D_VIEW_BACK), "BACK", 0, "Back", "Show background image in back view"},
1128 {(1<<RV3D_VIEW_FRONT), "FRONT", 0, "Front", "Show background image in front view"},
1129 /*{(1<<RV3D_VIEW_BACK)|(1<<RV3D_VIEW_FRONT), "BACK_FRONT", 0, "Back/Front", ""},*/
1130 {0, "", 0, "Z Axis", ""},
1131 {(1<<RV3D_VIEW_BOTTOM), "BOTTOM", 0, "Bottom", "Show background image in bottom view"},
1132 {(1<<RV3D_VIEW_TOP), "TOP", 0, "Top", "Show background image in top view"},
1133 /*{(1<<RV3D_VIEW_BOTTOM)|(1<<RV3D_VIEW_TOP), "BOTTOM_TOP", 0, "Top/Bottom", ""},*/
1134 {0, "", 0, "Other", ""},
1135 {0, "ALL", 0, "All Views", "Show background image in all views"},
1136 {(1<<RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", "Show background image in camera view"},
1137 {0, NULL, 0, NULL, NULL}};
1139 srna= RNA_def_struct(brna, "BackgroundImage", NULL);
1140 RNA_def_struct_sdna(srna, "BGpic");
1141 RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3d View background");
1143 prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1144 RNA_def_property_pointer_sdna(prop, NULL, "ima");
1145 RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
1146 RNA_def_property_flag(prop, PROP_EDITABLE);
1147 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1149 prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
1150 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1151 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
1152 RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
1153 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1155 prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
1156 RNA_def_property_float_sdna(prop, NULL, "xof");
1157 RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the world origin");
1158 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1160 prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
1161 RNA_def_property_float_sdna(prop, NULL, "yof");
1162 RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin");
1163 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1165 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1166 RNA_def_property_float_sdna(prop, NULL, "size");
1167 RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image");
1168 RNA_def_property_range(prop, 0.0, FLT_MAX);
1169 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1171 prop= RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
1172 RNA_def_property_float_sdna(prop, NULL, "blend");
1173 RNA_def_property_float_funcs(prop, "rna_BackgroundImage_opacity_get", "rna_BackgroundImage_opacity_set", NULL);
1174 RNA_def_property_ui_text(prop, "Opacity", "Image opacity to blend the image against the background color");
1175 RNA_def_property_range(prop, 0.0, 1.0);
1176 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1178 prop= RNA_def_property(srna, "view_axis", PROP_ENUM, PROP_NONE);
1179 RNA_def_property_enum_sdna(prop, NULL, "view");
1180 RNA_def_property_enum_items(prop, bgpic_axis_items);
1181 RNA_def_property_ui_text(prop, "Image Axis", "The axis to display the image on");
1182 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1184 prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
1185 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_EXPANDED);
1186 RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
1187 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
1191 static void rna_def_space_view3d(BlenderRNA *brna)
1195 const int matrix_dimsize[]= {4, 4};
1197 static EnumPropertyItem pivot_items[] = {
1198 {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
1199 "Pivot around bounding box center of selected object(s)"},
1200 {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
1201 {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", "Pivot around each object's own origin"},
1202 {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", "Pivot around the median point of selected objects"},
1203 {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"},
1204 {0, NULL, 0, NULL, NULL}};
1206 static EnumPropertyItem rv3d_persp_items[] = {
1207 {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
1208 {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
1209 {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
1210 {0, NULL, 0, NULL, NULL}};
1212 srna= RNA_def_struct(brna, "SpaceView3D", "Space");
1213 RNA_def_struct_sdna(srna, "View3D");
1214 RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
1216 prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
1217 RNA_def_property_flag(prop, PROP_EDITABLE);
1218 RNA_def_property_pointer_sdna(prop, NULL, "camera");
1219 RNA_def_property_ui_text(prop, "Camera", "Active camera used in this view (when unlocked from the scene's active camera)");
1220 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1222 prop= RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
1223 RNA_def_property_flag(prop, PROP_EDITABLE);
1224 RNA_def_property_pointer_sdna(prop, NULL, "ob_centre");
1225 RNA_def_property_ui_text(prop, "Lock to Object", "3D View center is locked to this object's position");
1226 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1228 prop= RNA_def_property(srna, "lock_bone", PROP_STRING, PROP_NONE);
1229 RNA_def_property_string_sdna(prop, NULL, "ob_centre_bone");
1230 RNA_def_property_ui_text(prop, "Lock to Bone", "3D View center is locked to this bone's position");
1231 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1233 prop= RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
1234 RNA_def_property_boolean_sdna(prop, NULL, "ob_centre_cursor", 1);
1235 RNA_def_property_ui_text(prop, "Lock to Cursor", "3D View center is locked to the cursor's position");
1236 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1238 prop= RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE);
1239 RNA_def_property_enum_sdna(prop, NULL, "drawtype");
1240 RNA_def_property_enum_items(prop, viewport_shade_items);
1241 RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
1242 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1244 prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
1245 RNA_def_property_pointer_sdna(prop, NULL, "localvd");
1246 RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility");
1248 prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
1249 RNA_def_property_array(prop, 3);
1250 RNA_def_property_float_funcs(prop, "rna_View3D_CursorLocation_get", "rna_View3D_CursorLocation_set", NULL);
1251 RNA_def_property_ui_text(prop, "3D Cursor Location", "3D cursor location for this view (dependent on local view setting)");
1252 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
1253 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1255 prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
1256 RNA_def_property_float_sdna(prop, NULL, "lens");
1257 RNA_def_property_ui_text(prop, "Lens", "Lens angle (mm) in perspective view");
1258 RNA_def_property_range(prop, 1.0f, 250.0f);
1259 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1261 prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
1262 RNA_def_property_float_sdna(prop, NULL, "near");
1263 RNA_def_property_range(prop, 0.001f, FLT_MAX);
1264 RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance");
1265 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1267 prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
1268 RNA_def_property_float_sdna(prop, NULL, "far");
1269 RNA_def_property_range(prop, 1.0f, FLT_MAX);
1270 RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance");
1271 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1273 prop= RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE);
1274 RNA_def_property_float_sdna(prop, NULL, "grid");
1275 RNA_def_property_ui_text(prop, "Grid Scale", "Distance between 3D View grid lines");
1276 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1277 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1279 prop= RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
1280 RNA_def_property_int_sdna(prop, NULL, "gridlines");
1281 RNA_def_property_ui_text(prop, "Grid Lines", "Number of grid lines to display in perspective view");
1282 RNA_def_property_range(prop, 0, 1024);
1283 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1285 prop= RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
1286 RNA_def_property_int_sdna(prop, NULL, "gridsubdiv");
1287 RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions between grid lines");
1288 RNA_def_property_range(prop, 1, 1024);
1289 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1291 prop= RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE);
1292 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
1293 RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view");
1294 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1296 prop= RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
1297 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);
1298 RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view");
1299 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1301 prop= RNA_def_property(srna, "show_axis_y", PROP_BOOLEAN, PROP_NONE);
1302 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y);
1303 RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view");
1304 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1306 prop= RNA_def_property(srna, "show_axis_z", PROP_BOOLEAN, PROP_NONE);
1307 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z);
1308 RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view");
1309 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1311 prop= RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE);
1312 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE);
1313 RNA_def_property_ui_text(prop, "Outline Selected",
1314 "Show an outline highlight around selected objects in non-wireframe views");
1315 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1317 prop= RNA_def_property(srna, "show_all_objects_origin", PROP_BOOLEAN, PROP_NONE);
1318 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS);
1319 RNA_def_property_ui_text(prop, "All Object Origins",
1320 "Show the object origin center dot for all (selected and unselected) objects");
1321 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1323 prop= RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
1324 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
1325 RNA_def_property_ui_text(prop, "Relationship Lines", "Show dashed lines indicating parent or constraint relationships");
1326 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1328 prop= RNA_def_property(srna, "show_textured_solid", PROP_BOOLEAN, PROP_NONE);
1329 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_TEX);
1330 RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view");
1331 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1333 prop= RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
1334 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
1335 RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");
1336 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1338 prop= RNA_def_property(srna, "show_only_render", PROP_BOOLEAN, PROP_NONE);
1339 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
1340 RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered");
1341 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1343 prop= RNA_def_property(srna, "use_occlude_geometry", PROP_BOOLEAN, PROP_NONE);
1344 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT);
1345 RNA_def_property_ui_text(prop, "Occlude Geometry", "Limit selection to visible (clipped with depth buffer)");
1346 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
1347 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1349 prop= RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
1350 RNA_def_property_collection_sdna(prop, NULL, "bgpicbase", NULL);
1351 RNA_def_property_struct_type(prop, "BackgroundImage");
1352 RNA_def_property_ui_text(prop, "Background Images", "List of background images");
1353 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1355 prop= RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
1356 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPICS);
1357 RNA_def_property_ui_text(prop, "Display Background Images", "Display reference images behind objects in the 3D View");
1358 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1360 prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
1361 RNA_def_property_enum_sdna(prop, NULL, "around");
1362 RNA_def_property_enum_items(prop, pivot_items);
1363 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
1364 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
1366 prop= RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
1367 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ALIGN);
1368 RNA_def_property_ui_text(prop, "Align", "Manipulate object centers only");
1369 RNA_def_property_ui_icon(prop, ICON_ALIGN, 0);
1370 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
1372 prop= RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
1373 RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_USE_MANIPULATOR);
1374 RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms");
1375 RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0);
1376 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1378 prop= RNA_def_property(srna, "use_manipulator_translate", PROP_BOOLEAN, PROP_NONE);
1379 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_TRANSLATE);
1380 RNA_def_property_ui_text(prop, "Manipulator Translate", "Use the manipulator for movement transformations");
1381 RNA_def_property_ui_icon(prop, ICON_MAN_TRANS, 0);
1382 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1384 prop= RNA_def_property(srna, "use_manipulator_rotate", PROP_BOOLEAN, PROP_NONE);
1385 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_ROTATE);
1386 RNA_def_property_ui_text(prop, "Manipulator Rotate", "Use the manipulator for rotation transformations");
1387 RNA_def_property_ui_icon(prop, ICON_MAN_ROT, 0);
1388 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1390 prop= RNA_def_property(srna, "use_manipulator_scale", PROP_BOOLEAN, PROP_NONE);
1391 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_SCALE);
1392 RNA_def_property_ui_text(prop, "Manipulator Scale", "Use the manipulator for scale transformations");
1393 RNA_def_property_ui_icon(prop, ICON_MAN_SCALE, 0);
1394 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1396 prop= RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE);
1397 RNA_def_property_enum_sdna(prop, NULL, "twmode");
1398 RNA_def_property_enum_items(prop, transform_orientation_items);
1399 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformOrientation_itemf");
1400 RNA_def_property_ui_text(prop, "Transform Orientation", "Transformation orientation");
1401 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1403 prop= RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE);
1404 RNA_def_property_struct_type(prop, "TransformOrientation");
1405 RNA_def_property_pointer_funcs(prop, "rna_CurrentOrientation_get", NULL, NULL, NULL);
1406 RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current transformation orientation");
1408 prop= RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
1409 RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
1410 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set");
1411 RNA_def_property_ui_text(prop, "Lock Camera and Layers",
1412 "Use the scene's active camera and layers in this view, rather than local layers");
1413 RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1);
1414 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1416 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1417 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
1418 RNA_def_property_array(prop, 20);
1419 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_layer_set");
1420 RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View");
1421 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update");
1423 prop= RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1424 RNA_def_property_boolean_sdna(prop, NULL, "lay_used", 1);
1425 RNA_def_property_array(prop, 20);
1426 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1427 RNA_def_property_ui_text(prop, "Used Layers", "Layers that contain something");
1429 prop= RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
1430 RNA_def_property_struct_type(prop, "RegionView3D");
1431 RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_3d_get", NULL, NULL, NULL);
1432 RNA_def_property_ui_text(prop, "3D Region", "3D region in this space, in case of quad view the camera region");
1434 prop= RNA_def_property(srna, "region_quadview", PROP_POINTER, PROP_NONE);
1435 RNA_def_property_struct_type(prop, "RegionView3D");
1436 RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_quadview_get", NULL, NULL, NULL);
1437 RNA_def_property_ui_text(prop, "Quad View Region", "3D region that defines the quad view settings");
1441 srna= RNA_def_struct(brna, "RegionView3D", NULL);
1442 RNA_def_struct_sdna(srna, "RegionView3D");
1443 RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data");
1445 prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
1446 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_LOCKED);
1447 RNA_def_property_ui_text(prop, "Lock", "Lock view rotation in side views");
1448 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
1450 prop= RNA_def_property(srna, "show_sync_view", PROP_BOOLEAN, PROP_NONE);
1451 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXVIEW);
1452 RNA_def_property_ui_text(prop, "Box", "Sync view position between side views");
1453 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
1455 prop= RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
1456 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
1457 RNA_def_property_ui_text(prop, "Clip", "Clip objects based on what's visible in other side views");
1458 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_clip_update");
1460 prop= RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
1461 RNA_def_property_float_sdna(prop, NULL, "persmat");
1462 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX: for now, it's too risky for users to do this
1463 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1464 RNA_def_property_ui_text(prop, "Perspective Matrix", "Current perspective matrix of the 3D region");
1466 prop= RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX);
1467 RNA_def_property_float_sdna(prop, NULL, "viewmat");
1468 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1469 RNA_def_property_float_funcs(prop, NULL, "rna_RegionView3D_view_matrix_set", NULL);
1470 RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix of the 3D region");
1471 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1473 prop= RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
1474 RNA_def_property_enum_sdna(prop, NULL, "persp");
1475 RNA_def_property_enum_items(prop, rv3d_persp_items);
1476 RNA_def_property_ui_text(prop, "Perspective", "View Perspective");
1477 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1479 prop= RNA_def_property(srna, "is_perspective", PROP_BOOLEAN, PROP_NONE);
1480 RNA_def_property_boolean_sdna(prop, NULL, "is_persp", 1);
1481 RNA_def_property_ui_text(prop, "Is Perspective", "");
1482 RNA_def_property_flag(prop, PROP_EDITABLE);
1484 prop= RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
1486 RNA_def_property_float_sdna(prop, NULL, "ofs"); // cant use because its negated
1488 RNA_def_property_array(prop, 3);
1489 RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL);
1491 RNA_def_property_ui_text(prop, "View Location", "View pivot location");
1492 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
1493 RNA_def_property_update(prop, NC_WINDOW, NULL);
1495 prop= RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); // cant use because its inverted
1497 RNA_def_property_float_sdna(prop, NULL, "viewquat");
1499 RNA_def_property_array(prop, 4);
1500 RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_rotation_get", "rna_RegionView3D_view_rotation_set", NULL);
1502 RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
1503 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1505 /* not sure we need rna access to these but adding anyway */
1506 prop= RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
1507 RNA_def_property_float_sdna(prop, NULL, "dist");
1508 RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
1509 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1512 static void rna_def_space_buttons(BlenderRNA *brna)
1517 static EnumPropertyItem buttons_context_items[] = {
1518 {BCONTEXT_SCENE, "SCENE", ICON_SCENE, "Scene", "Scene"},
1519 {BCONTEXT_RENDER, "RENDER", ICON_SCENE_DATA, "Render", "Render"},
1520 {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
1521 {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
1522 {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Constraints"},
1523 {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifiers", "Modifiers"},
1524 {BCONTEXT_DATA, "DATA", 0, "Data", "Data"},
1525 {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"},
1526 {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT, "Bone Constraints", "Bone Constraints"},
1527 {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
1528 {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
1529 {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"},
1530 {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
1531 {0, NULL, 0, NULL, NULL}};
1533 static EnumPropertyItem align_items[] = {
1534 {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
1535 {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
1536 {0, NULL, 0, NULL, NULL}};
1538 static EnumPropertyItem buttons_texture_context_items[] = {
1539 {SB_TEXC_MAT_OR_LAMP, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
1540 {0, NULL, 0, NULL, NULL}}; //actually populated dynamically trough a function
1542 srna= RNA_def_struct(brna, "SpaceProperties", "Space");
1543 RNA_def_struct_sdna(srna, "SpaceButs");
1544 RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
1546 prop= RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
1547 RNA_def_property_enum_sdna(prop, NULL, "mainb");
1548 RNA_def_property_enum_items(prop, buttons_context_items);
1549 RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_context_set", NULL);
1550 RNA_def_property_ui_text(prop, "Context", "Type of active data to display and edit");
1551 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
1553 prop= RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
1554 RNA_def_property_enum_sdna(prop, NULL, "align");
1555 RNA_def_property_enum_items(prop, align_items);
1556 RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_align_set", NULL);
1557 RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels");
1558 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
1560 prop= RNA_def_property(srna, "texture_context", PROP_ENUM, PROP_NONE);
1561 RNA_def_property_enum_items(prop, buttons_texture_context_items);
1562 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceProperties_texture_context_itemf");
1563 RNA_def_property_ui_text(prop, "Texture Context", "Type of texture data to display and edit");
1564 RNA_def_property_update(prop, NC_TEXTURE, NULL);
1567 prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
1568 RNA_def_property_pointer_sdna(prop, NULL, "pinid");
1569 RNA_def_property_struct_type(prop, "ID");
1570 /* note: custom set function is ONLY to avoid rna setting a user for this. */
1571 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef", NULL);
1572 RNA_def_property_flag(prop, PROP_EDITABLE);
1573 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
1575 prop= RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
1576 RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
1577 RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
1580 static void rna_def_space_image(BlenderRNA *brna)
1585 srna= RNA_def_struct(brna, "SpaceImageEditor", "Space");
1586 RNA_def_struct_sdna(srna, "SpaceImage");
1587 RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data");
1590 prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1591 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL);
1592 RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
1593 RNA_def_property_flag(prop, PROP_EDITABLE);
1594 RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); // is handled in image editor too
1596 prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
1597 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1598 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
1599 RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
1600 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1602 prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
1603 RNA_def_property_pointer_sdna(prop, NULL, "cumap");
1604 RNA_def_property_ui_text(prop, "Curve", "Color curve mapping to use for displaying the image");
1605 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_curves_update");
1607 prop= RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
1608 RNA_def_property_pointer_sdna(prop, NULL, "scopes");
1609 RNA_def_property_struct_type(prop, "Scopes");
1610 RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize image statistics");
1611 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_scopes_update");
1613 prop= RNA_def_property(srna, "use_image_pin", PROP_BOOLEAN, PROP_NONE);
1614 RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
1615 RNA_def_property_ui_text(prop, "Image Pin", "Display current image regardless of object selection");
1616 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
1617 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1619 prop= RNA_def_property(srna, "sample_histogram", PROP_POINTER, PROP_NONE);
1620 RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist");
1621 RNA_def_property_struct_type(prop, "Histogram");
1622 RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line");
1624 prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
1625 RNA_def_property_array(prop, 2);
1626 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1627 RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL);
1628 RNA_def_property_ui_text(prop, "Zoom", "Zoom factor");
1631 prop= RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);
1632 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
1633 RNA_def_property_ui_text(prop, "Draw Repeated", "Draw the image repeated outside of the main view");
1634 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1636 prop= RNA_def_property(srna, "draw_channels", PROP_ENUM, PROP_NONE);
1637 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
1638 RNA_def_property_enum_items(prop, draw_channels_items);
1639 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_draw_channels_itemf");
1640 RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
1641 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1644 prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE);
1645 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1646 RNA_def_property_struct_type(prop, "SpaceUVEditor");
1647 RNA_def_property_pointer_funcs(prop, "rna_SpaceImageEditor_uvedit_get", NULL, NULL, NULL);
1648 RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings");
1651 prop= RNA_def_property(srna, "use_image_paint", PROP_BOOLEAN, PROP_NONE);
1652 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWTOOL);
1653 RNA_def_property_ui_text(prop, "Image Painting", "Enable image painting mode");
1654 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
1655 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_paint_update");
1658 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
1659 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
1660 RNA_def_property_flag(prop, PROP_EDITABLE);
1661 RNA_def_property_struct_type(prop, "GreasePencil");
1662 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
1663 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1665 prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
1666 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
1667 RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
1670 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
1671 RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
1672 RNA_def_property_ui_text(prop, "Update Automatically",
1673 "Update other affected window spaces automatically to reflect changes "
1674 "during interactive operations such as transform");
1677 prop= RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
1678 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_render_get", NULL);
1679 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1680 RNA_def_property_ui_text(prop, "Show Render", "Show render related properties");
1682 prop= RNA_def_property(srna, "show_paint", PROP_BOOLEAN, PROP_NONE);
1683 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_paint_get", NULL);
1684 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1685 RNA_def_property_ui_text(prop, "Show Paint", "Show paint related properties");
1687 prop= RNA_def_property(srna, "show_uvedit", PROP_BOOLEAN, PROP_NONE);
1688 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_uvedit_get", NULL);
1689 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1690 RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
1692 rna_def_space_image_uv(brna);
1695 static void rna_def_space_sequencer(BlenderRNA *brna)
1700 static EnumPropertyItem view_type_items[] = {
1701 {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
1702 {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
1703 {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer and Image Preview", ""},
1704 {0, NULL, 0, NULL, NULL}};
1706 static EnumPropertyItem display_mode_items[] = {
1707 {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
1708 {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
1709 {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
1710 {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", ICON_SEQ_HISTOGRAM, "Histogram", ""},
1711 {0, NULL, 0, NULL, NULL}};
1713 static EnumPropertyItem proxy_render_size_items[] = {
1714 {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
1715 {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
1716 {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
1717 {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
1718 {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
1719 {SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
1720 {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
1721 {0, NULL, 0, NULL, NULL}};
1723 srna= RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
1724 RNA_def_struct_sdna(srna, "SpaceSeq");
1725 RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
1727 /* view type, fairly important */
1728 prop= RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
1729 RNA_def_property_enum_sdna(prop, NULL, "view");
1730 RNA_def_property_enum_items(prop, view_type_items);
1731 RNA_def_property_ui_text(prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)");
1732 RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update");
1734 /* display type, fairly important */
1735 prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
1736 RNA_def_property_enum_sdna(prop, NULL, "mainb");
1737 RNA_def_property_enum_items(prop, display_mode_items);
1738 RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output");
1739 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1742 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
1743 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
1744 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
1745 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1747 prop= RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
1748 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
1749 RNA_def_property_ui_text(prop, "Draw Frames", "Draw frames rather than seconds");
1750 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1752 prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
1753 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS);
1754 RNA_def_property_ui_text(prop, "Transform Markers", "Transform markers as well as strips");
1755 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1757 prop= RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE);
1758 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPERATED);
1759 RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview");
1760 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1762 prop= RNA_def_property(srna, "show_safe_margin", PROP_BOOLEAN, PROP_NONE);
1763 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_SAFE_MARGINS);
1764 RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");
1765 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1767 prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
1768 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL);
1769 RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
1770 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1773 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
1774 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
1775 RNA_def_property_struct_type(prop, "UnknownType");
1776 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
1777 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1779 prop= RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
1780 RNA_def_property_int_sdna(prop, NULL, "chanshown");
1781 RNA_def_property_ui_text(prop, "Display Channel",
1782 "The channel number shown in the image preview. 0 is the result of all strips combined");
1783 RNA_def_property_range(prop, -5, MAXSEQ);
1784 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1786 prop= RNA_def_property(srna, "draw_overexposed", PROP_INT, PROP_NONE);
1787 RNA_def_property_int_sdna(prop, NULL, "zebra");
1788 RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes");
1789 RNA_def_property_range(prop, 0, 110);
1790 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1792 prop= RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
1793 RNA_def_property_enum_sdna(prop, NULL, "render_size");
1794 RNA_def_property_enum_items(prop, proxy_render_size_items);
1795 RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
1796 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1799 /* not sure we need rna access to these but adding anyway */
1800 prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
1801 RNA_def_property_float_sdna(prop, NULL, "xof");
1802 RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the view center");
1803 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1805 prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
1806 RNA_def_property_float_sdna(prop, NULL, "yof");
1807 RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the view center");
1808 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1810 prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
1811 RNA_def_property_float_sdna(prop, NULL, "zoom");
1812 RNA_def_property_ui_text(prop, "Zoom", "Display zoom level");
1813 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1816 static void rna_def_space_text(BlenderRNA *brna)
1821 srna= RNA_def_struct(brna, "SpaceTextEditor", "Space");
1822 RNA_def_struct_sdna(srna, "SpaceText");
1823 RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data");
1826 prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
1827 RNA_def_property_flag(prop, PROP_EDITABLE);
1828 RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space");
1829 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL, NULL);
1830 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1833 prop= RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
1834 RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
1835 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
1836 RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space");
1837 RNA_def_property_ui_icon(prop, ICON_WORDWRAP_OFF, 1);
1838 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1840 prop= RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
1841 RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
1842 RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text");
1843 RNA_def_property_ui_icon(prop, ICON_LINENUMBERS_OFF, 1);
1844 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1846 prop= RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
1847 RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
1848 RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
1849 RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 1);
1850 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1852 prop= RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
1853 RNA_def_property_boolean_sdna(prop, NULL, "line_hlight", 0);
1854 RNA_def_property_ui_text(prop, "Highlight Line", "Highlight the current line");
1855 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1857 prop= RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
1858 RNA_def_property_int_sdna(prop, NULL, "tabnumber");
1859 RNA_def_property_range(prop, 2, 8);
1860 RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with");
1861 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, "rna_SpaceTextEditor_updateEdited");
1863 prop= RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE);
1864 RNA_def_property_int_sdna(prop, NULL, "lheight");
1865 RNA_def_property_range(prop, 8, 32);
1866 RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
1867 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1869 prop= RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE);
1870 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_SHOW_MARGIN);
1871 RNA_def_property_ui_text(prop, "Show Margin", "Show right margin");
1872 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1874 prop= RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE);
1875 RNA_def_property_int_sdna(prop, NULL, "margin_column");
1876 RNA_def_property_range(prop, 0, 1024);
1877 RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at");
1878 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1880 /* functionality options */
1881 prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
1882 RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1);
1883 RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
1884 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1886 prop= RNA_def_property(srna, "use_live_edit", PROP_BOOLEAN, PROP_NONE);
1887 RNA_def_property_boolean_sdna(prop, NULL, "live_edit", 1);
1888 RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
1889 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1892 prop= RNA_def_property(srna, "use_find_all", PROP_BOOLEAN, PROP_NONE);
1893 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
1894 RNA_def_property_ui_text(prop, "Find All", "Search in all text datablocks, instead of only the active one");
1895 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1897 prop= RNA_def_property(srna, "use_find_wrap", PROP_BOOLEAN, PROP_NONE);
1898 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_WRAP);
1899 RNA_def_property_ui_text(prop, "Find Wrap", "Search again from the start of the file when reaching the end");
1900 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1902 prop= RNA_def_property(srna, "use_match_case", PROP_BOOLEAN, PROP_NONE);
1903 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_MATCH_CASE);
1904 RNA_def_property_ui_text(prop, "Match case", "Search string is sensitive to uppercase and lowercase letters");
1905 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1907 prop= RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
1908 RNA_def_property_string_sdna(prop, NULL, "findstr");
1909 RNA_def_property_ui_text(prop, "Find Text", "Text to search for with the find tool");
1910 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1912 prop= RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
1913 RNA_def_property_string_sdna(prop, NULL, "replacestr");
1914 RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool");
1915 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1918 static void rna_def_space_dopesheet(BlenderRNA *brna)
1923 // XXX: action-editor is currently for object-level only actions, so show that using object-icon hint
1924 static EnumPropertyItem mode_items[] = {
1925 {SACTCONT_DOPESHEET, "DOPESHEET", ICON_OOPS, "DopeSheet", "DopeSheet Editor"},
1926 {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Action Editor"},
1927 {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "ShapeKey Editor", "ShapeKey Editor"},
1928 {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Grease Pencil"},
1929 {0, NULL, 0, NULL, NULL}};
1932 srna= RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space");
1933 RNA_def_struct_sdna(srna, "SpaceAction");
1934 RNA_def_struct_ui_text(srna, "Space DopeSheet Editor", "DopeSheet space data");
1937 prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1938 RNA_def_property_flag(prop, PROP_EDITABLE);
1939 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL, "rna_Action_actedit_assign_poll");
1940 RNA_def_property_ui_text(prop, "Action", "Action displayed and edited in this space");
1941 RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, "rna_SpaceDopeSheetEditor_action_update");
1944 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1945 RNA_def_property_enum_sdna(prop, NULL, "mode");
1946 RNA_def_property_enum_items(prop, mode_items);
1947 RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
1948 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
1951 prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
1952 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_DRAWTIME);
1953 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, only set with operator
1954 RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
1955 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1957 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
1958 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWCFRANUM);
1959 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
1960 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1962 prop= RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
1963 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SLIDERS);
1964 RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
1965 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1967 prop= RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE);
1968 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW);
1969 RNA_def_property_ui_text(prop, "Show Pose Markers",
1970 "Show markers belonging to the active action instead of Scene markers "
1971 "(Action and Shape Key Editors only)");
1972 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1975 prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
1976 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
1977 RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
1978 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1980 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
1981 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOREALTIMEUPDATES);
1982 RNA_def_property_ui_text(prop, "Realtime Updates",
1983 "When transforming keyframes, changes to the animation data are flushed to other views");
1984 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1986 prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
1987 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_MARKERS_MOVE);
1988 RNA_def_property_ui_text(prop, "Sync Markers", "Sync Markers with keyframe edits");
1991 prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
1992 RNA_def_property_struct_type(prop, "DopeSheet");
1993 RNA_def_property_pointer_sdna(prop, NULL, "ads");
1994 RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
1997 prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
1998 RNA_def_property_enum_sdna(prop, NULL, "autosnap");
1999 RNA_def_property_enum_items(prop, autosnap_items);
2000 RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
2001 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
2004 static void rna_def_space_graph(BlenderRNA *brna)
2009 static EnumPropertyItem mode_items[] = {
2010 {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve Editor", "Edit animation/keyframes displayed as 2D curves"},
2011 {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
2012 {0, NULL, 0, NULL, NULL}};
2014 /* this is basically the same as the one for the 3D-View, but with some entries ommitted */
2015 static EnumPropertyItem gpivot_items[] = {
2016 {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
2017 {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
2018 {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""},
2019 //{V3D_CENTROID, "MEDIAN_POINT", 0, "Median Point", ""},
2020 //{V3D_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""},
2021 {0, NULL, 0, NULL, NULL}};
2024 srna= RNA_def_struct(brna, "SpaceGraphEditor", "Space");
2025 RNA_def_struct_sdna(srna, "SpaceIpo");
2026 RNA_def_struct_ui_text(srna, "Space Graph Editor", "Graph Editor space data");
2029 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2030 RNA_def_property_enum_sdna(prop, NULL, "mode");
2031 RNA_def_property_enum_items(prop, mode_items);
2032 RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
2033 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, "rna_SpaceGraphEditor_display_mode_update");
2036 prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
2037 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_DRAWTIME);
2038 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, only set with operator
2039 RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
2040 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2042 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
2043 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCFRANUM);
2044 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
2045 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2047 prop= RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
2048 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SLIDERS);
2049 RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
2050 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2052 prop= RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
2053 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOHANDLES);
2054 RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points");
2055 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2057 prop= RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE);
2058 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY);
2059 RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes",
2060 "Only keyframes of selected F-Curves are visible and editable");
2061 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2063 prop= RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
2064 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
2065 RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
2066 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2068 prop= RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
2069 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
2070 RNA_def_property_ui_text(prop, "Use High Quality Drawing",
2071 "Draw F-Curves using Anti-Aliasing and other fancy effects (disable for better performance)");
2072 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2075 prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
2076 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);
2077 RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
2078 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2080 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
2081 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOREALTIMEUPDATES);
2082 RNA_def_property_ui_text(prop, "Realtime Updates",
2083 "When transforming keyframes, changes to the animation data are flushed to other views");
2084 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2087 prop= RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
2088 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCURSOR);
2089 RNA_def_property_ui_text(prop, "Show Cursor", "Show 2D cursor");
2090 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2092 prop= RNA_def_property(srna, "cursor_position_y", PROP_FLOAT, PROP_NONE);
2093 RNA_def_property_float_sdna(prop, NULL, "cursorVal");
2094 RNA_def_property_ui_text(prop, "Cursor Y-Value", "Graph Editor 2D-Value cursor - Y-Value component");
2095 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2097 prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
2098 RNA_def_property_enum_sdna(prop, NULL, "around");
2099 RNA_def_property_enum_items(prop, gpivot_items);
2100 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
2101 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2104 prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
2105 RNA_def_property_struct_type(prop, "DopeSheet");
2106 RNA_def_property_pointer_sdna(prop, NULL, "ads");
2107 RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
2110 prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
2111 RNA_def_property_enum_sdna(prop, NULL, "autosnap");
2112 RNA_def_property_enum_items(prop, autosnap_items);
2113 RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
2114 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2116 /* readonly state info */
2117 prop= RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE);
2118 RNA_def_property_boolean_sdna(prop, NULL, "flag", 0); /* XXX: hack to make this compile, since this property doesn't actually exist*/
2119 RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL);
2120 RNA_def_property_ui_text(prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored");
2121 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
2124 static void rna_def_space_nla(BlenderRNA *brna)
2129 srna= RNA_def_struct(brna, "SpaceNLA", "Space");
2130 RNA_def_struct_sdna(srna, "SpaceNla");
2131 RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data");
2134 prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
2135 RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_DRAWTIME);
2136 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, only set with operator
2137 RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
2138 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
2140 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
2141 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM);
2142 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
2143 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
2145 prop= RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE);
2146 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES);
2147 RNA_def_property_ui_text(prop, "Show Control F-Curves", "Show influence F-Curves on strips");
2148 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
2151 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
2152 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES);
2153 RNA_def_property_ui_text(prop, "Realtime Updates",
2154 "When transforming strips, changes to the animation data are flushed to other views");
2155 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
2158 prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
2159 RNA_def_property_struct_type(prop, "DopeSheet");
2160 RNA_def_property_pointer_sdna(prop, NULL, "ads");
2161 RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
2164 prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
2165 RNA_def_property_enum_sdna(prop, NULL, "autosnap");
2166 RNA_def_property_enum_items(prop, autosnap_items);
2167 RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
2168 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
2171 static void rna_def_space_time(BlenderRNA *brna)
2176 srna= RNA_def_struct(brna, "SpaceTimeline", "Space");
2177 RNA_def_struct_sdna(srna, "SpaceTime");
2178 RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data");
2181 prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
2182 RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL);
2183 RNA_def_property_ui_text(prop, "Only Selected Channels", "Show keyframes for active Object and/or its selected bones only");
2184 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2186 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
2187 RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CFRA_NUM);
2188 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
2189 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2191 /* displaying cache status */
2192 prop= RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE);
2193 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DISPLAY);
2194 RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");
2195 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2197 prop= RNA_def_property(srna, "cache_softbody", PROP_BOOLEAN, PROP_NONE);
2198 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SOFTBODY);
2199 RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
2200 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2202 prop= RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
2203 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_PARTICLES);
2204 RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
2205 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2207 prop= RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
2208 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_CLOTH);
2209 RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
2210 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2212 prop= RNA_def_property(srna, "cache_smoke", PROP_BOOLEAN, PROP_NONE);
2213 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SMOKE);
2214 RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");
2215 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2218 static void rna_def_console_line(BlenderRNA *brna)
2223 srna = RNA_def_struct(brna, "ConsoleLine", NULL);
2224 RNA_def_struct_ui_text(srna, "Console Input", "Input line for the interactive console");
2225 // XXX using non-inited "prop", uh? RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2227 prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
2228 RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length", "rna_ConsoleLine_body_set");
2229 RNA_def_property_ui_text(prop, "Line", "Text in the line");
2230 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2232 prop= RNA_def_property(srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */
2233 RNA_def_property_int_sdna(prop, NULL, "cursor");
2234 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_ConsoleLine_cursor_index_range");
2235 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2238 static void rna_def_space_console(BlenderRNA *brna)
2243 srna= RNA_def_struct(brna, "SpaceConsole", "Space");
2244 RNA_def_struct_sdna(srna, "SpaceConsole");
2245 RNA_def_struct_ui_text(srna, "Space Console", "Interactive python console");
2248 prop= RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); /* copied from text editor */
2249 RNA_def_property_int_sdna(prop, NULL, "lheight");
2250 RNA_def_property_range(prop, 8, 32);
2251 RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
2252 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2255 prop= RNA_def_property(srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
2256 RNA_def_property_int_sdna(prop, NULL, "sel_start");
2257 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2259 prop= RNA_def_property(srna, "select_end", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
2260 RNA_def_property_int_sdna(prop, NULL, "sel_end");
2261 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2263 prop= RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
2264 RNA_def_property_ui_text(prop, "Prompt", "Command line prompt");
2266 prop= RNA_def_property(srna, "language", PROP_STRING, PROP_NONE);
2267 RNA_def_property_ui_text(prop, "Language", "Command line prompt language");
2269 prop= RNA_def_property(srna, "history", PROP_COLLECTION, PROP_NONE);
2270 RNA_def_property_collection_sdna(prop, NULL, "history", NULL);
2271 RNA_def_property_struct_type(prop, "ConsoleLine");
2272 RNA_def_property_ui_text(prop, "History", "Command history");
2274 prop= RNA_def_property(srna, "scrollback", PROP_COLLECTION, PROP_NONE);
2275 RNA_def_property_collection_sdna(prop, NULL, "scrollback", NULL);
2276 RNA_def_property_struct_type(prop, "ConsoleLine");
2277 RNA_def_property_ui_text(prop, "Output", "Command output");
2280 static void rna_def_fileselect_params(BlenderRNA *brna)
2285 static EnumPropertyItem file_display_items[] = {
2286 {FILE_SHORTDISPLAY, "FILE_SHORTDISPLAY", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
2287 {FILE_LONGDISPLAY, "FILE_LONGDISPLAY", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
2288 {FILE_IMGDISPLAY, "FILE_IMGDISPLAY", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
2289 {0, NULL, 0, NULL, NULL}};
2291 static EnumPropertyItem file_sort_items[] = {
2292 {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
2293 {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension"},
2294 {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
2295 {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
2296 {0, NULL, 0, NULL, NULL}};
2298 srna= RNA_def_struct(brna, "FileSelectParams", NULL);
2299 RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
2301 prop= RNA_def_property(srna, "title", PROP_STRING, PROP_NONE);
2302 RNA_def_property_string_sdna(prop, NULL, "title");
2303 RNA_def_property_ui_text(prop, "Title", "Title for the file browser");
2304 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2306 prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
2307 RNA_def_property_string_sdna(prop, NULL, "dir");
2308 RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser");
2309 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2311 prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
2312 RNA_def_property_string_sdna(prop, NULL, "file");
2313 RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
2314 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2316 prop= RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
2317 RNA_def_property_enum_sdna(prop, NULL, "display");
2318 RNA_def_property_enum_items(prop, file_display_items);
2319 RNA_def_property_ui_text(prop, "Display Mode", "Display mode for the file list");
2320 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2322 prop= RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
2323 RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER);
2324 RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files");
2325 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2327 prop= RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
2328 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
2329 RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
2330 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS , NULL);
2332 prop= RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
2333 RNA_def_property_enum_sdna(prop, NULL, "sort");
2334 RNA_def_property_enum_items(prop, file_sort_items);
2335 RNA_def_property_ui_text(prop, "Sort", "");
2336 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2338 prop= RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE);
2339 RNA_def_property_boolean_sdna(prop, NULL, "filter", IMAGEFILE);
2340 RNA_def_property_ui_text(prop, "Filter Images", "Show image files");
2341 RNA_def_property_ui_icon(prop, ICON_FILE_IMAGE, 0);
2342 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2344 prop= RNA_def_property(srna, "use_filter_blender", PROP_BOOLEAN, PROP_NONE);
2345 RNA_def_property_boolean_sdna(prop, NULL, "filter", BLENDERFILE);
2346 RNA_def_property_ui_text(prop, "Filter Blender", "Show .blend files");
2347 RNA_def_property_ui_icon(prop, ICON_FILE_BLEND, 0);
2348 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2350 prop= RNA_def_property(srna, "use_filter_movie", PROP_BOOLEAN, PROP_NONE);
2351 RNA_def_property_boolean_sdna(prop, NULL, "filter", MOVIEFILE);
2352 RNA_def_property_ui_text(prop, "Filter Movies", "Show movie files");
2353 RNA_def_property_ui_icon(prop, ICON_FILE_MOVIE, 0);
2354 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2356 prop= RNA_def_property(srna, "use_filter_script", PROP_BOOLEAN, PROP_NONE);
2357 RNA_def_property_boolean_sdna(prop, NULL, "filter", PYSCRIPTFILE);
2358 RNA_def_property_ui_text(prop, "Filter Script", "Show script files");
2359 RNA_def_property_ui_icon(prop, ICON_FILE_SCRIPT, 0);
2360 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2362 prop= RNA_def_property(srna, "use_filter_font", PROP_BOOLEAN, PROP_NONE);
2363 RNA_def_property_boolean_sdna(prop, NULL, "filter", FTFONTFILE);
2364 RNA_def_property_ui_text(prop, "Filter Fonts", "Show font files");
2365 RNA_def_property_ui_icon(prop, ICON_FILE_FONT, 0);
2366 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2368 prop= RNA_def_property(srna, "use_filter_sound", PROP_BOOLEAN, PROP_NONE);
2369 RNA_def_property_boolean_sdna(prop, NULL, "filter", SOUNDFILE);
2370 RNA_def_property_ui_text(prop, "Filter Sound", "Show sound files");
2371 RNA_def_property_ui_icon(prop, ICON_FILE_SOUND, 0);
2372 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2374 prop= RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
2375 RNA_def_property_boolean_sdna(prop, NULL, "filter", TEXTFILE);
2376 RNA_def_property_ui_text(prop, "Filter Text", "Show text files");
2377 RNA_def_property_ui_icon(prop, ICON_FILE_BLANK, 0);
2378 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2380 prop= RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
2381 RNA_def_property_boolean_sdna(prop, NULL, "filter", FOLDERFILE);
2382 RNA_def_property_ui_text(prop, "Filter Folder", "Show folders");
2383 RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0);
2384 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2386 prop= RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE);
2387 RNA_def_property_string_sdna(prop, NULL, "filter_glob");
2388 RNA_def_property_ui_text(prop, "Extension Filter", "");
2389 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
2393 static void rna_def_space_filebrowser(BlenderRNA *brna)
2398 srna= RNA_def_struct(brna, "SpaceFileBrowser", "Space");
2399 RNA_def_struct_sdna(srna, "SpaceFile");
2400 RNA_def_struct_ui_text(srna, "Space File Browser", "File browser space data");
2402 prop= RNA_def_property(srna, "params", PROP_POINTER, PROP_NONE);
2403 RNA_def_property_pointer_sdna(prop, NULL, "params");
2404 RNA_def_property_ui_text(prop, "Filebrowser Parameter", "Parameters and Settings for the Filebrowser");
2406 prop= RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
2407 RNA_def_property_pointer_sdna(prop, NULL, "op");
2408 RNA_def_property_ui_text(prop, "Operator", "");
2411 static void rna_def_space_info(BlenderRNA *brna)
2416 srna= RNA_def_struct(brna, "SpaceInfo", "Space");
2417 RNA_def_struct_sdna(srna, "SpaceInfo");
2418 RNA_def_struct_ui_text(srna, "Space Info", "Info space data");
2420 /* reporting display */
2421 prop= RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
2422 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_DEBUG);
2423 RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
2424 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2426 prop= RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
2427 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_INFO);
2428 RNA_def_property_ui_text(prop, "Show Info", "Display general information");
2429 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2431 prop= RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
2432 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_OP);
2433 RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
2434 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2436 prop= RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
2437 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_WARN);
2438 RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
2439 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2441 prop= RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
2442 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
2443 RNA_def_property_ui_text(prop, "Show Error", "Display error text");
2444 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2447 static void rna_def_space_userpref(BlenderRNA *brna)
2452 srna= RNA_def_struct(brna, "SpaceUserPreferences", "Space");
2453 RNA_def_struct_sdna(srna, "SpaceUserPref");
2454 RNA_def_struct_ui_text(srna, "Space User Preferences", "User preferences space data");
2456 prop= RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
2457 RNA_def_property_string_sdna(prop, NULL, "filter");
2458 RNA_def_property_ui_text(prop, "Filter", "Search term for filtering in the UI");
2462 static void rna_def_space_node(BlenderRNA *brna)
2467 static EnumPropertyItem texture_type_items[] = {
2468 {SNODE_TEX_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit texture nodes from Object"},
2469 {SNODE_TEX_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit texture nodes from World"},
2470 {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"},
2471 {0, NULL, 0, NULL, NULL}};
2473 static EnumPropertyItem backdrop_channels_items[] = {
2474 {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
2475 {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
2476 "Draw image with RGB colors and alpha transparency"},
2477 {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
2478 {0, NULL, 0, NULL, NULL}};
2480 srna= RNA_def_struct(brna, "SpaceNodeEditor", "Space");
2481 RNA_def_struct_sdna(srna, "SpaceNode");
2482 RNA_def_struct_ui_text(srna, "Space Node Editor", "Node editor space data");
2484 prop= RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE);
2485 RNA_def_property_enum_sdna(prop, NULL, "treetype");
2486 RNA_def_property_enum_items(prop, nodetree_type_items);
2487 RNA_def_property_ui_text(prop, "Tree Type", "Node tree type to display and edit");
2488 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
2490 prop= RNA_def_property(srna, "texture_type", PROP_ENUM, PROP_NONE);
2491 RNA_def_property_enum_sdna(prop, NULL, "texfrom");
2492 RNA_def_property_enum_items(prop, texture_type_items);
2493 RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from");
2494 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
2496 prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
2497 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2498 RNA_def_property_ui_text(prop, "ID", "Datablock whose nodes are being edited");
2500 prop= RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE);
2501 RNA_def_property_pointer_sdna(prop, NULL, "from");
2502 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2503 RNA_def_property_ui_text(prop, "ID From", "Datablock from which the edited datablock is linked");
2505 prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
2506 RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
2507 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_SpaceNodeEditor_node_tree_poll");
2508 RNA_def_property_flag(prop, PROP_EDITABLE);
2509 RNA_def_property_ui_text(prop, "Node Tree", "Node tree being displayed and edited");
2510 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, "rna_SpaceNodeEditor_node_tree_update");
2512 prop= RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
2513 RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_BACKDRAW);
2514 RNA_def_property_ui_text(prop, "Backdrop", "Use active Viewer Node output as backdrop for compositing nodes");
2515 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2517 prop= RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE);
2518 RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_AUTO_RENDER);
2519 RNA_def_property_ui_text(prop, "Auto Render", "Re-render and composite changed layers on 3D edits");
2520 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2522 prop= RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
2523 RNA_def_property_float_sdna(prop, NULL, "zoom");
2524 RNA_def_property_float_default(prop, 1.0f);
2525 RNA_def_property_range(prop, 0.01f, FLT_MAX);
2526 RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
2527 RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
2528 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2530 prop= RNA_def_property(srna, "backdrop_x", PROP_FLOAT, PROP_NONE);
2531 RNA_def_property_float_sdna(prop, NULL, "xof");
2532 RNA_def_property_ui_text(prop, "Backdrop X", "Backdrop X offset");
2533 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2535 prop= RNA_def_property(srna, "backdrop_y", PROP_FLOAT, PROP_NONE);
2536 RNA_def_property_float_sdna(prop, NULL, "yof");
2537 RNA_def_property_ui_text(prop, "Backdrop Y", "Backdrop Y offset");
2538 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2540 prop= RNA_def_property(srna, "backdrop_channels", PROP_ENUM, PROP_NONE);
2541 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
2542 RNA_def_property_enum_items(prop, backdrop_channels_items);
2543 RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
2544 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2547 static void rna_def_space_logic(BlenderRNA *brna)
2552 srna= RNA_def_struct(brna, "SpaceLogicEditor", "Space");
2553 RNA_def_struct_sdna(srna, "SpaceLogic");
2554 RNA_def_struct_ui_text(srna, "Space Logic Editor", "Logic editor space data");
2557 prop= RNA_def_property(srna, "show_sensors_selected_objects", PROP_BOOLEAN, PROP_NONE);
2558 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_SEL);
2559 RNA_def_property_ui_text(prop, "Show Selected Object", "Show sensors of all selected objects");
2560 RNA_def_property_update(prop, NC_LOGIC, NULL);
2562 prop= RNA_def_property(srna, "show_sensors_active_object", PROP_BOOLEAN, PROP_NONE);
2563 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_ACT);
2564 RNA_def_property_ui_text(prop, "Show Active Object", "Show sensors of active object");
2565 RNA_def_property_update(prop, NC_LOGIC, NULL);
2567 prop= RNA_def_property(srna, "show_sensors_linked_controller", PROP_BOOLEAN, PROP_NONE);
2568 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_LINK);
2569 RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to the controller");
2570 RNA_def_property_update(prop, NC_LOGIC, NULL);
2572 prop= RNA_def_property(srna, "show_sensors_active_states", PROP_BOOLEAN, PROP_NONE);
2573 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_STATE);
2574 RNA_def_property_ui_text(prop, "Show Active States", "Show only sensors connected to active states");
2575 RNA_def_property_update(prop, NC_LOGIC, NULL);
2578 prop= RNA_def_property(srna, "show_controllers_selected_objects", PROP_BOOLEAN, PROP_NONE);
2579 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_SEL);
2580 RNA_def_property_ui_text(prop, "Show Selected Object", "Show controllers of all selected objects");
2581 RNA_def_property_update(prop, NC_LOGIC, NULL);
2583 prop= RNA_def_property(srna, "show_controllers_active_object", PROP_BOOLEAN, PROP_NONE);
2584 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_ACT);
2585 RNA_def_property_ui_text(prop, "Show Active Object", "Show controllers of active object");
2586 RNA_def_property_update(prop, NC_LOGIC, NULL);
2588 prop= RNA_def_property(srna, "show_controllers_linked_controller", PROP_BOOLEAN, PROP_NONE);
2589 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_LINK);
2590 RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to sensor/actuator");
2591 RNA_def_property_update(prop, NC_LOGIC, NULL);
2594 prop= RNA_def_property(srna, "show_actuators_selected_objects", PROP_BOOLEAN, PROP_NONE);
2595 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_SEL);
2596 RNA_def_property_ui_text(prop, "Show Selected Object", "Show actuators of all selected objects");
2597 RNA_def_property_update(prop, NC_LOGIC, NULL);
2599 prop= RNA_def_property(srna, "show_actuators_active_object", PROP_BOOLEAN, PROP_NONE);
2600 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_ACT);
2601 RNA_def_property_ui_text(prop, "Show Active Object", "Show actuators of active object");
2602 RNA_def_property_update(prop, NC_LOGIC, NULL);
2604 prop= RNA_def_property(srna, "show_actuators_linked_controller", PROP_BOOLEAN, PROP_NONE);
2605 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_LINK);
2606 RNA_def_property_ui_text(prop, "Show Linked to Actuator", "Show linked objects to the actuator");
2607 RNA_def_property_update(prop, NC_LOGIC, NULL);
2609 prop= RNA_def_property(srna, "show_actuators_active_states", PROP_BOOLEAN, PROP_NONE);
2610 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_STATE);
2611 RNA_def_property_ui_text(prop, "Show Active States", "Show only actuators connected to active states");
2612 RNA_def_property_update(prop, NC_LOGIC, NULL);
2616 void RNA_def_space(BlenderRNA *brna)
2618 rna_def_space(brna);
2619 rna_def_space_image(brna);
2620 rna_def_space_sequencer(brna);
2621 rna_def_space_text(brna);
2622 rna_def_fileselect_params(brna);
2623 rna_def_space_filebrowser(brna);
2624 rna_def_space_outliner(brna);
2625 rna_def_background_image(brna);
2626 rna_def_space_view3d(brna);
2627 rna_def_space_buttons(brna);
2628 rna_def_space_dopesheet(brna);
2629 rna_def_space_graph(brna);
2630 rna_def_space_nla(brna);
2631 rna_def_space_time(brna);
2632 rna_def_space_console(brna);
2633 rna_def_console_line(brna);
2634 rna_def_space_info(brna);
2635 rna_def_space_userpref(brna);
2636 rna_def_space_node(brna);
2637 rna_def_space_logic(brna);