Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_cachefile.c
| Show All 39 Lines | |||||
| # include "WM_api.h" | # include "WM_api.h" | ||||
| # include "WM_types.h" | # include "WM_types.h" | ||||
| # ifdef WITH_ALEMBIC | # ifdef WITH_ALEMBIC | ||||
| # include "../../../alembic/ABC_alembic.h" | # include "../../../alembic/ABC_alembic.h" | ||||
| # endif | # endif | ||||
| static void rna_CacheFile_update(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_CacheFile_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | ||||
| { | { | ||||
| CacheFile *cache_file = (CacheFile *)ptr->data; | CacheFile *cache_file = (CacheFile *)ptr->data; | ||||
| DEG_id_tag_update(&cache_file->id, 0); | DEG_id_tag_update(&cache_file->id, ID_RECALC_COPY_ON_WRITE); | ||||
| WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | ||||
| UNUSED_VARS(bmain, scene); | |||||
| } | |||||
| static void rna_CacheFile_update_handle(Main *bmain, Scene *scene, PointerRNA *ptr) | |||||
| { | |||||
| CacheFile *cache_file = ptr->data; | |||||
| if ((cache_file->flag & CACHEFILE_DIRTY) != 0) { | |||||
| BKE_cachefile_clean(bmain, cache_file); | |||||
| BLI_freelistN(&cache_file->object_paths); | |||||
| cache_file->flag &= ~CACHEFILE_DIRTY; | |||||
| } | |||||
| BKE_cachefile_reload(bmain, cache_file); | |||||
| rna_CacheFile_update(bmain, scene, ptr); | |||||
| } | } | ||||
| static void rna_CacheFile_object_paths_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | static void rna_CacheFile_object_paths_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | ||||
| { | { | ||||
| CacheFile *cache_file = (CacheFile *)ptr->data; | CacheFile *cache_file = (CacheFile *)ptr->data; | ||||
| rna_iterator_listbase_begin(iter, &cache_file->object_paths, NULL); | rna_iterator_listbase_begin(iter, &cache_file->object_paths, NULL); | ||||
| } | } | ||||
| static void rna_CacheFile_filename_set(PointerRNA *ptr, const char *value) | |||||
| { | |||||
| CacheFile *cache_file = ptr->data; | |||||
| if (STREQ(cache_file->filepath, value)) { | |||||
| return; | |||||
| } | |||||
| /* Different file is opened, close all readers. */ | |||||
| cache_file->flag |= CACHEFILE_DIRTY; | |||||
| BLI_strncpy(cache_file->filepath, value, sizeof(cache_file->filepath)); | |||||
| } | |||||
| #else | #else | ||||
| /* cachefile.object_paths */ | /* cachefile.object_paths */ | ||||
| static void rna_def_alembic_object_path(BlenderRNA *brna) | static void rna_def_alembic_object_path(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna = RNA_def_struct(brna, "AlembicObjectPath", NULL); | StructRNA *srna = RNA_def_struct(brna, "AlembicObjectPath", NULL); | ||||
| RNA_def_struct_sdna(srna, "AlembicObjectPath"); | RNA_def_struct_sdna(srna, "AlembicObjectPath"); | ||||
| RNA_def_struct_ui_text(srna, "Object Path", "Path of an object inside of an Alembic archive"); | RNA_def_struct_ui_text(srna, "Object Path", "Path of an object inside of an Alembic archive"); | ||||
| Show All 16 Lines | |||||
| static void rna_def_cachefile(BlenderRNA *brna) | static void rna_def_cachefile(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna = RNA_def_struct(brna, "CacheFile", "ID"); | StructRNA *srna = RNA_def_struct(brna, "CacheFile", "ID"); | ||||
| RNA_def_struct_sdna(srna, "CacheFile"); | RNA_def_struct_sdna(srna, "CacheFile"); | ||||
| RNA_def_struct_ui_text(srna, "CacheFile", ""); | RNA_def_struct_ui_text(srna, "CacheFile", ""); | ||||
| RNA_def_struct_ui_icon(srna, ICON_FILE); | RNA_def_struct_ui_icon(srna, ICON_FILE); | ||||
| PropertyRNA *prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); | PropertyRNA *prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); | ||||
| RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CacheFile_filename_set"); | |||||
| RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file"); | RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file"); | ||||
| RNA_def_property_update(prop, 0, "rna_CacheFile_update_handle"); | RNA_def_property_update(prop, 0, "rna_CacheFile_update"); | ||||
| prop = RNA_def_property(srna, "is_sequence", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_sequence", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Sequence", "Whether the cache is separated in a series of files"); | prop, "Sequence", "Whether the cache is separated in a series of files"); | ||||
| RNA_def_property_update(prop, 0, "rna_CacheFile_update"); | RNA_def_property_update(prop, 0, "rna_CacheFile_update"); | ||||
| /* ----------------- For Scene time ------------------- */ | /* ----------------- For Scene time ------------------- */ | ||||
| ▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines | |||||