diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index c3a3dda2c47..32547275e56 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1939,6 +1939,7 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) switch (RNA_enum_get(ptr, "mode")) { case ACT_PROP_TOGGLE: + case ACT_PROP_LEVEL: break; case ACT_PROP_ADD: uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE); diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 7698d671117..dcde9007cd8 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -397,6 +397,7 @@ typedef struct bActuator { #define ACT_PROP_ADD 1 #define ACT_PROP_COPY 2 #define ACT_PROP_TOGGLE 3 +#define ACT_PROP_LEVEL 4 /* constraint flag */ #define ACT_CONST_NONE 0 diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 9d26978d098..956077055a9 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1090,6 +1090,7 @@ static void rna_def_property_actuator(BlenderRNA *brna) {ACT_PROP_ADD, "ADD", 0, "Add", ""}, {ACT_PROP_COPY, "COPY", 0, "Copy", ""}, {ACT_PROP_TOGGLE, "TOGGLE", 0, "Toggle", "For bool/int/float/timer properties only"}, + {ACT_PROP_LEVEL, "LEVEL", 0, "Level", "For bool/int/float/timer properties only"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index 0eab6187d07..ea1b2a2bce3 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -69,13 +69,24 @@ bool SCA_PropertyActuator::Update() bool bNegativeEvent = IsNegativeEvent(); RemoveAllEvents(); - + CValue* propowner = GetParent(); if (bNegativeEvent) - return false; // do nothing on negative events + { + if (m_type==KX_ACT_PROP_LEVEL) + { + CValue* newval = new CBoolValue(false); + CValue* oldprop = propowner->GetProperty(m_propname); + if (oldprop) + { + oldprop->SetValue(newval); + } + newval->Release(); + } + return false; + } - CValue* propowner = GetParent(); CParser parser; parser.SetContext( propowner->AddRef()); @@ -97,6 +108,19 @@ bool SCA_PropertyActuator::Update() } newval->Release(); } + else if (m_type==KX_ACT_PROP_LEVEL) + { + CValue* newval = new CBoolValue(true); + CValue* oldprop = propowner->GetProperty(m_propname); + if (oldprop) + { + oldprop->SetValue(newval); + } else + { + propowner->SetProperty(m_propname,newval); + } + newval->Release(); + } else if ((userexpr = parser.ProcessText(m_exprtxt))) { switch (m_type) { diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.h b/source/gameengine/GameLogic/SCA_PropertyActuator.h index 83a6d05df1b..228ecf94bc4 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.h +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.h @@ -44,6 +44,7 @@ class SCA_PropertyActuator : public SCA_IActuator KX_ACT_PROP_ADD, KX_ACT_PROP_COPY, KX_ACT_PROP_TOGGLE, + KX_ACT_PROP_LEVEL, KX_ACT_PROP_MAX };