/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Contributor(s): Blender Foundation (2008) * * ***** END GPL LICENSE BLOCK ***** */ /** \file blender/makesrna/intern/rna_space.c * \ingroup RNA */ #include #include #include "MEM_guardedalloc.h" #include "BLF_translation.h" #include "BKE_key.h" #include "BKE_movieclip.h" #include "BKE_node.h" #include "BKE_screen.h" #include "DNA_action_types.h" #include "DNA_key_types.h" #include "DNA_material_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_space_types.h" #include "DNA_sequence_types.h" #include "DNA_mask_types.h" #include "DNA_view3d_types.h" #include "RNA_access.h" #include "RNA_define.h" #include "rna_internal.h" #include "WM_api.h" #include "WM_types.h" #include "RE_engine.h" #include "RE_pipeline.h" #include "ED_fileselect.h" #include "RNA_enum_types.h" EnumPropertyItem space_type_items[] = { /* empty must be here for python, is skipped for UI */ {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""}, {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", "3D viewport"}, {0, "", ICON_NONE, NULL, NULL}, {SPACE_TIME, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls"}, {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", "Edit drivers and keyframe interpolation"}, {SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", "Adjust timing of keyframes"}, {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "NLA Editor", "Combine and layer Actions"}, {0, "", ICON_NONE, NULL, NULL}, {SPACE_IMAGE, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", "View and edit images and UV Maps"}, {SPACE_SEQ, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", "Video editing tools"}, {SPACE_CLIP, "CLIP_EDITOR", ICON_CLIP, "Movie Clip Editor", "Motion tracking tools"}, {SPACE_TEXT, "TEXT_EDITOR", ICON_TEXT, "Text Editor", "Edit scripts and in-file documentation"}, {SPACE_NODE, "NODE_EDITOR", ICON_NODETREE, "Node Editor", "Editor for node-based shading and compositing tools"}, {SPACE_LOGIC, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", "Game logic editing"}, {0, "", ICON_NONE, NULL, NULL}, {SPACE_BUTS, "PROPERTIES", ICON_BUTS, "Properties", "Edit properties of active object and related datablocks"}, {SPACE_OUTLINER, "OUTLINER", ICON_OOPS, "Outliner", "Overview of scene graph and all available datablocks"}, {SPACE_USERPREF, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", "Edit persistent configuration settings"}, {SPACE_INFO, "INFO", ICON_INFO, "Info", "Main menu bar and list of error messages (drag down to expand and display)"}, {0, "", ICON_NONE, NULL, NULL}, {SPACE_FILE, "FILE_BROWSER", ICON_FILESEL, "File Browser", "Browse for files and assets"}, {0, "", ICON_NONE, NULL, NULL}, {SPACE_CONSOLE, "CONSOLE", ICON_CONSOLE, "Python Console", "Interactive programmatic console for advanced editing and script development"}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem pivot_items_full[] = { {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", "Pivot around each object's own origin"}, {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", "Pivot around the median point of selected objects"}, {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem draw_channels_items[] = { {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer", "Draw Z-buffer associated with image (mapped from camera clip start to end)"}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem transform_orientation_items[] = { {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", "Align the transformation axes to average normal of selected elements " "(bone Y axis for pose mode)"}, {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"}, {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"}, // {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, {0, NULL, 0, NULL, NULL} }; #ifndef RNA_RUNTIME static EnumPropertyItem autosnap_items[] = { {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""}, /* {-1, "", 0, "", ""}, */ {SACTSNAP_STEP, "STEP", 0, "Frame Step", "Snap to 1.0 frame intervals"}, {SACTSNAP_TSTEP, "TIME_STEP", 0, "Second Step", "Snap to 1.0 second intervals"}, /* {-1, "", 0, "", ""}, */ {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames (nla-action time)"}, {SACTSNAP_SECOND, "SECOND", 0, "Nearest Second", "Snap to actual seconds (nla-action time)"}, /* {-1, "", 0, "", ""}, */ {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"}, {0, NULL, 0, NULL, NULL} }; #endif EnumPropertyItem viewport_shade_items[] = { {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"}, {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"}, {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"}, {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Texture", "Display the object solid, with a texture"}, {OB_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Display objects solid, with GLSL material"}, {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"}, {0, NULL, 0, NULL, NULL} }; EnumPropertyItem clip_editor_mode_items[] = { {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"}, {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"}, {0, NULL, 0, NULL, NULL} }; /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */ static EnumPropertyItem buttons_context_items[] = { {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"}, {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"}, {BCONTEXT_RENDER_LAYER, "RENDER_LAYER", ICON_RENDERLAYERS, "Render Layers", "Render layers"}, {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"}, {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"}, {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object constraints"}, {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifiers", "Object modifiers"}, {BCONTEXT_DATA, "DATA", ICON_NONE, "Data", "Object data"}, {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"}, {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT_BONE, "Bone Constraints", "Bone constraints"}, {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"}, {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"}, {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, {0, NULL, 0, NULL, NULL} }; /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */ static EnumPropertyItem buttons_texture_context_items[] = { {SB_TEXC_MATERIAL, "MATERIAL", ICON_MATERIAL, "", "Show material textures"}, {SB_TEXC_WORLD, "WORLD", ICON_WORLD, "", "Show world textures"}, {SB_TEXC_LAMP, "LAMP", ICON_LAMP, "", "Show lamp textures"}, {SB_TEXC_PARTICLES, "PARTICLES", ICON_PARTICLES, "", "Show particles textures"}, {SB_TEXC_LINESTYLE, "LINESTYLE", ICON_LINE_DATA, "", "Show linestyle textures"}, {SB_TEXC_OTHER, "OTHER", ICON_TEXTURE, "", "Show other data textures"}, {0, NULL, 0, NULL, NULL} }; #ifdef RNA_RUNTIME #include "DNA_anim_types.h" #include "DNA_mask_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_userdef_types.h" #include "BLI_math.h" #include "BKE_animsys.h" #include "BKE_brush.h" #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_paint.h" #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_icons.h" #include "ED_buttons.h" #include "ED_fileselect.h" #include "ED_image.h" #include "ED_node.h" #include "ED_screen.h" #include "ED_view3d.h" #include "ED_sequencer.h" #include "ED_clip.h" #include "GPU_material.h" #include "IMB_imbuf_types.h" #include "UI_interface.h" #include "UI_view2d.h" static StructRNA *rna_Space_refine(struct PointerRNA *ptr) { SpaceLink *space = (SpaceLink *)ptr->data; switch (space->spacetype) { case SPACE_VIEW3D: return &RNA_SpaceView3D; case SPACE_IPO: return &RNA_SpaceGraphEditor; case SPACE_OUTLINER: return &RNA_SpaceOutliner; case SPACE_BUTS: return &RNA_SpaceProperties; case SPACE_FILE: return &RNA_SpaceFileBrowser; case SPACE_IMAGE: return &RNA_SpaceImageEditor; case SPACE_INFO: return &RNA_SpaceInfo; case SPACE_SEQ: return &RNA_SpaceSequenceEditor; case SPACE_TEXT: return &RNA_SpaceTextEditor; case SPACE_ACTION: return &RNA_SpaceDopeSheetEditor; case SPACE_NLA: return &RNA_SpaceNLA; case SPACE_TIME: return &RNA_SpaceTimeline; case SPACE_NODE: return &RNA_SpaceNodeEditor; case SPACE_LOGIC: return &RNA_SpaceLogicEditor; case SPACE_CONSOLE: return &RNA_SpaceConsole; case SPACE_USERPREF: return &RNA_SpaceUserPreferences; case SPACE_CLIP: return &RNA_SpaceClipEditor; default: return &RNA_Space; } } static ScrArea *rna_area_from_space(PointerRNA *ptr) { bScreen *sc = (bScreen *)ptr->id.data; SpaceLink *link = (SpaceLink *)ptr->data; return BKE_screen_find_area_from_space(sc, link); } static void area_region_from_regiondata(bScreen *sc, void *regiondata, ScrArea **r_sa, ARegion **r_ar) { ScrArea *sa; ARegion *ar; *r_sa = NULL; *r_ar = NULL; for (sa = sc->areabase.first; sa; sa = sa->next) { for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar->regiondata == regiondata) { *r_sa = sa; *r_ar = ar; return; } } } } static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **r_sa, ARegion **r_ar) { bScreen *sc = (bScreen *)ptr->id.data; void *regiondata = ptr->data; area_region_from_regiondata(sc, regiondata, r_sa, r_ar); } static int rna_Space_view2d_sync_get(PointerRNA *ptr) { ScrArea *sa; ARegion *ar; sa = rna_area_from_space(ptr); /* can be NULL */ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar) { View2D *v2d = &ar->v2d; return (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME) != 0; } return false; } static void rna_Space_view2d_sync_set(PointerRNA *ptr, int value) { ScrArea *sa; ARegion *ar; sa = rna_area_from_space(ptr); /* can be NULL */ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar) { View2D *v2d = &ar->v2d; if (value) { v2d->flag |= V2D_VIEWSYNC_SCREEN_TIME; } else { v2d->flag &= ~V2D_VIEWSYNC_SCREEN_TIME; } } } static void rna_Space_view2d_sync_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ScrArea *sa; ARegion *ar; sa = rna_area_from_space(ptr); /* can be NULL */ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar) { bScreen *sc = (bScreen *)ptr->id.data; View2D *v2d = &ar->v2d; UI_view2d_sync(sc, sa, v2d, V2D_LOCK_SET); } } static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr) { Scene *scene = ((bScreen *)ptr->id.data)->scene; View3D *v3d = (View3D *)ptr->data; if (v3d->twmode < V3D_MANIP_CUSTOM) return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, NULL); else return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM)); } EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { Scene *scene = NULL; ListBase *transform_spaces; TransformOrientation *ts = NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem *item = NULL; int i = V3D_MANIP_CUSTOM, totitem = 0; RNA_enum_items_add(&item, &totitem, transform_orientation_items); if (ptr->type == &RNA_SpaceView3D) scene = ((bScreen *)ptr->id.data)->scene; else scene = CTX_data_scene(C); /* can't use scene from ptr->id.data because that enum is also used by operators */ if (scene) { transform_spaces = &scene->transform_spaces; ts = transform_spaces->first; } if (ts) { RNA_enum_item_add_separator(&item, &totitem); for (; ts; ts = ts->next) { tmp.identifier = ts->name; tmp.name = ts->name; tmp.value = i++; RNA_enum_item_add(&item, &totitem, &tmp); } } RNA_enum_item_end(&item, &totitem); *r_free = true; return item; } /* Space 3D View */ static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int value) { View3D *v3d = (View3D *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; v3d->scenelock = value; if (value) { int bit; v3d->lay = sc->scene->lay; /* seek for layact */ bit = 0; while (bit < 32) { if (v3d->lay & (1 << bit)) { v3d->layact = 1 << bit; break; } bit++; } v3d->camera = sc->scene->camera; } } static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values) { View3D *v3d = (View3D *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; Scene *scene = (Scene *)sc->scene; const float *loc = ED_view3d_cursor3d_get(scene, v3d); copy_v3_v3(values, loc); } static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values) { View3D *v3d = (View3D *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; Scene *scene = (Scene *)sc->scene; float *cursor = ED_view3d_cursor3d_get(scene, v3d); copy_v3_v3(cursor, values); } static float rna_View3D_GridScaleUnit_get(PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; Scene *scene = (Scene *)sc->scene; return ED_view3d_grid_scale(scene, v3d, NULL); } static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values) { View3D *v3d = (View3D *)(ptr->data); v3d->lay = ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact); } static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { DAG_on_visible_update(bmain, false); } static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); ScrArea *sa = rna_area_from_space(ptr); ED_view3d_shade_update(bmain, scene, v3d, sa); } static void rna_SpaceView3D_matcap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); if (v3d->defmaterial) { Material *ma = v3d->defmaterial; if (ma->preview) BKE_previewimg_free(&ma->preview); if (ma->gpumaterial.first) GPU_material_free(&ma->gpumaterial); WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma); } } static void rna_SpaceView3D_matcap_enable(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); if (v3d->matcap_icon == 0) v3d->matcap_icon = ICON_MATCAP_01; } static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { if (U.uiflag & USER_LOCKAROUND) { View3D *v3d_act = (View3D *)(ptr->data); /* TODO, space looper */ bScreen *screen; for (screen = bmain->screen.first; screen; screen = screen->id.next) { ScrArea *sa; for (sa = screen->areabase.first; sa; sa = sa->next) { SpaceLink *sl; for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; if (v3d != v3d_act) { v3d->around = v3d_act->around; v3d->flag = (v3d->flag & ~V3D_ALIGN) | (v3d_act->flag & V3D_ALIGN); ED_area_tag_redraw_regiontype(sa, RGN_TYPE_HEADER); } } } } } } } static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); ScrArea *sa = rna_area_from_space(ptr); void *regiondata = NULL; if (sa) { ListBase *regionbase = (sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase; ARegion *ar = regionbase->last; /* always last in list, weak .. */ regiondata = ar->regiondata; } return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata); } static void rna_SpaceView3D_region_quadviews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); ScrArea *sa = rna_area_from_space(ptr); int i = 3; ARegion *ar = ((sa && sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase)->last; ListBase lb = {NULL, NULL}; if (ar && ar->alignment == RGN_ALIGN_QSPLIT) { while (i-- && ar) { ar = ar->prev; } if (i < 0) { lb.first = ar; } } rna_iterator_listbase_begin(iter, &lb, NULL); } static PointerRNA rna_SpaceView3D_region_quadviews_get(CollectionPropertyIterator *iter) { void *regiondata = ((ARegion *)rna_iterator_listbase_get(iter))->regiondata; return rna_pointer_inherit_refine(&iter->parent, &RNA_RegionView3D, regiondata); } static void rna_RegionView3D_quadview_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr) { ScrArea *sa; ARegion *ar; rna_area_region_from_regiondata(ptr, &sa, &ar); if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) ED_view3d_quadview_update(sa, ar, false); } /* same as above but call clip==true */ static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr) { ScrArea *sa; ARegion *ar; rna_area_region_from_regiondata(ptr, &sa, &ar); if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) ED_view3d_quadview_update(sa, ar, true); } static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values) { RegionView3D *rv3d = (RegionView3D *)(ptr->data); negate_v3_v3(values, rv3d->ofs); } static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values) { RegionView3D *rv3d = (RegionView3D *)(ptr->data); negate_v3_v3(rv3d->ofs, values); } static void rna_RegionView3D_view_rotation_get(PointerRNA *ptr, float *values) { RegionView3D *rv3d = (RegionView3D *)(ptr->data); invert_qt_qt(values, rv3d->viewquat); } static void rna_RegionView3D_view_rotation_set(PointerRNA *ptr, const float *values) { RegionView3D *rv3d = (RegionView3D *)(ptr->data); invert_qt_qt(rv3d->viewquat, values); } static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values) { RegionView3D *rv3d = (RegionView3D *)(ptr->data); float mat[4][4]; invert_m4_m4(mat, (float (*)[4])values); ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist); } static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr) { Scene *scene = ((bScreen *)ptr->id.data)->scene; RenderEngineType *type = RE_engines_find(scene->r.engine); View3D *v3d = (View3D *)ptr->data; int drawtype = v3d->drawtype; if (drawtype == OB_RENDER && !(type && type->view_draw)) return OB_SOLID; return drawtype; } static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { Scene *scene = ((bScreen *)ptr->id.data)->scene; RenderEngineType *type = RE_engines_find(scene->r.engine); EnumPropertyItem *item = NULL; int totitem = 0; RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_BOUNDBOX); RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_WIRE); RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_SOLID); RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_TEXTURE); RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_MATERIAL); if (type && type->view_draw) RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_RENDER); RNA_enum_item_end(&item, &totitem); *r_free = true; return item; } /* Space Image Editor */ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data); } static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { ED_space_image_paint_update(bmain->wm.first, scene->toolsettings); } static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)(ptr->data); return ED_space_image_show_render(sima); } static int rna_SpaceImageEditor_show_paint_get(PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)(ptr->data); return ED_space_image_show_paint(sima); } static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; return ED_space_image_show_uvedit(sima, sc->scene->obedit); } static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; return ED_space_image_check_show_maskedit(sc->scene, sima); } static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value) { SpaceImage *sima = (SpaceImage *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; ED_space_image_set(sima, sc->scene, sc->scene->obedit, (Image *)value.data); } static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value) { SpaceImage *sima = (SpaceImage *)(ptr->data); ED_space_image_set_mask(NULL, sima, (Mask *)value.data); } static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { SpaceImage *sima = (SpaceImage *)ptr->data; EnumPropertyItem *item = NULL; ImBuf *ibuf; void *lock; int zbuf, alpha, totitem = 0; ibuf = ED_space_image_acquire_buffer(sima, &lock); alpha = ibuf && (ibuf->channels == 4); zbuf = ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1)); ED_space_image_release_buffer(sima, ibuf, lock); if (alpha && zbuf) return draw_channels_items; if (alpha) { RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_USE_ALPHA); RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0); RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ALPHA); } else if (zbuf) { RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0); RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF); } else { RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0); } RNA_enum_item_end(&item, &totitem); *r_free = true; return item; } static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values) { SpaceImage *sima = (SpaceImage *)ptr->data; ScrArea *sa; ARegion *ar; values[0] = values[1] = 1; /* find aregion */ sa = rna_area_from_space(ptr); /* can be NULL */ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (ar) { ED_space_image_get_zoom(sima, ar, &values[0], &values[1]); } } static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values) { SpaceImage *sima = (SpaceImage *)ptr->data; if (sima->flag & SI_COORDFLOATS) { copy_v2_v2(values, sima->cursor); } else { int w, h; ED_space_image_get_size(sima, &w, &h); values[0] = sima->cursor[0] * w; values[1] = sima->cursor[1] * h; } } static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const float *values) { SpaceImage *sima = (SpaceImage *)ptr->data; if (sima->flag & SI_COORDFLOATS) { copy_v2_v2(sima->cursor, values); } else { int w, h; ED_space_image_get_size(sima, &w, &h); sima->cursor[0] = values[0] / w; sima->cursor[1] = values[1] / h; } } static void rna_SpaceImageEditor_scopes_update(struct bContext *C, struct PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)ptr->data; ImBuf *ibuf; void *lock; ibuf = ED_space_image_acquire_buffer(sima, &lock); if (ibuf) { ED_space_image_scopes_update(C, sima, ibuf, true); WM_main_add_notifier(NC_IMAGE, sima->image); } ED_space_image_release_buffer(sima, ibuf, lock); } static EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { static EnumPropertyItem pivot_items[] = { {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""}, {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""}, {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""}, {0, NULL, 0, NULL, NULL} }; SpaceImage *sima = (SpaceImage *)ptr->data; if (sima->mode == SI_MODE_PAINT) return pivot_items_full; else return pivot_items; } /* Space Text Editor */ static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value) { SpaceText *st = (SpaceText *)(ptr->data); st->wordwrap = value; st->left = 0; } static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value) { SpaceText *st = (SpaceText *)(ptr->data); st->text = value.data; WM_main_add_notifier(NC_TEXT | NA_SELECTED, st->text); } static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { SpaceText *st = (SpaceText *)ptr->data; if (st->text) WM_main_add_notifier(NC_TEXT | NA_EDITED, st->text); } /* Space Properties */ /* note: this function exists only to avoid id refcounting */ static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); sbuts->pinid = value.data; } static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); if (sbuts->pinid) return ID_code_to_RNA_type(GS(sbuts->pinid->name)); return &RNA_ID; } static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); ID *id = sbuts->pinid; if (id == NULL) { sbuts->flag &= ~SB_PIN_CONTEXT; return; } switch (GS(id->name)) { case ID_MA: WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL); break; case ID_TE: WM_main_add_notifier(NC_TEXTURE, NULL); break; case ID_WO: WM_main_add_notifier(NC_WORLD, NULL); break; case ID_LA: WM_main_add_notifier(NC_LAMP, NULL); break; } } static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); sbuts->mainb = value; sbuts->mainbuser = value; } static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); EnumPropertyItem *item = NULL; int totitem = 0; if (sbuts->pathflag & (1 << BCONTEXT_RENDER)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER); } if (sbuts->pathflag & (1 << BCONTEXT_RENDER_LAYER)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER_LAYER); } if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE); } if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD); } if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT); } if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_CONSTRAINT); } if (sbuts->pathflag & (1 << BCONTEXT_MODIFIER)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MODIFIER); } if (sbuts->pathflag & (1 << BCONTEXT_DATA)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_DATA); (item + totitem - 1)->icon = sbuts->dataicon; } if (sbuts->pathflag & (1 << BCONTEXT_BONE)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE); } if (sbuts->pathflag & (1 << BCONTEXT_BONE_CONSTRAINT)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE_CONSTRAINT); } if (sbuts->pathflag & (1 << BCONTEXT_MATERIAL)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MATERIAL); } if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE); } if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE); } if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS); } RNA_enum_item_end(&item, &totitem); *r_free = true; return item; } static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); sbuts->align = value; sbuts->re_align = 1; } static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; int totitem = 0; if (ED_texture_context_check_world(C)) { RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_WORLD); } if (ED_texture_context_check_lamp(C)) { RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_LAMP); } else if (ED_texture_context_check_material(C)) { RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_MATERIAL); } if (ED_texture_context_check_particles(C)) { RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_PARTICLES); } if (ED_texture_context_check_linestyle(C)) { RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_LINESTYLE); } if (ED_texture_context_check_others(C)) { RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_OTHER); } RNA_enum_item_end(&item, &totitem); *r_free = true; return item; } static void rna_SpaceProperties_texture_context_set(PointerRNA *ptr, int value) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); /* User action, no need to keep "better" value in prev here! */ sbuts->texture_context = sbuts->texture_context_prev = value; } /* Space Console */ static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value) { ConsoleLine *ci = (ConsoleLine *)ptr->data; memcpy(value, ci->line, ci->len + 1); } static int rna_ConsoleLine_body_length(PointerRNA *ptr) { ConsoleLine *ci = (ConsoleLine *)ptr->data; return ci->len; } static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value) { ConsoleLine *ci = (ConsoleLine *)ptr->data; int len = strlen(value); if ((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */ MEM_freeN(ci->line); ci->line = MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline"); ci->len_alloc = len + 1; } memcpy(ci->line, value, len + 1); ci->len = len; if (ci->cursor > len) /* clamp the cursor */ ci->cursor = len; } static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) { ConsoleLine *ci = (ConsoleLine *)ptr->data; *min = 0; *max = ci->len; /* intentionally _not_ -1 */ } /* Space Dopesheet */ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA value) { SpaceAction *saction = (SpaceAction *)(ptr->data); bAction *act = (bAction *)value.data; if ((act == NULL) || (act->idroot == 0)) { /* just set if we're clearing the action or if the action is "amorphous" still */ saction->action = act; } else { /* action to set must strictly meet the mode criteria... */ if (saction->mode == SACTCONT_ACTION) { /* currently, this is "object-level" only, until we have some way of specifying this */ if (act->idroot == ID_OB) saction->action = act; else printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n", act->id.name + 2); } else if (saction->mode == SACTCONT_SHAPEKEY) { /* as the name says, "shapekey-level" only... */ if (act->idroot == ID_KE) saction->action = act; else printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n", act->id.name + 2); } else { printf("ACK: who's trying to set an action while not in a mode displaying a single Action only?\n"); } } } static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { SpaceAction *saction = (SpaceAction *)(ptr->data); Object *obact = (scene->basact) ? scene->basact->object : NULL; /* we must set this action to be the one used by active object (if not pinned) */ if (obact /* && saction->pin == 0*/) { AnimData *adt = NULL; if (saction->mode == SACTCONT_ACTION) { /* TODO: context selector could help decide this with more control? */ adt = BKE_id_add_animdata(&obact->id); /* this only adds if non-existent */ } else if (saction->mode == SACTCONT_SHAPEKEY) { Key *key = BKE_key_from_object(obact); if (key) adt = BKE_id_add_animdata(&key->id); /* this only adds if non-existent */ } /* set action */ if (adt) { /* fix id-count of action we're replacing */ id_us_min(&adt->action->id); /* assign new action, and adjust the usercounts accordingly */ adt->action = saction->action; id_us_plus(&adt->action->id); /* force update of animdata */ adt->recalc |= ADT_RECALC_ANIM; } /* force depsgraph flush too */ DAG_id_tag_update(&obact->id, OB_RECALC_OB | OB_RECALC_DATA); } } static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { SpaceAction *saction = (SpaceAction *)(ptr->data); Object *obact = (scene->basact) ? scene->basact->object : NULL; /* special exceptions for ShapeKey Editor mode */ if (saction->mode == SACTCONT_SHAPEKEY) { Key *key = BKE_key_from_object(obact); /* 1) update the action stored for the editor */ if (key) saction->action = (key->adt) ? key->adt->action : NULL; else saction->action = NULL; /* 2) enable 'show sliders' by default, since one of the main * points of the ShapeKey Editor is to provide a one-stop shop * for controlling the shapekeys, whose main control is the value */ saction->flag |= SACTION_SLIDERS; } /* make sure action stored is valid */ else if (saction->mode == SACTCONT_ACTION) { /* 1) update the action stored for the editor */ /* TODO: context selector could help decide this with more control? */ if (obact) saction->action = (obact->adt) ? obact->adt->action : NULL; else saction->action = NULL; } /* recalculate extents of channel list */ saction->flag |= SACTION_TEMP_NEEDCHANSYNC; } /* Space Graph Editor */ static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ScrArea *sa = rna_area_from_space(ptr); /* after changing view mode, must force recalculation of F-Curve colors * which can only be achieved using refresh as opposed to redraw */ ED_area_tag_refresh(sa); } static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr) { SpaceIpo *sipo = (SpaceIpo *)(ptr->data); return (BLI_listbase_is_empty(&sipo->ghostCurves) == false); } static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ScrArea *sa = rna_area_from_space(ptr); ED_area_tag_refresh(sa); } static float rna_BackgroundImage_opacity_get(PointerRNA *ptr) { BGpic *bgpic = (BGpic *)ptr->data; return 1.0f - bgpic->blend; } static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value) { BGpic *bgpic = (BGpic *)ptr->data; bgpic->blend = 1.0f - value; } static BGpic *rna_BackgroundImage_new(View3D *v3d) { BGpic *bgpic = ED_view3D_background_image_new(v3d); WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d); return bgpic; } static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, PointerRNA *bgpic_ptr) { BGpic *bgpic = bgpic_ptr->data; if (BLI_findindex(&v3d->bgpicbase, bgpic) == -1) { BKE_report(reports, RPT_ERROR, "Background image cannot be removed"); } ED_view3D_background_image_remove(v3d, bgpic); RNA_POINTER_INVALIDATE(bgpic_ptr); WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d); } static void rna_BackgroundImage_clear(View3D *v3d) { ED_view3D_background_image_clear(v3d); WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d); } /* Space Node Editor */ static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA value) { SpaceNode *snode = (SpaceNode *)ptr->data; ED_node_tree_start(snode, (bNodeTree *)value.data, NULL, NULL); } static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA value) { SpaceNode *snode = (SpaceNode *)ptr->data; bNodeTree *ntree = (bNodeTree *)value.data; /* node tree type must match the selected type in node editor */ return (STREQ(snode->tree_idname, ntree->idname)); } static void rna_SpaceNodeEditor_node_tree_update(const bContext *C, PointerRNA *UNUSED(ptr)) { ED_node_tree_update(C); } static int rna_SpaceNodeEditor_tree_type_get(PointerRNA *ptr) { SpaceNode *snode = (SpaceNode *)ptr->data; return rna_node_tree_idname_to_enum(snode->tree_idname); } static void rna_SpaceNodeEditor_tree_type_set(PointerRNA *ptr, int value) { SpaceNode *snode = (SpaceNode *)ptr->data; ED_node_set_tree_type(snode, rna_node_tree_type_from_enum(value)); } static int rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type) { bContext *C = (bContext *)Cv; if (type->poll) return type->poll(C, type); else return true; } static EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, r_free); } static void rna_SpaceNodeEditor_path_get(PointerRNA *ptr, char *value) { SpaceNode *snode = ptr->data; ED_node_tree_path_get(snode, value); } static int rna_SpaceNodeEditor_path_length(PointerRNA *ptr) { SpaceNode *snode = ptr->data; return ED_node_tree_path_length(snode); } static void rna_SpaceNodeEditor_path_clear(SpaceNode *snode, bContext *C) { ED_node_tree_start(snode, NULL, NULL, NULL); ED_node_tree_update(C); } static void rna_SpaceNodeEditor_path_start(SpaceNode *snode, bContext *C, PointerRNA *node_tree) { ED_node_tree_start(snode, (bNodeTree *)node_tree->data, NULL, NULL); ED_node_tree_update(C); } static void rna_SpaceNodeEditor_path_append(SpaceNode *snode, bContext *C, PointerRNA *node_tree, PointerRNA *node) { ED_node_tree_push(snode, node_tree->data, node->data); ED_node_tree_update(C); } static void rna_SpaceNodeEditor_path_pop(SpaceNode *snode, bContext *C) { ED_node_tree_pop(snode); ED_node_tree_update(C); } static void rna_SpaceNodeEditor_show_backdrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); WM_main_add_notifier(NC_SCENE | ND_NODES, NULL); } static void rna_SpaceNodeEditor_cursor_location_from_region(SpaceNode *snode, bContext *C, int x, int y) { ARegion *ar = CTX_wm_region(C); UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]); snode->cursor[0] /= UI_DPI_FAC; snode->cursor[1] /= UI_DPI_FAC; } static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value) { SpaceClip *sc = (SpaceClip *)(ptr->data); bScreen *screen = (bScreen *)ptr->id.data; ED_space_clip_set_clip(NULL, screen, sc, (MovieClip *)value.data); } static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr, PointerRNA value) { SpaceClip *sc = (SpaceClip *)(ptr->data); ED_space_clip_set_mask(NULL, sc, (Mask *)value.data); } static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { SpaceClip *sc = (SpaceClip *)(ptr->data); sc->scopes.ok = 0; } static void rna_SpaceClipEditor_lock_selection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { SpaceClip *sc = (SpaceClip *)(ptr->data); sc->xlockof = 0.f; sc->ylockof = 0.f; } static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ScrArea *sa = rna_area_from_space(ptr); ED_area_tag_refresh(sa); } /* File browser. */ static void rna_FileBrowser_FSMenuEntry_path_get(PointerRNA *ptr, char *value) { char *path = ED_fsmenu_entry_get_path(ptr->data); strcpy(value, path ? path : ""); } static int rna_FileBrowser_FSMenuEntry_path_length(PointerRNA *ptr) { char *path = ED_fsmenu_entry_get_path(ptr->data); return (int)(path ? strlen(path) : 0); } static void rna_FileBrowser_FSMenuEntry_path_set(PointerRNA *ptr, const char *value) { FSMenuEntry *fsm = ptr->data; /* Note: this will write to file immediately. * Not nice (and to be fixed ultimately), but acceptable in this case for now. */ ED_fsmenu_entry_set_path(fsm, value); } static void rna_FileBrowser_FSMenuEntry_name_get(PointerRNA *ptr, char *value) { strcpy(value, ED_fsmenu_entry_get_name(ptr->data)); } static int rna_FileBrowser_FSMenuEntry_name_length(PointerRNA *ptr) { return (int)strlen(ED_fsmenu_entry_get_name(ptr->data)); } static void rna_FileBrowser_FSMenuEntry_name_set(PointerRNA *ptr, const char *value) { FSMenuEntry *fsm = ptr->data; /* Note: this will write to file immediately. * Not nice (and to be fixed ultimately), but acceptable in this case for now. */ ED_fsmenu_entry_set_name(fsm, value); } static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr) { FSMenuEntry *fsm = ptr->data; return fsm->save; } static void rna_FileBrowser_FSMenu_next(CollectionPropertyIterator *iter) { ListBaseIterator *internal = &iter->internal.listbase; if (internal->skip) { do { internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next); iter->valid = (internal->link != NULL); } while (iter->valid && internal->skip(iter, internal->link)); } else { internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next); iter->valid = (internal->link != NULL); } } static void rna_FileBrowser_FSMenu_begin(CollectionPropertyIterator *iter, FSMenuCategory category) { ListBaseIterator *internal = &iter->internal.listbase; struct FSMenu *fsmenu = ED_fsmenu_get(); struct FSMenuEntry *fsmentry = ED_fsmenu_get_category(fsmenu, category); internal->link = (fsmentry) ? (Link *)fsmentry : NULL; internal->skip = NULL; iter->valid = (internal->link != NULL); } static PointerRNA rna_FileBrowser_FSMenu_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal = &iter->internal.listbase; PointerRNA r_ptr; RNA_pointer_create(NULL, &RNA_FileBrowserFSMenuEntry, internal->link, &r_ptr); return r_ptr; } static void rna_FileBrowser_FSMenu_end(CollectionPropertyIterator *UNUSED(iter)) { } static void rna_FileBrowser_FSMenuSystem_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr)) { rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM); } static int rna_FileBrowser_FSMenuSystem_data_length(PointerRNA *UNUSED(ptr)) { struct FSMenu *fsmenu = ED_fsmenu_get(); return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM); } static void rna_FileBrowser_FSMenuSystemBookmark_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr)) { rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM_BOOKMARKS); } static int rna_FileBrowser_FSMenuSystemBookmark_data_length(PointerRNA *UNUSED(ptr)) { struct FSMenu *fsmenu = ED_fsmenu_get(); return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS); } static void rna_FileBrowser_FSMenuBookmark_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr)) { rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_BOOKMARKS); } static int rna_FileBrowser_FSMenuBookmark_data_length(PointerRNA *UNUSED(ptr)) { struct FSMenu *fsmenu = ED_fsmenu_get(); return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS); } static void rna_FileBrowser_FSMenuRecent_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr)) { rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_RECENT); } static int rna_FileBrowser_FSMenuRecent_data_length(PointerRNA *UNUSED(ptr)) { struct FSMenu *fsmenu = ED_fsmenu_get(); return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_RECENT); } static int rna_FileBrowser_FSMenu_active_get(PointerRNA *ptr, const FSMenuCategory category) { SpaceFile *sf = ptr->data; int actnr = -1; switch (category) { case FS_CATEGORY_SYSTEM: actnr = sf->systemnr; break; case FS_CATEGORY_SYSTEM_BOOKMARKS: actnr = sf->system_bookmarknr; break; case FS_CATEGORY_BOOKMARKS: actnr = sf->bookmarknr; break; case FS_CATEGORY_RECENT: actnr = sf->recentnr; break; } return actnr; } static void rna_FileBrowser_FSMenu_active_set(PointerRNA *ptr, int value, const FSMenuCategory category) { SpaceFile *sf = ptr->data; struct FSMenu *fsmenu = ED_fsmenu_get(); FSMenuEntry *fsm = ED_fsmenu_get_entry(fsmenu, category, value); if (fsm && sf->params) { switch (category) { case FS_CATEGORY_SYSTEM: sf->systemnr = value; break; case FS_CATEGORY_SYSTEM_BOOKMARKS: sf->system_bookmarknr = value; break; case FS_CATEGORY_BOOKMARKS: sf->bookmarknr = value; break; case FS_CATEGORY_RECENT: sf->recentnr = value; break; } BLI_strncpy(sf->params->dir, fsm->path, sizeof(sf->params->dir)); } } static void rna_FileBrowser_FSMenu_active_range( PointerRNA *UNUSED(ptr), int *min, int *max, int *softmin, int *softmax, const FSMenuCategory category) { struct FSMenu *fsmenu = ED_fsmenu_get(); *min = *softmin = -1; *max = *softmax = ED_fsmenu_get_nentries(fsmenu, category) - 1; } static void rna_FileBrowser_FSMenu_active_update(struct bContext *C, PointerRNA *UNUSED(ptr)) { ED_file_change_dir(C, true); } static int rna_FileBrowser_FSMenuSystem_active_get(PointerRNA *ptr) { return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM); } static void rna_FileBrowser_FSMenuSystem_active_set(PointerRNA *ptr, int value) { rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM); } static void rna_FileBrowser_FSMenuSystem_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) { rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM); } static int rna_FileBrowser_FSMenuSystemBookmark_active_get(PointerRNA *ptr) { return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM_BOOKMARKS); } static void rna_FileBrowser_FSMenuSystemBookmark_active_set(PointerRNA *ptr, int value) { rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM_BOOKMARKS); } static void rna_FileBrowser_FSMenuSystemBookmark_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) { rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM_BOOKMARKS); } static int rna_FileBrowser_FSMenuBookmark_active_get(PointerRNA *ptr) { return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_BOOKMARKS); } static void rna_FileBrowser_FSMenuBookmark_active_set(PointerRNA *ptr, int value) { rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_BOOKMARKS); } static void rna_FileBrowser_FSMenuBookmark_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) { rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_BOOKMARKS); } static int rna_FileBrowser_FSMenuRecent_active_get(PointerRNA *ptr) { return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_RECENT); } static void rna_FileBrowser_FSMenuRecent_active_set(PointerRNA *ptr, int value) { rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_RECENT); } static void rna_FileBrowser_FSMenuRecent_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) { rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_RECENT); } #else static EnumPropertyItem dt_uv_items[] = { {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"}, {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"}, {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"}, {SI_UVDT_WHITE, "WHITE", 0, "White", "Draw white edges"}, {0, NULL, 0, NULL, NULL} }; static void rna_def_space(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; srna = RNA_def_struct(brna, "Space", NULL); RNA_def_struct_sdna(srna, "SpaceLink"); RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area"); RNA_def_struct_refine_func(srna, "rna_Space_refine"); prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "spacetype"); RNA_def_property_enum_items(prop, space_type_items); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Type", "Space data type"); /* access to V2D_VIEWSYNC_SCREEN_TIME */ prop = RNA_def_property(srna, "show_locked_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Space_view2d_sync_get", "rna_Space_view2d_sync_set"); RNA_def_property_ui_text(prop, "Lock Time to Other Windows", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Space_view2d_sync_update"); } /* for all spaces that use a mask */ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *mask_set_func) { PropertyRNA *prop; static EnumPropertyItem overlay_mode_items[] = { {MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"}, {MASK_OVERLAY_COMBINED, "COMBINED", ICON_NONE, "Combined", "Combine space background image with the mask"}, {0, NULL, 0, NULL, NULL} }; prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mask_info.mask"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Mask", "Mask displayed and edited in this space"); RNA_def_property_pointer_funcs(prop, NULL, mask_set_func, NULL, NULL); RNA_def_property_update(prop, noteflag, NULL); /* mask drawing */ prop = RNA_def_property(srna, "mask_draw_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mask_info.draw_type"); RNA_def_property_enum_items(prop, dt_uv_items); RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for mask splines"); RNA_def_property_update(prop, noteflag, NULL); prop = RNA_def_property(srna, "show_mask_smooth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_SMOOTH); RNA_def_property_ui_text(prop, "Draw Smooth Splines", ""); RNA_def_property_update(prop, noteflag, NULL); prop = RNA_def_property(srna, "show_mask_overlay", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_OVERLAY); RNA_def_property_ui_text(prop, "Show Mask Overlay", ""); RNA_def_property_update(prop, noteflag, NULL); prop = RNA_def_property(srna, "mask_overlay_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mask_info.overlay_mode"); RNA_def_property_enum_items(prop, overlay_mode_items); RNA_def_property_ui_text(prop, "Overlay Mode", "Overlay mode of rasterized mask"); RNA_def_property_update(prop, noteflag, NULL); } static void rna_def_space_image_uv(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; static EnumPropertyItem sticky_mode_items[] = { {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"}, {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", "Select UVs that are at the same location and share a mesh vertex"}, {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex", "Select UVs that share mesh vertex, irrespective if they are in the same location"}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem dt_uvstretch_items[] = { {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"}, {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"}, {0, NULL, 0, NULL, NULL} }; srna = RNA_def_struct(brna, "SpaceUVEditor", NULL); RNA_def_struct_sdna(srna, "SpaceImage"); RNA_def_struct_nested(brna, srna, "SpaceImageEditor"); RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space"); /* selection */ prop = RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sticky"); RNA_def_property_enum_items(prop, sticky_mode_items); RNA_def_property_ui_text(prop, "Sticky Selection Mode", "Automatically select also UVs sharing the same vertex as the ones being selected"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); /* drawing */ prop = RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "dt_uv"); RNA_def_property_enum_items(prop, dt_uv_items); RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for drawing UV edges"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV); RNA_def_property_ui_text(prop, "Draw Smooth Edges", "Draw UV edges anti-aliased"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH); RNA_def_property_ui_text(prop, "Draw Stretch", "Draw faces colored according to the difference in shape between UVs and " "their 3D coordinates (blue for low distortion, red for high distortion)"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch"); RNA_def_property_enum_items(prop, dt_uvstretch_items); RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW); RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges after modifiers are applied"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_other_objects", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_OTHER); RNA_def_property_ui_text(prop, "Draw Other Objects", "Draw other selected objects that share the same image"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_texpaint", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAW_TEXPAINT); RNA_def_property_ui_text(prop, "Draw Texture Paint UVs", "Draw overlay of texture paint uv layer"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_normalized_coords", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS); RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWFACES); RNA_def_property_ui_text(prop, "Draw Faces", "Draw faces over the image"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); /* todo: move edge and face drawing options here from G.f */ prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP); RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV); RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP); RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); } static void rna_def_space_outliner(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; static EnumPropertyItem display_mode_items[] = { {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", "Display datablocks in all scenes"}, {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", "Display datablocks in current scene"}, {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display datablocks in visible layers"}, {SO_SELECTED, "SELECTED", 0, "Selected", "Display datablocks of selected objects"}, {SO_ACTIVE, "ACTIVE", 0, "Active", "Display datablocks of active object"}, {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", "Display datablocks of all objects of same type as selected object"}, {SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their datablocks"}, {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence datablocks"}, {SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"}, {SO_DATABLOCKS, "DATABLOCKS", 0, "Datablocks", "Display all raw datablocks"}, {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", "Display the user preference datablocks"}, {SO_ID_ORPHANS, "ORPHAN_DATA", 0, "Orphan Data", "Display datablocks which are unused and/or will be lost when the file is reloaded"}, {0, NULL, 0, NULL, NULL} }; srna = RNA_def_struct(brna, "SpaceOutliner", "Space"); RNA_def_struct_sdna(srna, "SpaceOops"); RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data"); prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "outlinevis"); RNA_def_property_enum_items(prop, display_mode_items); RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "search_string"); RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string"); RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); prop = RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE); RNA_def_property_ui_text(prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); prop = RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE); RNA_def_property_ui_text(prop, "Complete Matches Only", "Only use complete matches of search string"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); prop = RNA_def_property(srna, "use_sort_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_SKIP_SORT_ALPHA); RNA_def_property_ui_text(prop, "Sort Alphabetically", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); prop = RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS); RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); } static void rna_def_background_image(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; /* note: combinations work but don't flip so arnt that useful */ static EnumPropertyItem bgpic_axis_items[] = { {0, "", 0, N_("X Axis"), ""}, {(1 << RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"}, {(1 << RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", "Show background image while looking to the right"}, /*{(1<