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_view3d_types.h"
51 EnumPropertyItem space_type_items[] = {
52 {SPACE_EMPTY, "EMPTY", 0, "Empty", ""},
53 {SPACE_VIEW3D, "VIEW_3D", 0, "3D View", ""},
54 {SPACE_IPO, "GRAPH_EDITOR", 0, "Graph Editor", ""},
55 {SPACE_OUTLINER, "OUTLINER", 0, "Outliner", ""},
56 {SPACE_BUTS, "PROPERTIES", 0, "Properties", ""},
57 {SPACE_FILE, "FILE_BROWSER", 0, "File Browser", ""},
58 {SPACE_IMAGE, "IMAGE_EDITOR", 0, "Image Editor", ""},
59 {SPACE_INFO, "INFO", 0, "Info", ""},
60 {SPACE_SEQ, "SEQUENCE_EDITOR", 0, "Sequence Editor", ""},
61 {SPACE_TEXT, "TEXT_EDITOR", 0, "Text Editor", ""},
62 //{SPACE_IMASEL, "IMAGE_BROWSER", 0, "Image Browser", ""},
63 {SPACE_SOUND, "AUDIO_WINDOW", 0, "Audio Window", ""},
64 {SPACE_ACTION, "DOPESHEET_EDITOR", 0, "DopeSheet Editor", ""},
65 {SPACE_NLA, "NLA_EDITOR", 0, "NLA Editor", ""},
66 {SPACE_SCRIPT, "SCRIPTS_WINDOW", 0, "Scripts Window", ""},
67 {SPACE_TIME, "TIMELINE", 0, "Timeline", ""},
68 {SPACE_NODE, "NODE_EDITOR", 0, "Node Editor", ""},
69 {SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""},
70 {SPACE_CONSOLE, "CONSOLE", 0, "Python Console", ""},
71 {SPACE_USERPREF, "USER_PREFERENCES", 0, "User Preferences", ""},
72 {0, NULL, 0, NULL, NULL}};
74 static EnumPropertyItem draw_channels_items[] = {
75 {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
76 {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"},
77 {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
78 {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer", "Draw Z-buffer associated with image (mapped from camera clip start to end)"},
80 {SI_COLOR_CORRECTION, "COLOR_CORRECTED", ICON_IMAGE_ALPHA, "Color Corrected", "Display color corrected image"},
82 {0, NULL, 0, NULL, NULL}};
84 static EnumPropertyItem transform_orientation_items[] = {
85 {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"},
86 {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"},
87 {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the euler rotation axis as used for input"},
88 {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"},
89 {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"},
90 {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
91 {0, NULL, 0, NULL, NULL}};
93 EnumPropertyItem autosnap_items[] = {
94 {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
95 {SACTSNAP_STEP, "STEP", 0, "Time Step", "Snap to 1.0 frame/second intervals"},
96 {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames/seconds (nla-action time)"},
97 {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"},
98 {0, NULL, 0, NULL, NULL}};
100 EnumPropertyItem viewport_shade_items[] = {
101 {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"},
102 {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
103 {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"},
104 //{OB_SHADED, "SHADED", ICON_SMOOTH, "Shaded", "Display the object solid, with preview shading interpolated at vertices"},
105 {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Textured", "Display the object solid, with face-assigned textures"},
106 {0, NULL, 0, NULL, NULL}};
110 #include "DNA_anim_types.h"
111 #include "DNA_scene_types.h"
112 #include "DNA_screen_types.h"
114 #include "BLI_math.h"
116 #include "BKE_animsys.h"
117 #include "BKE_brush.h"
118 #include "BKE_colortools.h"
119 #include "BKE_context.h"
120 #include "BKE_depsgraph.h"
121 #include "BKE_paint.h"
123 #include "ED_image.h"
124 #include "ED_screen.h"
125 #include "ED_view3d.h"
126 #include "ED_sequencer.h"
128 #include "IMB_imbuf_types.h"
130 static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
132 SpaceLink *space= (SpaceLink*)ptr->data;
134 switch(space->spacetype) {
136 return &RNA_SpaceView3D;
138 return &RNA_SpaceGraphEditor;
140 return &RNA_SpaceOutliner;
142 return &RNA_SpaceProperties;
144 return &RNA_SpaceFileBrowser;
146 return &RNA_SpaceImageEditor;
148 return &RNA_SpaceInfo;
150 return &RNA_SpaceSequenceEditor;
152 return &RNA_SpaceTextEditor;
154 // return &RNA_SpaceImageBrowser;
156 return &RNA_SpaceAudioWindow;*/
158 return &RNA_SpaceDopeSheetEditor;
160 return &RNA_SpaceNLA;
162 return &RNA_SpaceScriptsWindow;*/
164 return &RNA_SpaceTimeline;
166 return &RNA_SpaceNodeEditor;
168 return &RNA_SpaceLogicEditor;
170 return &RNA_SpaceConsole;
172 return &RNA_SpaceUserPreferences;
178 static ScrArea *rna_area_from_space(PointerRNA *ptr)
180 bScreen *sc = (bScreen*)ptr->id.data;
181 SpaceLink *link= (SpaceLink*)ptr->data;
184 for(sa=sc->areabase.first; sa; sa=sa->next)
185 if(BLI_findindex(&sa->spacedata, link) != -1)
191 static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **sa_r, ARegion **ar_r)
193 bScreen *sc = (bScreen*)ptr->id.data;
196 void *regiondata= ptr->data;
201 for(sa=sc->areabase.first; sa; sa=sa->next) {
202 for(ar=sa->regionbase.first; ar; ar=ar->next) {
203 if(ar->regiondata == regiondata) {
212 static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr)
214 Scene *scene = ((bScreen*)ptr->id.data)->scene;
215 View3D *v3d= (View3D*)ptr->data;
217 if (v3d->twmode < V3D_MANIP_CUSTOM)
218 return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, NULL);
220 return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM));
223 EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, int *free)
226 ListBase *transform_spaces;
227 TransformOrientation *ts= NULL;
228 EnumPropertyItem tmp = {0, "", 0, "", ""};
229 EnumPropertyItem *item= NULL;
230 int i = V3D_MANIP_CUSTOM, totitem= 0;
232 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_GLOBAL);
233 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_NORMAL);
234 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_GIMBAL);
235 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_LOCAL);
236 RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_VIEW);
238 if (ptr->type == &RNA_SpaceView3D)
239 scene = ((bScreen*)ptr->id.data)->scene;
241 scene = CTX_data_scene(C); /* can't use scene from ptr->id.data because that enum is also used by operators */
244 transform_spaces = &scene->transform_spaces;
245 ts = transform_spaces->first;
250 RNA_enum_item_add_separator(&item, &totitem);
252 for(; ts; ts = ts->next) {
253 tmp.identifier = ts->name;
256 RNA_enum_item_add(&item, &totitem, &tmp);
260 RNA_enum_item_end(&item, &totitem);
267 static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int value)
269 View3D *v3d= (View3D*)(ptr->data);
270 bScreen *sc= (bScreen*)ptr->id.data;
272 v3d->scenelock = value;
276 v3d->lay= sc->scene->lay;
277 /* seek for layact */
280 if(v3d->lay & (1<<bit)) {
286 v3d->camera= sc->scene->camera;
290 static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values)
292 View3D *v3d= (View3D*)(ptr->data);
293 bScreen *sc= (bScreen*)ptr->id.data;
294 Scene *scene= (Scene *)sc->scene;
295 float *loc = give_cursor(scene, v3d);
297 copy_v3_v3(values, loc);
300 static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values)
302 View3D *v3d= (View3D*)(ptr->data);
303 bScreen *sc= (bScreen*)ptr->id.data;
304 Scene *scene= (Scene *)sc->scene;
305 float *cursor = give_cursor(scene, v3d);
307 copy_v3_v3(cursor, values);
310 static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
312 View3D *v3d= (View3D*)(ptr->data);
314 v3d->lay= ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact);
317 static void rna_SpaceView3D_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
319 DAG_on_visible_update(bmain, FALSE);
322 static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
324 View3D *v3d= (View3D*)(ptr->data);
325 ScrArea *sa= rna_area_from_space(ptr);
326 void *regiondata= NULL;
328 ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
329 ARegion *ar= regionbase->last; /* always last in list, weak .. */
330 regiondata= ar->regiondata;
333 return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
336 static PointerRNA rna_SpaceView3D_region_quadview_get(PointerRNA *ptr)
338 View3D *v3d= (View3D*)(ptr->data);
339 ScrArea *sa= rna_area_from_space(ptr);
340 void *regiondata= NULL;
342 ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
343 ARegion *ar= regionbase->last; /* always before last in list, weak .. */
345 ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL;
347 regiondata= ar->regiondata;
351 return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
354 static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRNA *ptr)
359 rna_area_region_from_regiondata(ptr, &sa, &ar);
360 if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
361 ED_view3d_quadview_update(sa, ar, FALSE);
364 /* same as above but call clip==TRUE */
365 static void rna_RegionView3D_quadview_clip_update(Main *main, Scene *scene, PointerRNA *ptr)
370 rna_area_region_from_regiondata(ptr, &sa, &ar);
371 if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
372 ED_view3d_quadview_update(sa, ar, TRUE);
375 static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values)
377 RegionView3D *rv3d= (RegionView3D *)(ptr->data);
378 negate_v3_v3(values, rv3d->ofs);
381 static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values)
383 RegionView3D *rv3d= (RegionView3D *)(ptr->data);
384 negate_v3_v3(rv3d->ofs, values);
387 /* Space Image Editor */
389 static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
391 return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
394 static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *ptr)
396 paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
398 ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
401 static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)
403 SpaceImage *sima= (SpaceImage*)(ptr->data);
404 return ED_space_image_show_render(sima);
407 static int rna_SpaceImageEditor_show_paint_get(PointerRNA *ptr)
409 SpaceImage *sima= (SpaceImage*)(ptr->data);
410 return ED_space_image_show_paint(sima);
413 static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
415 SpaceImage *sima= (SpaceImage*)(ptr->data);
416 bScreen *sc= (bScreen*)ptr->id.data;
417 return ED_space_image_show_uvedit(sima, sc->scene->obedit);
420 static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
422 SpaceImage *sima= (SpaceImage*)(ptr->data);
423 bScreen *sc= (bScreen*)ptr->id.data;
425 ED_space_image_set(NULL, sima, sc->scene, sc->scene->obedit, (Image*)value.data);
428 static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, PointerRNA *ptr, int *free)
430 SpaceImage *sima= (SpaceImage*)ptr->data;
431 EnumPropertyItem *item= NULL;
434 int zbuf, alpha, totitem= 0;
436 ibuf= ED_space_image_acquire_buffer(sima, &lock);
438 alpha= ibuf && (ibuf->channels == 4);
439 zbuf= ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1));
441 ED_space_image_release_buffer(sima, lock);
444 return draw_channels_items;
446 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
449 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_USE_ALPHA);
450 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ALPHA);
453 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF);
457 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_COLOR_CORRECTION);
460 RNA_enum_item_end(&item, &totitem);
466 static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values)
468 SpaceImage *sima= (SpaceImage*)ptr->data;
470 if (sima->flag & SI_COORDFLOATS) {
471 copy_v2_v2(values, sima->cursor);
474 ED_space_image_size(sima, &w, &h);
476 values[0] = sima->cursor[0] * w;
477 values[1] = sima->cursor[1] * h;
481 static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const float *values)
483 SpaceImage *sima= (SpaceImage*)ptr->data;
485 if (sima->flag & SI_COORDFLOATS) {
486 copy_v2_v2(sima->cursor, values);
489 ED_space_image_size(sima, &w, &h);
491 sima->cursor[0] = values[0] / w;
492 sima->cursor[1] = values[1] / h;
496 static void rna_SpaceImageEditor_curves_update(Main *bmain, Scene *scene, PointerRNA *ptr)
498 SpaceImage *sima= (SpaceImage*)ptr->data;
502 ibuf= ED_space_image_acquire_buffer(sima, &lock);
504 curvemapping_do_ibuf(sima->cumap, ibuf);
505 ED_space_image_release_buffer(sima, lock);
507 WM_main_add_notifier(NC_IMAGE, sima->image);
510 static void rna_SpaceImageEditor_scopes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
512 SpaceImage *sima= (SpaceImage*)ptr->data;
516 ibuf= ED_space_image_acquire_buffer(sima, &lock);
518 scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT);
519 WM_main_add_notifier(NC_IMAGE, sima->image);
521 ED_space_image_release_buffer(sima, lock);
524 /* Space Text Editor */
526 static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value)
528 SpaceText *st= (SpaceText*)(ptr->data);
534 static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
536 SpaceText *st= (SpaceText*)(ptr->data);
538 st->text= value.data;
542 /* Space Properties */
544 /* note: this function exists only to avoid id refcounting */
545 static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value)
547 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
548 sbuts->pinid= value.data;
551 static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
553 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
556 return ID_code_to_RNA_type(GS(sbuts->pinid->name));
561 static void rna_SpaceProperties_pin_id_update(Main *bmain, Scene *scene, PointerRNA *ptr)
563 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
564 ID *id = sbuts->pinid;
567 sbuts->flag &= ~SB_PIN_CONTEXT;
571 switch (GS(id->name)) {
573 WM_main_add_notifier(NC_MATERIAL|ND_SHADING, NULL);
576 WM_main_add_notifier(NC_TEXTURE, NULL);
579 WM_main_add_notifier(NC_WORLD, NULL);
582 WM_main_add_notifier(NC_LAMP, NULL);
588 static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value)
590 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
593 sbuts->mainbuser = value;
596 static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
598 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
605 static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
607 ConsoleLine *ci= (ConsoleLine*)ptr->data;
608 strcpy(value, ci->line);
611 static int rna_ConsoleLine_body_length(PointerRNA *ptr)
613 ConsoleLine *ci= (ConsoleLine*)ptr->data;
617 static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value)
619 ConsoleLine *ci= (ConsoleLine*)ptr->data;
620 int len= strlen(value);
622 if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */
624 ci->line= MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
625 ci->len_alloc= len + 1;
627 memcpy(ci->line, value, len + 1);
630 if(ci->cursor > len) /* clamp the cursor */
634 static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max)
636 ConsoleLine *ci= (ConsoleLine*)ptr->data;
642 /* Space Dopesheet */
644 static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA value)
646 SpaceAction *saction= (SpaceAction*)(ptr->data);
647 saction->action= value.data;
650 static void rna_SpaceDopeSheetEditor_action_update(Main *bmain, Scene *scene, PointerRNA *ptr)
652 SpaceAction *saction= (SpaceAction*)(ptr->data);
653 Object *obact= (scene->basact)? scene->basact->object: NULL;
655 /* we must set this action to be the one used by active object (if not pinned) */
656 if (obact/* && saction->pin == 0*/) {
657 AnimData *adt = NULL;
659 if (saction->mode == SACTCONT_ACTION) {
660 // TODO: context selector could help decide this with more control?
661 adt= BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
663 else if (saction->mode == SACTCONT_SHAPEKEY) {
664 Key *key = ob_get_key(obact);
666 adt= BKE_id_add_animdata(&key->id); /* this only adds if non-existant */
671 /* fix id-count of action we're replacing */
672 id_us_min(&adt->action->id);
674 /* show new id-count of action we're replacing */
675 adt->action= saction->action;
676 id_us_plus(&adt->action->id);
679 /* force depsgraph flush too */
680 DAG_id_tag_update(&obact->id, OB_RECALC_OB|OB_RECALC_DATA);
684 static void rna_SpaceDopeSheetEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
686 SpaceAction *saction= (SpaceAction*)(ptr->data);
687 Object *obact= (scene->basact)? scene->basact->object: NULL;
689 /* special exceptions for ShapeKey Editor mode */
690 if (saction->mode == SACTCONT_SHAPEKEY) {
691 Key *key = ob_get_key(obact);
693 /* 1) update the action stored for the editor */
695 saction->action = (key->adt)? key->adt->action : NULL;
697 saction->action = NULL;
699 /* 2) enable 'show sliders' by default, since one of the main
700 * points of the ShapeKey Editor is to provide a one-stop shop
701 * for controlling the shapekeys, whose main control is the value
703 saction->flag |= SACTION_SLIDERS;
705 /* make sure action stored is valid */
706 else if (saction->mode == SACTCONT_ACTION) {
707 /* 1) update the action stored for the editor */
708 // TODO: context selector could help decide this with more control?
710 saction->action = (obact->adt)? obact->adt->action : NULL;
712 saction->action = NULL;
716 /* Space Graph Editor */
718 static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *ptr)
720 //SpaceIpo *sipo= (SpaceIpo*)(ptr->data);
721 ScrArea *sa= CTX_wm_area(C);
723 /* after changing view mode, must force recalculation of F-Curve colors
724 * which can only be achieved using refresh as opposed to redraw
726 ED_area_tag_refresh(sa);
729 static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr)
731 SpaceIpo *sipo= (SpaceIpo*)(ptr->data);
732 return (sipo->ghostCurves.first != NULL);
735 static void rna_Sequencer_display_mode_update(bContext *C, PointerRNA *ptr)
737 int view = RNA_int_get(ptr, "view_type");
739 ED_sequencer_update_view(C, view);
742 static float rna_BackgroundImage_opacity_get(PointerRNA *ptr)
744 BGpic *bgpic= (BGpic *)ptr->data;
745 return 1.0f-bgpic->blend;
748 static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
750 BGpic *bgpic= (BGpic *)ptr->data;
751 bgpic->blend = 1.0f - value;
754 static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *ptr, int *free)
756 Scene *scene = CTX_data_scene(C);
757 Object *ob = CTX_data_active_object(C);
758 EnumPropertyItem *item= NULL;
759 EnumPropertyItem tmp= {0, "", 0, "", ""};
763 if(ob->type == OB_LAMP) {
764 tmp.value = SB_TEXC_MAT_OR_LAMP;
765 tmp.description = "Show Lamp Textures";
766 tmp.identifier = "LAMP";
767 tmp.icon = ICON_LAMP_POINT;
768 RNA_enum_item_add(&item, &totitem, &tmp);
770 else if(ob->totcol) {
771 tmp.value = SB_TEXC_MAT_OR_LAMP;
772 tmp.description = "Show Material Textures";
773 tmp.identifier = "MATERIAL";
774 tmp.icon = ICON_MATERIAL;
775 RNA_enum_item_add(&item, &totitem, &tmp);
778 if(ob->particlesystem.first) {
779 tmp.value = SB_TEXC_PARTICLES;
780 tmp.description = "Show Particle Textures";
781 tmp.identifier = "PARTICLE";
782 tmp.icon = ICON_PARTICLES;
783 RNA_enum_item_add(&item, &totitem, &tmp);
787 if(scene && scene->world) {
788 tmp.value = SB_TEXC_WORLD;
789 tmp.description = "Show World Textures";
790 tmp.identifier = "WORLD";
791 tmp.icon = ICON_WORLD;
792 RNA_enum_item_add(&item, &totitem, &tmp);
795 tmp.value = SB_TEXC_BRUSH;
796 tmp.description = "Show Brush Textures";
797 tmp.identifier = "BRUSH";
798 tmp.icon = ICON_BRUSH_DATA;
799 RNA_enum_item_add(&item, &totitem, &tmp);
801 RNA_enum_item_end(&item, &totitem);
809 static void rna_def_space(BlenderRNA *brna)
814 srna= RNA_def_struct(brna, "Space", NULL);
815 RNA_def_struct_sdna(srna, "SpaceLink");
816 RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area");
817 RNA_def_struct_refine_func(srna, "rna_Space_refine");
819 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
820 RNA_def_property_enum_sdna(prop, NULL, "spacetype");
821 RNA_def_property_enum_items(prop, space_type_items);
822 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
823 RNA_def_property_ui_text(prop, "Type", "Space data type");
826 static void rna_def_space_image_uv(BlenderRNA *brna)
831 static EnumPropertyItem sticky_mode_items[] = {
832 {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"},
833 {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", "Select UVs that are at the same location and share a mesh vertex"},
834 {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex", "Select UVs that share mesh vertex, irrespective if they are in the same location"},
835 {0, NULL, 0, NULL, NULL}};
837 static EnumPropertyItem dt_uv_items[] = {
838 {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"},
839 {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"},
840 {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"},
841 {SI_UVDT_WHITE, "WHITE", 0, "White", "Draw white edges"},
842 {0, NULL, 0, NULL, NULL}};
844 static EnumPropertyItem dt_uvstretch_items[] = {
845 {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
846 {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
847 {0, NULL, 0, NULL, NULL}};
849 static EnumPropertyItem pivot_items[] = {
850 {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
851 {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
852 {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
853 {0, NULL, 0, NULL, NULL}};
855 srna= RNA_def_struct(brna, "SpaceUVEditor", NULL);
856 RNA_def_struct_sdna(srna, "SpaceImage");
857 RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
858 RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space");
861 prop= RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
862 RNA_def_property_enum_sdna(prop, NULL, "sticky");
863 RNA_def_property_enum_items(prop, sticky_mode_items);
864 RNA_def_property_ui_text(prop, "Sticky Selection Mode", "Automatically select also UVs sharing the same vertex as the ones being selected");
865 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
868 prop= RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE);
869 RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
870 RNA_def_property_enum_items(prop, dt_uv_items);
871 RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for drawing UV edges");
872 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
874 prop= RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE);
875 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
876 RNA_def_property_ui_text(prop, "Draw Smooth Edges", "Draw UV edges anti-aliased");
877 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
879 prop= RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE);
880 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
881 RNA_def_property_ui_text(prop, "Draw Stretch", "Draw faces colored according to the difference in shape between UVs and their 3D coordinates (blue for low distortion, red for high distortion)");
882 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
884 prop= RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE);
885 RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
886 RNA_def_property_enum_items(prop, dt_uvstretch_items);
887 RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw");
888 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
890 prop= RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE);
891 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW);
892 RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges after modifiers are applied");
893 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
895 prop= RNA_def_property(srna, "show_other_objects", PROP_BOOLEAN, PROP_NONE);
896 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_OTHER);
897 RNA_def_property_ui_text(prop, "Draw Other Objects", "Draw other selected objects that share the same image");
898 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
900 prop= RNA_def_property(srna, "show_normalized_coords", PROP_BOOLEAN, PROP_NONE);
901 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
902 RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels");
903 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
905 prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_NONE);
906 RNA_def_property_array(prop, 2);
907 RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get", "rna_SpaceImageEditor_cursor_location_set", NULL);
908 RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
909 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
911 /* todo: move edge and face drawing options here from G.f */
913 prop= RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
914 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
915 RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing");
916 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
918 prop= RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
919 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
920 RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing");
921 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
923 prop= RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
924 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
925 RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices");
926 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
928 prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
929 RNA_def_property_enum_sdna(prop, NULL, "around");
930 RNA_def_property_enum_items(prop, pivot_items);
931 RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
932 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
935 static void rna_def_space_outliner(BlenderRNA *brna)
940 static EnumPropertyItem display_mode_items[] = {
941 {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", ""},
942 {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", ""},
943 {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", ""},
944 {SO_SELECTED, "SELECTED", 0, "Selected", ""},
945 {SO_ACTIVE, "ACTIVE", 0, "Active", ""},
946 {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", ""},
947 {SO_GROUPS, "GROUPS", 0, "Groups", ""},
948 {SO_LIBRARIES, "LIBRARIES", 0, "Libraries", ""},
949 {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", ""},
950 {SO_DATABLOCKS, "DATABLOCKS", 0, "Datablocks", ""},
951 {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", ""},
952 {SO_KEYMAP, "KEYMAPS", 0, "Key Maps", ""},
953 {0, NULL, 0, NULL, NULL}};
955 srna= RNA_def_struct(brna, "SpaceOutliner", "Space");
956 RNA_def_struct_sdna(srna, "SpaceOops");
957 RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
959 prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
960 RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
961 RNA_def_property_enum_items(prop, display_mode_items);
962 RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
963 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
965 prop= RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
966 RNA_def_property_string_sdna(prop, NULL, "search_string");
967 RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
968 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
970 prop= RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE);
971 RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE);
972 RNA_def_property_ui_text(prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string");
973 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
975 prop= RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE);
976 RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE);
977 RNA_def_property_ui_text(prop, "Complete Matches Only", "Only use complete matches of search string");
978 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
980 prop= RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
981 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
982 RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");
983 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
986 static void rna_def_background_image(BlenderRNA *brna)
991 /* note: combinations work but dont flip so arnt that useful */
992 static EnumPropertyItem bgpic_axis_items[] = {
993 {0, "", 0, "X Axis", ""},
994 {(1<<RV3D_VIEW_LEFT), "LEFT", 0, "Left", ""},
995 {(1<<RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", ""},
996 /*{(1<<RV3D_VIEW_LEFT)|(1<<RV3D_VIEW_RIGHT), "LEFT_RIGHT", 0, "Left/Right", ""},*/
997 {0, "", 0, "Y Axis", ""},
998 {(1<<RV3D_VIEW_BACK), "BACK", 0, "Back", ""},
999 {(1<<RV3D_VIEW_FRONT), "FRONT", 0, "Front", ""},
1000 /*{(1<<RV3D_VIEW_BACK)|(1<<RV3D_VIEW_FRONT), "BACK_FRONT", 0, "Back/Front", ""},*/
1001 {0, "", 0, "Z Axis", ""},
1002 {(1<<RV3D_VIEW_BOTTOM), "BOTTOM", 0, "Bottom", ""},
1003 {(1<<RV3D_VIEW_TOP), "TOP", 0, "Top", ""},
1004 /*{(1<<RV3D_VIEW_BOTTOM)|(1<<RV3D_VIEW_TOP), "BOTTOM_TOP", 0, "Top/Bottom", ""},*/
1005 {0, "", 0, "Other", ""},
1006 {0, "ALL", 0, "All Views", ""},
1007 {(1<<RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", ""},
1008 {0, NULL, 0, NULL, NULL}};
1010 srna= RNA_def_struct(brna, "BackgroundImage", NULL);
1011 RNA_def_struct_sdna(srna, "BGpic");
1012 RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3d View background");
1014 prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1015 RNA_def_property_pointer_sdna(prop, NULL, "ima");
1016 RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
1017 RNA_def_property_flag(prop, PROP_EDITABLE);
1018 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1020 prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
1021 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1022 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
1023 RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
1024 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1026 prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
1027 RNA_def_property_float_sdna(prop, NULL, "xof");
1028 RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the world origin");
1029 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1031 prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
1032 RNA_def_property_float_sdna(prop, NULL, "yof");
1033 RNA_def_property_ui_text(prop, "Y Offset", "Offsets image vertically from the world origin");
1034 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1036 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1037 RNA_def_property_float_sdna(prop, NULL, "size");
1038 RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image");
1039 RNA_def_property_range(prop, 0.0, FLT_MAX);
1040 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1042 prop= RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
1043 RNA_def_property_float_sdna(prop, NULL, "blend");
1044 RNA_def_property_float_funcs(prop, "rna_BackgroundImage_opacity_get", "rna_BackgroundImage_opacity_set", NULL);
1045 RNA_def_property_ui_text(prop, "Opacity", "Image opacity to blend the image against the background color");
1046 RNA_def_property_range(prop, 0.0, 1.0);
1047 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1049 prop= RNA_def_property(srna, "view_axis", PROP_ENUM, PROP_NONE);
1050 RNA_def_property_enum_sdna(prop, NULL, "view");
1051 RNA_def_property_enum_items(prop, bgpic_axis_items);
1052 RNA_def_property_ui_text(prop, "Image Axis", "The axis to display the image on");
1053 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1055 prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
1056 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_EXPANDED);
1057 RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
1058 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
1062 static void rna_def_space_view3d(BlenderRNA *brna)
1066 const int matrix_dimsize[]= {4, 4};
1068 static EnumPropertyItem pivot_items[] = {
1069 {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
1070 {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", ""},
1071 {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", ""},
1072 {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", ""},
1073 {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", ""},
1074 {0, NULL, 0, NULL, NULL}};
1076 static EnumPropertyItem rv3d_persp_items[] = {
1077 {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
1078 {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
1079 {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
1080 {0, NULL, 0, NULL, NULL}};
1082 srna= RNA_def_struct(brna, "SpaceView3D", "Space");
1083 RNA_def_struct_sdna(srna, "View3D");
1084 RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
1086 prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
1087 RNA_def_property_flag(prop, PROP_EDITABLE);
1088 RNA_def_property_pointer_sdna(prop, NULL, "camera");
1089 RNA_def_property_ui_text(prop, "Camera", "Active camera used in this view (when unlocked from the scene's active camera)");
1090 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1092 prop= RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
1093 RNA_def_property_flag(prop, PROP_EDITABLE);
1094 RNA_def_property_pointer_sdna(prop, NULL, "ob_centre");
1095 RNA_def_property_ui_text(prop, "Lock to Object", "3D View center is locked to this object's position");
1096 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1098 prop= RNA_def_property(srna, "lock_bone", PROP_STRING, PROP_NONE);
1099 RNA_def_property_string_sdna(prop, NULL, "ob_centre_bone");
1100 RNA_def_property_ui_text(prop, "Lock to Bone", "3D View center is locked to this bone's position");
1101 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1103 prop= RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
1104 RNA_def_property_boolean_sdna(prop, NULL, "ob_centre_cursor", 1);
1105 RNA_def_property_ui_text(prop, "Lock to Cursor", "3D View center is locked to the cursor's position");
1106 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1108 prop= RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE);
1109 RNA_def_property_enum_sdna(prop, NULL, "drawtype");
1110 RNA_def_property_enum_items(prop, viewport_shade_items);
1111 RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
1112 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1114 prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
1115 RNA_def_property_pointer_sdna(prop, NULL, "localvd");
1116 RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility");
1118 prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
1119 RNA_def_property_array(prop, 3);
1120 RNA_def_property_float_funcs(prop, "rna_View3D_CursorLocation_get", "rna_View3D_CursorLocation_set", NULL);
1121 RNA_def_property_ui_text(prop, "3D Cursor Location", "3D cursor location for this view (dependent on local view setting)");
1122 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
1123 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1125 prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
1126 RNA_def_property_float_sdna(prop, NULL, "lens");
1127 RNA_def_property_ui_text(prop, "Lens", "Lens angle (mm) in perspective view");
1128 RNA_def_property_range(prop, 1.0f, 250.0f);
1129 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1131 prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
1132 RNA_def_property_float_sdna(prop, NULL, "near");
1133 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1134 RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance");
1135 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1137 prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
1138 RNA_def_property_float_sdna(prop, NULL, "far");
1139 RNA_def_property_range(prop, 1.0f, FLT_MAX);
1140 RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance");
1141 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1143 prop= RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE);
1144 RNA_def_property_float_sdna(prop, NULL, "grid");
1145 RNA_def_property_ui_text(prop, "Grid Scale", "The distance between 3D View grid lines");
1146 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1147 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1149 prop= RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
1150 RNA_def_property_int_sdna(prop, NULL, "gridlines");
1151 RNA_def_property_ui_text(prop, "Grid Lines", "The number of grid lines to display in perspective view");
1152 RNA_def_property_range(prop, 0, 1024);
1153 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1155 prop= RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
1156 RNA_def_property_int_sdna(prop, NULL, "gridsubdiv");
1157 RNA_def_property_ui_text(prop, "Grid Subdivisions", "The number of subdivisions between grid lines");
1158 RNA_def_property_range(prop, 1, 1024);
1159 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1161 prop= RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE);
1162 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
1163 RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view");
1164 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1166 prop= RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
1167 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);
1168 RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view");
1169 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1171 prop= RNA_def_property(srna, "show_axis_y", PROP_BOOLEAN, PROP_NONE);
1172 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y);
1173 RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view");
1174 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1176 prop= RNA_def_property(srna, "show_axis_z", PROP_BOOLEAN, PROP_NONE);
1177 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z);
1178 RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view");
1179 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1181 prop= RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE);
1182 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE);
1183 RNA_def_property_ui_text(prop, "Outline Selected", "Show an outline highlight around selected objects in non-wireframe views");
1184 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1186 prop= RNA_def_property(srna, "show_all_objects_origin", PROP_BOOLEAN, PROP_NONE);
1187 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS);
1188 RNA_def_property_ui_text(prop, "All Object Origins", "Show the object origin center dot for all (selected and unselected) objects");
1189 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1191 prop= RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
1192 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
1193 RNA_def_property_ui_text(prop, "Relationship Lines", "Show dashed lines indicating parent or constraint relationships");
1194 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1196 prop= RNA_def_property(srna, "show_textured_solid", PROP_BOOLEAN, PROP_NONE);
1197 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_TEX);
1198 RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view");
1199 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1201 prop= RNA_def_property(srna, "show_only_render", PROP_BOOLEAN, PROP_NONE);
1202 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
1203 RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered");
1204 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1206 prop= RNA_def_property(srna, "use_occlude_geometry", PROP_BOOLEAN, PROP_NONE);
1207 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT);
1208 RNA_def_property_ui_text(prop, "Occlude Geometry", "Limit selection to visible (clipped with depth buffer)");
1209 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
1210 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1212 prop= RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
1213 RNA_def_property_collection_sdna(prop, NULL, "bgpicbase", NULL);
1214 RNA_def_property_struct_type(prop, "BackgroundImage");
1215 RNA_def_property_ui_text(prop, "Background Images", "List of background images");
1216 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1218 prop= RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
1219 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPICS);
1220 RNA_def_property_ui_text(prop, "Display Background Images", "Display reference images behind objects in the 3D View");
1221 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1223 prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
1224 RNA_def_property_enum_sdna(prop, NULL, "around");
1225 RNA_def_property_enum_items(prop, pivot_items);
1226 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
1227 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1229 prop= RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
1230 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ALIGN);
1231 RNA_def_property_ui_text(prop, "Align", "Manipulate object centers only");
1232 RNA_def_property_ui_icon(prop, ICON_ALIGN, 0);
1233 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1235 prop= RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
1236 RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_USE_MANIPULATOR);
1237 RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms");
1238 RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0);
1239 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1241 prop= RNA_def_property(srna, "use_manipulator_translate", PROP_BOOLEAN, PROP_NONE);
1242 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_TRANSLATE);
1243 RNA_def_property_ui_text(prop, "Manipulator Translate", "Use the manipulator for movement transformations");
1244 RNA_def_property_ui_icon(prop, ICON_MAN_TRANS, 0);
1245 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1247 prop= RNA_def_property(srna, "use_manipulator_rotate", PROP_BOOLEAN, PROP_NONE);
1248 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_ROTATE);
1249 RNA_def_property_ui_text(prop, "Manipulator Rotate", "Use the manipulator for rotation transformations");
1250 RNA_def_property_ui_icon(prop, ICON_MAN_ROT, 0);
1251 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1253 prop= RNA_def_property(srna, "use_manipulator_scale", PROP_BOOLEAN, PROP_NONE);
1254 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_SCALE);
1255 RNA_def_property_ui_text(prop, "Manipulator Scale", "Use the manipulator for scale transformations");
1256 RNA_def_property_ui_icon(prop, ICON_MAN_SCALE, 0);
1257 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1259 prop= RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE);
1260 RNA_def_property_enum_sdna(prop, NULL, "twmode");
1261 RNA_def_property_enum_items(prop, transform_orientation_items);
1262 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformOrientation_itemf");
1263 RNA_def_property_ui_text(prop, "Transform Orientation", "Transformation orientation");
1264 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1266 prop= RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE);
1267 RNA_def_property_struct_type(prop, "TransformOrientation");
1268 RNA_def_property_pointer_funcs(prop, "rna_CurrentOrientation_get", NULL, NULL, NULL);
1269 RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current Transformation orientation");
1271 prop= RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
1272 RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
1273 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set");
1274 RNA_def_property_ui_text(prop, "Lock Camera and Layers", "Use the scene's active camera and layers in this view, rather than local layers");
1275 RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1);
1276 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1278 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1279 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
1280 RNA_def_property_array(prop, 20);
1281 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_layer_set");
1282 RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View");
1283 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update");
1285 prop= RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1286 RNA_def_property_boolean_sdna(prop, NULL, "lay_used", 1);
1287 RNA_def_property_array(prop, 20);
1288 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1289 RNA_def_property_ui_text(prop, "Used Layers", "Layers that contain something");
1291 prop= RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
1292 RNA_def_property_struct_type(prop, "RegionView3D");
1293 RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_3d_get", NULL, NULL, NULL);
1294 RNA_def_property_ui_text(prop, "3D Region", "3D region in this space, in case of quad view the camera region");
1296 prop= RNA_def_property(srna, "region_quadview", PROP_POINTER, PROP_NONE);
1297 RNA_def_property_struct_type(prop, "RegionView3D");
1298 RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_quadview_get", NULL, NULL, NULL);
1299 RNA_def_property_ui_text(prop, "Quad View Region", "3D region that defines the quad view settings");
1303 srna= RNA_def_struct(brna, "RegionView3D", NULL);
1304 RNA_def_struct_sdna(srna, "RegionView3D");
1305 RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data");
1307 prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
1308 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_LOCKED);
1309 RNA_def_property_ui_text(prop, "Lock", "Lock view rotation in side views");
1310 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
1312 prop= RNA_def_property(srna, "show_sync_view", PROP_BOOLEAN, PROP_NONE);
1313 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXVIEW);
1314 RNA_def_property_ui_text(prop, "Box", "Sync view position between side views");
1315 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
1317 prop= RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
1318 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
1319 RNA_def_property_ui_text(prop, "Clip", "Clip objects based on what's visible in other side views");
1320 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_clip_update");
1322 prop= RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
1323 RNA_def_property_float_sdna(prop, NULL, "persmat");
1324 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX: for now, it's too risky for users to do this
1325 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1326 RNA_def_property_ui_text(prop, "Perspective Matrix", "Current perspective matrix of the 3D region");
1328 prop= RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX);
1329 RNA_def_property_float_sdna(prop, NULL, "viewmat");
1330 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX: for now, it's too risky for users to do this
1331 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1332 RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix of the 3D region");
1334 prop= RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
1335 RNA_def_property_enum_sdna(prop, NULL, "persp");
1336 RNA_def_property_enum_items(prop, rv3d_persp_items);
1337 RNA_def_property_ui_text(prop, "Perspective", "View Perspective");
1338 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1340 prop= RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
1342 RNA_def_property_float_sdna(prop, NULL, "ofs"); // cant use because its negated
1344 RNA_def_property_array(prop, 3);
1345 RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL);
1347 RNA_def_property_ui_text(prop, "View Location", "View pivot location");
1348 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
1349 RNA_def_property_update(prop, NC_WINDOW, NULL);
1351 prop= RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION);
1352 RNA_def_property_float_sdna(prop, NULL, "viewquat");
1353 RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
1354 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1356 /* not sure we need rna access to these but adding anyway */
1357 prop= RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
1358 RNA_def_property_float_sdna(prop, NULL, "dist");
1359 RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
1360 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
1363 static void rna_def_space_buttons(BlenderRNA *brna)
1368 static EnumPropertyItem buttons_context_items[] = {
1369 {BCONTEXT_SCENE, "SCENE", ICON_SCENE, "Scene", "Scene"},
1370 {BCONTEXT_RENDER, "RENDER", ICON_SCENE_DATA, "Render", "Render"},
1371 {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
1372 {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
1373 {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Constraints"},
1374 {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifiers", "Modifiers"},
1375 {BCONTEXT_DATA, "DATA", 0, "Data", "Data"},
1376 {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"},
1377 {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT, "Bone Constraints", "Bone Constraints"},
1378 {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
1379 {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
1380 {BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"},
1381 {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
1382 {0, NULL, 0, NULL, NULL}};
1384 static EnumPropertyItem align_items[] = {
1385 {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
1386 {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
1387 {0, NULL, 0, NULL, NULL}};
1389 static EnumPropertyItem buttons_texture_context_items[] = {
1390 {SB_TEXC_MAT_OR_LAMP, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
1391 {0, NULL, 0, NULL, NULL}}; //actually populated dynamically trough a function
1393 srna= RNA_def_struct(brna, "SpaceProperties", "Space");
1394 RNA_def_struct_sdna(srna, "SpaceButs");
1395 RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
1397 prop= RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
1398 RNA_def_property_enum_sdna(prop, NULL, "mainb");
1399 RNA_def_property_enum_items(prop, buttons_context_items);
1400 RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_context_set", NULL);
1401 RNA_def_property_ui_text(prop, "Context", "Type of active data to display and edit");
1402 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
1404 prop= RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
1405 RNA_def_property_enum_sdna(prop, NULL, "align");
1406 RNA_def_property_enum_items(prop, align_items);
1407 RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_align_set", NULL);
1408 RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels");
1409 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
1411 prop= RNA_def_property(srna, "texture_context", PROP_ENUM, PROP_NONE);
1412 RNA_def_property_enum_items(prop, buttons_texture_context_items);
1413 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceProperties_texture_context_itemf");
1414 RNA_def_property_ui_text(prop, "Texture Context", "Type of texture data to display and edit");
1415 RNA_def_property_update(prop, NC_TEXTURE, NULL);
1418 prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
1419 RNA_def_property_pointer_sdna(prop, NULL, "pinid");
1420 RNA_def_property_struct_type(prop, "ID");
1421 /* note: custom set function is ONLY to avoid rna setting a user for this. */
1422 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef", NULL);
1423 RNA_def_property_flag(prop, PROP_EDITABLE);
1424 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
1426 prop= RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
1427 RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
1428 RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
1431 static void rna_def_space_image(BlenderRNA *brna)
1436 srna= RNA_def_struct(brna, "SpaceImageEditor", "Space");
1437 RNA_def_struct_sdna(srna, "SpaceImage");
1438 RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data");
1441 prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1442 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL);
1443 RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
1444 RNA_def_property_flag(prop, PROP_EDITABLE);
1445 RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); // is handled in image editor too
1447 prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
1448 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1449 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
1450 RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
1451 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1453 prop= RNA_def_property(srna, "curves", PROP_POINTER, PROP_NONE);
1454 RNA_def_property_pointer_sdna(prop, NULL, "cumap");
1455 RNA_def_property_ui_text(prop, "Curves", "Color curve mapping to use for displaying the image");
1456 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_curves_update");
1458 prop= RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
1459 RNA_def_property_pointer_sdna(prop, NULL, "scopes");
1460 RNA_def_property_struct_type(prop, "Scopes");
1461 RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize image statistics.");
1462 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_scopes_update");
1464 prop= RNA_def_property(srna, "use_image_pin", PROP_BOOLEAN, PROP_NONE);
1465 RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
1466 RNA_def_property_ui_text(prop, "Image Pin", "Display current image regardless of object selection");
1467 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
1468 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1470 prop= RNA_def_property(srna, "sample_histogram", PROP_POINTER, PROP_NONE);
1471 RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist");
1472 RNA_def_property_struct_type(prop, "Histogram");
1473 RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line");
1476 prop= RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);
1477 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
1478 RNA_def_property_ui_text(prop, "Draw Repeated", "Draw the image repeated outside of the main view");
1479 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1481 prop= RNA_def_property(srna, "draw_channels", PROP_ENUM, PROP_NONE);
1482 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
1483 RNA_def_property_enum_items(prop, draw_channels_items);
1484 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_draw_channels_itemf");
1485 RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
1486 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
1489 prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE);
1490 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1491 RNA_def_property_struct_type(prop, "SpaceUVEditor");
1492 RNA_def_property_pointer_funcs(prop, "rna_SpaceImageEditor_uvedit_get", NULL, NULL, NULL);
1493 RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings");
1496 prop= RNA_def_property(srna, "use_image_paint", PROP_BOOLEAN, PROP_NONE);
1497 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWTOOL);
1498 RNA_def_property_ui_text(prop, "Image Painting", "Enable image painting mode");
1499 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
1500 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_paint_update");
1503 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
1504 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
1505 RNA_def_property_flag(prop, PROP_EDITABLE);
1506 RNA_def_property_struct_type(prop, "GreasePencil");
1507 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
1509 prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
1510 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
1511 RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
1514 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
1515 RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
1516 RNA_def_property_ui_text(prop, "Update Automatically", "Update other affected window spaces automatically to reflect changes during interactive operations such as transform");
1519 prop= RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
1520 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_render_get", NULL);
1521 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1522 RNA_def_property_ui_text(prop, "Show Render", "Show render related properties");
1524 prop= RNA_def_property(srna, "show_paint", PROP_BOOLEAN, PROP_NONE);
1525 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_paint_get", NULL);
1526 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1527 RNA_def_property_ui_text(prop, "Show Paint", "Show paint related properties");
1529 prop= RNA_def_property(srna, "show_uvedit", PROP_BOOLEAN, PROP_NONE);
1530 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_uvedit_get", NULL);
1531 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1532 RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
1534 rna_def_space_image_uv(brna);
1537 static void rna_def_space_sequencer(BlenderRNA *brna)
1542 static EnumPropertyItem view_type_items[] = {
1543 {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
1544 {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
1545 {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer and Image Preview", ""},
1546 {0, NULL, 0, NULL, NULL}};
1548 static EnumPropertyItem display_mode_items[] = {
1549 {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
1550 {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
1551 {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
1552 {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", ICON_SEQ_HISTOGRAM, "Histogram", ""},
1553 {0, NULL, 0, NULL, NULL}};
1555 static EnumPropertyItem proxy_render_size_items[] = {
1556 {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
1557 {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
1558 {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
1559 {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
1560 {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
1561 {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
1562 {0, NULL, 0, NULL, NULL}};
1564 srna= RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
1565 RNA_def_struct_sdna(srna, "SpaceSeq");
1566 RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
1568 /* view type, fairly important */
1569 prop= RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
1570 RNA_def_property_enum_sdna(prop, NULL, "view");
1571 RNA_def_property_enum_items(prop, view_type_items);
1572 RNA_def_property_ui_text(prop, "View Type", "The type of the Sequencer view (sequencer, preview or both)");
1573 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
1574 RNA_def_property_update(prop, 0, "rna_Sequencer_display_mode_update");
1576 /* display type, fairly important */
1577 prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
1578 RNA_def_property_enum_sdna(prop, NULL, "mainb");
1579 RNA_def_property_enum_items(prop, display_mode_items);
1580 RNA_def_property_ui_text(prop, "Display Mode", "The view mode to use for displaying sequencer output");
1581 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1584 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
1585 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
1586 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
1587 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1589 prop= RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
1590 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
1591 RNA_def_property_ui_text(prop, "Draw Frames", "Draw frames rather than seconds");
1592 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1594 prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
1595 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS);
1596 RNA_def_property_ui_text(prop, "Transform Markers", "Transform markers as well as strips");
1597 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1599 prop= RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE);
1600 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPERATED);
1601 RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview");
1602 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1604 prop= RNA_def_property(srna, "show_safe_margin", PROP_BOOLEAN, PROP_NONE);
1605 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_SAFE_MARGINS);
1606 RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");
1607 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1609 prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
1610 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL);
1611 RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
1612 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1615 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
1616 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
1617 RNA_def_property_struct_type(prop, "UnknownType");
1618 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
1619 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1621 prop= RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
1622 RNA_def_property_int_sdna(prop, NULL, "chanshown");
1623 RNA_def_property_ui_text(prop, "Display Channel", "The channel number shown in the image preview. 0 is the result of all strips combined");
1624 RNA_def_property_range(prop, -5, 32); // MAXSEQ --- todo, move from BKE_sequencer.h, allow up to 5 layers up the metastack. Should be dynamic...
1625 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1627 prop= RNA_def_property(srna, "draw_overexposed", PROP_INT, PROP_NONE);
1628 RNA_def_property_int_sdna(prop, NULL, "zebra");
1629 RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes");
1630 RNA_def_property_range(prop, 0, 110);
1631 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1633 prop= RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
1634 RNA_def_property_enum_sdna(prop, NULL, "render_size");
1635 RNA_def_property_enum_items(prop, proxy_render_size_items);
1636 RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
1637 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1640 /* not sure we need rna access to these but adding anyway */
1641 prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
1642 RNA_def_property_float_sdna(prop, NULL, "xof");
1643 RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the view center");
1644 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1646 prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
1647 RNA_def_property_float_sdna(prop, NULL, "yof");
1648 RNA_def_property_ui_text(prop, "Y Offset", "Offsets image horizontally from the view center");
1649 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1651 prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
1652 RNA_def_property_float_sdna(prop, NULL, "zoom");
1653 RNA_def_property_ui_text(prop, "Zoom", "Display zoom level");
1654 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
1657 static void rna_def_space_text(BlenderRNA *brna)
1662 srna= RNA_def_struct(brna, "SpaceTextEditor", "Space");
1663 RNA_def_struct_sdna(srna, "SpaceText");
1664 RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data");
1667 prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
1668 RNA_def_property_flag(prop, PROP_EDITABLE);
1669 RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space");
1670 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL, NULL);
1671 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1674 prop= RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
1675 RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
1676 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
1677 RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space");
1678 RNA_def_property_ui_icon(prop, ICON_WORDWRAP_OFF, 1);
1679 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1681 prop= RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
1682 RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
1683 RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text");
1684 RNA_def_property_ui_icon(prop, ICON_LINENUMBERS_OFF, 1);
1685 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1687 prop= RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
1688 RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
1689 RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
1690 RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 1);
1691 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1693 prop= RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
1694 RNA_def_property_boolean_sdna(prop, NULL, "line_hlight", 0);
1695 RNA_def_property_ui_text(prop, "Highlight Line", "Highlight the current line");
1696 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1698 prop= RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
1699 RNA_def_property_int_sdna(prop, NULL, "tabnumber");
1700 RNA_def_property_range(prop, 2, 8);
1701 RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with");
1702 RNA_def_property_update(prop, NC_TEXT|NA_EDITED, NULL);
1704 prop= RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE);
1705 RNA_def_property_int_sdna(prop, NULL, "lheight");
1706 RNA_def_property_range(prop, 8, 32);
1707 RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
1708 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1710 prop= RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE);
1711 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_SHOW_MARGIN);
1712 RNA_def_property_ui_text(prop, "Show Margin", "Show right margin");
1713 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1715 prop= RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE);
1716 RNA_def_property_int_sdna(prop, NULL, "margin_column");
1717 RNA_def_property_range(prop, 0, 1024);
1718 RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at");
1719 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1721 /* functionality options */
1722 prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
1723 RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1);
1724 RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
1725 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1727 prop= RNA_def_property(srna, "use_live_edit", PROP_BOOLEAN, PROP_NONE);
1728 RNA_def_property_boolean_sdna(prop, NULL, "live_edit", 1);
1729 RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
1730 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1733 prop= RNA_def_property(srna, "use_find_all", PROP_BOOLEAN, PROP_NONE);
1734 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
1735 RNA_def_property_ui_text(prop, "Find All", "Search in all text datablocks, instead of only the active one");
1736 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1738 prop= RNA_def_property(srna, "use_find_wrap", PROP_BOOLEAN, PROP_NONE);
1739 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_WRAP);
1740 RNA_def_property_ui_text(prop, "Find Wrap", "Search again from the start of the file when reaching the end");
1741 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1743 prop= RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
1744 RNA_def_property_string_sdna(prop, NULL, "findstr");
1745 RNA_def_property_ui_text(prop, "Find Text", "Text to search for with the find tool");
1746 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1748 prop= RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
1749 RNA_def_property_string_sdna(prop, NULL, "replacestr");
1750 RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool");
1751 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
1754 static void rna_def_space_dopesheet(BlenderRNA *brna)
1759 static EnumPropertyItem mode_items[] = {
1760 {SACTCONT_DOPESHEET, "DOPESHEET", 0, "DopeSheet", ""},
1761 {SACTCONT_ACTION, "ACTION", 0, "Action Editor", ""},
1762 {SACTCONT_SHAPEKEY, "SHAPEKEY", 0, "ShapeKey Editor", ""},
1763 {SACTCONT_GPENCIL, "GPENCIL", 0, "Grease Pencil", ""},
1764 {0, NULL, 0, NULL, NULL}};
1767 srna= RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space");
1768 RNA_def_struct_sdna(srna, "SpaceAction");
1769 RNA_def_struct_ui_text(srna, "Space DopeSheet Editor", "DopeSheet space data");
1772 prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1773 RNA_def_property_flag(prop, PROP_EDITABLE);
1774 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL, NULL);
1775 RNA_def_property_ui_text(prop, "Action", "Action displayed and edited in this space");
1776 RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, "rna_SpaceDopeSheetEditor_action_update");
1779 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1780 RNA_def_property_enum_sdna(prop, NULL, "mode");
1781 RNA_def_property_enum_items(prop, mode_items);
1782 RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
1783 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
1786 prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
1787 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_DRAWTIME);
1788 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, only set with operator
1789 RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
1790 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1792 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
1793 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWCFRANUM);
1794 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
1795 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1797 prop= RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
1798 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SLIDERS);
1799 RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
1800 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1802 prop= RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE);
1803 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW);
1804 RNA_def_property_ui_text(prop, "Show Pose Markers", "Show markers belonging to the active action instead of Scene markers (Action and Shape Key Editors only)");
1805 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1808 prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
1809 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
1810 RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
1811 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1813 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
1814 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOREALTIMEUPDATES);
1815 RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming keyframes, changes to the animation data are flushed to other views");
1816 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1818 prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
1819 RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_MARKERS_MOVE);
1820 RNA_def_property_ui_text(prop, "Sync Markers", "Sync Markers with keyframe edits");
1823 prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
1824 RNA_def_property_struct_type(prop, "DopeSheet");
1825 RNA_def_property_pointer_sdna(prop, NULL, "ads");
1826 RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
1829 prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
1830 RNA_def_property_enum_sdna(prop, NULL, "autosnap");
1831 RNA_def_property_enum_items(prop, autosnap_items);
1832 RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
1833 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
1836 static void rna_def_space_graph(BlenderRNA *brna)
1841 static EnumPropertyItem mode_items[] = {
1842 {SIPO_MODE_ANIMATION, "FCURVES", 0, "F-Curve Editor", ""},
1843 {SIPO_MODE_DRIVERS, "DRIVERS", 0, "Drivers", ""},
1844 {0, NULL, 0, NULL, NULL}};
1846 /* this is basically the same as the one for the 3D-View, but with some entries ommitted */
1847 static EnumPropertyItem gpivot_items[] = {
1848 {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
1849 {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
1850 {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""},
1851 //{V3D_CENTROID, "MEDIAN_POINT", 0, "Median Point", ""},
1852 //{V3D_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""},
1853 {0, NULL, 0, NULL, NULL}};
1856 srna= RNA_def_struct(brna, "SpaceGraphEditor", "Space");
1857 RNA_def_struct_sdna(srna, "SpaceIpo");
1858 RNA_def_struct_ui_text(srna, "Space Graph Editor", "Graph Editor space data");
1861 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1862 RNA_def_property_enum_sdna(prop, NULL, "mode");
1863 RNA_def_property_enum_items(prop, mode_items);
1864 RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
1865 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
1866 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, "rna_SpaceGraphEditor_display_mode_update");
1869 prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
1870 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_DRAWTIME);
1871 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, only set with operator
1872 RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
1873 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1875 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
1876 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCFRANUM);
1877 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
1878 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1880 prop= RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
1881 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SLIDERS);
1882 RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
1883 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1885 prop= RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
1886 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOHANDLES);
1887 RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points");
1888 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1890 prop= RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE);
1891 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY);
1892 RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes", "Only keyframes of selected F-Curves are visible and editable");
1893 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1895 prop= RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
1896 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
1897 RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
1898 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1900 prop= RNA_def_property(srna, "use_fancy_drawing", PROP_BOOLEAN, PROP_NONE);
1901 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
1902 RNA_def_property_ui_text(prop, "Use Fancy Drawing", "Draw F-Curves using Anti-Aliasing and other fancy effects. Disable for better performance");
1903 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1906 prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
1907 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);
1908 RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
1909 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1911 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
1912 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOREALTIMEUPDATES);
1913 RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming keyframes, changes to the animation data are flushed to other views");
1914 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1917 prop= RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
1918 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCURSOR);
1919 RNA_def_property_ui_text(prop, "Show Cursor", "Show 2D cursor");
1920 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1922 prop= RNA_def_property(srna, "cursor_position_y", PROP_FLOAT, PROP_NONE);
1923 RNA_def_property_float_sdna(prop, NULL, "cursorVal");
1924 RNA_def_property_ui_text(prop, "Cursor Y-Value", "Graph Editor 2D-Value cursor - Y-Value component");
1925 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1927 prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
1928 RNA_def_property_enum_sdna(prop, NULL, "around");
1929 RNA_def_property_enum_items(prop, gpivot_items);
1930 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
1931 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1934 prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
1935 RNA_def_property_struct_type(prop, "DopeSheet");
1936 RNA_def_property_pointer_sdna(prop, NULL, "ads");
1937 RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
1940 prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
1941 RNA_def_property_enum_sdna(prop, NULL, "autosnap");
1942 RNA_def_property_enum_items(prop, autosnap_items);
1943 RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
1944 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1946 /* readonly state info */
1947 prop= RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE);
1948 RNA_def_property_boolean_sdna(prop, NULL, "flag", 0); /* XXX: hack to make this compile, since this property doesn't actually exist*/
1949 RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL);
1950 RNA_def_property_ui_text(prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored");
1951 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
1954 static void rna_def_space_nla(BlenderRNA *brna)
1959 srna= RNA_def_struct(brna, "SpaceNLA", "Space");
1960 RNA_def_struct_sdna(srna, "SpaceNla");
1961 RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data");
1964 prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
1965 RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_DRAWTIME);
1966 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, only set with operator
1967 RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
1968 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
1970 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
1971 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM);
1972 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
1973 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
1975 prop= RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE);
1976 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES);
1977 RNA_def_property_ui_text(prop, "Show Control Curves", "Show influence curves on strips");
1978 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
1981 prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
1982 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES);
1983 RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming strips, changes to the animation data are flushed to other views");
1984 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
1987 prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
1988 RNA_def_property_struct_type(prop, "DopeSheet");
1989 RNA_def_property_pointer_sdna(prop, NULL, "ads");
1990 RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
1993 prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
1994 RNA_def_property_enum_sdna(prop, NULL, "autosnap");
1995 RNA_def_property_enum_items(prop, autosnap_items);
1996 RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
1997 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
2000 static void rna_def_space_time(BlenderRNA *brna)
2005 srna= RNA_def_struct(brna, "SpaceTimeline", "Space");
2006 RNA_def_struct_sdna(srna, "SpaceTime");
2007 RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data");
2010 prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
2011 RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL);
2012 RNA_def_property_ui_text(prop, "Only Selected channels", "Show keyframes for active Object and/or its selected channels only");
2013 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2015 prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
2016 RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CFRA_NUM);
2017 RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
2018 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2020 /* displaying cache status */
2021 prop= RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE);
2022 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DISPLAY);
2023 RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");
2024 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2026 prop= RNA_def_property(srna, "cache_softbody", PROP_BOOLEAN, PROP_NONE);
2027 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SOFTBODY);
2028 RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
2029 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2031 prop= RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
2032 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_PARTICLES);
2033 RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
2034 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2036 prop= RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
2037 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_CLOTH);
2038 RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
2039 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2041 prop= RNA_def_property(srna, "cache_smoke", PROP_BOOLEAN, PROP_NONE);
2042 RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SMOKE);
2043 RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");
2044 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
2047 static void rna_def_console_line(BlenderRNA *brna)
2052 srna = RNA_def_struct(brna, "ConsoleLine", NULL);
2053 RNA_def_struct_ui_text(srna, "Console Input", "Input line for the interactive console");
2054 // XXX using non-inited "prop", uh? RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2056 prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
2057 RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length", "rna_ConsoleLine_body_set");
2058 RNA_def_property_ui_text(prop, "Line", "Text in the line");
2059 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2061 prop= RNA_def_property(srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */
2062 RNA_def_property_int_sdna(prop, NULL, "cursor");
2063 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_ConsoleLine_cursor_index_range");
2064 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2067 static void rna_def_space_console(BlenderRNA *brna)
2072 srna= RNA_def_struct(brna, "SpaceConsole", "Space");
2073 RNA_def_struct_sdna(srna, "SpaceConsole");
2074 RNA_def_struct_ui_text(srna, "Space Console", "Interactive python console");
2077 prop= RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); /* copied from text editor */
2078 RNA_def_property_int_sdna(prop, NULL, "lheight");
2079 RNA_def_property_range(prop, 8, 32);
2080 RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
2081 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2084 prop= RNA_def_property(srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
2085 RNA_def_property_int_sdna(prop, NULL, "sel_start");
2086 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2088 prop= RNA_def_property(srna, "select_end", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
2089 RNA_def_property_int_sdna(prop, NULL, "sel_end");
2090 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
2092 prop= RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
2093 RNA_def_property_ui_text(prop, "Prompt", "Command line prompt");
2095 prop= RNA_def_property(srna, "language", PROP_STRING, PROP_NONE);
2096 RNA_def_property_ui_text(prop, "Language", "Command line prompt language");
2098 prop= RNA_def_property(srna, "history", PROP_COLLECTION, PROP_NONE);
2099 RNA_def_property_collection_sdna(prop, NULL, "history", NULL);
2100 RNA_def_property_struct_type(prop, "ConsoleLine");
2101 RNA_def_property_ui_text(prop, "History", "Command history");
2103 prop= RNA_def_property(srna, "scrollback", PROP_COLLECTION, PROP_NONE);
2104 RNA_def_property_collection_sdna(prop, NULL, "scrollback", NULL);
2105 RNA_def_property_struct_type(prop, "ConsoleLine");
2106 RNA_def_property_ui_text(prop, "Output", "Command output");
2109 static void rna_def_fileselect_params(BlenderRNA *brna)
2114 static EnumPropertyItem file_display_items[] = {
2115 {FILE_SHORTDISPLAY, "FILE_SHORTDISPLAY", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
2116 {FILE_LONGDISPLAY, "FILE_LONGDISPLAY", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
2117 {FILE_IMGDISPLAY, "FILE_IMGDISPLAY", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
2118 {0, NULL, 0, NULL, NULL}};
2120 static EnumPropertyItem file_sort_items[] = {
2121 {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
2122 {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension"},
2123 {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
2124 {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
2125 {0, NULL, 0, NULL, NULL}};
2127 srna= RNA_def_struct(brna, "FileSelectParams", NULL);
2128 RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
2130 prop= RNA_def_property(srna, "title", PROP_STRING, PROP_NONE);
2131 RNA_def_property_string_sdna(prop, NULL, "title");
2132 RNA_def_property_ui_text(prop, "Title", "Title for the file browser");
2133 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2135 prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
2136 RNA_def_property_string_sdna(prop, NULL, "dir");
2137 RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser");
2138 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2140 prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
2141 RNA_def_property_string_sdna(prop, NULL, "file");
2142 RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
2143 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2145 prop= RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
2146 RNA_def_property_enum_sdna(prop, NULL, "display");
2147 RNA_def_property_enum_items(prop, file_display_items);
2148 RNA_def_property_ui_text(prop, "Display Mode", "Display mode for the file list");
2149 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2151 prop= RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
2152 RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER);
2153 RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files");
2154 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2156 prop= RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
2157 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
2158 RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
2159 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS , NULL);
2161 prop= RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
2162 RNA_def_property_enum_sdna(prop, NULL, "sort");
2163 RNA_def_property_enum_items(prop, file_sort_items);
2164 RNA_def_property_ui_text(prop, "Sort", "");
2165 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2167 prop= RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE);
2168 RNA_def_property_boolean_sdna(prop, NULL, "filter", IMAGEFILE);
2169 RNA_def_property_ui_text(prop, "Filter Images", "Show image files");
2170 RNA_def_property_ui_icon(prop, ICON_FILE_IMAGE, 0);
2171 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2173 prop= RNA_def_property(srna, "use_filter_blender", PROP_BOOLEAN, PROP_NONE);
2174 RNA_def_property_boolean_sdna(prop, NULL, "filter", BLENDERFILE);
2175 RNA_def_property_ui_text(prop, "Filter Blender", "Show .blend files");
2176 RNA_def_property_ui_icon(prop, ICON_FILE_BLEND, 0);
2177 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2179 prop= RNA_def_property(srna, "use_filter_movie", PROP_BOOLEAN, PROP_NONE);
2180 RNA_def_property_boolean_sdna(prop, NULL, "filter", MOVIEFILE);
2181 RNA_def_property_ui_text(prop, "Filter Movies", "Show movie files");
2182 RNA_def_property_ui_icon(prop, ICON_FILE_MOVIE, 0);
2183 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2185 prop= RNA_def_property(srna, "use_filter_script", PROP_BOOLEAN, PROP_NONE);
2186 RNA_def_property_boolean_sdna(prop, NULL, "filter", PYSCRIPTFILE);
2187 RNA_def_property_ui_text(prop, "Filter Script", "Show script files");
2188 RNA_def_property_ui_icon(prop, ICON_FILE_SCRIPT, 0);
2189 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2191 prop= RNA_def_property(srna, "use_filter_font", PROP_BOOLEAN, PROP_NONE);
2192 RNA_def_property_boolean_sdna(prop, NULL, "filter", FTFONTFILE);
2193 RNA_def_property_ui_text(prop, "Filter Fonts", "Show font files");
2194 RNA_def_property_ui_icon(prop, ICON_FILE_FONT, 0);
2195 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2197 prop= RNA_def_property(srna, "use_filter_sound", PROP_BOOLEAN, PROP_NONE);
2198 RNA_def_property_boolean_sdna(prop, NULL, "filter", SOUNDFILE);
2199 RNA_def_property_ui_text(prop, "Filter Sound", "Show sound files");
2200 RNA_def_property_ui_icon(prop, ICON_FILE_SOUND, 0);
2201 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2203 prop= RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
2204 RNA_def_property_boolean_sdna(prop, NULL, "filter", TEXTFILE);
2205 RNA_def_property_ui_text(prop, "Filter Text", "Show text files");
2206 RNA_def_property_ui_icon(prop, ICON_FILE_BLANK, 0);
2207 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2209 prop= RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
2210 RNA_def_property_boolean_sdna(prop, NULL, "filter", FOLDERFILE);
2211 RNA_def_property_ui_text(prop, "Filter Folder", "Show folders");
2212 RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0);
2213 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
2215 prop= RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE);
2216 RNA_def_property_string_sdna(prop, NULL, "filter_glob");
2217 RNA_def_property_ui_text(prop, "Extension Filter", "");
2218 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
2222 static void rna_def_space_filebrowser(BlenderRNA *brna)
2227 srna= RNA_def_struct(brna, "SpaceFileBrowser", "Space");
2228 RNA_def_struct_sdna(srna, "SpaceFile");
2229 RNA_def_struct_ui_text(srna, "Space File Browser", "File browser space data");
2231 prop= RNA_def_property(srna, "params", PROP_POINTER, PROP_NONE);
2232 RNA_def_property_pointer_sdna(prop, NULL, "params");
2233 RNA_def_property_ui_text(prop, "Filebrowser Parameter", "Parameters and Settings for the Filebrowser");
2235 prop= RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
2236 RNA_def_property_pointer_sdna(prop, NULL, "op");
2237 RNA_def_property_ui_text(prop, "Operator", "");
2240 static void rna_def_space_info(BlenderRNA *brna)
2245 srna= RNA_def_struct(brna, "SpaceInfo", "Space");
2246 RNA_def_struct_sdna(srna, "SpaceInfo");
2247 RNA_def_struct_ui_text(srna, "Space Info", "Info space data");
2249 /* reporting display */
2250 prop= RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
2251 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_DEBUG);
2252 RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
2253 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2255 prop= RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
2256 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_INFO);
2257 RNA_def_property_ui_text(prop, "Show Info", "Display general information");
2258 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2260 prop= RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
2261 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_OP);
2262 RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
2263 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2265 prop= RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
2266 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_WARN);
2267 RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
2268 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2270 prop= RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
2271 RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
2272 RNA_def_property_ui_text(prop, "Show Error", "Display error text");
2273 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
2276 static void rna_def_space_userpref(BlenderRNA *brna)
2281 srna= RNA_def_struct(brna, "SpaceUserPreferences", "Space");
2282 RNA_def_struct_sdna(srna, "SpaceUserPref");
2283 RNA_def_struct_ui_text(srna, "Space User Preferences", "User preferences space data");
2285 prop= RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
2286 RNA_def_property_string_sdna(prop, NULL, "filter");
2287 RNA_def_property_ui_text(prop, "Filter", "Search term for filtering in the UI");
2291 static void rna_def_space_node(BlenderRNA *brna)
2296 static EnumPropertyItem tree_type_items[] = {
2297 {NTREE_SHADER, "MATERIAL", ICON_MATERIAL, "Material", "Material nodes"},
2298 {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
2299 {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
2300 {0, NULL, 0, NULL, NULL}};
2302 static EnumPropertyItem texture_type_items[] = {
2303 {SNODE_TEX_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit texture nodes from Object"},
2304 {SNODE_TEX_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit texture nodes from World"},
2305 {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"},
2306 {0, NULL, 0, NULL, NULL}};
2308 static EnumPropertyItem backdrop_channels_items[] = {
2309 {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
2310 {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"},
2311 {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
2312 {0, NULL, 0, NULL, NULL}};
2314 srna= RNA_def_struct(brna, "SpaceNodeEditor", "Space");
2315 RNA_def_struct_sdna(srna, "SpaceNode");
2316 RNA_def_struct_ui_text(srna, "Space Node Editor", "Node editor space data");
2318 prop= RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE);
2319 RNA_def_property_enum_sdna(prop, NULL, "treetype");
2320 RNA_def_property_enum_items(prop, tree_type_items);
2321 RNA_def_property_ui_text(prop, "Tree Type", "Node tree type to display and edit");
2322 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
2324 prop= RNA_def_property(srna, "texture_type", PROP_ENUM, PROP_NONE);
2325 RNA_def_property_enum_sdna(prop, NULL, "texfrom");
2326 RNA_def_property_enum_items(prop, texture_type_items);
2327 RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from");
2328 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
2330 prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
2331 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2332 RNA_def_property_ui_text(prop, "ID", "Datablock whose nodes are being edited");
2334 prop= RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE);
2335 RNA_def_property_pointer_sdna(prop, NULL, "from");
2336 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2337 RNA_def_property_ui_text(prop, "ID From", "Datablock from which the edited datablock is linked");
2339 prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
2340 RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
2341 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2342 RNA_def_property_ui_text(prop, "Node Tree", "Node tree being displayed and edited");
2344 prop= RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
2345 RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_BACKDRAW);
2346 RNA_def_property_ui_text(prop, "Backdrop", "Use active Viewer Node output as backdrop for compositing nodes");
2347 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2349 prop= RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE);
2350 RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_AUTO_RENDER);
2351 RNA_def_property_ui_text(prop, "Auto Render", "Re-render and composite changed layer on 3D edits");
2352 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2354 prop= RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
2355 RNA_def_property_float_sdna(prop, NULL, "zoom");
2356 RNA_def_property_float_default(prop, 1.0f);
2357 RNA_def_property_range(prop, 0.01f, FLT_MAX);
2358 RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
2359 RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
2360 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2362 prop= RNA_def_property(srna, "backdrop_x", PROP_FLOAT, PROP_NONE);
2363 RNA_def_property_float_sdna(prop, NULL, "xof");
2364 RNA_def_property_ui_text(prop, "Backdrop X", "Backdrop X offset");
2365 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2367 prop= RNA_def_property(srna, "backdrop_y", PROP_FLOAT, PROP_NONE);
2368 RNA_def_property_float_sdna(prop, NULL, "yof");
2369 RNA_def_property_ui_text(prop, "Backdrop Y", "Backdrop Y offset");
2370 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2372 prop= RNA_def_property(srna, "backdrop_channels", PROP_ENUM, PROP_NONE);
2373 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
2374 RNA_def_property_enum_items(prop, backdrop_channels_items);
2375 RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
2376 RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
2379 static void rna_def_space_logic(BlenderRNA *brna)
2384 srna= RNA_def_struct(brna, "SpaceLogicEditor", "Space");
2385 RNA_def_struct_sdna(srna, "SpaceLogic");
2386 RNA_def_struct_ui_text(srna, "Space Logic Editor", "Logic editor space data");
2389 prop= RNA_def_property(srna, "show_sensors_selected_objects", PROP_BOOLEAN, PROP_NONE);
2390 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_SEL);
2391 RNA_def_property_ui_text(prop, "Show Selected Object", "Show sensors of all selected objects");
2392 RNA_def_property_update(prop, NC_LOGIC, NULL);
2394 prop= RNA_def_property(srna, "show_sensors_active_object", PROP_BOOLEAN, PROP_NONE);
2395 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_ACT);
2396 RNA_def_property_ui_text(prop, "Show Active Object", "Show sensors of active object");
2397 RNA_def_property_update(prop, NC_LOGIC, NULL);
2399 prop= RNA_def_property(srna, "show_sensors_linked_controller", PROP_BOOLEAN, PROP_NONE);
2400 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_LINK);
2401 RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to the controller");
2402 RNA_def_property_update(prop, NC_LOGIC, NULL);
2404 prop= RNA_def_property(srna, "show_sensors_active_states", PROP_BOOLEAN, PROP_NONE);
2405 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_STATE);
2406 RNA_def_property_ui_text(prop, "Show Active States", "Show only sensors connected to active states");
2407 RNA_def_property_update(prop, NC_LOGIC, NULL);
2410 prop= RNA_def_property(srna, "show_controllers_selected_objects", PROP_BOOLEAN, PROP_NONE);
2411 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_SEL);
2412 RNA_def_property_ui_text(prop, "Show Selected Object", "Show controllers of all selected objects");
2413 RNA_def_property_update(prop, NC_LOGIC, NULL);
2415 prop= RNA_def_property(srna, "show_controllers_active_object", PROP_BOOLEAN, PROP_NONE);
2416 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_ACT);
2417 RNA_def_property_ui_text(prop, "Show Active Object", "Show controllers of active object");
2418 RNA_def_property_update(prop, NC_LOGIC, NULL);
2420 prop= RNA_def_property(srna, "show_controllers_linked_controller", PROP_BOOLEAN, PROP_NONE);
2421 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_LINK);
2422 RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to sensor/actuator");
2423 RNA_def_property_update(prop, NC_LOGIC, NULL);
2426 prop= RNA_def_property(srna, "show_actuators_selected_objects", PROP_BOOLEAN, PROP_NONE);
2427 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_SEL);
2428 RNA_def_property_ui_text(prop, "Show Selected Object", "Show actuators of all selected objects");
2429 RNA_def_property_update(prop, NC_LOGIC, NULL);
2431 prop= RNA_def_property(srna, "show_actuators_active_object", PROP_BOOLEAN, PROP_NONE);
2432 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_ACT);
2433 RNA_def_property_ui_text(prop, "Show Active Object", "Show actuators of active object");
2434 RNA_def_property_update(prop, NC_LOGIC, NULL);
2436 prop= RNA_def_property(srna, "show_actuators_linked_controller", PROP_BOOLEAN, PROP_NONE);
2437 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_LINK);
2438 RNA_def_property_ui_text(prop, "Show Linked to Actuator", "Show linked objects to the actuator");
2439 RNA_def_property_update(prop, NC_LOGIC, NULL);
2441 prop= RNA_def_property(srna, "show_actuators_active_states", PROP_BOOLEAN, PROP_NONE);
2442 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_STATE);
2443 RNA_def_property_ui_text(prop, "Show Active States", "Show only actuators connected to active states");
2444 RNA_def_property_update(prop, NC_LOGIC, NULL);
2448 void RNA_def_space(BlenderRNA *brna)
2450 rna_def_space(brna);
2451 rna_def_space_image(brna);
2452 rna_def_space_sequencer(brna);
2453 rna_def_space_text(brna);
2454 rna_def_fileselect_params(brna);
2455 rna_def_space_filebrowser(brna);
2456 rna_def_space_outliner(brna);
2457 rna_def_background_image(brna);
2458 rna_def_space_view3d(brna);
2459 rna_def_space_buttons(brna);
2460 rna_def_space_dopesheet(brna);
2461 rna_def_space_graph(brna);
2462 rna_def_space_nla(brna);
2463 rna_def_space_time(brna);
2464 rna_def_space_console(brna);
2465 rna_def_console_line(brna);
2466 rna_def_space_info(brna);
2467 rna_def_space_userpref(brna);
2468 rna_def_space_node(brna);
2469 rna_def_space_logic(brna);