diff options
-rw-r--r-- | .travis.yml | 30 | ||||
-rw-r--r-- | core/input_map.cpp | 5 | ||||
-rw-r--r-- | doc/base/classes.xml | 166 | ||||
-rw-r--r-- | drivers/png/SCsub | 11 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.cpp | 7 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 7 | ||||
-rw-r--r-- | platform/flash/dir_access_flash.cpp | 4 | ||||
-rw-r--r-- | platform/javascript/javascript_main.cpp | 19 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 6 | ||||
-rw-r--r-- | platform/javascript/os_javascript.h | 4 | ||||
-rw-r--r-- | platform/osx/dir_access_osx.mm | 7 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 2 | ||||
-rw-r--r-- | scene/2d/sprite.cpp | 12 | ||||
-rw-r--r-- | tools/editor/editor_help.cpp | 147 | ||||
-rw-r--r-- | tools/editor/editor_help.h | 9 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 19 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/project_settings.cpp | 31 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 69 | ||||
-rw-r--r-- | tools/editor/property_editor.h | 7 |
20 files changed, 454 insertions, 110 deletions
diff --git a/.travis.yml b/.travis.yml index 032e6aa0b8..11dcdf447c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: cpp -sudo: required -dist: trusty +sudo: false compiler: - gcc @@ -41,10 +40,33 @@ matrix: - compiler: clang env: GODOT_TARGET=x11 +addons: + apt: + packages: + - build-essential + - scons + - pkg-config + - libx11-dev + - libxcursor-dev + - libasound2-dev + - libfreetype6-dev + - libgl1-mesa-dev + - libglu1-mesa-dev + - libssl-dev + - libxinerama-dev + - libudev-dev + + # For cross-compiling to Windows. + - binutils-mingw-w64-i686 + - binutils-mingw-w64-x86-64 + - gcc-mingw-w64-i686 + - gcc-mingw-w64-x86-64 + - g++-mingw-w64-i686 + - g++-mingw-w64-x86-64 + - mingw-w64 + before_script: - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; sudo apt-get install -y scons pkg-config libx11-dev libxcursor-dev build-essential libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev libssl-dev libxinerama-dev libudev-dev; fi - - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "windows" ]; then sudo apt-get update -qq; sudo apt-get install -y mingw32 mingw-w64; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install scons; fi - if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then brew update; brew install android-sdk android-ndk; export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk; fi diff --git a/core/input_map.cpp b/core/input_map.cpp index d4560a1e1b..874ce1c424 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -156,10 +156,7 @@ void InputMap::action_erase_event(const StringName& p_action,const InputEvent& p List<InputEvent>::Element *E=_find_event(input_map[p_action].inputs,p_event); if (E) - return; //already gots - - input_map[p_action].inputs.erase(E); - + input_map[p_action].inputs.erase(E); } diff --git a/doc/base/classes.xml b/doc/base/classes.xml index e658e2ad96..1b5e2d85af 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -318,6 +318,7 @@ <argument index="0" name="seed" type="float"> </argument> <description> + Set seed for the random number generator. </description> </method> <method name="rand_seed"> @@ -426,7 +427,7 @@ <argument index="1" name="funcname" type="String"> </argument> <description> - Returns a reference to the specified function + Return a reference to the specified function. </description> </method> <method name="convert"> @@ -446,7 +447,7 @@ <argument index="0" name="what" type="Variant"> </argument> <description> - Returns the internal type of the given Variant object, using the TYPE_* enum in [@Global Scope]. + Return the internal type of the given Variant object, using the TYPE_* enum in [@Global Scope]. </description> </method> <method name="str"> @@ -490,6 +491,7 @@ <argument index="1" name="..." type="Variant"> </argument> <description> + Print one or more arguments to the console with a space between each argument. </description> </method> <method name="printerr"> @@ -520,7 +522,7 @@ <argument index="0" name="var" type="Variant"> </argument> <description> - Converts the value of a variable to a String. + Convert a value to a formatted string that can later be parsed using [method str2var]. </description> </method> <method name="str2var"> @@ -529,6 +531,7 @@ <argument index="0" name="string" type="String"> </argument> <description> + Convert a formatted string that was returned by [method var2str] to the original value. </description> </method> <method name="var2bytes"> @@ -537,6 +540,7 @@ <argument index="0" name="var" type="Variant"> </argument> <description> + Encode a variable value to a byte array. </description> </method> <method name="bytes2var"> @@ -545,6 +549,7 @@ <argument index="0" name="bytes" type="RawArray"> </argument> <description> + Decode a byte array back to a value. </description> </method> <method name="range"> @@ -553,7 +558,7 @@ <argument index="0" name="..." type="Variant"> </argument> <description> - Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial,final-1,increment). + Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial, final-1, increment). </description> </method> <method name="load"> @@ -586,10 +591,10 @@ <method name="hash"> <return type="int"> </return> - <argument index="0" name="var:Variant" type="Variant"> + <argument index="0" name="Variant" type="Variant"> </argument> <description> - Hashes the variable passed and returns an integer. + Hash the variable passed and return an integer. </description> </method> <method name="Color8"> @@ -604,6 +609,7 @@ <argument index="3" name="a8" type="int"> </argument> <description> + Make a color from red, green, blue and alpha. Arguments can range from 0 to 255. </description> </method> <method name="print_stack"> @@ -619,6 +625,7 @@ <argument index="0" name="instance_id" type="int"> </argument> <description> + Get an object by its ID. </description> </method> <method name="preload"> @@ -627,16 +634,20 @@ <argument index="0" name="path" type="String"> </argument> <description> + Preload a resource from the filesystem. The resource is loaded during script parsing. </description> </method> <method name="yield"> - <return type="Nil"> + <return type="Object"> </return> <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="signal" type="String"> </argument> <description> + Stop the function execution and return the current state. Call resume on the state to resume execution. This makes the state invalid. + Returns anything that was passed to the resume function call. + If passed an object and a signal, the execution is resumed when the object's signal is emmited. </description> </method> <method name="assert"> @@ -645,6 +656,7 @@ <argument index="0" name="condition" type="bool"> </argument> <description> + Assert that the condition is true. If the condition is false, generates an error. </description> </method> </methods> @@ -763,119 +775,172 @@ Tab Key </constant> <constant name="KEY_BACKTAB" value="16777219"> - Shift-Tab key + Shift-Tab Key </constant> <constant name="KEY_BACKSPACE" value="16777220"> + Backspace Key </constant> <constant name="KEY_RETURN" value="16777221"> + Return Key </constant> <constant name="KEY_ENTER" value="16777222"> + Enter Key </constant> <constant name="KEY_INSERT" value="16777223"> + Insert Key </constant> <constant name="KEY_DELETE" value="16777224"> + Delete Key </constant> <constant name="KEY_PAUSE" value="16777225"> + Pause Key </constant> <constant name="KEY_PRINT" value="16777226"> + Printscreen Key </constant> <constant name="KEY_SYSREQ" value="16777227"> </constant> <constant name="KEY_CLEAR" value="16777228"> </constant> <constant name="KEY_HOME" value="16777229"> + Home Key </constant> <constant name="KEY_END" value="16777230"> + End Key </constant> <constant name="KEY_LEFT" value="16777231"> + Left Arrow Key </constant> <constant name="KEY_UP" value="16777232"> + Up Arrow Key </constant> <constant name="KEY_RIGHT" value="16777233"> + Right Arrow Key </constant> <constant name="KEY_DOWN" value="16777234"> + Down Arrow Key </constant> <constant name="KEY_PAGEUP" value="16777235"> + Pageup Key </constant> <constant name="KEY_PAGEDOWN" value="16777236"> + Pagedown Key </constant> <constant name="KEY_SHIFT" value="16777237"> + Shift Key </constant> <constant name="KEY_CONTROL" value="16777238"> + Control Key </constant> <constant name="KEY_META" value="16777239"> </constant> <constant name="KEY_ALT" value="16777240"> + Alt Key </constant> <constant name="KEY_CAPSLOCK" value="16777241"> + Capslock Key </constant> <constant name="KEY_NUMLOCK" value="16777242"> + Numlock Key </constant> <constant name="KEY_SCROLLLOCK" value="16777243"> + Scrolllock Key </constant> <constant name="KEY_F1" value="16777244"> + F1 Key </constant> <constant name="KEY_F2" value="16777245"> + F2 Key </constant> <constant name="KEY_F3" value="16777246"> + F3 Key </constant> <constant name="KEY_F4" value="16777247"> + F4 Key </constant> <constant name="KEY_F5" value="16777248"> + F5 Key </constant> <constant name="KEY_F6" value="16777249"> + F6 Key </constant> <constant name="KEY_F7" value="16777250"> + F7 Key </constant> <constant name="KEY_F8" value="16777251"> + F8 Key </constant> <constant name="KEY_F9" value="16777252"> + F9 Key </constant> <constant name="KEY_F10" value="16777253"> + F10 Key </constant> <constant name="KEY_F11" value="16777254"> + F11 Key </constant> <constant name="KEY_F12" value="16777255"> + F12 Key </constant> <constant name="KEY_F13" value="16777256"> + F13 Key </constant> <constant name="KEY_F14" value="16777257"> + F14 Key </constant> <constant name="KEY_F15" value="16777258"> + F15 Key </constant> <constant name="KEY_F16" value="16777259"> + F16 Key </constant> <constant name="KEY_KP_ENTER" value="16777344"> + Enter Key on Numpad </constant> <constant name="KEY_KP_MULTIPLY" value="16777345"> + Multiply Key on Numpad </constant> <constant name="KEY_KP_DIVIDE" value="16777346"> + Divide Key on Numpad </constant> <constant name="KEY_KP_SUBTRACT" value="16777347"> + Subtract Key on Numpad </constant> <constant name="KEY_KP_PERIOD" value="16777348"> + Period Key on Numpad </constant> <constant name="KEY_KP_ADD" value="16777349"> + Add Key on Numpad </constant> <constant name="KEY_KP_0" value="16777350"> + Number 0 on Numpad </constant> <constant name="KEY_KP_1" value="16777351"> + Number 1 on Numpad </constant> <constant name="KEY_KP_2" value="16777352"> + Number 2 on Numpad </constant> <constant name="KEY_KP_3" value="16777353"> + Number 3 on Numpad </constant> <constant name="KEY_KP_4" value="16777354"> + Number 4 on Numpad </constant> <constant name="KEY_KP_5" value="16777355"> + Number 5 on Numpad </constant> <constant name="KEY_KP_6" value="16777356"> + Number 6 on Numpad </constant> <constant name="KEY_KP_7" value="16777357"> + Number 7 on Numpad </constant> <constant name="KEY_KP_8" value="16777358"> + Number 8 on Numpad </constant> <constant name="KEY_KP_9" value="16777359"> + Number 9 on Numpad </constant> <constant name="KEY_SUPER_L" value="16777260"> </constant> @@ -976,6 +1041,7 @@ <constant name="KEY_UNKNOWN" value="33554431"> </constant> <constant name="KEY_SPACE" value="32"> + Space Key </constant> <constant name="KEY_EXCLAM" value="33"> </constant> @@ -1008,24 +1074,34 @@ <constant name="KEY_SLASH" value="47"> </constant> <constant name="KEY_0" value="48"> + Number 0 </constant> <constant name="KEY_1" value="49"> + Number 1 </constant> <constant name="KEY_2" value="50"> + Number 2 </constant> <constant name="KEY_3" value="51"> + Number 3 </constant> <constant name="KEY_4" value="52"> + Number 4 </constant> <constant name="KEY_5" value="53"> + Number 5 </constant> <constant name="KEY_6" value="54"> + Number 6 </constant> <constant name="KEY_7" value="55"> + Number 7 </constant> <constant name="KEY_8" value="56"> + Number 8 </constant> <constant name="KEY_9" value="57"> + Number 9 </constant> <constant name="KEY_COLON" value="58"> </constant> @@ -1042,56 +1118,82 @@ <constant name="KEY_AT" value="64"> </constant> <constant name="KEY_A" value="65"> + A Key </constant> <constant name="KEY_B" value="66"> + B Key </constant> <constant name="KEY_C" value="67"> + C Key </constant> <constant name="KEY_D" value="68"> + D Key </constant> <constant name="KEY_E" value="69"> + E Key </constant> <constant name="KEY_F" value="70"> + F Key </constant> <constant name="KEY_G" value="71"> + G Key </constant> <constant name="KEY_H" value="72"> + H Key </constant> <constant name="KEY_I" value="73"> + I Key </constant> <constant name="KEY_J" value="74"> + J Key </constant> <constant name="KEY_K" value="75"> + K Key </constant> <constant name="KEY_L" value="76"> + L Key </constant> <constant name="KEY_M" value="77"> + M Key </constant> <constant name="KEY_N" value="78"> + N Key </constant> <constant name="KEY_O" value="79"> + O Key </constant> <constant name="KEY_P" value="80"> + P Key </constant> <constant name="KEY_Q" value="81"> + Q Key </constant> <constant name="KEY_R" value="82"> + R Key </constant> <constant name="KEY_S" value="83"> + S Key </constant> <constant name="KEY_T" value="84"> + T Key </constant> <constant name="KEY_U" value="85"> + U Key </constant> <constant name="KEY_V" value="86"> + V Key </constant> <constant name="KEY_W" value="87"> + W Key </constant> <constant name="KEY_X" value="88"> + X Key </constant> <constant name="KEY_Y" value="89"> + Y Key </constant> <constant name="KEY_Z" value="90"> + Z Key </constant> <constant name="KEY_BRACKETLEFT" value="91"> </constant> @@ -1264,10 +1366,13 @@ <constant name="KEY_MASK_GROUP_SWITCH" value="1073741824"> </constant> <constant name="BUTTON_LEFT" value="1"> + Left Mouse Button </constant> <constant name="BUTTON_RIGHT" value="2"> + Right Mouse Button </constant> <constant name="BUTTON_MIDDLE" value="3"> + Middle Mouse Button </constant> <constant name="BUTTON_WHEEL_UP" value="4"> </constant> @@ -1375,54 +1480,76 @@ <constant name="JOY_DS_Y" value="2"> </constant> <constant name="JOY_SELECT" value="10"> + Joystick Button Select </constant> <constant name="JOY_START" value="11"> + Joystick Button Start </constant> <constant name="JOY_DPAD_UP" value="12"> + Joystick DPad Up </constant> <constant name="JOY_DPAD_DOWN" value="13"> + Joystick DPad Down </constant> <constant name="JOY_DPAD_LEFT" value="14"> + Joystick DPad Left </constant> <constant name="JOY_DPAD_RIGHT" value="15"> + Joystick DPad Right </constant> <constant name="JOY_L" value="4"> + Joystick Left Shoulder Button </constant> <constant name="JOY_L2" value="6"> + Joystick Left Trigger </constant> <constant name="JOY_L3" value="8"> + Joystick Left Stick Click </constant> <constant name="JOY_R" value="5"> + Joystick Right Shoulder Button </constant> <constant name="JOY_R2" value="7"> + Joystick Right Trigger </constant> <constant name="JOY_R3" value="9"> + Joystick Right Stick Click </constant> <constant name="JOY_AXIS_0" value="0"> + Joystick Left Stick Horizontal Axis </constant> <constant name="JOY_AXIS_1" value="1"> + Joystick Left Stick Vertical Axis </constant> <constant name="JOY_AXIS_2" value="2"> + Joystick Right Stick Horizontal Axis </constant> <constant name="JOY_AXIS_3" value="3"> + Joystick Right Stick Vertical Axis </constant> <constant name="JOY_AXIS_4" value="4"> </constant> <constant name="JOY_AXIS_5" value="5"> </constant> <constant name="JOY_AXIS_6" value="6"> + Joystick Left Trigger Analog Axis </constant> <constant name="JOY_AXIS_7" value="7"> + Joystick Right Trigger Analog Axis </constant> <constant name="JOY_AXIS_MAX" value="8"> </constant> <constant name="JOY_ANALOG_0_X" value="0"> + Joystick Left Stick Horizontal Axis </constant> <constant name="JOY_ANALOG_0_Y" value="1"> + Joystick Left Stick Vertical Axis </constant> <constant name="JOY_ANALOG_1_X" value="2"> + Joystick Right Stick Horizontal Axis </constant> <constant name="JOY_ANALOG_1_Y" value="3"> + Joystick Right Stick Vertical Axis </constant> <constant name="JOY_ANALOG_2_X" value="4"> </constant> @@ -1566,9 +1693,6 @@ <constant name="PROPERTY_USAGE_STORAGE" value="1"> Property will be used as storage (default). </constant> - <constant name="PROPERTY_USAGE_STORAGE" value="1"> - Property will be used as storage (default). - </constant> <constant name="PROPERTY_USAGE_EDITOR" value="2"> Property will be visible in editor (default). </constant> @@ -1630,34 +1754,34 @@ Variable is of type [AABB]. </constant> <constant name="TYPE_MATRIX3" value="12"> - Variable is fo type [Matrix3]. + Variable is of type [Matrix3]. </constant> <constant name="TYPE_TRANSFORM" value="13"> - Variable is fo type [Transform]. + Variable is of type [Transform]. </constant> <constant name="TYPE_COLOR" value="14"> - Variable is fo type [Color]. + Variable is of type [Color]. </constant> <constant name="TYPE_IMAGE" value="15"> - Variable is fo type [Image]. + Variable is of type [Image]. </constant> <constant name="TYPE_NODE_PATH" value="16"> - Variable is fo type [NodePath]. + Variable is of type [NodePath]. </constant> <constant name="TYPE_RID" value="17"> - Variable is fo type [RID]. + Variable is of type [RID]. </constant> <constant name="TYPE_OBJECT" value="18"> - Variable is fo type [Object]. + Variable is of type [Object]. </constant> <constant name="TYPE_INPUT_EVENT" value="19"> - Variable is fo type [InputEvent]. + Variable is of type [InputEvent]. </constant> <constant name="TYPE_DICTIONARY" value="20"> - Variable is fo type [Dictionary]. + Variable is of type [Dictionary]. </constant> <constant name="TYPE_ARRAY" value="21"> - Variable is fo type [Array]. + Variable is of type [Array]. </constant> <constant name="TYPE_RAW_ARRAY" value="22"> </constant> diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 5532e28ade..df521de3eb 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -22,17 +22,16 @@ png_sources = [ "png/image_loader_png.cpp" ] -if ("neon_enabled" in env and env["neon_enabled"]): +# Currently .ASM filter_neon.S does not compile on NT. +import os +if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt": env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) env_neon = env.Clone(); if "S_compiler" in env: env_neon['CC'] = env['S_compiler'] #env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"]) - import os - # Currently .ASM filter_neon.S does not compile on NT. - if (os.name!="nt"): - png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c")) - png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S")) + png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c")) + png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S")) else: env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index 23a63be339..8b097ad25e 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -292,8 +292,11 @@ Error DirAccessUnix::rename(String p_path,String p_new_path) { } Error DirAccessUnix::remove(String p_path) { - p_path=fix_path(p_path); - + if (p_path.is_rel_path()) + p_path=get_current_dir().plus_file(p_path); + else + p_path=fix_path(p_path); + struct stat flags; if ((stat(p_path.utf8().get_data(),&flags)!=0)) return FAILED; diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 0a413979fc..b9476b870b 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -310,8 +310,11 @@ Error DirAccessWindows::rename(String p_path,String p_new_path) { Error DirAccessWindows::remove(String p_path) { - p_path=fix_path(p_path); - + if (p_path.is_rel_path()) + p_path=get_current_dir().plus_file(p_path); + else + p_path=fix_path(p_path); + printf("erasing %s\n",p_path.utf8().get_data()); //WIN32_FILE_ATTRIBUTE_DATA fileInfo; //DWORD fileAttr = GetFileAttributesExW(p_path.c_str(), GetFileExInfoStandard, &fileInfo); diff --git a/platform/flash/dir_access_flash.cpp b/platform/flash/dir_access_flash.cpp index 443242fd99..ce9eed2c59 100644 --- a/platform/flash/dir_access_flash.cpp +++ b/platform/flash/dir_access_flash.cpp @@ -183,12 +183,12 @@ size_t DirAccessFlash::get_space_left() { Error DirAccessFlash::rename(String p_from, String p_to) { - return FAILED; + ERR_FAIL_V(ERR_UNAVAILABLE); }; Error DirAccessFlash::remove(String p_name) { - return FAILED; + ERR_FAIL_V(ERR_UNAVAILABLE); }; extern char* psp_drive; diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index e66110b655..632ef2b6b2 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -74,6 +74,15 @@ static void _glut_skey(bool pressed,int key) { case GLUT_KEY_INSERT: ev.key.scancode=KEY_INSERT; break; } + if (pressed) { + if (os->skey_pressed[key]) + ev.key.echo = true; + else + os->skey_pressed[key] = true; + } + else { + os->skey_pressed[key] = false; + } uint32_t m = glutGetModifiers(); ev.key.mod.alt=(m&GLUT_ACTIVE_ALT)!=0; @@ -107,6 +116,16 @@ static void _glut_key(bool pressed,unsigned char key) { default: { ev.key.unicode=key; } + + if (pressed) { + if (os->key_pressed[key]) + ev.key.echo = true; + else + os->key_pressed[key] = true; + } + else { + os->key_pressed[key] = false; + } } diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 562733ab89..413d88ee23 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -693,7 +693,11 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, Ope time_to_save_sync=-1; - + for (int i = 0; i < 256; i++) { + key_pressed[i] = false; + if (i < 121) + skey_pressed[i] = false; + } } OS_JavaScript::~OS_JavaScript() { diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index ec3a6cf911..4a8265b9d9 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -56,10 +56,12 @@ public: Point2 pos; }; + bool skey_pressed[121]; + bool key_pressed[256]; + private: Vector<TouchPos> touch; - Point2 last_mouse; unsigned int last_id; GFXInitFunc gfx_init_func; diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm index e345bea60a..29f8fda663 100644 --- a/platform/osx/dir_access_osx.mm +++ b/platform/osx/dir_access_osx.mm @@ -297,8 +297,11 @@ Error DirAccessOSX::rename(String p_path,String p_new_path) { } Error DirAccessOSX::remove(String p_path) { - p_path=fix_path(p_path); - + if (p_path.is_rel_path()) + p_path=get_current_dir().plus_file(p_path); + else + p_path=fix_path(p_path); + struct stat flags; if ((stat(p_path.utf8().get_data(),&flags)!=0)) return FAILED; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index bb99e6ade7..4b339af6d4 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -813,7 +813,7 @@ static int translateKey(unsigned int key) InputEvent ev; ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=deltaX >0 ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_LEFT; + ev.mouse_button.button_index=deltaX < 0 ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_LEFT; ev.mouse_button.pressed=true; ev.mouse_button.x=mouse_x; ev.mouse_button.y=mouse_y; diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 001a1366a9..b2902b2867 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -188,13 +188,15 @@ bool Sprite::is_region() const{ void Sprite::set_region_rect(const Rect2& p_region_rect) { - bool changed=region_rect!=p_region_rect; + if (region_rect==p_region_rect) + return; + region_rect=p_region_rect; - if (region && changed) { - update(); + + if (region) item_rect_changed(); - _change_notify("region_rect"); - } + + _change_notify("region_rect"); } Rect2 Sprite::get_region_rect() const { diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 110e06f25b..238b2d1cb8 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -405,29 +405,98 @@ void EditorHelpIndex::select_class(const String& p_class) { class_list->ensure_cursor_is_visible(); } +void EditorHelpIndex::popup() { + + popup_centered_ratio(0.6); + + search_box->set_text(""); + _update_class_list(); +} + void EditorHelpIndex::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - class_list->clear(); - tree_item_map.clear(); - TreeItem *root = class_list->create_item(); - class_list->set_hide_root(true); + _update_class_list(); + connect("confirmed",this,"_tree_item_selected"); + } else if (p_what==NOTIFICATION_POST_POPUP) { + + search_box->call_deferred("grab_focus"); + } +} + +void EditorHelpIndex::_text_changed(const String& p_text) { - for(Map<String,DocData::ClassDoc>::Element *E=EditorHelp::get_doc_data()->class_list.front();E;E=E->next()) { + _update_class_list(); +} + +void EditorHelpIndex::_update_class_list() { + + class_list->clear(); + tree_item_map.clear(); + TreeItem *root = class_list->create_item(); + class_list->set_hide_root(true); + String filter = search_box->get_text().strip_edges(); + String to_select = ""; + for(Map<String,DocData::ClassDoc>::Element *E=EditorHelp::get_doc_data()->class_list.front();E;E=E->next()) { + + if (filter == "") { add_type(E->key(),tree_item_map,root); + } else { + + bool found = false; + String type = E->key(); + + while(type != "") { + if (type.findn(filter)!=-1) { + + if (to_select.empty()) { + to_select = type; + } + + found=true; + break; + } + + type = EditorHelp::get_doc_data()->class_list[type].inherits; + } + + if (found) { + add_type(E->key(),tree_item_map,root); + } } + } + if (tree_item_map.has(filter)) { + select_class(filter); + } else if (to_select != "") { + select_class(to_select); + } +} + + +void EditorHelpIndex::_sbox_input(const InputEvent& p_ie) { + + if (p_ie.type==InputEvent::KEY && ( + p_ie.key.scancode == KEY_UP || + p_ie.key.scancode == KEY_DOWN || + p_ie.key.scancode == KEY_PAGEUP || + p_ie.key.scancode == KEY_PAGEDOWN ) ) { + + class_list->call("_input_event",p_ie); + search_box->accept_event(); } } void EditorHelpIndex::_bind_methods() { ObjectTypeDB::bind_method("_tree_item_selected",&EditorHelpIndex::_tree_item_selected); + ObjectTypeDB::bind_method("_text_changed",&EditorHelpIndex::_text_changed); + ObjectTypeDB::bind_method("_sbox_input",&EditorHelpIndex::_sbox_input); ObjectTypeDB::bind_method("select_class",&EditorHelpIndex::select_class); ADD_SIGNAL( MethodInfo("open_class")); } @@ -436,19 +505,25 @@ void EditorHelpIndex::_bind_methods() { EditorHelpIndex::EditorHelpIndex() { - VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); + search_box = memnew( LineEdit ); + vbc->add_margin_child("Search:", search_box); + search_box->set_h_size_flags(SIZE_EXPAND_FILL); + + register_text_enter(search_box); + + search_box->connect("text_changed", this, "_text_changed"); + search_box->connect("input_event", this, "_sbox_input"); + class_list = memnew( Tree ); - vbc->add_margin_child("Class List: ",class_list,true); + vbc->add_margin_child("Class List: ", class_list, true); class_list->set_v_size_flags(SIZE_EXPAND_FILL); - class_list->connect("item_activated",this,"_tree_item_selected"); - get_ok()->set_text("Open"); } @@ -650,14 +725,64 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_text("Inherits: "); class_desc->pop(); class_desc->pop(); + + String inherits = cd.inherits; + class_desc->push_font(doc_font); - _add_type(cd.inherits); + + while (inherits != "") { + _add_type(inherits); + + inherits = doc->class_list[inherits].inherits; + + if (inherits != "") { + class_desc->add_text(" , "); + } + } + class_desc->pop(); class_desc->add_newline(); - class_desc->add_newline(); + } + + if (ObjectTypeDB::type_exists(cd.name)) { + bool found = false; + bool prev = false; + + for (Map<String,DocData::ClassDoc>::Element *E=doc->class_list.front();E;E=E->next()) { + + if (E->get().inherits == cd.name) { + + if (!found) { + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_font(doc_title_font); + class_desc->add_text("Inherited by: "); + class_desc->pop(); + class_desc->pop(); + + found = true; + class_desc->push_font(doc_font); + } + + if (prev) { + + class_desc->add_text(" , "); + prev = false; + } + + _add_type(E->get().name); + prev = true; + } + } + + if (found) + class_desc->pop(); + + class_desc->add_newline(); } + class_desc->add_newline(); + if (cd.brief_description!="") { class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); diff --git a/tools/editor/editor_help.h b/tools/editor/editor_help.h index 059a7ae11d..f6dda9f545 100644 --- a/tools/editor/editor_help.h +++ b/tools/editor/editor_help.h @@ -77,11 +77,16 @@ public: class EditorHelpIndex : public ConfirmationDialog { OBJ_TYPE( EditorHelpIndex, ConfirmationDialog ); - + LineEdit *search_box; Tree *class_list; HashMap<String,TreeItem*> tree_item_map; void _tree_item_selected(); + void _text_changed(const String& p_text); + void _sbox_input(const InputEvent& p_ie); + + void _update_class_list(); + void add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root); protected: @@ -92,6 +97,8 @@ public: void select_class(const String& p_class); + void popup(); + EditorHelpIndex(); }; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 61d6d74d1e..24df4544ec 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -981,11 +981,6 @@ void EditorNode::_save_scene(String p_file) { editor_data.apply_changes_in_editors(); - if (editor_plugin_screen) { - scene->set_meta("__editor_plugin_screen__",editor_plugin_screen->get_name()); - } - - _set_scene_metadata(p_file); @@ -3692,26 +3687,12 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo */ editor_data.set_edited_scene_import_metadata( sdata->get_import_metadata() ); - // editor_data.get_undo_redo().clear_history(); saved_version=editor_data.get_undo_redo().get_version(); _update_title(); _update_scene_tabs(); _add_to_recent_scenes(lpath); - if (new_scene->has_meta("__editor_plugin_screen__")) { - - String editor = new_scene->get_meta("__editor_plugin_screen__"); - - for(int i=0;i<editor_table.size();i++) { - - if (editor_table[i]->get_name()==editor) { - _editor_select(i); - break; - } - } - } - prev_scene->set_disabled(previous_scenes.size()==0); opening_prev=false; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 474bafee69..e3dce0b36a 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -971,7 +971,7 @@ void ScriptEditor::_menu_option(int p_option) { } } - help_index->popup_centered_ratio(0.6); + help_index->popup(); if (current!="") { help_index->call_deferred("select_class",current); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 69e09d6053..bf7d8b190a 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -60,6 +60,8 @@ void ProjectSettings::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { + globals_editor->edit(Globals::get_singleton()); + search_button->set_icon(get_icon("Zoom","EditorIcons")); clear_button->set_icon(get_icon("Close","EditorIcons")); @@ -566,8 +568,7 @@ void ProjectSettings::popup_project_settings() { //popup_centered(Size2(500,400)); popup_centered_ratio(); - globals_editor->edit(NULL); - globals_editor->edit(Globals::get_singleton()); + globals_editor->update_category_list(); _update_translations(); _update_autoload(); plugin_settings->update_plugins(); @@ -605,37 +606,45 @@ void ProjectSettings::_item_add() { case 3: value=""; break; } - String catname = category->get_text(); + String catname = category->get_text().strip_edges(); /*if (!catname.is_valid_identifier()) { message->set_text("Invalid Category.\nValid characters: a-z,A-Z,0-9 or _"); message->popup_centered(Size2(300,100)); return; }*/ - String propname = property->get_text(); + String propname = property->get_text().strip_edges(); /*if (!propname.is_valid_identifier()) { message->set_text("Invalid Property.\nValid characters: a-z,A-Z,0-9 or _"); message->popup_centered(Size2(300,100)); return; }*/ - String name = catname+"/"+propname; + String name = catname!="" ? catname+"/"+propname : propname; + Globals::get_singleton()->set(name,value); - globals_editor->edit(NULL); - globals_editor->edit(Globals::get_singleton()); + + globals_editor->set_current_section(catname); + globals_editor->update_category_list(); + + _settings_changed(); } void ProjectSettings::_item_del() { - String catname = category->get_text(); + String catname = category->get_text().strip_edges(); //ERR_FAIL_COND(!catname.is_valid_identifier()); - String propname = property->get_text(); + String propname = property->get_text().strip_edges(); //ERR_FAIL_COND(!propname.is_valid_identifier()); - String name = catname+"/"+propname; + String name = catname!="" ? catname+"/"+propname : propname; + Globals::get_singleton()->set(name,Variant()); - globals_editor->get_property_editor()->update_tree(); + globals_editor->set_current_section(catname); + globals_editor->update_category_list(); + + _settings_changed(); } void ProjectSettings::_action_adds(String) { diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 303604c2fc..4e98ae9e90 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -3840,14 +3840,34 @@ void SectionedPropertyEditor::_section_selected(int p_which) { filter->set_section( sections->get_item_metadata(p_which) ); } +void SectionedPropertyEditor::set_current_section(const String& p_section) { + + int section_idx = sections->find_metadata(p_section); + + if (section_idx==sections->get_current()) + return; + + if (section_idx!=-1) { + sections->select(section_idx); + _section_selected(section_idx); + } else if (sections->get_item_count()) { + sections->select(0); + _section_selected(0); + } +} + String SectionedPropertyEditor::get_current_section() const { - return sections->get_item_metadata( sections->get_current() ); + if (sections->get_current()!=-1) + return sections->get_item_metadata( sections->get_current() ); + else + return ""; } String SectionedPropertyEditor::get_full_item_path(const String& p_item) { - String base = sections->get_item_metadata( sections->get_current() ); + String base = get_current_section(); + if (base!="") return base+"/"+p_item; else @@ -3856,17 +3876,44 @@ String SectionedPropertyEditor::get_full_item_path(const String& p_item) { void SectionedPropertyEditor::edit(Object* p_object) { - List<PropertyInfo> pinfo; - if (p_object) - p_object->get_property_list(&pinfo); + if (p_object) { + obj=p_object->get_instance_ID(); + update_category_list(); + } else { + sections->clear(); + } + + filter->set_edited(p_object); + editor->edit(filter); + + sections->select(0); + _section_selected(0); + +} + +void SectionedPropertyEditor::update_category_list() { + + String selected_category=get_current_section(); sections->clear(); + Object *o = ObjectDB::get_instance(obj); + + if (!o) + return; + + List<PropertyInfo> pinfo; + o->get_property_list(&pinfo); + Set<String> existing_sections; for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) { PropertyInfo pi=E->get(); + if (pi.usage&PROPERTY_USAGE_CATEGORY) continue; + else if ( !(pi.usage&PROPERTY_USAGE_EDITOR) ) + continue; + if (pi.name.find(":")!=-1 || pi.name=="script/script") continue; int sp = pi.name.find("/"); @@ -3885,19 +3932,9 @@ void SectionedPropertyEditor::edit(Object* p_object) { sections->set_item_metadata(sections->get_item_count()-1,""); } } - - } - //sections->sort_items_by_text(); - - - filter->set_edited(p_object); - editor->edit(filter); - - sections->select(0); - _section_selected(0); - + set_current_section(selected_category); } PropertyEditor *SectionedPropertyEditor::get_property_editor() { diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 63ad090901..83923cb237 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -257,6 +257,9 @@ class SectionedPropertyEditor : public HBoxContainer { OBJ_TYPE(SectionedPropertyEditor,HBoxContainer); + + ObjectID obj; + ItemList *sections; SectionedPropertyEditorFilter *filter; PropertyEditor *editor; @@ -270,8 +273,12 @@ public: PropertyEditor *get_property_editor(); void edit(Object* p_object); String get_full_item_path(const String& p_item); + + void set_current_section(const String& p_section); String get_current_section() const; + void update_category_list(); + SectionedPropertyEditor(); ~SectionedPropertyEditor(); }; |