[Bf-blender-cvs] [cdabfff] cycles-ptex-24: Add RNA access to ptex_coords
Nicholas Bishop
noreply at git.blender.org
Fri Jan 30 18:00:40 CET 2015
Commit: cdabfff77efdbbdf00e1f06a8c3ccc865db5e995
Author: Nicholas Bishop
Date: Sun Jan 25 22:47:58 2015 +0100
Branches: cycles-ptex-24
https://developer.blender.org/rBcdabfff77efdbbdf00e1f06a8c3ccc865db5e995
Add RNA access to ptex_coords
===================================================================
M source/blender/makesrna/intern/rna_image.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index bfce1b9..c1f0954 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -377,6 +377,49 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
BKE_image_release_ibuf(ima, ibuf, lock);
}
+// TODO
+static int rna_Image_ptex_regions_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
+{
+ Image *ima = ptr->id.data;
+ ImBuf *ibuf;
+ void *lock;
+
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+
+ if (ibuf && ibuf->ptex_regions)
+ length[0] = ibuf->num_ptex_regions * 4;
+ else
+ length[0] = 0;
+
+ BKE_image_release_ibuf(ima, ibuf, lock);
+
+ return length[0];
+}
+
+static void rna_Image_ptex_regions_get(PointerRNA *ptr, int *values)
+{
+ Image *ima = ptr->id.data;
+ ImBuf *ibuf;
+ void *lock;
+
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+
+ if (ibuf && ibuf->ptex_regions) {
+ memcpy(values, ibuf->ptex_regions,
+ sizeof(*values) * ibuf->num_ptex_regions * 4);
+ }
+
+ BKE_image_release_ibuf(ima, ibuf, lock);
+}
+
+static void rna_Image_ptex_regions_set(PointerRNA *UNUSED(ptr),
+ const int *UNUSED(values))
+{
+ BLI_assert(!"rna_Image_ptex_regions_set not implemented");
+}
+//
+
static int rna_Image_channels_get(PointerRNA *ptr)
{
Image *im = (Image *)ptr->data;
@@ -800,6 +843,32 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);
+ // TODO
+#if 0
+ {
+ StructRNA *srna2 = RNA_def_struct(brna, "ImagePtexRegion", NULL);
+
+ prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_funcs(prop, "rna_ImagePtexRegion_x_get", "rna_ImagePtexRegion_x_set", NULL);
+ }
+ prop = RNA_def_property(srna, "ptex_table", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ImagePtexRegion");
+ RNA_def_property_collection_funcs(prop, "rna_Image_ptex_regions_begin",
+ "rna_iterator_array_next",
+ "rna_Image_ptex_regions_end",
+ "rna_iterator_array_get",
+ NULL, NULL, NULL, NULL);
+#else
+ prop = RNA_def_property(srna, "ptex_regions", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 1, NULL);
+ RNA_def_property_ui_text(prop, "Ptex Regions", "");
+ RNA_def_property_dynamic_array_funcs(prop,
+ "rna_Image_ptex_regions_get_length");
+ RNA_def_property_int_funcs(prop, "rna_Image_ptex_regions_get",
+ "rna_Image_ptex_regions_set", NULL);
+#endif
+
prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer");
More information about the Bf-blender-cvs
mailing list