Revision: 28146
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28146
Author:   broken
Date:     2010-04-12 07:04:49 +0200 (Mon, 12 Apr 2010)

Log Message:
-----------
Fix [#21953] Texture space size seems not updated constantly

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_curve.c
    trunk/blender/source/blender/makesrna/intern/rna_mesh.c
    trunk/blender/source/blender/makesrna/intern/rna_meta.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_curve.c    2010-04-12 
03:06:49 UTC (rev 28145)
+++ trunk/blender/source/blender/makesrna/intern/rna_curve.c    2010-04-12 
05:04:49 UTC (rev 28146)
@@ -59,6 +59,8 @@
 
 #ifdef RNA_RUNTIME
 
+#include "BLI_math.h"
+
 #include "DNA_object_types.h"
 
 #include "BKE_curve.h"
@@ -139,6 +141,40 @@
        return (cu->texflag & CU_AUTOSPACE)? 0: PROP_EDITABLE;
 }
 
+static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values)
+{
+       Curve *cu= (Curve *)ptr->data;
+       
+       if (!cu->bb)
+               tex_space_curve(cu);
+       
+       copy_v3_v3(values, cu->loc);
+}
+
+static void rna_Curve_texspace_loc_set(PointerRNA *ptr, const float *values)
+{
+       Curve *cu= (Curve *)ptr->data;
+       
+       copy_v3_v3(cu->loc, values);
+}
+
+static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values)
+{
+       Curve *cu= (Curve *)ptr->data;
+       
+       if (!cu->bb)
+               tex_space_curve(cu);
+       
+       copy_v3_v3(values, cu->size);
+}
+
+static void rna_Curve_texspace_size_set(PointerRNA *ptr, const float *values)
+{
+       Curve *cu= (Curve *)ptr->data;
+       
+       copy_v3_v3(cu->size, values);
+}
+
 static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max)
 {
        Curve *cu= (Curve*)ptr->id.data;
@@ -1002,7 +1038,6 @@
        RNA_def_struct_refine_func(srna, "rna_Curve_refine");
        
        rna_def_animdata_common(srna);
-       rna_def_texmat_common(srna, "rna_Curve_texspace_editable");
 
        prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "key");
@@ -1138,6 +1173,38 @@
        RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_DEFORM_FILL);
        RNA_def_property_ui_text(prop, "Fill deformed", "Fill curve after 
applying deformation");
        RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+       
+       /* texture space */
+       prop= RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE);
+       RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active 
object's texture space automatically when transforming object");
+       
+       prop= RNA_def_property(srna, "texspace_loc", PROP_FLOAT, 
PROP_TRANSLATION);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Texure Space Location", "Texture space 
location");
+       RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
+       RNA_def_property_float_funcs(prop, "rna_Curve_texspace_loc_get", 
"rna_Curve_texspace_loc_set", NULL);   
+       RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+       
+       prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space 
size");
+       RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
+       RNA_def_property_float_funcs(prop, "rna_Curve_texspace_size_get", 
"rna_Curve_texspace_size_set", NULL);
+       RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+       
+       /* not supported yet
+        prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+        RNA_def_property_float(prop, NULL, "rot");
+        RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture 
space rotation");
+        RNA_def_property_editable_func(prop, texspace_editable);
+        RNA_def_property_update(prop, 0, "rna_Curve_update_data");*/
+       
+       /* materials */
+       prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+       RNA_def_property_struct_type(prop, "Material");
+       RNA_def_property_ui_text(prop, "Materials", "");
 }
 
 static void rna_def_curve_nurb(BlenderRNA *brna)

Modified: trunk/blender/source/blender/makesrna/intern/rna_mesh.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_mesh.c     2010-04-12 
03:06:49 UTC (rev 28145)
+++ trunk/blender/source/blender/makesrna/intern/rna_mesh.c     2010-04-12 
05:04:49 UTC (rev 28146)
@@ -226,6 +226,40 @@
        return (me->texflag & AUTOSPACE)? 0: PROP_EDITABLE;
 }
 
+static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float *values)
+{
+       Mesh *me= (Mesh *)ptr->data;
+       
+       if (!me->bb)
+               tex_space_mesh(me);
+       
+       copy_v3_v3(values, me->loc);
+}
+
+static void rna_Mesh_texspace_loc_set(PointerRNA *ptr, const float *values)
+{
+       Mesh *me= (Mesh *)ptr->data;
+       
+       copy_v3_v3(me->loc, values);
+}
+
+static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float *values)
+{
+       Mesh *me= (Mesh *)ptr->data;
+       
+       if (!me->bb)
+               tex_space_mesh(me);
+       
+       copy_v3_v3(values, me->size);
+}
+
+static void rna_Mesh_texspace_size_set(PointerRNA *ptr, const float *values)
+{
+       Mesh *me= (Mesh *)ptr->data;
+       
+       copy_v3_v3(me->size, values);
+}
+
 static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, 
PointerRNA *ptr)
 {
        Mesh *me= (Mesh*)ptr->id.data;
@@ -1564,42 +1598,6 @@
        RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
 
-void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
-{
-       PropertyRNA *prop;
-
-       /* texture space */
-       prop= RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE);
-       RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active 
object's texture space automatically when transforming object");
-
-       prop= RNA_def_property(srna, "texspace_loc", PROP_FLOAT, 
PROP_TRANSLATION);
-       RNA_def_property_float_sdna(prop, NULL, "loc");
-       RNA_def_property_ui_text(prop, "Texure Space Location", "Texture space 
location");
-       RNA_def_property_editable_func(prop, texspace_editable);
-       RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-
-       prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
-       RNA_def_property_float_sdna(prop, NULL, "size");
-       RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space 
size");
-       RNA_def_property_editable_func(prop, texspace_editable);
-       RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-
-       /* not supported yet
-       prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
-       RNA_def_property_float(prop, NULL, "rot");
-       RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space 
rotation");
-       RNA_def_property_editable_func(prop, texspace_editable);
-       RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/
-
-       /* materials */
-       prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
-       RNA_def_property_struct_type(prop, "Material");
-       RNA_def_property_ui_text(prop, "Materials", "");
-}
-
-
 /* scene.objects */
 static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
 {
@@ -1766,6 +1764,38 @@
        RNA_def_property_pointer_sdna(prop, NULL, "key");
        RNA_def_property_ui_text(prop, "Shape Keys", "");
        
+       /* texture space */
+       prop= RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE);
+       RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active 
object's texture space automatically when transforming object");
+       
+       prop= RNA_def_property(srna, "texspace_loc", PROP_FLOAT, 
PROP_TRANSLATION);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Texure Space Location", "Texture space 
location");
+       RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
+       RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", 
"rna_Mesh_texspace_loc_set", NULL);     
+       RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+       
+       prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space 
size");
+       RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
+       RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", 
"rna_Mesh_texspace_size_set", NULL);
+       RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+       
+       /* not supported yet
+        prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+        RNA_def_property_float(prop, NULL, "rot");
+        RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture 
space rotation");
+        RNA_def_property_editable_func(prop, texspace_editable);
+        RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/
+       
+       /* materials */
+       prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+       RNA_def_property_struct_type(prop, "Material");
+       RNA_def_property_ui_text(prop, "Materials", "");
+       
        /* Mesh Draw Options for Edit Mode*/
        
        prop= RNA_def_property(srna, "draw_edges", PROP_BOOLEAN, PROP_NONE);
@@ -1871,7 +1901,6 @@
 
        /* pointers */
        rna_def_animdata_common(srna);
-       rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
 
        RNA_api_mesh(srna);
 }

Modified: trunk/blender/source/blender/makesrna/intern/rna_meta.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_meta.c     2010-04-12 
03:06:49 UTC (rev 28145)
+++ trunk/blender/source/blender/makesrna/intern/rna_meta.c     2010-04-12 
05:04:49 UTC (rev 28146)
@@ -33,6 +33,8 @@
 
 #ifdef RNA_RUNTIME
 
+#include "BLI_math.h"
+
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
 
@@ -46,9 +48,42 @@
 static int rna_Meta_texspace_editable(PointerRNA *ptr)
 {
        MetaBall *mb= (MetaBall*)ptr->data;
-       return (mb->texflag & AUTOSPACE)? 0: PROP_EDITABLE;
+       return (mb->texflag & MB_AUTOSPACE)? 0: PROP_EDITABLE;
 }
 
+static void rna_Meta_texspace_loc_get(PointerRNA *ptr, float *values)
+{
+       MetaBall *mb= (MetaBall*)ptr->data;
+       
+       /* tex_space_mball() needs object.. ugh */
+       
+       copy_v3_v3(values, mb->loc);
+}
+
+static void rna_Meta_texspace_loc_set(PointerRNA *ptr, const float *values)
+{
+       MetaBall *mb= (MetaBall*)ptr->data;
+       
+       copy_v3_v3(mb->loc, values);
+}
+
+static void rna_Meta_texspace_size_get(PointerRNA *ptr, float *values)
+{
+       MetaBall *mb= (MetaBall*)ptr->data;
+       
+       /* tex_space_mball() needs object.. ugh */
+       
+       copy_v3_v3(values, mb->size);
+}
+
+static void rna_Meta_texspace_size_set(PointerRNA *ptr, const float *values)
+{
+       MetaBall *mb= (MetaBall*)ptr->data;
+       
+       copy_v3_v3(mb->size, values);
+}
+
+
 static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA 
*ptr)
 {
        MetaBall *mb= ptr->id.data;
@@ -190,9 +225,38 @@

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to