summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/subviewport_container.cpp (renamed from scene/gui/viewport_container.cpp)36
-rw-r--r--scene/gui/subviewport_container.h (renamed from scene/gui/viewport_container.h)8
-rw-r--r--scene/register_scene_types.cpp5
3 files changed, 25 insertions, 24 deletions
diff --git a/scene/gui/viewport_container.cpp b/scene/gui/subviewport_container.cpp
index 7ce1d9e551..50f468741d 100644
--- a/scene/gui/viewport_container.cpp
+++ b/scene/gui/subviewport_container.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* viewport_container.cpp */
+/* subviewport_container.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,12 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "viewport_container.h"
+#include "subviewport_container.h"
#include "core/engine.h"
#include "scene/main/viewport.h"
-Size2 ViewportContainer::get_minimum_size() const {
+Size2 SubViewportContainer::get_minimum_size() const {
if (stretch)
return Size2();
@@ -52,19 +52,19 @@ Size2 ViewportContainer::get_minimum_size() const {
return ms;
}
-void ViewportContainer::set_stretch(bool p_enable) {
+void SubViewportContainer::set_stretch(bool p_enable) {
stretch = p_enable;
queue_sort();
update();
}
-bool ViewportContainer::is_stretch_enabled() const {
+bool SubViewportContainer::is_stretch_enabled() const {
return stretch;
}
-void ViewportContainer::set_stretch_shrink(int p_shrink) {
+void SubViewportContainer::set_stretch_shrink(int p_shrink) {
ERR_FAIL_COND(p_shrink < 1);
if (shrink == p_shrink)
@@ -87,12 +87,12 @@ void ViewportContainer::set_stretch_shrink(int p_shrink) {
update();
}
-int ViewportContainer::get_stretch_shrink() const {
+int SubViewportContainer::get_stretch_shrink() const {
return shrink;
}
-void ViewportContainer::_notification(int p_what) {
+void SubViewportContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_RESIZED) {
@@ -142,7 +142,7 @@ void ViewportContainer::_notification(int p_what) {
}
}
-void ViewportContainer::_input(const Ref<InputEvent> &p_event) {
+void SubViewportContainer::_input(const Ref<InputEvent> &p_event) {
if (Engine::get_singleton()->is_editor_hint())
return;
@@ -167,7 +167,7 @@ void ViewportContainer::_input(const Ref<InputEvent> &p_event) {
}
}
-void ViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) {
+void SubViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) {
if (Engine::get_singleton()->is_editor_hint())
return;
@@ -192,21 +192,21 @@ void ViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) {
}
}
-void ViewportContainer::_bind_methods() {
+void SubViewportContainer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_unhandled_input", "event"), &ViewportContainer::_unhandled_input);
- ClassDB::bind_method(D_METHOD("_input", "event"), &ViewportContainer::_input);
- ClassDB::bind_method(D_METHOD("set_stretch", "enable"), &ViewportContainer::set_stretch);
- ClassDB::bind_method(D_METHOD("is_stretch_enabled"), &ViewportContainer::is_stretch_enabled);
+ ClassDB::bind_method(D_METHOD("_unhandled_input", "event"), &SubViewportContainer::_unhandled_input);
+ ClassDB::bind_method(D_METHOD("_input", "event"), &SubViewportContainer::_input);
+ ClassDB::bind_method(D_METHOD("set_stretch", "enable"), &SubViewportContainer::set_stretch);
+ ClassDB::bind_method(D_METHOD("is_stretch_enabled"), &SubViewportContainer::is_stretch_enabled);
- ClassDB::bind_method(D_METHOD("set_stretch_shrink", "amount"), &ViewportContainer::set_stretch_shrink);
- ClassDB::bind_method(D_METHOD("get_stretch_shrink"), &ViewportContainer::get_stretch_shrink);
+ ClassDB::bind_method(D_METHOD("set_stretch_shrink", "amount"), &SubViewportContainer::set_stretch_shrink);
+ ClassDB::bind_method(D_METHOD("get_stretch_shrink"), &SubViewportContainer::get_stretch_shrink);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stretch"), "set_stretch", "is_stretch_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "stretch_shrink"), "set_stretch_shrink", "get_stretch_shrink");
}
-ViewportContainer::ViewportContainer() {
+SubViewportContainer::SubViewportContainer() {
stretch = false;
shrink = 1;
diff --git a/scene/gui/viewport_container.h b/scene/gui/subviewport_container.h
index 8597444426..6ff3d188e2 100644
--- a/scene/gui/viewport_container.h
+++ b/scene/gui/subviewport_container.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* viewport_container.h */
+/* subviewport_container.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -33,9 +33,9 @@
#include "scene/gui/container.h"
-class ViewportContainer : public Container {
+class SubViewportContainer : public Container {
- GDCLASS(ViewportContainer, Container);
+ GDCLASS(SubViewportContainer, Container);
bool stretch;
int shrink;
@@ -55,7 +55,7 @@ public:
virtual Size2 get_minimum_size() const;
- ViewportContainer();
+ SubViewportContainer();
};
#endif // VIEWPORTCONTAINER_H
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 22c000fae7..76fbc9dbf8 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -110,6 +110,7 @@
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/split_container.h"
+#include "scene/gui/subviewport_container.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/tabs.h"
#include "scene/gui/text_edit.h"
@@ -119,7 +120,6 @@
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "scene/gui/video_player.h"
-#include "scene/gui/viewport_container.h"
#include "scene/main/canvas_item.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/http_request.h"
@@ -357,7 +357,7 @@ void register_scene_types() {
ClassDB::register_class<ConfirmationDialog>();
ClassDB::register_class<MarginContainer>();
- ClassDB::register_class<ViewportContainer>();
+ ClassDB::register_class<SubViewportContainer>();
ClassDB::register_virtual_class<SplitContainer>();
ClassDB::register_class<HSplitContainer>();
ClassDB::register_class<VSplitContainer>();
@@ -842,6 +842,7 @@ void register_scene_types() {
ClassDB::add_compatibility_class("StaticBody", "StaticBody3D");
ClassDB::add_compatibility_class("VehicleBody", "VehicleBody3D");
ClassDB::add_compatibility_class("VehicleWheel", "VehicleWheel3D");
+ ClassDB::add_compatibility_class("ViewportContainer", "SubViewportContainer");
ClassDB::add_compatibility_class("VisibilityEnabler", "VisibilityEnabler3D");
ClassDB::add_compatibility_class("VisibilityNotifier", "VisibilityNotifier3D");
ClassDB::add_compatibility_class("VisualServer", "RenderingServer");