Commit Graph

66 Commits

Author SHA1 Message Date
Rémi Verschelde fd6453c45e Revert "Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED"
This reverts commit 4b817a565c.

Fixes #64988.
Fixes #64997.

This caused several regressions (#64988, #64997,
https://github.com/godotengine/godot/issues/64997#issuecomment-1229970605)
which point at a flaw in the current logic:

- `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with
  `NOTIFCATION_THEME_CHANGED` as introduced in #62845.
- Some classes use their `THEME_CHANGED` to cache theme items in
  member variables (e.g. `style_normal`, etc.), and use those member
  variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE`
  notification is now deferred, they end up accessing invalid state and this
  can lead to not applying theme properly (e.g. for EditorHelp) or crashing
  (e.g. for EditorLog or CodeEdit).

So we need to go back to the drawing board and see if `THEME_CHANGED` can be
called earlier so that the previous logic still works?

Or can we refactor all engine code to make sure that:
- `ENTER_TREE` and similar do not depend on theme properties cached in member
  variables.
- Or `THEME_CHANGE` does trigger a general UI update to make sure that any
  bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE`
  does arrive for the first time. But that means having a temporary invalid
  (and possibly still crashing) state, and doing some computations twice
  which might be heavy (e.g. `EditorHelp::_update_doc()`).
2022-08-29 11:11:29 +02:00
Rémi Verschelde 9efa5a8fc9
Merge pull request #64555 from nongvantinh/inspector_resource_preview_incorrect_size
Fixed inspector resource preview shows up with incorrect size
2022-08-28 22:57:33 +02:00
Rémi Verschelde f7f8af232c
Merge pull request #64885 from Mickeon/rename-tooltip-hint
Rename `hint_tooltip` to `tooltip_text` & setter getter
2022-08-28 17:43:01 +02:00
Aaron Record 4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
Micky ef5b9a06a9 Rename `hint_tooltip` to `tooltip_text` & setget
`hint_tooltip` -> `tooltip_text`
`set_tooltip` -> `set_tooltip_text`
`_get_tooltip` -> `get_tooltip_text`

Updates documentation, too.
2022-08-27 01:35:01 +02:00
SaracenOne dd814a0dca Disable editing properties in foreign resources
from imported scenes or objects returning
true from a function named '_is_read_only' and
disable resaving imported resources.
2022-08-23 23:16:13 +01:00
Nong Van Tinh b9ab4b372f Fixed inspector resource preview shows up with incorrect size 2022-08-18 09:20:00 +07:00
Hendrik Brucker ade7cb6982 Add "Make Unique (Recursive)" to resource picker, simplify "Make Unique" 2022-08-06 21:08:22 +02:00
Yuri Sizov 9f55bd971e Extract EditorResourceConversionPlugin into its own source files and clean up editor includes 2022-07-31 21:14:15 +03:00
Juan Linietsky d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Rémi Verschelde 90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz d1ddee2258 Implement BPM support
Based on #62896, only implements the BPM support part.

* Implements BPM support in the AudioStreamOGG/MP3 importers.
* Can select BPM/Bar Size and total beats in a song file, as well as edit looping points.
* Looping is now BPM aware
* Added a special importer UI for configuring this.
* Added a special preview showing the audio waveform as well as the playback position in the resource picker.
* Renamed `AudioStream::instance` to `instantiate` for correctness.
2022-07-23 07:31:17 +02:00
FireForge 97dfbea6ad Rename Control PRESET_WIDE to PRESET_FULL_RECT 2022-07-18 20:08:11 -05:00
FireForge af19501cc7 Seperate filter and description in FileDialog.add_filter() 2022-07-09 10:51:45 -05:00
kobewi d2900429e8 Add static methods for creating Image and ImageTexture 2022-07-08 13:40:47 +02:00
bruvzg 344ba0ffaf
Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +03:00
FireForge 9bc6f44c80 Add rounded corners to EditorProperty and EditorSpinSlider
- Adds rounded corners to the EditorProperty child background, EditorSpinSlider label background, and resource sub-inspector borders and background.
- Allows customizing EditorSpinSlider label background through a new Theme StyleBox property, label_bg.
- Makes margins consistent in resource sub-inspectors.
- Removes space between buttons in NodePath, Resource, and multiline string editors.
- Adds space between label background and content for vertical property editors.
2022-05-25 15:31:30 -05: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
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
Hugo Locurcio 180e5d3028
Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Rémi Verschelde e8cca501fe
Merge pull request #60395 from Geometror/editor-gradient-preview-plugin 2022-04-26 12:22:07 +02:00
FireForge 3073b85de9 Rename theme properties to include underscores
- check_vadjust -> check_v_adjust
- close_h_ofs -> close_h_offset
- close_v_ofs -> close_v_offset
- commentfocus -> comment_focus
- hseparation -> h_separation
- ofs -> offset
- selectedframe -> selected_frame
- state_machine_selectedframe -> state_machine_selected_frame
- table_hseparation -> table_h_separation
- table_vseparation -> table_v_separation
- vseparation -> v_separation
2022-04-23 11:16:18 -05:00
Hendrik Brucker a93834c819 Add gradient resource preview generator 2022-04-21 00:08:35 +02:00
kobewi ab21ab80ba Make resource unique when pasting to another scene 2022-03-24 18:52:59 +01:00
Rémi Verschelde 5dd0b02f60
Merge pull request #58821 from IgorKordiukiewicz/extend-script-popup-without-script
Fixed issue where Extend Script option would show up even without script attached to the node
2022-03-06 10:17:31 +01:00
Igor Kordiukiewicz dc361d3201 Fixed issue where Extend Script option would show up even without script attached to the node 2022-03-06 03:19:03 +01:00
kobewi 7d44bb8f06 Remove set_as_minsize() 2022-03-06 00:57:42 +01:00
Michael Alexsander 917dac78e7 Replace some bits of code left to work with the new `TabContainer` 2022-03-04 19:16:33 -03:00
Rémi Verschelde 11572c6e30
Editor: Cleanup some includes dependencies
Removes some unnecessary includes from `editor_node.h`, and instead add
those where they're used.

Removes unnecessary `editor_node.h` includes in various editor classes.

Renames `dynamicfont` to `dynamic_font` in a couple files.

Misc cleanup while jumping through that rabbit hole.
2022-02-15 14:54:15 +01:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Rémi Verschelde 317cd0b19a
Refactor some object type checking code with `cast_to`
Less stringly typed logic, and less String allocations and comparisons.
2022-02-08 10:08:34 +01:00
Rémi Verschelde 0154ce2c8d
Merge pull request #43015 from Xrayez/refactor-auto-instaprop
Refactor auto-instantiation of `Object` properties in editor
2022-02-08 08:57:29 +01:00
trollodel aa1102fc53 Store panels and docks singletons in their own classes 2022-01-20 20:13:26 +01:00
kobewi 562fc4cc0d Rename TextureRect.expand to ignore_texture_size 2022-01-07 20:21:17 +01:00
Rémi Verschelde 6a27d7361a
Merge pull request #56321 from pycbouh/core-use-gdvirtual-everywhere 2022-01-07 16:14:28 +01:00
Rémi Verschelde 8f6cba3a44
Merge pull request #56398 from KoBeWi/cooler_picker 2022-01-05 17:42:48 +01:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
kobewi 9568789a9d Improvements to EditorResourcePicker 2022-01-01 13:51:42 +01:00
Yuri Sizov 7d37f76241 Use GDVIRTUAL* macros when binding virtual methods in exposed classes 2021-12-29 20:27:44 +03:00
Andrii Doroshenko (Xrayez) 7a8b11ee14 Refactor auto-instantiation of `Object` properties in editor
Auto-instantiation is used by the create dialog, but should also be
used by the editor inspector.

This refactors object properties auto-instantiation into a dedicated
method to be reused throughout editor (and possibly scripting).
2021-12-28 15:50:44 +02:00
Nathan Franke 49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Aaron Franke 3c0fdcc8ac
Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
Andrii Doroshenko (Xrayez) 6742a338a8 Rename `GradientTexture` to `GradientTexture1D`
1. Explicit and unambiguous when comparing to `GradientTexture2D`
2. Consistent with other class names where 1D is used in the engine.
2021-11-07 15:11:04 +02:00
Rémi Verschelde bbee193957
Merge pull request #52781 from KoBeWi/node's_favorite_shader 2021-11-03 16:33:50 +01:00
kobewi 07065d67e1 Infer shader type based on edited node 2021-11-03 15:27:38 +01:00
Yuri Sizov 67cbca341a Add a flag to EditorResourcePicker to differentiate selection contexts 2021-11-02 14:35:15 +03:00
Rémi Verschelde 88b347dc27
Merge pull request #51920 from jmb462/missing-sname-macro-optimization-in-some-functions 2021-09-23 13:14:20 +02:00
Anilforextra c63d51408f Use Rect2's get_end(). 2021-09-22 14:09:45 +05:45
Ryan Roden-Corrent 470b94fe22
Add QuickLoad option to resource picker.
When clicking on a resource field in the inspector dock, you now have
the "Quick Load" option in addition to "Load". This opens a QuickOpen
dialog allowing the user to type in a phrase to quickly locate the
desired resource (similar to "Quick Open Scene").

In my experience, this is much faster than clicking through the File
Dialog.

Relates to godotengine/godot-proposals#346.
2021-09-18 21:59:32 -04:00