diff options
author | Jorge Bernal <jbernalmartinez@gmail.com> | 2015-04-16 07:31:25 +0300 |
---|---|---|
committer | Jorge Bernal <jbernalmartinez@gmail.com> | 2015-04-16 07:39:33 +0300 |
commit | 8c98b1649d1cee38faff338414d35c87ee0f8c2a (patch) | |
tree | ed7f4bcdbd84cf81f0d4bd1f649ae762d109cfb2 /source/gameengine/Converter/KX_ConvertSensors.cpp | |
parent | b466a82fa5b3490a13880a92ce00d01057ae21b3 (diff) |
BGE: Fix for T42341 Sensor.frequency is badly named
"Frequency" parameter is renamed to "Skip" in the LogicBricks sensors as it represents skipped frames between pulses.
Naming something (frequency) the exact opposite of what it represents (period) was the worst choice.
Also, a new BGE python attribute 'skippedTicks' was introduced. 'frequency' attribute is maintained but deprecated.
Internally, freq variable is used yet at DNA_Sensor to maintain compability and to avoid do_versions.
Thanks to Sybren for the investigation.
{F162440}
Reviewers: campbellbarton, sybren, moguri, hg1
Reviewed By: sybren, hg1
Differential Revision: https://developer.blender.org/D1229
Diffstat (limited to 'source/gameengine/Converter/KX_ConvertSensors.cpp')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertSensors.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index 0d706fcd924..b781e4d1cc8 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -105,7 +105,7 @@ void BL_ConvertSensors(struct Object* blenderobject, bSensor* sens = (bSensor*)blenderobject->sensors.first; bool pos_pulsemode = false; bool neg_pulsemode = false; - int frequency = 0; + int skipped_ticks = 0; bool invert = false; bool level = false; bool tap = false; @@ -120,13 +120,13 @@ void BL_ConvertSensors(struct Object* blenderobject, while (sens) { SCA_ISensor* gamesensor=NULL; - /* All sensors have a pulse toggle, frequency, and invert field. */ + /* All sensors have a pulse toggle, skipped ticks parameter, and invert field. */ /* These are extracted here, and set when the sensor is added to the */ /* list. */ pos_pulsemode = (sens->pulse & SENS_PULSE_REPEAT)!=0; neg_pulsemode = (sens->pulse & SENS_NEG_PULSE_MODE)!=0; - frequency = sens->freq; + skipped_ticks = sens->freq; invert = !(sens->invert == 0); level = !(sens->level == 0); tap = !(sens->tap == 0); @@ -602,7 +602,7 @@ void BL_ConvertSensors(struct Object* blenderobject, /* Conversion succeeded, so we can set the generic props here. */ gamesensor->SetPulseMode(pos_pulsemode, neg_pulsemode, - frequency); + skipped_ticks); gamesensor->SetInvert(invert); gamesensor->SetLevel(level); gamesensor->SetTap(tap); |