Revision: 17708
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17708
Author:   blendix
Date:     2008-12-04 01:07:47 +0100 (Thu, 04 Dec 2008)

Log Message:
-----------
RNA
* Remove some unnecessary defining of struct types for pointers.
* Review of DNA_key_types.h and added Key for Mesh and Curve.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_image.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_ipo.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_key.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_lamp.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_lattice.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_mesh.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_sensor.c

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c      
2008-12-03 23:21:01 UTC (rev 17707)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c      
2008-12-04 00:07:47 UTC (rev 17708)
@@ -54,6 +54,9 @@
 
        rna_def_ipo_common(srna);
        rna_def_texmat_common(srna, "rna_Curve_texspace_editable");
+
+       prop= RNA_def_property(srna, "key", PROP_POINTER, PROP_NONE);
+       RNA_def_property_ui_text(prop, "Shape Keys", "");
        
        rna_def_path(brna, srna);
        rna_def_nurbs(brna, srna);
@@ -102,12 +105,10 @@
        
        /* pointers */
        prop= RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_pointer_sdna(prop, NULL, "bevobj");
        RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that 
defines the bevel shape.");
        
        prop= RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_pointer_sdna(prop, NULL, "taperobj");
        RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that 
defines the taper (width).");
        
@@ -240,17 +241,14 @@
        
        /* pointers */
        prop= RNA_def_property(srna, "text_on_curve", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_pointer_sdna(prop, NULL, "textoncurve");
        RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text 
object.");
        
        prop= RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "VectorFont");
        RNA_def_property_pointer_sdna(prop, NULL, "vfont");
        RNA_def_property_ui_text(prop, "Font", "");
        
        prop= RNA_def_property(srna, "textbox", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "TextBox");
        RNA_def_property_pointer_sdna(prop, NULL, "tb");
        RNA_def_property_ui_text(prop, "Textbox", "");
        
@@ -261,7 +259,6 @@
        */
        /*
        prop= RNA_def_property(srna, "curinfo", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "CharInfo");
        RNA_def_property_pointer_sdna(prop, NULL, "curinfo");
        RNA_def_property_ui_text(prop, "curinfo", "");
        */

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_image.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_image.c      
2008-12-03 23:21:01 UTC (rev 17707)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_image.c      
2008-12-04 00:07:47 UTC (rev 17708)
@@ -128,7 +128,6 @@
 
        prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
-       RNA_def_property_struct_type(prop, "PackedFile");
        RNA_def_property_ui_text(prop, "Packed File", "");
 
        /* booleans */

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_ipo.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_ipo.c        
2008-12-03 23:21:01 UTC (rev 17707)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_ipo.c        
2008-12-04 00:07:47 UTC (rev 17708)
@@ -58,7 +58,6 @@
 
        /* Pointers */
        prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_pointer_sdna(prop, NULL, "ob");
        RNA_def_property_ui_text(prop, "Driver Object", "Object that controls 
this Ipo Driver.");
 }
@@ -103,7 +102,6 @@
        /* Pointers */
        prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "driver");
-       RNA_def_property_struct_type(prop, "IpoDriver");
        RNA_def_property_ui_text(prop, "Ipo Driver", "");
 }
 

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_key.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_key.c        
2008-12-03 23:21:01 UTC (rev 17707)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_key.c        
2008-12-04 00:07:47 UTC (rev 17708)
@@ -29,9 +29,39 @@
 
 #include "rna_internal.h"
 
+#include "DNA_ID.h"
+#include "DNA_curve_types.h"
 #include "DNA_key_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 
 #ifdef RNA_RUNTIME
+
+static Key *rna_ShapeKey_find_key(ID *id)
+{
+       switch(GS(id->name)) {
+               case ID_CU: return ((Curve*)id)->key;
+               case ID_KE: return (Key*)id;
+               case ID_LT: return ((Lattice*)id)->key;
+               case ID_ME: return ((Mesh*)id)->key;
+               default: return NULL;
+       }
+}
+
+static void *rna_ShapeKey_relative_key_get(PointerRNA *ptr)
+{
+       Key *key= rna_ShapeKey_find_key(ptr->id.data);
+       KeyBlock *kb= (KeyBlock*)ptr->data, *kbrel;
+       int a;
+
+       if(key && kb->relative < key->totkey)
+               for(a=0, kbrel=key->block.first; kbrel; kbrel=kbrel->next, a++)
+                       if(a == kb->relative)
+                               return kbrel;
+
+       return NULL;
+}
+
 #else
 
 void RNA_def_keyblock(BlenderRNA *brna)
@@ -45,49 +75,52 @@
                {KEY_BSPLINE, "KEY_BSPLINE", "BSpline", ""},
                {0, NULL, NULL, NULL}};
 
-       srna= RNA_def_struct(brna, "KeyBlock", NULL, "KeyBlock");
+       srna= RNA_def_struct(brna, "ShapeKey", NULL, "Shape Key");
+       RNA_def_struct_sdna(srna, "KeyBlock");
 
-       prop= RNA_def_property(srna, "current_pos", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+       RNA_def_property_ui_text(prop, "Name", "");
+       RNA_def_struct_name_property(srna, prop);
+
+       /* the current value isn't easily editable this way, it's linked to an 
IPO.
+       prop= RNA_def_property(srna, "current_position", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "pos");
-       RNA_def_property_ui_text(prop, "CurrentPosition", "Current Position.");
+       RNA_def_property_ui_text(prop, "Current Position", "");
 
-       prop= RNA_def_property(srna, "current_val", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "current_value", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "curval");
-       RNA_def_property_ui_text(prop, "CurrentValue", "Current Value.");
+       RNA_def_property_ui_text(prop, "Current Value", "");*/
 
-       prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, prop_keyblock_type_items);
-       RNA_def_property_ui_text(prop, "Type", "");
+       RNA_def_property_ui_text(prop, "Interpolation", "Interpolation type.");
 
-       prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-       RNA_def_property_string_sdna(prop, NULL, "name");
-       RNA_def_property_ui_text(prop, "Name", "Current Shape Key name.");
-       RNA_def_property_string_maxlength(prop, 32);
-
        prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "vgroup");
-       RNA_def_property_ui_text(prop, "Vertex Group", "");
-       RNA_def_property_string_maxlength(prop, 32);
+       RNA_def_property_ui_text(prop, "Vertex Group", "Vertex weight group, to 
blend with basis shape.");
 
-       /* XXX couldn't quite figure this one out: shape key number, channel 
code? */
-       prop= RNA_def_property(srna, "channel", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "adrcode");
+       prop= RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
-       RNA_def_property_ui_text(prop, "Channel", "");
+       RNA_def_property_struct_type(prop, "ShapeKey");
+       RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a 
relative key.");
+       RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get", 
NULL, NULL);
 
-       prop= RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
-       RNA_def_property_ui_text(prop, "Relative", "Makes Shape Keys 
relative.");
+       prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
+       RNA_def_property_ui_text(prop, "Mute", "Mute this shape key.");
 
-       prop= RNA_def_property(srna, "slidermin", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "slidermin");
-       RNA_def_property_ui_text(prop, "SliderMin", "Minimum for Slider.");
+       RNA_def_property_range(prop, -10.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Slider Min", "Minimum for slider.");
 
-       prop= RNA_def_property(srna, "slidermax", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "slidermax");
-       RNA_def_property_ui_text(prop, "SliderMax", "Maximum for Slider.");
+       RNA_def_property_range(prop, -10.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider.");
 
+       /* KeyBlock.data has to be wrapped still */
 }
 
 void RNA_def_key(BlenderRNA *brna)
@@ -99,36 +132,29 @@
 
        srna= RNA_def_struct(brna, "Key", "ID", "Key");
 
-       prop= RNA_def_property(srna, "refkey", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "KeyBlock");
+       prop= RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_pointer_sdna(prop, NULL, "refkey");
        RNA_def_property_ui_text(prop, "Reference Key", "");
 
-       prop= RNA_def_property(srna, "keyblocks", PROP_COLLECTION, PROP_NONE);
+       prop= RNA_def_property(srna, "shape_keys", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "block", NULL);
-       RNA_def_property_struct_type(prop, "KeyBlock");
-       RNA_def_property_ui_text(prop, "KeyBlocks", "Key Blocks.");
+       RNA_def_property_struct_type(prop, "ShapeKey");
+       RNA_def_property_ui_text(prop, "Shape Keys", "");
 
-       prop= RNA_def_property(srna, "num_keyblocks", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "totkey");
-       RNA_def_property_ui_text(prop, "NumKeyBlocks", "Number of KeyBlocks.");
-       
-       prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "Ipo");
-       RNA_def_property_ui_text(prop, "Ipo", "");
+       rna_def_ipo_common(srna);
 
        prop= RNA_def_property(srna, "from", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "ID");
-       RNA_def_property_ui_text(prop, "From", "");

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to