diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index b17e1f14740..46230815178 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -35,6 +35,8 @@ #include "WM_types.h" +#include "BLI_utildefines.h" + /* Always keep in alphabetical order */ EnumPropertyItem actuator_type_items[] ={ {ACT_ACTION, "ACTION", 0, "Action", ""}, @@ -117,6 +119,29 @@ static void rna_Actuator_type_set(struct PointerRNA *ptr, int value) } } +static void rna_ConstraintActuator_type_set(struct PointerRNA *ptr, int value) +{ + bActuator *act= (bActuator *)ptr->data; + bConstraintActuator *ca= act->data; + if (value != ca->type) + { + ca->type = value; + switch (ca->type) { + case ACT_CONST_TYPE_ORI: + /* negative axis not supported in the orientation mode */ + if (ELEM3(ca->mode, ACT_CONST_DIRNX,ACT_CONST_DIRNY, ACT_CONST_DIRNZ)) + ca->mode = ACT_CONST_NONE; + break; + + case ACT_CONST_TYPE_LOC: + case ACT_CONST_TYPE_DIST: + case ACT_CONST_TYPE_FH: + default: + break; + } + } +} + static float rna_ConstraintActuator_limitmin_get(struct PointerRNA *ptr) { bActuator *act = (bActuator*)ptr->data; @@ -1076,6 +1101,14 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem prop_direction_pos_items[] ={ + {ACT_CONST_NONE, "NONE", 0, "None", ""}, + {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""}, + {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""}, + {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to handle Constraints"); RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data"); @@ -1083,6 +1116,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_ConstraintActuator_type_set", NULL); RNA_def_property_ui_text(prop, "Constraints Mode", "The type of the constraint"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1117,7 +1151,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Max", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "damping", PROP_INT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "damp"); RNA_def_property_ui_range(prop, 0, 100, 1, 1); RNA_def_property_ui_text(prop, "Damping", "Damping factor: time constant (in frame) of low pass filter"); @@ -1154,13 +1188,19 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Time", "Maximum activation time in frame, 0 for unlimited"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rotdamp"); RNA_def_property_ui_range(prop, 0, 100, 1, 1); RNA_def_property_ui_text(prop, "rotDamp", "Use a different damping for orientation"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_CONST_TYPE_ORI */ + prop= RNA_def_property(srna, "direction_axis_pos", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, prop_direction_pos_items); + RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "rotation_max", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "maxrot"); RNA_def_property_array(prop, 3); @@ -1168,16 +1208,16 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); - RNA_def_property_ui_range(prop, 0.0, 180.0, 10, 2); - RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_range(prop, 0.0, 180.0); + RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to maintain with target direction. No correction is done if angle with target direction is between min and max"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "maxloc[0]"); - RNA_def_property_ui_range(prop, 0.0, 180.0, 10, 2); - RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_range(prop, 0.0, 180.0); + RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle allowed with target direction. No correction is done if angle with target direction is between min and max"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_CONST_TYPE_FH */ @@ -1187,7 +1227,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Distance", "Height of the Fh area"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "spring", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "spring", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL); RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2); RNA_def_property_ui_text(prop, "Fh", "Spring force within the Fh area"); |