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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-05-29 19:12:31 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-05-29 19:12:31 +0400
commit688b7c73ad42148bfa946a195549c4fc6b38c266 (patch)
tree1208edf7df719a00a145e59b0a3b26f491a5d1a6 /source/blender/makesrna/intern/rna_mesh.c
parent10e8672c8de27769b9e6857cf9b7f2805ca837b2 (diff)
RNA:
* Added PROP_ID_REFCOUNT flag to control if refcounting should be done on ID pointer properties. All ID pointers are refcounted, by default, with the exception of Object, Scene and Text. * Also made TextureFace image pointer editable, with the special refcounting behavior.
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh.c')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index c1fa0a415ee..c75558dafe4 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -467,6 +467,23 @@ static int rna_Mesh_string_layers_length(PointerRNA *ptr)
return rna_CustomDataLayer_length(ptr, CD_PROP_STR);
}
+static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value)
+{
+ MTFace *tf= (MTFace*)ptr->data;
+ ID *id= value.data;
+
+ if(id) {
+ /* special exception here, individual faces don't count
+ * as reference, but we do ensure the refcount is not zero */
+ if(id->us == 0)
+ id_us_plus(id);
+ else
+ id_lib_extern(id);
+ }
+
+ tf->tpage= (struct Image*)id;
+}
+
/* path construction */
static char *rna_VertexGroupElement_path(PointerRNA *ptr)
@@ -747,9 +764,11 @@ static void rna_def_mtface(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Mesh Texture Face", "UV mapping, texturing and game engine data for a face.");
RNA_def_struct_path_func(srna, "rna_MeshTextureFace_path");
- /* prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "tpage");
- RNA_def_property_ui_text(prop, "Image", ""); */
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_TextureFace_image_set");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
prop= RNA_def_property(srna, "tex", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TEX);