diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2011-06-11 05:03:03 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2011-06-11 05:03:03 +0400 |
commit | 8e85491ab7f4d2e156910eceb87ca4023d42c95a (patch) | |
tree | 550ce54c91d51dd9dc8de8d87be6d168359079c9 | |
parent | e67edaf6ac3f36975ebf305c091b2dd7aaad3b31 (diff) |
BGE Animations: Adding a layer option to Action actuators.
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_actuator_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 5 | ||||
-rw-r--r-- | source/gameengine/Converter/BL_ActionActuator.cpp | 14 | ||||
-rw-r--r-- | source/gameengine/Converter/BL_ActionActuator.h | 3 | ||||
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 1 |
6 files changed, 21 insertions, 7 deletions
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 0a9a91a53af..0cbc67a3504 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3700,6 +3700,9 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE); row= uiLayoutRow(layout, 0); + uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE); + + row= uiLayoutRow(layout, 0); uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE); #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 683d8142cc9..7951ebc8c99 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -56,8 +56,10 @@ typedef struct bActionActuator { char frameProp[32]; /* Set this property to the actions current frame */ short blendin; /* Number of frames of blending */ short priority; /* Execution priority */ + short layer; /* Animation layer */ short end_reset; /* Ending the actuator (negative pulse) wont reset the the action to its starting frame */ short strideaxis; /* Displacement axis */ + short pad[3]; float stridelength; /* Displacement incurred by cycle */ // not in use } bActionActuator; diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index e16d13fafaa..656dbc53656 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -616,6 +616,11 @@ static void rna_def_action_actuator(BlenderRNA *brna) 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, "layer", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 4); /* This should match BL_ActionManager::MAX_ACTION_LAYERS */ + RNA_def_property_ui_text(prop, "Layer", "The animation layer to play the action on"); + 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"); diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index a6ef7155522..6230f03c4ed 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -180,9 +180,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (!m_is_going && bPositiveEvent) { m_is_going = true; - obj->PlayAction(m_action->id.name+2, start, end, 0, m_blendin, play_mode); + obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_blendin, play_mode); if (m_end_reset) - obj->SetActionFrame(0, m_localtime); + obj->SetActionFrame(m_layer, m_localtime); } else if (m_is_going && bNegativeEvent) { @@ -190,19 +190,19 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (!m_end_reset) { - obj->StopAction(0); + obj->StopAction(m_layer); return false; } - m_localtime = obj->GetActionFrame(0); - obj->StopAction(0); // Stop the action after getting the frame + m_localtime = obj->GetActionFrame(m_layer); + obj->StopAction(m_layer); // Stop the action after getting the frame } // Handle a frame property if it's defined if (m_framepropname[0] != 0) { CValue* oldprop = obj->GetProperty(m_framepropname); - CValue* newval = new CFloatValue(obj->GetActionFrame(0)); + CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer)); if (oldprop) oldprop->SetValue(newval); else @@ -215,7 +215,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) return true; } // Handle a finished animation - else if (m_is_going && obj->IsActionDone(0)) + else if (m_is_going && obj->IsActionDone(m_layer)) { return false; } diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h index 1530ccda00b..6daf412d9a3 100644 --- a/source/gameengine/Converter/BL_ActionActuator.h +++ b/source/gameengine/Converter/BL_ActionActuator.h @@ -52,6 +52,7 @@ public: short playtype, short blendin, short priority, + short layer, short end_reset, float stride) : SCA_IActuator(gameobj, KX_ACT_ACTION), @@ -69,6 +70,7 @@ public: m_stridelength(stride), m_playtype(playtype), m_priority(priority), + m_layer(layer), m_end_reset(end_reset), m_is_going(false), m_pose(NULL), @@ -163,6 +165,7 @@ protected: float m_stridelength; short m_playtype; short m_priority; + short m_layer; bool m_end_reset; bool m_is_going; struct bPose* m_pose; diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index b8e19c9187a..7bd51fef9f0 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -205,6 +205,7 @@ void BL_ConvertActuators(char* maggiename, actact->type, // + 1, because Blender starts to count at zero, actact->blendin, actact->priority, + actact->layer, actact->end_reset, actact->stridelength // Ketsji at 1, because zero is reserved for "NoDef" |