summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/cpu_particles_2d.cpp6
-rw-r--r--scene/2d/navigation_agent_2d.cpp9
-rw-r--r--scene/2d/physics_body_2d.cpp3
-rw-r--r--scene/2d/tile_map.cpp3
-rw-r--r--scene/3d/audio_stream_player_3d.cpp3
-rw-r--r--scene/3d/cpu_particles_3d.cpp6
-rw-r--r--scene/3d/gpu_particles_3d.cpp3
-rw-r--r--scene/3d/light_3d.cpp12
-rw-r--r--scene/3d/navigation_agent_3d.cpp9
-rw-r--r--scene/3d/physics_body_3d.cpp3
-rw-r--r--scene/3d/voxelizer.cpp45
-rw-r--r--scene/animation/animation_player.cpp11
-rw-r--r--scene/animation/tween.cpp59
-rw-r--r--scene/gui/file_dialog.cpp3
-rw-r--r--scene/gui/line_edit.cpp15
-rw-r--r--scene/gui/rich_text_label.cpp28
-rw-r--r--scene/gui/slider.cpp6
-rw-r--r--scene/gui/subviewport_container.cpp2
-rw-r--r--scene/gui/subviewport_container.h2
-rw-r--r--scene/gui/tabs.cpp6
-rw-r--r--scene/gui/text_edit.cpp3
-rw-r--r--scene/gui/tree.cpp18
-rw-r--r--scene/main/canvas_item.cpp63
-rw-r--r--scene/main/canvas_item.h6
-rw-r--r--scene/main/node.cpp24
-rw-r--r--scene/main/scene_tree.cpp6
-rw-r--r--scene/main/shader_globals_override.cpp30
-rw-r--r--scene/main/shader_globals_override.h30
-rw-r--r--scene/main/timer.cpp8
-rw-r--r--scene/resources/animation.cpp27
-rw-r--r--scene/resources/audio_stream_sample.cpp36
-rw-r--r--scene/resources/material.cpp107
-rw-r--r--scene/resources/particles_material.cpp9
-rw-r--r--scene/resources/texture.cpp6
-rw-r--r--scene/resources/tile_set.cpp3
-rw-r--r--scene/resources/visual_shader.cpp40
-rw-r--r--scene/resources/visual_shader_nodes.cpp154
37 files changed, 594 insertions, 210 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 0a6b091a51..c37cd398c4 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -961,7 +961,8 @@ void CPUParticles2D::_particles_process(float p_delta) {
//scale by scale
float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
- if (base_scale < 0.000001) base_scale = 0.000001;
+ if (base_scale < 0.000001)
+ base_scale = 0.000001;
p.transform.elements[0] *= base_scale;
p.transform.elements[1] *= base_scale;
@@ -1196,7 +1197,8 @@ void CPUParticles2D::convert_from_particles(Node *p_particles) {
set_param(m_param, material->get_param(ParticlesMaterial::m_param)); \
{ \
Ref<CurveTexture> ctex = material->get_param_texture(ParticlesMaterial::m_param); \
- if (ctex.is_valid()) set_param_curve(m_param, ctex->get_curve()); \
+ if (ctex.is_valid()) \
+ set_param_curve(m_param, ctex->get_curve()); \
} \
set_param_randomness(m_param, material->get_param_randomness(ParticlesMaterial::m_param));
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index 32da46e8a8..df23a40721 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -288,9 +288,12 @@ String NavigationAgent2D::get_configuration_warning() const {
void NavigationAgent2D::update_navigation() {
- if (agent_parent == nullptr) return;
- if (navigation == nullptr) return;
- if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return;
+ if (agent_parent == nullptr)
+ return;
+ if (navigation == nullptr)
+ return;
+ if (update_frame_id == Engine::get_singleton()->get_physics_frames())
+ return;
update_frame_id = Engine::get_singleton()->get_physics_frames();
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index de15f0efc2..4198eb6c06 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1394,7 +1394,8 @@ Vector2 KinematicCollision2D::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision2D::get_local_shape() const {
- if (!owner) return nullptr;
+ if (!owner)
+ return nullptr;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 86e61fe878..ac8136a79f 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1355,7 +1355,8 @@ bool TileMap::get_collision_use_parent() const {
void TileMap::set_collision_use_parent(bool p_use_parent) {
- if (use_parent == p_use_parent) return;
+ if (use_parent == p_use_parent)
+ return;
_clear_quadrants();
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 5701d3cea2..8a00d67e12 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -320,7 +320,8 @@ float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
case ATTENUATION_LOGARITHMIC: {
att = -20 * Math::log(p_distance / unit_size + CMP_EPSILON);
} break;
- case ATTENUATION_DISABLED: break;
+ case ATTENUATION_DISABLED:
+ break;
default: {
ERR_PRINT("Unknown attenuation type");
break;
diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp
index 4c25f55f0b..414dc6f97b 100644
--- a/scene/3d/cpu_particles_3d.cpp
+++ b/scene/3d/cpu_particles_3d.cpp
@@ -1004,7 +1004,8 @@ void CPUParticles3D::_particles_process(float p_delta) {
//scale by scale
float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
- if (base_scale < 0.000001) base_scale = 0.000001;
+ if (base_scale < 0.000001)
+ base_scale = 0.000001;
p.transform.basis.scale(Vector3(1, 1, 1) * base_scale);
@@ -1253,7 +1254,8 @@ void CPUParticles3D::convert_from_particles(Node *p_particles) {
set_param(m_param, material->get_param(ParticlesMaterial::m_param)); \
{ \
Ref<CurveTexture> ctex = material->get_param_texture(ParticlesMaterial::m_param); \
- if (ctex.is_valid()) set_param_curve(m_param, ctex->get_curve()); \
+ if (ctex.is_valid()) \
+ set_param_curve(m_param, ctex->get_curve()); \
} \
set_param_randomness(m_param, material->get_param_randomness(ParticlesMaterial::m_param));
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index 7744c477cb..01886a730f 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -257,7 +257,8 @@ String GPUParticles3D::get_configuration_warning() const {
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(draw_passes[i]->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
}
- if (anim_material_found) break;
+ if (anim_material_found)
+ break;
}
}
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index c048f60ebd..0aa0f7e5ac 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -326,9 +326,15 @@ Light3D::Light3D(RenderingServer::LightType p_type) {
type = p_type;
switch (p_type) {
- case RS::LIGHT_DIRECTIONAL: light = RenderingServer::get_singleton()->directional_light_create(); break;
- case RS::LIGHT_OMNI: light = RenderingServer::get_singleton()->omni_light_create(); break;
- case RS::LIGHT_SPOT: light = RenderingServer::get_singleton()->spot_light_create(); break;
+ case RS::LIGHT_DIRECTIONAL:
+ light = RenderingServer::get_singleton()->directional_light_create();
+ break;
+ case RS::LIGHT_OMNI:
+ light = RenderingServer::get_singleton()->omni_light_create();
+ break;
+ case RS::LIGHT_SPOT:
+ light = RenderingServer::get_singleton()->spot_light_create();
+ break;
default: {
};
}
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 0449ab15b7..e672ed9a54 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -306,9 +306,12 @@ String NavigationAgent3D::get_configuration_warning() const {
void NavigationAgent3D::update_navigation() {
- if (agent_parent == nullptr) return;
- if (navigation == nullptr) return;
- if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return;
+ if (agent_parent == nullptr)
+ return;
+ if (navigation == nullptr)
+ return;
+ if (update_frame_id == Engine::get_singleton()->get_physics_frames())
+ return;
update_frame_id = Engine::get_singleton()->get_physics_frames();
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 3991efc7c0..280bab5d45 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -1346,7 +1346,8 @@ Vector3 KinematicCollision3D::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision3D::get_local_shape() const {
- if (!owner) return nullptr;
+ if (!owner)
+ return nullptr;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp
index f30c58be55..a2d305f3cb 100644
--- a/scene/3d/voxelizer.cpp
+++ b/scene/3d/voxelizer.cpp
@@ -36,10 +36,14 @@
#define FINDMINMAX(x0, x1, x2, min, max) \
min = max = x0; \
- if (x1 < min) min = x1; \
- if (x1 > max) max = x1; \
- if (x2 < min) min = x2; \
- if (x2 > max) max = x2;
+ if (x1 < min) \
+ min = x1; \
+ if (x1 > max) \
+ max = x1; \
+ if (x2 < min) \
+ min = x2; \
+ if (x2 > max) \
+ max = x2;
static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
int q;
@@ -53,8 +57,10 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
vmax[q] = -maxbox[q];
}
}
- if (normal.dot(vmin) + d > 0.0f) return false;
- if (normal.dot(vmax) + d >= 0.0f) return true;
+ if (normal.dot(vmin) + d > 0.0f)
+ return false;
+ if (normal.dot(vmax) + d >= 0.0f)
+ return true;
return false;
}
@@ -71,7 +77,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
#define AXISTEST_X2(a, b, fa, fb) \
p0 = a * v0.y - b * v0.z; \
@@ -84,7 +91,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
/*======================== Y-tests ========================*/
#define AXISTEST_Y02(a, b, fa, fb) \
@@ -98,7 +106,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
#define AXISTEST_Y1(a, b, fa, fb) \
p0 = -a * v0.x + b * v0.z; \
@@ -111,7 +120,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
/*======================== Z-tests ========================*/
@@ -126,7 +136,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p2; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
#define AXISTEST_Z0(a, b, fa, fb) \
p0 = a * v0.x - b * v0.y; \
@@ -139,7 +150,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
static bool fast_tri_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalfsize, const Vector3 *triverts) {
@@ -197,15 +209,18 @@ static bool fast_tri_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalf
/* test in X-direction */
FINDMINMAX(v0.x, v1.x, v2.x, min, max);
- if (min > boxhalfsize.x || max < -boxhalfsize.x) return false;
+ if (min > boxhalfsize.x || max < -boxhalfsize.x)
+ return false;
/* test in Y-direction */
FINDMINMAX(v0.y, v1.y, v2.y, min, max);
- if (min > boxhalfsize.y || max < -boxhalfsize.y) return false;
+ if (min > boxhalfsize.y || max < -boxhalfsize.y)
+ return false;
/* test in Z-direction */
FINDMINMAX(v0.z, v1.z, v2.z, min, max);
- if (min > boxhalfsize.z || max < -boxhalfsize.z) return false;
+ if (min > boxhalfsize.z || max < -boxhalfsize.z)
+ return false;
/* Bullet 2: */
/* test if the box intersects the plane of the triangle */
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 8228cf67bd..7bac09f839 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1479,9 +1479,14 @@ void AnimationPlayer::_set_process(bool p_process, bool p_force) {
switch (animation_process_mode) {
- case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break;
- case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break;
- case ANIMATION_PROCESS_MANUAL: break;
+ case ANIMATION_PROCESS_PHYSICS:
+ set_physics_process_internal(p_process && active);
+ break;
+ case ANIMATION_PROCESS_IDLE:
+ set_process_internal(p_process && active);
+ break;
+ case ANIMATION_PROCESS_MANUAL:
+ break;
}
processing = p_process;
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index d0c6cac8cf..b826907a3a 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -353,7 +353,8 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const {
// If we're looking at an INT value, instead convert it to a FLOAT
// This is better for interpolation
- if (final_val.get_type() == Variant::INT) final_val = final_val.operator real_t();
+ if (final_val.get_type() == Variant::INT)
+ final_val = final_val.operator real_t();
return final_val;
}
@@ -395,7 +396,8 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) {
// If we're looking at an INT value, instead convert it to a FLOAT
// This is better for interpolation
- if (final_val.get_type() == Variant::INT) final_val = final_val.operator real_t();
+ if (final_val.get_type() == Variant::INT)
+ final_val = final_val.operator real_t();
// Calculate the delta based on the initial value and the final value
_calc_delta_val(p_data.initial_val, final_val, p_data.delta_val);
@@ -409,7 +411,8 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) {
// If we're looking at an INT value, instead convert it to a FLOAT
// This is better for interpolation
- if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t();
+ if (initial_val.get_type() == Variant::INT)
+ initial_val = initial_val.operator real_t();
// Calculate the delta based on the initial value and the final value
_calc_delta_val(initial_val, p_data.final_val, p_data.delta_val);
@@ -823,8 +826,12 @@ void Tween::set_active(bool p_active) {
// Depending on physics or idle, set processing
switch (tween_process_mode) {
- case TWEEN_PROCESS_IDLE: set_process_internal(p_active); break;
- case TWEEN_PROCESS_PHYSICS: set_physics_process_internal(p_active); break;
+ case TWEEN_PROCESS_IDLE:
+ set_process_internal(p_active);
+ break;
+ case TWEEN_PROCESS_PHYSICS:
+ set_physics_process_internal(p_active);
+ break;
}
}
@@ -1334,11 +1341,14 @@ void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant
// If no initial value given, grab the initial value from the object
// TODO: Is this documented? This is very useful and removes a lot of clutter from tweens!
- if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get_indexed(p_property.get_subnames());
+ if (p_initial_val.get_type() == Variant::NIL)
+ p_initial_val = p_object->get_indexed(p_property.get_subnames());
// Convert any integers into REALs as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Build the interpolation data
_build_interpolation(INTER_PROPERTY, p_object, &p_property, nullptr, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
@@ -1352,8 +1362,10 @@ void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_
}
// Convert any integers into REALs as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Build the interpolation data
_build_interpolation(INTER_METHOD, p_object, nullptr, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
@@ -1486,10 +1498,12 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
// If no initial value is given, grab it from the source object
// TODO: Is this documented? It's really helpful for decluttering tweens
- if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get_indexed(p_property.get_subnames());
+ if (p_initial_val.get_type() == Variant::NIL)
+ p_initial_val = p_object->get_indexed(p_property.get_subnames());
// Convert initial INT values to FLOAT as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
// Confirm the source and target objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1515,7 +1529,8 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
ERR_FAIL_COND(!target_prop_valid);
// Convert target INT to FLOAT since it is better for interpolation
- if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t();
+ if (target_val.get_type() == Variant::INT)
+ target_val = target_val.operator real_t();
// Verify that the target value and initial value are the same type
ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type());
@@ -1550,7 +1565,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi
return;
}
// Convert initial INT values to FLOAT as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
// Verify the source and target objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1576,7 +1592,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi
ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK);
// Convert target INT values to FLOAT as they are better for interpolation
- if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t();
+ if (target_val.get_type() == Variant::INT)
+ target_val = target_val.operator real_t();
ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type());
// Make the new InterpolateData for the method follow
@@ -1613,7 +1630,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_
p_initial_property = p_initial_property.get_as_property_path();
// Convert the initial INT values to FLOAT as they are better for Interpolation
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Verify both objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1639,7 +1657,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_
ERR_FAIL_COND(!initial_prop_valid);
// Convert the initial INT value to FLOAT as it is better for interpolation
- if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t();
+ if (initial_val.get_type() == Variant::INT)
+ initial_val = initial_val.operator real_t();
ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type());
// Build the InterpolateData object
@@ -1679,7 +1698,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in
}
// Convert final INT values to FLOAT as they are better for interpolation
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Make sure the given objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1705,7 +1725,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in
ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK);
// Convert initial INT values to FLOAT as they aer better for interpolation
- if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t();
+ if (initial_val.get_type() == Variant::INT)
+ initial_val = initial_val.operator real_t();
ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type());
// Build the new InterpolateData object
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 89d13ecd7f..a449d680a8 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -410,7 +410,8 @@ void FileDialog::_tree_item_activated() {
void FileDialog::update_file_name() {
int idx = filter->get_selected() - 1;
if ((idx == -1 && filter->get_item_count() == 2) || (filter->get_item_count() > 2 && idx >= 0 && idx < filter->get_item_count() - 2)) {
- if (idx == -1) idx += 1;
+ if (idx == -1)
+ idx += 1;
String filter_str = filters[idx];
String file_str = file->get_text();
String base_name = file_str.get_basename();
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index b9b7560f2e..8574b05016 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -463,14 +463,16 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case KEY_UP: {
shift_selection_check_pre(k->get_shift());
- if (get_cursor_position() == 0) handled = false;
+ if (get_cursor_position() == 0)
+ handled = false;
set_cursor_position(0);
shift_selection_check_post(k->get_shift());
} break;
case KEY_DOWN: {
shift_selection_check_pre(k->get_shift());
- if (get_cursor_position() == text.length()) handled = false;
+ if (get_cursor_position() == text.length())
+ handled = false;
set_cursor_position(text.length());
shift_selection_check_post(k->get_shift());
} break;
@@ -988,7 +990,8 @@ void LineEdit::paste_text() {
if (paste_buffer != "") {
int prev_len = text.length();
- if (selection.enabled) selection_delete();
+ if (selection.enabled)
+ selection_delete();
append_at_cursor(paste_buffer);
if (!text_changed_dirty) {
@@ -1204,7 +1207,8 @@ void LineEdit::_toggle_draw_caret() {
void LineEdit::delete_char() {
- if ((text.length() <= 0) || (cursor_pos == 0)) return;
+ if ((text.length() <= 0) || (cursor_pos == 0))
+ return;
Ref<Font> font = get_theme_font("font");
if (font != nullptr) {
@@ -1379,7 +1383,8 @@ int LineEdit::get_cursor_position() const {
void LineEdit::set_window_pos(int p_pos) {
window_pos = p_pos;
- if (window_pos < 0) window_pos = 0;
+ if (window_pos < 0)
+ window_pos = 0;
}
void LineEdit::append_at_cursor(String p_text) {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 84097eb6a1..a6c0c99bdb 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -230,10 +230,18 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
} else { \
int used = wofs - margin; \
switch (align) { \
- case ALIGN_LEFT: l.offset_caches.push_back(0); break; \
- case ALIGN_CENTER: l.offset_caches.push_back(((p_width - margin) - used) / 2); break; \
- case ALIGN_RIGHT: l.offset_caches.push_back(((p_width - margin) - used)); break; \
- case ALIGN_FILL: l.offset_caches.push_back(line_wrapped ? ((p_width - margin) - used) : 0); break; \
+ case ALIGN_LEFT: \
+ l.offset_caches.push_back(0); \
+ break; \
+ case ALIGN_CENTER: \
+ l.offset_caches.push_back(((p_width - margin) - used) / 2); \
+ break; \
+ case ALIGN_RIGHT: \
+ l.offset_caches.push_back(((p_width - margin) - used)); \
+ break; \
+ case ALIGN_FILL: \
+ l.offset_caches.push_back(line_wrapped ? ((p_width - margin) - used) : 0); \
+ break; \
} \
l.height_caches.push_back(line_height); \
l.ascent_caches.push_back(line_ascent); \
@@ -255,7 +263,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
line_descent = line < l.descent_caches.size() ? l.descent_caches[line] : 1; \
} \
if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh && p_click_pos.x < p_ofs.x + wofs) { \
- if (r_outside) *r_outside = true; \
+ if (r_outside) \
+ *r_outside = true; \
*r_click_item = it; \
*r_click_char = rchar; \
RETURN; \
@@ -275,7 +284,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
} \
const bool x_in_range = (p_click_pos.x > p_ofs.x + wofs) && (!p_frame->cell || p_click_pos.x < p_ofs.x + p_width); \
if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh && x_in_range) { \
- if (r_outside) *r_outside = true; \
+ if (r_outside) \
+ *r_outside = true; \
*r_click_item = it; \
*r_click_char = rchar; \
RETURN; \
@@ -286,7 +296,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
#define ADVANCE(m_width) \
{ \
if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh && p_click_pos.x >= p_ofs.x + wofs && p_click_pos.x < p_ofs.x + wofs + m_width) { \
- if (r_outside) *r_outside = false; \
+ if (r_outside) \
+ *r_outside = false; \
*r_click_item = it; \
*r_click_char = rchar; \
RETURN; \
@@ -855,7 +866,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh) {
//went to next line, but pointer was on the previous one
- if (r_outside) *r_outside = true;
+ if (r_outside)
+ *r_outside = true;
*r_click_item = itp;
*r_click_char = rchar;
RETURN;
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 1f135163d4..910d5f8230 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -182,7 +182,8 @@ void Slider::_notification(int p_what) {
if (ticks > 1) {
int grabber_offset = (grabber->get_size().height / 2 - tick->get_height() / 2);
for (int i = 0; i < ticks; i++) {
- if (!ticks_on_borders && (i == 0 || i + 1 == ticks)) continue;
+ if (!ticks_on_borders && (i == 0 || i + 1 == ticks))
+ continue;
int ofs = (i * areasize / (ticks - 1)) + grabber_offset;
tick->draw(ci, Point2i((size.width - widget_width) / 2, ofs));
}
@@ -199,7 +200,8 @@ void Slider::_notification(int p_what) {
if (ticks > 1) {
int grabber_offset = (grabber->get_size().width / 2 - tick->get_width() / 2);
for (int i = 0; i < ticks; i++) {
- if ((!ticks_on_borders) && ((i == 0) || ((i + 1) == ticks))) continue;
+ if ((!ticks_on_borders) && ((i == 0) || ((i + 1) == ticks)))
+ continue;
int ofs = (i * areasize / (ticks - 1)) + grabber_offset;
tick->draw(ci, Point2i(ofs, (size.height - widget_height) / 2));
}
diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp
index 50f468741d..7252a43651 100644
--- a/scene/gui/subviewport_container.cpp
+++ b/scene/gui/subviewport_container.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* subviewport_container.cpp */
+/* subviewport_container.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/scene/gui/subviewport_container.h b/scene/gui/subviewport_container.h
index 6ff3d188e2..13b711f838 100644
--- a/scene/gui/subviewport_container.h
+++ b/scene/gui/subviewport_container.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* subviewport_container.h */
+/* subviewport_container.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 1a3b53f489..b856d3ab3a 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -399,7 +399,8 @@ int Tabs::get_tab_count() const {
void Tabs::set_current_tab(int p_current) {
- if (current == p_current) return;
+ if (current == p_current)
+ return;
ERR_FAIL_INDEX(p_current, get_tab_count());
current = p_current;
@@ -856,7 +857,8 @@ void Tabs::ensure_tab_visible(int p_idx) {
if (!is_inside_tree())
return;
- if (tabs.size() == 0) return;
+ if (tabs.size() == 0)
+ return;
ERR_FAIL_INDEX(p_idx, tabs.size());
if (p_idx == offset) {
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index aa518fbb7d..132ee0f249 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2991,7 +2991,8 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
} break;
case KEY_TAB: {
- if (k->get_command()) break; // Avoid tab when command.
+ if (k->get_command())
+ break; // Avoid tab when command.
if (readonly)
break;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 329c1085df..4a550727fc 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2277,7 +2277,8 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
bool is_command = k.is_valid() && k->get_command();
if (p_event->is_action("ui_right") && p_event->is_pressed()) {
- if (!cursor_can_exit_tree) accept_event();
+ if (!cursor_can_exit_tree)
+ accept_event();
if (!selected_item || select_mode == SELECT_ROW || selected_col > (columns.size() - 1)) {
return;
@@ -2294,7 +2295,8 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
} else if (p_event->is_action("ui_left") && p_event->is_pressed()) {
- if (!cursor_can_exit_tree) accept_event();
+ if (!cursor_can_exit_tree)
+ accept_event();
if (!selected_item || select_mode == SELECT_ROW || selected_col < 0) {
return;
@@ -2313,19 +2315,22 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
} else if (p_event->is_action("ui_up") && p_event->is_pressed() && !is_command) {
- if (!cursor_can_exit_tree) accept_event();
+ if (!cursor_can_exit_tree)
+ accept_event();
_go_up();
} else if (p_event->is_action("ui_down") && p_event->is_pressed() && !is_command) {
- if (!cursor_can_exit_tree) accept_event();
+ if (!cursor_can_exit_tree)
+ accept_event();
_go_down();
} else if (p_event->is_action("ui_page_down") && p_event->is_pressed()) {
- if (!cursor_can_exit_tree) accept_event();
+ if (!cursor_can_exit_tree)
+ accept_event();
TreeItem *next = nullptr;
if (!selected_item)
@@ -2363,7 +2368,8 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
ensure_cursor_is_visible();
} else if (p_event->is_action("ui_page_up") && p_event->is_pressed()) {
- if (!cursor_can_exit_tree) accept_event();
+ if (!cursor_can_exit_tree)
+ accept_event();
TreeItem *prev = nullptr;
if (!selected_item)
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index b5d54b2199..e91826d44b 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -95,18 +95,35 @@ void CanvasItemMaterial::_update_shader() {
String code = "shader_type canvas_item;\nrender_mode ";
switch (blend_mode) {
- case BLEND_MODE_MIX: code += "blend_mix"; break;
- case BLEND_MODE_ADD: code += "blend_add"; break;
- case BLEND_MODE_SUB: code += "blend_sub"; break;
- case BLEND_MODE_MUL: code += "blend_mul"; break;
- case BLEND_MODE_PREMULT_ALPHA: code += "blend_premul_alpha"; break;
- case BLEND_MODE_DISABLED: code += "blend_disabled"; break;
+ case BLEND_MODE_MIX:
+ code += "blend_mix";
+ break;
+ case BLEND_MODE_ADD:
+ code += "blend_add";
+ break;
+ case BLEND_MODE_SUB:
+ code += "blend_sub";
+ break;
+ case BLEND_MODE_MUL:
+ code += "blend_mul";
+ break;
+ case BLEND_MODE_PREMULT_ALPHA:
+ code += "blend_premul_alpha";
+ break;
+ case BLEND_MODE_DISABLED:
+ code += "blend_disabled";
+ break;
}
switch (light_mode) {
- case LIGHT_MODE_NORMAL: break;
- case LIGHT_MODE_UNSHADED: code += ",unshaded"; break;
- case LIGHT_MODE_LIGHT_ONLY: code += ",light_only"; break;
+ case LIGHT_MODE_NORMAL:
+ break;
+ case LIGHT_MODE_UNSHADED:
+ code += ",unshaded";
+ break;
+ case LIGHT_MODE_LIGHT_ONLY:
+ code += ",light_only";
+ break;
}
code += ";\n";
@@ -1372,10 +1389,18 @@ void CanvasItem::_update_texture_filter_changed(bool p_propagate) {
} else {
//from viewport
switch (get_viewport()->get_default_canvas_item_texture_filter()) {
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS; break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
+ break;
default: {
}
}
@@ -1421,9 +1446,15 @@ void CanvasItem::_update_texture_repeat_changed(bool p_propagate) {
} else {
//from viewport
switch (get_viewport()->get_default_canvas_item_texture_repeat()) {
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR; break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
+ texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
+ texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
+ texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR;
+ break;
default: {
}
}
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index dc17c5283b..5f1798cc2a 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -247,9 +247,11 @@ private:
protected:
_FORCE_INLINE_ void _notify_transform() {
- if (!is_inside_tree()) return;
+ if (!is_inside_tree())
+ return;
_notify_transform(this);
- if (!block_transform_notify && notify_local_transform) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
+ if (!block_transform_notify && notify_local_transform)
+ notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
}
void item_rect_changed(bool p_size_changed = true);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 4c02a15531..3d56b51e26 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -819,10 +819,14 @@ String Node::get_rpc_md5() const {
bool Node::can_process_notification(int p_what) const {
switch (p_what) {
- case NOTIFICATION_PHYSICS_PROCESS: return data.physics_process;
- case NOTIFICATION_PROCESS: return data.idle_process;
- case NOTIFICATION_INTERNAL_PROCESS: return data.idle_process_internal;
- case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: return data.physics_process_internal;
+ case NOTIFICATION_PHYSICS_PROCESS:
+ return data.physics_process;
+ case NOTIFICATION_PROCESS:
+ return data.idle_process;
+ case NOTIFICATION_INTERNAL_PROCESS:
+ return data.idle_process_internal;
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS:
+ return data.physics_process_internal;
}
return true;
@@ -2994,10 +2998,14 @@ void Node::_bind_methods() {
String Node::_get_name_num_separator() {
switch (ProjectSettings::get_singleton()->get("node/name_num_separator").operator int()) {
- case 0: return "";
- case 1: return " ";
- case 2: return "_";
- case 3: return "-";
+ case 0:
+ return "";
+ case 1:
+ return " ";
+ case 2:
+ return "_";
+ case 3:
+ return "-";
}
return " ";
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 7afc1b2edd..94be22ccd2 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1372,7 +1372,8 @@ void SceneTree::get_argument_options(const StringName &p_function, int p_idx, Li
SceneTree::SceneTree() {
- if (singleton == nullptr) singleton = this;
+ if (singleton == nullptr)
+ singleton = this;
_quit = false;
accept_quit = true;
quit_on_go_back = true;
@@ -1478,5 +1479,6 @@ SceneTree::~SceneTree() {
memdelete(root);
}
- if (singleton == this) singleton = nullptr;
+ if (singleton == this)
+ singleton = nullptr;
}
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
index 13582cf655..823892a86a 100644
--- a/scene/main/shader_globals_override.cpp
+++ b/scene/main/shader_globals_override.cpp
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* shader_globals_override.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#include "shader_globals_override.h"
#include "core/core_string_names.h"
diff --git a/scene/main/shader_globals_override.h b/scene/main/shader_globals_override.h
index 33d0dc948f..d470e6a7dc 100644
--- a/scene/main/shader_globals_override.h
+++ b/scene/main/shader_globals_override.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* shader_globals_override.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef SHADER_GLOBALS_OVERRIDE_H
#define SHADER_GLOBALS_OVERRIDE_H
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index 7c847095e1..7cab4028b8 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -173,8 +173,12 @@ Timer::TimerProcessMode Timer::get_timer_process_mode() const {
void Timer::_set_process(bool p_process, bool p_force) {
switch (timer_process_mode) {
- case TIMER_PROCESS_PHYSICS: set_physics_process_internal(p_process && !paused); break;
- case TIMER_PROCESS_IDLE: set_process_internal(p_process && !paused); break;
+ case TIMER_PROCESS_PHYSICS:
+ set_physics_process_internal(p_process && !paused);
+ break;
+ case TIMER_PROCESS_IDLE:
+ set_process_internal(p_process && !paused);
+ break;
}
processing = p_process;
}
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index ea4338519e..c5806ee7b3 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -349,12 +349,24 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
switch (track_get_type(track)) {
- case TYPE_TRANSFORM: r_ret = "transform"; break;
- case TYPE_VALUE: r_ret = "value"; break;
- case TYPE_METHOD: r_ret = "method"; break;
- case TYPE_BEZIER: r_ret = "bezier"; break;
- case TYPE_AUDIO: r_ret = "audio"; break;
- case TYPE_ANIMATION: r_ret = "animation"; break;
+ case TYPE_TRANSFORM:
+ r_ret = "transform";
+ break;
+ case TYPE_VALUE:
+ r_ret = "value";
+ break;
+ case TYPE_METHOD:
+ r_ret = "method";
+ break;
+ case TYPE_BEZIER:
+ r_ret = "bezier";
+ break;
+ case TYPE_AUDIO:
+ r_ret = "audio";
+ break;
+ case TYPE_ANIMATION:
+ r_ret = "animation";
+ break;
}
return true;
@@ -1842,7 +1854,8 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
return _cubic_interpolate(p_keys[pre].value, p_keys[idx].value, p_keys[next].value, p_keys[post].value, c);
} break;
- default: return p_keys[idx].value;
+ default:
+ return p_keys[idx].value;
}
// do a barrel roll
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index d630a1f3ee..fdf5e2c2d0 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -230,9 +230,15 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
int len = base->data_bytes;
switch (base->format) {
- case AudioStreamSample::FORMAT_8_BITS: len /= 1; break;
- case AudioStreamSample::FORMAT_16_BITS: len /= 2; break;
- case AudioStreamSample::FORMAT_IMA_ADPCM: len *= 2; break;
+ case AudioStreamSample::FORMAT_8_BITS:
+ len /= 1;
+ break;
+ case AudioStreamSample::FORMAT_16_BITS:
+ len /= 2;
+ break;
+ case AudioStreamSample::FORMAT_IMA_ADPCM:
+ len *= 2;
+ break;
}
if (base->stereo) {
@@ -465,9 +471,15 @@ float AudioStreamSample::get_length() const {
int len = data_bytes;
switch (format) {
- case AudioStreamSample::FORMAT_8_BITS: len /= 1; break;
- case AudioStreamSample::FORMAT_16_BITS: len /= 2; break;
- case AudioStreamSample::FORMAT_IMA_ADPCM: len *= 2; break;
+ case AudioStreamSample::FORMAT_8_BITS:
+ len /= 1;
+ break;
+ case AudioStreamSample::FORMAT_16_BITS:
+ len /= 2;
+ break;
+ case AudioStreamSample::FORMAT_IMA_ADPCM:
+ len *= 2;
+ break;
}
if (stereo) {
@@ -536,9 +548,15 @@ Error AudioStreamSample::save_to_wav(const String &p_path) {
int byte_pr_sample = 0;
switch (format) {
- case AudioStreamSample::FORMAT_8_BITS: byte_pr_sample = 1; break;
- case AudioStreamSample::FORMAT_16_BITS: byte_pr_sample = 2; break;
- case AudioStreamSample::FORMAT_IMA_ADPCM: byte_pr_sample = 4; break;
+ case AudioStreamSample::FORMAT_8_BITS:
+ byte_pr_sample = 1;
+ break;
+ case AudioStreamSample::FORMAT_16_BITS:
+ byte_pr_sample = 2;
+ break;
+ case AudioStreamSample::FORMAT_IMA_ADPCM:
+ byte_pr_sample = 4;
+ break;
}
String file_path = p_path;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index fd8cff7cd0..e3bed171b0 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -414,13 +414,26 @@ void BaseMaterial3D::_update_shader() {
String texfilter_str;
switch (texture_filter) {
- case TEXTURE_FILTER_NEAREST: texfilter_str = "filter_nearest"; break;
- case TEXTURE_FILTER_LINEAR: texfilter_str = "filter_linear"; break;
- case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texfilter_str = "filter_nearest_mipmap"; break;
- case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texfilter_str = "filter_linear_mipmap"; break;
- case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC: texfilter_str = "filter_nearest_mipmap_aniso"; break;
- case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC: texfilter_str = "filter_linear_mipmap_aniso"; break;
- case TEXTURE_FILTER_MAX: break; // Internal value, skip.
+ case TEXTURE_FILTER_NEAREST:
+ texfilter_str = "filter_nearest";
+ break;
+ case TEXTURE_FILTER_LINEAR:
+ texfilter_str = "filter_linear";
+ break;
+ case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
+ texfilter_str = "filter_nearest_mipmap";
+ break;
+ case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
+ texfilter_str = "filter_linear_mipmap";
+ break;
+ case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC:
+ texfilter_str = "filter_nearest_mipmap_aniso";
+ break;
+ case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC:
+ texfilter_str = "filter_linear_mipmap_aniso";
+ break;
+ case TEXTURE_FILTER_MAX:
+ break; // Internal value, skip.
}
if (flags[FLAG_USE_TEXTURE_REPEAT]) {
@@ -433,10 +446,18 @@ void BaseMaterial3D::_update_shader() {
String code = "shader_type spatial;\nrender_mode ";
switch (blend_mode) {
- case BLEND_MODE_MIX: code += "blend_mix"; break;
- case BLEND_MODE_ADD: code += "blend_add"; break;
- case BLEND_MODE_SUB: code += "blend_sub"; break;
- case BLEND_MODE_MUL: code += "blend_mul"; break;
+ case BLEND_MODE_MIX:
+ code += "blend_mix";
+ break;
+ case BLEND_MODE_ADD:
+ code += "blend_add";
+ break;
+ case BLEND_MODE_SUB:
+ code += "blend_sub";
+ break;
+ case BLEND_MODE_MUL:
+ code += "blend_mul";
+ break;
}
DepthDrawMode ddm = depth_draw_mode;
@@ -445,9 +466,15 @@ void BaseMaterial3D::_update_shader() {
}
switch (ddm) {
- case DEPTH_DRAW_OPAQUE_ONLY: code += ",depth_draw_opaque"; break;
- case DEPTH_DRAW_ALWAYS: code += ",depth_draw_always"; break;
- case DEPTH_DRAW_DISABLED: code += ",depth_draw_never"; break;
+ case DEPTH_DRAW_OPAQUE_ONLY:
+ code += ",depth_draw_opaque";
+ break;
+ case DEPTH_DRAW_ALWAYS:
+ code += ",depth_draw_always";
+ break;
+ case DEPTH_DRAW_DISABLED:
+ code += ",depth_draw_never";
+ break;
}
if (transparency == TRANSPARENCY_ALPHA_DEPTH_PRE_PASS) {
@@ -455,23 +482,49 @@ void BaseMaterial3D::_update_shader() {
}
switch (cull_mode) {
- case CULL_BACK: code += ",cull_back"; break;
- case CULL_FRONT: code += ",cull_front"; break;
- case CULL_DISABLED: code += ",cull_disabled"; break;
+ case CULL_BACK:
+ code += ",cull_back";
+ break;
+ case CULL_FRONT:
+ code += ",cull_front";
+ break;
+ case CULL_DISABLED:
+ code += ",cull_disabled";
+ break;
}
switch (diffuse_mode) {
- case DIFFUSE_BURLEY: code += ",diffuse_burley"; break;
- case DIFFUSE_LAMBERT: code += ",diffuse_lambert"; break;
- case DIFFUSE_LAMBERT_WRAP: code += ",diffuse_lambert_wrap"; break;
- case DIFFUSE_OREN_NAYAR: code += ",diffuse_oren_nayar"; break;
- case DIFFUSE_TOON: code += ",diffuse_toon"; break;
+ case DIFFUSE_BURLEY:
+ code += ",diffuse_burley";
+ break;
+ case DIFFUSE_LAMBERT:
+ code += ",diffuse_lambert";
+ break;
+ case DIFFUSE_LAMBERT_WRAP:
+ code += ",diffuse_lambert_wrap";
+ break;
+ case DIFFUSE_OREN_NAYAR:
+ code += ",diffuse_oren_nayar";
+ break;
+ case DIFFUSE_TOON:
+ code += ",diffuse_toon";
+ break;
}
switch (specular_mode) {
- case SPECULAR_SCHLICK_GGX: code += ",specular_schlick_ggx"; break;
- case SPECULAR_BLINN: code += ",specular_blinn"; break;
- case SPECULAR_PHONG: code += ",specular_phong"; break;
- case SPECULAR_TOON: code += ",specular_toon"; break;
- case SPECULAR_DISABLED: code += ",specular_disabled"; break;
+ case SPECULAR_SCHLICK_GGX:
+ code += ",specular_schlick_ggx";
+ break;
+ case SPECULAR_BLINN:
+ code += ",specular_blinn";
+ break;
+ case SPECULAR_PHONG:
+ code += ",specular_phong";
+ break;
+ 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";
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index 83430aef9e..1a28e2586d 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -703,7 +703,8 @@ void ParticlesMaterial::set_param(Parameter p_param, float p_value) {
case PARAM_ANIM_OFFSET: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value);
} break;
- case PARAM_MAX: break; // Can't happen, but silences warning
+ case PARAM_MAX:
+ break; // Can't happen, but silences warning
}
}
float ParticlesMaterial::get_param(Parameter p_param) const {
@@ -756,7 +757,8 @@ void ParticlesMaterial::set_param_randomness(Parameter p_param, float p_value) {
case PARAM_ANIM_OFFSET: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value);
} break;
- case PARAM_MAX: break; // Can't happen, but silences warning
+ case PARAM_MAX:
+ break; // Can't happen, but silences warning
}
}
float ParticlesMaterial::get_param_randomness(Parameter p_param) const {
@@ -828,7 +830,8 @@ void ParticlesMaterial::set_param_texture(Parameter p_param, const Ref<Texture2D
case PARAM_ANIM_OFFSET: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture);
} break;
- case PARAM_MAX: break; // Can't happen, but silences warning
+ case PARAM_MAX:
+ break; // Can't happen, but silences warning
}
_queue_shader_change();
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index d57af29599..91c40d871d 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1037,8 +1037,10 @@ bool AtlasTexture::is_pixel_opaque(int p_x, int p_y) const {
int y = p_y + region.position.y - margin.position.y;
// margin edge may outside of atlas
- if (x < 0 || x >= atlas->get_width()) return false;
- if (y < 0 || y >= atlas->get_height()) return false;
+ if (x < 0 || x >= atlas->get_width())
+ return false;
+ if (y < 0 || y >= atlas->get_height())
+ return false;
return atlas->is_pixel_opaque(x, y);
}
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 6f8a53be1a..1b68b7486b 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -993,7 +993,8 @@ void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
if (p_shapes[i].get_type() == Variant::OBJECT) {
Ref<Shape2D> shape = p_shapes[i];
- if (shape.is_null()) continue;
+ if (shape.is_null())
+ continue;
s.shape = shape;
s.shape_transform = default_transform;
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 3b245f908a..5637aaec9a 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1229,11 +1229,21 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
for (int i = 0; i < output_count; i++) {
String var_name = "n_out" + itos(node) + "p" + itos(i);
switch (vsnode->get_output_port_type(i)) {
- case VisualShaderNode::PORT_TYPE_SCALAR: outputs[i] = "float " + var_name; break;
- case VisualShaderNode::PORT_TYPE_SCALAR_INT: outputs[i] = "int " + var_name; break;
- case VisualShaderNode::PORT_TYPE_VECTOR: outputs[i] = "vec3 " + var_name; break;
- case VisualShaderNode::PORT_TYPE_BOOLEAN: outputs[i] = "bool " + var_name; break;
- case VisualShaderNode::PORT_TYPE_TRANSFORM: outputs[i] = "mat4 " + var_name; break;
+ case VisualShaderNode::PORT_TYPE_SCALAR:
+ outputs[i] = "float " + var_name;
+ break;
+ case VisualShaderNode::PORT_TYPE_SCALAR_INT:
+ outputs[i] = "int " + var_name;
+ break;
+ case VisualShaderNode::PORT_TYPE_VECTOR:
+ outputs[i] = "vec3 " + var_name;
+ break;
+ case VisualShaderNode::PORT_TYPE_BOOLEAN:
+ outputs[i] = "bool " + var_name;
+ break;
+ case VisualShaderNode::PORT_TYPE_TRANSFORM:
+ outputs[i] = "mat4 " + var_name;
+ break;
default: {
}
}
@@ -1243,11 +1253,21 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
for (int i = 0; i < output_count; i++) {
outputs[i] = "n_out" + itos(node) + "p" + itos(i);
switch (vsnode->get_output_port_type(i)) {
- case VisualShaderNode::PORT_TYPE_SCALAR: code += String() + "\tfloat " + outputs[i] + ";\n"; break;
- case VisualShaderNode::PORT_TYPE_SCALAR_INT: code += String() + "\tint " + outputs[i] + ";\n"; break;
- case VisualShaderNode::PORT_TYPE_VECTOR: code += String() + "\tvec3 " + outputs[i] + ";\n"; break;
- case VisualShaderNode::PORT_TYPE_BOOLEAN: code += String() + "\tbool " + outputs[i] + ";\n"; break;
- case VisualShaderNode::PORT_TYPE_TRANSFORM: code += String() + "\tmat4 " + outputs[i] + ";\n"; break;
+ case VisualShaderNode::PORT_TYPE_SCALAR:
+ code += String() + "\tfloat " + outputs[i] + ";\n";
+ break;
+ case VisualShaderNode::PORT_TYPE_SCALAR_INT:
+ code += String() + "\tint " + outputs[i] + ";\n";
+ break;
+ case VisualShaderNode::PORT_TYPE_VECTOR:
+ code += String() + "\tvec3 " + outputs[i] + ";\n";
+ break;
+ case VisualShaderNode::PORT_TYPE_BOOLEAN:
+ code += String() + "\tbool " + outputs[i] + ";\n";
+ break;
+ case VisualShaderNode::PORT_TYPE_TRANSFORM:
+ code += String() + "\tmat4 " + outputs[i] + ";\n";
+ break;
default: {
}
}
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index 7b9953a90f..03db8c3ac5 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -497,9 +497,14 @@ String VisualShaderNodeTexture::generate_global(Shader::Mode p_mode, VisualShade
String u = "uniform sampler2D " + make_unique_id(p_type, p_id, "tex");
switch (texture_type) {
- case TYPE_DATA: break;
- case TYPE_COLOR: u += " : hint_albedo"; break;
- case TYPE_NORMALMAP: u += " : hint_normal"; break;
+ case TYPE_DATA:
+ break;
+ case TYPE_COLOR:
+ u += " : hint_albedo";
+ break;
+ case TYPE_NORMALMAP:
+ u += " : hint_normal";
+ break;
}
return u + ";\n";
}
@@ -869,9 +874,14 @@ String VisualShaderNodeCubemap::generate_global(Shader::Mode p_mode, VisualShade
if (source == SOURCE_TEXTURE) {
String u = "uniform samplerCube " + make_unique_id(p_type, p_id, "cube");
switch (texture_type) {
- case TYPE_DATA: break;
- case TYPE_COLOR: u += " : hint_albedo"; break;
- case TYPE_NORMALMAP: u += " : hint_normal"; break;
+ case TYPE_DATA:
+ break;
+ case TYPE_COLOR:
+ u += " : hint_albedo";
+ break;
+ case TYPE_NORMALMAP:
+ u += " : hint_normal";
+ break;
}
return u + ";\n";
}
@@ -1032,16 +1042,36 @@ String VisualShaderNodeFloatOp::generate_code(Shader::Mode p_mode, VisualShader:
String code = "\t" + p_output_vars[0] + " = ";
switch (op) {
- case OP_ADD: code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n"; break;
- case OP_SUB: code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n"; break;
- case OP_MUL: code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n"; break;
- case OP_DIV: code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n"; break;
- case OP_MOD: code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_POW: code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_MAX: code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_MIN: code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_ATAN2: code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_STEP: code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
+ case OP_ADD:
+ code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n";
+ break;
+ case OP_SUB:
+ code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n";
+ break;
+ case OP_MUL:
+ code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n";
+ break;
+ case OP_DIV:
+ code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n";
+ break;
+ case OP_MOD:
+ code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_POW:
+ code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_MAX:
+ code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_MIN:
+ code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_ATAN2:
+ code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_STEP:
+ code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
}
return code;
@@ -1124,13 +1154,27 @@ String VisualShaderNodeIntOp::generate_code(Shader::Mode p_mode, VisualShader::T
String code = "\t" + p_output_vars[0] + " = ";
switch (op) {
- case OP_ADD: code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n"; break;
- case OP_SUB: code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n"; break;
- case OP_MUL: code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n"; break;
- case OP_DIV: code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n"; break;
- case OP_MOD: code += p_input_vars[0] + " % " + p_input_vars[1] + ";\n"; break;
- case OP_MAX: code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_MIN: code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
+ case OP_ADD:
+ code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n";
+ break;
+ case OP_SUB:
+ code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n";
+ break;
+ case OP_MUL:
+ code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n";
+ break;
+ case OP_DIV:
+ code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n";
+ break;
+ case OP_MOD:
+ code += p_input_vars[0] + " % " + p_input_vars[1] + ";\n";
+ break;
+ case OP_MAX:
+ code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_MIN:
+ code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
}
return code;
@@ -1209,18 +1253,42 @@ String VisualShaderNodeVectorOp::generate_code(Shader::Mode p_mode, VisualShader
String code = "\t" + p_output_vars[0] + " = ";
switch (op) {
- case OP_ADD: code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n"; break;
- case OP_SUB: code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n"; break;
- case OP_MUL: code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n"; break;
- case OP_DIV: code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n"; break;
- case OP_MOD: code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_POW: code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_MAX: code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_MIN: code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_CROSS: code += "cross(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_ATAN2: code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_REFLECT: code += "reflect(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
- case OP_STEP: code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
+ case OP_ADD:
+ code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n";
+ break;
+ case OP_SUB:
+ code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n";
+ break;
+ case OP_MUL:
+ code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n";
+ break;
+ case OP_DIV:
+ code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n";
+ break;
+ case OP_MOD:
+ code += "mod(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_POW:
+ code += "pow(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_MAX:
+ code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_MIN:
+ code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_CROSS:
+ code += "cross(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_ATAN2:
+ code += "atan(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_REFLECT:
+ code += "reflect(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
+ case OP_STEP:
+ code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ break;
}
return code;
@@ -3752,8 +3820,12 @@ String VisualShaderNodeTextureUniform::generate_global(Shader::Mode p_mode, Visu
else
code += " : hint_albedo;\n";
break;
- case TYPE_NORMALMAP: code += " : hint_normal;\n"; break;
- case TYPE_ANISO: code += " : hint_aniso;\n"; break;
+ case TYPE_NORMALMAP:
+ code += " : hint_normal;\n";
+ break;
+ case TYPE_ANISO:
+ code += " : hint_aniso;\n";
+ break;
}
return code;
@@ -4003,8 +4075,12 @@ String VisualShaderNodeCubemapUniform::generate_global(Shader::Mode p_mode, Visu
else
code += " : hint_albedo;\n";
break;
- case TYPE_NORMALMAP: code += " : hint_normal;\n"; break;
- case TYPE_ANISO: code += " : hint_aniso;\n"; break;
+ case TYPE_NORMALMAP:
+ code += " : hint_normal;\n";
+ break;
+ case TYPE_ANISO:
+ code += " : hint_aniso;\n";
+ break;
}
return code;