diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2012-04-09 05:42:44 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2012-04-09 05:42:44 +0400 |
commit | bcd6c84a66280c5eeed363c91638deeecbcb91f1 (patch) | |
tree | a15f8e57972e2739383373e1a40f2904e97832eb /source | |
parent | 891b46e074f28330003eb1484712a3c052008b48 (diff) |
bugfix [#30760] edit text property bug
backspace was messing up with utf8 text.
hijacking Blender utf8 functions
tested in CMake but I think scons should work too. No idea about pure 'make'
Happy Easter ;)
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/GameLogic/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SConscript | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index 98255bb8b97..64f198f72a0 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -28,6 +28,7 @@ set(INC ../Expressions ../Rasterizer ../SceneGraph + ../../blender/blenlib ../../../intern/container ../../../intern/moto/include ../../../intern/string diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index 48237a1b467..704b244c52c 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -39,6 +39,10 @@ #include "StringValue.h" #include "SCA_IInputDevice.h" +extern "C" { + #include "BLI_string_cursor_utf8.h" +} + /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ @@ -338,7 +342,11 @@ void SCA_KeyboardSensor::AddToTargetProp(int keyIndex) STR_String newprop = tprop->GetText(); int oldlength = newprop.Length(); if (oldlength >= 1 ) { - newprop.SetLength(oldlength - 1); + int newlength=oldlength; + + BLI_str_cursor_step_prev_utf8(newprop, NULL, &newlength); + newprop.SetLength(newlength); + CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); GetParent()->SetProperty(m_targetprop, newstringprop); newstringprop->Release(); diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript index 62bdbc29544..e01222e81d7 100644 --- a/source/gameengine/GameLogic/SConscript +++ b/source/gameengine/GameLogic/SConscript @@ -6,6 +6,7 @@ sources = env.Glob('*.cpp') + env.Glob('Joystick/*.cpp') incs = '. #/intern/string #intern/container' incs += ' #/source/gameengine/Expressions #/intern/moto/include' incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph' +incs += ' #/blender/blenlib' defs = [] |