summaryrefslogtreecommitdiffstats
path: root/core/object/script_language.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make languages' thread enter/exit more resilientPedro J. Estébanez2024-09-101-0/+17
|
* Core: Fix unreachable codeThaddeus Crews2024-08-271-1/+2
|
* GDScript: Fix message when calling non-tool function in tool modeDanil Alexeev2024-08-271-0/+12
|
* Fix global class cache file not present when no class nameHilderin2024-07-311-4/+0
|
* Lookup method also in base scripts of a PlaceHolderScriptInstanceRaul Santos2024-06-221-1/+7
|
* Use Core/Scene stringnames consistentlykobewi2024-05-131-1/+0
|
* Add PackedVector4Array Variant typeK. S. Ernest (iFire) Lee2024-05-031-0/+1
| | | | | Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
* Merge pull request #90776 from Naros/avoid-script-language-not-overriddenRémi Verschelde2024-04-191-1/+7
|\ | | | | | | Defer call to `set_break_language`
| * Defer call to set_break_languageChris Cranford2024-04-161-1/+7
| |
* | [Core] Add iteration support to `Array`A Thousand Ships2024-04-101-6/+6
|/
* Merge pull request #89261 from ↵Rémi Verschelde2024-03-241-0/+19
|\ | | | | | | | | | | paulloz/core/fix-script-reloading-outside-script-editor Fix how scripts reload outside of ScriptEditor
| * Fix how scripts reload outside of ScriptEditorPaul Joannon2024-03-181-0/+19
| |
* | Merge pull request #87680 from AThousandShips/the_angry_countRémi Verschelde2024-03-131-0/+16
|\ \ | | | | | | | | | Add methods to get argument count of methods
| * | Add methods to get argument count of methodsA Thousand Ships2024-03-101-0/+16
| |/ | | | | | | | | | | | | | | Added to: * `Callable`s * `Object`s * `ClassDB` * `Script(Instance)`s
* | Merge pull request #82084 from ogapo/pr/pck-cache-mergeRémi Verschelde2024-03-111-6/+18
|\ \ | |/ |/| | | Merge `uid_cache.bin` and `global_script_class_cache.cfg` after mounting PCKs
| * Merge uid_cache.bin and global_script_class_cache.cfg after mounting PCKsDavid Nikdel2024-03-061-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | fixes godotengine#82061 fixes godotengine#61556 Also, distinguish between main pack and DLC packs. It's desirable to downloaded content to be as small as possible. This change avoids bloating non-main pack files with new versions of resources that are all read on startup and never used again. They have no effect if loaded after startup. - project.godot/project.binary file - extension_list.cfg - app icon and boot_splash - .ico and .icns files (these can still be opted in for DLC by listing them explicitly in the include filter)
* | Merge pull request #89175 from ↵Rémi Verschelde2024-03-061-1/+6
|\ \ | |/ |/| | | | | paulloz/dotnet/fix-exported-nodes-reset-without-build-artifacts Hint fallback property as node when it is a node
| * Hint fallback property as node when it is a nodePaul Joannon2024-03-051-1/+6
| |
* | Allow configuring the script filename casing ruleRedMser2024-03-051-0/+7
|/ | | | | | Defaults to "Auto", which detects the casing based on the preference of the currently selected language (C# for example prefers PascalCase whereas GDScript prefers snake_case).
* Generate script resource preview without parsingYuri Sizov2024-01-261-0/+12
|
* Expose `Script.get_global_name()`Alfonso J. Ramos2023-12-181-0/+2
|
* Fix property groups overriding real propertiesPaul Joannon2023-11-281-0/+4
|
* Merge pull request #84847 from RandomShaper/lang_init_termRémi Verschelde2023-11-141-7/+29
|\ | | | | | | Let languages init & finish run without locks held
| * Let languages init & finish run without locks heldPedro J. Estébanez2023-11-131-7/+29
| |
* | Fill remaining global scope constant descriptionskobewi2023-11-131-3/+0
|/
* Make languages bookkeeping thread-safePedro J. Estébanez2023-11-091-7/+27
|
* C#: Abstract script class support398utubzyt2023-09-151-0/+1
|
* Merge pull request #81388 from ↵Rémi Verschelde2023-09-071-34/+0
|\ | | | | | | | | | | YuriSizov/core-gdvirtual-but-less-confused-about-itself Extract `ScriptInstance` into its own file to simplify includes
| * Extract ScriptInstance to simplify includesYuri Sizov2023-09-061-34/+0
| | | | | | | | | | | | | | | | | | This allows to include script_instance.h directly in the generated gdvirtual.gen.inc, and remove excessive includes from the codebase. This should also allow Resource to use GDVIRTUAL macros, which wasn't possible previously due to a circular dependency.
* | Change precedence in rules to make location after proper casing.ajreckof2023-09-051-1/+1
|/
* Fix race in ScriptServer.Ryan Roden-Corrent2023-06-211-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #76581. TSAN flagged this issue on starting the editor: 1. main calls register_core_types, which calls IP::create(), which calls Thread::start on the resolver thread 2. Thread::callback calls ScriptServer::thread_enter(), as "Scripts may need to attach a stack." 3. ScriptServer::thread_enter() accesses ScriptServer::_languages, which is still being initialized on the main thread by initialize_gdscript_module This fixes the issue by skipping thread enter/exit notifications if languages have not finished initializing yet. I'm assuming that notifying un-initialized languages of thread starts/stops would have been pointless anyways. If we need to somehow notify languages of threads before the languages initialize, we'll need a different solution. ``` Godot Engine v4.0.2.stable.custom_build.7a0977ce2 - https://godotengine.org ================== WARNING: ThreadSanitizer: data race (pid=9426) Write of size 4 at 0x55615b187cd0 by main thread: #0 ScriptServer::register_language(ScriptLanguage*) /home/rcorre/src/godot/godot/core/object/script_language.cpp:177:28 (godot.linuxbsd.editor.x86_64.llvm.san+0x9e52ab9) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #1 initialize_gdscript_module(ModuleInitializationLevel) /home/rcorre/src/godot/godot/modules/gdscript/register_types.cpp:118:3 (godot.linuxbsd.editor.x86_64.llvm.san+0x36f9c6f) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #2 initialize_modules(ModuleInitializationLevel) /home/rcorre/src/godot/godot/modules/register_module_types.gen.cpp:93:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f50499) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #3 Main::setup2(unsigned long) /home/rcorre/src/godot/godot/main/main.cpp:1961:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f1d40d) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #4 Main::setup(char const*, int, char**, bool) /home/rcorre/src/godot/godot/main/main.cpp:1879:10 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f16370) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #5 main /home/rcorre/src/godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:61:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x2e67e1f) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) Previous read of size 4 at 0x55615b187cd0 by thread T1: #0 ScriptServer::thread_enter() /home/rcorre/src/godot/godot/core/object/script_language.cpp:244:22 (godot.linuxbsd.editor.x86_64.llvm.san+0x9e54aed) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #1 Thread::callback(unsigned long, Thread::Settings const&, void (*)(void*), void*) /home/rcorre/src/godot/godot/core/os/thread.cpp:61:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x9464ab0) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #2 void std::__invoke_impl<void, void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>(std::__invoke_other, void (*&&)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long&&, Thread::Settings&&, void (*&&)(void*), void*&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #3 std::__invoke_result<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>::type std::__invoke<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>(void (*&&)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long&&, Thread::Settings&&, void (*&&)(void*), void*&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283) #4 void std::thread::_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>>::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283) #5 std::thread::_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283) #6 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283) #7 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Location is global 'ScriptServer::_language_count' of size 4 at 0x55615b187cd0 (godot.linuxbsd.editor.x86_64.llvm.san+0xbf46cd0) Thread T1 (tid=9431, running) created by main thread at: #0 pthread_create <null> (godot.linuxbsd.editor.x86_64.llvm.san+0x2de5776) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9) #3 IP::IP() /home/rcorre/src/godot/godot/core/io/ip.cpp:347:19 (godot.linuxbsd.editor.x86_64.llvm.san+0x962cbcd) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #4 IPUnix::IPUnix() /home/rcorre/src/godot/godot/drivers/unix/ip_unix.cpp:261:9 (godot.linuxbsd.editor.x86_64.llvm.san+0x4aee599) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #5 IPUnix::_create_unix() /home/rcorre/src/godot/godot/drivers/unix/ip_unix.cpp:258:9 (godot.linuxbsd.editor.x86_64.llvm.san+0x4aee599) #6 IP::create() /home/rcorre/src/godot/godot/core/io/ip.cpp:339:9 (godot.linuxbsd.editor.x86_64.llvm.san+0x962ca5e) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #7 register_core_types() /home/rcorre/src/godot/godot/core/register_core_types.cpp:279:7 (godot.linuxbsd.editor.x86_64.llvm.san+0x93e2333) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #8 Main::setup(char const*, int, char**, bool) /home/rcorre/src/godot/godot/main/main.cpp:690:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f08a49) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) #9 main /home/rcorre/src/godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:61:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x2e67e1f) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048) SUMMARY: ThreadSanitizer: data race /home/rcorre/src/godot/godot/core/object/script_language.cpp:177:28 in ScriptServer::register_language(ScriptLanguage*) ``` Co-authored-by: Pedro J. Estébanez <RandomShaper@users.noreply.github.com>
* sort code completions with rulesajreckof2023-05-231-1/+46
| | | | | | | | | | | | | | | | | | | Fixups Add levenshtein distance for comparisons, remove kind sort order, try to improve as many different use cases as possible Trying again to improve code completion Sort code autocompletion options by similarity based on input To make it really brief, uses a combination `String.similiary`, the category system introduced in a previous PR, and some filtering to yield more predictable results, instead of scattering every completion option at seemingly random. It also gives much higher priority to strings that contain the base in full, closer to the beginning or are perfect matches. Also moves CodeCompletionOptionCompare to code_edit.cpp Co-Authored-By: Micky <66727710+Mickeon@users.noreply.github.com> Co-Authored-By: Eric M <41730826+EricEzaM@users.noreply.github.com>
* Add Engine::unregister_script_language and make ↵Emmanuel Leblond2023-02-101-5/+13
| | | | Engine::register_script_language returns a Error
* Remove unused has_global_classes()kobewi2023-02-031-4/+0
|
* Restore script class cache if removedJuan Linietsky2023-01-311-0/+8
| | | | | | I have no idea why anyone would do this, but this fixes it. Fixes #72154. Depends on #72444 being merged to function properly.
* Implement a quick script inheritance checkJuan Linietsky2023-01-191-0/+31
| | | | Optimizes, simplifies and fixes EditorResourcePicker (was not refreshing custom clases).
* Clean up EditorFileSystem script parsingJuan Linietsky2023-01-181-0/+9
| | | | | * Optimize only update modified/added/removed files. * Clean up documentation parsing.
* Move global script class cache to separate filekobewi2023-01-161-17/+25
|
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
* Fixes inability to assign script after clearingocean (they/them)2022-11-211-2/+4
|
* Unify usage of GLOBAL/EDITOR_GETkobewi2022-10-181-3/+3
|
* Validate input in `ScriptServer::register_language`Haoyu Qiu2022-10-081-0/+1
|
* Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg2022-10-071-6/+6
| | | | change warnings=all to use /W4.
* Replace Array return types with TypedArray 2kobewi2022-08-231-6/+7
|
* Removed faulty function update after get_property_list.Hristo Stamenov2022-08-031-0/+25
| | | | The function tried to rearrange properties but that lead to problems with duplication or deleted properties. Implemented the logic that that function did inside the get_property_list both for tool scripts and non-tool scripts.
* Implement Vector4, Vector4i, Projectionreduz2022-07-231-0/+3
| | | | | | | | | | | | | Implement built-in classes Vector4, Vector4i and Projection. * Two versions of Vector4 (float and integer). * A Projection class, which is a 4x4 matrix specialized in projection types. These types have been requested for a long time, but given they were very corner case they were not added before. Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity. **Q**: Why Projection and not Matrix4? **A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
* Add a const call mode to Object, Variant and Script.K. S. Ernest (iFire) Lee2022-06-271-0/+5
| | | | | | | For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script). This mode ensures only const functions can be called, making it safe to use from the editor. Co-Authored-By: reduz <reduzio@gmail.com>
* Add a new HashSet templatereduz2022-05-201-1/+1
| | | | | * Intended to replace RBSet in most cases. * Optimized for iteration speed
* Replace most uses of Map by HashMapreduz2022-05-161-14/+14
| | | | | | | | | | | | * Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
* Add a new HashMap implementationreduz2022-05-121-3/+2
| | | | | | | | | | | | | | | | | Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>