Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r--source/blender/makesrna/intern/rna_space.c152
1 files changed, 88 insertions, 64 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index a05cef7a1cd..652d2545e67 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -39,6 +39,7 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BLI_uuid.h"
#include "DNA_action_types.h"
#include "DNA_gpencil_types.h"
@@ -856,6 +857,14 @@ static void rna_Space_view2d_sync_set(PointerRNA *ptr, bool value)
ARegion *region;
area = rna_area_from_space(ptr); /* can be NULL */
+ if ((area != NULL) && !UI_view2d_area_supports_sync(area)) {
+ BKE_reportf(NULL,
+ RPT_ERROR,
+ "'show_locked_time' is not supported for the '%s' editor",
+ area->type->name);
+ return;
+ }
+
region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
if (region) {
View2D *v2d = &region->v2d;
@@ -906,7 +915,7 @@ static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UN
static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
View3D *v3d = (View3D *)(ptr->data);
- if (v3d->scenelock) {
+ if (v3d->scenelock && scene != NULL) {
wmWindowManager *wm = bmain->wm.first;
scene->camera = v3d->camera;
@@ -1540,7 +1549,9 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
{
- ED_space_image_paint_update(bmain, bmain->wm.first, scene);
+ if (scene != NULL) {
+ ED_space_image_paint_update(bmain, bmain->wm.first, scene);
+ }
}
static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, int value)
@@ -2604,16 +2615,38 @@ static void rna_FileAssetSelectParams_asset_library_set(PointerRNA *ptr, int val
params->asset_library_ref = ED_asset_library_reference_from_enum_value(value);
}
-static void rna_FileAssetSelectParams_asset_category_set(PointerRNA *ptr, uint64_t value)
+static PointerRNA rna_FileBrowser_FileSelectEntry_asset_data_get(PointerRNA *ptr)
{
- FileSelectParams *params = ptr->data;
- params->filter_id = value;
+ const FileDirEntry *entry = ptr->data;
+
+ /* Note that the owning ID of the RNA pointer (`ptr->owner_id`) has to be set carefully:
+ * Local IDs (`entry->id`) own their asset metadata themselves. Asset metadata from other blend
+ * files are owned by the file browser (`entry`). Only if this is set correctly, we can tell from
+ * the metadata RNA pointer if the metadata is stored locally and can thus be edited or not. */
+
+ if (entry->id) {
+ PointerRNA id_ptr;
+ RNA_id_pointer_create(entry->id, &id_ptr);
+ return rna_pointer_inherit_refine(&id_ptr, &RNA_AssetMetaData, entry->asset_data);
+ }
+
+ return rna_pointer_inherit_refine(ptr, &RNA_AssetMetaData, entry->asset_data);
}
-static uint64_t rna_FileAssetSelectParams_asset_category_get(PointerRNA *ptr)
+static int rna_FileBrowser_FileSelectEntry_name_editable(PointerRNA *ptr, const char **r_info)
{
- FileSelectParams *params = ptr->data;
- return params->filter_id;
+ const FileDirEntry *entry = ptr->data;
+
+ /* This actually always returns 0 (the name is never editable) but we want to get a disabled
+ * message returned to `r_info` in some cases. */
+
+ if (entry->asset_data) {
+ PointerRNA asset_data_ptr = rna_FileBrowser_FileSelectEntry_asset_data_get(ptr);
+ /* Get disabled hint from asset metadata polling. */
+ rna_AssetMetaData_editable(&asset_data_ptr, r_info);
+ }
+
+ return 0;
}
static void rna_FileBrowser_FileSelectEntry_name_get(PointerRNA *ptr, char *value)
@@ -2672,12 +2705,6 @@ static int rna_FileBrowser_FileSelectEntry_preview_icon_id_get(PointerRNA *ptr)
return ED_file_icon(entry);
}
-static PointerRNA rna_FileBrowser_FileSelectEntry_asset_data_get(PointerRNA *ptr)
-{
- const FileDirEntry *entry = ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_AssetMetaData, entry->asset_data);
-}
-
static StructRNA *rna_FileBrowser_params_typef(PointerRNA *ptr)
{
SpaceFile *sfile = ptr->data;
@@ -3153,6 +3180,17 @@ static void rna_SpaceSpreadsheet_context_path_guess(SpaceSpreadsheet *sspreadshe
WM_main_add_notifier(NC_SPACE | ND_SPACE_SPREADSHEET, NULL);
}
+static void rna_FileAssetSelectParams_catalog_id_get(PointerRNA *ptr, char *value)
+{
+ const FileAssetSelectParams *params = ptr->data;
+ BLI_uuid_format(value, params->catalog_id);
+}
+
+static int rna_FileAssetSelectParams_catalog_id_length(PointerRNA *UNUSED(ptr))
+{
+ return UUID_STRING_LEN - 1;
+}
+
#else
static const EnumPropertyItem dt_uv_items[] = {
@@ -3443,6 +3481,19 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
prop, "Tile Grid Shape", "How many tiles will be shown in the background");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+ prop = RNA_def_property(srna, "use_custom_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CUSTOM_GRID);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Custom Grid", "Use a grid with a user-defined number of steps");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "custom_grid_subdivisions", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom_grid_subdiv");
+ RNA_def_property_range(prop, 1, 5000);
+ RNA_def_property_ui_text(
+ prop, "Dynamic Grid Size", "Number of grid units in UV space that make one UV Unit");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
prop = RNA_def_property(srna, "uv_opacity", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "uv_opacity");
RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -5449,6 +5500,12 @@ static void rna_def_space_sequencer_timeline_overlay(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_THUMBNAILS);
RNA_def_property_ui_text(prop, "Show Thumbnails", "Show strip thumbnails");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_strip_tag_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG);
+ RNA_def_property_ui_text(
+ prop, "Show Color Tags", "Display the strip color tags in the sequencer");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
}
static void rna_def_space_sequencer(BlenderRNA *brna)
@@ -6260,12 +6317,13 @@ static void rna_def_fileselect_entry(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "File Select Entry", "A file viewable in the File Browser");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_editable_func(prop, "rna_FileBrowser_FileSelectEntry_name_editable");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(prop,
"rna_FileBrowser_FileSelectEntry_name_get",
"rna_FileBrowser_FileSelectEntry_name_length",
NULL);
RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "relative_path", PROP_STRING, PROP_NONE);
@@ -6537,47 +6595,6 @@ static void rna_def_fileselect_asset_params(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- /* XXX copied from rna_enum_id_type_filter_items. */
- static const EnumPropertyItem asset_category_items[] = {
- {FILTER_ID_SCE, "SCENES", ICON_SCENE_DATA, "Scenes", "Show scenes"},
- {FILTER_ID_AC, "ANIMATIONS", ICON_ANIM_DATA, "Animations", "Show animation data"},
- {FILTER_ID_OB | FILTER_ID_GR,
- "OBJECTS_AND_COLLECTIONS",
- ICON_GROUP,
- "Objects & Collections",
- "Show objects and collections"},
- {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME
- /* XXX avoid warning */
- // | FILTER_ID_HA | FILTER_ID_PT | FILTER_ID_VO
- ,
- "GEOMETRY",
- ICON_MESH_DATA,
- "Geometry",
- "Show meshes, curves, lattice, armatures and metaballs data"},
- {FILTER_ID_LS | FILTER_ID_MA | FILTER_ID_NT | FILTER_ID_TE,
- "SHADING",
- ICON_MATERIAL_DATA,
- "Shading",
- "Show materials, nodetrees, textures and Freestyle's linestyles"},
- {FILTER_ID_IM | FILTER_ID_MC | FILTER_ID_MSK | FILTER_ID_SO,
- "IMAGES_AND_SOUNDS",
- ICON_IMAGE_DATA,
- "Images & Sounds",
- "Show images, movie clips, sounds and masks"},
- {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_LP | FILTER_ID_SPK | FILTER_ID_WO,
- "ENVIRONMENTS",
- ICON_WORLD_DATA,
- "Environment",
- "Show worlds, lights, cameras and speakers"},
- {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT |
- FILTER_ID_VF | FILTER_ID_CF | FILTER_ID_WS,
- "MISC",
- ICON_GREASEPENCIL,
- "Miscellaneous",
- "Show other data types"},
- {0, NULL, 0, NULL, NULL},
- };
-
static const EnumPropertyItem asset_import_type_items[] = {
{FILE_ASSET_IMPORT_LINK, "LINK", 0, "Link", "Import the assets as linked data-block"},
{FILE_ASSET_IMPORT_APPEND,
@@ -6585,6 +6602,14 @@ static void rna_def_fileselect_asset_params(BlenderRNA *brna)
0,
"Append",
"Import the assets as copied data-block, with no link to the original asset data-block"},
+ {FILE_ASSET_IMPORT_APPEND_REUSE,
+ "APPEND_REUSE",
+ 0,
+ "Append (Reuse Data)",
+ "Import the assets as copied data-block while avoiding multiple copies of nested, "
+ "typically heavy data. For example the textures of a material asset, or the mesh of an "
+ "object asset, don't have to be copied every time this asset is imported. The instances of "
+ "the asset share the data instead"},
{0, NULL, 0, NULL, NULL},
};
@@ -6598,14 +6623,13 @@ static void rna_def_fileselect_asset_params(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Asset Library", "");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
- prop = RNA_def_property(srna, "asset_category", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, asset_category_items);
- RNA_def_property_enum_funcs(prop,
- "rna_FileAssetSelectParams_asset_category_get",
- "rna_FileAssetSelectParams_asset_category_set",
- NULL);
- RNA_def_property_ui_text(prop, "Asset Category", "Determine which kind of assets to display");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
+ prop = RNA_def_property(srna, "catalog_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_FileAssetSelectParams_catalog_id_get",
+ "rna_FileAssetSelectParams_catalog_id_length",
+ NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Catalog UUID", "The UUID of the catalog shown in the browser");
prop = RNA_def_property(srna, "import_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, asset_import_type_items);