mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-11-22 00:48:09 +01:00
Moved the y_sort property from YSort to Node2D. Node2d has it off by default while YSort has it on by default.
This commit is contained in:
parent
8953d84f29
commit
1b14af3a98
@ -132,6 +132,9 @@
|
||||
<member name="z_index" type="int" setter="set_z_index" getter="get_z_index" default="0">
|
||||
Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between [constant RenderingServer.CANVAS_ITEM_Z_MIN] and [constant RenderingServer.CANVAS_ITEM_Z_MAX] (inclusive).
|
||||
</member>
|
||||
<member name="sort_enabled" type="bool" setter="set_sort_enabled" getter="is_sort_enabled" default="true">
|
||||
If [code]true[/code], child nodes are sorted, otherwise sorting is disabled.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
</constants>
|
||||
|
@ -12,9 +12,6 @@
|
||||
<methods>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="sort_enabled" type="bool" setter="set_sort_enabled" getter="is_sort_enabled" default="true">
|
||||
If [code]true[/code], child nodes are sorted, otherwise sorting is disabled.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
</constants>
|
||||
|
@ -31,24 +31,7 @@
|
||||
|
||||
#include "y_sort.h"
|
||||
|
||||
void YSort::set_sort_enabled(bool p_enabled) {
|
||||
sort_enabled = p_enabled;
|
||||
RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), sort_enabled);
|
||||
}
|
||||
|
||||
bool YSort::is_sort_enabled() const {
|
||||
return sort_enabled;
|
||||
}
|
||||
|
||||
void YSort::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_sort_enabled", "enabled"), &YSort::set_sort_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_sort_enabled"), &YSort::is_sort_enabled);
|
||||
|
||||
ADD_GROUP("Sort", "sort_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sort_enabled"), "set_sort_enabled", "is_sort_enabled");
|
||||
}
|
||||
|
||||
YSort::YSort() {
|
||||
sort_enabled = true;
|
||||
_sort_enabled = true;
|
||||
RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), true);
|
||||
}
|
||||
|
@ -36,12 +36,8 @@
|
||||
|
||||
class YSort : public Node2D {
|
||||
GDCLASS(YSort, Node2D);
|
||||
bool sort_enabled;
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void set_sort_enabled(bool p_enabled);
|
||||
bool is_sort_enabled() const;
|
||||
YSort();
|
||||
};
|
||||
|
||||
|
@ -350,6 +350,19 @@ int Node2D::get_z_index() const {
|
||||
return z_index;
|
||||
}
|
||||
|
||||
void Node2D::set_sort_enabled(bool p_enabled) {
|
||||
if (_sort_enabled == p_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
_sort_enabled = p_enabled;
|
||||
RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), _sort_enabled);
|
||||
}
|
||||
|
||||
bool Node2D::is_sort_enabled() const {
|
||||
return _sort_enabled;
|
||||
}
|
||||
|
||||
Transform2D Node2D::get_relative_transform_to_parent(const Node *p_parent) const {
|
||||
if (p_parent == this) {
|
||||
return Transform2D();
|
||||
@ -438,6 +451,9 @@ void Node2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_z_as_relative", "enable"), &Node2D::set_z_as_relative);
|
||||
ClassDB::bind_method(D_METHOD("is_z_relative"), &Node2D::is_z_relative);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_sort_enabled", "enabled"), &Node2D::set_sort_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_sort_enabled"), &Node2D::is_sort_enabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent);
|
||||
|
||||
ADD_GROUP("Transform", "");
|
||||
@ -456,6 +472,10 @@ void Node2D::_bind_methods() {
|
||||
ADD_GROUP("Z Index", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_index", "get_z_index");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "z_as_relative"), "set_z_as_relative", "is_z_relative");
|
||||
|
||||
ADD_GROUP("Sort", "sort_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sort_enabled"), "set_sort_enabled", "is_sort_enabled");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel"), "set_as_toplevel", "is_set_as_toplevel");
|
||||
}
|
||||
|
||||
@ -470,6 +490,7 @@ StringName Node2D::get_property_store_alias(const StringName &p_property) const
|
||||
#endif
|
||||
|
||||
Node2D::Node2D() {
|
||||
_sort_enabled = false;
|
||||
angle = 0;
|
||||
_scale = Vector2(1, 1);
|
||||
_xform_dirty = false;
|
||||
|
@ -52,6 +52,8 @@ class Node2D : public CanvasItem {
|
||||
void _update_xform_values();
|
||||
|
||||
protected:
|
||||
bool _sort_enabled;
|
||||
|
||||
void _notification(int p_notification);
|
||||
static void _bind_methods();
|
||||
|
||||
@ -114,6 +116,9 @@ public:
|
||||
void set_z_as_relative(bool p_enabled);
|
||||
bool is_z_relative() const;
|
||||
|
||||
void set_sort_enabled(bool p_enabled);
|
||||
bool is_sort_enabled() const;
|
||||
|
||||
Transform2D get_relative_transform_to_parent(const Node *p_parent) const;
|
||||
|
||||
Transform2D get_transform() const;
|
||||
|
Loading…
Reference in New Issue
Block a user