diff options
author | Jorge Bernal <jbernalmartinez@gmail.com> | 2014-04-17 05:23:29 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2014-04-17 05:40:07 +0400 |
commit | a5b9f22454cc36c8811b10fe65d40ec900497922 (patch) | |
tree | b28160483e995b0443788bfefbbaa2c81febfc25 /source/gameengine/Converter/KX_ConvertSensors.cpp | |
parent | 8a4210074c0d20af7aa1fe8b03839086f3f39078 (diff) |
BGE - button for deactivate sensors, controllers and actuators
This change introduces a new checkbox to deactivate the sensors, controllers and/or actuators. It is useful during the development phase to avoid delete sensors, controllers or actuators if you want to test something new.
NOC: The wiki page is being updated (the images mostly), but the feature is already in the 2.71 release log.
{F61628}
Reviewers: moguri, dfelinto, campbellbarton, dingto, #user_interface, billrey
Reviewed By: moguri
CC: billrey
Differential Revision: https://developer.blender.org/D16
Diffstat (limited to 'source/gameengine/Converter/KX_ConvertSensors.cpp')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertSensors.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index 2e2ebda47e2..6ab382f7956 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -49,6 +49,7 @@ #include "DNA_object_types.h" #include "DNA_material_types.h" #include "DNA_sensor_types.h" +#include "DNA_controller_types.h" #include "DNA_actuator_types.h" /* for SENS_ALL_KEYS ? this define is * probably misplaced */ /* end of blender include block */ @@ -575,7 +576,7 @@ void BL_ConvertSensors(struct Object* blenderobject, } } - if (gamesensor) + if (gamesensor && !(sens->flag & SENS_DEACTIVATE)) { gamesensor->SetExecutePriority(executePriority++); STR_String uniquename = sens->name; @@ -606,16 +607,19 @@ void BL_ConvertSensors(struct Object* blenderobject, { bController* linkedcont = (bController*) sens->links[i]; if (linkedcont) { - SCA_IController* gamecont = converter->FindGameController(linkedcont); + // If the controller is deactived doesn't register it + if (!(linkedcont->flag & CONT_DEACTIVATE)) { + SCA_IController* gamecont = converter->FindGameController(linkedcont); - if (gamecont) { - logicmgr->RegisterToSensor(gamecont,gamesensor); - } - else { - printf("Warning, sensor \"%s\" could not find its controller " - "(link %d of %d) from object \"%s\"\n" - "\tthere has been an error converting the blender controller for the game engine," - "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2); + if (gamecont) { + logicmgr->RegisterToSensor(gamecont,gamesensor); + } + else { + printf("Warning, sensor \"%s\" could not find its controller " + "(link %d of %d) from object \"%s\"\n" + "\tthere has been an error converting the blender controller for the game engine," + "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2); + } } } else { |