Revision: 37396
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37396
Author:   moguri
Date:     2011-06-11 01:03:03 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
BGE Animations: Adding a layer option to Action actuators.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/space_logic/logic_window.c
    branches/soc-2011-pepper/source/blender/makesdna/DNA_actuator_types.h
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_actuator.c
    branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
    branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h
    branches/soc-2011-pepper/source/gameengine/Converter/KX_ConvertActuators.cpp

Modified: 
branches/soc-2011-pepper/source/blender/editors/space_logic/logic_window.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/space_logic/logic_window.c  
2011-06-11 00:58:49 UTC (rev 37395)
+++ branches/soc-2011-pepper/source/blender/editors/space_logic/logic_window.c  
2011-06-11 01:03:03 UTC (rev 37396)
@@ -3700,6 +3700,9 @@
        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

Modified: branches/soc-2011-pepper/source/blender/makesdna/DNA_actuator_types.h
===================================================================
--- branches/soc-2011-pepper/source/blender/makesdna/DNA_actuator_types.h       
2011-06-11 00:58:49 UTC (rev 37395)
+++ branches/soc-2011-pepper/source/blender/makesdna/DNA_actuator_types.h       
2011-06-11 01:03:03 UTC (rev 37396)
@@ -56,8 +56,10 @@
        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;                                                             
                                
 

Modified: branches/soc-2011-pepper/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- branches/soc-2011-pepper/source/blender/makesrna/intern/rna_actuator.c      
2011-06-11 00:58:49 UTC (rev 37395)
+++ branches/soc-2011-pepper/source/blender/makesrna/intern/rna_actuator.c      
2011-06-11 01:03:03 UTC (rev 37396)
@@ -616,6 +616,11 @@
        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");

Modified: 
branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp  
2011-06-11 00:58:49 UTC (rev 37395)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp  
2011-06-11 01:03:03 UTC (rev 37396)
@@ -180,9 +180,9 @@
        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 @@
                
                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 @@
                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;
        }

Modified: 
branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h    
2011-06-11 00:58:49 UTC (rev 37395)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h    
2011-06-11 01:03:03 UTC (rev 37396)
@@ -52,6 +52,7 @@
                                                short   playtype,
                                                short   blendin,
                                                short   priority,
+                                               short   layer,
                                                short   end_reset,
                                                float   stride) 
                : SCA_IActuator(gameobj, KX_ACT_ACTION),
@@ -69,6 +70,7 @@
                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 @@
        float   m_stridelength;
        short   m_playtype;
        short   m_priority;
+       short   m_layer;
        bool    m_end_reset;
        bool    m_is_going;
        struct bPose* m_pose;

Modified: 
branches/soc-2011-pepper/source/gameengine/Converter/KX_ConvertActuators.cpp
===================================================================
--- 
branches/soc-2011-pepper/source/gameengine/Converter/KX_ConvertActuators.cpp    
    2011-06-11 00:58:49 UTC (rev 37395)
+++ 
branches/soc-2011-pepper/source/gameengine/Converter/KX_ConvertActuators.cpp    
    2011-06-11 01:03:03 UTC (rev 37396)
@@ -205,6 +205,7 @@
                                        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"

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to