summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/area_2d.cpp8
-rw-r--r--scene/2d/area_2d.h4
-rw-r--r--scene/2d/navigation_region_2d.cpp4
-rw-r--r--scene/2d/navigation_region_2d.h4
-rw-r--r--scene/2d/physics_body_2d.cpp6
-rw-r--r--scene/2d/physics_body_2d.h4
-rw-r--r--scene/2d/tile_map.cpp12
-rw-r--r--scene/2d/tile_map.h4
-rw-r--r--scene/3d/area_3d.cpp4
-rw-r--r--scene/3d/area_3d.h4
-rw-r--r--scene/3d/light_3d.cpp1
-rw-r--r--scene/3d/mesh_instance_3d.cpp21
-rw-r--r--scene/3d/physics_body_3d.cpp2
-rw-r--r--scene/3d/physics_body_3d.h2
-rw-r--r--scene/3d/skeleton_3d.cpp12
-rw-r--r--scene/3d/skeleton_3d.h2
-rw-r--r--scene/3d/spring_arm_3d.cpp4
-rw-r--r--scene/3d/visual_instance_3d.cpp75
-rw-r--r--scene/3d/visual_instance_3d.h12
-rw-r--r--scene/3d/voxelizer.cpp18
-rw-r--r--scene/animation/animation_player.cpp4
-rw-r--r--scene/main/node.cpp4
-rw-r--r--scene/main/node.h3
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/main/shader_globals_override.cpp257
-rw-r--r--scene/main/shader_globals_override.h37
-rw-r--r--scene/main/viewport.cpp30
-rw-r--r--scene/main/viewport.h1
-rw-r--r--scene/register_scene_types.cpp20
-rw-r--r--scene/resources/dynamic_font.cpp2
-rw-r--r--scene/resources/dynamic_font.h2
-rw-r--r--scene/resources/font.cpp2
-rw-r--r--scene/resources/font.h2
-rw-r--r--scene/resources/resource_format_text.cpp47
-rw-r--r--scene/resources/resource_format_text.h6
-rw-r--r--scene/resources/shader.cpp2
-rw-r--r--scene/resources/shader.h2
-rw-r--r--scene/resources/sky_material.cpp39
-rw-r--r--scene/resources/sky_material.h4
-rw-r--r--scene/resources/texture.cpp4
-rw-r--r--scene/resources/texture.h4
-rw-r--r--scene/scene_string_names.cpp3
-rw-r--r--scene/scene_string_names.h2
43 files changed, 536 insertions, 146 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index c46b6eeb5c..8ba334bc67 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -435,10 +435,10 @@ bool Area2D::is_monitorable() const {
return monitorable;
}
-Array Area2D::get_overlapping_bodies() const {
+TypedArray<Node2D> Area2D::get_overlapping_bodies() const {
ERR_FAIL_COND_V_MSG(!monitoring, Array(), "Can't find overlapping bodies when monitoring is off.");
- Array ret;
+ TypedArray<Node2D> ret;
ret.resize(body_map.size());
int idx = 0;
for (const Map<ObjectID, BodyState>::Element *E = body_map.front(); E; E = E->next()) {
@@ -453,10 +453,10 @@ Array Area2D::get_overlapping_bodies() const {
return ret;
}
-Array Area2D::get_overlapping_areas() const {
+TypedArray<Area2D> Area2D::get_overlapping_areas() const {
ERR_FAIL_COND_V_MSG(!monitoring, Array(), "Can't find overlapping bodies when monitoring is off.");
- Array ret;
+ TypedArray<Area2D> ret;
ret.resize(area_map.size());
int idx = 0;
for (const Map<ObjectID, AreaState>::Element *E = area_map.front(); E; E = E->next()) {
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index c5e6635412..0e2c0ac672 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -178,8 +178,8 @@ public:
void set_collision_layer_bit(int p_bit, bool p_value);
bool get_collision_layer_bit(int p_bit) const;
- Array get_overlapping_bodies() const; //function for script
- Array get_overlapping_areas() const; //function for script
+ TypedArray<Node2D> get_overlapping_bodies() const; //function for script
+ TypedArray<Area2D> get_overlapping_areas() const; //function for script
bool overlaps_area(Node *p_area) const;
bool overlaps_body(Node *p_body) const;
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index d77fd5b097..19484442b1 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -95,7 +95,7 @@ Vector<Vector2> NavigationPolygon::get_vertices() const {
return vertices;
}
-void NavigationPolygon::_set_polygons(const Array &p_array) {
+void NavigationPolygon::_set_polygons(const TypedArray<Vector<int32_t>> &p_array) {
{
MutexLock lock(navmesh_generation);
@@ -118,7 +118,7 @@ Array NavigationPolygon::_get_polygons() const {
return ret;
}
-void NavigationPolygon::_set_outlines(const Array &p_array) {
+void NavigationPolygon::_set_outlines(const TypedArray<Vector<int32_t>> &p_array) {
outlines.resize(p_array.size());
for (int i = 0; i < p_array.size(); i++) {
diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h
index 73e056a353..cbfe4299fb 100644
--- a/scene/2d/navigation_region_2d.h
+++ b/scene/2d/navigation_region_2d.h
@@ -55,10 +55,10 @@ class NavigationPolygon : public Resource {
protected:
static void _bind_methods();
- void _set_polygons(const Array &p_array);
+ void _set_polygons(const TypedArray<Vector<int32_t>> &p_array);
Array _get_polygons() const;
- void _set_outlines(const Array &p_array);
+ void _set_outlines(const TypedArray<Vector<int32_t>> &p_array);
Array _get_outlines() const;
public:
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 21dc9537ec..de15f0efc2 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -139,7 +139,7 @@ PhysicsBody2D::PhysicsBody2D(PhysicsServer2D::BodyMode p_mode) :
set_pickable(false);
}
-Array PhysicsBody2D::get_collision_exceptions() {
+TypedArray<PhysicsBody2D> PhysicsBody2D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer2D::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
Array ret;
@@ -739,11 +739,11 @@ RigidBody2D::CCDMode RigidBody2D::get_continuous_collision_detection_mode() cons
return ccd_mode;
}
-Array RigidBody2D::get_colliding_bodies() const {
+TypedArray<Node2D> RigidBody2D::get_colliding_bodies() const {
ERR_FAIL_COND_V(!contact_monitor, Array());
- Array ret;
+ TypedArray<Node2D> ret;
ret.resize(contact_monitor->body_map.size());
int idx = 0;
for (const Map<ObjectID, BodyState>::Element *E = contact_monitor->body_map.front(); E; E = E->next()) {
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index 0d92a820e3..75f4f778bf 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -67,7 +67,7 @@ public:
void set_collision_layer_bit(int p_bit, bool p_value);
bool get_collision_layer_bit(int p_bit) const;
- Array get_collision_exceptions();
+ TypedArray<PhysicsBody2D> get_collision_exceptions();
void add_collision_exception_with(Node *p_node); //must be physicsbody
void remove_collision_exception_with(Node *p_node);
@@ -256,7 +256,7 @@ public:
void add_force(const Vector2 &p_offset, const Vector2 &p_force);
void add_torque(float p_torque);
- Array get_colliding_bodies() const; //function for script
+ TypedArray<Node2D> get_colliding_bodies() const; //function for script
virtual String get_configuration_warning() const;
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 1cf12e4421..9628c01718 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1691,27 +1691,27 @@ bool TileMap::is_centered_textures_enabled() const {
return centered_textures;
}
-Array TileMap::get_used_cells() const {
+TypedArray<Vector2i> TileMap::get_used_cells() const {
- Array a;
+ TypedArray<Vector2i> a;
a.resize(tile_map.size());
int i = 0;
for (Map<PosKey, Cell>::Element *E = tile_map.front(); E; E = E->next()) {
- Vector2 p(E->key().x, E->key().y);
+ Vector2i p(E->key().x, E->key().y);
a[i++] = p;
}
return a;
}
-Array TileMap::get_used_cells_by_id(int p_id) const {
+TypedArray<Vector2i> TileMap::get_used_cells_by_id(int p_id) const {
- Array a;
+ TypedArray<Vector2i> a;
for (Map<PosKey, Cell>::Element *E = tile_map.front(); E; E = E->next()) {
if (E->value().id == p_id) {
- Vector2 p(E->key().x, E->key().y);
+ Vector2i p(E->key().x, E->key().y);
a.push_back(p);
}
}
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index d9490aae13..cc1537f583 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -328,8 +328,8 @@ public:
void set_centered_textures(bool p_enable);
bool is_centered_textures_enabled() const;
- Array get_used_cells() const;
- Array get_used_cells_by_id(int p_id) const;
+ TypedArray<Vector2i> get_used_cells() const;
+ TypedArray<Vector2i> get_used_cells_by_id(int p_id) const;
Rect2 get_used_rect(); // Not const because of cache
void set_occluder_light_mask(int p_mask);
diff --git a/scene/3d/area_3d.cpp b/scene/3d/area_3d.cpp
index 17ae553e5e..b72483d71b 100644
--- a/scene/3d/area_3d.cpp
+++ b/scene/3d/area_3d.cpp
@@ -416,7 +416,7 @@ bool Area3D::is_monitoring() const {
return monitoring;
}
-Array Area3D::get_overlapping_bodies() const {
+TypedArray<Node3D> Area3D::get_overlapping_bodies() const {
ERR_FAIL_COND_V(!monitoring, Array());
Array ret;
@@ -451,7 +451,7 @@ bool Area3D::is_monitorable() const {
return monitorable;
}
-Array Area3D::get_overlapping_areas() const {
+TypedArray<Area3D> Area3D::get_overlapping_areas() const {
ERR_FAIL_COND_V(!monitoring, Array());
Array ret;
diff --git a/scene/3d/area_3d.h b/scene/3d/area_3d.h
index ff6c0b6b08..f6503c6d2d 100644
--- a/scene/3d/area_3d.h
+++ b/scene/3d/area_3d.h
@@ -184,8 +184,8 @@ public:
void set_collision_layer_bit(int p_bit, bool p_value);
bool get_collision_layer_bit(int p_bit) const;
- Array get_overlapping_bodies() const;
- Array get_overlapping_areas() const; //function for script
+ TypedArray<Node3D> get_overlapping_bodies() const;
+ TypedArray<Area3D> get_overlapping_areas() const; //function for script
bool overlaps_area(Node *p_area) const;
bool overlaps_body(Node *p_body) const;
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index 9928246d2b..c048f60ebd 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -301,6 +301,7 @@ void Light3D::_bind_methods() {
BIND_ENUM_CONSTANT(PARAM_INDIRECT_ENERGY);
BIND_ENUM_CONSTANT(PARAM_SPECULAR);
BIND_ENUM_CONSTANT(PARAM_RANGE);
+ BIND_ENUM_CONSTANT(PARAM_SIZE);
BIND_ENUM_CONSTANT(PARAM_ATTENUATION);
BIND_ENUM_CONSTANT(PARAM_SPOT_ANGLE);
BIND_ENUM_CONSTANT(PARAM_SPOT_ATTENUATION);
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index d56a095a5b..cdc8db8aea 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -307,19 +307,22 @@ Ref<Material> MeshInstance3D::get_surface_material(int p_surface) const {
Ref<Material> MeshInstance3D::get_active_material(int p_surface) const {
- if (get_material_override() != Ref<Material>()) {
- return get_material_override();
- } else if (p_surface < materials.size()) {
- return materials[p_surface];
- } else {
- Ref<Mesh> mesh = get_mesh();
+ Ref<Material> material_override = get_material_override();
+ if (material_override.is_valid()) {
+ return material_override;
+ }
- if (mesh.is_null() || p_surface >= mesh->get_surface_count()) {
- return Ref<Material>();
- }
+ Ref<Material> surface_material = get_surface_material(p_surface);
+ if (surface_material.is_valid()) {
+ return surface_material;
+ }
+ Ref<Mesh> mesh = get_mesh();
+ if (mesh.is_valid()) {
return mesh->surface_get_material(p_surface);
}
+
+ return Ref<Material>();
}
void MeshInstance3D::_mesh_changed() {
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 72d1762ab5..3991efc7c0 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -110,7 +110,7 @@ bool PhysicsBody3D::get_collision_layer_bit(int p_bit) const {
return get_collision_layer() & (1 << p_bit);
}
-Array PhysicsBody3D::get_collision_exceptions() {
+TypedArray<PhysicsBody3D> PhysicsBody3D::get_collision_exceptions() {
List<RID> exceptions;
PhysicsServer3D::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
Array ret;
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index 2e71020233..0e719f5108 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -68,7 +68,7 @@ public:
void set_collision_mask_bit(int p_bit, bool p_value);
bool get_collision_mask_bit(int p_bit) const;
- Array get_collision_exceptions();
+ TypedArray<PhysicsBody3D> get_collision_exceptions();
void add_collision_exception_with(Node *p_node); //must be physicsbody
void remove_collision_exception_with(Node *p_node);
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 59a6e23005..973822653a 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -33,6 +33,7 @@
#include "core/engine.h"
#include "core/message_queue.h"
#include "core/project_settings.h"
+#include "core/type_info.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/resources/surface_tool.h"
@@ -770,7 +771,7 @@ void _pb_start_simulation(const Skeleton3D *p_skeleton, Node *p_node, const Vect
}
}
-void Skeleton3D::physical_bones_start_simulation_on(const Array &p_bones) {
+void Skeleton3D::physical_bones_start_simulation_on(const TypedArray<StringName> &p_bones) {
set_physics_process_internal(false);
Vector<int> sim_bones;
@@ -780,12 +781,9 @@ void Skeleton3D::physical_bones_start_simulation_on(const Array &p_bones) {
sim_bones.resize(p_bones.size());
int c = 0;
for (int i = sim_bones.size() - 1; 0 <= i; --i) {
- Variant::Type type = p_bones.get(i).get_type();
- if (Variant::STRING == type || Variant::STRING_NAME == type) {
- int bone_id = find_bone(p_bones.get(i));
- if (bone_id != -1)
- sim_bones.write[c++] = bone_id;
- }
+ int bone_id = find_bone(p_bones[i]);
+ if (bone_id != -1)
+ sim_bones.write[c++] = bone_id;
}
sim_bones.resize(c);
}
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index 08b8691658..0bccd3f8fc 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -222,7 +222,7 @@ private:
public:
void physical_bones_stop_simulation();
- void physical_bones_start_simulation_on(const Array &p_bones);
+ void physical_bones_start_simulation_on(const TypedArray<StringName> &p_bones);
void physical_bones_add_collision_exception(RID p_exception);
void physical_bones_remove_collision_exception(RID p_exception);
#endif // _3D_DISABLED
diff --git a/scene/3d/spring_arm_3d.cpp b/scene/3d/spring_arm_3d.cpp
index a5460593c9..0ffde7aa8f 100644
--- a/scene/3d/spring_arm_3d.cpp
+++ b/scene/3d/spring_arm_3d.cpp
@@ -45,12 +45,12 @@ void SpringArm3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
if (!Engine::get_singleton()->is_editor_hint()) {
- set_process_internal(true);
+ set_physics_process_internal(true);
}
break;
case NOTIFICATION_EXIT_TREE:
if (!Engine::get_singleton()->is_editor_hint()) {
- set_process_internal(false);
+ set_physics_process_internal(false);
}
break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS:
diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp
index 775a9b76e2..604bc53422 100644
--- a/scene/3d/visual_instance_3d.cpp
+++ b/scene/3d/visual_instance_3d.cpp
@@ -217,6 +217,62 @@ float GeometryInstance3D::get_lod_max_hysteresis() const {
void GeometryInstance3D::_notification(int p_what) {
}
+const StringName *GeometryInstance3D::_instance_uniform_get_remap(const StringName p_name) const {
+ StringName *r = instance_uniform_property_remap.getptr(p_name);
+ if (!r) {
+ String s = p_name;
+ if (s.begins_with("shader_params/")) {
+ StringName name = s.replace("shader_params/", "");
+ instance_uniform_property_remap[p_name] = name;
+ return instance_uniform_property_remap.getptr(p_name);
+ }
+
+ return nullptr;
+ }
+
+ return r;
+}
+
+bool GeometryInstance3D::_set(const StringName &p_name, const Variant &p_value) {
+ const StringName *r = _instance_uniform_get_remap(p_name);
+ if (r) {
+ set_shader_instance_uniform(*r, p_value);
+ return true;
+ }
+
+ return false;
+}
+
+bool GeometryInstance3D::_get(const StringName &p_name, Variant &r_ret) const {
+ const StringName *r = _instance_uniform_get_remap(p_name);
+ if (r) {
+ r_ret = get_shader_instance_uniform(*r);
+ return true;
+ }
+
+ return false;
+}
+void GeometryInstance3D::_get_property_list(List<PropertyInfo> *p_list) const {
+ List<PropertyInfo> pinfo;
+ RS::get_singleton()->instance_geometry_get_shader_parameter_list(get_instance(), &pinfo);
+ for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
+ PropertyInfo pi = E->get();
+ bool has_def_value = false;
+ Variant def_value = RS::get_singleton()->instance_geometry_get_shader_parameter_default_value(get_instance(), pi.name);
+ if (def_value.get_type() != Variant::NIL) {
+ has_def_value = true;
+ }
+ if (instance_uniforms.has(pi.name)) {
+ pi.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE | (has_def_value ? (PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED) : 0);
+ } else {
+ pi.usage = PROPERTY_USAGE_EDITOR | (has_def_value ? PROPERTY_USAGE_CHECKABLE : 0); //do not save if not changed
+ }
+
+ pi.name = "shader_params/" + pi.name;
+ p_list->push_back(pi);
+ }
+}
+
void GeometryInstance3D::set_flag(Flags p_flag, bool p_value) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
@@ -258,6 +314,22 @@ float GeometryInstance3D::get_extra_cull_margin() const {
return extra_cull_margin;
}
+void GeometryInstance3D::set_shader_instance_uniform(const StringName &p_uniform, const Variant &p_value) {
+
+ if (p_value.get_type() == Variant::NIL) {
+ Variant def_value = RS::get_singleton()->instance_geometry_get_shader_parameter_default_value(get_instance(), p_uniform);
+ RS::get_singleton()->instance_geometry_set_shader_parameter(get_instance(), p_uniform, def_value);
+ instance_uniforms.erase(p_value);
+ } else {
+ instance_uniforms[p_uniform] = p_value;
+ RS::get_singleton()->instance_geometry_set_shader_parameter(get_instance(), p_uniform, p_value);
+ }
+}
+
+Variant GeometryInstance3D::get_shader_instance_uniform(const StringName &p_uniform) const {
+
+ return RS::get_singleton()->instance_geometry_get_shader_parameter(get_instance(), p_uniform);
+}
void GeometryInstance3D::set_custom_aabb(AABB aabb) {
RS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb);
@@ -280,6 +352,9 @@ void GeometryInstance3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lod_max_distance", "mode"), &GeometryInstance3D::set_lod_max_distance);
ClassDB::bind_method(D_METHOD("get_lod_max_distance"), &GeometryInstance3D::get_lod_max_distance);
+ ClassDB::bind_method(D_METHOD("set_shader_instance_uniform", "uniform", "value"), &GeometryInstance3D::set_shader_instance_uniform);
+ ClassDB::bind_method(D_METHOD("get_shader_instance_uniform", "uniform"), &GeometryInstance3D::get_shader_instance_uniform);
+
ClassDB::bind_method(D_METHOD("set_lod_min_hysteresis", "mode"), &GeometryInstance3D::set_lod_min_hysteresis);
ClassDB::bind_method(D_METHOD("get_lod_min_hysteresis"), &GeometryInstance3D::get_lod_min_hysteresis);
diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h
index 9476c28848..cc5f92066f 100644
--- a/scene/3d/visual_instance_3d.h
+++ b/scene/3d/visual_instance_3d.h
@@ -108,9 +108,18 @@ private:
float lod_min_hysteresis;
float lod_max_hysteresis;
+ mutable HashMap<StringName, Variant> instance_uniforms;
+ mutable HashMap<StringName, StringName> instance_uniform_property_remap;
+
float extra_cull_margin;
+ const StringName *_instance_uniform_get_remap(const StringName p_name) const;
+
protected:
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+ void _get_property_list(List<PropertyInfo> *p_list) const;
+
void _notification(int p_what);
static void _bind_methods();
@@ -139,6 +148,9 @@ public:
void set_extra_cull_margin(float p_margin);
float get_extra_cull_margin() const;
+ void set_shader_instance_uniform(const StringName &p_uniform, const Variant &p_value);
+ Variant get_shader_instance_uniform(const StringName &p_uniform) const;
+
void set_custom_aabb(AABB aabb);
GeometryInstance3D();
diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp
index 203c3cd812..f30c58be55 100644
--- a/scene/3d/voxelizer.cpp
+++ b/scene/3d/voxelizer.cpp
@@ -592,22 +592,16 @@ void Voxelizer::plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, const Vec
Vector<Vector3> vertices = a[Mesh::ARRAY_VERTEX];
const Vector3 *vr = vertices.ptr();
Vector<Vector2> uv = a[Mesh::ARRAY_TEX_UV];
- const Vector2 *uvr;
+ const Vector2 *uvr = nullptr;
Vector<Vector3> normals = a[Mesh::ARRAY_NORMAL];
- const Vector3 *nr;
+ const Vector3 *nr = nullptr;
Vector<int> index = a[Mesh::ARRAY_INDEX];
- bool read_uv = false;
- bool read_normals = false;
-
if (uv.size()) {
-
uvr = uv.ptr();
- read_uv = true;
}
if (normals.size()) {
- read_normals = true;
nr = normals.ptr();
}
@@ -626,13 +620,13 @@ void Voxelizer::plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, const Vec
vtxs[k] = p_xform.xform(vr[ir[j * 3 + k]]);
}
- if (read_uv) {
+ if (uvr) {
for (int k = 0; k < 3; k++) {
uvs[k] = uvr[ir[j * 3 + k]];
}
}
- if (read_normals) {
+ if (nr) {
for (int k = 0; k < 3; k++) {
normal[k] = nr[ir[j * 3 + k]];
}
@@ -659,13 +653,13 @@ void Voxelizer::plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, const Vec
vtxs[k] = p_xform.xform(vr[j * 3 + k]);
}
- if (read_uv) {
+ if (uvr) {
for (int k = 0; k < 3; k++) {
uvs[k] = uvr[j * 3 + k];
}
}
- if (read_normals) {
+ if (nr) {
for (int k = 0; k < 3; k++) {
normal[k] = nr[j * 3 + k];
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index b657833a3b..946f759610 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -950,13 +950,13 @@ void AnimationPlayer::_animation_process(float p_delta) {
play(queued.front()->get());
String new_name = playback.assigned;
queued.pop_front();
- if (end_notify)
+ if (end_notify || playback.seeked)
emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name);
} else {
//stop();
playing = false;
_set_process(false);
- if (end_notify)
+ if (end_notify || playback.seeked)
emit_signal(SceneStringNames::get_singleton()->animation_finished, playback.assigned);
}
end_reached = false;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 50f3bf834f..4c02a15531 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2693,9 +2693,9 @@ void Node::queue_delete() {
}
}
-Array Node::_get_children() const {
+TypedArray<Node> Node::_get_children() const {
- Array arr;
+ TypedArray<Node> arr;
int cc = get_child_count();
arr.resize(cc);
for (int i = 0; i < cc; i++)
diff --git a/scene/main/node.h b/scene/main/node.h
index 5de07d506e..1c1b7bbd7a 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -37,6 +37,7 @@
#include "core/object.h"
#include "core/project_settings.h"
#include "core/script_language.h"
+#include "core/typed_array.h"
#include "scene/main/scene_tree.h"
class Viewport;
@@ -182,7 +183,7 @@ private:
void _duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p_reown_map) const;
Node *_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap = nullptr) const;
- Array _get_children() const;
+ TypedArray<Node> _get_children() const;
Array _get_groups() const;
Variant _rpc_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 0418b20e9c..f30a899d69 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1422,7 +1422,7 @@ SceneTree::SceneTree() {
current_scene = nullptr;
int msaa_mode = GLOBAL_DEF("rendering/quality/screen_filters/msaa", 0);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/screen_filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/screen_filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x,AndroidVR 2x,AndroidVR 4x"));
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/screen_filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/screen_filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x"));
root->set_msaa(Viewport::MSAA(msaa_mode));
int ssaa_mode = GLOBAL_DEF("rendering/quality/screen_filters/screen_space_aa", 0);
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
new file mode 100644
index 0000000000..13582cf655
--- /dev/null
+++ b/scene/main/shader_globals_override.cpp
@@ -0,0 +1,257 @@
+#include "shader_globals_override.h"
+
+#include "core/core_string_names.h"
+#include "scene/main/window.h"
+#include "scene/scene_string_names.h"
+
+StringName *ShaderGlobalsOverride::_remap(const StringName &p_name) const {
+
+ StringName *r = param_remaps.getptr(p_name);
+ if (!r) {
+ //not cached, do caching
+ String p = p_name;
+ if (p.begins_with("params/")) {
+ String q = p.replace_first("params/", "");
+ param_remaps[p] = q;
+ r = param_remaps.getptr(q);
+ }
+ }
+
+ return r;
+}
+bool ShaderGlobalsOverride::_set(const StringName &p_name, const Variant &p_value) {
+
+ StringName *r = _remap(p_name);
+
+ if (r) {
+ Override *o = overrides.getptr(*r);
+ if (!o) {
+ Override ov;
+ ov.in_use = false;
+ overrides[*r] = ov;
+ o = overrides.getptr(*r);
+ }
+ if (o) {
+ o->override = p_value;
+ if (active) {
+ RS::get_singleton()->global_variable_set_override(*r, p_value);
+ }
+ o->in_use = p_value.get_type() != Variant::NIL;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool ShaderGlobalsOverride::_get(const StringName &p_name, Variant &r_ret) const {
+
+ StringName *r = _remap(p_name);
+
+ if (r) {
+ const Override *o = overrides.getptr(*r);
+ if (o) {
+ r_ret = o->override;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void ShaderGlobalsOverride::_get_property_list(List<PropertyInfo> *p_list) const {
+
+ Vector<StringName> variables;
+ variables = RS::get_singleton()->global_variable_get_list();
+ for (int i = 0; i < variables.size(); i++) {
+ PropertyInfo pinfo;
+ pinfo.name = "params/" + variables[i];
+ pinfo.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
+
+ switch (RS::get_singleton()->global_variable_get_type(variables[i])) {
+ case RS::GLOBAL_VAR_TYPE_BOOL: {
+ pinfo.type = Variant::BOOL;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_BVEC2: {
+ pinfo.type = Variant::INT;
+ pinfo.hint = PROPERTY_HINT_FLAGS;
+ pinfo.hint_string = "x,y";
+ } break;
+ case RS::GLOBAL_VAR_TYPE_BVEC3: {
+ pinfo.type = Variant::INT;
+ pinfo.hint = PROPERTY_HINT_FLAGS;
+ pinfo.hint_string = "x,y,z";
+ } break;
+ case RS::GLOBAL_VAR_TYPE_BVEC4: {
+ pinfo.type = Variant::INT;
+ pinfo.hint = PROPERTY_HINT_FLAGS;
+ pinfo.hint_string = "x,y,z,w";
+ } break;
+ case RS::GLOBAL_VAR_TYPE_INT: {
+ pinfo.type = Variant::INT;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_IVEC2: {
+ pinfo.type = Variant::VECTOR2I;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_IVEC3: {
+ pinfo.type = Variant::VECTOR3I;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_IVEC4: {
+ pinfo.type = Variant::PACKED_INT32_ARRAY;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_RECT2I: {
+ pinfo.type = Variant::RECT2I;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_UINT: {
+ pinfo.type = Variant::INT;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_UVEC2: {
+ pinfo.type = Variant::VECTOR2I;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_UVEC3: {
+ pinfo.type = Variant::VECTOR3I;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_UVEC4: {
+ pinfo.type = Variant::PACKED_INT32_ARRAY;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_FLOAT: {
+ pinfo.type = Variant::FLOAT;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_VEC2: {
+ pinfo.type = Variant::VECTOR2;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_VEC3: {
+ pinfo.type = Variant::VECTOR3;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_VEC4: {
+ pinfo.type = Variant::PLANE;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_RECT2: {
+ pinfo.type = Variant::RECT2;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_COLOR: {
+ pinfo.type = Variant::COLOR;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_MAT2: {
+ pinfo.type = Variant::PACKED_INT32_ARRAY;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_MAT3: {
+ pinfo.type = Variant::BASIS;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_TRANSFORM_2D: {
+ pinfo.type = Variant::TRANSFORM2D;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_TRANSFORM: {
+ pinfo.type = Variant::TRANSFORM;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_MAT4: {
+ pinfo.type = Variant::PACKED_INT32_ARRAY;
+ } break;
+ case RS::GLOBAL_VAR_TYPE_SAMPLER2D: {
+ pinfo.type = Variant::OBJECT;
+ pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ pinfo.hint_string = "Texture2D";
+ } break;
+ case RS::GLOBAL_VAR_TYPE_SAMPLER2DARRAY: {
+ pinfo.type = Variant::OBJECT;
+ pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ pinfo.hint_string = "Texture2DArray";
+ } break;
+ case RS::GLOBAL_VAR_TYPE_SAMPLER3D: {
+ pinfo.type = Variant::OBJECT;
+ pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ pinfo.hint_string = "Texture3D";
+ } break;
+ case RS::GLOBAL_VAR_TYPE_SAMPLERCUBE: {
+ pinfo.type = Variant::OBJECT;
+ pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ pinfo.hint_string = "Cubemap";
+ } break;
+ default: {
+
+ } break;
+ }
+
+ if (!overrides.has(variables[i])) {
+ Override o;
+ o.in_use = false;
+ Callable::CallError ce;
+ o.override = Variant::construct(pinfo.type, NULL, 0, ce);
+ overrides[variables[i]] = o;
+ }
+
+ Override *o = overrides.getptr(variables[i]);
+ if (o->in_use && o->override.get_type() != Variant::NIL) {
+ pinfo.usage |= PROPERTY_USAGE_CHECKED;
+ pinfo.usage |= PROPERTY_USAGE_STORAGE;
+ }
+
+ p_list->push_back(pinfo);
+ }
+}
+
+void ShaderGlobalsOverride::_activate() {
+
+ List<Node *> nodes;
+ get_tree()->get_nodes_in_group(SceneStringNames::get_singleton()->shader_overrides_group_active, &nodes);
+ if (nodes.size() == 0) {
+ //good we are the only override, enable all
+ active = true;
+ add_to_group(SceneStringNames::get_singleton()->shader_overrides_group_active);
+
+ const StringName *K = nullptr;
+ while ((K = overrides.next(K))) {
+ Override *o = overrides.getptr(*K);
+ if (o->in_use && o->override.get_type() != Variant::NIL) {
+ RS::get_singleton()->global_variable_set_override(*K, o->override);
+ }
+ }
+
+ update_configuration_warning(); //may have activated
+ }
+}
+
+void ShaderGlobalsOverride::_notification(int p_what) {
+
+ if (p_what == Node3D::NOTIFICATION_ENTER_TREE) {
+
+ add_to_group(SceneStringNames::get_singleton()->shader_overrides_group);
+ _activate();
+
+ } else if (p_what == Node3D::NOTIFICATION_EXIT_TREE) {
+
+ if (active) {
+ //remove overrides
+ const StringName *K = nullptr;
+ while ((K = overrides.next(K))) {
+ Override *o = overrides.getptr(*K);
+ if (o->in_use) {
+ RS::get_singleton()->global_variable_set_override(*K, Variant());
+ }
+ }
+ }
+
+ remove_from_group(SceneStringNames::get_singleton()->shader_overrides_group_active);
+ remove_from_group(SceneStringNames::get_singleton()->shader_overrides_group);
+ get_tree()->call_group(SceneStringNames::get_singleton()->shader_overrides_group, "_activate"); //another may want to activate when this is removed
+ active = false;
+ }
+}
+
+String ShaderGlobalsOverride::get_configuration_warning() const {
+
+ if (!active) {
+ return TTR("ShaderGlobalsOverride is not active because another node of the same type is in the scene.");
+ }
+
+ return String();
+}
+
+void ShaderGlobalsOverride::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_activate"), &ShaderGlobalsOverride::_activate);
+}
+
+ShaderGlobalsOverride::ShaderGlobalsOverride() {
+ active = false;
+}
diff --git a/scene/main/shader_globals_override.h b/scene/main/shader_globals_override.h
new file mode 100644
index 0000000000..33d0dc948f
--- /dev/null
+++ b/scene/main/shader_globals_override.h
@@ -0,0 +1,37 @@
+#ifndef SHADER_GLOBALS_OVERRIDE_H
+#define SHADER_GLOBALS_OVERRIDE_H
+
+#include "scene/3d/node_3d.h"
+
+class ShaderGlobalsOverride : public Node {
+
+ GDCLASS(ShaderGlobalsOverride, Node);
+
+ struct Override {
+ bool in_use = false;
+ Variant override;
+ };
+
+ StringName *_remap(const StringName &p_name) const;
+
+ bool active;
+ mutable HashMap<StringName, Override> overrides;
+ mutable HashMap<StringName, StringName> param_remaps;
+
+ void _activate();
+
+protected:
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+ void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ String get_configuration_warning() const;
+
+ ShaderGlobalsOverride();
+};
+
+#endif // SHADER_GLOBALS_OVERRIDE_H
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 72b1a877c1..51dd22db81 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -3495,6 +3495,17 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1024);
BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_MAX);
+ BIND_ENUM_CONSTANT(MSAA_DISABLED);
+ BIND_ENUM_CONSTANT(MSAA_2X);
+ BIND_ENUM_CONSTANT(MSAA_4X);
+ BIND_ENUM_CONSTANT(MSAA_8X);
+ BIND_ENUM_CONSTANT(MSAA_16X);
+ BIND_ENUM_CONSTANT(MSAA_MAX);
+
+ BIND_ENUM_CONSTANT(SCREEN_SPACE_AA_DISABLED);
+ BIND_ENUM_CONSTANT(SCREEN_SPACE_AA_FXAA);
+ BIND_ENUM_CONSTANT(SCREEN_SPACE_AA_MAX);
+
BIND_ENUM_CONSTANT(RENDER_INFO_OBJECTS_IN_FRAME);
BIND_ENUM_CONSTANT(RENDER_INFO_VERTICES_IN_FRAME);
BIND_ENUM_CONSTANT(RENDER_INFO_MATERIAL_CHANGES_IN_FRAME);
@@ -3505,9 +3516,10 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(DEBUG_DRAW_DISABLED);
BIND_ENUM_CONSTANT(DEBUG_DRAW_UNSHADED);
+ BIND_ENUM_CONSTANT(DEBUG_DRAW_LIGHTING);
BIND_ENUM_CONSTANT(DEBUG_DRAW_OVERDRAW);
BIND_ENUM_CONSTANT(DEBUG_DRAW_WIREFRAME);
-
+ BIND_ENUM_CONSTANT(DEBUG_DRAW_NORMAL_BUFFER);
BIND_ENUM_CONSTANT(DEBUG_DRAW_GI_PROBE_ALBEDO);
BIND_ENUM_CONSTANT(DEBUG_DRAW_GI_PROBE_LIGHTING);
BIND_ENUM_CONSTANT(DEBUG_DRAW_GI_PROBE_EMISSION);
@@ -3519,18 +3531,12 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(DEBUG_DRAW_PSSM_SPLITS);
BIND_ENUM_CONSTANT(DEBUG_DRAW_DECAL_ATLAS);
- BIND_ENUM_CONSTANT(MSAA_DISABLED);
- BIND_ENUM_CONSTANT(MSAA_2X);
- BIND_ENUM_CONSTANT(MSAA_4X);
- BIND_ENUM_CONSTANT(MSAA_8X);
- BIND_ENUM_CONSTANT(MSAA_16X);
-
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST);
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR);
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS);
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
-
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX);
+
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR);
@@ -3746,15 +3752,15 @@ void SubViewport::_bind_methods() {
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");
+ BIND_ENUM_CONSTANT(CLEAR_MODE_ALWAYS);
+ BIND_ENUM_CONSTANT(CLEAR_MODE_NEVER);
+ BIND_ENUM_CONSTANT(CLEAR_MODE_ONLY_NEXT_FRAME);
+
BIND_ENUM_CONSTANT(UPDATE_DISABLED);
BIND_ENUM_CONSTANT(UPDATE_ONCE);
BIND_ENUM_CONSTANT(UPDATE_WHEN_VISIBLE);
BIND_ENUM_CONSTANT(UPDATE_WHEN_PARENT_VISIBLE);
BIND_ENUM_CONSTANT(UPDATE_ALWAYS);
-
- BIND_ENUM_CONSTANT(CLEAR_MODE_ALWAYS);
- BIND_ENUM_CONSTANT(CLEAR_MODE_NEVER);
- BIND_ENUM_CONSTANT(CLEAR_MODE_ONLY_NEXT_FRAME);
}
SubViewport::SubViewport() {
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 0cbc957307..7e2df9fe42 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -116,7 +116,6 @@ public:
};
enum RenderInfo {
-
RENDER_INFO_OBJECTS_IN_FRAME,
RENDER_INFO_VERTICES_IN_FRAME,
RENDER_INFO_MATERIAL_CHANGES_IN_FRAME,
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index ff49dbdc8f..dc3ef5b508 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -177,6 +177,8 @@
#include "scene/3d/node_3d.h"
#include "scene/3d/skeleton_3d.h"
+#include "scene/main/shader_globals_override.h"
+
#ifndef _3D_DISABLED
#include "scene/3d/area_3d.h"
#include "scene/3d/audio_stream_player_3d.h"
@@ -403,6 +405,8 @@ void register_scene_types() {
ClassDB::register_class<AnimationNodeTimeSeek>();
ClassDB::register_class<AnimationNodeTransition>();
+ ClassDB::register_class<ShaderGlobalsOverride>(); //can be used in any shader
+
OS::get_singleton()->yield(); //may take time to init
#ifndef _3D_DISABLED
@@ -753,8 +757,16 @@ void register_scene_types() {
ClassDB::add_compatibility_class("AnimationTreePlayer", "AnimationTree");
// Renamed in 4.0.
+ // Keep alphabetical ordering to easily locate classes and avoid duplicates.
ClassDB::add_compatibility_class("AnimatedSprite", "AnimatedSprite2D");
ClassDB::add_compatibility_class("Area", "Area3D");
+ ClassDB::add_compatibility_class("ARVRCamera", "XRCamera3D");
+ ClassDB::add_compatibility_class("ARVRController", "XRController3D");
+ ClassDB::add_compatibility_class("ARVRAnchor", "XRAnchor3D");
+ ClassDB::add_compatibility_class("ARVRInterface", "XRInterface");
+ ClassDB::add_compatibility_class("ARVROrigin", "XROrigin3D");
+ ClassDB::add_compatibility_class("ARVRPositionalTracker", "XRPositionalTracker");
+ ClassDB::add_compatibility_class("ARVRServer", "XRServer");
ClassDB::add_compatibility_class("BoneAttachment", "BoneAttachment3D");
ClassDB::add_compatibility_class("BoxShape", "BoxShape3D");
ClassDB::add_compatibility_class("BulletPhysicsDirectBodyState", "BulletPhysicsDirectBodyState3D");
@@ -802,6 +814,7 @@ void register_scene_types() {
ClassDB::add_compatibility_class("Navigation2DServer", "NavigationServer2D");
ClassDB::add_compatibility_class("NavigationServer", "NavigationServer3D");
ClassDB::add_compatibility_class("OmniLight", "OmniLight3D");
+ ClassDB::add_compatibility_class("PanoramaSky", "Sky");
ClassDB::add_compatibility_class("Particles", "GPUParticles3D");
ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D");
ClassDB::add_compatibility_class("Path", "Path3D");
@@ -823,6 +836,7 @@ void register_scene_types() {
ClassDB::add_compatibility_class("PhysicsShapeQueryResult", "PhysicsShapeQueryResult3D");
ClassDB::add_compatibility_class("PinJoint", "PinJoint3D");
ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape3D");
+ ClassDB::add_compatibility_class("ProceduralSky", "Sky");
ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D");
ClassDB::add_compatibility_class("RayCast", "RayCast3D");
ClassDB::add_compatibility_class("RayShape", "RayShape3D");
@@ -853,12 +867,6 @@ void register_scene_types() {
ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp");
ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform");
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/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index a613b01376..eea4d12d0e 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -1064,7 +1064,7 @@ void DynamicFont::update_oversampling() {
/////////////////////////
-RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
+RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
if (r_error)
*r_error = ERR_FILE_CANT_OPEN;
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 9e628fc35a..ef4b9dd9d0 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -302,7 +302,7 @@ VARIANT_ENUM_CAST(DynamicFont::SpacingType);
class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 192eefbf6a..267816f267 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -646,7 +646,7 @@ BitmapFont::~BitmapFont() {
////////////
-RES ResourceFormatLoaderBMFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
+RES ResourceFormatLoaderBMFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
if (r_error)
*r_error = ERR_FILE_CANT_OPEN;
diff --git a/scene/resources/font.h b/scene/resources/font.h
index ce75f27e2a..c233344529 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -200,7 +200,7 @@ public:
class ResourceFormatLoaderBMFont : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 5068bb548f..41146036f6 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -120,18 +120,23 @@ Error ResourceLoaderText::_parse_sub_resource(VariantParser::Stream *p_stream, R
int index = token.value;
- String path = local_path + "::" + itos(index);
+ if (use_nocache) {
+ r_res = int_resources[index];
+ } else {
- if (!ignore_resource_parsing) {
+ String path = local_path + "::" + itos(index);
- if (!ResourceCache::has(path)) {
- r_err_str = "Can't load cached sub-resource: " + path;
- return ERR_PARSE_ERROR;
- }
+ if (!ignore_resource_parsing) {
- r_res = RES(ResourceCache::get(path));
- } else {
- r_res = RES();
+ if (!ResourceCache::has(path)) {
+ r_err_str = "Can't load cached sub-resource: " + path;
+ return ERR_PARSE_ERROR;
+ }
+
+ r_res = RES(ResourceCache::get(path));
+ } else {
+ r_res = RES();
+ }
}
VariantParser::get_token(p_stream, token, line, r_err_str);
@@ -535,7 +540,7 @@ Error ResourceLoaderText::load() {
Ref<Resource> res;
- if (!ResourceCache::has(path)) { //only if it doesn't exist
+ if (use_nocache || !ResourceCache::has(path)) { //only if it doesn't exist
Object *obj = ClassDB::instance(type);
if (!obj) {
@@ -556,8 +561,10 @@ Error ResourceLoaderText::load() {
}
res = Ref<Resource>(r);
- resource_cache.push_back(res);
- res->set_path(path);
+ int_resources[id] = res;
+ if (!use_nocache) {
+ res->set_path(path);
+ }
}
resource_current++;
@@ -643,10 +650,12 @@ Error ResourceLoaderText::load() {
_printerr();
} else {
error = OK;
- if (!ResourceCache::has(res_path)) {
- resource->set_path(res_path);
+ if (!use_nocache) {
+ if (!ResourceCache::has(res_path)) {
+ resource->set_path(res_path);
+ }
+ resource->set_as_translation_remapped(translation_remapped);
}
- resource->set_as_translation_remapped(translation_remapped);
}
return error;
}
@@ -691,7 +700,7 @@ Error ResourceLoaderText::load() {
error = OK;
//get it here
resource = packed_scene;
- if (!ResourceCache::has(res_path)) {
+ if (!use_nocache && !ResourceCache::has(res_path)) {
packed_scene->set_path(res_path);
}
@@ -725,6 +734,9 @@ void ResourceLoaderText::set_translation_remapped(bool p_remapped) {
}
ResourceLoaderText::ResourceLoaderText() {
+
+ use_nocache = false;
+
resources_total = 0;
resource_current = 0;
use_sub_threads = false;
@@ -1285,7 +1297,7 @@ String ResourceLoaderText::recognize(FileAccess *p_f) {
/////////////////////
-RES ResourceFormatLoaderText::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
+RES ResourceFormatLoaderText::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
if (r_error)
*r_error = ERR_CANT_OPEN;
@@ -1298,6 +1310,7 @@ RES ResourceFormatLoaderText::load(const String &p_path, const String &p_origina
ResourceLoaderText loader;
String path = p_original_path != "" ? p_original_path : p_path;
+ loader.use_nocache = p_no_cache;
loader.use_sub_threads = p_use_sub_threads;
loader.local_path = ProjectSettings::get_singleton()->localize_path(path);
loader.progress = r_progress;
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index fbbd2e3346..b9a6db5f36 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -62,6 +62,7 @@ class ResourceLoaderText {
//Map<String,String> remaps;
Map<int, ExtResource> ext_resources;
+ Map<int, RES> int_resources;
int resources_total;
int resource_current;
@@ -69,6 +70,8 @@ class ResourceLoaderText {
VariantParser::Tag next_tag;
+ bool use_nocache;
+
bool use_sub_threads;
float *progress;
@@ -106,7 +109,6 @@ class ResourceLoaderText {
friend class ResourceFormatLoaderText;
- List<RES> resource_cache;
Error error;
RES resource;
@@ -134,7 +136,7 @@ public:
class ResourceFormatLoaderText : public ResourceFormatLoader {
public:
static ResourceFormatLoaderText *singleton;
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false);
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index a62e7ded16..1ac2f7c3c9 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -176,7 +176,7 @@ Shader::~Shader() {
}
////////////
-RES ResourceFormatLoaderShader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
+RES ResourceFormatLoaderShader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
if (r_error)
*r_error = ERR_FILE_CANT_OPEN;
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index cf0cec362c..75c38bd561 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -102,7 +102,7 @@ VARIANT_ENUM_CAST(Shader::Mode);
class ResourceFormatLoaderShader : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp
index 37b88cccea..a0b6ab1e30 100644
--- a/scene/resources/sky_material.cpp
+++ b/scene/resources/sky_material.cpp
@@ -111,16 +111,6 @@ float ProceduralSkyMaterial::get_ground_energy() const {
return ground_energy;
}
-void ProceduralSkyMaterial::set_sun_angle_min(float p_angle) {
-
- sun_angle_min = p_angle;
- RS::get_singleton()->material_set_param(_get_material(), "sun_angle_min", Math::deg2rad(sun_angle_min));
-}
-float ProceduralSkyMaterial::get_sun_angle_min() const {
-
- return sun_angle_min;
-}
-
void ProceduralSkyMaterial::set_sun_angle_max(float p_angle) {
sun_angle_max = p_angle;
@@ -181,9 +171,6 @@ void ProceduralSkyMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_ground_energy", "energy"), &ProceduralSkyMaterial::set_ground_energy);
ClassDB::bind_method(D_METHOD("get_ground_energy"), &ProceduralSkyMaterial::get_ground_energy);
- ClassDB::bind_method(D_METHOD("set_sun_angle_min", "degrees"), &ProceduralSkyMaterial::set_sun_angle_min);
- ClassDB::bind_method(D_METHOD("get_sun_angle_min"), &ProceduralSkyMaterial::get_sun_angle_min);
-
ClassDB::bind_method(D_METHOD("set_sun_angle_max", "degrees"), &ProceduralSkyMaterial::set_sun_angle_max);
ClassDB::bind_method(D_METHOD("get_sun_angle_max"), &ProceduralSkyMaterial::get_sun_angle_max);
@@ -203,7 +190,6 @@ void ProceduralSkyMaterial::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ground_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_ground_energy", "get_ground_energy");
ADD_GROUP("Sun", "sun_");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_angle_min", PROPERTY_HINT_RANGE, "0,360,0.01"), "set_sun_angle_min", "get_sun_angle_min");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_angle_max", PROPERTY_HINT_RANGE, "0,360,0.01"), "set_sun_angle_max", "get_sun_angle_max");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_curve", PROPERTY_HINT_EXP_EASING), "set_sun_curve", "get_sun_curve");
}
@@ -220,8 +206,7 @@ ProceduralSkyMaterial::ProceduralSkyMaterial() {
code += "uniform vec4 ground_horizon_color : hint_color = vec4(0.37, 0.33, 0.31, 1.0);\n";
code += "uniform float ground_curve : hint_range(0, 1) = 0.02;\n";
code += "uniform float ground_energy = 1.0;\n\n";
- code += "uniform float sun_angle_min = 0.01;\n";
- code += "uniform float sun_angle_max = 1.0;\n";
+ code += "uniform float sun_angle_max = 1.74;\n";
code += "uniform float sun_curve : hint_range(0, 1) = 0.05;\n\n";
code += "const float PI = 3.1415926535897932384626433833;\n\n";
code += "void fragment() {\n";
@@ -231,37 +216,37 @@ ProceduralSkyMaterial::ProceduralSkyMaterial() {
code += "\tsky *= sky_energy;\n";
code += "\tif (LIGHT0_ENABLED) {\n";
code += "\t\tfloat sun_angle = acos(dot(LIGHT0_DIRECTION, EYEDIR));\n";
- code += "\t\tif (sun_angle < sun_angle_min) {\n";
+ code += "\t\tif (sun_angle < LIGHT0_SIZE) {\n";
code += "\t\t\tsky = LIGHT0_COLOR * LIGHT0_ENERGY;\n";
code += "\t\t} else if (sun_angle < sun_angle_max) {\n";
- code += "\t\t\tfloat c2 = (sun_angle - sun_angle_min) / (sun_angle_max - sun_angle_min);\n";
+ code += "\t\t\tfloat c2 = (sun_angle - LIGHT0_SIZE) / (sun_angle_max - LIGHT0_SIZE);\n";
code += "\t\t\tsky = mix(LIGHT0_COLOR * LIGHT0_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));\n";
code += "\t\t}\n";
code += "\t}\n";
code += "\tif (LIGHT1_ENABLED) {\n";
code += "\t\tfloat sun_angle = acos(dot(LIGHT1_DIRECTION, EYEDIR));\n";
- code += "\t\tif (sun_angle < sun_angle_min) {\n";
+ code += "\t\tif (sun_angle < LIGHT1_SIZE) {\n";
code += "\t\t\tsky = LIGHT1_COLOR * LIGHT1_ENERGY;\n";
code += "\t\t} else if (sun_angle < sun_angle_max) {\n";
- code += "\t\t\tfloat c2 = (sun_angle - sun_angle_min) / (sun_angle_max - sun_angle_min);\n";
+ code += "\t\t\tfloat c2 = (sun_angle - LIGHT1_SIZE) / (sun_angle_max - LIGHT1_SIZE);\n";
code += "\t\t\tsky = mix(LIGHT1_COLOR * LIGHT1_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));\n";
code += "\t\t}\n";
code += "\t}\n";
code += "\tif (LIGHT2_ENABLED) {\n";
code += "\t\tfloat sun_angle = acos(dot(LIGHT2_DIRECTION, EYEDIR));\n";
- code += "\t\tif (sun_angle < sun_angle_min) {\n";
+ code += "\t\tif (sun_angle < LIGHT2_SIZE) {\n";
code += "\t\t\tsky = LIGHT2_COLOR * LIGHT2_ENERGY;\n";
code += "\t\t} else if (sun_angle < sun_angle_max) {\n";
- code += "\t\t\tfloat c2 = (sun_angle - sun_angle_min) / (sun_angle_max - sun_angle_min);\n";
+ code += "\t\t\tfloat c2 = (sun_angle - LIGHT2_SIZE) / (sun_angle_max - LIGHT2_SIZE);\n";
code += "\t\t\tsky = mix(LIGHT2_COLOR * LIGHT2_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));\n";
code += "\t\t}\n";
code += "\t}\n";
code += "\tif (LIGHT3_ENABLED) {\n";
code += "\t\tfloat sun_angle = acos(dot(LIGHT3_DIRECTION, EYEDIR));\n";
- code += "\t\tif (sun_angle < sun_angle_min) {\n";
+ code += "\t\tif (sun_angle < LIGHT3_SIZE) {\n";
code += "\t\t\tsky = LIGHT3_COLOR * LIGHT3_ENERGY;\n";
code += "\t\t} else if (sun_angle < sun_angle_max) {\n";
- code += "\t\t\tfloat c2 = (sun_angle - sun_angle_min) / (sun_angle_max - sun_angle_min);\n";
+ code += "\t\t\tfloat c2 = (sun_angle - LIGHT3_SIZE) / (sun_angle_max - LIGHT3_SIZE);\n";
code += "\t\t\tsky = mix(LIGHT3_COLOR * LIGHT3_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));\n";
code += "\t\t}\n";
code += "\t}\n";
@@ -287,7 +272,6 @@ ProceduralSkyMaterial::ProceduralSkyMaterial() {
set_ground_curve(0.02);
set_ground_energy(1.0);
- set_sun_angle_min(1.0);
set_sun_angle_max(100.0);
set_sun_curve(0.05);
}
@@ -535,7 +519,6 @@ PhysicalSkyMaterial::PhysicalSkyMaterial() {
code += "const vec3 UP = vec3( 0.0, 1.0, 0.0 );\n\n";
code += "// Sun constants\n";
- code += "const float SOL_SIZE = 0.00872663806;\n";
code += "const float SUN_ENERGY = 1000.0;\n\n";
code += "// optical length at zenith for molecules\n";
@@ -591,8 +574,8 @@ PhysicalSkyMaterial::PhysicalSkyMaterial() {
code += "\tLin *= mix(ground_color.rgb, vec3(1.0), smoothstep(-0.1, 0.1, dot(UP, EYEDIR)));\n\n";
code += "\t// Solar disk and out-scattering\n";
- code += "\tfloat sunAngularDiameterCos = cos(SOL_SIZE * sun_disk_scale);\n";
- code += "\tfloat sunAngularDiameterCos2 = cos(SOL_SIZE * sun_disk_scale*0.5);\n";
+ code += "\tfloat sunAngularDiameterCos = cos(LIGHT0_SIZE * sun_disk_scale);\n";
+ code += "\tfloat sunAngularDiameterCos2 = cos(LIGHT0_SIZE * sun_disk_scale*0.5);\n";
code += "\tfloat sundisk = smoothstep(sunAngularDiameterCos, sunAngularDiameterCos2, cos_theta);\n";
code += "\tvec3 L0 = (sun_energy * 1900.0 * extinction) * sundisk * LIGHT0_COLOR;\n";
code += "\t// Note: Add nightime here: L0 += night_sky * extinction\n\n";
diff --git a/scene/resources/sky_material.h b/scene/resources/sky_material.h
index 515706b0c5..9bd9d7ec8b 100644
--- a/scene/resources/sky_material.h
+++ b/scene/resources/sky_material.h
@@ -49,7 +49,6 @@ private:
float ground_curve;
float ground_energy;
- float sun_angle_min;
float sun_angle_max;
float sun_curve;
@@ -84,9 +83,6 @@ public:
void set_ground_energy(float p_energy);
float get_ground_energy() const;
- void set_sun_angle_min(float p_angle);
- float get_sun_angle_min() const;
-
void set_sun_angle_max(float p_angle);
float get_sun_angle_max() const;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 749dff24f2..f431a2ad48 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -796,7 +796,7 @@ StreamTexture::~StreamTexture() {
}
}
-RES ResourceFormatLoaderStreamTexture::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
+RES ResourceFormatLoaderStreamTexture::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
Ref<StreamTexture> st;
st.instance();
@@ -2024,7 +2024,7 @@ TextureLayered::~TextureLayered() {
}
}
-RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
+RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
if (r_error) {
*r_error = ERR_CANT_OPEN;
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 18f70baa07..f4f00c2ca0 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -213,7 +213,7 @@ public:
class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
@@ -421,7 +421,7 @@ public:
COMPRESSION_UNCOMPRESSED
};
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index ad996e7d50..5e3f8b803b 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -202,4 +202,7 @@ SceneStringNames::SceneStringNames() {
parameters_base_path = "parameters/";
tracks_changed = "tracks_changed";
+
+ shader_overrides_group = StaticCString::create("_shader_overrides_group_");
+ shader_overrides_group_active = StaticCString::create("_shader_overrides_group_active_");
}
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 58e8c28454..c5de10a6f6 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -207,6 +207,8 @@ public:
StringName window_input;
StringName theme_changed;
+ StringName shader_overrides_group;
+ StringName shader_overrides_group_active;
enum {
MAX_MATERIALS = 32