Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_space.c
| Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | static EnumPropertyItem autosnap_items[] = { | ||||
| {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames (nla-action time)"}, | {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)"}, | {SACTSNAP_SECOND, "SECOND", 0, "Nearest Second", "Snap to actual seconds (nla-action time)"}, | ||||
| /* {-1, "", 0, "", ""}, */ | /* {-1, "", 0, "", ""}, */ | ||||
| {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"}, | {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| EnumPropertyItem rna_enum_viewport_engine_items[] = { | |||||
| {0, "LEGACY_VIEWPORT", 0, "Legacy Viewport", ""}, | |||||
| {0, NULL, 0, NULL, NULL} | |||||
| }; | |||||
| EnumPropertyItem rna_enum_viewport_shade_items[] = { | EnumPropertyItem rna_enum_viewport_shade_items[] = { | ||||
| {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"}, | {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_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_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_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_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Display objects solid, with GLSL material"}, | ||||
| {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"}, | {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| ▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
| #include "GPU_material.h" | #include "GPU_material.h" | ||||
| #include "IMB_imbuf_types.h" | #include "IMB_imbuf_types.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "VP_engine_API.h" | |||||
| static StructRNA *rna_Space_refine(struct PointerRNA *ptr) | static StructRNA *rna_Space_refine(struct PointerRNA *ptr) | ||||
| { | { | ||||
| SpaceLink *space = (SpaceLink *)ptr->data; | SpaceLink *space = (SpaceLink *)ptr->data; | ||||
| switch (space->spacetype) { | switch (space->spacetype) { | ||||
| case SPACE_VIEW3D: | case SPACE_VIEW3D: | ||||
| return &RNA_SpaceView3D; | return &RNA_SpaceView3D; | ||||
| case SPACE_IPO: | case SPACE_IPO: | ||||
| ▲ Show 20 Lines • Show All 384 Lines • ▼ Show 20 Lines | |||||
| static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values) | static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values) | ||||
| { | { | ||||
| RegionView3D *rv3d = (RegionView3D *)(ptr->data); | RegionView3D *rv3d = (RegionView3D *)(ptr->data); | ||||
| float mat[4][4]; | float mat[4][4]; | ||||
| invert_m4_m4(mat, (float (*)[4])values); | invert_m4_m4(mat, (float (*)[4])values); | ||||
| ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist); | ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist); | ||||
| } | } | ||||
| static int rna_SpaceView3D_viewport_engine_get(PointerRNA *ptr) | |||||
| { | |||||
| View3D *v3d = (View3D *)ptr->data; | |||||
| int engine_type_idx = 0; | |||||
| if (!v3d->viewport_engine) { | |||||
| BLI_assert(0); | |||||
| return -1; | |||||
| } | |||||
| for (ViewportEngineType *engine_type = ViewportEngineTypes.first; engine_type; engine_type = engine_type->next) { | |||||
| if (v3d->viewport_engine->type == engine_type) { | |||||
| break; | |||||
| } | |||||
| engine_type_idx++; | |||||
| } | |||||
| return engine_type_idx; | |||||
| } | |||||
| static void rna_SpaceView3D_viewport_engine_set(PointerRNA *ptr, int value) | |||||
| { | |||||
| View3D *v3d = (View3D *)ptr->data; | |||||
| ViewportEngineType *new_engine_type = BLI_findlink(&ViewportEngineTypes, value); | |||||
| if (new_engine_type) { | |||||
| if (v3d->viewport_engine) { | |||||
| VP_engine_free(v3d->viewport_engine); | |||||
| } | |||||
| v3d->viewport_engine = VP_engine_create(new_engine_type); | |||||
| } | |||||
| } | |||||
| static EnumPropertyItem *rna_SpaceView3D_viewport_engine_itemf( | |||||
| bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), | |||||
| bool *r_free) | |||||
| { | |||||
| EnumPropertyItem *item = NULL; | |||||
| EnumPropertyItem tmp = {0, "", 0, "", ""}; | |||||
| int totitem = 0; | |||||
| for (ViewportEngineType *engine_type = ViewportEngineTypes.first; engine_type; engine_type = engine_type->next) { | |||||
| tmp.value = totitem; | |||||
| tmp.identifier = engine_type->idname; | |||||
| tmp.name = engine_type->name; | |||||
| RNA_enum_item_add(&item, &totitem, &tmp); | |||||
| } | |||||
| RNA_enum_item_end(&item, &totitem); | |||||
| *r_free = true; | |||||
| return item; | |||||
| } | |||||
| static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr) | static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr) | ||||
| { | { | ||||
| Scene *scene = ((bScreen *)ptr->id.data)->scene; | Scene *scene = ((bScreen *)ptr->id.data)->scene; | ||||
| RenderEngineType *type = RE_engines_find(scene->r.engine); | RenderEngineType *type = RE_engines_find(scene->r.engine); | ||||
| View3D *v3d = (View3D *)ptr->data; | View3D *v3d = (View3D *)ptr->data; | ||||
| int drawtype = v3d->drawtype; | int drawtype = v3d->drawtype; | ||||
| if (drawtype == OB_RENDER && !(type && type->view_draw)) | if (drawtype == OB_RENDER && !(type && type->view_draw)) | ||||
| ▲ Show 20 Lines • Show All 1,670 Lines • ▼ Show 20 Lines | static void rna_def_space_view3d(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_flag(prop, PROP_EDITABLE); | RNA_def_property_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "camera"); | RNA_def_property_pointer_sdna(prop, NULL, "camera"); | ||||
| RNA_def_property_ui_text(prop, "Camera", | RNA_def_property_ui_text(prop, "Camera", | ||||
| "Active camera used in this view (when unlocked from the scene's active camera)"); | "Active camera used in this view (when unlocked from the scene's active camera)"); | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| /* viewport engine */ | |||||
| prop = RNA_def_property(srna, "viewport_engine", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_items(prop, rna_enum_viewport_engine_items); | |||||
| RNA_def_property_enum_funcs(prop, "rna_SpaceView3D_viewport_engine_get", "rna_SpaceView3D_viewport_engine_set", | |||||
| "rna_SpaceView3D_viewport_engine_itemf"); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_ui_text(prop, "Viewport Engine", "Engine to use for viewport drawing"); | |||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | |||||
| /* render border */ | /* render border */ | ||||
| prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER); | RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | ||||
| RNA_def_property_ui_text(prop, "Render Border", "Use a region within the frame size for rendered viewport " | RNA_def_property_ui_text(prop, "Render Border", "Use a region within the frame size for rendered viewport " | ||||
| "(when not viewing through the camera)"); | "(when not viewing through the camera)"); | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| ▲ Show 20 Lines • Show All 360 Lines • ▼ Show 20 Lines | static void rna_def_space_view3d(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "Volume", "Show the stereo 3d frustum volume"); | RNA_def_property_ui_text(prop, "Volume", "Show the stereo 3d frustum volume"); | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| prop = RNA_def_property(srna, "stereo_3d_volume_alpha", PROP_FLOAT, PROP_FACTOR); | prop = RNA_def_property(srna, "stereo_3d_volume_alpha", PROP_FLOAT, PROP_FACTOR); | ||||
| RNA_def_property_float_sdna(prop, NULL, "stereo3d_volume_alpha"); | RNA_def_property_float_sdna(prop, NULL, "stereo3d_volume_alpha"); | ||||
| RNA_def_property_ui_text(prop, "Volume Alpha", "Opacity (alpha) of the cameras' frustum volume"); | RNA_def_property_ui_text(prop, "Volume Alpha", "Opacity (alpha) of the cameras' frustum volume"); | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| /* *** Blender 2.8 Viewport temporary *** */ | |||||
| prop = RNA_def_property(srna, "use_modern_viewport", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "tmp_compat_flag", V3D_NEW_VIEWPORT); | |||||
| RNA_def_property_ui_text(prop, "Modern Viewport", "Use modern viewport"); | |||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | |||||
| /* *** Animated *** */ | /* *** Animated *** */ | ||||
| RNA_define_animate_sdna(true); | RNA_define_animate_sdna(true); | ||||
| /* region */ | /* region */ | ||||
| srna = RNA_def_struct(brna, "RegionView3D", NULL); | srna = RNA_def_struct(brna, "RegionView3D", NULL); | ||||
| RNA_def_struct_sdna(srna, "RegionView3D"); | RNA_def_struct_sdna(srna, "RegionView3D"); | ||||
| RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data"); | RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data"); | ||||
| ▲ Show 20 Lines • Show All 2,002 Lines • Show Last 20 Lines | |||||