summaryrefslogtreecommitdiff
path: root/scene/gui/range.cpp
AgeCommit message (Collapse)Author
2022-12-01Merge pull request #67660 from Rindbee/improve-setter-for-RangeRémi Verschelde
Improve validation when setting `max`/`min`/`page` in `Range`
2022-10-31Add set_value_no_signal() to Rangekobewi
2022-10-20Improve validation when setting `max`/`min`/`page` in `Range`Rindbee
The incoming value is validated first and then compared. Previously, when the ScrollContainer was scrolled, the ScrollBar of the other axis of the ScrollContainer would emit the changed signal. This commit avoids that.
2022-09-19Change return type of `get_configuration_warnings` to `PackedStringArray`Marc Gilleron
2022-08-29Rename `CanvasItem.update()` to `queue_redraw()`Micky
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on. Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency. Just a few comments have also been changed to say "redraw". In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-23Add some codes, returnes directly if the value is not changed.风青山
Avoid executing the following value-changed logics if the value does not really change.
2022-05-19Use range iterators for RBSet in most casesAaron Record
2022-05-16Replace most uses of Map by HashMapreduz
* 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-03-28String: Remove TTR and DTR defines in non-tools buildRémi Verschelde
This ensures we don't use TTR in runtime code, as it's specifically meant to source translations for the editor.
2022-03-27Add GDExtension support to Scriptreduz
* 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-10Discern between virtual and abstract class bindingsreduz
* Previous "virtual" classes (which can't be instantiated) are not corretly named "abstract". * Added a new "virtual" category for classes, they can't be instantiated from the editor, but can be inherited from script and extensions. * Converted a large amount of classes from "abstract" to "virtual" where it makes sense. Most classes that make sense have been converted. Missing: * Physics servers * VideoStream * Script* classes. which will go in a separate PR due to the complexity involved.
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-10-09Fix Range property dependencieskobewi
2021-07-18Optimize StringName usagereduz
* Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor.
2021-06-17Add PROPERTY_USAGE_NONE and use itAaron Franke
2021-04-11Use Array for node configuration warningsNathan Franke
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
2021-02-10Removed _change_notifyreduz
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap. -For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed() -Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-09Initialize class variables with default values in scene/ [2/2]Rafał Mikrut
2021-01-15Make Range return 1.0 ratio if minimum and maximum values are equalHugo Locurcio
An error message is also no longer printed. This matches the behavior found in most UI frameworks where having equal minimum and maximum values is considered acceptable. This closes #43179.
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-05-16Update all get_configuration_warning to retrieve warnings from the parentArrowInAKnee
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-11-26Range: Remove min/max check added in #33908Rémi Verschelde
This wasn't a very good idea as it puts too strict requirements on how to set `min` and `max` values. For example, since the default min and max are 0 and 100, this triggers an error: ``` set_min(256) set_max(16384) ``` Since `min` will be higher than `max` temporarily. It can be worked around by setting max first, but it's not really intuitive. I'll relax the requirement as it's only a problem in `get_as_ratio`, which already has a check. Fix another min == max occurrence.
2019-11-26Range: Fix cases where max was set to or below min valueRémi Verschelde
It will now raise an error whenever this happens so that we can fix these situations. `max == min` is not allowed as it could lead to divisions by zero in ratios, and `max < min` doesn't make much sense. Fixes #33907.
2019-11-20Fix some overflows and unitialized variablesRafał Mikrut
2019-11-10Memory leak and crash fixesRafał Mikrut
2019-08-09Fix Exponential Range Graphical ErrorEmmanuel Barroga
Fixes the Exponential Range Slider having a graphical error with less than 1 values.
2019-07-09Improve the node configuration warning displayHugo Locurcio
- Refer to properties explicitly when possible - When multiple warnings are returned, always separate them by one blank line to make them easier to distinguish - Improve grammar and formatting
2019-06-16Fix Range's "changed" signal emitting with a value even if binded to emit noneMichael Alexsander Silva Dias
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-09-28Merge pull request #22381 from DualMatrix/range_exp_warningRémi Verschelde
Added warning when min_value of range <= 0 while exp_edit is true.
2018-09-24Fixed step value not being respected for ranges in some cases.DualMatrix
Fixed step value not being respected for ranges in some cases.
2018-09-23Added warning when min_value of range is smaller than 0 while exp_edit is true.DualMatrix
Added warning when min_value of range is smaller than 0 while exp_edit is true. The new warning is: "If exp_edit is true min_value must be > 0."
2018-08-16Fix type of Range allow_greater/allow_lesser propertiesRémi Verschelde
2018-05-16Allow editing of some unbound properties when hinted (or no range hinted)Juan Linietsky
2018-05-15-New inspector.Juan Linietsky
-Changed UI resizing code, gained huge amount of speed. -Reorganized timer sync to clean up behavior (sorry forgot commit this before) -
2018-01-12Bind many more properties to scriptsBojidar Marinov
Notable potentially breaking changes: - PROPERTY_USAGE_NOEDITOR is now PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, without PROPERTY_USAGE_INTERNAL - Some properties were renamed, and sometimes even shadowed by new ones - New getter methods (some virtual) were added
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-09-28Fix crash when unsharing a range that is not sharedDylan Enloe
Added a guard to Range::_unref_shared to prevent it from doing anything in the event that shared is null. Fixes Issue: #11521
2017-08-27Use HTTPS URL for Godot's website in the headersRémi Verschelde
2017-08-24Convert Object::cast_to() to the static versionHein-Pieter van Braam
Currently we rely on some undefined behavior when Object->cast_to() gets called with a Null pointer. This used to work fine with GCC < 6 but newer versions of GCC remove all codepaths in which the this pointer is Null. However, the non-static cast_to() was supposed to be null safe. This patch makes cast_to() Null safe and removes the now redundant Null checks where they existed. It is explained in this article: https://www.viva64.com/en/b/0226/
2017-08-10Removes type information from method bindsIgnacio Etcheverry
2017-07-24Merge pull request #9764 from Noshyaar/pr-fix2Rémi Verschelde
Add object type hint for docs