diff options
-rw-r--r-- | source/blender/makesdna/DNA_actuator_types.h | 42 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 194 |
2 files changed, 193 insertions, 43 deletions
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 9dbb7ecd998..a3fe14f711f 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -50,7 +50,7 @@ typedef struct bAddObjectActuator { typedef struct bActionActuator { struct bAction *act; /* Pointer to action */ - short type, flag; /* Playback type */ + short type, flag; /* Playback type */ // not in use int sta, end; /* Start & End frames */ char name[32]; /* For property-driven playback */ char frameProp[32]; /* Set this property to the actions current frame */ @@ -58,7 +58,7 @@ typedef struct bActionActuator { short priority; /* Execution priority */ short end_reset; /* Ending the actuator (negative pulse) wont reset the the action to its starting frame */ short strideaxis; /* Displacement axis */ - float stridelength; /* Displacement incurred by cycle */ + float stridelength; /* Displacement incurred by cycle */ // not in use } bActionActuator; typedef struct bSoundActuator { @@ -158,31 +158,12 @@ typedef struct bRandomActuator { } bRandomActuator; typedef struct bMessageActuator { - /** - * Send to all objects with this propertyname. Empty to broadcast. - */ - char toPropName[32]; - - /** - * (Possible future use) pointer to a single destination object. - */ - struct Object *toObject; - - /** - * Message Subject to send. - */ - char subject[32]; - - /** - * bodyType is either 'User defined text' or PropName - */ - short bodyType, pad1; + char toPropName[32]; /* Send to all objects with this propertyname. Empty to broadcast. */ + struct Object *toObject;/* (Possible future use) pointer to a single destination object. */ + char subject[32]; /* Message Subject to send. */ + short bodyType, pad1; /* bodyType is either 'User defined text' or PropName */ int pad2; - - /** - * Either User Defined Text or our PropName to send value of - */ - char body[32]; + char body[32]; /* Either User Defined Text or our PropName to send value of */ } bMessageActuator; typedef struct bGameActuator { @@ -408,7 +389,6 @@ typedef struct FreeCamera { #define ACT_EDOB_LOCAL_LINV 2 #define ACT_EDOB_LOCAL_ANGV 4 - /* editObjectActuator->flag */ #define ACT_TRACK_3D 1 @@ -416,6 +396,14 @@ typedef struct FreeCamera { #define ACT_EDOB_REPLACE_MESH_NOGFX 2 /* use for replace mesh actuator */ #define ACT_EDOB_REPLACE_MESH_PHYS 4 +/* editObjectActuator->dyn_operation */ +#define ACT_EDOB_RESTORE_DYN 0 +#define ACT_EDOB_SUSPEND_DYN 1 +#define ACT_EDOB_ENABLE_RB 2 +#define ACT_EDOB_DISABLE_RB 3 +#define ACT_EDOB_SET_MASS 4 + + /* SceneActuator->type */ #define ACT_SCENE_RESTART 0 #define ACT_SCENE_SET 1 diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index af4f9c250c6..291776c58c9 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -61,8 +61,6 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr) return &RNA_RandomActuator; case ACT_MESSAGE: return &RNA_MessageActuator; -// case ACT_ACTION: -// return &RNA_ActionActuator; case ACT_GAME: return &RNA_GameActuator; case ACT_VISIBILITY: @@ -546,6 +544,14 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem prop_type_items[] ={ + {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""}, + {ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""}, + {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""}, + {ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to .."); RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data"); @@ -559,18 +565,108 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_type_items[] ={ - {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""}, - {ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""}, - {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""}, - {ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""}, - {0, NULL, 0, NULL, NULL} - }; + {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""}, + {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""}, + {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""}, + {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""}, + {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""}, + {0, NULL, 0, NULL, NULL} }; + + static EnumPropertyItem prop_dyn_items[] ={ + {ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""}, + {ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""}, + {ACT_EDOB_ENABLE_RB, "ENABLERIGIDBOBY", 0, "Enable Rigid Body", ""}, + {ACT_EDOB_DISABLE_RB, "DISABLERIGIDBOBY", 0, "Disable Rigid Body", ""}, + {ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""}, + {0, NULL, 0, NULL, NULL} }; srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator to handle real-time constraints"); + RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects"); RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data"); - //XXX + prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "dynamic_operation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "dyn_operation"); + RNA_def_property_enum_items(prop, prop_dyn_items); + RNA_def_property_ui_text(prop, "Dynamic Operation", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + 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_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (cant be on an visible layer)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_pointer_sdna(prop, NULL, "ob"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Track to this Object"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Mesh"); + RNA_def_property_pointer_sdna(prop, NULL, "me"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mesh", "Replace the existing, when left blank 'Phys' will remake the existing physics mesh"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE); + RNA_def_property_ui_range(prop, 0, 2000, 1, 1); + RNA_def_property_ui_text(prop, "Time", "Duration the new Object lives or the track takes"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_range(prop, 0, 10000, 1, 0.01); + RNA_def_property_ui_text(prop, "Mass", "The mass of the object"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* floats 3 Arrays*/ + prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "linVelocity"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_range(prop, -100.0, 100.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Linear Velocity", "Velocity upon creation"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "angVelocity"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1.0, 0.01); + RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity upon creation"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* booleans */ + prop= RNA_def_property(srna, "local_linear_velocity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_LINV); + RNA_def_property_ui_text(prop, "L", "Apply the transformation locally"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "local_angular_velocity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_ANGV); + RNA_def_property_ui_text(prop, "L", "Apply the rotation locally"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "replace_display_mesh", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX); + RNA_def_property_ui_text(prop, "Gfx", "Replace the display mesh"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "replace_physics_mesh", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_PHYS); + RNA_def_property_ui_text(prop, "Phys", "Replace the physics mesh (triangle bounds only - compound shapes not supported)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "enable_3d_tracking", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TRACK_3D); + RNA_def_property_ui_text(prop, "3D", "Enable 3D tracking"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_scene_actuator(BlenderRNA *brna) @@ -846,7 +942,7 @@ static void rna_def_visibility_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "children", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_RECURSIVE); - RNA_def_property_ui_text(prop, "Children", "Sets all the children of this object to the same visibility/occlusion recursively"); + RNA_def_property_ui_text(prop, "Children", "Set all the children of this object to the same visibility/occlusion recursively"); RNA_def_property_update(prop, NC_LOGIC, NULL); } @@ -953,12 +1049,79 @@ static void rna_def_parent_actuator(BlenderRNA *brna) static void rna_def_shape_action_actuator(BlenderRNA *brna) { StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_type_items[] ={ + {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""}, + {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""}, + {ACT_ACTION_LOOP_STOP, "LOOPSTOP", 0, "Loop Stop", ""}, + {ACT_ACTION_LOOP_END, "LOOPEND", 0, "Loop End", ""}, + {ACT_ACTION_FROM_PROP, "PROPERTY", 0, "Property", ""}, +#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR + {ACT_ACTION_MOTION, "MOTION", 0, "Displacement", ""}, +#endif + {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to .."); - RNA_def_struct_sdna_from(srna, "bShapeActionActuator", "data"); + RNA_def_struct_sdna_from(srna, "bActionActuator", "data"); + + prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Action type", "Action playback type"); + RNA_def_property_update(prop, NC_LOGIC, NULL); - //XXX + prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "act"); + RNA_def_property_struct_type(prop, "Action"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Action", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "continue_last_frame", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "end_reset", 1); + RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + 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", "Use this property to define the Action position"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "sta"); + RNA_def_property_range(prop, 0, MAXFRAME); + RNA_def_property_ui_text(prop, "Start frame", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "end"); + RNA_def_property_range(prop, 0, MAXFRAME); + RNA_def_property_ui_text(prop, "End frame", ""); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "blendin", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 32767); + RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers. With 2 or more actions at once, the overriding channels must be lower in the stack"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "frameProp"); + RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + +#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR + prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "stridelength"); + RNA_def_property_range(prop, 0.0, 2500.0); + RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action"); + RNA_def_property_update(prop, NC_LOGIC, NULL); +#endif } static void rna_def_state_actuator(BlenderRNA *brna) @@ -1062,16 +1225,15 @@ void RNA_def_actuator(BlenderRNA *brna) rna_def_sound_actuator(brna); rna_def_property_actuator(brna); rna_def_constraint_actuator(brna); // to be done - rna_def_edit_object_actuator(brna); // to be done + rna_def_edit_object_actuator(brna); rna_def_scene_actuator(brna); rna_def_random_actuator(brna); rna_def_message_actuator(brna); -// rna_def_action_actuator(brna); /* deprecated */ rna_def_game_actuator(brna); rna_def_visibility_actuator(brna); rna_def_twodfilter_actuator(brna); rna_def_parent_actuator(brna); - rna_def_shape_action_actuator(brna);// to be done + rna_def_shape_action_actuator(brna); rna_def_state_actuator(brna); rna_def_armature_actuator(brna); } |