diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-28 18:28:45 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-28 18:28:45 +0400 |
commit | 8563115e8c18e1e2b5db5de21520a0c780c5b164 (patch) | |
tree | c3942457c05c86f48ec0d95e56734160527090e0 /source/blender/makesrna/intern/rna_ID.c | |
parent | 18e54b1ee85407d54e8f9d1942c323616cbe0beb (diff) |
RNA
* Move mesh API functions to mesh_data.c, would like to keep
RNA layer fairly thin, any non-trivial functions shoud be
in their modules.
* Replace mesh.create_copy by generic id.copy.
* Fix #19250: Mesh.add_geometry() in editmode fails silently,
now gives an error.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ID.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index f5c6063e892..8ab5a1442c7 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -178,6 +178,18 @@ StructRNA* rna_IDPropertyGroup_refine(PointerRNA *ptr) return ptr->type; } +ID *rna_ID_copy(ID *id) +{ + ID *newid; + + if(id_copy(id, &newid, 0)) { + if(newid) newid->us--; + return newid; + } + + return NULL; +} + #else static void rna_def_ID_properties(BlenderRNA *brna) @@ -243,7 +255,8 @@ static void rna_def_ID_properties(BlenderRNA *brna) static void rna_def_ID(BlenderRNA *brna) { StructRNA *srna; - PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *prop, *parm; srna= RNA_def_struct(brna, "ID", NULL); RNA_def_struct_ui_text(srna, "ID", "Base type for datablocks, defining a unique name, linking from other libraries and garbage collection."); @@ -271,6 +284,12 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "lib"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Library", "Library file the datablock is linked from."); + + /* functions */ + func= RNA_def_function(srna, "copy", "rna_ID_copy"); + RNA_def_function_ui_description(func, "Create a copy of this datablock (not supported for all datablocks)."); + parm= RNA_def_pointer(func, "id", "ID", "", "New copy of the ID."); + RNA_def_function_return(func, parm); } static void rna_def_library(BlenderRNA *brna) |