Commit Graph

283 Commits

Author SHA1 Message Date
kobewi f13bb2ff56 Reimport file when .import changes 2024-06-29 19:57:44 +02:00
kobewi 5a3c7b41d8 Optimize get_path() in EditorFileSystemDirectory 2024-06-26 14:09:28 +02:00
Hilderin 39369db029 Fix synchronization of global class name 2024-06-25 18:33:07 -04:00
Rémi Verschelde 74f9f12c71
Merge pull request #92320 from Hilderin/fix-importing-assets-with-csv
Fix reimporting assets with csv in the project
2024-06-21 13:54:35 +02:00
Hilderin 8ac841a026 Fix Noticeable freeze after saving a scene #93104 2024-06-20 16:47:28 -04:00
kobewi c981e8b765 Don't rescan filesystem when adding new directory 2024-06-20 00:46:14 +02:00
Hilderin 8a82d3e9a7 Fix ProgressDialog crash when importing TTF font 2024-06-14 09:00:42 -04:00
David Nikdel 5122a3e3b0 editor: warn on UID duplicates
This commonly occurs when files are copied outside of the editor and don't get new UIDs.

Restricting this warning to first_scan since it's we want to exclude the case of files being moved after initial load which is harder to handle.

Addresses https://github.com/godotengine/godot-proposals/discussions/8949
2024-06-12 16:44:07 -04:00
Hilderin f1099ab943 Fix reimporting assets with csv in the project 2024-06-11 17:04:15 -04:00
Hilderin 9f8a918ade Fix update_files from PR #92893 2024-06-10 20:03:18 -04:00
Hilderin cc990efddf Fix freeze after building C# 2024-06-09 13:40:51 -04:00
kobewi f3b0f7b9e2 Skip unnecessary updates to scene groups and scripts 2024-05-15 16:48:01 +02:00
A Thousand Ships a0dbdcc3ab
Replace `find` with `contains/has` where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +02:00
Rémi Verschelde a21824b293
Merge pull request #85295 from jsjtxietian/use-mutex-protect-max_index-in-ImportThreadData
Use `SafeNumeric` to protect `max_index` in ImportThreadData
2024-05-02 12:46:19 +02:00
kobewi 0904378515 Remove code duplication for adding global script class 2024-05-01 00:26:42 +02:00
kobewi 5883300b92 Don't show scene group progress for 1 scene 2024-04-17 11:23:54 +02:00
Rémi Verschelde ce2a09f40e
Merge pull request #89739 from jsjtxietian/group-step
Add progress bar when updating scene groups
2024-04-15 18:14:42 +02:00
Sofox 87b5a56ddf Fix duplicated folder reference in Godot Editor after changing filename case 2024-04-05 21:38:48 +01:00
jsjtxietian cbb67d114e Add progress bar when update scene groups 2024-03-21 19:20:12 +08:00
A Thousand Ships 2cbf469912
Fix sorting of files/dirs in dialogs
Sorts leading `_` before other characters except `.`.
2024-03-20 13:45:47 +01:00
bruvzg fee14eb5e8
[Import] Add "skip file" import option to skip (and exclude from export) importable formats, auto set it for the images used by bitmap font. 2024-03-12 21:34:40 +02:00
kobewi 25553d7aca Refactor how file cache entries are stored 2024-03-08 23:16:31 +01:00
Rémi Verschelde 093cdd2188
EditorFileSystem: Add verbose print for file being (re)imported
Also print the time it took for each file.
2024-02-28 09:59:46 +01:00
Muller-Castro 1638c1b28f Add const lvalue ref to editor/* container parameters 2024-02-26 15:28:15 -03:00
Wilson E. Alvarez 9790b992ba
Fix data race against EditorFileSystem.scanning_changes_done 2024-02-09 07:48:01 -05:00
Adam Scott bd70b8e1f6
Add THREADS_ENABLED macro in order to compile Godot to run on the main thread 2024-01-17 13:58:29 -05:00
kobewi 0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00
Rémi Verschelde 6c390b620d
Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +01:00
Lyuma fea4165ca8 gltf: fix three bugs which prevented extracted textures from being refreshed.
1. Extracted texture paths in `GLTFDocument::_parse_image_save_image` at the project root started with res:/// which broke cache invalidation
2. md5 hashes were not being written to generator_parameters for new imports, which led Godot to think the file was manually created.
3. `EditorFileSystem::reimport_append` must emit the `resources_reimported` signal in order for the resource cache to be updated.
2023-12-25 01:03:40 -08:00
Stanislav Labzyuk 958699a0c4 Implement project-wide node groups 2023-12-19 18:07:19 +01:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Bartłomiej T. Listwon aae48ac2b6 Prevent overriding file info of another file when reimport creates files 2023-12-08 22:17:51 +01:00
jsjtxietian 4861ab4cfe Use mutex to protect max_index in ImportThreadData 2023-11-28 12:50:57 +08:00
Rémi Verschelde e03f47cb7c
Remove EditorFileDialog warning when skipping project directories
We might need better UX to handle this in EditorFileDialog, showing the
directories as greyed out with a tooltip, but for now this silences a warning
that users have no control over.

We keep the warning only in the initial project scan.
2023-11-12 19:05:05 +01:00
Rémi Verschelde 432c75d6af
Merge pull request #83081 from Rindbee/fix-wrong-split
Fix `EditorFileSystemDirectory::get_file_deps()` may return wrong result
2023-11-09 11:45:21 +01:00
Aaron Franke 58076b9ccb
Implement glTF compat version system for files from older Godot versions 2023-11-03 12:07:25 -05:00
风青山 203f3e700b Fix `EditorFileSystemDirectory::get_file_deps()` may return wrong results
Limit the maxsplit to `8` to get complete `deps`.

`deps` caches the return value of `ResourceLoader::get_dependencies()`,
which is also separated by "::".
"::" is quite popular as a splitter.
2023-10-10 10:51:01 +08:00
Mikael Hermansson 1a80508d0f Remove I/O error popup when failing to load/unload extension 2023-10-06 13:57:53 +02:00
Rémi Verschelde 373c4b22d3
Fix various typos with codespell
Using 2.2.7.dev5+g2af65969.
2023-10-06 12:52:22 +02:00
Yuri Sizov 7aff59f0b6 Merge pull request #78567 from NiskashY/master
Fix reimporting files with non lowercase name extension
2023-07-12 21:02:42 +02:00
NiskashY fc6a6dd0f4 Fix reimporting files with non lowercase name extension 2023-07-12 17:04:01 +02:00
RedworkDE f3f3365abd C#: Fix command line exporting 2023-07-07 20:51:46 +02:00
kobewi 7f18db9d9d Fix filesystem cache split error 2023-06-16 13:13:30 +02:00
Rémi Verschelde 9be0aab790
Merge pull request #75798 from KoBeWi/let's_fix_this_hack_with_yet_another_hack
Make sure script cache is created after reimport
2023-06-12 22:53:35 +02:00
Pedro J. Estébanez ed9dc792df Avoid error spam on first opening of a not yet imported project 2023-05-20 11:45:02 +02:00
kobewi d1a114470c Print a warning when a nested project is detected 2023-05-15 02:04:58 +02:00
Samuele Panzeri 4aaa2e6477 Fix wait for thread not started 2023-04-27 20:28:22 +02:00
kobewi 680ed7f612 Make sure script cache is created after reimport 2023-04-07 23:34:58 +02:00
Ninni Pipping bd30847e59 Exposing more project settings for documentation 2023-03-15 14:25:40 +01:00
Yuri Sizov e9c7b8d224
Merge pull request #71850 from WesleyElliott/fix-custom-node-export 2023-02-18 12:40:09 +03:00
Juan Linietsky 6cd587c8f4 Prevent recursive importing (hack)
Prevents recursion when importing files due to the ill nature of EditorProgress.
The progress dialog will have to be entirely rewritten after 4.0 is out due to it being a constant source of bugs.
In the meantime, this fixes the problem.

Fixes #53871. Supersedes #73159.
2023-02-13 11:54:32 +01:00
SaracenOne 27f8da7493 Emit reimport signal in reimport_file_with_custom_parameters
method to fix resources not updating when reimported from the
advanced import menu.
2023-02-09 22:26:52 +00:00
Lyuma 5fbcb80170 Use reimport_append api for importing embedded gltf images
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2023-02-06 07:11:45 -08:00
Rémi Verschelde 074113b97d
Merge pull request #72455 from reduz/allow-reimport-appending
Support reimport appending
2023-02-06 15:39:51 +01:00
Juan Linietsky 91c3066c89 Support reimport appending
* Add API: `EditorFileSystem::reimport_append(path)`, thread safe, what can be used from importers when they generate new files within the import process.
* Added a `remap.gen_param` custom value to .import files, which can be used by importers to store data needed to generate this file again or not.

This API is added to allow the GLTF2 importer to properly extract png files as textures.
2023-02-01 12:27:50 +01:00
Rémi Verschelde 38a806e13f
Always create global class list, even if empty
Fixes #72451.
2023-01-31 15:28:53 +01:00
Juan Linietsky 79897dd5bc Restore script class cache if removed
I have no idea why anyone would do this, but this fixes it.

Fixes #72154. Depends on #72444 being merged to function properly.
2023-01-31 11:28:21 +01:00
Rémi Verschelde 0440b3cf0e
Merge pull request #71783 from Bartkk0/parse-check-deleted
Check if file was removed when parsing documentation
2023-01-22 16:08:05 +01:00
Wesley Elliott d0cdaadb32 Use path instead of file name when updating script classes
The _script_class_file_to_path contains a map of paths to classes, but
when updating the script classes for new class names, the file name is
used instead. This meant new classes weren't able to be used in exported
variables until the project is reloaded (as the
_script_class_file_to_path is initially set with the full path)

Fixes #70718
2023-01-22 12:30:55 +02:00
Juan Linietsky dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
Bartkk 292b24bae0 Check if file was removed when parsing documentation 2023-01-21 04:42:44 +01:00
Juan Linietsky c0a81b1a2c Further fixes to global script class parsing
Bugs were introduced on first parse by #71628

This should fix everything remaining. No errors of any type were observed.
2023-01-19 13:52:15 +01:00
Juan Linietsky 5bdc0d97d3 Clean up EditorFileSystem script parsing
* Optimize only update modified/added/removed files.
* Clean up documentation parsing.
2023-01-18 20:56:45 +01:00
Rémi Verschelde 0f0b853c98
Merge pull request #70668 from KoBeWi/never_give_up
Retry loading addons after filesystem scan
2023-01-16 09:47:17 +01:00
Juan Linietsky 07a964fce3 Ability to change a resource UID from API
* Works for text, binary and imported resources
* Allows better clean up of duplicate files.

TODO (future PRs):

* Use this API for assigning new UIDs to copied files.
* Use this API for UID conflict on FS scanning (if more than one file has the same UID, the newer one(s) should get assigned a different UID).
2023-01-09 18:52:00 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
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".
2023-01-05 13:25:55 +01:00
kobewi f2367e0782 Retry loading addons after filesystem scan 2022-12-28 15:40:45 +01:00
Gilles Roudière be1c9d677d Rename all gdnative occurences to gdextension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:04:57 +01:00
Rémi Verschelde f3e6750a7e
Merge pull request #68324 from AThousandShips/group_import_uid
Fix group reimport bug
2022-12-05 18:45:15 +01:00
Rémi Verschelde c950d174cf
Merge pull request #67664 from WindyDarian/fix_dependency_import
Don't try to import unknown dependency from scan
2022-11-29 16:48:27 +01:00
trollodel c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
Ninni Pipping 83588aa74e Fix group reimport bug 2022-11-27 16:31:36 +01:00
Windy Darian 0463a445c4 Don't try to import unknown dependency from scan
Only import dependency we know how to import, since custom resource may have .gd in dependency list which doesn't have an importer
2022-10-19 22:17:36 -07:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Rémi Verschelde db7047705b Merge pull request #67124 from KoBeWi/load_before_save
Fallback to ResourceLoader if can't find UID
2022-10-10 17:42:24 +02:00
kobewi 14b82c36a2 Defer clearing of ResourceUID cache and silence warnings 2022-10-10 11:20:23 +02:00
kobewi a38891dfb3 Fallback to ResourceLoader if can't find UID 2022-10-09 13:06:15 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde 166df0896c Fix typos with codespell
Using codespell 2.3-dev from current git.

And fix typo in `methods.py` for `vsproj=yes` option (still won't work
though).
2022-09-30 14:23:36 +02:00
Aaron Franke 2be9ef507a
Remove unused `abort_scan` variable 2022-09-15 14:23:38 -05:00
Aaron Franke 10a56981dc
Rename String `plus_file` to `path_join` 2022-08-29 19:38:13 -05:00
Juan Linietsky a3936adb29 Add Startup benchmarking support
This adds support for benchmarking engine startup (and editor startup if used).
The goal is to use this in the benchmarking server to track improvements and changes to engine, editor, importer and scene loading startup times.
2022-08-19 14:21:43 +02:00
Aaron Franke ac870ab1c8
Move editor paths into the EditorPaths class 2022-07-29 11:07:30 -05:00
Juan Linietsky c7255388e1 Remove ThreadWorkPool, replace by WorkerThreadPool
The former needs to be allocated once per usage. The later is shared for all threads, which is more efficient.
It can also be better debugged.
2022-07-25 15:39:50 +02:00
MinusKube a4ddb033c9 Fix FileInfo::import_valid always being set to false for TextFile in some cases 2022-07-20 23:51:29 +02:00
reduz e772b65d92 Remake resource thread safety and API
* Ensures thread safety when resources are destroyed.
* Simplified API by always forcing `ResourceCache::get_ref`, which needs less hacks and is fully thread safe.
* Removed RWLock for resources because its not possible to use for the new logic. Should not be a problem.

Supersedes #57533
2022-06-22 13:46:46 +02:00
reduz 45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Aaron Record 900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Lyuma 41824c6cc8 Bind EditorFileSystem::reimport_files and improve docs
reimport_files offers a way for scripts to modify imported resources directly.
For example, images, sounds or glTF documents which are written by an external program.

It is much faster than `scan`, and can allow scripts to synchronously proceed after import finishes.
2022-05-17 00:45:48 -07:00
reduz 746dddc067 Replace most uses of Map by HashMap
* 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!
2022-05-16 10:37:48 +02:00
bruvzg 4bf99f4af2 Narrow FileAccess scope to prevent deadlocks. 2022-04-12 10:54:39 +03:00
bruvzg 9381acb6a4
Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
reduz e32215fbad Add Blender install autodetection and configuration.
This PR is a continuation to #54886

* Changed Blender path editor setting from binary to installation.
* Add a class to query whether the format is supported.
* This class allows to create proper editors to configure support.

**NOTE**: This PR only provides autodetection on Linux. Code needs to be added for Windows and MacOS to autodetect the Blender installation.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2022-04-01 11:01:12 +02:00
reduz 360dea5348 Add GDExtension support to Script
* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
2022-03-27 16:13:00 +02:00
Aaron Franke 918b09cabc
Initialize bools in the headers in editor 2022-03-12 13:34:06 -06:00
Rémi Verschelde 768f9422bc Convert uses of `DirAccess *` to `DirAccessRef` to prevent memleaks
`DirAccess *` needs to be deleted manually, and this is often forgotten
especially when doing early returns with `ERR_FAIL_COND`.
`DirAccessRef` is deleted automatically when it goes out of scope.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-03-11 09:13:11 +01:00
jmb462 dcd2a92af3 Port existing _notification code to use switch statements (part 1/3) 2022-02-16 11:38:24 +01:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
jmb462 c24433f500 Prevent renaming to an unkown extension from FileSystem dock. 2022-01-17 20:03:51 +01:00
luz paz 858bcd5058 Fix various typos
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inh,inout,leapyear,lod,nd,numer,ois,ony,paket,ro,seeked,sinc,switchs,te,uint,varn,vew`
2022-01-13 23:20:01 -05:00