2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008)
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_space.c
30 #include "MEM_guardedalloc.h"
32 #include "BLT_translation.h"
34 #include "BKE_image.h"
36 #include "BKE_movieclip.h"
39 #include "DNA_action_types.h"
40 #include "DNA_key_types.h"
41 #include "DNA_material_types.h"
42 #include "DNA_node_types.h"
43 #include "DNA_object_types.h"
44 #include "DNA_space_types.h"
45 #include "DNA_sequence_types.h"
46 #include "DNA_mask_types.h"
47 #include "DNA_view3d_types.h"
48 #include "DNA_workspace_types.h"
50 #include "RNA_access.h"
51 #include "RNA_define.h"
53 #include "rna_internal.h"
58 #include "RE_engine.h"
59 #include "RE_pipeline.h"
61 #include "RNA_enum_types.h"
64 const EnumPropertyItem rna_enum_space_type_items[] = {
65 /* empty must be here for python, is skipped for UI */
66 {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""},
69 {0, "", ICON_NONE, "General", ""},
70 {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", "3D viewport"},
71 {SPACE_IMAGE, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", "View and edit images and UV Maps"},
72 {SPACE_NODE, "NODE_EDITOR", ICON_NODETREE, "Node Editor", "Editor for node-based shading and compositing tools"},
73 {SPACE_SEQ, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequencer", "Video editing tools"},
74 {SPACE_CLIP, "CLIP_EDITOR", ICON_CLIP, "Movie Clip Editor", "Motion tracking tools"},
77 {0, "", ICON_NONE, "Animation", ""},
78 //{SPACE_ACTION, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls (NOTE: Switch to 'Timeline' mode)"}, /* XXX */
79 {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", "Edit drivers and keyframe interpolation"},
80 {SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", "Adjust timing of keyframes"},
81 {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "NLA Editor", "Combine and layer Actions"},
84 {0, "", ICON_NONE, "Scripting", ""},
85 {SPACE_TEXT, "TEXT_EDITOR", ICON_TEXT, "Text Editor", "Edit scripts and in-file documentation"},
86 {SPACE_CONSOLE, "CONSOLE", ICON_CONSOLE, "Python Console", "Interactive programmatic console for "
87 "advanced editing and script development"},
88 {SPACE_INFO, "INFO", ICON_INFO, "Info", "Main menu bar and list of error messages "
89 "(drag down to expand and display)"},
90 /* Special case: Top-bar isn't supposed to be a regular editor for the user. */
91 {SPACE_TOPBAR, "TOPBAR", ICON_NONE, "Top Bar", "Global bar at the top of the screen for global per-window settings"},
94 {0, "", ICON_NONE, "Data", ""},
95 {SPACE_OUTLINER, "OUTLINER", ICON_OOPS, "Outliner", "Overview of scene graph and all available data-blocks"},
96 {SPACE_BUTS, "PROPERTIES", ICON_BUTS, "Properties", "Edit properties of active object and related data-blocks"},
97 {SPACE_FILE, "FILE_BROWSER", ICON_FILESEL, "File Browser", "Browse for files and assets"},
98 {SPACE_USERPREF, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences",
99 "Edit persistent configuration settings"},
100 {0, NULL, 0, NULL, NULL}
103 #define V3D_S3D_CAMERA_LEFT {STEREO_LEFT_ID, "LEFT", ICON_RESTRICT_RENDER_OFF, "Left", ""},
104 #define V3D_S3D_CAMERA_RIGHT {STEREO_RIGHT_ID, "RIGHT", ICON_RESTRICT_RENDER_OFF, "Right", ""},
105 #define V3D_S3D_CAMERA_S3D {STEREO_3D_ID, "S3D", ICON_CAMERA_STEREO, "3D", ""},
107 #define V3D_S3D_CAMERA_VIEWS {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""},
110 static const EnumPropertyItem stereo3d_camera_items[] = {
114 {0, NULL, 0, NULL, NULL}
118 static const EnumPropertyItem multiview_camera_items[] = {
121 {0, NULL, 0, NULL, NULL}
125 #undef V3D_S3D_CAMERA_LEFT
126 #undef V3D_S3D_CAMERA_RIGHT
127 #undef V3D_S3D_CAMERA_S3D
128 #undef V3D_S3D_CAMERA_VIEWS
131 static const EnumPropertyItem stereo3d_eye_items[] = {
132 {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"},
133 {STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"},
134 {0, NULL, 0, NULL, NULL}
138 static const EnumPropertyItem pivot_items_full[] = {
139 {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
140 "Pivot around bounding box center of selected object(s)"},
141 {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
142 {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
143 "Individual Origins", "Pivot around each object's own origin"},
144 {V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
145 "Pivot around the median point of selected objects"},
146 {V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"},
147 {0, NULL, 0, NULL, NULL}
150 static const EnumPropertyItem draw_channels_items[] = {
151 {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
152 "Draw image with RGB colors and alpha transparency"},
153 {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
154 {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
155 {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer",
156 "Draw Z-buffer associated with image (mapped from camera clip start to end)"},
157 {SI_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
158 {SI_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
159 {SI_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""},
160 {0, NULL, 0, NULL, NULL}
164 static const EnumPropertyItem autosnap_items[] = {
165 {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
166 /* {-1, "", 0, "", ""}, */
167 {SACTSNAP_STEP, "STEP", 0, "Frame Step", "Snap to 1.0 frame intervals"},
168 {SACTSNAP_TSTEP, "TIME_STEP", 0, "Second Step", "Snap to 1.0 second intervals"},
169 /* {-1, "", 0, "", ""}, */
170 {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames (nla-action time)"},
171 {SACTSNAP_SECOND, "SECOND", 0, "Nearest Second", "Snap to actual seconds (nla-action time)"},
172 /* {-1, "", 0, "", ""}, */
173 {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"},
174 {0, NULL, 0, NULL, NULL}
178 const EnumPropertyItem rna_enum_shading_type_items[] = {
179 {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
180 {OB_SOLID, "SOLID", ICON_SOLID, "Single Color", "Display the object or material in a single color"},
181 {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Texture", "Display the object solid, with a texture"},
182 {OB_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Display objects solid, with GLSL material"},
183 {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"},
184 {0, NULL, 0, NULL, NULL}
187 const EnumPropertyItem rna_enum_viewport_lighting_items[] = {
188 {V3D_LIGHTING_FLAT, "FLAT", 0, "Flat Lighting", "Display using flat lighting"},
189 {V3D_LIGHTING_STUDIO, "STUDIO", 0, "Studio Lighting", "Display using studio lighting"},
190 /* {V3D_LIGHTING_SCENE, "SCENE", 0, "Scene Lighting", "Display using scene lighting"}, */
191 {0, NULL, 0, NULL, NULL}
194 const EnumPropertyItem rna_enum_clip_editor_mode_items[] = {
195 {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
196 {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"},
197 {0, NULL, 0, NULL, NULL}
200 /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
201 static const EnumPropertyItem buttons_context_items[] = {
202 {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"},
203 {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"},
204 {BCONTEXT_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "View Layer", "View layer"},
205 {BCONTEXT_COLLECTION, "COLLECTION", ICON_COLLAPSEMENU, "Collection", "Collection"},
206 {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
207 {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
208 {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object constraints"},
209 {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifiers", "Object modifiers"},
210 {BCONTEXT_DATA, "DATA", ICON_NONE, "Data", "Object data"},
211 {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"},
212 {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT_BONE, "Bone Constraints", "Bone constraints"},
213 {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
214 {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
215 {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"},
216 {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
217 {BCONTEXT_WORKSPACE, "WORKSPACE", ICON_SPLITSCREEN, "Workspace", "Workspace"},
218 {0, NULL, 0, NULL, NULL}
221 static const EnumPropertyItem buttons_collection_context_items[] = {
222 {SB_COLLECTION_CTX_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "", "Show material textures"},
223 {SB_COLLECTION_CTX_GROUP, "GROUP", ICON_GROUP, "", "Show world textures"},
224 {0, NULL, 0, NULL, NULL}
227 static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
228 {0, "NONE", 0, "None", "Only list current directory's content, with no recursion"},
229 {1, "BLEND", 0, "Blend File", "List .blend files' content"},
230 {2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"},
231 {3, "ALL_2", 0, "Two Levels", "List all sub-directories' content, two levels of recursion"},
232 {4, "ALL_3", 0, "Three Levels", "List all sub-directories' content, three levels of recursion"},
233 {0, NULL, 0, NULL, NULL}
236 const EnumPropertyItem rna_enum_file_sort_items[] = {
237 {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
238 {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"},
239 {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
240 {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
241 {0, NULL, 0, NULL, NULL}
246 #include "DNA_anim_types.h"
247 #include "DNA_scene_types.h"
248 #include "DNA_screen_types.h"
249 #include "DNA_userdef_types.h"
251 #include "BLI_math.h"
253 #include "BKE_animsys.h"
254 #include "BKE_brush.h"
255 #include "BKE_colortools.h"
256 #include "BKE_context.h"
257 #include "BKE_layer.h"
258 #include "BKE_global.h"
260 #include "BKE_paint.h"
261 #include "BKE_scene.h"
262 #include "BKE_screen.h"
263 #include "BKE_icons.h"
264 #include "BKE_workspace.h"
266 #include "DEG_depsgraph.h"
267 #include "DEG_depsgraph_build.h"
269 #include "ED_buttons.h"
270 #include "ED_fileselect.h"
271 #include "ED_image.h"
273 #include "ED_transform.h"
274 #include "ED_screen.h"
275 #include "ED_view3d.h"
276 #include "ED_sequencer.h"
279 #include "GPU_material.h"
281 #include "IMB_imbuf_types.h"
283 #include "UI_interface.h"
284 #include "UI_view2d.h"
286 static StructRNA *rna_Space_refine(struct PointerRNA *ptr)
288 SpaceLink *space = (SpaceLink *)ptr->data;
290 switch (space->spacetype) {
292 return &RNA_SpaceView3D;
294 return &RNA_SpaceGraphEditor;
296 return &RNA_SpaceOutliner;
298 return &RNA_SpaceProperties;
300 return &RNA_SpaceFileBrowser;
302 return &RNA_SpaceImageEditor;
304 return &RNA_SpaceInfo;
306 return &RNA_SpaceSequenceEditor;
308 return &RNA_SpaceTextEditor;
310 return &RNA_SpaceDopeSheetEditor;
312 return &RNA_SpaceNLA;
314 return &RNA_SpaceNodeEditor;
316 return &RNA_SpaceConsole;
318 return &RNA_SpaceUserPreferences;
320 return &RNA_SpaceClipEditor;
326 static ScrArea *rna_area_from_space(PointerRNA *ptr)
328 bScreen *sc = (bScreen *)ptr->id.data;
329 SpaceLink *link = (SpaceLink *)ptr->data;
330 return BKE_screen_find_area_from_space(sc, link);
333 static void area_region_from_regiondata(bScreen *sc, void *regiondata, ScrArea **r_sa, ARegion **r_ar)
341 for (sa = sc->areabase.first; sa; sa = sa->next) {
342 for (ar = sa->regionbase.first; ar; ar = ar->next) {
343 if (ar->regiondata == regiondata) {
352 static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **r_sa, ARegion **r_ar)
354 bScreen *sc = (bScreen *)ptr->id.data;
355 void *regiondata = ptr->data;
357 area_region_from_regiondata(sc, regiondata, r_sa, r_ar);
360 static int rna_Space_view2d_sync_get(PointerRNA *ptr)
365 sa = rna_area_from_space(ptr); /* can be NULL */
366 ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
368 View2D *v2d = &ar->v2d;
369 return (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME) != 0;
375 static void rna_Space_view2d_sync_set(PointerRNA *ptr, int value)
380 sa = rna_area_from_space(ptr); /* can be NULL */
381 ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
383 View2D *v2d = &ar->v2d;
385 v2d->flag |= V2D_VIEWSYNC_SCREEN_TIME;
388 v2d->flag &= ~V2D_VIEWSYNC_SCREEN_TIME;
393 static void rna_Space_view2d_sync_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
398 sa = rna_area_from_space(ptr); /* can be NULL */
399 ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
402 bScreen *sc = (bScreen *)ptr->id.data;
403 View2D *v2d = &ar->v2d;
405 UI_view2d_sync(sc, sa, v2d, V2D_LOCK_SET);
410 static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr)
412 View3D *v3d = (View3D *)(ptr->data);
413 if (v3d->scenelock) {
414 wmWindowManager *wm = bmain->wm.first;
416 scene->camera = v3d->camera;
417 WM_windows_scene_data_sync(&wm->windows, scene);
421 static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int value)
423 View3D *v3d = (View3D *)(ptr->data);
424 bScreen *sc = (bScreen *)ptr->id.data;
426 v3d->scenelock = value;
429 Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
432 v3d->lay = scene->lay;
433 /* seek for layact */
436 if (v3d->lay & (1u << bit)) {
437 v3d->layact = (1u << bit);
442 v3d->camera = scene->camera;
446 static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values)
448 View3D *v3d = (View3D *)(ptr->data);
449 bScreen *screen = ptr->id.data;
450 Scene *scene = ED_screen_scene_find(screen, G.main->wm.first);
451 const float *loc = ED_view3d_cursor3d_get(scene, v3d);
453 copy_v3_v3(values, loc);
456 static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values)
458 View3D *v3d = (View3D *)(ptr->data);
459 bScreen *screen = ptr->id.data;
460 Scene *scene = ED_screen_scene_find(screen, G.main->wm.first);
461 float *cursor = ED_view3d_cursor3d_get(scene, v3d);
463 copy_v3_v3(cursor, values);
466 static float rna_View3D_GridScaleUnit_get(PointerRNA *ptr)
468 View3D *v3d = (View3D *)(ptr->data);
469 bScreen *screen = ptr->id.data;
470 Scene *scene = ED_screen_scene_find(screen, G.main->wm.first);
472 return ED_view3d_grid_scale(scene, v3d, NULL);
475 static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
477 View3D *v3d = (View3D *)(ptr->data);
479 v3d->lay = ED_view3d_view_layer_set(v3d->lay, values, &v3d->layact);
482 static int rna_SpaceView3D_active_layer_get(PointerRNA *ptr)
484 View3D *v3d = (View3D *)(ptr->data);
486 return (int)(log(v3d->layact) / M_LN2);
489 static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
491 DEG_on_visible_update(bmain, false);
494 static void rna_3DViewShading_type_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
496 View3D *v3d = (View3D *)(ptr->data);
497 ScrArea *sa = rna_area_from_space(ptr);
499 ED_view3d_shade_update(bmain, v3d, sa);
502 static void rna_SpaceView3D_matcap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
504 View3D *v3d = (View3D *)(ptr->data);
506 if (v3d->defmaterial) {
507 Material *ma = v3d->defmaterial;
510 BKE_previewimg_free(&ma->preview);
512 if (ma->gpumaterial.first)
513 GPU_material_free(&ma->gpumaterial);
515 WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma);
519 static void rna_SpaceView3D_matcap_enable(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
521 View3D *v3d = (View3D *)(ptr->data);
523 if (v3d->matcap_icon < ICON_MATCAP_01 ||
524 v3d->matcap_icon > ICON_MATCAP_24)
526 v3d->matcap_icon = ICON_MATCAP_01;
530 static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
532 if (U.uiflag & USER_LOCKAROUND) {
533 View3D *v3d_act = (View3D *)(ptr->data);
535 /* TODO, space looper */
537 for (screen = bmain->screen.first; screen; screen = screen->id.next) {
539 for (sa = screen->areabase.first; sa; sa = sa->next) {
541 for (sl = sa->spacedata.first; sl; sl = sl->next) {
542 if (sl->spacetype == SPACE_VIEW3D) {
543 View3D *v3d = (View3D *)sl;
544 if (v3d != v3d_act) {
545 v3d->around = v3d_act->around;
546 v3d->flag = (v3d->flag & ~V3D_ALIGN) | (v3d_act->flag & V3D_ALIGN);
547 ED_area_tag_redraw_regiontype(sa, RGN_TYPE_HEADER);
556 static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
558 View3D *v3d = (View3D *)(ptr->data);
559 ScrArea *sa = rna_area_from_space(ptr);
560 void *regiondata = NULL;
562 ListBase *regionbase = (sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase;
563 ARegion *ar = regionbase->last; /* always last in list, weak .. */
564 regiondata = ar->regiondata;
567 return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
570 static void rna_SpaceView3D_region_quadviews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
572 View3D *v3d = (View3D *)(ptr->data);
573 ScrArea *sa = rna_area_from_space(ptr);
576 ARegion *ar = ((sa && sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase)->last;
577 ListBase lb = {NULL, NULL};
579 if (ar && ar->alignment == RGN_ALIGN_QSPLIT) {
589 rna_iterator_listbase_begin(iter, &lb, NULL);
592 static PointerRNA rna_SpaceView3D_region_quadviews_get(CollectionPropertyIterator *iter)
594 void *regiondata = ((ARegion *)rna_iterator_listbase_get(iter))->regiondata;
596 return rna_pointer_inherit_refine(&iter->parent, &RNA_RegionView3D, regiondata);
599 static void rna_RegionView3D_quadview_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
604 rna_area_region_from_regiondata(ptr, &sa, &ar);
605 if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
606 ED_view3d_quadview_update(sa, ar, false);
609 /* same as above but call clip==true */
610 static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
615 rna_area_region_from_regiondata(ptr, &sa, &ar);
616 if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
617 ED_view3d_quadview_update(sa, ar, true);
620 static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values)
622 RegionView3D *rv3d = (RegionView3D *)(ptr->data);
623 negate_v3_v3(values, rv3d->ofs);
626 static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values)
628 RegionView3D *rv3d = (RegionView3D *)(ptr->data);
629 negate_v3_v3(rv3d->ofs, values);
632 static void rna_RegionView3D_view_rotation_get(PointerRNA *ptr, float *values)
634 RegionView3D *rv3d = (RegionView3D *)(ptr->data);
635 invert_qt_qt(values, rv3d->viewquat);
638 static void rna_RegionView3D_view_rotation_set(PointerRNA *ptr, const float *values)
640 RegionView3D *rv3d = (RegionView3D *)(ptr->data);
641 invert_qt_qt(rv3d->viewquat, values);
644 static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values)
646 RegionView3D *rv3d = (RegionView3D *)(ptr->data);
648 invert_m4_m4(mat, (float (*)[4])values);
649 ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
652 static int rna_3DViewShading_type_get(PointerRNA *ptr)
654 bScreen *screen = ptr->id.data;
655 Scene *scene = WM_windows_scene_get_from_screen(G.main->wm.first, screen);
656 RenderEngineType *type = RE_engines_find(scene->r.engine);
657 View3D *v3d = (View3D *)ptr->data;
659 if (BKE_scene_uses_blender_eevee(scene)) {
660 if (v3d->drawtype == OB_MATERIAL) {
664 else if (v3d->drawtype == OB_RENDER) {
665 if (!(type && type->render_to_view)) {
670 return v3d->drawtype;
673 static void rna_3DViewShading_type_set(PointerRNA *ptr, int value)
675 View3D *v3d = (View3D *)ptr->data;
676 if (value != v3d->drawtype && value == OB_RENDER) {
677 v3d->prev_drawtype = v3d->drawtype;
679 v3d->drawtype = value;
682 static void rna_View3DShading_single_color_mode_set(PointerRNA *ptr, int value) {
683 View3D *v3d = (View3D *)ptr->data;
684 v3d->drawtype_options = (v3d->drawtype_options &~ V3D_DRAWOPTION_SOLID_COLOR_MASK) + value;
687 static int rna_View3DShading_single_color_mode_get(PointerRNA *ptr) {
688 View3D *v3d = (View3D *)ptr->data;
689 return v3d->drawtype_options & V3D_DRAWOPTION_SOLID_COLOR_MASK;
692 static const EnumPropertyItem *rna_3DViewShading_type_itemf(
693 bContext *C, PointerRNA *UNUSED(ptr),
694 PropertyRNA *UNUSED(prop), bool *r_free)
696 wmWindow *win = CTX_wm_window(C);
697 Scene *scene = WM_window_get_active_scene(win);
698 RenderEngineType *type = RE_engines_find(scene->r.engine);
700 EnumPropertyItem *item = NULL;
703 RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_SOLID);
705 if (BKE_scene_uses_blender_eevee(scene)) {
706 RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
709 RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_MATERIAL);
710 if (type && type->render_to_view) {
711 RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
715 RNA_enum_item_end(&item, &totitem);
721 static const EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(
722 bContext *C, PointerRNA *UNUSED(ptr),
723 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
725 Scene *scene = CTX_data_scene(C);
727 if (scene->r.views_format == SCE_VIEWS_FORMAT_MULTIVIEW)
728 return multiview_camera_items;
730 return stereo3d_camera_items;
733 static PointerRNA rna_SpaceView3D_shading_get(PointerRNA *ptr)
735 return rna_pointer_inherit_refine(ptr, &RNA_View3DShading, ptr->data);
738 static char *rna_View3DShading_path(PointerRNA *UNUSED(ptr))
740 return BLI_sprintfN("shading");
743 static PointerRNA rna_SpaceView3D_overlay_get(PointerRNA *ptr)
745 return rna_pointer_inherit_refine(ptr, &RNA_View3DOverlay, ptr->data);
748 static char *rna_View3DOverlay_path(PointerRNA *UNUSED(ptr))
750 return BLI_sprintfN("overlay");
753 /* Space Image Editor */
755 static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
757 return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
760 static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
762 ED_space_image_paint_update(bmain->wm.first, scene);
766 static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, int value)
768 SpaceImage *sima = (SpaceImage *)(ptr->data);
771 sima->iuser.flag |= IMA_SHOW_STEREO;
773 sima->iuser.flag &= ~IMA_SHOW_STEREO;
776 static int rna_SpaceImageEditor_show_stereo_get(PointerRNA *ptr)
778 SpaceImage *sima = (SpaceImage *)(ptr->data);
779 return (sima->iuser.flag & IMA_SHOW_STEREO) != 0;
782 static void rna_SpaceImageEditor_show_stereo_update(Main *UNUSED(bmain), Scene *UNUSED(unused), PointerRNA *ptr)
784 SpaceImage *sima = (SpaceImage *)(ptr->data);
785 Image *ima = sima->image;
789 BKE_image_multilayer_index(ima->rr, &sima->iuser);
792 BKE_image_multiview_index(ima, &sima->iuser);
797 static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)
799 SpaceImage *sima = (SpaceImage *)(ptr->data);
800 return ED_space_image_show_render(sima);
803 static int rna_SpaceImageEditor_show_paint_get(PointerRNA *ptr)
805 SpaceImage *sima = (SpaceImage *)(ptr->data);
806 return ED_space_image_show_paint(sima);
809 static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
811 SpaceImage *sima = (SpaceImage *)(ptr->data);
812 bScreen *sc = (bScreen *)ptr->id.data;
813 wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
814 ViewLayer *view_layer = WM_window_get_active_view_layer(win);
815 Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
816 return ED_space_image_show_uvedit(sima, obedit);
819 static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr)
821 SpaceImage *sima = (SpaceImage *)(ptr->data);
822 bScreen *sc = (bScreen *)ptr->id.data;
823 wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
824 ViewLayer *view_layer = WM_window_get_active_view_layer(win);
825 return ED_space_image_check_show_maskedit(sima, view_layer);
828 static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
830 SpaceImage *sima = (SpaceImage *)(ptr->data);
831 bScreen *sc = (bScreen *)ptr->id.data;
833 Scene *scene = ED_screen_scene_find_with_window(sc, G.main->wm.first, &win);
834 ViewLayer *view_layer = WM_window_get_active_view_layer(win);
835 Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
836 ED_space_image_set(sima, scene, obedit, (Image *)value.data);
839 static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value)
841 SpaceImage *sima = (SpaceImage *)(ptr->data);
843 ED_space_image_set_mask(NULL, sima, (Mask *)value.data);
846 static const EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(
847 bContext *UNUSED(C), PointerRNA *ptr,
848 PropertyRNA *UNUSED(prop), bool *r_free)
850 SpaceImage *sima = (SpaceImage *)ptr->data;
851 EnumPropertyItem *item = NULL;
854 int zbuf, alpha, totitem = 0;
856 ibuf = ED_space_image_acquire_buffer(sima, &lock);
858 alpha = ibuf && (ibuf->channels == 4);
859 zbuf = ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1));
861 ED_space_image_release_buffer(sima, ibuf, lock);
864 return draw_channels_items;
867 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_USE_ALPHA);
868 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
869 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ALPHA);
872 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
873 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF);
876 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
879 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_R);
880 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_G);
881 RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_B);
883 RNA_enum_item_end(&item, &totitem);
889 static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values)
891 SpaceImage *sima = (SpaceImage *)ptr->data;
895 values[0] = values[1] = 1;
898 sa = rna_area_from_space(ptr); /* can be NULL */
899 ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
901 ED_space_image_get_zoom(sima, ar, &values[0], &values[1]);
905 static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values)
907 SpaceImage *sima = (SpaceImage *)ptr->data;
909 if (sima->flag & SI_COORDFLOATS) {
910 copy_v2_v2(values, sima->cursor);
914 ED_space_image_get_size(sima, &w, &h);
916 values[0] = sima->cursor[0] * w;
917 values[1] = sima->cursor[1] * h;
921 static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const float *values)
923 SpaceImage *sima = (SpaceImage *)ptr->data;
925 if (sima->flag & SI_COORDFLOATS) {
926 copy_v2_v2(sima->cursor, values);
930 ED_space_image_get_size(sima, &w, &h);
932 sima->cursor[0] = values[0] / w;
933 sima->cursor[1] = values[1] / h;
937 static void rna_SpaceImageEditor_image_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
939 SpaceImage *sima = (SpaceImage *)ptr->data;
940 Image *ima = sima->image;
942 /* make sure all the iuser settings are valid for the sima image */
945 if (BKE_image_multilayer_index(sima->image->rr, &sima->iuser) == NULL) {
946 BKE_image_init_imageuser(sima->image, &sima->iuser);
950 BKE_image_multiview_index(ima, &sima->iuser);
955 static void rna_SpaceImageEditor_scopes_update(struct bContext *C, struct PointerRNA *ptr)
957 SpaceImage *sima = (SpaceImage *)ptr->data;
961 ibuf = ED_space_image_acquire_buffer(sima, &lock);
963 ED_space_image_scopes_update(C, sima, ibuf, true);
964 WM_main_add_notifier(NC_IMAGE, sima->image);
966 ED_space_image_release_buffer(sima, ibuf, lock);
969 static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(
970 bContext *UNUSED(C), PointerRNA *ptr,
971 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
973 static const EnumPropertyItem pivot_items[] = {
974 {V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
975 {V3D_AROUND_CENTER_MEAN, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
976 {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
977 {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
978 "Individual Origins", "Pivot around each selected island's own median point"},
979 {0, NULL, 0, NULL, NULL}
982 SpaceImage *sima = (SpaceImage *)ptr->data;
984 if (sima->mode == SI_MODE_PAINT)
985 return pivot_items_full;
990 /* Space Text Editor */
992 static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value)
994 SpaceText *st = (SpaceText *)(ptr->data);
996 st->wordwrap = value;
1000 static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
1002 SpaceText *st = (SpaceText *)(ptr->data);
1004 st->text = value.data;
1006 WM_main_add_notifier(NC_TEXT | NA_SELECTED, st->text);
1009 static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1011 SpaceText *st = (SpaceText *)ptr->data;
1014 WM_main_add_notifier(NC_TEXT | NA_EDITED, st->text);
1017 /* Space Properties */
1019 /* note: this function exists only to avoid id refcounting */
1020 static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value)
1022 SpaceButs *sbuts = (SpaceButs *)(ptr->data);
1023 sbuts->pinid = value.data;
1026 static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
1028 SpaceButs *sbuts = (SpaceButs *)(ptr->data);
1031 return ID_code_to_RNA_type(GS(sbuts->pinid->name));
1036 static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1038 SpaceButs *sbuts = (SpaceButs *)(ptr->data);
1039 ID *id = sbuts->pinid;
1042 sbuts->flag &= ~SB_PIN_CONTEXT;
1046 switch (GS(id->name)) {
1048 WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
1051 WM_main_add_notifier(NC_TEXTURE, NULL);
1054 WM_main_add_notifier(NC_WORLD, NULL);
1057 WM_main_add_notifier(NC_LAMP, NULL);
1065 static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value)
1067 SpaceButs *sbuts = (SpaceButs *)(ptr->data);
1069 sbuts->mainb = value;
1070 sbuts->mainbuser = value;
1073 static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
1074 bContext *UNUSED(C), PointerRNA *ptr,
1075 PropertyRNA *UNUSED(prop), bool *r_free)
1077 SpaceButs *sbuts = (SpaceButs *)(ptr->data);
1078 EnumPropertyItem *item = NULL;
1081 if (sbuts->pathflag & (1 << BCONTEXT_RENDER)) {
1082 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER);
1085 if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) {
1086 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_VIEW_LAYER);
1089 if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) {
1090 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE);
1093 if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) {
1094 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD);
1097 if (sbuts->pathflag & (1 << BCONTEXT_WORKSPACE)) {
1098 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORKSPACE);
1101 if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) {
1102 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_COLLECTION);
1105 if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) {
1106 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT);
1109 if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) {
1110 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_CONSTRAINT);
1113 if (sbuts->pathflag & (1 << BCONTEXT_MODIFIER)) {
1114 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MODIFIER);
1117 if (sbuts->pathflag & (1 << BCONTEXT_DATA)) {
1118 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_DATA);
1119 (item + totitem - 1)->icon = sbuts->dataicon;
1122 if (sbuts->pathflag & (1 << BCONTEXT_BONE)) {
1123 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE);
1126 if (sbuts->pathflag & (1 << BCONTEXT_BONE_CONSTRAINT)) {
1127 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE_CONSTRAINT);
1130 if (sbuts->pathflag & (1 << BCONTEXT_MATERIAL)) {
1131 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MATERIAL);
1134 if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) {
1135 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE);
1138 if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) {
1139 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE);
1142 if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) {
1143 RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS);
1146 RNA_enum_item_end(&item, &totitem);
1152 static void rna_SpaceProperties_context_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1154 SpaceButs *sbuts = (SpaceButs *)(ptr->data);
1155 /* XXX BCONTEXT_DATA is ugly, but required for lamps... See T51318. */
1156 if (ELEM(sbuts->mainb, BCONTEXT_WORLD, BCONTEXT_MATERIAL, BCONTEXT_TEXTURE, BCONTEXT_DATA)) {
1161 static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
1163 SpaceButs *sbuts = (SpaceButs *)(ptr->data);
1165 sbuts->align = value;
1166 sbuts->re_align = 1;
1170 static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
1172 ConsoleLine *ci = (ConsoleLine *)ptr->data;
1173 memcpy(value, ci->line, ci->len + 1);
1176 static int rna_ConsoleLine_body_length(PointerRNA *ptr)
1178 ConsoleLine *ci = (ConsoleLine *)ptr->data;
1182 static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value)
1184 ConsoleLine *ci = (ConsoleLine *)ptr->data;
1185 int len = strlen(value);
1187 if ((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */
1188 MEM_freeN(ci->line);
1189 ci->line = MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
1190 ci->len_alloc = len + 1;
1192 memcpy(ci->line, value, len + 1);
1195 if (ci->cursor > len) /* clamp the cursor */
1199 static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max,
1200 int *UNUSED(softmin), int *UNUSED(softmax))
1202 ConsoleLine *ci = (ConsoleLine *)ptr->data;
1205 *max = ci->len; /* intentionally _not_ -1 */
1208 /* Space Dopesheet */
1210 static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA value)
1212 SpaceAction *saction = (SpaceAction *)(ptr->data);
1213 bAction *act = (bAction *)value.data;
1215 if ((act == NULL) || (act->idroot == 0)) {
1216 /* just set if we're clearing the action or if the action is "amorphous" still */
1217 saction->action = act;
1220 /* action to set must strictly meet the mode criteria... */
1221 if (saction->mode == SACTCONT_ACTION) {
1222 /* currently, this is "object-level" only, until we have some way of specifying this */
1223 if (act->idroot == ID_OB)
1224 saction->action = act;
1226 printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n",
1229 else if (saction->mode == SACTCONT_SHAPEKEY) {
1230 /* as the name says, "shapekey-level" only... */
1231 if (act->idroot == ID_KE)
1232 saction->action = act;
1234 printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n",
1238 printf("ACK: who's trying to set an action while not in a mode displaying a single Action only?\n");
1243 static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr)
1245 SpaceAction *saction = (SpaceAction *)(ptr->data);
1246 ViewLayer *view_layer = CTX_data_view_layer(C);
1247 Main *bmain = CTX_data_main(C);
1248 Object *obact = OBACT(view_layer);
1250 /* we must set this action to be the one used by active object (if not pinned) */
1251 if (obact /* && saction->pin == 0*/) {
1252 AnimData *adt = NULL;
1254 if (saction->mode == SACTCONT_ACTION) {
1255 /* TODO: context selector could help decide this with more control? */
1256 adt = BKE_animdata_add_id(&obact->id); /* this only adds if non-existent */
1258 else if (saction->mode == SACTCONT_SHAPEKEY) {
1259 Key *key = BKE_key_from_object(obact);
1261 adt = BKE_animdata_add_id(&key->id); /* this only adds if non-existent */
1265 // FIXME: this overlaps a lot with the BKE_animdata_set_action() API method
1267 /* Don't do anything if old and new actions are the same... */
1268 if (adt->action != saction->action) {
1269 /* NLA Tweak Mode needs special handling... */
1270 if (adt->flag & ADT_NLA_EDIT_ON) {
1271 /* Exit editmode first - we cannot change actions while in tweakmode
1272 * NOTE: This will clear the action ref properly
1274 BKE_nla_tweakmode_exit(adt);
1276 /* Assign new action, and adjust the usercounts accordingly */
1277 adt->action = saction->action;
1278 id_us_plus((ID *)adt->action);
1281 /* Handle old action... */
1283 /* Fix id-count of action we're replacing */
1284 id_us_min(&adt->action->id);
1286 /* To prevent data loss (i.e. if users flip between actions using the Browse menu),
1287 * stash this action if nothing else uses it.
1290 * This callback runs when unlinking actions. In that case, we don't want to
1291 * stash the action, as the user is signalling that they want to detach it.
1292 * This can be reviewed again later, but it could get annoying if we keep these instead.
1294 if ((adt->action->id.us <= 0) && (saction->action != NULL)) {
1295 /* XXX: Things here get dodgy if this action is only partially completed,
1296 * and the user then uses the browse menu to get back to this action,
1297 * assigning it as the active action (i.e. the stash strip gets out of sync)
1299 BKE_nla_action_stash(adt);
1303 /* Assign new action, and adjust the usercounts accordingly */
1304 adt->action = saction->action;
1305 id_us_plus((ID *)adt->action);
1309 /* Force update of animdata */
1310 adt->recalc |= ADT_RECALC_ANIM;
1313 /* force depsgraph flush too */
1314 DEG_id_tag_update(&obact->id, OB_RECALC_OB | OB_RECALC_DATA);
1315 /* Update relations as well, so new time source dependency is added. */
1316 DEG_relations_tag_update(bmain);
1320 static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
1322 SpaceAction *saction = (SpaceAction *)(ptr->data);
1323 ScrArea *sa = CTX_wm_area(C);
1324 ViewLayer *view_layer = CTX_data_view_layer(C);
1325 Object *obact = OBACT(view_layer);
1327 /* special exceptions for ShapeKey Editor mode */
1328 if (saction->mode == SACTCONT_SHAPEKEY) {
1329 Key *key = BKE_key_from_object(obact);
1331 /* 1) update the action stored for the editor */
1333 saction->action = (key->adt) ? key->adt->action : NULL;
1335 saction->action = NULL;
1337 /* 2) enable 'show sliders' by default, since one of the main
1338 * points of the ShapeKey Editor is to provide a one-stop shop
1339 * for controlling the shapekeys, whose main control is the value
1341 saction->flag |= SACTION_SLIDERS;
1343 /* make sure action stored is valid */
1344 else if (saction->mode == SACTCONT_ACTION) {
1345 /* 1) update the action stored for the editor */
1346 /* TODO: context selector could help decide this with more control? */
1348 saction->action = (obact->adt) ? obact->adt->action : NULL;
1350 saction->action = NULL;
1353 /* Collapse summary channel and hide channel list for timeline */
1354 if (saction->mode == SACTCONT_TIMELINE) {
1355 saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
1358 if (sa && sa->spacedata.first == saction) {
1359 ARegion *channels_region = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
1360 if (channels_region) {
1361 if (saction->mode == SACTCONT_TIMELINE) {
1362 channels_region->flag |= RGN_FLAG_HIDDEN;
1365 channels_region->flag &= ~RGN_FLAG_HIDDEN;
1367 ED_region_visibility_change_update(C, channels_region);
1371 /* recalculate extents of channel list */
1372 saction->flag |= SACTION_TEMP_NEEDCHANSYNC;
1375 /* Space Graph Editor */
1377 static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1379 ScrArea *sa = rna_area_from_space(ptr);
1381 /* after changing view mode, must force recalculation of F-Curve colors
1382 * which can only be achieved using refresh as opposed to redraw
1384 ED_area_tag_refresh(sa);
1387 static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr)
1389 SpaceIpo *sipo = (SpaceIpo *)(ptr->data);
1390 return (BLI_listbase_is_empty(&sipo->ghostCurves) == false);
1393 static void rna_SpaceConsole_rect_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1395 SpaceConsole *sc = ptr->data;
1396 WM_main_add_notifier(NC_SPACE | ND_SPACE_CONSOLE | NA_EDITED, sc);
1399 static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1401 ScrArea *sa = rna_area_from_space(ptr);
1402 ED_area_tag_refresh(sa);
1405 /* Space Node Editor */
1407 static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA value)
1409 SpaceNode *snode = (SpaceNode *)ptr->data;
1410 ED_node_tree_start(snode, (bNodeTree *)value.data, NULL, NULL);
1413 static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
1415 SpaceNode *snode = (SpaceNode *)ptr->data;
1416 bNodeTree *ntree = (bNodeTree *)value.data;
1418 /* node tree type must match the selected type in node editor */
1419 return (STREQ(snode->tree_idname, ntree->idname));
1422 static void rna_SpaceNodeEditor_node_tree_update(const bContext *C, PointerRNA *UNUSED(ptr))
1424 ED_node_tree_update(C);
1427 static int rna_SpaceNodeEditor_tree_type_get(PointerRNA *ptr)
1429 SpaceNode *snode = (SpaceNode *)ptr->data;
1430 return rna_node_tree_idname_to_enum(snode->tree_idname);
1432 static void rna_SpaceNodeEditor_tree_type_set(PointerRNA *ptr, int value)
1434 SpaceNode *snode = (SpaceNode *)ptr->data;
1435 ED_node_set_tree_type(snode, rna_node_tree_type_from_enum(value));
1437 static int rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type)
1439 bContext *C = (bContext *)Cv;
1441 return type->poll(C, type);
1445 static const EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(
1446 bContext *C, PointerRNA *UNUSED(ptr),
1447 PropertyRNA *UNUSED(prop), bool *r_free)
1449 return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, r_free);
1452 static void rna_SpaceNodeEditor_path_get(PointerRNA *ptr, char *value)
1454 SpaceNode *snode = ptr->data;
1455 ED_node_tree_path_get(snode, value);
1458 static int rna_SpaceNodeEditor_path_length(PointerRNA *ptr)
1460 SpaceNode *snode = ptr->data;
1461 return ED_node_tree_path_length(snode);
1464 static void rna_SpaceNodeEditor_path_clear(SpaceNode *snode, bContext *C)
1466 ED_node_tree_start(snode, NULL, NULL, NULL);
1467 ED_node_tree_update(C);
1470 static void rna_SpaceNodeEditor_path_start(SpaceNode *snode, bContext *C, PointerRNA *node_tree)
1472 ED_node_tree_start(snode, (bNodeTree *)node_tree->data, NULL, NULL);
1473 ED_node_tree_update(C);
1476 static void rna_SpaceNodeEditor_path_append(SpaceNode *snode, bContext *C, PointerRNA *node_tree, PointerRNA *node)
1478 ED_node_tree_push(snode, node_tree->data, node->data);
1479 ED_node_tree_update(C);
1482 static void rna_SpaceNodeEditor_path_pop(SpaceNode *snode, bContext *C)
1484 ED_node_tree_pop(snode);
1485 ED_node_tree_update(C);
1488 static void rna_SpaceNodeEditor_show_backdrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1490 WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
1491 WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
1494 static void rna_SpaceNodeEditor_cursor_location_from_region(SpaceNode *snode, bContext *C, int x, int y)
1496 ARegion *ar = CTX_wm_region(C);
1498 UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);
1499 snode->cursor[0] /= UI_DPI_FAC;
1500 snode->cursor[1] /= UI_DPI_FAC;
1503 static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value)
1505 SpaceClip *sc = (SpaceClip *)(ptr->data);
1506 bScreen *screen = (bScreen *)ptr->id.data;
1508 ED_space_clip_set_clip(NULL, screen, sc, (MovieClip *)value.data);
1511 static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr, PointerRNA value)
1513 SpaceClip *sc = (SpaceClip *)(ptr->data);
1515 ED_space_clip_set_mask(NULL, sc, (Mask *)value.data);
1518 static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1520 SpaceClip *sc = (SpaceClip *)(ptr->data);
1525 static void rna_SpaceClipEditor_lock_selection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1527 SpaceClip *sc = (SpaceClip *)(ptr->data);
1533 static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1535 ScrArea *sa = rna_area_from_space(ptr);
1536 ED_area_tag_refresh(sa);
1541 static int rna_FileSelectParams_use_lib_get(PointerRNA *ptr)
1543 FileSelectParams *params = ptr->data;
1545 return params && (params->type == FILE_LOADLIB);
1548 static const EnumPropertyItem *rna_FileSelectParams_recursion_level_itemf(
1549 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
1551 FileSelectParams *params = ptr->data;
1553 if (params && params->type != FILE_LOADLIB) {
1554 EnumPropertyItem *item = NULL;
1557 RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 0);
1558 RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 2);
1559 RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 3);
1560 RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 4);
1562 RNA_enum_item_end(&item, &totitem);
1569 return fileselectparams_recursion_level_items;
1572 static void rna_FileBrowser_FSMenuEntry_path_get(PointerRNA *ptr, char *value)
1574 char *path = ED_fsmenu_entry_get_path(ptr->data);
1576 strcpy(value, path ? path : "");
1579 static int rna_FileBrowser_FSMenuEntry_path_length(PointerRNA *ptr)
1581 char *path = ED_fsmenu_entry_get_path(ptr->data);
1583 return (int)(path ? strlen(path) : 0);
1586 static void rna_FileBrowser_FSMenuEntry_path_set(PointerRNA *ptr, const char *value)
1588 FSMenuEntry *fsm = ptr->data;
1590 /* Note: this will write to file immediately.
1591 * Not nice (and to be fixed ultimately), but acceptable in this case for now. */
1592 ED_fsmenu_entry_set_path(fsm, value);
1595 static void rna_FileBrowser_FSMenuEntry_name_get(PointerRNA *ptr, char *value)
1597 strcpy(value, ED_fsmenu_entry_get_name(ptr->data));
1600 static int rna_FileBrowser_FSMenuEntry_name_length(PointerRNA *ptr)
1602 return (int)strlen(ED_fsmenu_entry_get_name(ptr->data));
1605 static void rna_FileBrowser_FSMenuEntry_name_set(PointerRNA *ptr, const char *value)
1607 FSMenuEntry *fsm = ptr->data;
1609 /* Note: this will write to file immediately.
1610 * Not nice (and to be fixed ultimately), but acceptable in this case for now. */
1611 ED_fsmenu_entry_set_name(fsm, value);
1614 static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr, const char **UNUSED(r_info))
1616 FSMenuEntry *fsm = ptr->data;
1618 return fsm->save ? PROP_EDITABLE : 0;
1621 static void rna_FileBrowser_FSMenu_next(CollectionPropertyIterator *iter)
1623 ListBaseIterator *internal = &iter->internal.listbase;
1625 if (internal->skip) {
1627 internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next);
1628 iter->valid = (internal->link != NULL);
1629 } while (iter->valid && internal->skip(iter, internal->link));
1632 internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next);
1633 iter->valid = (internal->link != NULL);
1637 static void rna_FileBrowser_FSMenu_begin(CollectionPropertyIterator *iter, FSMenuCategory category)
1639 ListBaseIterator *internal = &iter->internal.listbase;
1641 struct FSMenu *fsmenu = ED_fsmenu_get();
1642 struct FSMenuEntry *fsmentry = ED_fsmenu_get_category(fsmenu, category);
1644 internal->link = (fsmentry) ? (Link *)fsmentry : NULL;
1645 internal->skip = NULL;
1647 iter->valid = (internal->link != NULL);
1650 static PointerRNA rna_FileBrowser_FSMenu_get(CollectionPropertyIterator *iter)
1652 ListBaseIterator *internal = &iter->internal.listbase;
1655 RNA_pointer_create(NULL, &RNA_FileBrowserFSMenuEntry, internal->link, &r_ptr);
1660 static void rna_FileBrowser_FSMenu_end(CollectionPropertyIterator *UNUSED(iter))
1664 static void rna_FileBrowser_FSMenuSystem_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
1666 rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM);
1669 static int rna_FileBrowser_FSMenuSystem_data_length(PointerRNA *UNUSED(ptr))
1671 struct FSMenu *fsmenu = ED_fsmenu_get();
1673 return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM);
1676 static void rna_FileBrowser_FSMenuSystemBookmark_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
1678 rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM_BOOKMARKS);
1681 static int rna_FileBrowser_FSMenuSystemBookmark_data_length(PointerRNA *UNUSED(ptr))
1683 struct FSMenu *fsmenu = ED_fsmenu_get();
1685 return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS);
1688 static void rna_FileBrowser_FSMenuBookmark_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
1690 rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_BOOKMARKS);
1693 static int rna_FileBrowser_FSMenuBookmark_data_length(PointerRNA *UNUSED(ptr))
1695 struct FSMenu *fsmenu = ED_fsmenu_get();
1697 return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
1700 static void rna_FileBrowser_FSMenuRecent_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
1702 rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_RECENT);
1705 static int rna_FileBrowser_FSMenuRecent_data_length(PointerRNA *UNUSED(ptr))
1707 struct FSMenu *fsmenu = ED_fsmenu_get();
1709 return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_RECENT);
1712 static int rna_FileBrowser_FSMenu_active_get(PointerRNA *ptr, const FSMenuCategory category)
1714 SpaceFile *sf = ptr->data;
1718 case FS_CATEGORY_SYSTEM:
1719 actnr = sf->systemnr;
1721 case FS_CATEGORY_SYSTEM_BOOKMARKS:
1722 actnr = sf->system_bookmarknr;
1724 case FS_CATEGORY_BOOKMARKS:
1725 actnr = sf->bookmarknr;
1727 case FS_CATEGORY_RECENT:
1728 actnr = sf->recentnr;
1735 static void rna_FileBrowser_FSMenu_active_set(PointerRNA *ptr, int value, const FSMenuCategory category)
1737 SpaceFile *sf = ptr->data;
1738 struct FSMenu *fsmenu = ED_fsmenu_get();
1739 FSMenuEntry *fsm = ED_fsmenu_get_entry(fsmenu, category, value);
1741 if (fsm && sf->params) {
1743 case FS_CATEGORY_SYSTEM:
1744 sf->systemnr = value;
1746 case FS_CATEGORY_SYSTEM_BOOKMARKS:
1747 sf->system_bookmarknr = value;
1749 case FS_CATEGORY_BOOKMARKS:
1750 sf->bookmarknr = value;
1752 case FS_CATEGORY_RECENT:
1753 sf->recentnr = value;
1757 BLI_strncpy(sf->params->dir, fsm->path, sizeof(sf->params->dir));
1761 static void rna_FileBrowser_FSMenu_active_range(
1762 PointerRNA *UNUSED(ptr), int *min, int *max, int *softmin, int *softmax, const FSMenuCategory category)
1764 struct FSMenu *fsmenu = ED_fsmenu_get();
1766 *min = *softmin = -1;
1767 *max = *softmax = ED_fsmenu_get_nentries(fsmenu, category) - 1;
1770 static void rna_FileBrowser_FSMenu_active_update(struct bContext *C, PointerRNA *UNUSED(ptr))
1772 ED_file_change_dir(C);
1775 static int rna_FileBrowser_FSMenuSystem_active_get(PointerRNA *ptr)
1777 return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM);
1780 static void rna_FileBrowser_FSMenuSystem_active_set(PointerRNA *ptr, int value)
1782 rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM);
1785 static void rna_FileBrowser_FSMenuSystem_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1787 rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM);
1790 static int rna_FileBrowser_FSMenuSystemBookmark_active_get(PointerRNA *ptr)
1792 return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM_BOOKMARKS);
1795 static void rna_FileBrowser_FSMenuSystemBookmark_active_set(PointerRNA *ptr, int value)
1797 rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM_BOOKMARKS);
1800 static void rna_FileBrowser_FSMenuSystemBookmark_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1802 rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM_BOOKMARKS);
1805 static int rna_FileBrowser_FSMenuBookmark_active_get(PointerRNA *ptr)
1807 return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_BOOKMARKS);
1810 static void rna_FileBrowser_FSMenuBookmark_active_set(PointerRNA *ptr, int value)
1812 rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_BOOKMARKS);
1815 static void rna_FileBrowser_FSMenuBookmark_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1817 rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_BOOKMARKS);
1820 static int rna_FileBrowser_FSMenuRecent_active_get(PointerRNA *ptr)
1822 return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_RECENT);
1825 static void rna_FileBrowser_FSMenuRecent_active_set(PointerRNA *ptr, int value)
1827 rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_RECENT);
1830 static void rna_FileBrowser_FSMenuRecent_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1832 rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_RECENT);
1837 static const EnumPropertyItem dt_uv_items[] = {
1838 {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"},
1839 {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"},
1840 {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"},
1841 {SI_UVDT_WHITE, "WHITE", 0, "White", "Draw white edges"},
1842 {0, NULL, 0, NULL, NULL}
1845 static void rna_def_space(BlenderRNA *brna)
1850 srna = RNA_def_struct(brna, "Space", NULL);
1851 RNA_def_struct_sdna(srna, "SpaceLink");
1852 RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area");
1853 RNA_def_struct_refine_func(srna, "rna_Space_refine");
1855 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1856 RNA_def_property_enum_sdna(prop, NULL, "spacetype");
1857 RNA_def_property_enum_items(prop, rna_enum_space_type_items);
1858 /* When making this editable, take care for the special case of global areas (see rna_Area_type_set). */
1859 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1860 RNA_def_property_ui_text(prop, "Type", "Space data type");
1862 /* access to V2D_VIEWSYNC_SCREEN_TIME */
1863 prop = RNA_def_property(srna, "show_locked_time", PROP_BOOLEAN, PROP_NONE);
1864 RNA_def_property_boolean_funcs(prop, "rna_Space_view2d_sync_get", "rna_Space_view2d_sync_set");
1865 RNA_def_property_ui_text(prop, "Lock Time to Other Windows", "");
1866 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Space_view2d_sync_update");
1869 /* for all spaces that use a mask */
1870 static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *mask_set_func)
1874 static const EnumPropertyItem overlay_mode_items[] = {
1875 {MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"},
1876 {MASK_OVERLAY_COMBINED, "COMBINED", ICON_NONE, "Combined", "Combine space background image with the mask"},
1877 {0, NULL, 0, NULL, NULL}
1880 prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
1881 RNA_def_property_pointer_sdna(prop, NULL, "mask_info.mask");
1882 RNA_def_property_flag(prop, PROP_EDITABLE);
1883 RNA_def_property_ui_text(prop, "Mask", "Mask displayed and edited in this space");
1884 RNA_def_property_pointer_funcs(prop, NULL, mask_set_func, NULL, NULL);
1885 RNA_def_property_update(prop, noteflag, NULL);
1888 prop = RNA_def_property(srna, "mask_draw_type", PROP_ENUM, PROP_NONE);
1889 RNA_def_property_enum_sdna(prop, NULL, "mask_info.draw_type");
1890 RNA_def_property_enum_items(prop, dt_uv_items);
1891 RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for mask splines");
1892 RNA_def_property_update(prop, noteflag, NULL);
1894 prop = RNA_def_property(srna, "show_mask_smooth", PROP_BOOLEAN, PROP_NONE);
1895 RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_SMOOTH);
1896 RNA_def_property_ui_text(prop, "Draw Smooth Splines", "");
1897 RNA_def_property_update(prop, noteflag, NULL);
1899 prop = RNA_def_property(srna, "show_mask_overlay", PROP_BOOLEAN, PROP_NONE);
1900 RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_OVERLAY);
1901 RNA_def_property_ui_text(prop, "Show Mask Overlay", "");
1902 RNA_def_property_update(prop, noteflag, NULL);
1904 prop = RNA_def_property(srna, "mask_overlay_mode", PROP_ENUM, PROP_NONE);
1905 RNA_def_property_enum_sdna(prop, NULL, "mask_info.overlay_mode");
1906 RNA_def_property_enum_items(prop, overlay_mode_items);
1907 RNA_def_property_ui_text(prop, "Overlay Mode", "Overlay mode of rasterized mask");
1908 RNA_def_property_update(prop, noteflag, NULL);
1911 static void rna_def_space_image_uv(BlenderRNA *brna)
1916 static const EnumPropertyItem sticky_mode_items[] = {
1917 {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"},
1918 {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location",
1919 "Select UVs that are at the same location and share a mesh vertex"},
1920 {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex",
1921 "Select UVs that share mesh vertex, irrespective if they are in the same location"},
1922 {0, NULL, 0, NULL, NULL}
1925 static const EnumPropertyItem dt_uvstretch_items[] = {
1926 {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
1927 {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
1928 {0, NULL, 0, NULL, NULL}
1931 static const EnumPropertyItem other_uv_filter_items[] = {
1932 {SI_FILTER_ALL, "ALL", 0, "All", "No filter, show all islands from other objects"},
1933 {SI_FILTER_SAME_IMAGE, "SAME_IMAGE", ICON_IMAGE_DATA, "Same Image",
1934 "Only show others' UV islands whose active image matches image of the active face"},
1935 {0, NULL, 0, NULL, NULL}
1938 srna = RNA_def_struct(brna, "SpaceUVEditor", NULL);
1939 RNA_def_struct_sdna(srna, "SpaceImage");
1940 RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
1941 RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space");
1944 prop = RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
1945 RNA_def_property_enum_sdna(prop, NULL, "sticky");
1946 RNA_def_property_enum_items(prop, sticky_mode_items);
1947 RNA_def_property_ui_text(prop, "Sticky Selection Mode",
1948 "Automatically select also UVs sharing the same vertex as the ones being selected");
1949 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1952 prop = RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE);
1953 RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
1954 RNA_def_property_enum_items(prop, dt_uv_items);
1955 RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for drawing UV edges");
1956 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1958 prop = RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE);
1959 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
1960 RNA_def_property_ui_text(prop, "Draw Smooth Edges", "Draw UV edges anti-aliased");
1961 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1963 prop = RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE);
1964 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
1965 RNA_def_property_ui_text(prop, "Draw Stretch",
1966 "Draw faces colored according to the difference in shape between UVs and "
1967 "their 3D coordinates (blue for low distortion, red for high distortion)");
1968 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1970 prop = RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE);
1971 RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
1972 RNA_def_property_enum_items(prop, dt_uvstretch_items);
1973 RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw");
1974 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1976 prop = RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE);
1977 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW);
1978 RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges after modifiers are applied");
1979 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1981 prop = RNA_def_property(srna, "show_other_objects", PROP_BOOLEAN, PROP_NONE);
1982 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_OTHER);
1983 RNA_def_property_ui_text(prop, "Draw Other Objects", "Draw other selected objects that share the same image");
1984 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1986 prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
1987 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_METADATA);
1988 RNA_def_property_ui_text(prop, "Show Metadata", "Draw metadata properties of the image");
1989 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1991 prop = RNA_def_property(srna, "show_texpaint", PROP_BOOLEAN, PROP_NONE);
1992 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAW_TEXPAINT);
1993 RNA_def_property_ui_text(prop, "Draw Texture Paint UVs", "Draw overlay of texture paint uv layer");
1994 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1996 prop = RNA_def_property(srna, "show_normalized_coords", PROP_BOOLEAN, PROP_NONE);
1997 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
1998 RNA_def_property_ui_text(prop, "Normalized Coordinates",
1999 "Display UV coordinates from 0.0 to 1.0 rather than in pixels");
2000 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2002 prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
2003 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWFACES);
2004 RNA_def_property_ui_text(prop, "Draw Faces", "Draw faces over the image");
2005 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2007 /* todo: move edge and face drawing options here from G.f */
2009 prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
2010 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
2011 RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing");
2012 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2014 prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
2015 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
2016 RNA_def_property_ui_text(prop, "Constrain to Image Bounds",
2017 "Constraint to stay within the image bounds while editing");
2018 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2020 prop = RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
2021 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
2022 RNA_def_property_ui_text(prop, "Live Unwrap",
2023 "Continuously unwrap the selected UV island while transforming pinned vertices");
2024 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2026 /* Other UV filtering */
2027 prop = RNA_def_property(srna, "other_uv_filter", PROP_ENUM, PROP_NONE);
2028 RNA_def_property_enum_items(prop, other_uv_filter_items);
2029 RNA_def_property_ui_text(prop, "Other UV filter",
2030 "Filter applied on the other object's UV to limit displayed");
2031 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2034 static void rna_def_space_outliner(BlenderRNA *brna)
2039 static const EnumPropertyItem display_mode_items[] = {
2040 {SO_COLLECTIONS, "COLLECTIONS", 0, "Collections", "Display collections in the view layer"},
2041 {SO_SCENES, "SCENES", 0, "Scenes", "Display scenes and their view layers, collections and objects"},
2042 {SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their data-blocks"},
2043 {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence data-blocks"},
2044 {SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"},
2045 {SO_DATABLOCKS, "DATABLOCKS", 0, "Data-Blocks", "Display all raw data-blocks"},
2046 {SO_ID_ORPHANS, "ORPHAN_DATA", 0, "Orphan Data",
2047 "Display data-blocks which are unused and/or will be lost when the file is reloaded"},
2048 {0, NULL, 0, NULL, NULL}
2051 static const EnumPropertyItem filter_state_items[] = {
2052 {SO_FILTER_OB_VISIBLE, "VISIBLE", ICON_RESTRICT_VIEW_OFF, "Visible", "Show visible objects"},
2053 {SO_FILTER_OB_SELECTED, "SELECTED", ICON_RESTRICT_SELECT_OFF, "Selected", "Show selected objects"},
2054 {SO_FILTER_OB_ACTIVE, "ACTIVE", ICON_LAYER_ACTIVE, "Active", "Show only the active object"},
2055 {0, NULL, 0, NULL, NULL}
2058 srna = RNA_def_struct(brna, "SpaceOutliner", "Space");
2059 RNA_def_struct_sdna(srna, "SpaceOops");
2060 RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
2062 prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
2063 RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
2064 RNA_def_property_enum_items(prop, display_mode_items);
2065 RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
2066 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2068 prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
2069 RNA_def_property_string_sdna(prop, NULL, "search_string");
2070 RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
2071 RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
2072 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2074 prop = RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE);
2075 RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE);
2076 RNA_def_property_ui_text(prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string");
2077 RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 0);
2078 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2080 prop = RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE);
2081 RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE);
2082 RNA_def_property_ui_text(prop, "Complete Matches Only", "Only use complete matches of search string");
2083 RNA_def_property_ui_icon(prop, ICON_OUTLINER_DATA_FONT, 0);
2084 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2086 prop = RNA_def_property(srna, "use_sort_alpha", PROP_BOOLEAN, PROP_NONE);
2087 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_SKIP_SORT_ALPHA);
2088 RNA_def_property_ui_text(prop, "Sort Alphabetically", "");
2089 RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
2090 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2092 prop = RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
2093 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
2094 RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");
2095 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2098 prop = RNA_def_property(srna, "use_filter_search", PROP_BOOLEAN, PROP_NONE);
2099 RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_SEARCH);
2100 RNA_def_property_ui_text(prop, "Search Name", "Filter searched elements");
2101 RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
2102 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2104 prop = RNA_def_property(srna, "use_filters", PROP_BOOLEAN, PROP_NONE);
2105 RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_ENABLE);
2106 RNA_def_property_ui_text(prop, "Use Filters", "Use filters");
2107 RNA_def_property_ui_icon(prop, ICON_FILTER, 0);
2108 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2110 prop = RNA_def_property(srna, "use_filter_object", PROP_BOOLEAN, PROP_NONE);
2111 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OBJECT);
2112 RNA_def_property_ui_text(prop, "Filter Objects", "Show objects");
2113 RNA_def_property_ui_icon(prop, ICON_OBJECT_DATA, 0);
2114 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2116 prop = RNA_def_property(srna, "use_filter_object_content", PROP_BOOLEAN, PROP_NONE);
2117 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_CONTENT);
2118 RNA_def_property_ui_text(prop, "Filter Objects Contents", "Show what is inside the objects elements");
2119 RNA_def_property_ui_icon(prop, ICON_MODIFIER, 0);
2120 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2122 prop = RNA_def_property(srna, "use_filter_children", PROP_BOOLEAN, PROP_NONE);
2123 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_CHILDREN);
2124 RNA_def_property_ui_text(prop, "Filter Objects Children", "Show children");
2125 RNA_def_property_ui_icon(prop, ICON_PLUS, 0);
2126 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2128 prop = RNA_def_property(srna, "use_filter_collection", PROP_BOOLEAN, PROP_NONE);
2129 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_COLLECTION);
2130 RNA_def_property_ui_text(prop, "Filter Collections", "Show collections");
2131 RNA_def_property_ui_icon(prop, ICON_COLLAPSEMENU, 0);
2132 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2134 /* Filters object state. */
2135 prop = RNA_def_property(srna, "use_filter_object_state", PROP_BOOLEAN, PROP_NONE);
2136 RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_OB_STATE);
2137 RNA_def_property_ui_text(prop, "Filter Object State", "Filter objects based on their state (visible, ...)."
2138 "This can be slow");
2139 RNA_def_property_ui_icon(prop, ICON_LAYER_USED, 0);
2140 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2142 prop = RNA_def_property(srna, "filter_state", PROP_ENUM, PROP_NONE);
2143 RNA_def_property_enum_sdna(prop, NULL, "filter_state");
2144 RNA_def_property_enum_items(prop, filter_state_items);
2145 RNA_def_property_ui_text(prop, "State Filter", "");
2146 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2148 /* Filters object type. */
2149 prop = RNA_def_property(srna, "use_filter_object_type", PROP_BOOLEAN, PROP_NONE);
2150 RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_OB_TYPE);
2151 RNA_def_property_ui_text(prop, "Filter Object Type", "Show specific objects types");
2152 RNA_def_property_ui_icon(prop, ICON_MESH_CUBE, 0);
2153 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2155 prop = RNA_def_property(srna, "use_filter_object_mesh", PROP_BOOLEAN, PROP_NONE);
2156 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_MESH);
2157 RNA_def_property_ui_text(prop, "Show Meshes", "Show mesh objects");
2158 RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_MESH, 0);
2159 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2161 prop = RNA_def_property(srna, "use_filter_object_armature", PROP_BOOLEAN, PROP_NONE);
2162 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_ARMATURE);
2163 RNA_def_property_ui_text(prop, "Show Armatures", "Show armature objects");
2164 RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_ARMATURE, 0);
2165 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2167 prop = RNA_def_property(srna, "use_filter_object_empty", PROP_BOOLEAN, PROP_NONE);
2168 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_EMPTY);
2169 RNA_def_property_ui_text(prop, "Show Empties", "Show empty objects");
2170 RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_EMPTY, 0);
2171 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2173 prop = RNA_def_property(srna, "use_filter_object_lamp", PROP_BOOLEAN, PROP_NONE);
2174 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_LAMP);
2175 RNA_def_property_ui_text(prop, "Show Lamps", "Show lamps objects");
2176 RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LAMP, 0);
2177 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2179 prop = RNA_def_property(srna, "use_filter_object_camera", PROP_BOOLEAN, PROP_NONE);
2180 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_CAMERA);
2181 RNA_def_property_ui_text(prop, "Show Cameras", "Show camera objects");
2182 RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_CAMERA, 0);
2183 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2185 prop = RNA_def_property(srna, "use_filter_object_others", PROP_BOOLEAN, PROP_NONE);
2186 RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_OTHERS);
2187 RNA_def_property_ui_text(prop, "Show Other Objects", "Show curves, lattices, light probes, fonts, ...");
2188 RNA_def_property_ui_icon(prop, ICON_ZOOMIN, 0);
2189 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
2192 static void rna_def_space_view3d_shading(BlenderRNA *brna)
2197 static const EnumPropertyItem single_color_mode_items[] = {
2198 {V3D_DRAWOPTION_SINGLE_COLOR, "SINGLE", 0, "Single", "Show scene in a single color"},
2199 {V3D_DRAWOPTION_OBJECT_COLOR, "OBJECT", 0, "Object", "Show Object color"},
2200 {V3D_DRAWOPTION_MATERIAL_COLOR, "MATERIAL", 0, "Material", "Show Material color"},
2201 {V3D_DRAWOPTION_RANDOMIZE, "RANDOM", 0, "Random", "Show random object color"},
2202 {0, NULL, 0, NULL, NULL}
2205 srna = RNA_def_struct(brna, "View3DShading", NULL);
2206 RNA_def_struct_sdna(srna, "View3D");
2207 RNA_def_struct_nested(brna, srna, "SpaceView3D");
2208 RNA_def_struct_path_func(srna, "rna_View3DShading_path");
2209 RNA_def_struct_ui_text(srna, "3D View Shading Settings", "Settings for shading in the 3D viewport");
2211 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2212 RNA_def_property_enum_sdna(prop, NULL, "drawtype");
2213 RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
2214 RNA_def_property_enum_funcs(prop, "rna_3DViewShading_type_get", "rna_3DViewShading_type_set",
2215 "rna_3DViewShading_type_itemf");
2216 RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
2217 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
2219 prop = RNA_def_property(srna, "light", PROP_ENUM, PROP_NONE);
2220 RNA_def_property_enum_sdna(prop, NULL, "drawtype_lighting");
2221 RNA_def_property_enum_items(prop, rna_enum_viewport_lighting_items);
2222 RNA_def_property_ui_text(prop, "Lighting", "Lighting Method for Solid/Texture Viewport Shading");
2223 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
2225 prop = RNA_def_property(srna, "show_object_overlap", PROP_BOOLEAN, PROP_NONE);
2226 RNA_def_property_boolean_sdna(prop, NULL, "drawtype_options", V3D_DRAWOPTION_OBJECT_OVERLAP);
2227 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2228 RNA_def_property_ui_text(prop, "Object Overlap", "Show Object Overlap");
2229 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
2231 prop = RNA_def_property(srna, "single_color_mode", PROP_ENUM, PROP_NONE);
2232 RNA_def_property_enum_items(prop, single_color_mode_items);
2233 RNA_def_property_enum_funcs(prop, "rna_View3DShading_single_color_mode_get",
2234 "rna_View3DShading_single_color_mode_set",
2236 RNA_def_property_ui_text(prop, "Color", "Single Color Mode");
2237 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
2240 static void rna_def_space_view3d_overlay(BlenderRNA *brna)
2245 srna = RNA_def_struct(brna, "View3DOverlay", NULL);
2246 RNA_def_struct_sdna(srna, "View3D");
2247 RNA_def_struct_nested(brna, srna, "SpaceView3D");
2248 RNA_def_struct_path_func(srna, "rna_View3DOverlay_path");
2249 RNA_def_struct_ui_text(srna, "3D View Overlay Settings", "Settings for display of overlays in the 3D viewport");
2251 prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
2252 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
2253 RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like manipulators and outlines");
2254 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2257 static void rna_def_space_view3d(BlenderRNA *brna)
2262 static const EnumPropertyItem rv3d_persp_items[] = {
2263 {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
2264 {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
2265 {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
2266 {0, NULL, 0, NULL, NULL}
2269 static const EnumPropertyItem bundle_drawtype_items[] = {
2270 {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
2271 {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
2272 {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
2273 {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
2274 {OB_CUBE, "CUBE", 0, "Cube", ""},
2275 {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
2276 {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
2277 {0, NULL, 0, NULL, NULL}
2280 static const EnumPropertyItem view3d_matcap_items[] = {
2281 {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""},
2282 {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""},
2283 {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""},
2284 {ICON_MATCAP_04, "04", ICON_MATCAP_04, "", ""},
2285 {ICON_MATCAP_05, "05", ICON_MATCAP_05, "", ""},
2286 {ICON_MATCAP_06, "06", ICON_MATCAP_06, "", ""},
2287 {ICON_MATCAP_07, "07", ICON_MATCAP_07, "", ""},
2288 {ICON_MATCAP_08, "08", ICON_MATCAP_08, "", ""},
2289 {ICON_MATCAP_09, "09", ICON_MATCAP_09, "", ""},
2290 {ICON_MATCAP_10, "10", ICON_MATCAP_10, "", ""},
2291 {ICON_MATCAP_11, "11", ICON_MATCAP_11, "", ""},
2292 {ICON_MATCAP_12, "12", ICON_MATCAP_12, "", ""},
2293 {ICON_MATCAP_13, "13", ICON_MATCAP_13, "", ""},
2294 {ICON_MATCAP_14, "14", ICON_MATCAP_14, "", ""},
2295 {ICON_MATCAP_15, "15", ICON_MATCAP_15, "", ""},
2296 {ICON_MATCAP_16, "16", ICON_MATCAP_16, "", ""},
2297 {ICON_MATCAP_17, "17", ICON_MATCAP_17, "", ""},
2298 {ICON_MATCAP_18, "18", ICON_MATCAP_18, "", ""},
2299 {ICON_MATCAP_19, "19", ICON_MATCAP_19, "", ""},
2300 {ICON_MATCAP_20, "20", ICON_MATCAP_20, "", ""},
2301 {ICON_MATCAP_21, "21", ICON_MATCAP_21, "", ""},
2302 {ICON_MATCAP_22, "22", ICON_MATCAP_22, "", ""},
2303 {ICON_MATCAP_23, "23", ICON_MATCAP_23, "", ""},
2304 {ICON_MATCAP_24, "24", ICON_MATCAP_24, "", ""},
2305 {0, NULL, 0, NULL, NULL}
2308 srna = RNA_def_struct(brna, "SpaceView3D", "Space");
2309 RNA_def_struct_sdna(srna, "View3D");
2310 RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
2312 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
2313 RNA_def_property_flag(prop, PROP_EDITABLE);
2314 RNA_def_property_pointer_sdna(prop, NULL, "camera");
2315 RNA_def_property_ui_text(prop, "Camera",
2316 "Active camera used in this view (when unlocked from the scene's active camera)");
2317 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_camera_update");
2320 prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE);
2321 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER);
2322 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2323 RNA_def_property_ui_text(prop, "Render Border", "Use a region within the frame size for rendered viewport "
2324 "(when not viewing through the camera)");
2325 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2327 prop = RNA_def_property(srna, "render_border_min_x", PROP_FLOAT, PROP_NONE);
2328 RNA_def_property_float_sdna(prop, NULL, "render_border.xmin");
2329 RNA_def_property_range(prop, 0.0f, 1.0f);
2330 RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value for the render border");
2331 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2333 prop = RNA_def_property(srna, "render_border_min_y", PROP_FLOAT, PROP_NONE);
2334 RNA_def_property_float_sdna(prop, NULL, "render_border.ymin");
2335 RNA_def_property_range(prop, 0.0f, 1.0f);
2336 RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border");
2337 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2339 prop = RNA_def_property(srna, "render_border_max_x", PROP_FLOAT, PROP_NONE);
2340 RNA_def_property_float_sdna(prop, NULL, "render_border.xmax");
2341 RNA_def_property_range(prop, 0.0f, 1.0f);
2342 RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border");
2343 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2345 prop = RNA_def_property(srna, "render_border_max_y", PROP_FLOAT, PROP_NONE);
2346 RNA_def_property_float_sdna(prop, NULL, "render_border.ymax");
2347 RNA_def_property_range(prop, 0.0f, 1.0f);
2348 RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border");
2349 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2351 prop = RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
2352 RNA_def_property_flag(prop, PROP_EDITABLE);
2353 RNA_def_property_pointer_sdna(prop, NULL, "ob_centre");
2354 RNA_def_property_ui_text(prop, "Lock to Object", "3D View center is locked to this object's position");
2355 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2357 prop = RNA_def_property(srna, "lock_bone", PROP_STRING, PROP_NONE);
2358 RNA_def_property_string_sdna(prop, NULL, "ob_centre_bone");
2359 RNA_def_property_ui_text(prop, "Lock to Bone", "3D View center is locked to this bone's position");
2360 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2362 prop = RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
2363 RNA_def_property_boolean_sdna(prop, NULL, "ob_centre_cursor", 1);
2364 RNA_def_property_ui_text(prop, "Lock to Cursor", "3D View center is locked to the cursor's position");
2365 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2367 prop = RNA_def_property(srna, "show_face_orientation_overlay", PROP_BOOLEAN, PROP_NONE);
2368 RNA_def_property_boolean_sdna(prop, NULL, "overlays", V3D_OVERLAY_FACE_ORIENTATION);
2369 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2370 RNA_def_property_ui_text(prop, "Face Orientation", "Show the Face Orientation Overlay");
2371 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
2373 prop = RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
2374 RNA_def_property_pointer_sdna(prop, NULL, "localvd");
2375 RNA_def_property_ui_text(prop, "Local View",
2376 "Display an isolated sub-set of objects, apart from the scene visibility");
2378 prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
2379 RNA_def_property_array(prop, 3);
2380 RNA_def_property_float_funcs(prop, "rna_View3D_CursorLocation_get", "rna_View3D_CursorLocation_set", NULL);
2381 RNA_def_property_ui_text(prop, "3D Cursor Location",
2382 "3D cursor location for this view (dependent on local view setting)");
2383 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1, RNA_TRANSLATION_PREC_DEFAULT);
2384 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2386 prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_UNIT_CAMERA);
2387 RNA_def_property_float_sdna(prop, NULL, "lens");
2388 RNA_def_property_ui_text(prop, "Lens", "Viewport lens angle");
2389 RNA_def_property_range(prop, 1.0f, 250.0f);
2390 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2392 prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
2393 RNA_def_property_float_sdna(prop, NULL, "near");
2394 RNA_def_property_range(prop, 1e-6f, FLT_MAX);
2395 RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
2396 RNA_def_property_float_default(prop, 0.1f);
2397 RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance (perspective view only)");
2398 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2400 prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
2401 RNA_def_property_float_sdna(prop, NULL, "far");
2402 RNA_def_property_range(prop, 1e-6f, FLT_MAX);
2403 RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
2404 RNA_def_property_float_default(prop, 1000.0f);
2405 RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance");
2406 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2408 prop = RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE);
2409 RNA_def_property_float_sdna(prop, NULL, "grid");
2410 RNA_def_property_ui_text(prop, "Grid Scale", "Distance between 3D View grid lines");
2411 RNA_def_property_range(prop, 0.0f, FLT_MAX);
2412 RNA_def_property_ui_range(prop, 0.001f, 1000.0f, 0.1f, 3);
2413 RNA_def_property_float_default(prop, 1.0f);
2414 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2416 prop = RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
2417 RNA_def_property_int_sdna(prop, NULL, "gridlines");
2418 RNA_def_property_ui_text(prop, "Grid Lines", "Number of grid lines to display in perspective view");
2419 RNA_def_property_range(prop, 0, 1024);
2420 RNA_def_property_int_default(prop, 16);
2421 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2423 prop = RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
2424 RNA_def_property_int_sdna(prop, NULL, "gridsubdiv");
2425 RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions between grid lines");
2426 RNA_def_property_range(prop, 1, 1024);
2427 RNA_def_property_int_default(prop, 10);
2428 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2430 prop = RNA_def_property(srna, "grid_scale_unit", PROP_FLOAT, PROP_NONE);
2431 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2432 RNA_def_property_float_funcs(prop, "rna_View3D_GridScaleUnit_get", NULL, NULL);
2433 RNA_def_property_ui_text(prop, "Grid Scale Unit", "Grid cell size scaled by scene unit system settings");
2435 prop = RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE);
2436 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
2437 RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view");
2438 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2440 prop = RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
2441 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);
2442 RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view");
2443 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2445 prop = RNA_def_property(srna, "show_axis_y", PROP_BOOLEAN, PROP_NONE);
2446 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y);
2447 RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view");
2448 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2450 prop = RNA_def_property(srna, "show_axis_z", PROP_BOOLEAN, PROP_NONE);
2451 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z);
2452 RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view");
2453 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2455 prop = RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE);
2456 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE);
2457 RNA_def_property_ui_text(prop, "Outline Selected",
2458 "Show an outline highlight around selected objects in non-wireframe views");
2459 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2461 prop = RNA_def_property(srna, "show_all_objects_origin", PROP_BOOLEAN, PROP_NONE);
2462 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS);
2463 RNA_def_property_ui_text(prop, "All Object Origins",
2464 "Show the object origin center dot for all (selected and unselected) objects");
2465 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2467 prop = RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
2468 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
2469 RNA_def_property_ui_text(prop, "Relationship Lines",
2470 "Show dashed lines indicating parent or constraint relationships");
2471 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2473 prop = RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE);
2474 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_GPENCIL);
2475 RNA_def_property_ui_text(prop, "Show Grease Pencil",
2476 "Show grease pencil for this view");
2477 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2479 prop = RNA_def_property(srna, "show_textured_solid", PROP_BOOLEAN, PROP_NONE);
2480 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_TEX);
2481 RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view");
2482 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2484 prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE);
2485 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_BACKFACE_CULLING);
2486 RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces");
2487 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2489 prop = RNA_def_property(srna, "show_mode_shade_override", PROP_BOOLEAN, PROP_NONE);
2490 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_MODE_SHADE_OVERRIDE);
2491 RNA_def_property_ui_text(prop, "Full Shading", "Use full shading for mode drawing (to view final result)");
2492 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2494 prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
2495 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_OCCLUDE_WIRE);
2496 RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
2497 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2499 prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
2500 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
2501 RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");
2502 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2504 prop = RNA_def_property(srna, "show_world", PROP_BOOLEAN, PROP_NONE);
2505 RNA_def_property_boolean_sdna(prop, NULL, "flag3", V3D_SHOW_WORLD);
2506 RNA_def_property_ui_text(prop, "World Background", "Display world colors in the background");
2507 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2509 prop = RNA_def_property(srna, "use_occlude_geometry", PROP_BOOLEAN, PROP_NONE);
2510 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT);
2511 RNA_def_property_ui_text(prop, "Occlude Geometry", "Limit selection to visible (clipped with depth buffer)");
2512 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
2513 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2515 prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
2516 RNA_def_property_enum_sdna(prop, NULL, "around");
2517 RNA_def_property_enum_items(prop, pivot_items_full);
2518 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
2519 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
2521 prop = RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
2522 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ALIGN);
2523 RNA_def_property_ui_text(prop, "Align", "Manipulate center points (object, pose and weight paint mode only)");
2524 RNA_def_property_ui_icon(prop, ICON_ALIGN, 0);
2525 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
2527 prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
2528 RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_MANIPULATOR_DRAW);
2529 RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms");
2530 RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0);
2531 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2533 prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
2534 RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
2535 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set");
2536 RNA_def_property_ui_text(prop, "Lock Camera and Layers",
2537 "Use the scene's active camera and layers in this view, rather than local layers");
2538 RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1);
2539 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2541 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2542 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
2543 RNA_def_property_array(prop, 20);
2544 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_layer_set");
2545 RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View");
2546 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update");
2548 prop = RNA_def_property(srna, "active_layer", PROP_INT, PROP_NONE);
2549 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2550 RNA_def_property_int_funcs(prop, "rna_SpaceView3D_active_layer_get", NULL, NULL);
2551 RNA_def_property_ui_text(prop, "Active Layer", "Active 3D view layer index");
2553 prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2554 RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
2555 RNA_def_property_array(prop, 8);
2556 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2557 RNA_def_property_ui_text(prop, "Local View Layers", "Local view layers visible in this 3D View");
2559 prop = RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2560 RNA_def_property_boolean_sdna(prop, NULL, "lay_used", 1);
2561 RNA_def_property_array(prop, 20);
2562 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2563 RNA_def_property_ui_text(prop, "Used Layers", "Layers that contain something");
2565 prop = RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
2566 RNA_def_property_struct_type(prop, "RegionView3D");
2567 RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_3d_get", NULL, NULL, NULL);
2568 RNA_def_property_ui_text(prop, "3D Region", "3D region in this space, in case of quad view the camera region");
2570 prop = RNA_def_property(srna, "region_quadviews", PROP_COLLECTION, PROP_NONE);
2571 RNA_def_property_struct_type(prop, "RegionView3D");
2572 RNA_def_property_collection_funcs(prop, "rna_SpaceView3D_region_quadviews_begin", "rna_iterator_listbase_next",
2573 "rna_iterator_listbase_end", "rna_SpaceView3D_region_quadviews_get",
2574 NULL, NULL, NULL, NULL);
2575 RNA_def_property_ui_text(prop, "Quad View Regions", "3D regions (the third one defines quad view settings, "
2576 "the fourth one is same as 'region_3d')");
2578 prop = RNA_def_property(srna, "show_reconstruction", PROP_BOOLEAN, PROP_NONE);
2579 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_RECONSTRUCTION);
2580 RNA_def_property_ui_text(prop, "Show Reconstruction", "Display reconstruction data from active movie clip");
2581 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2583 prop = RNA_def_property(srna, "tracks_draw_size", PROP_FLOAT, PROP_NONE);
2584 RNA_def_property_range(prop, 0.0, FLT_MAX);
2585 RNA_def_property_ui_range(prop, 0, 5, 1, 3);
2586 RNA_def_property_float_sdna(prop, NULL, "bundle_size");
2587 RNA_def_property_ui_text(prop, "Tracks Size", "Display size of tracks from reconstructed data");
2588 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2590 prop = RNA_def_property(srna, "tracks_draw_type", PROP_ENUM, PROP_NONE);
2591 RNA_def_property_enum_sdna(prop, NULL, "bundle_drawtype");
2592 RNA_def_property_enum_items(prop, bundle_drawtype_items);
2593 RNA_def_property_ui_text(prop, "Tracks Display Type", "Viewport display style for tracks");
2594 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2596 prop = RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
2597 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_CAMERAPATH);
2598 RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed camera path");
2599 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2601 prop = RNA_def_property(srna, "show_bundle_names", PROP_BOOLEAN, PROP_NONE);
2602 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME);
2603 RNA_def_property_ui_text(prop, "Show 3D Marker Names", "Show names for reconstructed tracks objects");
2604 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2606 prop = RNA_def_property(srna, "use_matcap", PROP_BOOLEAN, PROP_NONE);
2607 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_MATCAP);
2608 RNA_def_property_ui_text(prop, "Matcap", "Active Objects draw images mapped on normals, enhancing Solid Draw Mode");
2609 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_matcap_enable");
2611 prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE);
2612 RNA_def_property_enum_sdna(prop, NULL, "matcap_icon");
2613 RNA_def_property_enum_items(prop, view3d_matcap_items);
2614 RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture, active objects only");
2615 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_matcap_update");
2617 prop = RNA_def_property(srna, "fx_settings", PROP_POINTER, PROP_NONE);
2618 RNA_def_property_ui_text(prop, "FX Options", "Options used for real time compositing");
2619 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2621 /* Stereo Settings */
2622 prop = RNA_def_property(srna, "stereo_3d_eye", PROP_ENUM, PROP_NONE);
2623 RNA_def_property_enum_sdna(prop, NULL, "multiview_eye");
2624 RNA_def_property_enum_items(prop, stereo3d_eye_items);
2625 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf");
2626 RNA_def_property_ui_text(prop, "Stereo Eye", "Current stereo eye being drawn");
2627 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2629 prop = RNA_def_property(srna, "stereo_3d_camera", PROP_ENUM, PROP_NONE);
2630 RNA_def_property_enum_sdna(prop, NULL, "stereo3d_camera");
2631 RNA_def_property_enum_items(prop, stereo3d_camera_items);
2632 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf");
2633 RNA_def_property_ui_text(prop, "Camera", "");
2634 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2636 prop = RNA_def_property(srna, "show_stereo_3d_cameras", PROP_BOOLEAN, PROP_NONE);
2637 RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPCAMERAS);
2638 RNA_def_property_ui_text(prop, "Cameras", "Show the left and right cameras");
2639 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2641 prop = RNA_def_property(srna, "show_stereo_3d_convergence_plane", PROP_BOOLEAN, PROP_NONE);
2642 RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPPLANE);
2643 RNA_def_property_ui_text(prop, "Plane", "Show the stereo 3d convergence plane");
2644 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2646 prop = RNA_def_property(srna, "stereo_3d_convergence_plane_alpha", PROP_FLOAT, PROP_FACTOR);
2647 RNA_def_property_float_sdna(prop, NULL, "stereo3d_convergence_alpha");
2648 RNA_def_property_ui_text(prop, "Plane Alpha", "Opacity (alpha) of the convergence plane");
2649 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2651 prop = RNA_def_property(srna, "show_stereo_3d_volume", PROP_BOOLEAN, PROP_NONE);
2652 RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPVOLUME);
2653 RNA_def_property_ui_text(prop, "Volume", "Show the stereo 3d frustum volume");
2654 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2656 prop = RNA_def_property(srna, "stereo_3d_volume_alpha", PROP_FLOAT, PROP_FACTOR);
2657 RNA_def_property_float_sdna(prop, NULL, "stereo3d_volume_alpha");
2658 RNA_def_property_ui_text(prop, "Volume Alpha", "Opacity (alpha) of the cameras' frustum volume");
2659 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2661 /* Nested Structs */
2662 prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE);
2663 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2664 RNA_def_property_struct_type(prop, "View3DShading");
2665 RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_shading_get", NULL, NULL, NULL);
2666 RNA_def_property_ui_text(prop, "Shading Settings", "Settings for shading in the 3D viewport");
2668 prop = RNA_def_property(srna, "overlay", PROP_POINTER, PROP_NONE);
2669 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2670 RNA_def_property_struct_type(prop, "View3DOverlay");
2671 RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_overlay_get", NULL, NULL, NULL);
2672 RNA_def_property_ui_text(prop, "Overlay Settings", "Settings for display of overlays in the 3D viewport");
2674 rna_def_space_view3d_shading(brna);
2675 rna_def_space_view3d_overlay(brna);
2677 /* *** Animated *** */
2678 RNA_define_animate_sdna(true);
2681 srna = RNA_def_struct(brna, "RegionView3D", NULL);
2682 RNA_def_struct_sdna(srna, "RegionView3D");
2683 RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data");
2685 prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
2686 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_LOCKED);
2687 RNA_def_property_ui_text(prop, "Lock", "Lock view rotation in side views");
2688 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
2690 prop = RNA_def_property(srna, "show_sync_view", PROP_BOOLEAN, PROP_NONE);
2691 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXVIEW);
2692 RNA_def_property_ui_text(prop, "Box", "Sync view position between side views");
2693 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
2695 prop = RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
2696 RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
2697 RNA_def_property_ui_text(prop, "Clip", "Clip objects based on what's visible in other side views");
2698 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_clip_update");
2700 prop = RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
2701 RNA_def_property_float_sdna(prop, NULL, "persmat");
2702 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* XXX: for now, it's too risky for users to do this */
2703 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2704 RNA_def_property_ui_text(prop, "Perspective Matrix",
2705 "Current perspective matrix (``window_matrix * view_matrix``)");
2707 prop = RNA_def_property(srna, "window_matrix", PROP_FLOAT, PROP_MATRIX);
2708 RNA_def_property_float_sdna(prop, NULL, "winmat");
2709 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2710 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2711 RNA_def_property_ui_text(prop, "Window Matrix", "Current window matrix");
2713 prop = RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX);
2714 RNA_def_property_float_sdna(prop, NULL, "viewmat");
2715 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2716 RNA_def_property_float_funcs(prop, NULL, "rna_RegionView3D_view_matrix_set", NULL);
2717 RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix");
2718 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2720 prop = RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
2721 RNA_def_property_enum_sdna(prop, NULL, "persp");
2722 RNA_def_property_enum_items(prop, rv3d_persp_items);
2723 RNA_def_property_ui_text(prop, "Perspective", "View Perspective");
2724 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2726 prop = RNA_def_property(srna, "is_perspective", PROP_BOOLEAN, PROP_NONE);
2727 RNA_def_property_boolean_sdna(prop, NULL, "is_persp", 1);
2728 RNA_def_property_ui_text(prop, "Is Perspective", "");
2729 RNA_def_property_flag(prop, PROP_EDITABLE);
2731 /* This isn't directly accessible from the UI, only an operator. */
2732 prop = RNA_def_property(srna, "use_clip_planes", PROP_BOOLEAN, PROP_NONE);
2733 RNA_def_property_boolean_sdna(prop, NULL, "rflag", RV3D_CLIPPING);
2734 RNA_def_property_ui_text(prop, "Use Clip Planes", "");
2736 prop = RNA_def_property(srna, "clip_planes", PROP_FLOAT, PROP_NONE);
2737 RNA_def_property_float_sdna(prop, NULL, "clip");
2738 RNA_def_property_multi_array(prop, 2, (int[]){6, 4});
2739 RNA_def_property_ui_text(prop, "Clip Planes", "");
2741 prop = RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
2743 RNA_def_property_float_sdna(prop, NULL, "ofs"); /* cant use because its negated */
2745 RNA_def_property_array(prop, 3);
2746 RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get",
2747 "rna_RegionView3D_view_location_set", NULL);
2749 RNA_def_property_ui_text(prop, "View Location", "View pivot location");
2750 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
2751 RNA_def_property_update(prop, NC_WINDOW, NULL);
2753 prop = RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); /* cant use because its inverted */
2755 RNA_def_property_float_sdna(prop, NULL, "viewquat");
2757 RNA_def_property_array(prop, 4);
2758 RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_rotation_get",
2759 "rna_RegionView3D_view_rotation_set", NULL);
2761 RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
2762 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2764 /* not sure we need rna access to these but adding anyway */
2765 prop = RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
2766 RNA_def_property_float_sdna(prop, NULL, "dist");
2767 RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
2768 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2770 prop = RNA_def_property(srna, "view_camera_zoom", PROP_FLOAT, PROP_UNSIGNED);
2771 RNA_def_property_float_sdna(prop, NULL, "camzoom");
2772 RNA_def_property_ui_text(prop, "Camera Zoom", "Zoom factor in camera view");
2773 RNA_def_property_range(prop, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
2774 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2776 prop = RNA_def_property(srna, "view_camera_offset", PROP_FLOAT, PROP_NONE);
2777 RNA_def_property_float_sdna(prop, NULL, "camdx");
2778 RNA_def_property_array(prop, 2);
2779 RNA_def_property_ui_text(prop, "Camera Offset", "View shift in camera view");
2780 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2782 RNA_api_region_view3d(srna);
2785 static void rna_def_space_buttons(BlenderRNA *brna)
2790 static const EnumPropertyItem align_items[] = {
2791 {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
2792 {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
2793 {0, NULL, 0, NULL, NULL}
2796 srna = RNA_def_struct(brna, "SpaceProperties", "Space");
2797 RNA_def_struct_sdna(srna, "SpaceButs");
2798 RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
2800 prop = RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
2801 RNA_def_property_enum_sdna(prop, NULL, "mainb");
2802 RNA_def_property_enum_items(prop, buttons_context_items);
2803 RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_context_set", "rna_SpaceProperties_context_itemf");
2804 RNA_def_property_ui_text(prop, "Context", "Type of active data to display and edit");
2805 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
2807 prop = RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
2808 RNA_def_property_enum_sdna(prop, NULL, "align");
2809 RNA_def_property_enum_items(prop, align_items);
2810 RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_align_set", NULL);
2811 RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels");
2812 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
2814 prop = RNA_def_property(srna, "collection_context", PROP_ENUM, PROP_NONE);
2815 RNA_def_property_enum_items(prop, buttons_collection_context_items);
2816 RNA_def_property_ui_text(prop, "Collection Context", "Which collection we want to show");
2817 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
2820 prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
2821 RNA_def_property_pointer_sdna(prop, NULL, "pinid");
2822 RNA_def_property_struct_type(prop, "ID");
2823 /* note: custom set function is ONLY to avoid rna setting a user for this. */
2824 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set",
2825 "rna_SpaceProperties_pin_id_typef", NULL);
2826 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
2827 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
2829 prop = RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
2830 RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
2831 RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
2834 static void rna_def_space_image(BlenderRNA *brna)
2836 static const EnumPropertyItem image_space_mode_items[] = {
2837 {SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image and UV edit in mesh editmode"},
2838 {SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode"},
2839 {SI_MODE_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask editing"},
2840 {0, NULL, 0, NULL, NULL}
2846 srna = RNA_def_struct(brna, "SpaceImageEditor", "Space");
2847 RNA_def_struct_sdna(srna, "SpaceImage");
2848 RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data");
2851 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
2852 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL);
2853 RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
2854 RNA_def_property_flag(prop, PROP_EDITABLE);
2855 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_SpaceImageEditor_image_update"); /* is handled in image editor too */
2857 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
2858 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2859 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
2860 RNA_def_property_ui_text(prop, "Image User",
2861 "Parameters defining which layer, pass and frame of the image is displayed");
2862 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2864 prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
2865 RNA_def_property_pointer_sdna(prop, NULL, "scopes");
2866 RNA_def_property_struct_type(prop, "Scopes");
2867 RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize image statistics");
2868 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2869 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_scopes_update");
2871 prop = RNA_def_property(srna, "use_image_pin", PROP_BOOLEAN, PROP_NONE);
2872 RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
2873 RNA_def_property_ui_text(prop, "Image Pin", "Display current image regardless of object selection");
2874 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
2875 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2877 prop = RNA_def_property(srna, "sample_histogram", PROP_POINTER, PROP_NONE);
2878 RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist");
2879 RNA_def_property_struct_type(prop, "Histogram");
2880 RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line");
2882 prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
2883 RNA_def_property_array(prop, 2);
2884 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2885 RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL);
2886 RNA_def_property_ui_text(prop, "Zoom", "Zoom factor");
2889 prop = RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);
2890 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
2891 RNA_def_property_ui_text(prop, "Draw Repeated", "Draw the image repeated outside of the main view");
2892 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2894 prop = RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE);
2895 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SHOW_GPENCIL);
2896 RNA_def_property_ui_text(prop, "Show Grease Pencil",
2897 "Show grease pencil for this view");
2898 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2900 prop = RNA_def_property(srna, "draw_channels", PROP_ENUM, PROP_NONE);
2901 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
2902 RNA_def_property_enum_items(prop, draw_channels_items);
2903 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_draw_channels_itemf");
2904 RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
2905 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2907 prop = RNA_def_property(srna, "show_stereo_3d", PROP_BOOLEAN, PROP_NONE);
2908 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_stereo_get", "rna_SpaceImageEditor_show_stereo_set");
2909 RNA_def_property_ui_text(prop, "Show Stereo", "Display the image in Stereo 3D");
2910 RNA_def_property_ui_icon(prop, ICON_CAMERA_STEREO, 0);
2911 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_show_stereo_update");
2914 prop = RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE);
2915 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2916 RNA_def_property_struct_type(prop, "SpaceUVEditor");
2917 RNA_def_property_pointer_funcs(prop, "rna_SpaceImageEditor_uvedit_get", NULL, NULL, NULL);
2918 RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings");
2921 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2922 RNA_def_property_enum_sdna(prop, NULL, "mode");
2923 RNA_def_property_enum_items(prop, image_space_mode_items);
2924 RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
2925 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
2928 prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
2929 RNA_def_property_array(prop, 2);
2930 RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
2931 "rna_SpaceImageEditor_cursor_location_set", NULL);
2932 RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
2933 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2935 prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
2936 RNA_def_property_enum_sdna(prop, NULL, "around");
2937 RNA_def_property_enum_items(prop, pivot_items_full);
2938 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_pivot_itemf");
2939 RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
2940 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2943 prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
2944 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
2945 RNA_def_property_struct_type(prop, "GreasePencil");
2946 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
2947 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
2948 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2951 prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
2952 RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
2953 RNA_def_property_ui_text(prop, "Update Automatically",
2954 "Update other affected window spaces automatically to reflect changes "
2955 "during interactive operations such as transform");
2958 prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
2959 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_render_get", NULL);
2960 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2961 RNA_def_property_ui_text(prop, "Show Render", "Show render related properties");
2963 prop = RNA_def_property(srna, "show_paint", PROP_BOOLEAN, PROP_NONE);
2964 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_paint_get", NULL);
2965 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2966 RNA_def_property_ui_text(prop, "Show Paint", "Show paint related properties");
2968 prop = RNA_def_property(srna, "show_uvedit", PROP_BOOLEAN, PROP_NONE);
2969 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_uvedit_get", NULL);
2970 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2971 RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
2973 prop = RNA_def_property(srna, "show_maskedit", PROP_BOOLEAN, PROP_NONE);
2974 RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_maskedit_get", NULL);
2975 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2976 RNA_def_property_ui_text(prop, "Show Mask Editor", "Show Mask editing related properties");
2978 rna_def_space_image_uv(brna);
2981 rna_def_space_mask_info(srna, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mask_set");
2984 static void rna_def_space_sequencer(BlenderRNA *brna)
2989 static const EnumPropertyItem view_type_items[] = {
2990 {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
2991 {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
2992 {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer/Preview", ""},
2993 {0, NULL, 0, NULL, NULL}
2996 static const EnumPropertyItem display_mode_items[] = {
2997 {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
2998 {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
2999 {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
3000 {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", ICON_SEQ_HISTOGRAM, "Histogram", ""},
3001 {0, NULL, 0, NULL, NULL}
3004 static const EnumPropertyItem proxy_render_size_items[] = {
3005 {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
3006 {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
3007 {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
3008 {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
3009 {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
3010 {SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
3011 {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
3012 {0, NULL, 0, NULL, NULL}
3015 static const EnumPropertyItem overlay_type_items[] = {
3016 {SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
3017 {SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
3018 {SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
3019 {0, NULL, 0, NULL, NULL}
3022 static const EnumPropertyItem preview_channels_items[] = {
3023 {SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
3024 "Draw image with RGB colors and alpha transparency"},
3025 {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
3026 {0, NULL, 0, NULL, NULL}
3029 static const EnumPropertyItem waveform_type_draw_items[] = {
3030 {SEQ_NO_WAVEFORMS, "NO_WAVEFORMS", 0, "Waveforms Off",
3031 "No waveforms drawn for any sound strips"},
3032 {SEQ_ALL_WAVEFORMS, "ALL_WAVEFORMS", 0, "Waveforms On",
3033 "Waveforms drawn for all sound strips"},
3034 {0, "DEFAULT_WAVEFORMS", 0, "Use Strip Option",
3035 "Waveforms drawn according to strip setting"},
3036 {0, NULL, 0, NULL, NULL}
3039 srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
3040 RNA_def_struct_sdna(srna, "SpaceSeq");
3041 RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
3043 /* view type, fairly important */
3044 prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
3045 RNA_def_property_enum_sdna(prop, NULL, "view");
3046 RNA_def_property_enum_items(prop, view_type_items);
3047 RNA_def_property_ui_text(prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)");
3048 RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update");
3050 /* display type, fairly important */
3051 prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
3052 RNA_def_property_enum_sdna(prop, NULL, "mainb");
3053 RNA_def_property_enum_items(prop, display_mode_items);
3054 RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output");
3055 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3058 prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
3059 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
3060 RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
3061 "Show frame number beside the current frame indicator line");
3062 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3064 prop = RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
3065 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
3066 RNA_def_property_ui_text(prop, "Draw Frames", "Draw frames rather than seconds");
3067 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3069 prop = RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
3070 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS);
3071 RNA_def_property_ui_text(prop, "Sync Markers", "Transform markers as well as strips");
3072 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3074 prop = RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE);
3075 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPARATED);
3076 RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview");
3077 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3079 prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
3080 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_MARGINS);
3081 RNA_def_property_ui_text(prop, "Safe Areas", "Show TV title safe and action safe areas in preview");
3082 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3084 prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
3085 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_CENTER);
3086 RNA_def_property_ui_text(prop, "Center-Cut Safe Areas", "Show safe areas to fit content in a different aspect ratio");
3087 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3089 prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
3090 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_METADATA);
3091 RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of first visible strip");
3092 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3094 prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
3095 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
3096 RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
3097 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3099 prop = RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE);
3100 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GPENCIL);
3101 RNA_def_property_ui_text(prop, "Show Grease Pencil",
3102 "Show grease pencil for this view");
3103 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3105 prop = RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
3106 RNA_def_property_int_sdna(prop, NULL, "chanshown");
3107 RNA_def_property_ui_text(prop, "Display Channel",
3108 "The channel number shown in the image preview. 0 is the result of all strips combined");
3109 RNA_def_property_range(prop, -5, MAXSEQ);
3110 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3112 prop = RNA_def_property(srna, "preview_channels", PROP_ENUM, PROP_NONE);
3113 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
3114 RNA_def_property_enum_items(prop, preview_channels_items);
3115 RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the preview to draw");
3116 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3118 prop = RNA_def_property(srna, "waveform_draw_type", PROP_ENUM, PROP_NONE);
3119 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
3120 RNA_def_property_enum_items(prop, waveform_type_draw_items);
3121 RNA_def_property_ui_text(prop, "Waveform Drawing", "How Waveforms are drawn");
3122 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3124 prop = RNA_def_property(srna, "draw_overexposed", PROP_INT, PROP_NONE);
3125 RNA_def_property_int_sdna(prop, NULL, "zebra");
3126 RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes");
3127 RNA_def_property_range(prop, 0, 110);
3128 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3130 prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
3131 RNA_def_property_enum_sdna(prop, NULL, "render_size");
3132 RNA_def_property_enum_items(prop, proxy_render_size_items);
3133 RNA_def_property_ui_text(prop, "Proxy render size",
3134 "Draw preview using full resolution or different proxy resolutions");
3135 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3138 prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
3139 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
3140 RNA_def_property_struct_type(prop, "GreasePencil");
3141 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
3142 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
3143 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3145 prop = RNA_def_property(srna, "overlay_type", PROP_ENUM, PROP_NONE);
3146 RNA_def_property_enum_sdna(prop, NULL, "overlay_type");
3147 RNA_def_property_enum_items(prop, overlay_type_items);
3148 RNA_def_property_ui_text(prop, "Overlay Type", "Overlay draw type");
3149 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3151 prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
3152 RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_BACKDROP);
3153 RNA_def_property_ui_text(prop, "Use Backdrop", "Display result under strips");
3154 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3156 prop = RNA_def_property(srna, "show_strip_offset", PROP_BOOLEAN, PROP_NONE);
3157 RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_OFFSET_EXT);
3158 RNA_def_property_ui_text(prop, "Show Offsets", "Display strip in/out offsets");
3159 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
3162 static void rna_def_space_text(BlenderRNA *brna)
3167 srna = RNA_def_struct(brna, "SpaceTextEditor", "Space");
3168 RNA_def_struct_sdna(srna, "SpaceText");
3169 RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data");
3172 prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
3173 RNA_def_property_flag(prop, PROP_EDITABLE);
3174 RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space");
3175 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL, NULL);
3176 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3179 prop = RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
3180 RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
3181 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
3182 RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space");
3183 RNA_def_property_ui_icon(prop, ICON_WORDWRAP_OFF, 1);
3184 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3186 prop = RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
3187 RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
3188 RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text");
3189 RNA_def_property_ui_icon(prop, ICON_LINENUMBERS_OFF, 1);
3190 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3192 prop = RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
3193 RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
3194 RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
3195 RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 1);
3196 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3198 prop = RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
3199 RNA_def_property_boolean_sdna(prop, NULL, "line_hlight", 0);
3200 RNA_def_property_ui_text(prop, "Highlight Line", "Highlight the current line");
3201 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3203 prop = RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
3204 RNA_def_property_int_sdna(prop, NULL, "tabnumber");
3205 RNA_def_property_range(prop, 2, 8);
3206 RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with");
3207 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, "rna_SpaceTextEditor_updateEdited");
3209 prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE);
3210 RNA_def_property_int_sdna(prop, NULL, "lheight");
3211 RNA_def_property_range(prop, 8, 32);
3212 RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
3213 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3215 prop = RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE);
3216 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_SHOW_MARGIN);
3217 RNA_def_property_ui_text(prop, "Show Margin", "Show right margin");
3218 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3220 prop = RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE);
3221 RNA_def_property_int_sdna(prop, NULL, "margin_column");
3222 RNA_def_property_range(prop, 0, 1024);
3223 RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at");
3224 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3226 prop = RNA_def_property(srna, "top", PROP_INT, PROP_NONE);
3227 RNA_def_property_int_sdna(prop, NULL, "top");
3228 RNA_def_property_range(prop, 0, INT_MAX);
3229 RNA_def_property_ui_text(prop, "Top Line", "Top line visible");
3230 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3232 prop = RNA_def_property(srna, "visible_lines", PROP_INT, PROP_NONE);
3233 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3234 RNA_def_property_int_sdna(prop, NULL, "viewlines");
3235 RNA_def_property_ui_text(prop, "Visible Lines", "Amount of lines that can be visible in current editor");
3237 /* functionality options */
3238 prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
3239 RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1);
3240 RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
3241 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3243 prop = RNA_def_property(srna, "use_live_edit", PROP_BOOLEAN, PROP_NONE);
3244 RNA_def_property_boolean_sdna(prop, NULL, "live_edit", 1);
3245 RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
3246 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
3249 prop = RNA_def_property(srna, "use_find_all", PROP_BOOLEAN, PROP_NONE);
3250 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIN