diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-03 02:45:11 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-03 02:45:11 +0300 |
commit | 8f1847e4c33f4276c6aaf123e658f9d2043f7dcb (patch) | |
tree | 76fc524250b9a54069931c3d50e8c379fc6b982f /source | |
parent | d27c9f9d76752bffdcdf60812ee05f48482bccfc (diff) |
RNA: review of commits in the past days, check the diffs for the
many small changes, but the two bigger ones are:
* Sensors and controllers now use inheritance, rather than pointing
to the data in a separate struct. Had to add some new RNA define
functionality to support this better.
* DNA_meta_types.h was marked as done but still missing many things,
now completed.
Diffstat (limited to 'source')
25 files changed, 564 insertions, 450 deletions
diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h index 33b8efa8dd5..b90e853d772 100644 --- a/source/blender/makesdna/DNA_vfont_types.h +++ b/source/blender/makesdna/DNA_vfont_types.h @@ -40,7 +40,6 @@ typedef struct VFont { ID id; char name[256]; - float scale, pad; struct VFontData *data; struct PackedFile * packedfile; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 8c296dce5f2..dc9b8b251bc 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -37,13 +37,15 @@ extern BlenderRNA BLENDER_RNA; extern StructRNA RNA_Actuator; extern StructRNA RNA_ActuatorSensor; +extern StructRNA RNA_AlwaysSensor; +extern StructRNA RNA_AndController; extern StructRNA RNA_BooleanProperty; extern StructRNA RNA_Brush; -extern StructRNA RNA_BrushClone; extern StructRNA RNA_Camera; extern StructRNA RNA_CharInfo; extern StructRNA RNA_CollectionProperty; extern StructRNA RNA_CollisionSensor; +extern StructRNA RNA_Controller; extern StructRNA RNA_Curve; extern StructRNA RNA_CurveMap; extern StructRNA RNA_CurveMapPoint; @@ -51,11 +53,12 @@ extern StructRNA RNA_CurveMapping; extern StructRNA RNA_DelaySensor; extern StructRNA RNA_EnumProperty; extern StructRNA RNA_EnumPropertyItem; +extern StructRNA RNA_ExpressionController; extern StructRNA RNA_FloatProperty; -extern StructRNA RNA_GameProperty; extern StructRNA RNA_GameBooleanProperty; extern StructRNA RNA_GameFloatProperty; extern StructRNA RNA_GameIntProperty; +extern StructRNA RNA_GameProperty; extern StructRNA RNA_GameStringProperty; extern StructRNA RNA_GameTimeProperty; extern StructRNA RNA_Group; @@ -94,19 +97,23 @@ extern StructRNA RNA_Material; extern StructRNA RNA_Mesh; extern StructRNA RNA_MessageSensor; extern StructRNA RNA_MetaBall; -extern StructRNA RNA_MetaElem; +extern StructRNA RNA_MetaElement; extern StructRNA RNA_ModifierData; extern StructRNA RNA_MouseSensor; +extern StructRNA RNA_NandController; extern StructRNA RNA_NearSensor; extern StructRNA RNA_Node; extern StructRNA RNA_NodeTree; +extern StructRNA RNA_NorController; extern StructRNA RNA_Object; extern StructRNA RNA_Operator; +extern StructRNA RNA_OrController; extern StructRNA RNA_PackedFile; extern StructRNA RNA_Panel; extern StructRNA RNA_PointerProperty; extern StructRNA RNA_Property; extern StructRNA RNA_PropertySensor; +extern StructRNA RNA_PythonController; extern StructRNA RNA_RadarSensor; extern StructRNA RNA_Radiosity; extern StructRNA RNA_RandomSensor; @@ -123,9 +130,11 @@ extern StructRNA RNA_Struct; extern StructRNA RNA_TextBox; extern StructRNA RNA_TouchSensor; extern StructRNA RNA_UnknownType; -extern StructRNA RNA_VFont; +extern StructRNA RNA_VectorFont; extern StructRNA RNA_WindowManager; extern StructRNA RNA_World; +extern StructRNA RNA_XnorController; +extern StructRNA RNA_XorController; /* Pointer * diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 9c616f25762..9764a24393c 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -41,6 +41,7 @@ void RNA_exit(void); StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from, const char *name); void RNA_def_struct_sdna(StructRNA *srna, const char *structname); +void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname); void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop); void RNA_def_struct_flag(StructRNA *srna, int flag); void RNA_def_struct_funcs(StructRNA *srna, const char *notify, const char *refine); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index cf779b42fec..03b1855cefb 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -115,6 +115,14 @@ static void rna_print_c_string(FILE *f, const char *str) fprintf(f, "\""); } +static void rna_print_data_get(FILE *f, PropertyDefRNA *dp) +{ + if(dp->dnastructfromname && dp->dnastructfromprop) + fprintf(f, " %s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname, dp->dnastructfromname, dp->dnastructfromprop); + else + fprintf(f, " %s *data= (%s*)(ptr->data);\n", dp->dnastructname, dp->dnastructname); +} + static char *rna_alloc_function_name(const char *structname, const char *propname, const char *type) { AllocDefRNA *alloc; @@ -185,7 +193,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr StringPropertyRNA *sprop= (StringPropertyRNA*)prop; fprintf(f, "static void %s(PointerRNA *ptr, char *value)\n", func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); fprintf(f, " BLI_strncpy(value, data->%s, %d);\n", dp->dnaname, sprop->maxlength); fprintf(f, "}\n\n"); break; @@ -194,7 +202,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(prop->arraylength) { fprintf(f, "static %s %s(PointerRNA *ptr, int index)\n", rna_type_type(prop), func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); if(dp->dnaarraylength == 1) { if(prop->type == PROP_BOOLEAN && dp->booleanbit) fprintf(f, " return ((data->%s & (%d<<index)) != 0);\n", dp->dnaname, dp->booleanbit); @@ -212,11 +220,13 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr else { fprintf(f, "static %s %s(PointerRNA *ptr)\n", rna_type_type(prop), func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); if(prop->type == PROP_BOOLEAN && dp->booleanbit) fprintf(f, " return (((data->%s) & %d) != 0);\n", dp->dnaname, dp->booleanbit); else if(prop->type == PROP_ENUM && dp->enumbitflags) fprintf(f, " return ((data->%s) & %d);\n", dp->dnaname, rna_enum_bitmask(prop)); + else if(prop->type == PROP_POINTER && dp->dnapointerlevel == 0) + fprintf(f, " return (%s)&(data->%s);\n", rna_type_type(prop), dp->dnaname); else fprintf(f, " return (%s)(data->%s);\n", rna_type_type(prop), dp->dnaname); fprintf(f, "}\n\n"); @@ -291,7 +301,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr StringPropertyRNA *sprop= (StringPropertyRNA*)prop; fprintf(f, "static void %s(PointerRNA *ptr, const char *value)\n", func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); fprintf(f, " BLI_strncpy(data->%s, value, %d);\n", dp->dnaname, sprop->maxlength); fprintf(f, "}\n\n"); break; @@ -300,7 +310,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(prop->arraylength) { fprintf(f, "static void %s(PointerRNA *ptr, int index, %s value)\n", func, rna_type_type(prop)); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); if(dp->dnaarraylength == 1) { if(prop->type == PROP_BOOLEAN && dp->booleanbit) { fprintf(f, " if(value) data->%s |= (%d<<index);\n", dp->dnaname, dp->booleanbit); @@ -326,7 +336,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr else { fprintf(f, "static void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop)); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); if(prop->type == PROP_BOOLEAN && dp->booleanbit) { fprintf(f, " if(value) data->%s |= %d;\n", dp->dnaname, dp->booleanbit); fprintf(f, " else data->%s &= ~%d;\n", dp->dnaname, dp->booleanbit); @@ -365,12 +375,12 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA fprintf(f, "static int %s(PointerRNA *ptr)\n", func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); fprintf(f, " return strlen(data->%s);\n", dp->dnaname); fprintf(f, "}\n\n"); } else if(prop->type == PROP_COLLECTION) { - if(prop->type == PROP_COLLECTION && (!dp->dnalengthname || !dp->dnaname)) { + if(prop->type == PROP_COLLECTION && (!(dp->dnalengthname || dp->dnalengthfixed)|| !dp->dnaname)) { fprintf(stderr, "rna_def_property_length_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier); DefRNA.error= 1; return NULL; @@ -380,8 +390,11 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA fprintf(f, "static int %s(PointerRNA *ptr)\n", func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); - fprintf(f, " return (data->%s == NULL)? 0: data->%s;\n", dp->dnaname, dp->dnalengthname); + rna_print_data_get(f, dp); + if(dp->dnalengthname) + fprintf(f, " return (data->%s == NULL)? 0: data->%s;\n", dp->dnaname, dp->dnalengthname); + else + fprintf(f, " return (data->%s == NULL)? 0: %d;\n", dp->dnaname, dp->dnalengthfixed); fprintf(f, "}\n\n"); } @@ -403,17 +416,20 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * func= rna_alloc_function_name(srna->identifier, prop->identifier, "begin"); - if(dp->dnalengthname) { + if(dp->dnalengthname || dp->dnalengthfixed) { fprintf(f, "static void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); - fprintf(f, " rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthname); + rna_print_data_get(f, dp); + if(dp->dnalengthname) + fprintf(f, " rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthname); + else + fprintf(f, " rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthfixed); fprintf(f, "}\n\n"); } else { fprintf(f, "static void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func); fprintf(f, "{\n"); - fprintf(f, " %s *data= (%s*)ptr->data;\n", dp->dnastructname, dp->dnastructname); + rna_print_data_get(f, dp); fprintf(f, " rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname); fprintf(f, "}\n\n"); } @@ -502,7 +518,7 @@ static void rna_def_property_funcs(FILE *f, PropertyDefRNA *dp) if(!cprop->begin) cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp); } - else if(dp->dnalengthname) { + else if(dp->dnalengthname || dp->dnalengthfixed) { if(!cprop->begin) cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp); if(!cprop->length) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index d1ac53c4a25..695188b7983 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -74,7 +74,7 @@ static StructRNA *rna_ID_refine(PointerRNA *ptr) case ID_OB: return &RNA_Object; case ID_SCE: return &RNA_Scene; case ID_SCR: return &RNA_Screen; - case ID_VF: return &RNA_VFont; + case ID_VF: return &RNA_VectorFont; case ID_WO: return &RNA_World; case ID_WM: return &RNA_WindowManager; default: return &RNA_ID; @@ -157,7 +157,7 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_struct_funcs(srna, NULL, "rna_ID_refine"); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, "ID", "name"); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* must be unique */ RNA_def_property_ui_text(prop, "Name", "Unique datablock ID name."); RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set"); RNA_def_property_string_maxlength(prop, 22); diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index b8516123452..90550022cc5 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -41,7 +41,7 @@ void RNA_def_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem actuator_types_items[] ={ + static EnumPropertyItem actuator_type_items[] ={ {ACT_OBJECT, "OBJECT", "Object", ""}, {ACT_IPO, "IPO", "IPO", ""}, {ACT_CAMERA, "CAMERA", "Camera", ""}, @@ -67,14 +67,13 @@ void RNA_def_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "actuator_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Name", "Actuator name."); + RNA_def_property_ui_text(prop, "Name", ""); /* type is not editable, would need to do proper data free/alloc */ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_enum_items(prop, actuator_types_items); - RNA_def_property_ui_text(prop, "Actuator Types", "Actuator types."); + RNA_def_property_enum_items(prop, actuator_type_items); + RNA_def_property_ui_text(prop, "Type", ""); } diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 5439c13971e..dee2f11cb7e 100755 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -35,35 +35,6 @@ #else -void rna_def_brushclone(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna= RNA_def_struct(brna, "BrushClone", "ID", "BrushClone"); - - /* pointers */ - prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "image"); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_ui_text(prop, "Image", "Image for clone tool."); - - /* Number values */ - /* NOTE: This did not appear to be exposed in the 2.48a user interface. */ - /* - prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR); - RNA_def_property_float_sdna(prop, NULL, "offset"); - RNA_def_property_array(prop, 2); - RNA_def_property_ui_text(prop, "Offset", ""); - RNA_def_property_ui_range(prop, 0.0f , 1.0f, 10.0f, 3.0f); - */ - - prop= RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "alpha"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Opacity", "The amount of opacity of the clone image."); -} - void rna_def_brush(BlenderRNA *brna) { StructRNA *srna; @@ -81,21 +52,20 @@ void rna_def_brush(BlenderRNA *brna) srna= RNA_def_struct(brna, "Brush", "ID", "Brush"); - /* Enums */ + /* enums */ prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_blend_items); RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode."); - /* Number values */ - prop= RNA_def_property(srna, "brush_diameter", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "size"); + /* number values */ + prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 1, 200); - RNA_def_property_ui_text(prop, "Brush diameter", "Diameter of the brush."); + RNA_def_property_ui_text(prop, "Size", "Diameter of the brush."); prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "innerradius"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Falloff", "Falloff radius of the brush"); + RNA_def_property_ui_text(prop, "Falloff", "Falloff radius of the brush."); prop= RNA_def_property(srna, "spacing", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "spacing"); @@ -109,7 +79,6 @@ void rna_def_brush(BlenderRNA *brna) prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "rgb"); - RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Color", ""); RNA_def_property_ui_range(prop, 0.0f , 1.0f, 10.0f, 3.0f); @@ -118,50 +87,67 @@ void rna_def_brush(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Opacity", "The amount of pressure on the brush."); - /* pointers */ - /* XXX: figure out how to link to tex (texact?) */ - - /* - prop= RNA_def_property(srna, "clone", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "clone"); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_ui_text(prop, "Clone", "Clone tool linked to the brush."); - */ - /* flag */ prop= RNA_def_property(srna, "airbrush", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH); - RNA_def_property_ui_text(prop, "Airbrush", "Set brush into airbrush mode."); + RNA_def_property_ui_text(prop, "Airbrush", "Keep applying paint effect while holding mouse (spray)."); - prop= RNA_def_property(srna, "torus", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TORUS); - RNA_def_property_ui_text(prop, "Torus", "Set brush into torus mapping mode."); + RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting."); prop= RNA_def_property(srna, "alpha_pressure", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE); - RNA_def_property_ui_text(prop, "Opacity Pressure", "Set pressure sensitivity for opacity."); + RNA_def_property_ui_text(prop, "Opacity Pressure", "Enable tablet pressure sensitivity for opacity."); prop= RNA_def_property(srna, "size_pressure", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE); - RNA_def_property_ui_text(prop, "Size Pressure", "Set pressure sensitivity for size."); + RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size."); prop= RNA_def_property(srna, "falloff_pressure", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RAD_PRESSURE); - RNA_def_property_ui_text(prop, "Falloff Pressure", "Set pressure sensitivity for falloff."); + RNA_def_property_ui_text(prop, "Falloff Pressure", "Enable tablet pressure sensitivity for falloff."); prop= RNA_def_property(srna, "spacing_pressure", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACING_PRESSURE); - RNA_def_property_ui_text(prop, "Spacing Pressure", "Set pressure sensitivity for spacing."); + RNA_def_property_ui_text(prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing."); + /* not exposed in the interface yet prop= RNA_def_property(srna, "fixed_tex", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX); - RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position."); + RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position.");*/ + + /* texture */ + prop= RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "mtex", ""); + RNA_def_property_struct_type(prop, "UnknownType"); + RNA_def_property_ui_text(prop, "Textures Slots", ""); + + prop= RNA_def_property(srna, "active_texture", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "texact"); + RNA_def_property_range(prop, 0, MAX_MTEX-1); + RNA_def_property_ui_text(prop, "Active Texture", "Active texture index."); + + /* clone tool */ + prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "clone.image"); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_ui_text(prop, "Image", "Image for clone tool."); + + prop= RNA_def_property(srna, "clone_opacity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "clone.alpha"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Clone Opacity", "Opacity of clone image display."); + + prop= RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "clone.offset"); + RNA_def_property_ui_text(prop, "Clone Offset", ""); + RNA_def_property_ui_range(prop, -1.0f , 1.0f, 10.0f, 3.0f); } void RNA_def_brush(BlenderRNA *brna) { rna_def_brush(brna); - rna_def_brushclone(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 153397f0bd7..f5ee073b663 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -129,15 +129,12 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Degrees", "Use degrees instead of mm as the unit of the Camera lens."); /* Pointers */ - - prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Ipo"); - RNA_def_property_ui_text(prop, "Ipo Curve", ""); + rna_def_ipo_common(srna); prop= RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_sdna(prop, NULL, "dof_ob"); - RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define depth of field focal point."); + RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point."); } #endif diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index ec4ca1216a0..3b52069f556 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -33,31 +33,40 @@ #include "DNA_controller_types.h" #ifdef RNA_RUNTIME -static struct StructRNA* rna_Controller_data_type(struct PointerRNA *ptr) + +static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr) { bController *controller= (bController*)ptr->data; - switch(controller->type){ + + switch(controller->type) { case CONT_LOGIC_AND: + return &RNA_AndController; case CONT_LOGIC_OR: + return &RNA_OrController; case CONT_LOGIC_NAND: + return &RNA_NandController; case CONT_LOGIC_NOR: + return &RNA_NorController; case CONT_LOGIC_XOR: + return &RNA_XorController; case CONT_LOGIC_XNOR: - return &RNA_UnknownType; + return &RNA_XnorController; case CONT_EXPRESSION: - return &RNA_ExpressionCont; + return &RNA_ExpressionController; case CONT_PYTHON: - return &RNA_PythonCont; + return &RNA_PythonController; + default: + return &RNA_Controller; } - return &RNA_UnknownType; } + #else void RNA_def_controller(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem controller_types_items[] ={ + static EnumPropertyItem controller_type_items[] ={ {CONT_LOGIC_AND, "LOGICAND", "Logic And", ""}, {CONT_LOGIC_OR, "LOGICOR", "Logic Or", ""}, {CONT_LOGIC_NAND, "LOGICNAND", "Logic Nand", ""}, @@ -68,38 +77,45 @@ void RNA_def_controller(BlenderRNA *brna) {CONT_PYTHON, "PYTHON", "Python Script", ""}, {0, NULL, NULL, NULL}}; + /* Controller */ srna= RNA_def_struct(brna, "Controller", NULL , "Controller"); RNA_def_struct_sdna(srna, "bController"); + RNA_def_struct_funcs(srna, NULL, "rna_Controller_refine"); - prop= RNA_def_property(srna, "controller_name", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Name", "Controller name."); + prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_struct_name_property(srna, prop); /* type is not editable, would need to do proper data free/alloc */ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_enum_items(prop, controller_types_items); - RNA_def_property_ui_text(prop, "Controller Types", "Controller types."); - - prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); - RNA_def_property_ui_text(prop, "Data", "Controller data."); - RNA_def_property_pointer_funcs(prop, NULL, "rna_Controller_data_type", NULL); + RNA_def_property_enum_items(prop, controller_type_items); + RNA_def_property_ui_text(prop, "Type", ""); - srna= RNA_def_struct(brna, "ExpressionCont", NULL , "ExpressionCont"); - RNA_def_struct_sdna(srna, "bExpressionCont"); + /* Expression Controller */ + srna= RNA_def_struct(brna, "ExpressionController", "Controller", "Expression Controller"); + RNA_def_struct_sdna_from(srna, "bExpressionCont", "data"); prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "str"); RNA_def_property_string_maxlength(prop, 127); - RNA_def_property_ui_text(prop, "Expression", "Expression."); + RNA_def_property_ui_text(prop, "Expression", ""); - srna= RNA_def_struct(brna, "PythonCont", NULL , "PythonCont"); - RNA_def_struct_sdna(srna, "bPythonCont"); + /* Python Controller */ + srna= RNA_def_struct(brna, "PythonController", "Controller" , "Python Controller"); + RNA_def_struct_sdna_from(srna, "bPythonCont", "data"); prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ID"); - RNA_def_property_ui_text(prop, "Python Text", "Python text."); + RNA_def_property_ui_text(prop, "Python Text", ""); + + /* Other Controllers */ + RNA_def_struct(brna, "AndController", "Controller", "And Controller"); + RNA_def_struct(brna, "OrController", "Controller", "Or Controller"); + RNA_def_struct(brna, "NorController", "Controller", "Nor Controller"); + RNA_def_struct(brna, "NandController", "Controller", "Nand Controller"); + RNA_def_struct(brna, "XorController", "Controller", "Xor Controller"); + RNA_def_struct(brna, "XnorController", "Controller", "Xnor Controller"); } #endif diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index e877548ab76..f7db5bc1c45 100755 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -33,6 +33,12 @@ #ifdef RNA_RUNTIME +static int rna_Curve_texspace_editable(PointerRNA *ptr) +{ + Curve *cu= (Curve*)ptr->data; + return (cu->texflag & CU_AUTOSPACE)? PROP_NOT_EDITABLE: 0; +} + #else static void rna_def_path(BlenderRNA *brna, StructRNA *srna); @@ -45,6 +51,9 @@ void rna_def_curve(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "Curve", "ID", "Curve"); + + rna_def_ipo_common(srna); + rna_def_texmat_common(srna, "rna_Curve_texspace_editable"); rna_def_path(brna, srna); rna_def_nurbs(brna, srna); @@ -102,10 +111,6 @@ void rna_def_curve(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "taperobj"); RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width)."); - prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Ipo"); - RNA_def_property_ui_text(prop, "Ipo Curve", ""); - /* Flags */ prop= RNA_def_property(srna, "3d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_3D); @@ -227,7 +232,7 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna) RNA_def_property_ui_text(prop, "Family", "Blender uses font from selfmade objects."); prop= RNA_def_property(srna, "str", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, "Curve", "str"); + RNA_def_property_string_sdna(prop, NULL, "str"); RNA_def_property_ui_text(prop, "String", ""); RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set"); RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */ @@ -240,7 +245,7 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna) 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, "VFont"); + RNA_def_property_struct_type(prop, "VectorFont"); RNA_def_property_pointer_sdna(prop, NULL, "vfont"); RNA_def_property_ui_text(prop, "Font", ""); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 203051c09d3..6993167be11 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -249,17 +249,27 @@ static size_t rna_property_type_sizeof(PropertyType type) } } -static PropertyDefRNA *rna_find_def_property(StructRNA *srna, PropertyRNA *prop) +static StructDefRNA *rna_find_def_struct(StructRNA *srna) { StructDefRNA *ds; - PropertyDefRNA *dp; for(ds=DefRNA.structs.first; ds; ds=ds->next) if(ds->srna == srna) - for(dp=ds->properties.first; dp; dp=dp->next) - if(dp->prop == prop) - return dp; + return ds; + + return NULL; +} + +static PropertyDefRNA *rna_find_def_property(StructRNA *srna, PropertyRNA *prop) +{ + StructDefRNA *ds= rna_find_def_struct(srna); + PropertyDefRNA *dp; + if(ds) + for(dp=ds->properties.first; dp; dp=dp->next) + if(dp->prop == prop) + return dp; + return NULL; } @@ -268,7 +278,7 @@ static PropertyDefRNA *rna_find_def_property(StructRNA *srna, PropertyRNA *prop) StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from, const char *name) { StructRNA *srna, *srnafrom= NULL; - StructDefRNA *ds= NULL; + StructDefRNA *ds= NULL, *dsfrom= NULL; PropertyRNA *prop, *propfrom; if(from) { @@ -292,8 +302,10 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * memcpy(srna, srnafrom, sizeof(StructRNA)); srna->properties.first= srna->properties.last= NULL; - if(DefRNA.preprocess) + if(DefRNA.preprocess) { srna->from= (StructRNA*)from; + dsfrom= rna_find_def_struct(srnafrom); + } else srna->from= srnafrom; } @@ -307,6 +319,9 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * ds= MEM_callocN(sizeof(StructDefRNA), "StructDefRNA"); ds->srna= srna; rna_addtail(&DefRNA.structs, ds); + + if(dsfrom) + ds->dnafromname= dsfrom->dnaname; } /* in preprocess, try to find sdna */ @@ -412,6 +427,32 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname) ds->dnaname= structname; } +void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname) +{ + StructDefRNA *ds= DefRNA.structs.last; + + if(!DefRNA.preprocess) { + fprintf(stderr, "RNA_def_struct_sdna_from: only during preprocessing.\n"); + return; + } + + if(!ds->dnaname) { + fprintf(stderr, "RNA_def_struct_sdna_from: %s base struct must know DNA already.\n", structname); + return; + } + + if(!DNA_struct_find_nr(DefRNA.sdna, structname)) { + if(!DefRNA.silent) { + fprintf(stderr, "RNA_def_struct_sdna_from: %s not found.\n", structname); + DefRNA.error= 1; + } + return; + } + + ds->dnafromprop= propname; + ds->dnaname= structname; +} + void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop) { if(prop->type != PROP_STRING) { @@ -899,6 +940,8 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *stru prop->arraylength= 0; dp->dnastructname= structname; + dp->dnastructfromname= ds->dnafromname; + dp->dnastructfromprop= ds->dnafromprop; dp->dnaname= propname; dp->dnatype= smember.type; dp->dnaarraylength= smember.arraylength; @@ -1084,11 +1127,11 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, } if((dp=rna_def_property_sdna(prop, structname, propname))) { - if(prop->arraylength) { + if(prop->arraylength && !lengthpropname) { prop->arraylength= 0; if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_collection_sdna: %s.%s, array not supported for collection type.\n", structname, propname); + fprintf(stderr, "RNA_def_property_collection_sdna: %s.%s, array of collections not supported.\n", structname, propname); DefRNA.error= 1; } } @@ -1107,15 +1150,15 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, if(!structname) structname= ds->dnaname; - if(!rna_find_sdna_member(DefRNA.sdna, structname, lengthpropname, &smember)) { - if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_collection_sdna: %s.%s not found.\n", structname, lengthpropname); - DefRNA.error= 1; + if(lengthpropname[0] == 0 || rna_find_sdna_member(DefRNA.sdna, structname, lengthpropname, &smember)) { + if(lengthpropname[0] == 0) { + dp->dnalengthfixed= prop->arraylength; + prop->arraylength= 0; + } + else { + dp->dnalengthstructname= structname; + dp->dnalengthname= lengthpropname; } - } - else { - dp->dnalengthstructname= structname; - dp->dnalengthname= lengthpropname; cprop->next= (PropCollectionNextFunc)"rna_iterator_array_next"; cprop->end= (PropCollectionEndFunc)"rna_iterator_array_end"; @@ -1125,6 +1168,12 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, else cprop->get= (PropCollectionGetFunc)"rna_iterator_array_get"; } + else { + if(!DefRNA.silent) { + fprintf(stderr, "RNA_def_property_collection_sdna: %s.%s not found.\n", structname, lengthpropname); + DefRNA.error= 1; + } + } } } diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index 972dadae266..54ac834466b 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -50,14 +50,15 @@ void RNA_def_group(BlenderRNA *brna) srna= RNA_def_struct(brna, "Group", "ID", "Group"); - prop= RNA_def_property(srna, "dupli_ofs", PROP_FLOAT, PROP_VECTOR); + prop= RNA_def_property(srna, "dupli_offset", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "dupli_ofs"); RNA_def_property_ui_text(prop, "Dupli Offset", "Offset from the center to use when instancing as DupliGroup."); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL); RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects"); + RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects."); RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, 0); prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 1a893845173..bdbc87c2372 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -40,14 +40,22 @@ typedef struct PropertyDefRNA { struct StructRNA *srna; struct PropertyRNA *prop; + /* struct */ const char *dnastructname; + const char *dnastructfromname; + const char *dnastructfromprop; + + /* property */ const char *dnaname; - const char *dnalengthstructname; - const char *dnalengthname; const char *dnatype; int dnaarraylength; int dnapointerlevel; + /* for finding length of array collections */ + const char *dnalengthstructname; + const char *dnalengthname; + int dnalengthfixed; + int booleanbit; int enumbitflags; } PropertyDefRNA; @@ -58,6 +66,11 @@ typedef struct StructDefRNA { struct StructRNA *srna; const char *dnaname; + + /* for derived structs to find data in some property */ + const char *dnafromname; + const char *dnafromprop; + ListBase properties; } StructDefRNA; @@ -109,7 +122,10 @@ void RNA_def_screen(struct BlenderRNA *brna); void RNA_def_sensor(struct BlenderRNA *brna); void RNA_def_vfont(struct BlenderRNA *brna); void RNA_def_wm(struct BlenderRNA *brna); -void RNA_def_world(BlenderRNA *brna); +void RNA_def_world(struct BlenderRNA *brna); + +void rna_def_ipo_common(struct StructRNA *srna); +void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable); /* ID Properties */ diff --git a/source/blender/makesrna/intern/rna_ipo.c b/source/blender/makesrna/intern/rna_ipo.c index 72878813b2f..9cd3c088a7a 100644 --- a/source/blender/makesrna/intern/rna_ipo.c +++ b/source/blender/makesrna/intern/rna_ipo.c @@ -54,16 +54,13 @@ void rna_def_ipodriver(BlenderRNA *brna) /* String values */ 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", "Bone name or scripting expression."); /* 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."); - } void rna_def_ipocurve(BlenderRNA *brna) @@ -85,30 +82,28 @@ void rna_def_ipocurve(BlenderRNA *brna) srna= RNA_def_struct(brna, "IpoCurve", NULL, "Ipo Curve"); /* Enums */ - prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ipo", 0); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_enum_items(prop, prop_mode_interpolation_items); RNA_def_property_ui_text(prop, "Interpolation", ""); - prop= RNA_def_property(srna, "extend", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "extrap", 0); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_enum_items(prop, prop_mode_extend_items); - RNA_def_property_ui_text(prop, "Extend", ""); + RNA_def_property_ui_text(prop, "Extrapolation", ""); /* Number values */ - + /* can't just edit this most likely .. prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "curval"); - RNA_def_property_ui_text(prop, "Value", "Value of this Ipo Curve at the current frame."); + RNA_def_property_ui_text(prop, "Value", "Value of this Ipo Curve at the current frame.");*/ /* Pointers */ - prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "IpoDriver"); RNA_def_property_pointer_sdna(prop, NULL, "driver"); + RNA_def_property_struct_type(prop, "IpoDriver"); RNA_def_property_ui_text(prop, "Ipo Driver", ""); } @@ -143,8 +138,7 @@ void rna_def_ipo(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Block Type", ""); /* Boolean values */ - - prop= RNA_def_property(srna, "show_key", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "show_keys", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "showkey", 0); RNA_def_property_ui_text(prop, "Show Keys", "Show Ipo Keys."); @@ -153,7 +147,6 @@ void rna_def_ipo(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mute", "Mute this Ipo block."); /* Collection */ - prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "curve", NULL); RNA_def_property_struct_type(prop, "IpoCurve"); diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index a2816d578b0..3d46628b25b 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -233,20 +233,20 @@ void RNA_def_main(BlenderRNA *brna) {"windowmanagers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks."}, {"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks."}, {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks."}, - {"curves", "ID", "rna_Main_curve_begin", "Curves", "Curve datablocks."}, - {"metaballs", "ID", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks."}, + {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks."}, + {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks."}, + {"vfonts", "VectorFont", "rna_Main_vfont_begin", "Vector Fonts", "Vector font datablocks."}, {"textures", "ID", "rna_Main_tex_begin", "Textures", "Texture datablocks."}, - {"ipos", "ID", "rna_Main_ipo_begin", "Ipos", "Ipo datablocks."}, - {"keys", "ID", "rna_Main_key_begin", "Keys", "Key datablocks."}, + {"ipos", "Ipo", "rna_Main_ipo_begin", "Ipos", "Ipo datablocks."}, + {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks."}, {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks."}, + {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks."}, + {"keys", "ID", "rna_Main_key_begin", "Keys", "Key datablocks."}, {"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks."}, - {"vfonts", "ID", "rna_Main_vfont_begin", "VFonts", "VFont datablocks."}, {"texts", "ID", "rna_Main_text_begin", "Texts", "Text datablocks."}, {"sounds", "ID", "rna_Main_sound_begin", "Sounds", "Sound datablocks."}, - {"groups", "ID", "rna_Main_group_begin", "Groups", "Group datablocks."}, {"armatures", "ID", "rna_Main_armature_begin", "Armatures", "Armature datablocks."}, {"actions", "ID", "rna_Main_action_begin", "Actions", "Action datablocks."}, - {"brushes", "ID", "rna_Main_brush_begin", "Brushes", "Brush datablocks."}, {"particles", "ID", "rna_Main_particle_begin", "Particles", "Particle datablocks."}, {NULL, NULL, NULL, NULL, NULL}}; int i; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index a4a132a4ebe..0ef564282eb 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -42,8 +42,9 @@ void RNA_def_material(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {MA_RGB, "RGB", "RGB", ""}, - /*{MA_CMYK, "CMYK", "CMYK", ""}, - {MA_YUV, "YUV", "YUV", ""}, XXX: blender code doesn't support this yet. Commented out */ + /* not used in blender yet + {MA_CMYK, "CMYK", "CMYK", ""}, + {MA_YUV, "YUV", "YUV", ""}, */ {MA_HSV, "HSV", "HSV", ""}, {0, NULL, NULL, NULL}}; static EnumPropertyItem prop_fadeto_mir_items[] = { @@ -178,7 +179,7 @@ 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, "Nodetree", ""); + RNA_def_property_ui_text(prop, "Node Tree", ""); } #endif diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index f4ab7277247..b0d66254c08 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -836,6 +836,46 @@ static void rna_def_mmultires(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Render Level", "Set level to render"); } +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_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "loc"); + RNA_def_property_ui_text(prop, "Texure Space Location", "Texture space location"); + RNA_def_property_funcs(prop, NULL, texspace_editable); + + prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size"); + RNA_def_property_funcs(prop, NULL, texspace_editable); + + /* not supported yet + prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_ROTATION); + RNA_def_property_float(prop, NULL, "rot"); + RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); + RNA_def_property_funcs(prop, NULL, texspace_editable);*/ + + /* 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", ""); +} + +void rna_def_ipo_common(StructRNA *srna) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Ipo Curves", "Ipo curves used by this datablock."); +} + static void rna_def_mesh(BlenderRNA *brna) { StructRNA *srna; @@ -902,34 +942,14 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_range(prop, 1, 80); RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); - prop= RNA_def_property(srna, "novnormalflip", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "no_vnormal_flip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_NOPUNOFLIP); RNA_def_property_ui_text(prop, "No Vertex Normal Flip", "Disables flipping of vertexnormals during render"); - prop= RNA_def_property(srna, "twosided", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "double_sided", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED); RNA_def_property_ui_text(prop, "Double Sided", "Render/display the mesh with double or single sided lighting"); - prop= RNA_def_property(srna, "autotexspace", 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_NONE); - RNA_def_property_float_sdna(prop, NULL, "loc"); - RNA_def_property_ui_text(prop, "Texure Space Location", "Texture space location"); - RNA_def_property_funcs(prop, NULL, "rna_Mesh_texspace_editable"); - - prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "size"); - RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size"); - RNA_def_property_funcs(prop, NULL, "rna_Mesh_texspace_editable"); - - /* not supported yet - prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_NONE); - RNA_def_property_float(prop, NULL, "rot"); - RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); - RNA_def_property_funcs(prop, NULL, "rna_Mesh_texspace_editable");*/ - prop= RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "texcomesh"); RNA_def_property_ui_text(prop, "Texture Space Mesh", "Derive texture coordinates from another mesh"); @@ -938,13 +958,11 @@ 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, "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", ""); - /*prop= RNA_def_property(srna, "key", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Key", "");*/ + + rna_def_texmat_common(srna, "rna_Mesh_texspace_editable"); + rna_def_ipo_common(srna); } void RNA_def_mesh(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 8fe1192f58a..9b88c80d0d4 100755 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -33,9 +33,15 @@ #ifdef RNA_RUNTIME +static int rna_Meta_texspace_editable(PointerRNA *ptr) +{ + MetaBall *mb= (MetaBall*)ptr->data; + return (mb->texflag & AUTOSPACE)? PROP_NOT_EDITABLE: 0; +} + #else -void rna_def_metaelem(BlenderRNA *brna) +void rna_def_metaelement(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -47,46 +53,48 @@ void rna_def_metaelem(BlenderRNA *brna) {MB_CUBE, "CUBE", "Cube", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "MetaElem", "ID", "MetaElem"); + srna= RNA_def_struct(brna, "MetaElement", NULL, "Meta Element"); + RNA_def_struct_sdna(srna, "MetaElem"); - /* Enums */ + /* enums */ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", "Metaball types."); - /* Number values */ - prop= RNA_def_property(srna, "x_dimension", PROP_FLOAT, PROP_NONE); + /* number values */ + prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "x"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Location", ""); + + prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ROTATION); + RNA_def_property_float_sdna(prop, NULL, "quat"); + RNA_def_property_ui_text(prop, "Rotation", ""); + + prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "rad"); + RNA_def_property_ui_text(prop, "Radius", ""); + + prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "expx"); RNA_def_property_range(prop, 0.0f, 20.0f); - RNA_def_property_ui_text(prop, "X Dimension", "X dimension of metaelement. Used for elements such as cubes."); - - prop= RNA_def_property(srna, "y_dimension", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "expy"); - RNA_def_property_range(prop, 0.0f, 20.0f); - RNA_def_property_ui_text(prop, "Y Dimension", "Y dimension of metaelement. Used for elements such as cubes."); - - prop= RNA_def_property(srna, "z_dimension", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "expz"); - RNA_def_property_range(prop, 0.0f, 20.0f); - RNA_def_property_ui_text(prop, "Z Dimension", "Z dimension of metaelement. Used for elements such as cubes."); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Size", "Size of element, use of components depends on element type."); prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "s"); RNA_def_property_range(prop, 0.0f, 10.0f); - RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the metaelement to fill."); + RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the element to fill."); /* flags */ - prop= RNA_def_property(srna, "metaelem_negative", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "negative", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_NEGATIVE); - RNA_def_property_ui_text(prop, "Negative Metaelement", "Set metaball as negative one."); + RNA_def_property_ui_text(prop, "Negative", "Set metaball as negative one."); - prop= RNA_def_property(srna, "metaelem_hide", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_HIDE); - RNA_def_property_ui_text(prop, "Hide Metaelement", "Hide metaball?"); - - prop= RNA_def_property(srna, "metaelem_scale_radius", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_SCALE_RAD); - RNA_def_property_ui_text(prop, "Scale Metaelement Radius", "Scale metaball radius?"); + RNA_def_property_ui_text(prop, "Hide", "Hide element."); } void rna_def_metaball(BlenderRNA *brna) @@ -101,32 +109,41 @@ void rna_def_metaball(BlenderRNA *brna) {0, NULL, NULL, NULL}}; srna= RNA_def_struct(brna, "MetaBall", "ID", "MetaBall"); - - /* Enums */ + + prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "elems", NULL); + RNA_def_property_struct_type(prop, "MetaElement"); + RNA_def_property_ui_text(prop, "Elements", "Meta elements."); + + /* enums */ prop= RNA_def_property(srna, "flag", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_update_items); - RNA_def_property_ui_text(prop, "Update", "Metaball edit update option."); + RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior."); - /* Number values */ - prop= RNA_def_property(srna, "wiresize", PROP_FLOAT, PROP_NONE); + /* number values */ + prop= RNA_def_property(srna, "wire_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "wiresize"); RNA_def_property_range(prop, 0.050f, 1.0f); - RNA_def_property_ui_text(prop, "Wiresize", "Polygonization resolution in the 3D viewport."); + RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport."); - prop= RNA_def_property(srna, "rendersize", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "render_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rendersize"); RNA_def_property_range(prop, 0.050f, 1.0f); - RNA_def_property_ui_text(prop, "Rendersize", "Polygonization resolution in rendering."); + RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering."); prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "thresh"); RNA_def_property_range(prop, 0.0f, 5.0f); - RNA_def_property_ui_text(prop, "Threshold", "Influence of metaelements."); + RNA_def_property_ui_text(prop, "Threshold", "Influence of meta elements."); + + /* materials, textures */ + rna_def_texmat_common(srna, "rna_Meta_texspace_editable"); + rna_def_ipo_common(srna); } void RNA_def_meta(BlenderRNA *brna) { - rna_def_metaelem(brna); + rna_def_metaelement(brna); rna_def_metaball(brna); } diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index c4049eaa885..510e4291259 100755 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -72,19 +72,20 @@ void RNA_def_modifier(BlenderRNA *brna) {0, NULL, NULL, NULL}}; /* data */ - srna= RNA_def_struct(brna, "ModifierData", NULL , "ModifierData"); + srna= RNA_def_struct(brna, "Modifier", NULL , "Object Modifier"); RNA_def_struct_sdna(srna, "ModifierData"); /* strings */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Name", "Name of the modifier."); + RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_struct_name_property(srna, prop); /* enums */ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_enum_sdna(prop, NULL, "type", PROP_DEF_ENUM_BITFLAGS); RNA_def_property_enum_items(prop, type_items); - RNA_def_property_ui_text(prop, "Type", "Specify the type of the modifier."); + RNA_def_property_ui_text(prop, "Type", ""); /* flags */ prop= RNA_def_property(srna, "realtime", PROP_BOOLEAN, PROP_NONE); @@ -99,7 +100,7 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode); RNA_def_property_ui_text(prop, "Editmode", "Use modifier while in the edit mode."); - prop= RNA_def_property(srna, "oncage", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "on_cage", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_OnCage); RNA_def_property_ui_text(prop, "On Cage", "Enable direct editing of modifier control cage."); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a0d6a15d4eb..a4b13b7639b 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -57,7 +57,6 @@ void RNA_def_nodetree(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_text(prop, "Location", ""); - } #endif diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 735d524032f..a224016f0cb 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -34,23 +34,7 @@ #include "DNA_property_types.h" #ifdef RNA_RUNTIME -static struct StructRNA* rna_Object_gameproperties_type(struct CollectionPropertyIterator *iter) -{ - bProperty *property= (bProperty*)iter->ptr.data; - switch(property->type){ - case PROP_BOOL: - return &RNA_GameBooleanProperty; - case PROP_INT: - return &RNA_GameIntProperty; - case PROP_FLOAT: - return &RNA_GameFloatProperty; - case PROP_STRING: - return &RNA_GameStringProperty; - case PROP_TIME: - return &RNA_GameTimeProperty; - } - return &RNA_UnknownType; -} + #else void RNA_def_object(BlenderRNA *brna) @@ -84,25 +68,25 @@ void RNA_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Scale", ""); prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "ModifierData"); - RNA_def_property_ui_text(prop, "Modifiers", "Modifiers of this object."); + RNA_def_property_struct_type(prop, "Modifier"); + RNA_def_property_ui_text(prop, "Modifiers", ""); prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Sensor"); - RNA_def_property_ui_text(prop, "Sensors", "Sensors of this object."); + RNA_def_property_ui_text(prop, "Sensors", ""); prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Controller"); - RNA_def_property_ui_text(prop, "Controller", "Controllers of this object."); + RNA_def_property_ui_text(prop, "Controllers", ""); prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Actuator"); - RNA_def_property_ui_text(prop, "Actuators", "Actuators of this object."); + RNA_def_property_ui_text(prop, "Actuators", ""); - prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "game_properties", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "prop", NULL); - RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, "rna_Object_gameproperties_type", 0, 0, 0); - RNA_def_property_ui_text(prop, "Property", "Properties of this object."); + RNA_def_property_struct_type(prop, "GameProperty"); + RNA_def_property_ui_text(prop, "Game Properties", "Game engine properties."); } #endif diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index 94a16eaf9b9..626bf0bf43d 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -34,6 +34,40 @@ #ifdef RNA_RUNTIME +static StructRNA* rna_GameProperty_refine(struct PointerRNA *ptr) +{ + bProperty *property= (bProperty*)ptr->data; + + switch(property->type){ + case PROP_BOOL: + return &RNA_GameBooleanProperty; + case PROP_INT: + return &RNA_GameIntProperty; + case PROP_FLOAT: + return &RNA_GameFloatProperty; + case PROP_STRING: + return &RNA_GameStringProperty; + case PROP_TIME: + return &RNA_GameTimeProperty; + default: + return &RNA_GameProperty; + } +} + +/* for both float and timer */ +static float rna_GameFloatProperty_value_get(PointerRNA *ptr) +{ + bProperty *prop= (bProperty*)(ptr->data); + return *(float*)(&prop->data); +} + +static void rna_GameFloatProperty_value_set(PointerRNA *ptr, float value) +{ + bProperty *prop= (bProperty*)(ptr->data); + CLAMP(value, -10000.0f, 10000.0f); + *(float*)(&prop->data)= value; +} + #else void RNA_def_gameproperty(BlenderRNA *brna) @@ -41,7 +75,7 @@ void RNA_def_gameproperty(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem gameproperty_types_items[] ={ + static EnumPropertyItem gameproperty_type_items[] ={ {PROP_BOOL, "BOOL", "Boolean", ""}, {PROP_INT, "INT", "Integer", ""}, {PROP_FLOAT, "FLOAT", "Float", ""}, @@ -50,25 +84,26 @@ void RNA_def_gameproperty(BlenderRNA *brna) {0, NULL, NULL, NULL}}; /* Base Struct for GameProperty */ - srna= RNA_def_struct(brna, "GameProperty", NULL , "GameProperty"); + srna= RNA_def_struct(brna, "GameProperty", NULL , "Game Property"); RNA_def_struct_sdna(srna, "bProperty"); + RNA_def_struct_funcs(srna, NULL, "rna_GameProperty_refine"); - prop= RNA_def_property(srna, "gameproperty_name", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Name", "Game Property name."); + prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* must be unique */ + RNA_def_property_ui_text(prop, "Name", "Available as as GameObject attributes in the game engines python api"); + RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_enum_items(prop, gameproperty_types_items); - RNA_def_property_ui_text(prop, "Game Property Types", "Game Property types."); + RNA_def_property_enum_items(prop, gameproperty_type_items); + RNA_def_property_ui_text(prop, "Type", ""); prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG); - RNA_def_property_ui_text(prop, "Debug", "Show debug information for this property."); + RNA_def_property_ui_text(prop, "Debug", "Print debug information for this property."); /* GameBooleanProperty */ - srna= RNA_def_struct(brna, "GameBooleanProperty", "GameProperty" , "GameBooleanProperty"); + srna= RNA_def_struct(brna, "GameBooleanProperty", "GameProperty" , "Game Boolean Property"); RNA_def_struct_sdna(srna, "bProperty"); prop= RNA_def_property(srna, "boolean_value", PROP_BOOLEAN, PROP_NONE); @@ -76,39 +111,41 @@ void RNA_def_gameproperty(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Value", "Property value."); /* GameIntProperty */ - srna= RNA_def_struct(brna, "GameIntProperty", "GameProperty" , "GameIntProperty"); + srna= RNA_def_struct(brna, "GameIntProperty", "GameProperty" , "Game Integer Property"); RNA_def_struct_sdna(srna, "bProperty"); - prop= RNA_def_property(srna, "int_value", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "value", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "data"); RNA_def_property_ui_text(prop, "Value", "Property value."); RNA_def_property_range(prop, -10000, 10000); /* GameFloatProperty */ - srna= RNA_def_struct(brna, "GameFloatProperty", "GameProperty" , "GameFloatProperty"); + srna= RNA_def_struct(brna, "GameFloatProperty", "GameProperty" , "Game Float Property"); RNA_def_struct_sdna(srna, "bProperty"); - prop= RNA_def_property(srna, "float_value", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "data"); RNA_def_property_ui_text(prop, "Value", "Property value."); RNA_def_property_range(prop, -10000, 10000); + RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL); /* GameTimerProperty */ - srna= RNA_def_struct(brna, "GameTimeProperty", "GameProperty" , "GameTimeProperty"); + srna= RNA_def_struct(brna, "GameTimeProperty", "GameProperty" , "Game Time Property"); RNA_def_struct_sdna(srna, "bProperty"); - prop= RNA_def_property(srna, "timer_value", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "data"); RNA_def_property_ui_text(prop, "Value", "Property value."); RNA_def_property_range(prop, -10000, 10000); + RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL); /* GameStringProperty */ - srna= RNA_def_struct(brna, "GameStringProperty", "GameProperty" , "GameStringProperty"); + srna= RNA_def_struct(brna, "GameStringProperty", "GameProperty" , "Game String Property"); RNA_def_struct_sdna(srna, "bProperty"); - prop= RNA_def_property(srna, "string_value", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "poin"); - RNA_def_property_string_maxlength(prop, MAX_PROPSTRING-1); + RNA_def_property_string_maxlength(prop, MAX_PROPSTRING); RNA_def_property_ui_text(prop, "Value", "Property value."); } diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index d311bce54c6..661b813080e 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -34,13 +34,13 @@ #ifdef RNA_RUNTIME -static struct StructRNA* rna_Sensor_data_type(struct PointerRNA *ptr) +static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr) { bSensor *sensor= (bSensor*)ptr->data; switch(sensor->type) { case SENS_ALWAYS: - return &RNA_UnknownType; + return &RNA_AlwaysSensor; case SENS_TOUCH: return &RNA_TouchSensor; case SENS_NEAR: @@ -68,10 +68,8 @@ static struct StructRNA* rna_Sensor_data_type(struct PointerRNA *ptr) case SENS_DELAY: return &RNA_DelaySensor; default: - return &RNA_UnknownType; + return &RNA_Sensor; } - - return &RNA_UnknownType; } #else @@ -80,7 +78,7 @@ void rna_def_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem sensor_types_items[] ={ + static EnumPropertyItem sensor_type_items[] ={ {SENS_ALWAYS, "ALWAYS", "Always", ""}, {SENS_TOUCH, "TOUCH", "Touch", ""}, {SENS_NEAR, "NEAR", "Near", ""}, @@ -97,19 +95,19 @@ void rna_def_sensor(BlenderRNA *brna) {SENS_DELAY, "DELAY", "Delay", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "Sensor", NULL , "Sensor"); + srna= RNA_def_struct(brna, "Sensor", NULL, "Sensor"); RNA_def_struct_sdna(srna, "bSensor"); + RNA_def_struct_funcs(srna, NULL, "rna_Sensor_refine"); - prop= RNA_def_property(srna, "sensor_name", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); + prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Sensor name."); + RNA_def_struct_name_property(srna, prop); /* type is not editable, would need to do proper data free/alloc */ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_enum_items(prop, sensor_types_items); - RNA_def_property_ui_text(prop, "Sensor Types", "Sensor types."); + RNA_def_property_enum_items(prop, sensor_type_items); + RNA_def_property_ui_text(prop, "Type", ""); prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor."); @@ -125,17 +123,14 @@ void rna_def_sensor(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE); RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)."); - prop= RNA_def_property(srna, "freq", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)."); RNA_def_property_range(prop, 0, 10000); +} - - //This add data property to Sensor, and because data can be bMouseSensor, bNearSensor, bAlwaysSensor ... - //rna_Sensor_data_type defines above in runtime section to get its type and proper structure for data - prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); - RNA_def_property_ui_text(prop, "Data", "Sensor data."); - RNA_def_property_pointer_funcs(prop, NULL, "rna_Sensor_data_type", NULL); +void rna_def_always_sensor(BlenderRNA *brna) +{ + RNA_def_struct(brna, "AlwaysSensor", "Sensor", "Always Sensor"); } void rna_def_near_sensor(BlenderRNA *brna) @@ -143,12 +138,11 @@ void rna_def_near_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "NearSensor", NULL , "NearSensor"); - RNA_def_struct_sdna(srna, "bNearSensor"); + srna= RNA_def_struct(brna, "NearSensor", "Sensor" , "Near Sensor"); + RNA_def_struct_sdna_from(srna, "bNearSensor", "data"); prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property."); prop= RNA_def_property(srna, "distance", PROP_INT, PROP_NONE); @@ -158,7 +152,7 @@ void rna_def_near_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "reset_distance", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "resetdist"); - RNA_def_property_ui_text(prop, "Reset", "Reset distance."); + RNA_def_property_ui_text(prop, "Reset Distance", ""); RNA_def_property_range(prop, 0, 10000); } @@ -178,10 +172,11 @@ void rna_def_mouse_sensor(BlenderRNA *brna) {BL_SENS_MOUSE_MOUSEOVER_ANY, "MOUSEOVERANY", "Mouse Over Any", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "MouseSensor", NULL , "MouseSensor"); - RNA_def_struct_sdna(srna, "bMouseSensor"); + srna= RNA_def_struct(brna, "MouseSensor", "Sensor", "Mouse Sensor"); + RNA_def_struct_sdna_from(srna, "bMouseSensor", "data"); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "mouse_event", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type", 0); RNA_def_property_enum_items(prop, mouse_event_items); RNA_def_property_ui_text(prop, "Mouse Event", "Specify the type of event this mouse sensor should trigger on."); } @@ -191,14 +186,13 @@ void rna_def_touch_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "TouchSensor", NULL , "TouchSensor"); - RNA_def_struct_sdna(srna, "bTouchSensor"); + srna= RNA_def_struct(brna, "TouchSensor", "Sensor", "Touch Sensor"); + RNA_def_struct_sdna_from(srna, "bTouchSensor", "data"); 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."); - + RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material."); } void rna_def_keyboard_sensor(BlenderRNA *brna) @@ -206,43 +200,44 @@ void rna_def_keyboard_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "KeyboardSensor", NULL , "KeyboardSensor"); - RNA_def_struct_sdna(srna, "bKeyboardSensor"); + srna= RNA_def_struct(brna, "KeyboardSensor", "Sensor", "Keyboard Sensor"); + RNA_def_struct_sdna_from(srna, "bKeyboardSensor", "data"); prop= RNA_def_property(srna, "key", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Input Key", "Input key code."); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* need better range or enum check */ + RNA_def_property_ui_text(prop, "Key", "Input key code."); RNA_def_property_range(prop, 0, 255); - prop= RNA_def_property(srna, "modifier_key1", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "modifier_key", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* need better range or enum check */ RNA_def_property_int_sdna(prop, NULL, "qual"); - RNA_def_property_ui_text(prop, "First Modifier Key", "Modifier key code."); + RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code."); RNA_def_property_range(prop, 0, 255); - prop= RNA_def_property(srna, "modifier_key2", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "second_modifier_key", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* need better range or enum check */ RNA_def_property_int_sdna(prop, NULL, "qual2"); RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code."); RNA_def_property_range(prop, 0, 255); - prop= RNA_def_property(srna, "target_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "target", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "targetName"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Target Name", "Property that indicates whether to log keystrokes as a string."); + RNA_def_property_ui_text(prop, "Target", "Property that indicates whether to log keystrokes as a string."); - prop= RNA_def_property(srna, "toggle_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "log", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "toggleName"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Toggle Name", "Property that receive the keystrokes in case a string is logged."); + RNA_def_property_ui_text(prop, "Log", "Property that receive the keystrokes in case a string is logged."); - prop= RNA_def_property(srna, "type", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "all_keys", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type", 1); RNA_def_property_ui_text(prop, "All Keys", "Trigger this sensor on any keystroke."); - } void rna_def_property_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_items[] ={ + static EnumPropertyItem prop_type_items[] ={ {SENS_PROP_EQUAL, "PROPEQUAL", "Equal", ""}, {SENS_PROP_NEQUAL, "PROPNEQUAL", "Not Equal", ""}, {SENS_PROP_INTERVAL, "PROPINTERVAL", "Interval", ""}, @@ -250,26 +245,29 @@ void rna_def_property_sensor(BlenderRNA *brna) /* {SENS_PROP_EXPRESSION, "PROPEXPRESSION", "Expression", ""}, NOT_USED_IN_UI */ {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "PropertySensor", NULL , "PropertySensor"); - RNA_def_struct_sdna(srna, "bPropertySensor"); + srna= RNA_def_struct(brna, "PropertySensor", "Sensor", "Property Sensor"); + RNA_def_struct_sdna_from(srna, "bPropertySensor", "data"); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_items); - RNA_def_property_ui_text(prop, "Property Type", "Specify the type of property evaluation type."); + prop= RNA_def_property(srna, "evaluation_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type", 0); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Evaluation Type", "Type of property evaluation."); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Property Name", "Property name."); + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Property", ""); + + prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "value"); + RNA_def_property_ui_text(prop, "Value", "Check for this value in types in Equal or Not Equal types."); - prop= RNA_def_property(srna, "first_value", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "min_value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "value"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "First Value", "Specify the value that checked, or minimum value in Interval Type."); + RNA_def_property_ui_text(prop, "Minimum Value", "Specify minimum value in Interval type."); - prop= RNA_def_property(srna, "second_value", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "max_value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "maxvalue"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Second Value", "Specify maximum value in Interval type."); + RNA_def_property_ui_text(prop, "Maximum Value", "Specify maximum value in Interval type."); } void rna_def_actuator_sensor(BlenderRNA *brna) @@ -277,12 +275,12 @@ void rna_def_actuator_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "ActuatorSensor", NULL , "ActuatorSensor"); - RNA_def_struct_sdna(srna, "bActuatorSensor"); + srna= RNA_def_struct(brna, "ActuatorSensor", "Sensor", "Actuator Sensor"); + RNA_def_struct_sdna_from(srna, "bActuatorSensor", "data"); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Actuator Name", "Actuator name."); + prop= RNA_def_property(srna, "actuator", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Actuator", "Actuator name, actuator active state modifications will be detected."); } void rna_def_delay_sensor(BlenderRNA *brna) @@ -290,8 +288,8 @@ void rna_def_delay_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "DelaySensor", NULL , "DelaySensor"); - RNA_def_struct_sdna(srna, "bDelaySensor"); + srna= RNA_def_struct(brna, "DelaySensor", "Sensor", "Delay Sensor"); + RNA_def_struct_sdna_from(srna, "bDelaySensor", "data"); prop= RNA_def_property(srna, "delay", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "Delay", "Delay in number of logic tics before the positive trigger (default 60 per second)."); @@ -310,23 +308,26 @@ void rna_def_collision_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem prop_type_items[] ={ + {0, "PROPERTY", "Property", ""}, + {1, "MATERIAL", "Material", ""}, + {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "CollisionSensor", NULL , "CollisionSensor"); - RNA_def_struct_sdna(srna, "bCollisionSensor"); + srna= RNA_def_struct(brna, "CollisionSensor", "Sensor", "Collision Sensor"); + RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data"); - prop= RNA_def_property(srna, "property_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Property Name", "Only look for Objects with this property."); - prop= RNA_def_property(srna, "material_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "materialName"); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Material Name", "Only look for Objects with this material."); - prop= RNA_def_property(srna, "type", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL); - RNA_def_property_ui_text(prop, "Material/Property", "Toggle collision on material or property."); + prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode", 0); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Collision Type", "Toggle collision on material or property."); } void rna_def_radar_sensor(BlenderRNA *brna) @@ -334,20 +335,20 @@ void rna_def_radar_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; static EnumPropertyItem axis_items[] ={ - {SENS_RAY_X_AXIS, "RAYX", "+X axis", ""}, - {SENS_RAY_Y_AXIS, "RAYY", "+Y axis", ""}, - {SENS_RAY_Z_AXIS, "RAYZ", "+Z axis", ""}, - {SENS_RAY_NEG_X_AXIS, "RAYNX", "-X axis", ""}, - {SENS_RAY_NEG_Y_AXIS, "RAYNY", "-Y axis", ""}, - {SENS_RAY_NEG_Z_AXIS, "RAYNZ", "-Z axis", ""}, + {SENS_RAY_X_AXIS, "XAXIS", "+X axis", ""}, + {SENS_RAY_Y_AXIS, "YAXIS", "+Y axis", ""}, + {SENS_RAY_Z_AXIS, "ZAXIS", "+Z axis", ""}, + {SENS_RAY_NEG_X_AXIS, "NEGXAXIS", "-X axis", ""}, + {SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", "-Y axis", ""}, + {SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", "-Z axis", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "RadarSensor", NULL , "RadarSensor"); - RNA_def_struct_sdna(srna, "bRadarSensor"); - prop= RNA_def_property(srna, "property_name", PROP_STRING, PROP_NONE); + srna= RNA_def_struct(brna, "RadarSensor", "Sensor", "Radar Sensor"); + RNA_def_struct_sdna_from(srna, "bRadarSensor", "data"); + + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Property Name", "Only look for Objects with this property."); + RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property."); prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, axis_items); @@ -368,59 +369,59 @@ void rna_def_random_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "RandomSensor", NULL , "RandomSensor"); - RNA_def_struct_sdna(srna, "bRandomSensor"); + srna= RNA_def_struct(brna, "RandomSensor", "Sensor", "Random Sensor"); + RNA_def_struct_sdna_from(srna, "bRandomSensor", "data"); prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); RNA_def_property_ui_text(prop, "Seed", "Initial seed of the generator. (Choose 0 for not random)."); - } void rna_def_ray_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem axis_items[] ={ - {SENS_RAY_X_AXIS, "RAYX", "+X axis", ""}, - {SENS_RAY_Y_AXIS, "RAYY", "+Y axis", ""}, - {SENS_RAY_Z_AXIS, "RAYZ", "+Z axis", ""}, - {SENS_RAY_NEG_X_AXIS, "RAYNX", "-X axis", ""}, - {SENS_RAY_NEG_Y_AXIS, "RAYNY", "-Y axis", ""}, - {SENS_RAY_NEG_Z_AXIS, "RAYNZ", "-Z axis", ""}, + {SENS_RAY_X_AXIS, "XAXIS", "+X axis", ""}, + {SENS_RAY_Y_AXIS, "YAXIS", "+Y axis", ""}, + {SENS_RAY_Z_AXIS, "ZAXIS", "+Z axis", ""}, + {SENS_RAY_NEG_X_AXIS, "NEGXAXIS", "-X axis", ""}, + {SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", "-Y axis", ""}, + {SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", "-Z axis", ""}, + {0, NULL, NULL, NULL}}; + static EnumPropertyItem prop_type_items[] ={ + {0, "PROPERTY", "Property", ""}, + {1, "MATERIAL", "Material", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "RaySensor", NULL , "RaySensor"); - RNA_def_struct_sdna(srna, "bRaySensor"); + srna= RNA_def_struct(brna, "RaySensor", "Sensor", "Ray Sensor"); + RNA_def_struct_sdna_from(srna, "bRaySensor", "data"); - prop= RNA_def_property(srna, "property_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "propname"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Property Name", "Only look for Objects with this property."); + RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property."); - prop= RNA_def_property(srna, "material_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "matname"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Material Name", "Only look for Objects with this material."); + RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material."); - prop= RNA_def_property(srna, "type", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL); - RNA_def_property_ui_text(prop, "Material/Property", "Toggle collision on material or property."); + prop= RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode", 0); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Collision Type", "Toggle collision on material or property."); prop= RNA_def_property(srna, "x_ray_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY); RNA_def_property_ui_text(prop, "X-Ray Mode", "Toggle X-Ray option (see through objects that don't have the property)."); prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 10000.0); + RNA_def_property_range(prop, 0.01, 10000.0); RNA_def_property_ui_text(prop, "Range", "Sense objects no farther than this distance."); prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axisflag", PROP_DEF_ENUM_BITFLAGS); + RNA_def_property_enum_sdna(prop, NULL, "axisflag", 0); RNA_def_property_enum_items(prop, axis_items); RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the ray is cast."); - } void rna_def_message_sensor(BlenderRNA *brna) @@ -428,11 +429,10 @@ void rna_def_message_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "MessageSensor", NULL , "MessageSensor"); - RNA_def_struct_sdna(srna, "bMessageSensor"); + srna= RNA_def_struct(brna, "MessageSensor", "Sensor", "Message Sensor"); + RNA_def_struct_sdna_from(srna, "bMessageSensor", "data"); prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Subject", "Optional subject filter: only accept messages with this subject, or empty for all."); } @@ -454,23 +454,22 @@ void rna_def_joystick_sensor(BlenderRNA *brna) {SENS_JOY_NEG_Y_AXIS, "DOWNAXIS", "Down Axis", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "JoystickSensor", NULL , "JoystickSensor"); - RNA_def_struct_sdna(srna, "bJoystickSensor"); + srna= RNA_def_struct(brna, "JoystickSensor", "Sensor", "Joystick Sensor"); + RNA_def_struct_sdna_from(srna, "bJoystickSensor", "data"); prop= RNA_def_property(srna, "joystick_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "joyindex"); - RNA_def_property_ui_text(prop, "Index", "Specify which joystick to use."); + RNA_def_property_ui_text(prop, "Joystick Index", "Specify which joystick to use."); RNA_def_property_range(prop, 0, SENS_JOY_MAXINDEX-1); - prop= RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type", PROP_DEF_ENUM_BITFLAGS); + RNA_def_property_enum_sdna(prop, NULL, "type", 0); RNA_def_property_enum_items(prop, event_type_items); RNA_def_property_ui_text(prop, "Event Type", "The type of event this joystick sensor is triggered on."); - prop= RNA_def_property(srna, "any_event", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "all_events", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_JOY_ANY_EVENT); - RNA_def_property_ui_text(prop, "All (Button/Axis/Hat) Events", "Triggered by all events on this joysticks current type (axis/button/hat)."); + RNA_def_property_ui_text(prop, "All Events", "Triggered by all events on this joysticks current type (axis/button/hat)."); /* Button */ prop= RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE); @@ -490,7 +489,7 @@ void rna_def_joystick_sensor(BlenderRNA *brna) RNA_def_property_range(prop, 0, 32768); prop= RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axisf", PROP_DEF_ENUM_BITFLAGS); + RNA_def_property_enum_sdna(prop, NULL, "axisf", 0); RNA_def_property_enum_items(prop, axis_direction_items); RNA_def_property_ui_text(prop, "Axis Direction", "The direction of the axis."); @@ -506,11 +505,11 @@ void rna_def_joystick_sensor(BlenderRNA *brna) RNA_def_property_range(prop, 0, 12); } - void RNA_def_sensor(BlenderRNA *brna) { rna_def_sensor(brna); + rna_def_always_sensor(brna); rna_def_near_sensor(brna); rna_def_mouse_sensor(brna); rna_def_touch_sensor(brna); diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c index aea084183d5..3dbf6858c50 100755 --- a/source/blender/makesrna/intern/rna_vfont.c +++ b/source/blender/makesrna/intern/rna_vfont.c @@ -40,13 +40,18 @@ void RNA_def_vfont(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "VFont", "ID", "VFont"); - - /* number values */ - prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale"); - RNA_def_property_range(prop, 0.1f, 100.0f); /* TODO: check bounds! */ - RNA_def_property_ui_text(prop, "Font Scale", ""); + srna= RNA_def_struct(brna, "VectorFont", "ID", "Vector Font"); + RNA_def_struct_sdna(srna, "VFont"); + + prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Filename", ""); + + prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); + RNA_def_property_ui_text(prop, "Packed File", ""); } #endif + diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 056815398ae..6e41b8768b5 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -54,66 +54,33 @@ void RNA_def_world(BlenderRNA *brna) {0, NULL, NULL, NULL}}; */ srna= RNA_def_struct(brna, "World", "ID" , "World"); - RNA_def_struct_sdna(srna, "World"); - -/* When MTex and IPO was defined uncomment this section: - prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "ID"); - RNA_def_property_ui_text(prop, "IPO", "IPO associated with this world setting."); + rna_def_ipo_common(srna); +/* prop= RNA_def_property(srna, "mtex", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "MTex"); RNA_def_property_ui_text(prop, "MTex", "MTex associated with this world setting."); */ - /* Horizontal Color */ - prop= RNA_def_property(srna, "horizontal_color_red", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horr"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Horizontal Red Color", "Horizontal red color of this world."); - - prop= RNA_def_property(srna, "horizontal_color_green", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horg"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Horizontal Green Color", "Horizontal green color of this world."); - - prop= RNA_def_property(srna, "horizontal_color_blue", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horb"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Horizontal Blue Color", "Horizontal blue color of this world."); - - /* Zenith Color */ - prop= RNA_def_property(srna, "zenith_color_red", PROP_FLOAT, PROP_NONE); + /* colors */ + prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "horr"); + RNA_def_property_array(prop, 3); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Zenith Red Color", "Zenith red color of this world."); - - prop= RNA_def_property(srna, "zenith_color_green", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horg"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Zenith Green Color", "Zenith green color of this world."); + RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon."); - prop= RNA_def_property(srna, "zenith_color_blue", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horb"); + prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "zenr"); + RNA_def_property_array(prop, 3); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Zenith Blue Color", "Zenith blue color of this world."); + RNA_def_property_ui_text(prop, "Zenith Color", "Color at the zenith."); - /* Ambiant Color */ - prop= RNA_def_property(srna, "ambiant_color_red", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horr"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Ambiant Red Color", "Ambiant red color of this world."); - - prop= RNA_def_property(srna, "ambiant_color_green", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horg"); + prop= RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "ambr"); + RNA_def_property_array(prop, 3); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Ambiant Green Color", "Ambiant green color of this world."); - - prop= RNA_def_property(srna, "ambiant_color_blue", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "horb"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Ambiant Blue Color", "Ambiant blue color of this world."); + RNA_def_property_ui_text(prop, "Ambient Color", ""); /* exp, range */ prop= RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE); @@ -138,7 +105,6 @@ void RNA_def_world(BlenderRNA *brna) prop= RNA_def_property(srna, "real_sky", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYREAL); RNA_def_property_ui_text(prop, "Real Sky", "Renders background with a real horizon."); - } #endif |