Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_ID.c
| Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BKE_font.h" | #include "BKE_font.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_library_query.h" | #include "BKE_library_query.h" | ||||
| #include "BKE_library_override.h" | |||||
| #include "BKE_library_remap.h" | #include "BKE_library_remap.h" | ||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_global.h" /* XXX, remove me */ | #include "BKE_global.h" /* XXX, remove me */ | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| ▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | static ID *rna_ID_copy(ID *id, Main *bmain) | ||||
| if (id_copy(bmain, id, &newid, false)) { | if (id_copy(bmain, id, &newid, false)) { | ||||
| if (newid) id_us_min(newid); | if (newid) id_us_min(newid); | ||||
| return newid; | return newid; | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| static ID *rna_ID_override_create(ID *id, Main *bmain) | |||||
| { | |||||
| if (id->lib == NULL) { | |||||
| return NULL; | |||||
| } | |||||
| return BKE_override_static_create_from(bmain, id); | |||||
| } | |||||
| static void rna_ID_update_tag(ID *id, ReportList *reports, int flag) | static void rna_ID_update_tag(ID *id, ReportList *reports, int flag) | ||||
| { | { | ||||
| /* XXX, new function for this! */ | /* XXX, new function for this! */ | ||||
| #if 0 | #if 0 | ||||
| if (ob->type == OB_FONT) { | if (ob->type == OB_FONT) { | ||||
| Curve *cu = ob->data; | Curve *cu = ob->data; | ||||
| freedisplist(&cu->disp); | freedisplist(&cu->disp); | ||||
| BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL); | BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL); | ||||
| ▲ Show 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | |||||
| static PointerRNA rna_IDPreview_get(PointerRNA *ptr) | static PointerRNA rna_IDPreview_get(PointerRNA *ptr) | ||||
| { | { | ||||
| ID *id = (ID *)ptr->data; | ID *id = (ID *)ptr->data; | ||||
| PreviewImage *prv_img = BKE_previewimg_id_ensure(id); | PreviewImage *prv_img = BKE_previewimg_id_ensure(id); | ||||
| return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img); | return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img); | ||||
| } | } | ||||
| static PointerRNA rna_ID_override_reference_get(PointerRNA *ptr) | |||||
| { | |||||
| ID *id = (ID *)ptr->data; | |||||
| ID *reference = (id && id->override_static) ? id->override_static->reference : NULL; | |||||
| return reference ? rna_pointer_inherit_refine(ptr, ID_code_to_RNA_type(GS(reference->name)), reference) : PointerRNA_NULL; | |||||
| } | |||||
| #else | #else | ||||
| static void rna_def_ID_properties(BlenderRNA *brna) | static void rna_def_ID_properties(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| /* this is struct is used for holding the virtual | /* this is struct is used for holding the virtual | ||||
| ▲ Show 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | static void rna_def_ID(BlenderRNA *brna) | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly"); | RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly"); | ||||
| prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "lib"); | RNA_def_property_pointer_sdna(prop, NULL, "lib"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from"); | RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from"); | ||||
| prop = RNA_def_pointer(srna, "override_static_reference", "ID", | |||||
| "Override Reference", "Reference linked data-block overridden by this one"); | |||||
| RNA_def_property_pointer_sdna(prop, NULL, "override_static->reference"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_pointer_funcs(prop, "rna_ID_override_reference_get", NULL, NULL, NULL); | |||||
| prop = RNA_def_pointer(srna, "preview", "ImagePreview", "Preview", | prop = RNA_def_pointer(srna, "preview", "ImagePreview", "Preview", | ||||
| "Preview image and icon of this data-block (None if not supported for this type of data)"); | "Preview image and icon of this data-block (None if not supported for this type of data)"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL); | ||||
| /* functions */ | /* functions */ | ||||
| func = RNA_def_function(srna, "copy", "rna_ID_copy"); | func = RNA_def_function(srna, "copy", "rna_ID_copy"); | ||||
| RNA_def_function_ui_description(func, "Create a copy of this data-block (not supported for all data-blocks)"); | RNA_def_function_ui_description(func, "Create a copy of this data-block (not supported for all data-blocks)"); | ||||
| RNA_def_function_flag(func, FUNC_USE_MAIN); | RNA_def_function_flag(func, FUNC_USE_MAIN); | ||||
| parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); | parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "override_create", "rna_ID_override_create"); | |||||
| RNA_def_function_ui_description(func, "Create an overridden local copy of this linked data-block (not supported for all data-blocks)"); | |||||
| RNA_def_function_flag(func, FUNC_USE_MAIN); | |||||
| parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID"); | |||||
| RNA_def_function_return(func, parm); | |||||
| func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear"); | func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear"); | ||||
| RNA_def_function_ui_description(func, "Clear the user count of a data-block so its not saved, " | RNA_def_function_ui_description(func, "Clear the user count of a data-block so its not saved, " | ||||
| "on reload the data will be removed"); | "on reload the data will be removed"); | ||||
| func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap"); | func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap"); | ||||
| RNA_def_function_ui_description(func, "Replace all usage in the .blend file of this ID by new given one"); | RNA_def_function_ui_description(func, "Replace all usage in the .blend file of this ID by new given one"); | ||||
| RNA_def_function_flag(func, FUNC_USE_MAIN); | RNA_def_function_flag(func, FUNC_USE_MAIN); | ||||
| parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use"); | parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use"); | ||||
| ▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines | |||||