* Remove some unnecessary defining of struct types for pointers.
* Review of DNA_key_types.h and added Key for Mesh and Curve.
This commit is contained in:
Brecht Van Lommel
2008-12-04 00:07:47 +00:00
parent 853f2b0647
commit 8fc5d6e7de
11 changed files with 83 additions and 73 deletions

View File

@@ -54,6 +54,9 @@ void rna_def_curve(BlenderRNA *brna)
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 @@ void rna_def_curve(BlenderRNA *brna)
/* 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 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
/* 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 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
*/
/*
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", "");
*/

View File

@@ -128,7 +128,6 @@ static void rna_def_image(BlenderRNA *brna)
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 */

View File

@@ -58,7 +58,6 @@ void rna_def_ipodriver(BlenderRNA *brna)
/* 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 @@ void rna_def_ipocurve(BlenderRNA *brna)
/* 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", "");
}

View File

@@ -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 @@ void RNA_def_keyblock(BlenderRNA *brna)
{KEY_BSPLINE, "KEY_BSPLINE", "BSpline", ""},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "KeyBlock", NULL, "KeyBlock");
prop= RNA_def_property(srna, "current_pos", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "pos");
RNA_def_property_ui_text(prop, "CurrentPosition", "Current Position.");
prop= RNA_def_property(srna, "current_val", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "curval");
RNA_def_property_ui_text(prop, "CurrentValue", "Current Value.");
prop= RNA_def_property(srna, "type", 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", "");
srna= RNA_def_struct(brna, "ShapeKey", NULL, "Shape Key");
RNA_def_struct_sdna(srna, "KeyBlock");
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);
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, "Current Position", "");
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, "Current Value", "");*/
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, "Interpolation", "Interpolation type.");
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 @@ void RNA_def_key(BlenderRNA *brna)
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", "");
RNA_def_property_ui_text(prop, "From", "Datablock using these shape keys.");
prop= RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "type", 1);
RNA_def_property_ui_text(prop, "Relative", "");
RNA_def_property_boolean_sdna(prop, NULL, "type", KEY_RELATIVE);
RNA_def_property_ui_text(prop, "Relative", "Makes shape keys relative.");
prop= RNA_def_property(srna, "slurph", PROP_INT, PROP_NONE);
prop= RNA_def_property(srna, "slurph", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "slurph");
RNA_def_property_ui_text(prop, "Slurph", "");
RNA_def_property_range(prop, -500, 500);
RNA_def_property_ui_text(prop, "Slurph", "Creates a delay in amount of frames in applying keypositions, first vertex goes first.");
}
#endif

View File

@@ -161,7 +161,6 @@ void RNA_def_lamp(BlenderRNA *brna)
prop= RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
RNA_def_property_struct_type(prop, "CurveMapping");
RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
/* Number values */

View File

@@ -82,13 +82,10 @@ void RNA_def_lattice(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE);
RNA_def_property_ui_text(prop, "Outside", "Only draw, and take into account, the outer vertices.");
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, "key", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Key");
RNA_def_property_ui_text(prop, "Key", "");
RNA_def_property_ui_text(prop, "Shape Keys", "");
}
#endif

View File

@@ -178,7 +178,6 @@ void RNA_def_material(BlenderRNA *brna)
/* nodetree */
prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "NodeTree");
RNA_def_property_ui_text(prop, "Node Tree", "");
}

View File

@@ -958,8 +958,8 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "mr");
RNA_def_property_ui_text(prop, "Multires", "");
/*prop= RNA_def_property(srna, "key", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Key", "");*/
prop= RNA_def_property(srna, "key", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Shape Keys", "");
rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
rna_def_ipo_common(srna);

View File

@@ -49,11 +49,9 @@ void RNA_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Data", "Object data.");
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Parent", "Parent Object");
prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track).");
prop= RNA_def_property(srna, "loc", PROP_FLOAT, PROP_VECTOR);

View File

@@ -142,12 +142,10 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Unwrapper", "Unwrap algorithm used by the Unwrap tool.");
prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "NodeTree");
RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree.");
prop= RNA_def_property(srna, "radiosity", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "radio");
RNA_def_property_struct_type(prop, "Radiosity");
RNA_def_property_ui_text(prop, "Radiosity", "");
}

View File

@@ -191,7 +191,6 @@ void rna_def_touch_sensor(BlenderRNA *brna)
prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ma");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material.");
}