diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 125 |
1 files changed, 85 insertions, 40 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 6c261d06035..1d1dbdb8d9c 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -37,6 +37,8 @@ #include "BKE_node.h" #include "BKE_studiolight.h" +#include "BLI_math.h" + #include "DNA_action_types.h" #include "DNA_key_types.h" #include "DNA_material_types.h" @@ -181,29 +183,39 @@ const EnumPropertyItem rna_enum_viewport_lighting_items[] = { }; static const EnumPropertyItem rna_enum_studio_light_items[] = { - {0, "STUDIOLIGHT_01", 0, "", ""}, - {1, "STUDIOLIGHT_02", 0, "", ""}, - {2, "STUDIOLIGHT_03", 0, "", ""}, - {3, "STUDIOLIGHT_04", 0, "", ""}, - {4, "STUDIOLIGHT_05", 0, "", ""}, - {5, "STUDIOLIGHT_06", 0, "", ""}, - {6, "STUDIOLIGHT_07", 0, "", ""}, - {7, "STUDIOLIGHT_08", 0, "", ""}, - {8, "STUDIOLIGHT_09", 0, "", ""}, - {9, "STUDIOLIGHT_10", 0, "", ""}, - {10, "STUDIOLIGHT_11", 0, "", ""}, - {11, "STUDIOLIGHT_12", 0, "", ""}, - {12, "STUDIOLIGHT_13", 0, "", ""}, - {13, "STUDIOLIGHT_14", 0, "", ""}, - {14, "STUDIOLIGHT_15", 0, "", ""}, - {15, "STUDIOLIGHT_16", 0, "", ""}, - {16, "STUDIOLIGHT_17", 0, "", ""}, - {17, "STUDIOLIGHT_18", 0, "", ""}, - {18, "STUDIOLIGHT_19", 0, "", ""}, - {19, "STUDIOLIGHT_20", 0, "", ""}, + {0, "STUDIOLIGHT_00", 0, "", ""}, + {1, "STUDIOLIGHT_01", 0, "", ""}, + {2, "STUDIOLIGHT_02", 0, "", ""}, + {3, "STUDIOLIGHT_03", 0, "", ""}, + {4, "STUDIOLIGHT_04", 0, "", ""}, + {5, "STUDIOLIGHT_05", 0, "", ""}, + {6, "STUDIOLIGHT_06", 0, "", ""}, + {7, "STUDIOLIGHT_07", 0, "", ""}, + {8, "STUDIOLIGHT_08", 0, "", ""}, + {9, "STUDIOLIGHT_09", 0, "", ""}, + {10, "STUDIOLIGHT_10", 0, "", ""}, + {11, "STUDIOLIGHT_11", 0, "", ""}, + {12, "STUDIOLIGHT_12", 0, "", ""}, + {13, "STUDIOLIGHT_13", 0, "", ""}, + {14, "STUDIOLIGHT_14", 0, "", ""}, + {15, "STUDIOLIGHT_15", 0, "", ""}, + {16, "STUDIOLIGHT_16", 0, "", ""}, + {17, "STUDIOLIGHT_17", 0, "", ""}, + {18, "STUDIOLIGHT_18", 0, "", ""}, + {19, "STUDIOLIGHT_19", 0, "", ""}, + {20, "STUDIOLIGHT_20", 0, "", ""}, + {21, "STUDIOLIGHT_21", 0, "", ""}, + {22, "STUDIOLIGHT_22", 0, "", ""}, + {23, "STUDIOLIGHT_23", 0, "", ""}, + {24, "STUDIOLIGHT_24", 0, "", ""}, + {25, "STUDIOLIGHT_25", 0, "", ""}, + {26, "STUDIOLIGHT_26", 0, "", ""}, + {27, "STUDIOLIGHT_27", 0, "", ""}, + {28, "STUDIOLIGHT_28", 0, "", ""}, + {29, "STUDIOLIGHT_29", 0, "", ""}, {0, NULL, 0, NULL, NULL} }; -#define NUM_STUDIO_LIGHT_ITEMS 20 +#define NUM_STUDIO_LIGHT_ITEMS 30 const EnumPropertyItem rna_enum_clip_editor_mode_items[] = { {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"}, @@ -686,9 +698,18 @@ static const EnumPropertyItem *rna_3DViewShading_type_itemf( return item; } +static int rna_View3DShading_studio_light_orientation_get(PointerRNA *ptr) +{ + View3D *v3d = (View3D *)ptr->data; + StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light); + return sl->flag & (STUDIOLIGHT_ORIENTATION_WORLD|STUDIOLIGHT_ORIENTATION_CAMERA); +} +static void rna_View3DShading_studio_light_orientation_set(PointerRNA *UNUSED(ptr), int UNUSED(value)) +{ +} + static int rna_View3DShading_studio_light_get(PointerRNA *ptr) { - /* XXX: should be stored as string */ View3D *v3d = (View3D *)ptr->data; StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light); return sl->index; @@ -696,7 +717,6 @@ static int rna_View3DShading_studio_light_get(PointerRNA *ptr) static void rna_View3DShading_studio_light_set(PointerRNA *ptr, int value) { - /* XXX: should be stored as string */ View3D *v3d = (View3D *)ptr->data; StudioLight *sl = BKE_studiolight_findindex(value); BLI_strncpy(v3d->shading.studio_light, sl->name, FILE_MAXFILE); @@ -714,6 +734,7 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf( if (totitem < NUM_STUDIO_LIGHT_ITEMS) { RNA_enum_items_add_value(&item, &totitem, rna_enum_studio_light_items, totitem); lastitem = &item[totitem-1]; + lastitem->value = sl->index; lastitem->icon = sl->icon_id; lastitem->name = sl->name; } @@ -2052,33 +2073,23 @@ static void rna_def_space_outliner(BlenderRNA *brna) static const EnumPropertyItem display_mode_items[] = { {SO_SCENES, "SCENES", 0, "Scenes", "Display scenes and their view layers, collections and objects"}, - {SO_COLLECTIONS, "COLLECTIONS", 0, "Collections", "Display collections and objects in the view layer"}, - {SO_OBJECTS, "OBJECTS", 0, "Objects", "Display objects in the view layer"}, - {SO_VIEW_LAYER, "VIEW_LAYER", 0, "View Layer", "Edit which collections are used in the view layer"}, + {SO_VIEW_LAYER, "VIEW_LAYER", 0, "View Layer", "Display collections and objects in the view layer"}, {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence data-blocks"}, {SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"}, - {SO_DATABLOCKS, "DATABLOCKS", 0, "Data-Blocks", "Display all raw data-blocks"}, + {SO_DATA_API, "DATA_API", 0, "Data API", "Display low level Blender data and its properties"}, {SO_ID_ORPHANS, "ORPHAN_DATA", 0, "Orphan Data", "Display data-blocks which are unused and/or will be lost when the file is reloaded"}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem filter_state_items[] = { - {SO_FILTER_OB_ALL, "ALL", 0, "All", "Show visible objects"}, + {SO_FILTER_OB_ALL, "ALL", 0, "All", "Show all objects in the view layer"}, {SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"}, {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"}, {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"}, {0, NULL, 0, NULL, NULL} }; - static const EnumPropertyItem filter_collection_items[] = { - {SO_FILTER_COLLECTION_SCENE, "SCENE", 0, "Scene", "Show collections in active scene and view layer"}, - {SO_FILTER_COLLECTION_UNLINKED, "UNLINKED", 0, "Unlinked", "Show collections not used in any scene hierarchy"}, - {SO_FILTER_COLLECTION_ALL, "ALL", 0, "All", "Show all collections in the file"}, - {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"); @@ -2140,6 +2151,11 @@ static void rna_def_space_outliner(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Object Children", "Show children"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); + prop = RNA_def_property(srna, "use_filter_collection", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_COLLECTION); + RNA_def_property_ui_text(prop, "Show Collections", "Show collections"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); + /* Filters object state. */ prop = RNA_def_property(srna, "filter_state", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "filter_state"); @@ -2178,11 +2194,16 @@ static void rna_def_space_outliner(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Other Objects", "Show curves, lattices, light probes, fonts, ..."); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); - /* Filters collections state. */ - prop = RNA_def_property(srna, "filter_collection", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, filter_collection_items); - RNA_def_property_ui_text(prop, "Collection Filter", ""); + /* Libraries filter. */ + prop = RNA_def_property(srna, "use_filter_id_type", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_ID_TYPE); + RNA_def_property_ui_text(prop, "Filter By Type", "Show only data-blocks of one type"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); + + prop = RNA_def_property(srna, "filter_id_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "filter_id_type"); + RNA_def_property_enum_items(prop, rna_enum_id_type_items); + RNA_def_property_ui_text(prop, "Filter ID Type", "Data-block type to show"); } static void rna_def_space_view3d_shading(BlenderRNA *brna) @@ -2198,6 +2219,13 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static const EnumPropertyItem studio_light_orientation_items[] = { + {0, "UNKNOWN", 0, "Unknown", "Studio light has no orientation"}, + {STUDIOLIGHT_ORIENTATION_CAMERA, "CAMERA", 0, "Camera", "Studio light is camera based"}, + {STUDIOLIGHT_ORIENTATION_WORLD, "WORLD", 0, "World", "Studio light is world based"}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "View3DShading", NULL); RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_nested(brna, srna, "SpaceView3D"); @@ -2231,6 +2259,23 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Studiolight", "Studio lighting setup"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "studio_light_orientation", PROP_ENUM, PROP_NONE); + RNA_define_verify_sdna(0); + RNA_def_property_enum_sdna(prop, NULL, "shading.flag"); + RNA_def_property_ui_text(prop, "Studio Light Orientation", "Orientation of the studio light"); + RNA_def_property_enum_items(prop, studio_light_orientation_items); + RNA_def_property_enum_funcs(prop, "rna_View3DShading_studio_light_orientation_get", "rna_View3DShading_studio_light_orientation_set", NULL); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_define_verify_sdna(1); + + prop = RNA_def_property(srna, "studiolight_rot_z", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "shading.studiolight_rot_z"); + RNA_def_property_float_default(prop, 0.0); + RNA_def_property_ui_text(prop, "Studiolight Rotation", "Rotation of the studiolight around the Z-Axis"); + RNA_def_property_range(prop, -M_PI, M_PI); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "color_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "shading.color_type"); RNA_def_property_enum_items(prop, color_type_items); |