summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/light_3d.cpp33
-rw-r--r--scene/3d/light_3d.h5
-rw-r--r--scene/3d/xr_nodes.cpp (renamed from scene/3d/arvr_nodes.cpp)320
-rw-r--r--scene/3d/xr_nodes.h (renamed from scene/3d/arvr_nodes.h)64
-rw-r--r--scene/gui/control.cpp4
-rw-r--r--scene/gui/dialogs.cpp1
-rw-r--r--scene/gui/file_dialog.cpp66
-rw-r--r--scene/gui/file_dialog.h22
-rw-r--r--scene/gui/option_button.cpp4
-rw-r--r--scene/gui/rich_text_label.cpp10
-rw-r--r--scene/gui/slider.cpp5
-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/gui/tabs.cpp30
-rw-r--r--scene/gui/texture_rect.cpp9
-rw-r--r--scene/gui/tree.cpp7
-rw-r--r--scene/main/canvas_layer.cpp8
-rw-r--r--scene/main/instance_placeholder.cpp2
-rw-r--r--scene/main/node.cpp11
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/viewport.cpp82
-rw-r--r--scene/main/viewport.h22
-rw-r--r--scene/main/window.cpp2
-rw-r--r--scene/register_scene_types.cpp19
-rw-r--r--scene/resources/default_theme/default_theme.cpp2
-rw-r--r--scene/resources/material.cpp168
-rw-r--r--scene/resources/material.h52
-rw-r--r--scene/resources/visual_shader.cpp11
-rw-r--r--scene/resources/visual_shader.h2
29 files changed, 576 insertions, 431 deletions
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index be3b369724..2455d46e43 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -217,8 +217,12 @@ bool Light3D::is_editor_only() const {
void Light3D::_validate_property(PropertyInfo &property) const {
- if (RenderingServer::get_singleton()->is_low_end() && property.name == "shadow_contact") {
- property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
+ if (get_light_type() == RS::LIGHT_DIRECTIONAL && property.name == "light_size") {
+ property.usage = 0;
+ }
+
+ if (get_light_type() != RS::LIGHT_DIRECTIONAL && property.name == "light_angular_distance") {
+ property.usage = 0;
}
}
@@ -255,6 +259,8 @@ void Light3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_color", "get_color");
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "light_energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_param", "get_param", PARAM_ENERGY);
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "light_indirect_energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_param", "get_param", PARAM_INDIRECT_ENERGY);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "light_size", PROPERTY_HINT_RANGE, "0,64,0.01,or_greater"), "set_param", "get_param", PARAM_SIZE);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "light_angular_distance", PROPERTY_HINT_RANGE, "0,90,0.01"), "set_param", "get_param", PARAM_SIZE);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "light_negative"), "set_negative", "is_negative");
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "light_specular", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_SPECULAR);
ADD_PROPERTY(PropertyInfo(Variant::INT, "light_bake_mode", PROPERTY_HINT_ENUM, "Disable,Indirect,All"), "set_bake_mode", "get_bake_mode");
@@ -262,9 +268,10 @@ void Light3D::_bind_methods() {
ADD_GROUP("Shadow", "shadow_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_enabled"), "set_shadow", "has_shadow");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "shadow_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_shadow_color", "get_shadow_color");
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "shadow_bias", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "shadow_contact", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_CONTACT_SHADOW_SIZE);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "shadow_bias", PROPERTY_HINT_RANGE, "0,10,0.001"), "set_param", "get_param", PARAM_SHADOW_BIAS);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "shadow_normal_bias", PROPERTY_HINT_RANGE, "0,10,0.001"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_reverse_cull_face"), "set_shadow_reverse_cull_face", "get_shadow_reverse_cull_face");
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "shadow_transmittance_bias", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_param", "get_param", PARAM_TRANSMITTANCE_BIAS);
ADD_GROUP("Editor", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only");
ADD_GROUP("", "");
@@ -276,7 +283,6 @@ void Light3D::_bind_methods() {
BIND_ENUM_CONSTANT(PARAM_ATTENUATION);
BIND_ENUM_CONSTANT(PARAM_SPOT_ANGLE);
BIND_ENUM_CONSTANT(PARAM_SPOT_ATTENUATION);
- BIND_ENUM_CONSTANT(PARAM_CONTACT_SHADOW_SIZE);
BIND_ENUM_CONSTANT(PARAM_SHADOW_MAX_DISTANCE);
BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_1_OFFSET);
BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_2_OFFSET);
@@ -284,7 +290,8 @@ void Light3D::_bind_methods() {
BIND_ENUM_CONSTANT(PARAM_SHADOW_FADE_START);
BIND_ENUM_CONSTANT(PARAM_SHADOW_NORMAL_BIAS);
BIND_ENUM_CONSTANT(PARAM_SHADOW_BIAS);
- BIND_ENUM_CONSTANT(PARAM_SHADOW_BIAS_SPLIT_SCALE);
+ BIND_ENUM_CONSTANT(PARAM_SHADOW_PANCAKE_SIZE);
+ BIND_ENUM_CONSTANT(PARAM_TRANSMITTANCE_BIAS);
BIND_ENUM_CONSTANT(PARAM_MAX);
BIND_ENUM_CONSTANT(BAKE_DISABLED);
@@ -318,17 +325,19 @@ Light3D::Light3D(RenderingServer::LightType p_type) {
set_param(PARAM_INDIRECT_ENERGY, 1);
set_param(PARAM_SPECULAR, 0.5);
set_param(PARAM_RANGE, 5);
+ set_param(PARAM_SIZE, 0);
set_param(PARAM_ATTENUATION, 1);
set_param(PARAM_SPOT_ANGLE, 45);
set_param(PARAM_SPOT_ATTENUATION, 1);
- set_param(PARAM_CONTACT_SHADOW_SIZE, 0);
set_param(PARAM_SHADOW_MAX_DISTANCE, 0);
set_param(PARAM_SHADOW_SPLIT_1_OFFSET, 0.1);
set_param(PARAM_SHADOW_SPLIT_2_OFFSET, 0.2);
set_param(PARAM_SHADOW_SPLIT_3_OFFSET, 0.5);
set_param(PARAM_SHADOW_FADE_START, 0.8);
- set_param(PARAM_SHADOW_NORMAL_BIAS, 0.0);
- set_param(PARAM_SHADOW_BIAS, 0.15);
+ set_param(PARAM_SHADOW_PANCAKE_SIZE, 20.0);
+ set_param(PARAM_SHADOW_BIAS, 0.02);
+ set_param(PARAM_SHADOW_NORMAL_BIAS, 1.0);
+ set_param(PARAM_TRANSMITTANCE_BIAS, 0.05);
set_param(PARAM_SHADOW_FADE_START, 1);
set_disable_scale(true);
}
@@ -398,10 +407,9 @@ void DirectionalLight3D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "directional_shadow_split_3", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_param", "get_param", PARAM_SHADOW_SPLIT_3_OFFSET);
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "directional_shadow_fade_start", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_SHADOW_FADE_START);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "directional_shadow_blend_splits"), "set_blend_splits", "is_blend_splits_enabled");
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "directional_shadow_normal_bias", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "directional_shadow_bias_split_scale", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS_SPLIT_SCALE);
ADD_PROPERTY(PropertyInfo(Variant::INT, "directional_shadow_depth_range", PROPERTY_HINT_ENUM, "Stable,Optimized"), "set_shadow_depth_range", "get_shadow_depth_range");
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "directional_shadow_max_distance", PROPERTY_HINT_EXP_RANGE, "0,8192,0.1,or_greater"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "directional_shadow_pancake_size", PROPERTY_HINT_EXP_RANGE, "0,1024,0.1,or_greater"), "set_param", "get_param", PARAM_SHADOW_PANCAKE_SIZE);
BIND_ENUM_CONSTANT(SHADOW_ORTHOGONAL);
BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS);
@@ -414,11 +422,8 @@ void DirectionalLight3D::_bind_methods() {
DirectionalLight3D::DirectionalLight3D() :
Light3D(RenderingServer::LIGHT_DIRECTIONAL) {
- set_param(PARAM_SHADOW_NORMAL_BIAS, 0.8);
- set_param(PARAM_SHADOW_BIAS, 0.1);
set_param(PARAM_SHADOW_MAX_DISTANCE, 100);
set_param(PARAM_SHADOW_FADE_START, 0.8);
- set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE, 0.25);
set_shadow_mode(SHADOW_PARALLEL_4_SPLITS);
set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE);
diff --git a/scene/3d/light_3d.h b/scene/3d/light_3d.h
index 197e5854ec..21810e03dd 100644
--- a/scene/3d/light_3d.h
+++ b/scene/3d/light_3d.h
@@ -46,10 +46,10 @@ public:
PARAM_INDIRECT_ENERGY = RS::LIGHT_PARAM_INDIRECT_ENERGY,
PARAM_SPECULAR = RS::LIGHT_PARAM_SPECULAR,
PARAM_RANGE = RS::LIGHT_PARAM_RANGE,
+ PARAM_SIZE = RS::LIGHT_PARAM_SIZE,
PARAM_ATTENUATION = RS::LIGHT_PARAM_ATTENUATION,
PARAM_SPOT_ANGLE = RS::LIGHT_PARAM_SPOT_ANGLE,
PARAM_SPOT_ATTENUATION = RS::LIGHT_PARAM_SPOT_ATTENUATION,
- PARAM_CONTACT_SHADOW_SIZE = RS::LIGHT_PARAM_CONTACT_SHADOW_SIZE,
PARAM_SHADOW_MAX_DISTANCE = RS::LIGHT_PARAM_SHADOW_MAX_DISTANCE,
PARAM_SHADOW_SPLIT_1_OFFSET = RS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET,
PARAM_SHADOW_SPLIT_2_OFFSET = RS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET,
@@ -57,7 +57,8 @@ public:
PARAM_SHADOW_FADE_START = RS::LIGHT_PARAM_SHADOW_FADE_START,
PARAM_SHADOW_NORMAL_BIAS = RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS,
PARAM_SHADOW_BIAS = RS::LIGHT_PARAM_SHADOW_BIAS,
- PARAM_SHADOW_BIAS_SPLIT_SCALE = RS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
+ PARAM_SHADOW_PANCAKE_SIZE = RS::LIGHT_PARAM_SHADOW_PANCAKE_SIZE,
+ PARAM_TRANSMITTANCE_BIAS = RS::LIGHT_PARAM_TRANSMITTANCE_BIAS,
PARAM_MAX = RS::LIGHT_PARAM_MAX
};
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/xr_nodes.cpp
index 537c094ceb..0373114e7d 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* arvr_nodes.cpp */
+/* xr_nodes.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,25 +28,25 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "arvr_nodes.h"
+#include "xr_nodes.h"
#include "core/input/input_filter.h"
-#include "servers/arvr/arvr_interface.h"
-#include "servers/arvr_server.h"
+#include "servers/xr/xr_interface.h"
+#include "servers/xr_server.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
-void ARVRCamera::_notification(int p_what) {
+void XRCamera3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- // need to find our ARVROrigin parent and let it know we're its camera!
- ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
+ // need to find our XROrigin3D parent and let it know we're its camera!
+ XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin != nullptr) {
origin->set_tracked_camera(this);
}
}; break;
case NOTIFICATION_EXIT_TREE: {
- // need to find our ARVROrigin parent and let it know we're no longer its camera!
- ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
+ // need to find our XROrigin3D parent and let it know we're no longer its camera!
+ XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin != nullptr) {
origin->clear_tracked_camera_if(this);
}
@@ -54,26 +54,26 @@ void ARVRCamera::_notification(int p_what) {
};
};
-String ARVRCamera::get_configuration_warning() const {
+String XRCamera3D::get_configuration_warning() const {
if (!is_visible() || !is_inside_tree())
return String();
- // must be child node of ARVROrigin!
- ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
+ // must be child node of XROrigin3D!
+ XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin == nullptr) {
- return TTR("ARVRCamera must have an ARVROrigin node as its parent.");
+ return TTR("XRCamera3D must have an XROrigin3D node as its parent.");
};
return String();
};
-Vector3 ARVRCamera::project_local_ray_normal(const Point2 &p_pos) const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, Vector3());
+Vector3 XRCamera3D::project_local_ray_normal(const Point2 &p_pos) const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, Vector3());
- Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- if (arvr_interface.is_null()) {
+ Ref<XRInterface> xr_interface = xr_server->get_primary_interface();
+ if (xr_interface.is_null()) {
// we might be in the editor or have VR turned off, just call superclass
return Camera3D::project_local_ray_normal(p_pos);
}
@@ -84,20 +84,20 @@ Vector3 ARVRCamera::project_local_ray_normal(const Point2 &p_pos) const {
Vector2 cpos = get_viewport()->get_camera_coords(p_pos);
Vector3 ray;
- CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+ CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
Vector2 screen_he = cm.get_viewport_half_extents();
ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -get_znear()).normalized();
return ray;
};
-Point2 ARVRCamera::unproject_position(const Vector3 &p_pos) const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, Vector2());
+Point2 XRCamera3D::unproject_position(const Vector3 &p_pos) const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, Vector2());
- Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- if (arvr_interface.is_null()) {
+ Ref<XRInterface> xr_interface = xr_server->get_primary_interface();
+ if (xr_interface.is_null()) {
// we might be in the editor or have VR turned off, just call superclass
return Camera3D::unproject_position(p_pos);
}
@@ -106,7 +106,7 @@ Point2 ARVRCamera::unproject_position(const Vector3 &p_pos) const {
Size2 viewport_size = get_viewport()->get_visible_rect().size;
- CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+ CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
Plane p(get_camera_transform().xform_inv(p_pos), 1.0);
@@ -120,13 +120,13 @@ Point2 ARVRCamera::unproject_position(const Vector3 &p_pos) const {
return res;
};
-Vector3 ARVRCamera::project_position(const Point2 &p_point, float p_z_depth) const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, Vector3());
+Vector3 XRCamera3D::project_position(const Point2 &p_point, float p_z_depth) const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, Vector3());
- Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- if (arvr_interface.is_null()) {
+ Ref<XRInterface> xr_interface = xr_server->get_primary_interface();
+ if (xr_interface.is_null()) {
// we might be in the editor or have VR turned off, just call superclass
return Camera3D::project_position(p_point, p_z_depth);
}
@@ -135,7 +135,7 @@ Vector3 ARVRCamera::project_position(const Point2 &p_point, float p_z_depth) con
Size2 viewport_size = get_viewport()->get_visible_rect().size;
- CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+ CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
Vector2 vp_he = cm.get_viewport_half_extents();
@@ -149,13 +149,13 @@ Vector3 ARVRCamera::project_position(const Point2 &p_point, float p_z_depth) con
return get_camera_transform().xform(p);
};
-Vector<Plane> ARVRCamera::get_frustum() const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, Vector<Plane>());
+Vector<Plane> XRCamera3D::get_frustum() const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, Vector<Plane>());
- Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- if (arvr_interface.is_null()) {
+ Ref<XRInterface> xr_interface = xr_server->get_primary_interface();
+ if (xr_interface.is_null()) {
// we might be in the editor or have VR turned off, just call superclass
return Camera3D::get_frustum();
}
@@ -163,21 +163,21 @@ Vector<Plane> ARVRCamera::get_frustum() const {
ERR_FAIL_COND_V(!is_inside_world(), Vector<Plane>());
Size2 viewport_size = get_viewport()->get_visible_rect().size;
- CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+ CameraMatrix cm = xr_interface->get_projection_for_eye(XRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
return cm.get_projection_planes(get_camera_transform());
};
-ARVRCamera::ARVRCamera(){
+XRCamera3D::XRCamera3D(){
// nothing to do here yet for now..
};
-ARVRCamera::~ARVRCamera(){
+XRCamera3D::~XRCamera3D(){
// nothing to do here yet for now..
};
////////////////////////////////////////////////////////////////////////////////////////////////////
-void ARVRController::_notification(int p_what) {
+void XRController3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
set_process_internal(true);
@@ -186,12 +186,12 @@ void ARVRController::_notification(int p_what) {
set_process_internal(false);
}; break;
case NOTIFICATION_INTERNAL_PROCESS: {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL(arvr_server);
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL(xr_server);
// find the tracker for our controller
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, controller_id);
if (tracker == nullptr) {
// this controller is currently turned off
is_active = false;
@@ -236,49 +236,49 @@ void ARVRController::_notification(int p_what) {
};
};
-void ARVRController::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_controller_id", "controller_id"), &ARVRController::set_controller_id);
- ClassDB::bind_method(D_METHOD("get_controller_id"), &ARVRController::get_controller_id);
+void XRController3D::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_controller_id", "controller_id"), &XRController3D::set_controller_id);
+ ClassDB::bind_method(D_METHOD("get_controller_id"), &XRController3D::get_controller_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_id", PROPERTY_HINT_RANGE, "0,32,1"), "set_controller_id", "get_controller_id");
- ClassDB::bind_method(D_METHOD("get_controller_name"), &ARVRController::get_controller_name);
+ ClassDB::bind_method(D_METHOD("get_controller_name"), &XRController3D::get_controller_name);
// passthroughs to information about our related joystick
- ClassDB::bind_method(D_METHOD("get_joystick_id"), &ARVRController::get_joystick_id);
- ClassDB::bind_method(D_METHOD("is_button_pressed", "button"), &ARVRController::is_button_pressed);
- ClassDB::bind_method(D_METHOD("get_joystick_axis", "axis"), &ARVRController::get_joystick_axis);
+ ClassDB::bind_method(D_METHOD("get_joystick_id"), &XRController3D::get_joystick_id);
+ ClassDB::bind_method(D_METHOD("is_button_pressed", "button"), &XRController3D::is_button_pressed);
+ ClassDB::bind_method(D_METHOD("get_joystick_axis", "axis"), &XRController3D::get_joystick_axis);
- ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRController::get_is_active);
- ClassDB::bind_method(D_METHOD("get_hand"), &ARVRController::get_hand);
+ ClassDB::bind_method(D_METHOD("get_is_active"), &XRController3D::get_is_active);
+ ClassDB::bind_method(D_METHOD("get_hand"), &XRController3D::get_hand);
- ClassDB::bind_method(D_METHOD("get_rumble"), &ARVRController::get_rumble);
- ClassDB::bind_method(D_METHOD("set_rumble", "rumble"), &ARVRController::set_rumble);
+ ClassDB::bind_method(D_METHOD("get_rumble"), &XRController3D::get_rumble);
+ ClassDB::bind_method(D_METHOD("set_rumble", "rumble"), &XRController3D::set_rumble);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rumble", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_rumble", "get_rumble");
ADD_PROPERTY_DEFAULT("rumble", 0.0);
- ClassDB::bind_method(D_METHOD("get_mesh"), &ARVRController::get_mesh);
+ ClassDB::bind_method(D_METHOD("get_mesh"), &XRController3D::get_mesh);
ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::INT, "button")));
ADD_SIGNAL(MethodInfo("button_release", PropertyInfo(Variant::INT, "button")));
ADD_SIGNAL(MethodInfo("mesh_updated", PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh")));
};
-void ARVRController::set_controller_id(int p_controller_id) {
+void XRController3D::set_controller_id(int p_controller_id) {
// We don't check any bounds here, this controller may not yet be active and just be a place holder until it is.
// Note that setting this to 0 means this node is not bound to a controller yet.
controller_id = p_controller_id;
update_configuration_warning();
};
-int ARVRController::get_controller_id(void) const {
+int XRController3D::get_controller_id(void) const {
return controller_id;
};
-String ARVRController::get_controller_name(void) const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, String());
+String XRController3D::get_controller_name(void) const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, String());
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, controller_id);
if (tracker == nullptr) {
return String("Not connected");
};
@@ -286,12 +286,12 @@ String ARVRController::get_controller_name(void) const {
return tracker->get_name();
};
-int ARVRController::get_joystick_id() const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, 0);
+int XRController3D::get_joystick_id() const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, 0);
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, controller_id);
if (tracker == nullptr) {
// No tracker? no joystick id... (0 is our first joystick)
return -1;
@@ -300,7 +300,7 @@ int ARVRController::get_joystick_id() const {
return tracker->get_joy_id();
};
-bool ARVRController::is_button_pressed(int p_button) const {
+bool XRController3D::is_button_pressed(int p_button) const {
int joy_id = get_joystick_id();
if (joy_id == -1) {
return false;
@@ -309,7 +309,7 @@ bool ARVRController::is_button_pressed(int p_button) const {
return InputFilter::get_singleton()->is_joy_button_pressed(joy_id, p_button);
};
-float ARVRController::get_joystick_axis(int p_axis) const {
+float XRController3D::get_joystick_axis(int p_axis) const {
int joy_id = get_joystick_id();
if (joy_id == -1) {
return 0.0;
@@ -318,12 +318,12 @@ float ARVRController::get_joystick_axis(int p_axis) const {
return InputFilter::get_singleton()->get_joy_axis(joy_id, p_axis);
};
-real_t ARVRController::get_rumble() const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, 0.0);
+real_t XRController3D::get_rumble() const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, 0.0);
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, controller_id);
if (tracker == nullptr) {
return 0.0;
};
@@ -331,46 +331,46 @@ real_t ARVRController::get_rumble() const {
return tracker->get_rumble();
};
-void ARVRController::set_rumble(real_t p_rumble) {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL(arvr_server);
+void XRController3D::set_rumble(real_t p_rumble) {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL(xr_server);
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, controller_id);
if (tracker != nullptr) {
tracker->set_rumble(p_rumble);
};
};
-Ref<Mesh> ARVRController::get_mesh() const {
+Ref<Mesh> XRController3D::get_mesh() const {
return mesh;
}
-bool ARVRController::get_is_active() const {
+bool XRController3D::get_is_active() const {
return is_active;
};
-ARVRPositionalTracker::TrackerHand ARVRController::get_hand() const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, ARVRPositionalTracker::TRACKER_HAND_UNKNOWN);
+XRPositionalTracker::TrackerHand XRController3D::get_hand() const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, XRPositionalTracker::TRACKER_HAND_UNKNOWN);
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, controller_id);
if (tracker == nullptr) {
- return ARVRPositionalTracker::TRACKER_HAND_UNKNOWN;
+ return XRPositionalTracker::TRACKER_HAND_UNKNOWN;
};
return tracker->get_hand();
};
-String ARVRController::get_configuration_warning() const {
+String XRController3D::get_configuration_warning() const {
if (!is_visible() || !is_inside_tree())
return String();
- // must be child node of ARVROrigin!
- ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
+ // must be child node of XROrigin!
+ XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin == nullptr) {
- return TTR("ARVRController must have an ARVROrigin node as its parent.");
+ return TTR("XRController3D must have an XROrigin3D node as its parent.");
};
if (controller_id == 0) {
@@ -380,19 +380,19 @@ String ARVRController::get_configuration_warning() const {
return String();
};
-ARVRController::ARVRController() {
+XRController3D::XRController3D() {
controller_id = 1;
is_active = true;
button_states = 0;
};
-ARVRController::~ARVRController(){
+XRController3D::~XRController3D(){
// nothing to do here yet for now..
};
////////////////////////////////////////////////////////////////////////////////////////////////////
-void ARVRAnchor::_notification(int p_what) {
+void XRAnchor3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
set_process_internal(true);
@@ -401,12 +401,12 @@ void ARVRAnchor::_notification(int p_what) {
set_process_internal(false);
}; break;
case NOTIFICATION_INTERNAL_PROCESS: {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL(arvr_server);
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL(xr_server);
// find the tracker for our anchor
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_ANCHOR, anchor_id);
if (tracker == nullptr) {
// this anchor is currently not available
is_active = false;
@@ -415,7 +415,7 @@ void ARVRAnchor::_notification(int p_what) {
Transform transform;
// we'll need our world_scale
- real_t world_scale = arvr_server->get_world_scale();
+ real_t world_scale = xr_server->get_world_scale();
// get our info from our tracker
transform.basis = tracker->get_orientation();
@@ -427,7 +427,7 @@ void ARVRAnchor::_notification(int p_what) {
transform.basis.orthonormalize();
// apply our reference frame and set our transform
- set_transform(arvr_server->get_reference_frame() * transform);
+ set_transform(xr_server->get_reference_frame() * transform);
// check for an updated mesh
Ref<Mesh> trackerMesh = tracker->get_mesh();
@@ -442,43 +442,43 @@ void ARVRAnchor::_notification(int p_what) {
};
};
-void ARVRAnchor::_bind_methods() {
+void XRAnchor3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_anchor_id", "anchor_id"), &ARVRAnchor::set_anchor_id);
- ClassDB::bind_method(D_METHOD("get_anchor_id"), &ARVRAnchor::get_anchor_id);
+ ClassDB::bind_method(D_METHOD("set_anchor_id", "anchor_id"), &XRAnchor3D::set_anchor_id);
+ ClassDB::bind_method(D_METHOD("get_anchor_id"), &XRAnchor3D::get_anchor_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "anchor_id", PROPERTY_HINT_RANGE, "0,32,1"), "set_anchor_id", "get_anchor_id");
- ClassDB::bind_method(D_METHOD("get_anchor_name"), &ARVRAnchor::get_anchor_name);
+ ClassDB::bind_method(D_METHOD("get_anchor_name"), &XRAnchor3D::get_anchor_name);
- ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRAnchor::get_is_active);
- ClassDB::bind_method(D_METHOD("get_size"), &ARVRAnchor::get_size);
+ ClassDB::bind_method(D_METHOD("get_is_active"), &XRAnchor3D::get_is_active);
+ ClassDB::bind_method(D_METHOD("get_size"), &XRAnchor3D::get_size);
- ClassDB::bind_method(D_METHOD("get_plane"), &ARVRAnchor::get_plane);
+ ClassDB::bind_method(D_METHOD("get_plane"), &XRAnchor3D::get_plane);
- ClassDB::bind_method(D_METHOD("get_mesh"), &ARVRAnchor::get_mesh);
+ ClassDB::bind_method(D_METHOD("get_mesh"), &XRAnchor3D::get_mesh);
ADD_SIGNAL(MethodInfo("mesh_updated", PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh")));
};
-void ARVRAnchor::set_anchor_id(int p_anchor_id) {
+void XRAnchor3D::set_anchor_id(int p_anchor_id) {
// We don't check any bounds here, this anchor may not yet be active and just be a place holder until it is.
// Note that setting this to 0 means this node is not bound to an anchor yet.
anchor_id = p_anchor_id;
update_configuration_warning();
};
-int ARVRAnchor::get_anchor_id(void) const {
+int XRAnchor3D::get_anchor_id(void) const {
return anchor_id;
};
-Vector3 ARVRAnchor::get_size() const {
+Vector3 XRAnchor3D::get_size() const {
return size;
};
-String ARVRAnchor::get_anchor_name(void) const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, String());
+String XRAnchor3D::get_anchor_name(void) const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, String());
- ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id);
+ XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_ANCHOR, anchor_id);
if (tracker == nullptr) {
return String("Not connected");
};
@@ -486,18 +486,18 @@ String ARVRAnchor::get_anchor_name(void) const {
return tracker->get_name();
};
-bool ARVRAnchor::get_is_active() const {
+bool XRAnchor3D::get_is_active() const {
return is_active;
};
-String ARVRAnchor::get_configuration_warning() const {
+String XRAnchor3D::get_configuration_warning() const {
if (!is_visible() || !is_inside_tree())
return String();
- // must be child node of ARVROrigin!
- ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
+ // must be child node of XROrigin3D!
+ XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin == nullptr) {
- return TTR("ARVRAnchor must have an ARVROrigin node as its parent.");
+ return TTR("XRAnchor3D must have an XROrigin3D node as its parent.");
};
if (anchor_id == 0) {
@@ -507,7 +507,7 @@ String ARVRAnchor::get_configuration_warning() const {
return String();
};
-Plane ARVRAnchor::get_plane() const {
+Plane XRAnchor3D::get_plane() const {
Vector3 location = get_translation();
Basis orientation = get_transform().basis;
@@ -516,67 +516,67 @@ Plane ARVRAnchor::get_plane() const {
return plane;
};
-Ref<Mesh> ARVRAnchor::get_mesh() const {
+Ref<Mesh> XRAnchor3D::get_mesh() const {
return mesh;
}
-ARVRAnchor::ARVRAnchor() {
+XRAnchor3D::XRAnchor3D() {
anchor_id = 1;
is_active = true;
};
-ARVRAnchor::~ARVRAnchor(){
+XRAnchor3D::~XRAnchor3D(){
// nothing to do here yet for now..
};
////////////////////////////////////////////////////////////////////////////////////////////////////
-String ARVROrigin::get_configuration_warning() const {
+String XROrigin3D::get_configuration_warning() const {
if (!is_visible() || !is_inside_tree())
return String();
if (tracked_camera == nullptr)
- return TTR("ARVROrigin requires an ARVRCamera child node.");
+ return TTR("XROrigin3D requires an XRCamera3D child node.");
return String();
};
-void ARVROrigin::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_world_scale", "world_scale"), &ARVROrigin::set_world_scale);
- ClassDB::bind_method(D_METHOD("get_world_scale"), &ARVROrigin::get_world_scale);
+void XROrigin3D::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_world_scale", "world_scale"), &XROrigin3D::set_world_scale);
+ ClassDB::bind_method(D_METHOD("get_world_scale"), &XROrigin3D::get_world_scale);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "world_scale"), "set_world_scale", "get_world_scale");
};
-void ARVROrigin::set_tracked_camera(ARVRCamera *p_tracked_camera) {
+void XROrigin3D::set_tracked_camera(XRCamera3D *p_tracked_camera) {
tracked_camera = p_tracked_camera;
};
-void ARVROrigin::clear_tracked_camera_if(ARVRCamera *p_tracked_camera) {
+void XROrigin3D::clear_tracked_camera_if(XRCamera3D *p_tracked_camera) {
if (tracked_camera == p_tracked_camera) {
tracked_camera = nullptr;
};
};
-float ARVROrigin::get_world_scale() const {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL_V(arvr_server, 1.0);
+float XROrigin3D::get_world_scale() const {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL_V(xr_server, 1.0);
- return arvr_server->get_world_scale();
+ return xr_server->get_world_scale();
};
-void ARVROrigin::set_world_scale(float p_world_scale) {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL(arvr_server);
+void XROrigin3D::set_world_scale(float p_world_scale) {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL(xr_server);
- arvr_server->set_world_scale(p_world_scale);
+ xr_server->set_world_scale(p_world_scale);
};
-void ARVROrigin::_notification(int p_what) {
- // get our ARVRServer
- ARVRServer *arvr_server = ARVRServer::get_singleton();
- ERR_FAIL_NULL(arvr_server);
+void XROrigin3D::_notification(int p_what) {
+ // get our XRServer
+ XRServer *xr_server = XRServer::get_singleton();
+ ERR_FAIL_NULL(xr_server);
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -587,13 +587,13 @@ void ARVROrigin::_notification(int p_what) {
}; break;
case NOTIFICATION_INTERNAL_PROCESS: {
// set our world origin to our node transform
- arvr_server->set_world_origin(get_global_transform());
+ xr_server->set_world_origin(get_global_transform());
// check if we have a primary interface
- Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- if (arvr_interface.is_valid() && tracked_camera != nullptr) {
+ Ref<XRInterface> xr_interface = xr_server->get_primary_interface();
+ if (xr_interface.is_valid() && tracked_camera != nullptr) {
// get our positioning transform for our headset
- Transform t = arvr_interface->get_transform_for_eye(ARVRInterface::EYE_MONO, Transform());
+ Transform t = xr_interface->get_transform_for_eye(XRInterface::EYE_MONO, Transform());
// now apply this to our camera
tracked_camera->set_transform(t);
@@ -603,19 +603,19 @@ void ARVROrigin::_notification(int p_what) {
break;
};
- // send our notification to all active ARVR interfaces, they may need to react to it also
- for (int i = 0; i < arvr_server->get_interface_count(); i++) {
- Ref<ARVRInterface> interface = arvr_server->get_interface(i);
+ // send our notification to all active XE interfaces, they may need to react to it also
+ for (int i = 0; i < xr_server->get_interface_count(); i++) {
+ Ref<XRInterface> interface = xr_server->get_interface(i);
if (interface.is_valid() && interface->is_initialized()) {
interface->notification(p_what);
}
}
};
-ARVROrigin::ARVROrigin() {
+XROrigin3D::XROrigin3D() {
tracked_camera = nullptr;
};
-ARVROrigin::~ARVROrigin(){
+XROrigin3D::~XROrigin3D(){
// nothing to do here yet for now..
};
diff --git a/scene/3d/arvr_nodes.h b/scene/3d/xr_nodes.h
index bc5df2e174..a2f16545d1 100644
--- a/scene/3d/arvr_nodes.h
+++ b/scene/3d/xr_nodes.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* arvr_nodes.h */
+/* xr_nodes.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,24 +28,24 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef ARVR_NODES_H
-#define ARVR_NODES_H
+#ifndef XR_NODES_H
+#define XR_NODES_H
#include "scene/3d/camera_3d.h"
#include "scene/3d/node_3d.h"
#include "scene/resources/mesh.h"
-#include "servers/arvr/arvr_positional_tracker.h"
+#include "servers/xr/xr_positional_tracker.h"
/**
@author Bastiaan Olij <mux213@gmail.com>
**/
/*
- ARVRCamera is a subclass of camera which will register itself with its parent ARVROrigin and as a result is automatically positioned
+ XRCamera is a subclass of camera which will register itself with its parent XROrigin and as a result is automatically positioned
*/
-class ARVRCamera : public Camera3D {
+class XRCamera3D : public Camera3D {
- GDCLASS(ARVRCamera, Camera3D);
+ GDCLASS(XRCamera3D, Camera3D);
protected:
void _notification(int p_what);
@@ -58,19 +58,19 @@ public:
virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const;
virtual Vector<Plane> get_frustum() const;
- ARVRCamera();
- ~ARVRCamera();
+ XRCamera3D();
+ ~XRCamera3D();
};
/*
- ARVRController is a helper node that automatically updates its position based on tracker data.
+ XRController3D is a helper node that automatically updates its position based on tracker data.
- It must be a child node of our ARVROrigin node
+ It must be a child node of our XROrigin node
*/
-class ARVRController : public Node3D {
+class XRController3D : public Node3D {
- GDCLASS(ARVRController, Node3D);
+ GDCLASS(XRController3D, Node3D);
private:
int controller_id;
@@ -95,23 +95,23 @@ public:
void set_rumble(real_t p_rumble);
bool get_is_active() const;
- ARVRPositionalTracker::TrackerHand get_hand() const;
+ XRPositionalTracker::TrackerHand get_hand() const;
Ref<Mesh> get_mesh(void) const;
String get_configuration_warning() const;
- ARVRController();
- ~ARVRController();
+ XRController3D();
+ ~XRController3D();
};
/*
- ARVRAnchor is a helper node that automatically updates its position based on anchor data, it represents a real world location.
- It must be a child node of our ARVROrigin node
+ XRAnchor3D is a helper node that automatically updates its position based on anchor data, it represents a real world location.
+ It must be a child node of our XROrigin3D node
*/
-class ARVRAnchor : public Node3D {
- GDCLASS(ARVRAnchor, Node3D);
+class XRAnchor3D : public Node3D {
+ GDCLASS(XRAnchor3D, Node3D);
private:
int anchor_id;
@@ -137,24 +137,24 @@ public:
String get_configuration_warning() const;
- ARVRAnchor();
- ~ARVRAnchor();
+ XRAnchor3D();
+ ~XRAnchor3D();
};
/*
- ARVROrigin is special spatial node that acts as our origin point mapping our real world center of our tracking volume into our virtual world.
+ XROrigin3D is special spatial node that acts as our origin point mapping our real world center of our tracking volume into our virtual world.
It is this point that you will move around the world as the player 'moves while standing still', i.e. the player moves through teleporting or controller inputs as opposed to physically moving.
Our camera and controllers will always be child nodes and thus place relative to this origin point.
- This node will automatically locate any camera child nodes and update its position while our ARVRController node will handle tracked controllers.
+ This node will automatically locate any camera child nodes and update its position while our XRController3D node will handle tracked controllers.
*/
-class ARVROrigin : public Node3D {
+class XROrigin3D : public Node3D {
- GDCLASS(ARVROrigin, Node3D);
+ GDCLASS(XROrigin3D, Node3D);
private:
- ARVRCamera *tracked_camera;
+ XRCamera3D *tracked_camera;
protected:
void _notification(int p_what);
@@ -163,14 +163,14 @@ protected:
public:
String get_configuration_warning() const;
- void set_tracked_camera(ARVRCamera *p_tracked_camera);
- void clear_tracked_camera_if(ARVRCamera *p_tracked_camera);
+ void set_tracked_camera(XRCamera3D *p_tracked_camera);
+ void clear_tracked_camera_if(XRCamera3D *p_tracked_camera);
float get_world_scale() const;
void set_world_scale(float p_world_scale);
- ARVROrigin();
- ~ARVROrigin();
+ XROrigin3D();
+ ~XROrigin3D();
};
-#endif /* ARVR_NODES_H */
+#endif /* XR_NODES_H */
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 775f863a4f..b4dc37c74f 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1893,7 +1893,7 @@ static Control *_next_control(Control *p_from) {
return nullptr;
}
- int next = p_from->get_position_in_parent();
+ int next = p_from->get_index();
ERR_FAIL_INDEX_V(next, parent->get_child_count(), nullptr);
for (int i = (next + 1); i < parent->get_child_count(); i++) {
@@ -2032,7 +2032,7 @@ Control *Control::find_prev_valid_focus() const {
} else {
- for (int i = (from->get_position_in_parent() - 1); i >= 0; i--) {
+ for (int i = (from->get_index() - 1); i >= 0; i--) {
Control *c = Object::cast_to<Control>(from->get_parent()->get_child(i));
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 2e87a92969..5654219a3e 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -322,7 +322,6 @@ AcceptDialog::AcceptDialog() {
label->set_end(Point2(-margin, -button_margin - 10));
add_child(label);
- hbc = memnew(HBoxContainer);
add_child(hbc);
hbc->add_spacer();
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 6be74d8d29..89d13ecd7f 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -46,9 +46,9 @@ VBoxContainer *FileDialog::get_vbox() {
void FileDialog::_theme_changed() {
- Color font_color = vbc->get_theme_color("font_color", "ToolButton");
- Color font_color_hover = vbc->get_theme_color("font_color_hover", "ToolButton");
- Color font_color_pressed = vbc->get_theme_color("font_color_pressed", "ToolButton");
+ Color font_color = vbox->get_theme_color("font_color", "ToolButton");
+ Color font_color_hover = vbox->get_theme_color("font_color_hover", "ToolButton");
+ Color font_color_pressed = vbox->get_theme_color("font_color_pressed", "ToolButton");
dir_up->add_theme_color_override("icon_color_normal", font_color);
dir_up->add_theme_color_override("icon_color_hover", font_color_hover);
@@ -73,9 +73,9 @@ void FileDialog::_notification(int p_what) {
}
if (p_what == NOTIFICATION_ENTER_TREE) {
- dir_up->set_icon(vbc->get_theme_icon("parent_folder"));
- refresh->set_icon(vbc->get_theme_icon("reload"));
- show_hidden->set_icon(vbc->get_theme_icon("toggle_hidden"));
+ dir_up->set_icon(vbox->get_theme_icon("parent_folder", "FileDialog"));
+ refresh->set_icon(vbox->get_theme_icon("reload", "FileDialog"));
+ show_hidden->set_icon(vbox->get_theme_icon("toggle_hidden", "FileDialog"));
_theme_changed();
}
}
@@ -429,8 +429,8 @@ void FileDialog::update_file_list() {
dir_access->list_dir_begin();
TreeItem *root = tree->create_item();
- Ref<Texture2D> folder = vbc->get_theme_icon("folder");
- const Color folder_color = vbc->get_theme_color("folder_icon_modulate");
+ Ref<Texture2D> folder = vbox->get_theme_icon("folder", "FileDialog");
+ const Color folder_color = vbox->get_theme_color("folder_icon_modulate", "FileDialog");
List<String> files;
List<String> dirs;
@@ -528,7 +528,7 @@ void FileDialog::update_file_list() {
}
if (mode == FILE_MODE_OPEN_DIR) {
- ti->set_custom_color(0, vbc->get_theme_color("files_disabled"));
+ ti->set_custom_color(0, vbox->get_theme_color("files_disabled", "FileDialog"));
ti->set_selectable(0, false);
}
Dictionary d;
@@ -888,9 +888,9 @@ FileDialog::FileDialog() {
mode_overrides_title = true;
- vbc = memnew(VBoxContainer);
- add_child(vbc);
- vbc->connect("theme_changed", callable_mp(this, &FileDialog::_theme_changed));
+ vbox = memnew(VBoxContainer);
+ add_child(vbox);
+ vbox->connect("theme_changed", callable_mp(this, &FileDialog::_theme_changed));
mode = FILE_MODE_SAVE_FILE;
set_title(RTR("Save a File"));
@@ -909,6 +909,7 @@ FileDialog::FileDialog() {
drives = memnew(OptionButton);
drives->connect("item_selected", callable_mp(this, &FileDialog::_select_drive));
+ hbc->add_child(drives);
dir = memnew(LineEdit);
hbc->add_child(dir);
@@ -933,11 +934,11 @@ FileDialog::FileDialog() {
makedir->set_text(RTR("Create Folder"));
makedir->connect("pressed", callable_mp(this, &FileDialog::_make_dir));
hbc->add_child(makedir);
- vbc->add_child(hbc);
+ vbox->add_child(hbc);
tree = memnew(Tree);
tree->set_hide_root(true);
- vbc->add_margin_child(RTR("Directories & Files:"), tree, true);
+ vbox->add_margin_child(RTR("Directories & Files:"), tree, true);
file_box = memnew(HBoxContainer);
file_box->add_child(memnew(Label(RTR("File:"))));
@@ -950,7 +951,7 @@ FileDialog::FileDialog() {
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
filter->set_clip_text(true); // too many extensions overflows it
file_box->add_child(filter);
- vbc->add_child(file_box);
+ vbox->add_child(file_box);
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
access = ACCESS_RESOURCES;
@@ -993,7 +994,6 @@ FileDialog::FileDialog() {
update_dir();
set_hide_on_ok(false);
- vbox = vbc;
invalidated = true;
if (register_func)
@@ -1006,37 +1006,3 @@ FileDialog::~FileDialog() {
unregister_func(this);
memdelete(dir_access);
}
-
-void LineEditFileChooser::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("get_button"), &LineEditFileChooser::get_button);
- ClassDB::bind_method(D_METHOD("get_line_edit"), &LineEditFileChooser::get_line_edit);
- ClassDB::bind_method(D_METHOD("get_file_dialog"), &LineEditFileChooser::get_file_dialog);
-}
-
-void LineEditFileChooser::_chosen(const String &p_text) {
-
- line_edit->set_text(p_text);
- line_edit->emit_signal("text_entered", p_text);
-}
-
-void LineEditFileChooser::_browse() {
-
- dialog->popup_centered_ratio();
-}
-
-LineEditFileChooser::LineEditFileChooser() {
-
- line_edit = memnew(LineEdit);
- add_child(line_edit);
- line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- button = memnew(Button);
- button->set_text(" .. ");
- add_child(button);
- button->connect("pressed", callable_mp(this, &LineEditFileChooser::_browse));
- dialog = memnew(FileDialog);
- add_child(dialog);
- dialog->connect("file_selected", callable_mp(this, &LineEditFileChooser::_chosen));
- dialog->connect("dir_selected", callable_mp(this, &LineEditFileChooser::_chosen));
- dialog->connect("files_selected", callable_mp(this, &LineEditFileChooser::_chosen));
-}
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 295ae023d1..ac0e733abc 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -70,7 +70,6 @@ private:
ConfirmationDialog *makedialog;
LineEdit *makedirname;
- VBoxContainer *vbc;
Button *makedir;
Access access;
//Button *action;
@@ -178,27 +177,6 @@ public:
~FileDialog();
};
-class LineEditFileChooser : public HBoxContainer {
-
- GDCLASS(LineEditFileChooser, HBoxContainer);
- Button *button;
- LineEdit *line_edit;
- FileDialog *dialog;
-
- void _chosen(const String &p_text);
- void _browse();
-
-protected:
- static void _bind_methods();
-
-public:
- Button *get_button() { return button; }
- LineEdit *get_line_edit() { return line_edit; }
- FileDialog *get_file_dialog() { return dialog; }
-
- LineEditFileChooser();
-};
-
VARIANT_ENUM_CAST(FileDialog::FileMode);
VARIANT_ENUM_CAST(FileDialog::Access);
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 30ecd651b1..a03d6d0cdc 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -340,8 +340,8 @@ void OptionButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items");
// "selected" property must come after "items", otherwise GH-10213 occurs.
ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected");
- ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "id")));
- ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index")));
+ ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "index")));
}
OptionButton::OptionButton() {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 5fb2243aff..0b314d57c5 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -411,7 +411,6 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
break; //don't allow lines longer than assigned width
}
- w += cw;
fw += cw;
end++;
@@ -552,8 +551,10 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
}
}
- if (visible)
+ if (visible) {
line_is_blank = false;
+ w += font->get_char_size(c[i], c[i + 1]).x;
+ }
if (c[i] == '\t')
visible = false;
@@ -582,13 +583,14 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
} else {
cw = drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent) + fx_offset, fx_char, c[i + 1], fx_color);
}
- } else if (previously_visible) {
+ } else if (previously_visible && c[i] != '\t') {
backtrack += font->get_char_size(fx_char, c[i + 1]).x;
}
p_char_count++;
if (c[i] == '\t') {
cw = tab_size * font->get_char_size(' ').width;
+ backtrack = MAX(0, backtrack - cw);
}
ofs += cw;
@@ -607,7 +609,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
} else if (strikethrough) {
Color uc = color;
uc.a *= 0.5;
- int uy = y + lh / 2 - line_descent + 2;
+ int uy = y + lh - (line_ascent + line_descent) / 2;
float strikethrough_width = 1.0;
#ifdef TOOLS_ENABLED
strikethrough_width *= EDSCALE;
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index e47e2b869d..1f135163d4 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -166,8 +166,9 @@ void Slider::_notification(int p_what) {
RID ci = get_canvas_item();
Size2i size = get_size();
Ref<StyleBox> style = get_theme_stylebox("slider");
- Ref<StyleBox> grabber_area = get_theme_stylebox("grabber_area");
- Ref<Texture2D> grabber = get_theme_icon(editable ? ((mouse_inside || has_focus()) ? "grabber_highlight" : "grabber") : "grabber_disabled");
+ bool highlighted = mouse_inside || has_focus();
+ Ref<StyleBox> grabber_area = get_theme_stylebox(highlighted ? "grabber_area_highlight" : "grabber_area");
+ Ref<Texture2D> grabber = get_theme_icon(editable ? (highlighted ? "grabber_highlight" : "grabber") : "grabber_disabled");
Ref<Texture2D> tick = get_theme_icon("tick");
double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();
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/gui/tabs.cpp b/scene/gui/tabs.cpp
index ea6d44e3a7..1a3b53f489 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -184,10 +184,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
}
int found = -1;
- for (int i = 0; i < tabs.size(); i++) {
-
- if (i < offset)
- continue;
+ for (int i = offset; i < tabs.size(); i++) {
if (tabs[i].rb_rect.has_point(pos)) {
rb_pressing = true;
@@ -276,10 +273,7 @@ void Tabs::_notification(int p_what) {
missing_right = false;
- for (int i = 0; i < tabs.size(); i++) {
-
- if (i < offset)
- continue;
+ for (int i = offset; i < tabs.size(); i++) {
tabs.write[i].ofs_cache = w;
@@ -499,10 +493,7 @@ void Tabs::_update_hover() {
// test hovering to display right or close button
int hover_now = -1;
int hover_buttons = -1;
- for (int i = 0; i < tabs.size(); i++) {
-
- if (i < offset)
- continue;
+ for (int i = offset; i < tabs.size(); i++) {
Rect2 rect = get_tab_rect(i);
if (rect.has_point(pos)) {
@@ -559,9 +550,8 @@ void Tabs::_update_cache() {
if (count_resize > 0) {
m_width = MAX((limit - size_fixed) / count_resize, min_width);
}
- for (int i = 0; i < tabs.size(); i++) {
- if (i < offset)
- continue;
+ for (int i = offset; i < tabs.size(); i++) {
+
Ref<StyleBox> sb;
if (tabs[i].disabled) {
sb = tab_disabled;
@@ -753,10 +743,7 @@ void Tabs::drop_data(const Point2 &p_point, const Variant &p_data) {
int Tabs::get_tab_idx_at_point(const Point2 &p_point) const {
int hover_now = -1;
- for (int i = 0; i < tabs.size(); i++) {
-
- if (i < offset)
- continue;
+ for (int i = offset; i < tabs.size(); i++) {
Rect2 rect = get_tab_rect(i);
if (rect.has_point(p_point)) {
@@ -850,10 +837,7 @@ void Tabs::_ensure_no_over_offset() {
while (offset > 0) {
int total_w = 0;
- for (int i = 0; i < tabs.size(); i++) {
-
- if (i < offset - 1)
- continue;
+ for (int i = offset - 1; i < tabs.size(); i++) {
total_w += tabs[i].size_cache;
}
diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp
index baa138847f..92f3c5b5d9 100644
--- a/scene/gui/texture_rect.cpp
+++ b/scene/gui/texture_rect.cpp
@@ -95,6 +95,15 @@ void TextureRect::_notification(int p_what) {
} break;
}
+ Ref<AtlasTexture> p_atlas = texture;
+
+ if (p_atlas.is_valid() && region.has_no_area()) {
+ Size2 scale_size(size.width / texture->get_width(), size.height / texture->get_height());
+
+ offset.width += hflip ? p_atlas->get_margin().get_position().width * scale_size.width * 2 : 0;
+ offset.height += vflip ? p_atlas->get_margin().get_position().height * scale_size.height * 2 : 0;
+ }
+
size.width *= hflip ? -1.0f : 1.0f;
size.height *= vflip ? -1.0f : 1.0f;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index a7acaae8df..509a52d36a 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3045,13 +3045,6 @@ void Tree::_notification(int p_what) {
draw_item(Point2(), draw_ofs, draw_size, root);
}
- int ofs = 0;
-
- for (int i = 0; i < (columns.size() - 1 - 1); i++) {
-
- ofs += get_column_width(i);
- }
-
if (show_column_titles) {
//title buttons
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp
index 15f64390de..c1caa943e3 100644
--- a/scene/main/canvas_layer.cpp
+++ b/scene/main/canvas_layer.cpp
@@ -35,7 +35,7 @@ void CanvasLayer::set_layer(int p_xform) {
layer = p_xform;
if (viewport.is_valid())
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
}
int CanvasLayer::get_layer() const {
@@ -151,7 +151,7 @@ void CanvasLayer::_notification(int p_what) {
viewport = vp->get_viewport_rid();
RenderingServer::get_singleton()->viewport_attach_canvas(viewport, canvas);
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
_update_follow_viewport();
@@ -167,7 +167,7 @@ void CanvasLayer::_notification(int p_what) {
case NOTIFICATION_MOVED_IN_PARENT: {
if (is_inside_tree())
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
} break;
}
@@ -214,7 +214,7 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) {
viewport = vp->get_viewport_rid();
RenderingServer::get_singleton()->viewport_attach_canvas(viewport, canvas);
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
}
}
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index 78958a7a1c..062b221c84 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -95,7 +95,7 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene
if (!scene)
return nullptr;
scene->set_name(get_name());
- int pos = get_position_in_parent();
+ int pos = get_index();
for (List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
scene->set(E->get().name, E->get().value);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 6b46ffd8ad..50f3bf834f 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1268,7 +1268,7 @@ void Node::add_child_below_node(Node *p_node, Node *p_child, bool p_legible_uniq
add_child(p_child, p_legible_unique_name);
if (is_a_parent_of(p_node)) {
- move_child(p_child, p_node->get_position_in_parent() + 1);
+ move_child(p_child, p_node->get_index() + 1);
} else {
WARN_PRINT("Cannot move under node " + p_node->get_name() + " as " + p_child->get_name() + " does not share a parent.");
}
@@ -1918,6 +1918,7 @@ int Node::get_index() const {
return data.pos;
}
+
void Node::remove_and_skip() {
ERR_FAIL_COND(!data.parent);
@@ -2042,11 +2043,6 @@ bool Node::get_scene_instance_load_placeholder() const {
return data.use_placeholder;
}
-int Node::get_position_in_parent() const {
-
- return data.pos;
-}
-
Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const {
Node *node = nullptr;
@@ -2215,7 +2211,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
}
parent->add_child(dup);
- int pos = E->get()->get_position_in_parent();
+ int pos = E->get()->get_index();
if (pos < parent->get_child_count() - 1) {
@@ -2860,7 +2856,6 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_pause_mode"), &Node::get_pause_mode);
ClassDB::bind_method(D_METHOD("can_process"), &Node::can_process);
ClassDB::bind_method(D_METHOD("print_stray_nodes"), &Node::_print_stray_nodes);
- ClassDB::bind_method(D_METHOD("get_position_in_parent"), &Node::get_position_in_parent);
ClassDB::bind_method(D_METHOD("set_display_folded", "fold"), &Node::set_display_folded);
ClassDB::bind_method(D_METHOD("is_displayed_folded"), &Node::is_displayed_folded);
diff --git a/scene/main/node.h b/scene/main/node.h
index 292ec0e291..5de07d506e 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -369,8 +369,6 @@ public:
void set_process_unhandled_key_input(bool p_enable);
bool is_processing_unhandled_key_input() const;
- int get_position_in_parent() const;
-
Node *duplicate(int p_flags = DUPLICATE_GROUPS | DUPLICATE_SIGNALS | DUPLICATE_SCRIPTS) const;
Node *duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const;
#ifdef TOOLS_ENABLED
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 5fcd4bf009..1cfc3b0260 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -879,13 +879,14 @@ void Viewport::update_canvas_items() {
_update_canvas_items(this);
}
-void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_override, const Rect2i &p_to_screen_rect, const Transform2D &p_stretch_transform, bool p_allocated) {
+void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, const Transform2D &p_stretch_transform, bool p_allocated) {
- if (size == p_size && size_allocated == p_allocated && stretch_transform == p_stretch_transform && p_size_override == size_override && to_screen_rect != p_to_screen_rect)
+ if (size == p_size && size_allocated == p_allocated && stretch_transform == p_stretch_transform && p_size_2d_override == size_2d_override && to_screen_rect != p_to_screen_rect)
return;
+
size = p_size;
size_allocated = p_allocated;
- size_override = p_size_override;
+ size_2d_override = p_size_2d_override;
stretch_transform = p_stretch_transform;
to_screen_rect = p_to_screen_rect;
@@ -904,6 +905,9 @@ void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_override, co
Size2i Viewport::_get_size() const {
return size;
}
+Size2i Viewport::_get_size_2d_override() const {
+ return size_2d_override;
+}
bool Viewport::_is_size_allocated() const {
return size_allocated;
}
@@ -918,8 +922,8 @@ Rect2 Viewport::get_visible_rect() const {
r = Rect2(Point2(), size);
}
- if (size_override != Size2i()) {
- r.size = size_override;
+ if (size_2d_override != Size2i()) {
+ r.size = size_2d_override;
}
return r;
@@ -3494,6 +3498,8 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS);
BIND_ENUM_CONSTANT(DEBUG_DRAW_SCENE_LUMINANCE);
BIND_ENUM_CONSTANT(DEBUG_DRAW_SSAO);
+ BIND_ENUM_CONSTANT(DEBUG_DRAW_ROUGHNESS_LIMITER);
+ BIND_ENUM_CONSTANT(DEBUG_DRAW_PSSM_SPLITS);
BIND_ENUM_CONSTANT(MSAA_DISABLED);
BIND_ENUM_CONSTANT(MSAA_2X);
@@ -3609,23 +3615,46 @@ Viewport::~Viewport() {
/////////////////////////////////
-void SubViewport::set_use_arvr(bool p_use_arvr) {
- arvr = p_use_arvr;
+void SubViewport::set_use_xr(bool p_use_xr) {
+ xr = p_use_xr;
- RS::get_singleton()->viewport_set_use_arvr(get_viewport_rid(), arvr);
+ RS::get_singleton()->viewport_set_use_xr(get_viewport_rid(), xr);
}
-bool SubViewport::is_using_arvr() {
- return arvr;
+bool SubViewport::is_using_xr() {
+ return xr;
}
void SubViewport::set_size(const Size2i &p_size) {
- _set_size(p_size, Size2i(), Rect2i(), Transform2D(), true);
+ _set_size(p_size, _get_size_2d_override(), Rect2i(), _stretch_transform(), true);
}
Size2i SubViewport::get_size() const {
return _get_size();
}
+void SubViewport::set_size_2d_override(const Size2i &p_size) {
+
+ _set_size(_get_size(), p_size, Rect2i(), _stretch_transform(), true);
+}
+Size2i SubViewport::get_size_2d_override() const {
+
+ return _get_size_2d_override();
+}
+
+void SubViewport::set_size_2d_override_stretch(bool p_enable) {
+
+ if (p_enable == size_2d_override_stretch) {
+ return;
+ }
+
+ size_2d_override_stretch = p_enable;
+ _set_size(_get_size(), _get_size_2d_override(), Rect2i(), _stretch_transform(), true);
+}
+bool SubViewport::is_size_2d_override_stretch_enabled() const {
+
+ return size_2d_override_stretch;
+}
+
void SubViewport::set_update_mode(UpdateMode p_mode) {
update_mode = p_mode;
@@ -3641,7 +3670,6 @@ void SubViewport::set_clear_mode(ClearMode p_mode) {
clear_mode = p_mode;
RS::get_singleton()->viewport_set_clear_mode(get_viewport_rid(), RS::ViewportClearMode(p_mode));
}
-
SubViewport::ClearMode SubViewport::get_clear_mode() const {
return clear_mode;
@@ -3651,6 +3679,18 @@ DisplayServer::WindowID SubViewport::get_window_id() const {
return DisplayServer::INVALID_WINDOW_ID;
}
+Transform2D SubViewport::_stretch_transform() {
+
+ Transform2D transform = Transform2D();
+ Size2i view_size_2d_override = _get_size_2d_override();
+ if (size_2d_override_stretch && view_size_2d_override.width > 0 && view_size_2d_override.height > 0) {
+ Size2 scale = _get_size() / view_size_2d_override;
+ transform.scale(scale);
+ }
+
+ return transform;
+}
+
void SubViewport::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -3662,19 +3702,28 @@ void SubViewport::_notification(int p_what) {
}
void SubViewport::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_use_arvr", "use"), &SubViewport::set_use_arvr);
- ClassDB::bind_method(D_METHOD("is_using_arvr"), &SubViewport::is_using_arvr);
+ ClassDB::bind_method(D_METHOD("set_use_xr", "use"), &SubViewport::set_use_xr);
+ ClassDB::bind_method(D_METHOD("is_using_xr"), &SubViewport::is_using_xr);
ClassDB::bind_method(D_METHOD("set_size", "size"), &SubViewport::set_size);
ClassDB::bind_method(D_METHOD("get_size"), &SubViewport::get_size);
+ ClassDB::bind_method(D_METHOD("set_size_2d_override", "size"), &SubViewport::set_size_2d_override);
+ ClassDB::bind_method(D_METHOD("get_size_2d_override"), &SubViewport::get_size_2d_override);
+
+ ClassDB::bind_method(D_METHOD("set_size_2d_override_stretch", "enable"), &SubViewport::set_size_2d_override_stretch);
+ ClassDB::bind_method(D_METHOD("is_size_2d_override_stretch_enabled"), &SubViewport::is_size_2d_override_stretch_enabled);
+
ClassDB::bind_method(D_METHOD("set_update_mode", "mode"), &SubViewport::set_update_mode);
ClassDB::bind_method(D_METHOD("get_update_mode"), &SubViewport::get_update_mode);
ClassDB::bind_method(D_METHOD("set_clear_mode", "mode"), &SubViewport::set_clear_mode);
ClassDB::bind_method(D_METHOD("get_clear_mode"), &SubViewport::get_clear_mode);
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "arvr"), "set_use_arvr", "is_using_arvr");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "xr"), "set_use_xr", "is_using_xr");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size_2d_override"), "set_size_2d_override", "get_size_2d_override");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "size_2d_override_stretch"), "set_size_2d_override_stretch", "is_size_2d_override_stretch_enabled");
ADD_GROUP("Render Target", "render_target_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_clear_mode", PROPERTY_HINT_ENUM, "Always,Never,Next Frame"), "set_clear_mode", "get_clear_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_update_mode", PROPERTY_HINT_ENUM, "Disabled,Once,When Visible,Always"), "set_update_mode", "get_update_mode");
@@ -3691,7 +3740,8 @@ void SubViewport::_bind_methods() {
}
SubViewport::SubViewport() {
- arvr = false;
+ xr = false;
+ size_2d_override_stretch = false;
update_mode = UPDATE_WHEN_VISIBLE;
clear_mode = CLEAR_MODE_ALWAYS;
}
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 8982869783..ab3987d16d 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -133,7 +133,8 @@ public:
DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS,
DEBUG_DRAW_SCENE_LUMINANCE,
DEBUG_DRAW_SSAO,
- DEBUG_DRAW_ROUGHNESS_LIMITER
+ DEBUG_DRAW_ROUGHNESS_LIMITER,
+ DEBUG_DRAW_PSSM_SPLITS
};
enum DefaultCanvasItemTextureFilter {
@@ -203,7 +204,7 @@ private:
Transform2D stretch_transform;
Size2i size;
- Size2i size_override;
+ Size2i size_2d_override;
bool size_allocated;
RID contact_2d_debug;
@@ -434,9 +435,10 @@ private:
SubWindowResize _sub_window_get_resize_margin(Window *p_subwindow, const Point2 &p_point);
protected:
- void _set_size(const Size2i &p_size, const Size2i &p_size_override, const Rect2i &p_to_screen_rect, const Transform2D &p_stretch_transform, bool p_allocated);
+ void _set_size(const Size2i &p_size, const Size2i &p_size_2d_override, const Rect2i &p_to_screen_rect, const Transform2D &p_stretch_transform, bool p_allocated);
Size2i _get_size() const;
+ Size2i _get_size_2d_override() const;
bool _is_size_allocated() const;
void _notification(int p_what);
@@ -588,19 +590,27 @@ public:
private:
UpdateMode update_mode;
ClearMode clear_mode;
- bool arvr;
+ bool xr;
+ bool size_2d_override_stretch;
protected:
static void _bind_methods();
virtual DisplayServer::WindowID get_window_id() const;
+ Transform2D _stretch_transform();
void _notification(int p_what);
public:
void set_size(const Size2i &p_size);
Size2i get_size() const;
- void set_use_arvr(bool p_use_arvr);
- bool is_using_arvr();
+ void set_size_2d_override(const Size2i &p_size);
+ Size2i get_size_2d_override() const;
+
+ void set_use_xr(bool p_use_xr);
+ bool is_using_xr();
+
+ void set_size_2d_override_stretch(bool p_enable);
+ bool is_size_2d_override_stretch_enabled() const;
void set_update_mode(UpdateMode p_mode);
UpdateMode get_update_mode() const;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 45982e0e93..19954299de 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -909,7 +909,7 @@ void Window::_window_input_text(const String &p_text) {
input_text(p_text);
}
void Window::_window_drop_files(const Vector<String> &p_files) {
- emit_signal("files_dropped", p_files);
+ emit_signal("files_dropped", p_files, current_screen);
}
Viewport *Window::get_parent_viewport() const {
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index e11abb5fba..035d26b3e4 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"
@@ -179,7 +179,6 @@
#ifndef _3D_DISABLED
#include "scene/3d/area_3d.h"
-#include "scene/3d/arvr_nodes.h"
#include "scene/3d/audio_stream_player_3d.h"
#include "scene/3d/baked_lightmap.h"
#include "scene/3d/bone_attachment_3d.h"
@@ -213,6 +212,7 @@
#include "scene/3d/vehicle_body_3d.h"
#include "scene/3d/visibility_notifier_3d.h"
#include "scene/3d/world_environment.h"
+#include "scene/3d/xr_nodes.h"
#include "scene/resources/environment.h"
#include "scene/resources/mesh_library.h"
#endif
@@ -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>();
@@ -410,10 +410,10 @@ void register_scene_types() {
ClassDB::register_class<Camera3D>();
ClassDB::register_class<ClippedCamera3D>();
ClassDB::register_class<Listener3D>();
- ClassDB::register_class<ARVRCamera>();
- ClassDB::register_class<ARVRController>();
- ClassDB::register_class<ARVRAnchor>();
- ClassDB::register_class<ARVROrigin>();
+ ClassDB::register_class<XRCamera3D>();
+ ClassDB::register_class<XRController3D>();
+ ClassDB::register_class<XRAnchor3D>();
+ ClassDB::register_class<XROrigin3D>();
ClassDB::register_class<MeshInstance3D>();
ClassDB::register_class<ImmediateGeometry3D>();
ClassDB::register_virtual_class<SpriteBase3D>();
@@ -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");
@@ -852,6 +853,10 @@ void register_scene_types() {
ClassDB::add_compatibility_class("World", "World3D");
ClassDB::add_compatibility_class("ProceduralSky", "Sky");
ClassDB::add_compatibility_class("PanoramaSky", "Sky");
+ ClassDB::add_compatibility_class("ARVRCamera", "XRCamera3D");
+ ClassDB::add_compatibility_class("ARVROrigin", "XROrigin3D");
+ ClassDB::add_compatibility_class("ARVRController", "XRController3D");
+ ClassDB::add_compatibility_class("ARVRAnchor", "XRAnchor3D");
#endif
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index e6f09eb034..a1e8bf51bd 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -497,6 +497,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
theme->set_stylebox("grabber_area", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
+ theme->set_stylebox("grabber_area_highlight", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
theme->set_icon("grabber", "HSlider", make_icon(hslider_grabber_png));
theme->set_icon("grabber_highlight", "HSlider", make_icon(hslider_grabber_hl_png));
@@ -507,6 +508,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
theme->set_stylebox("grabber_area", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
+ theme->set_stylebox("grabber_area_highlight", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
theme->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png));
theme->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png));
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 84c1c9d734..fd8cff7cd0 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -314,7 +314,7 @@ void BaseMaterial3D::init_shaders() {
shader_names->anisotropy = "anisotropy_ratio";
shader_names->heightmap_scale = "heightmap_scale";
shader_names->subsurface_scattering_strength = "subsurface_scattering_strength";
- shader_names->transmission = "transmission";
+ shader_names->backlight = "backlight";
shader_names->refraction = "refraction";
shader_names->point_size = "point_size";
shader_names->uv1_scale = "uv1_scale";
@@ -347,6 +347,11 @@ void BaseMaterial3D::init_shaders() {
shader_names->refraction_texture_channel = "refraction_texture_channel";
shader_names->alpha_scissor_threshold = "alpha_scissor_threshold";
+ shader_names->transmittance_color = "transmittance_color";
+ shader_names->transmittance_curve = "transmittance_curve";
+ shader_names->transmittance_depth = "transmittance_depth";
+ shader_names->transmittance_boost = "transmittance_boost";
+
shader_names->texture_names[TEXTURE_ALBEDO] = "texture_albedo";
shader_names->texture_names[TEXTURE_METALLIC] = "texture_metallic";
shader_names->texture_names[TEXTURE_ROUGHNESS] = "texture_roughness";
@@ -358,7 +363,8 @@ void BaseMaterial3D::init_shaders() {
shader_names->texture_names[TEXTURE_AMBIENT_OCCLUSION] = "texture_ambient_occlusion";
shader_names->texture_names[TEXTURE_HEIGHTMAP] = "texture_heightmap";
shader_names->texture_names[TEXTURE_SUBSURFACE_SCATTERING] = "texture_subsurface_scattering";
- shader_names->texture_names[TEXTURE_TRANSMISSION] = "texture_transmission";
+ shader_names->texture_names[TEXTURE_SUBSURFACE_TRANSMITTANCE] = "texture_subsurface_transmittance";
+ shader_names->texture_names[TEXTURE_BACKLIGHT] = "texture_backlight";
shader_names->texture_names[TEXTURE_REFRACTION] = "texture_refraction";
shader_names->texture_names[TEXTURE_DETAIL_MASK] = "texture_detail_mask";
shader_names->texture_names[TEXTURE_DETAIL_ALBEDO] = "texture_detail_albedo";
@@ -385,7 +391,7 @@ void BaseMaterial3D::_update_shader() {
dirty_materials->remove(&element);
MaterialKey mk = _compute_key();
- if (mk.key == current_key.key)
+ if (mk == current_key)
return; //no update required in the end
if (shader_map.has(current_key)) {
@@ -467,6 +473,9 @@ void BaseMaterial3D::_update_shader() {
case SPECULAR_TOON: code += ",specular_toon"; break;
case SPECULAR_DISABLED: code += ",specular_disabled"; break;
}
+ if (features[FEATURE_SUBSURFACE_SCATTERING] && flags[FLAG_SUBSURFACE_MODE_SKIN]) {
+ code += ",sss_mode_skin";
+ }
if (shading_mode == SHADING_MODE_UNSHADED) {
code += ",unshaded";
@@ -586,16 +595,25 @@ void BaseMaterial3D::_update_shader() {
code += "uniform sampler2D texture_detail_mask : hint_white," + texfilter_str + ";\n";
}
- if (features[FEATURE_SUBSURACE_SCATTERING]) {
+ if (features[FEATURE_SUBSURFACE_SCATTERING]) {
code += "uniform float subsurface_scattering_strength : hint_range(0,1);\n";
code += "uniform sampler2D texture_subsurface_scattering : hint_white," + texfilter_str + ";\n";
}
- if (features[FEATURE_TRANSMISSION]) {
+ if (features[FEATURE_SUBSURFACE_TRANSMITTANCE]) {
+
+ code += "uniform vec4 transmittance_color : hint_color;\n";
+ code += "uniform float transmittance_depth;\n";
+ code += "uniform sampler2D texture_subsurface_transmittance : hint_white," + texfilter_str + ";\n";
+ code += "uniform float transmittance_curve;\n";
+ code += "uniform float transmittance_boost;\n";
+ }
+
+ if (features[FEATURE_BACKLIGHT]) {
- code += "uniform vec4 transmission : hint_color;\n";
- code += "uniform sampler2D texture_transmission : hint_black," + texfilter_str + ";\n";
+ code += "uniform vec4 backlight : hint_color;\n";
+ code += "uniform sampler2D texture_backlight : hint_black," + texfilter_str + ";\n";
}
if (features[FEATURE_HEIGHT_MAPPING]) {
@@ -1048,7 +1066,7 @@ void BaseMaterial3D::_update_shader() {
code += "\tAO_LIGHT_AFFECT = ao_light_affect;\n";
}
- if (features[FEATURE_SUBSURACE_SCATTERING]) {
+ if (features[FEATURE_SUBSURFACE_SCATTERING]) {
if (flags[FLAG_UV1_USE_TRIPLANAR]) {
code += "\tfloat sss_tex = triplanar_texture(texture_subsurface_scattering,uv1_power_normal,uv1_triplanar_pos).r;\n";
@@ -1058,13 +1076,27 @@ void BaseMaterial3D::_update_shader() {
code += "\tSSS_STRENGTH=subsurface_scattering_strength*sss_tex;\n";
}
- if (features[FEATURE_TRANSMISSION]) {
+ if (features[FEATURE_SUBSURFACE_TRANSMITTANCE]) {
+
+ if (flags[FLAG_UV1_USE_TRIPLANAR]) {
+ code += "\tvec4 trans_color_tex = triplanar_texture(texture_subsurface_transmittance,uv1_power_normal,uv1_triplanar_pos);\n";
+ } else {
+ code += "\tvec4 trans_color_tex = texture(texture_subsurface_transmittance,base_uv);\n";
+ }
+ code += "\tSSS_TRANSMITTANCE_COLOR=transmittance_color*trans_color_tex;\n";
+
+ code += "\tSSS_TRANSMITTANCE_DEPTH=transmittance_depth;\n";
+ code += "\tSSS_TRANSMITTANCE_CURVE=transmittance_curve;\n";
+ code += "\tSSS_TRANSMITTANCE_BOOST=transmittance_boost;\n";
+ }
+
+ if (features[FEATURE_BACKLIGHT]) {
if (flags[FLAG_UV1_USE_TRIPLANAR]) {
- code += "\tvec3 transmission_tex = triplanar_texture(texture_transmission,uv1_power_normal,uv1_triplanar_pos).rgb;\n";
+ code += "\tvec3 backlight_tex = triplanar_texture(texture_backlight,uv1_power_normal,uv1_triplanar_pos).rgb;\n";
} else {
- code += "\tvec3 transmission_tex = texture(texture_transmission,base_uv).rgb;\n";
+ code += "\tvec3 backlight_tex = texture(texture_backlight,base_uv).rgb;\n";
}
- code += "\tTRANSMISSION = (transmission.rgb+transmission_tex);\n";
+ code += "\tBACKLIGHT = (backlight.rgb+backlight_tex);\n";
}
if (features[FEATURE_DETAIL]) {
@@ -1306,15 +1338,48 @@ float BaseMaterial3D::get_subsurface_scattering_strength() const {
return subsurface_scattering_strength;
}
-void BaseMaterial3D::set_transmission(const Color &p_transmission) {
+void BaseMaterial3D::set_transmittance_color(const Color &p_color) {
+ transmittance_color = p_color;
+ RS::get_singleton()->material_set_param(_get_material(), shader_names->transmittance_color, p_color);
+}
+
+Color BaseMaterial3D::get_transmittance_color() const {
+ return transmittance_color;
+}
+
+void BaseMaterial3D::set_transmittance_depth(float p_depth) {
+ transmittance_depth = p_depth;
+ RS::get_singleton()->material_set_param(_get_material(), shader_names->transmittance_depth, p_depth);
+}
+float BaseMaterial3D::get_transmittance_depth() const {
+ return transmittance_depth;
+}
+
+void BaseMaterial3D::set_transmittance_curve(float p_curve) {
+ transmittance_curve = p_curve;
+ RS::get_singleton()->material_set_param(_get_material(), shader_names->transmittance_curve, p_curve);
+}
+float BaseMaterial3D::get_transmittance_curve() const {
+ return transmittance_curve;
+}
- transmission = p_transmission;
- RS::get_singleton()->material_set_param(_get_material(), shader_names->transmission, transmission);
+void BaseMaterial3D::set_transmittance_boost(float p_boost) {
+ transmittance_boost = p_boost;
+ RS::get_singleton()->material_set_param(_get_material(), shader_names->transmittance_boost, p_boost);
+}
+float BaseMaterial3D::get_transmittance_boost() const {
+ return transmittance_boost;
}
-Color BaseMaterial3D::get_transmission() const {
+void BaseMaterial3D::set_backlight(const Color &p_backlight) {
- return transmission;
+ backlight = p_backlight;
+ RS::get_singleton()->material_set_param(_get_material(), shader_names->backlight, backlight);
+}
+
+Color BaseMaterial3D::get_backlight() const {
+
+ return backlight;
}
void BaseMaterial3D::set_refraction(float p_refraction) {
@@ -1454,7 +1519,7 @@ void BaseMaterial3D::set_flag(Flags p_flag, bool p_enabled) {
return;
flags[p_flag] = p_enabled;
- if ((p_flag == FLAG_USE_SHADOW_TO_OPACITY) || (p_flag == FLAG_USE_TEXTURE_REPEAT)) {
+ if (p_flag == FLAG_USE_SHADOW_TO_OPACITY || p_flag == FLAG_USE_TEXTURE_REPEAT || p_flag == FLAG_SUBSURFACE_MODE_SKIN) {
_change_notify();
}
_queue_shader_change();
@@ -1537,8 +1602,8 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const {
_validate_feature("anisotropy", FEATURE_ANISOTROPY, property);
_validate_feature("ao", FEATURE_AMBIENT_OCCLUSION, property);
_validate_feature("heightmap", FEATURE_HEIGHT_MAPPING, property);
- _validate_feature("subsurf_scatter", FEATURE_SUBSURACE_SCATTERING, property);
- _validate_feature("transmission", FEATURE_TRANSMISSION, property);
+ _validate_feature("subsurf_scatter", FEATURE_SUBSURFACE_SCATTERING, property);
+ _validate_feature("backlight", FEATURE_BACKLIGHT, property);
_validate_feature("refraction", FEATURE_REFRACTION, property);
_validate_feature("detail", FEATURE_DETAIL, property);
@@ -1572,6 +1637,10 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const {
property.usage = 0;
}
+ if (flags[FLAG_SUBSURFACE_MODE_SKIN] && (property.name == "subsurf_scatter_transmittance_color" || property.name == "subsurf_scatter_transmittance_texture" || property.name == "subsurf_scatter_transmittance_curve")) {
+ property.usage = 0;
+ }
+
if (orm) {
if (property.name == "shading_mode") {
@@ -1628,7 +1697,11 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const {
property.usage = 0;
}
- if (property.name.begins_with("transmission")) {
+ if (property.name.begins_with("backlight")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("transmittance")) {
property.usage = 0;
}
}
@@ -2067,8 +2140,20 @@ void BaseMaterial3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_subsurface_scattering_strength", "strength"), &BaseMaterial3D::set_subsurface_scattering_strength);
ClassDB::bind_method(D_METHOD("get_subsurface_scattering_strength"), &BaseMaterial3D::get_subsurface_scattering_strength);
- ClassDB::bind_method(D_METHOD("set_transmission", "transmission"), &BaseMaterial3D::set_transmission);
- ClassDB::bind_method(D_METHOD("get_transmission"), &BaseMaterial3D::get_transmission);
+ ClassDB::bind_method(D_METHOD("set_transmittance_color", "color"), &BaseMaterial3D::set_transmittance_color);
+ ClassDB::bind_method(D_METHOD("get_transmittance_color"), &BaseMaterial3D::get_transmittance_color);
+
+ ClassDB::bind_method(D_METHOD("set_transmittance_depth", "depth"), &BaseMaterial3D::set_transmittance_depth);
+ ClassDB::bind_method(D_METHOD("get_transmittance_depth"), &BaseMaterial3D::get_transmittance_depth);
+
+ ClassDB::bind_method(D_METHOD("set_transmittance_curve", "curve"), &BaseMaterial3D::set_transmittance_curve);
+ ClassDB::bind_method(D_METHOD("get_transmittance_curve"), &BaseMaterial3D::get_transmittance_curve);
+
+ ClassDB::bind_method(D_METHOD("set_transmittance_boost", "boost"), &BaseMaterial3D::set_transmittance_boost);
+ ClassDB::bind_method(D_METHOD("get_transmittance_boost"), &BaseMaterial3D::get_transmittance_boost);
+
+ ClassDB::bind_method(D_METHOD("set_backlight", "backlight"), &BaseMaterial3D::set_backlight);
+ ClassDB::bind_method(D_METHOD("get_backlight"), &BaseMaterial3D::get_backlight);
ClassDB::bind_method(D_METHOD("set_refraction", "refraction"), &BaseMaterial3D::set_refraction);
ClassDB::bind_method(D_METHOD("get_refraction"), &BaseMaterial3D::get_refraction);
@@ -2282,14 +2367,23 @@ void BaseMaterial3D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "heightmap_flip_texture"), "set_flag", "get_flag", FLAG_INVERT_HEIGHTMAP);
ADD_GROUP("Subsurf Scatter", "subsurf_scatter_");
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "subsurf_scatter_enabled"), "set_feature", "get_feature", FEATURE_SUBSURACE_SCATTERING);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "subsurf_scatter_enabled"), "set_feature", "get_feature", FEATURE_SUBSURFACE_SCATTERING);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "subsurf_scatter_strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_subsurface_scattering_strength", "get_subsurface_scattering_strength");
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "subsurf_scatter_skin_mode"), "set_flag", "get_flag", FLAG_SUBSURFACE_MODE_SKIN);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "subsurf_scatter_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_SUBSURFACE_SCATTERING);
- ADD_GROUP("Transmission", "transmission_");
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "transmission_enabled"), "set_feature", "get_feature", FEATURE_TRANSMISSION);
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "transmission", PROPERTY_HINT_COLOR_NO_ALPHA), "set_transmission", "get_transmission");
- ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "transmission_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_TRANSMISSION);
+ ADD_SUBGROUP("Transmittance", "subsurf_scatter_transmittance_");
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "subsurf_scatter_transmittance_enabled"), "set_feature", "get_feature", FEATURE_SUBSURFACE_TRANSMITTANCE);
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "subsurf_scatter_transmittance_color"), "set_transmittance_color", "get_transmittance_color");
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "subsurf_scatter_transmittance_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_SUBSURFACE_TRANSMITTANCE);
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "subsurf_scatter_transmittance_depth", PROPERTY_HINT_RANGE, "0.001,8,0.001,or_greater"), "set_transmittance_depth", "get_transmittance_depth");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "subsurf_scatter_transmittance_curve", PROPERTY_HINT_EXP_EASING, "0.01,16,0.01"), "set_transmittance_curve", "get_transmittance_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "subsurf_scatter_transmittance_boost", PROPERTY_HINT_RANGE, "0.00,1.0,0.01"), "set_transmittance_boost", "get_transmittance_boost");
+
+ ADD_GROUP("Back Lighting", "backlight_");
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "backlight_enabled"), "set_feature", "get_feature", FEATURE_BACKLIGHT);
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "backlight", PROPERTY_HINT_COLOR_NO_ALPHA), "set_backlight", "get_backlight");
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "backlight_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_BACKLIGHT);
ADD_GROUP("Refraction", "refraction_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "refraction_enabled"), "set_feature", "get_feature", FEATURE_REFRACTION);
@@ -2362,7 +2456,8 @@ void BaseMaterial3D::_bind_methods() {
BIND_ENUM_CONSTANT(TEXTURE_AMBIENT_OCCLUSION);
BIND_ENUM_CONSTANT(TEXTURE_HEIGHTMAP);
BIND_ENUM_CONSTANT(TEXTURE_SUBSURFACE_SCATTERING);
- BIND_ENUM_CONSTANT(TEXTURE_TRANSMISSION);
+ BIND_ENUM_CONSTANT(TEXTURE_SUBSURFACE_TRANSMITTANCE);
+ BIND_ENUM_CONSTANT(TEXTURE_BACKLIGHT);
BIND_ENUM_CONSTANT(TEXTURE_REFRACTION);
BIND_ENUM_CONSTANT(TEXTURE_DETAIL_MASK);
BIND_ENUM_CONSTANT(TEXTURE_DETAIL_ALBEDO);
@@ -2399,8 +2494,9 @@ void BaseMaterial3D::_bind_methods() {
BIND_ENUM_CONSTANT(FEATURE_ANISOTROPY);
BIND_ENUM_CONSTANT(FEATURE_AMBIENT_OCCLUSION);
BIND_ENUM_CONSTANT(FEATURE_HEIGHT_MAPPING);
- BIND_ENUM_CONSTANT(FEATURE_SUBSURACE_SCATTERING);
- BIND_ENUM_CONSTANT(FEATURE_TRANSMISSION);
+ BIND_ENUM_CONSTANT(FEATURE_SUBSURFACE_SCATTERING);
+ BIND_ENUM_CONSTANT(FEATURE_SUBSURFACE_TRANSMITTANCE);
+ BIND_ENUM_CONSTANT(FEATURE_BACKLIGHT);
BIND_ENUM_CONSTANT(FEATURE_REFRACTION);
BIND_ENUM_CONSTANT(FEATURE_DETAIL);
BIND_ENUM_CONSTANT(FEATURE_MAX);
@@ -2436,6 +2532,7 @@ void BaseMaterial3D::_bind_methods() {
BIND_ENUM_CONSTANT(FLAG_USE_SHADOW_TO_OPACITY);
BIND_ENUM_CONSTANT(FLAG_USE_TEXTURE_REPEAT);
BIND_ENUM_CONSTANT(FLAG_INVERT_HEIGHTMAP);
+ BIND_ENUM_CONSTANT(FLAG_SUBSURFACE_MODE_SKIN);
BIND_ENUM_CONSTANT(FLAG_MAX);
BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
@@ -2491,7 +2588,11 @@ BaseMaterial3D::BaseMaterial3D(bool p_orm) :
set_anisotropy(0);
set_heightmap_scale(0.05);
set_subsurface_scattering_strength(0);
- set_transmission(Color(0, 0, 0));
+ set_backlight(Color(0, 0, 0));
+ set_transmittance_color(Color(1, 1, 1, 1));
+ set_transmittance_depth(0.1);
+ set_transmittance_curve(1.0);
+ set_transmittance_boost(0.0);
set_refraction(0.05);
set_point_size(1);
set_uv1_offset(Vector3(0, 0, 0));
@@ -2547,7 +2648,8 @@ BaseMaterial3D::BaseMaterial3D(bool p_orm) :
features[i] = false;
}
- current_key.key = 0;
+ current_key.key0 = 0;
+ current_key.key1 = 0;
current_key.invalid_key = 1;
texture_filter = TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
_queue_shader_change();
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 0c9352baf4..241357ba9b 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -125,7 +125,8 @@ public:
TEXTURE_AMBIENT_OCCLUSION,
TEXTURE_HEIGHTMAP,
TEXTURE_SUBSURFACE_SCATTERING,
- TEXTURE_TRANSMISSION,
+ TEXTURE_SUBSURFACE_TRANSMITTANCE,
+ TEXTURE_BACKLIGHT,
TEXTURE_REFRACTION,
TEXTURE_DETAIL_MASK,
TEXTURE_DETAIL_ALBEDO,
@@ -173,8 +174,9 @@ public:
FEATURE_ANISOTROPY,
FEATURE_AMBIENT_OCCLUSION,
FEATURE_HEIGHT_MAPPING,
- FEATURE_SUBSURACE_SCATTERING,
- FEATURE_TRANSMISSION,
+ FEATURE_SUBSURFACE_SCATTERING,
+ FEATURE_SUBSURFACE_TRANSMITTANCE,
+ FEATURE_BACKLIGHT,
FEATURE_REFRACTION,
FEATURE_DETAIL,
FEATURE_MAX
@@ -218,6 +220,7 @@ public:
FLAG_USE_SHADOW_TO_OPACITY,
FLAG_USE_TEXTURE_REPEAT,
FLAG_INVERT_HEIGHTMAP,
+ FLAG_SUBSURFACE_MODE_SKIN,
FLAG_MAX
};
@@ -290,10 +293,16 @@ private:
uint64_t roughness_channel : 3;
};
- uint64_t key;
+ struct {
+ uint64_t key0;
+ uint64_t key1;
+ };
+ bool operator==(const MaterialKey &p_key) const {
+ return (key0 == p_key.key0) && (key1 == p_key.key1);
+ }
bool operator<(const MaterialKey &p_key) const {
- return key < p_key.key;
+ return (key0 == p_key.key0) ? (key1 < p_key.key1) : (key0 < p_key.key0);
}
};
@@ -309,7 +318,8 @@ private:
_FORCE_INLINE_ MaterialKey _compute_key() const {
MaterialKey mk;
- mk.key = 0;
+ mk.key0 = 0;
+ mk.key1 = 0;
for (int i = 0; i < FEATURE_MAX; i++) {
if (features[i]) {
mk.feature_mask |= ((uint64_t)1 << i);
@@ -356,7 +366,11 @@ private:
StringName anisotropy;
StringName heightmap_scale;
StringName subsurface_scattering_strength;
- StringName transmission;
+ StringName transmittance_color;
+ StringName transmittance_curve;
+ StringName transmittance_depth;
+ StringName transmittance_boost;
+ StringName backlight;
StringName refraction;
StringName point_size;
StringName uv1_scale;
@@ -414,7 +428,13 @@ private:
float anisotropy;
float heightmap_scale;
float subsurface_scattering_strength;
- Color transmission;
+ float transmittance_amount;
+ Color transmittance_color;
+ float transmittance_depth;
+ float transmittance_curve;
+ float transmittance_boost;
+
+ Color backlight;
float refraction;
float point_size;
float alpha_scissor_threshold;
@@ -545,8 +565,20 @@ public:
void set_subsurface_scattering_strength(float p_subsurface_scattering_strength);
float get_subsurface_scattering_strength() const;
- void set_transmission(const Color &p_transmission);
- Color get_transmission() const;
+ void set_transmittance_color(const Color &p_color);
+ Color get_transmittance_color() const;
+
+ void set_transmittance_depth(float p_depth);
+ float get_transmittance_depth() const;
+
+ void set_transmittance_curve(float p_curve);
+ float get_transmittance_curve() const;
+
+ void set_transmittance_boost(float p_boost);
+ float get_transmittance_boost() const;
+
+ void set_backlight(const Color &p_backlight);
+ Color get_backlight() const;
void set_refraction(float p_refraction);
float get_refraction() const;
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index f70f54412b..310a7ef4e4 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2164,6 +2164,17 @@ void VisualShaderNodeUniform::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "uniform_name"), "set_uniform_name", "get_uniform_name");
}
+String VisualShaderNodeUniform::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {
+
+ List<String> keyword_list;
+ ShaderLanguage::get_keyword_list(&keyword_list);
+ if (keyword_list.find(uniform_name)) {
+ return TTR("Uniform name cannot be equal to a shader keyword. Choose another name.");
+ }
+
+ return String();
+}
+
VisualShaderNodeUniform::VisualShaderNodeUniform() {
}
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 450dcfa081..ecf3f93fbb 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -379,6 +379,8 @@ public:
void set_uniform_name(const String &p_name);
String get_uniform_name() const;
+ virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const;
+
VisualShaderNodeUniform();
};