[Bf-blender-cvs] [4259764] cycles-ptex-12: Add RNA access to ptex_coords
Nicholas Bishop
noreply at git.blender.org
Mon Jan 26 02:05:16 CET 2015
Commit: 42597647599477a1741fcfb603cb345ca0890817
Author: Nicholas Bishop
Date: Sun Jan 25 22:47:58 2015 +0100
Branches: cycles-ptex-12
https://developer.blender.org/rB42597647599477a1741fcfb603cb345ca0890817
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..82f3e70 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -377,6 +377,57 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
BKE_image_release_ibuf(ima, ibuf, lock);
}
+// TODO
+static void rna_Image_ptex_table_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
+{
+ Image *image = (Image *)ptr->id.data;
+ rna_iterator_array_begin(iter, (void *)image->render_slots,
+ sizeof(RenderSlot), IMA_MAX_RENDER_SLOT,
+ 0, NULL);
+}
+
+static int rna_Image_ptex_table_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_coords)
+ length[0] = ibuf->num_ptex_coords*4;
+ else
+ length[0] = 0;
+
+ BKE_image_release_ibuf(ima, ibuf, lock);
+
+ return length[0];
+}
+
+static void rna_Image_ptex_table_get(PointerRNA *ptr, float *values)
+{
+ Image *ima = ptr->id.data;
+ ImBuf *ibuf;
+ void *lock;
+
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+
+ if (ibuf && ibuf->ptex_coords) {
+ memcpy(values, ibuf->ptex_coords,
+ sizeof(*values) * ibuf->num_ptex_coords * 4);
+ }
+
+ BKE_image_release_ibuf(ima, ibuf, lock);
+}
+
+static void rna_Image_ptex_table_set(PointerRNA *UNUSED(ptr), const float *UNUSED(values))
+{
+ BLI_assert(!"rna_Image_ptex_table_set not implemented");
+}
+//
+
static int rna_Image_channels_get(PointerRNA *ptr)
{
Image *im = (Image *)ptr->data;
@@ -800,6 +851,14 @@ 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
+ prop = RNA_def_property(srna, "ptex_table", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 1, NULL);
+ RNA_def_property_ui_text(prop, "Ptex Table", "");
+ RNA_def_property_dynamic_array_funcs(prop, "rna_Image_ptex_table_get_length");
+ RNA_def_property_float_funcs(prop, "rna_Image_ptex_table_get", "rna_Image_ptex_table_set", NULL);
+
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