Skip to content

Commit

Permalink
Merge pull request godotengine#42451 from Duroxxigar/rename-toplevel
Browse files Browse the repository at this point in the history
Renamed toplevel to be top_level
  • Loading branch information
akien-mga authored Oct 2, 2020
2 parents a1c2722 + b687ace commit 19f72be
Show file tree
Hide file tree
Showing 27 changed files with 110 additions and 110 deletions.
2 changes: 1 addition & 1 deletion doc/classes/CanvasItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@
<member name="show_behind_parent" type="bool" setter="set_draw_behind_parent" getter="is_draw_behind_parent_enabled" default="false">
If [code]true[/code], the object draws behind its parent.
</member>
<member name="toplevel" type="bool" setter="set_as_toplevel" getter="is_set_as_toplevel">
<member name="top_level" type="bool" setter="set_as_top_level" getter="is_set_as_top_level">
If [code]true[/code], the node will not inherit its transform from parent [CanvasItem]s.
</member>
<member name="show_on_top" type="bool" setter="_set_on_top" getter="_is_on_top">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Node3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
<member name="scale" type="Vector3" setter="set_scale" getter="get_scale" default="Vector3( 1, 1, 1 )">
Scale part of the local transformation.
</member>
<member name="toplevel" type="bool" setter="set_as_toplevel" getter="is_set_as_toplevel">
<member name="top_level" type="bool" setter="set_as_top_level" getter="is_set_as_top_level">
If [code]true[/code], the node will not inherit its transformations from its parent. Node transformations are only in global space.
</member>
<member name="transform" type="Transform" setter="set_transform" getter="get_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
Expand Down
2 changes: 1 addition & 1 deletion editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5758,7 +5758,7 @@ AnimationTrackEditor::AnimationTrackEditor() {

box_selection = memnew(Control);
add_child(box_selection);
box_selection->set_as_toplevel(true);
box_selection->set_as_top_level(true);
box_selection->set_mouse_filter(MOUSE_FILTER_IGNORE);
box_selection->hide();
box_selection->connect("draw", callable_mp(this, &AnimationTrackEditor::_box_selection_draw));
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_audio_buses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
audioprev_hbc->add_child(audio_value_preview_label);

slider->add_child(audio_value_preview_box);
audio_value_preview_box->set_as_toplevel(true);
audio_value_preview_box->set_as_top_level(true);
Ref<StyleBoxFlat> panel_style = memnew(StyleBoxFlat);
panel_style->set_bg_color(Color(0.0f, 0.0f, 0.0f, 0.8f));
audio_value_preview_box->add_theme_style_override("panel", panel_style);
Expand Down
10 changes: 5 additions & 5 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Size2 EditorProperty::get_minimum_size() const {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}
if (!c->is_visible()) {
Expand Down Expand Up @@ -117,7 +117,7 @@ void EditorProperty::_notification(int p_what) {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}
if (c == bottom_editor) {
Expand Down Expand Up @@ -179,7 +179,7 @@ void EditorProperty::_notification(int p_what) {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}
if (c == bottom_editor) {
Expand Down Expand Up @@ -1133,7 +1133,7 @@ void EditorInspectorSection::_notification(int p_what) {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}
if (!c->is_visible_in_tree()) {
Expand Down Expand Up @@ -1225,7 +1225,7 @@ Size2 EditorInspectorSection::get_minimum_size() const {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}
if (!c->is_visible()) {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_spin_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ EditorSpinSlider::EditorSpinSlider() {
grabber = memnew(TextureRect);
add_child(grabber);
grabber->hide();
grabber->set_as_toplevel(true);
grabber->set_as_top_level(true);
grabber->set_mouse_filter(MOUSE_FILTER_STOP);
grabber->connect("mouse_entered", callable_mp(this, &EditorSpinSlider::_grabber_mouse_entered));
grabber->connect("mouse_exited", callable_mp(this, &EditorSpinSlider::_grabber_mouse_exited));
Expand Down
10 changes: 5 additions & 5 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void CanvasItemEditor::_expand_encompassing_rect_using_children(Rect2 &r_rect, c
const CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);

for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
if (canvas_item && !canvas_item->is_set_as_toplevel()) {
if (canvas_item && !canvas_item->is_set_as_top_level()) {
_expand_encompassing_rect_using_children(r_rect, p_node->get_child(i), r_first, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
} else {
const CanvasLayer *canvas_layer = Object::cast_to<CanvasLayer>(p_node);
Expand Down Expand Up @@ -591,7 +591,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no

for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
if (canvas_item) {
if (!canvas_item->is_set_as_toplevel()) {
if (!canvas_item->is_set_as_top_level()) {
_find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
} else {
_find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, canvas_item->get_transform(), p_canvas_xform);
Expand Down Expand Up @@ -767,7 +767,7 @@ void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_n
if (!lock_children || !editable) {
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
if (canvas_item) {
if (!canvas_item->is_set_as_toplevel()) {
if (!canvas_item->is_set_as_top_level()) {
_find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
} else {
_find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, canvas_item->get_transform(), p_canvas_xform);
Expand Down Expand Up @@ -3626,7 +3626,7 @@ void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Trans
Transform2D parent_xform = p_parent_xform;
Transform2D canvas_xform = p_canvas_xform;

if (canvas_item && !canvas_item->is_set_as_toplevel()) {
if (canvas_item && !canvas_item->is_set_as_top_level()) {
parent_xform = parent_xform * canvas_item->get_transform();
} else {
CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node);
Expand Down Expand Up @@ -3695,7 +3695,7 @@ void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p
Transform2D parent_xform = p_parent_xform;
Transform2D canvas_xform = p_canvas_xform;

if (canvas_item && !canvas_item->is_set_as_toplevel()) {
if (canvas_item && !canvas_item->is_set_as_top_level()) {
parent_xform = parent_xform * canvas_item->get_transform();
} else {
CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node);
Expand Down
34 changes: 17 additions & 17 deletions scene/3d/node_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void Node3D::_propagate_transform_changed(Node3D *p_origin) {
data.children_lock++;

for (List<Node3D *>::Element *E = data.children.front(); E; E = E->next()) {
if (E->get()->data.toplevel_active) {
if (E->get()->data.top_level_active) {
continue; //don't propagate to a toplevel
}
E->get()->_propagate_transform_changed(p_origin);
Expand Down Expand Up @@ -136,12 +136,12 @@ void Node3D::_notification(int p_what) {
data.C = nullptr;
}

if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) {
if (data.top_level && !Engine::get_singleton()->is_editor_hint()) {
if (data.parent) {
data.local_transform = data.parent->get_global_transform() * get_transform();
data.dirty = DIRTY_VECTORS; //global is always dirty upon entering a scene
}
data.toplevel_active = true;
data.top_level_active = true;
}

data.dirty |= DIRTY_GLOBAL; //global is always dirty upon entering a scene
Expand All @@ -160,7 +160,7 @@ void Node3D::_notification(int p_what) {
}
data.parent = nullptr;
data.C = nullptr;
data.toplevel_active = false;
data.top_level_active = false;
} break;
case NOTIFICATION_ENTER_WORLD: {
data.inside_world = true;
Expand Down Expand Up @@ -238,7 +238,7 @@ void Node3D::set_transform(const Transform &p_transform) {

void Node3D::set_global_transform(const Transform &p_transform) {
Transform xform =
(data.parent && !data.toplevel_active) ?
(data.parent && !data.top_level_active) ?
data.parent->get_global_transform().affine_inverse() * p_transform :
p_transform;

Expand All @@ -261,7 +261,7 @@ Transform Node3D::get_global_transform() const {
_update_local_transform();
}

if (data.parent && !data.toplevel_active) {
if (data.parent && !data.top_level_active) {
data.global_transform = data.parent->get_global_transform() * data.local_transform;
} else {
data.global_transform = data.local_transform;
Expand Down Expand Up @@ -462,8 +462,8 @@ bool Node3D::is_scale_disabled() const {
return data.disable_scale;
}

void Node3D::set_as_toplevel(bool p_enabled) {
if (data.toplevel == p_enabled) {
void Node3D::set_as_top_level(bool p_enabled) {
if (data.top_level == p_enabled) {
return;
}
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
Expand All @@ -473,16 +473,16 @@ void Node3D::set_as_toplevel(bool p_enabled) {
set_transform(data.parent->get_global_transform().affine_inverse() * get_global_transform());
}

data.toplevel = p_enabled;
data.toplevel_active = p_enabled;
data.top_level = p_enabled;
data.top_level_active = p_enabled;

} else {
data.toplevel = p_enabled;
data.top_level = p_enabled;
}
}

bool Node3D::is_set_as_toplevel() const {
return data.toplevel;
bool Node3D::is_set_as_top_level() const {
return data.top_level;
}

Ref<World3D> Node3D::get_world_3d() const {
Expand Down Expand Up @@ -715,8 +715,8 @@ void Node3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_global_transform"), &Node3D::get_global_transform);
ClassDB::bind_method(D_METHOD("get_parent_spatial"), &Node3D::get_parent_spatial);
ClassDB::bind_method(D_METHOD("set_ignore_transform_notification", "enabled"), &Node3D::set_ignore_transform_notification);
ClassDB::bind_method(D_METHOD("set_as_toplevel", "enable"), &Node3D::set_as_toplevel);
ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Node3D::is_set_as_toplevel);
ClassDB::bind_method(D_METHOD("set_as_toplevel", "enable"), &Node3D::set_as_top_level);
ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Node3D::is_set_as_top_level);
ClassDB::bind_method(D_METHOD("set_disable_scale", "disable"), &Node3D::set_disable_scale);
ClassDB::bind_method(D_METHOD("is_scale_disabled"), &Node3D::is_scale_disabled);
ClassDB::bind_method(D_METHOD("get_world_3d"), &Node3D::get_world_3d);
Expand Down Expand Up @@ -789,8 +789,8 @@ Node3D::Node3D() :
data.children_lock = 0;

data.ignore_notification = false;
data.toplevel = false;
data.toplevel_active = false;
data.top_level = false;
data.top_level_active = false;
data.scale = Vector3(1, 1, 1);
data.viewport = nullptr;
data.inside_world = false;
Expand Down
8 changes: 4 additions & 4 deletions scene/3d/node_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class Node3D : public Node {

Viewport *viewport;

bool toplevel_active;
bool toplevel;
bool top_level_active;
bool top_level;
bool inside_world;

int children_lock;
Expand Down Expand Up @@ -144,8 +144,8 @@ class Node3D : public Node {
virtual Transform get_local_gizmo_transform() const;
#endif

void set_as_toplevel(bool p_enabled);
bool is_set_as_toplevel() const;
void set_as_top_level(bool p_enabled);
bool is_set_as_top_level() const;

void set_disable_scale(bool p_enabled);
bool is_scale_disabled() const;
Expand Down
4 changes: 2 additions & 2 deletions scene/3d/physics_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@ void PhysicalBone3D::_start_physics_simulation() {
PhysicsServer3D::get_singleton()->body_set_collision_layer(get_rid(), get_collision_layer());
PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), get_collision_mask());
PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
set_as_toplevel(true);
set_as_top_level(true);
_internal_simulate_physics = true;
}

Expand All @@ -2626,7 +2626,7 @@ void PhysicalBone3D::_stop_physics_simulation() {
if (_internal_simulate_physics) {
PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), nullptr, "");
parent_skeleton->set_bone_global_pose_override(bone_id, Transform(), 0.0, false);
set_as_toplevel(false);
set_as_top_level(false);
_internal_simulate_physics = false;
}
}
2 changes: 1 addition & 1 deletion scene/3d/soft_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void SoftBody3D::_notification(int p_what) {

set_notify_transform(false);
// Required to be top level with Transform at center of world in order to modify RenderingServer only to support custom Transform
set_as_toplevel(true);
set_as_top_level(true);
set_transform(Transform());
set_notify_transform(true);

Expand Down
8 changes: 4 additions & 4 deletions scene/gui/box_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void BoxContainer::_resort() {
if (!c || !c->is_visible_in_tree()) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}

Expand Down Expand Up @@ -111,7 +111,7 @@ void BoxContainer::_resort() {
if (!c || !c->is_visible_in_tree()) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}

Expand Down Expand Up @@ -172,7 +172,7 @@ void BoxContainer::_resort() {
if (!c || !c->is_visible_in_tree()) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}

Expand Down Expand Up @@ -224,7 +224,7 @@ Size2 BoxContainer::get_minimum_size() const {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions scene/gui/center_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Size2 CenterContainer::get_minimum_size() const {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}
if (!c->is_visible()) {
Expand Down Expand Up @@ -77,7 +77,7 @@ void CenterContainer::_notification(int p_what) {
if (!c) {
continue;
}
if (c->is_set_as_toplevel()) {
if (c->is_set_as_top_level()) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion scene/gui/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ void ColorPicker::_screen_pick_pressed() {
if (!screen) {
screen = memnew(Control);
r->add_child(screen);
screen->set_as_toplevel(true);
screen->set_as_top_level(true);
screen->set_anchors_and_margins_preset(Control::PRESET_WIDE);
screen->set_default_cursor_shape(CURSOR_POINTING_HAND);
screen->connect("gui_input", callable_mp(this, &ColorPicker::_screen_input));
Expand Down
Loading

0 comments on commit 19f72be

Please sign in to comment.