diff options
author | Jorge Bernal <jbernalmartinez@gmail.com> | 2014-07-15 04:36:56 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-15 05:30:27 +0400 |
commit | 1bf87fa26c6763ef282ec39b07b678723a7f389b (patch) | |
tree | 14dcf327183bc94347f64c57fcfb26a002fee963 /source/blender/makesrna/intern/rna_actuator.c | |
parent | 50d30148b63212d4249b6e2aa97a5802557a9b6e (diff) |
BGE: TrackTo actuator: increasing up & track axis options
This is related to Task T34861 to increase up & track axis options for TrackTo actuator. I've just added it to differential to facilitate an easier review.
With the patch applied you can select X, Y and Z axis for the Up axis, and X, Y, Z, -X, -Y and -Z for the track axis.
Related to the implementation I have used the algorithm from Trackto constrain placed in constrain.c but adapted to be used with MOTO library.
The wiki docs are here (http://wiki.blender.org/index.php/User:Lordloki/Doc:2.6/Manual/Game_Engine/Logic/Actuators/Edit_Object#Trackto_Actuator).
Test file is here: {F97623}
I have also uploaded 2 screenshots showing the UI modifications to the TrackTo actuator:
{F91992} {F91990}
Reviewers: moguri, dfelinto
Reviewed By: moguri
CC: Genome36
Differential Revision: https://developer.blender.org/D565
Diffstat (limited to 'source/blender/makesrna/intern/rna_actuator.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 62e681d1374..9d26978d098 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1369,6 +1369,23 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem prop_track_axis_items[] = { + {ACT_TRACK_TRAXIS_X, "TRACKAXISX", 0, "X axis", ""}, + {ACT_TRACK_TRAXIS_Y, "TRACKAXISY", 0, "Y axis", ""}, + {ACT_TRACK_TRAXIS_Z, "TRACKAXISZ", 0, "Z axis", ""}, + {ACT_TRACK_TRAXIS_NEGX, "TRACKAXISNEGX", 0, "-X axis", ""}, + {ACT_TRACK_TRAXIS_NEGY, "TRACKAXISNEGY", 0, "-Y axis", ""}, + {ACT_TRACK_TRAXIS_NEGZ, "TRACKAXISNEGZ", 0, "-Z axis", ""}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem prop_up_axis_items[] = { + {ACT_TRACK_UP_X, "UPAXISX", 0, "X axis", ""}, + {ACT_TRACK_UP_Y, "UPAXISY", 0, "Y axis", ""}, + {ACT_TRACK_UP_Z, "UPAXISZ", 0, "Z axis", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "EditObjectActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects"); RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data"); @@ -1385,6 +1402,18 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Dynamic Operation", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); + prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "upflag"); + RNA_def_property_enum_items(prop, prop_up_axis_items); + RNA_def_property_ui_text(prop, "Up Axis", "The axis that points upward"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "trackflag"); + RNA_def_property_enum_items(prop, prop_track_axis_items); + RNA_def_property_ui_text(prop, "Track Axis", "The axis that points to the target object"); + 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"); |