summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2021-10-03 22:51:28 -0700
committerclayjohn <claynjohn@gmail.com>2021-10-04 08:48:58 -0700
commit8c949016ffd193862f4b4b4633ee091708c446d9 (patch)
treeea5aa538478324d600d003a7086138bc9aaae7ca /scene/resources
parent66ab3ce954a94fd43baed1dd74381dd32c893407 (diff)
Hide render_priority except when using SpatialMaterials
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/material.cpp7
-rw-r--r--scene/resources/material.h3
-rw-r--r--scene/resources/sky_material.cpp12
-rw-r--r--scene/resources/sky_material.h3
4 files changed, 10 insertions, 15 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 3a6af3afb0..66177f0807 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -80,6 +80,9 @@ void Material::_validate_property(PropertyInfo &property) const {
if (!_can_do_next_pass() && property.name == "next_pass") {
property.usage = PROPERTY_USAGE_NONE;
}
+ if (!_can_use_render_priority() && property.name == "render_priority") {
+ property.usage = PROPERTY_USAGE_NONE;
+ }
}
void Material::inspect_native_shader_code() {
@@ -291,6 +294,10 @@ bool ShaderMaterial::_can_do_next_pass() const {
return shader.is_valid() && shader->get_mode() == Shader::MODE_SPATIAL;
}
+bool ShaderMaterial::_can_use_render_priority() const {
+ return shader.is_valid() && shader->get_mode() == Shader::MODE_SPATIAL;
+}
+
Shader::Mode ShaderMaterial::get_shader_mode() const {
if (shader.is_valid()) {
return shader->get_mode();
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 5d7a5324ca..798f7568df 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -53,6 +53,7 @@ protected:
_FORCE_INLINE_ RID _get_material() const { return material; }
static void _bind_methods();
virtual bool _can_do_next_pass() const { return false; }
+ virtual bool _can_use_render_priority() const { return false; }
void _validate_property(PropertyInfo &property) const override;
@@ -93,6 +94,7 @@ protected:
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
virtual bool _can_do_next_pass() const override;
+ virtual bool _can_use_render_priority() const override;
void _shader_changed();
@@ -535,6 +537,7 @@ protected:
static void _bind_methods();
void _validate_property(PropertyInfo &property) const override;
virtual bool _can_do_next_pass() const override { return true; }
+ virtual bool _can_use_render_priority() const override { return true; }
public:
void set_albedo(const Color &p_albedo);
diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp
index 39082b6f7a..b6d3c96cb7 100644
--- a/scene/resources/sky_material.cpp
+++ b/scene/resources/sky_material.cpp
@@ -125,10 +125,6 @@ float ProceduralSkyMaterial::get_sun_curve() const {
return sun_curve;
}
-bool ProceduralSkyMaterial::_can_do_next_pass() const {
- return false;
-}
-
Shader::Mode ProceduralSkyMaterial::get_shader_mode() const {
return Shader::MODE_SKY;
}
@@ -312,10 +308,6 @@ Ref<Texture2D> PanoramaSkyMaterial::get_panorama() const {
return panorama;
}
-bool PanoramaSkyMaterial::_can_do_next_pass() const {
- return false;
-}
-
Shader::Mode PanoramaSkyMaterial::get_shader_mode() const {
return Shader::MODE_SKY;
}
@@ -482,10 +474,6 @@ Ref<Texture2D> PhysicalSkyMaterial::get_night_sky() const {
return night_sky;
}
-bool PhysicalSkyMaterial::_can_do_next_pass() const {
- return false;
-}
-
Shader::Mode PhysicalSkyMaterial::get_shader_mode() const {
return Shader::MODE_SKY;
}
diff --git a/scene/resources/sky_material.h b/scene/resources/sky_material.h
index 63e730617b..daeda212d4 100644
--- a/scene/resources/sky_material.h
+++ b/scene/resources/sky_material.h
@@ -58,7 +58,6 @@ private:
protected:
static void _bind_methods();
- virtual bool _can_do_next_pass() const override;
public:
void set_sky_top_color(const Color &p_sky_top);
@@ -117,7 +116,6 @@ private:
protected:
static void _bind_methods();
- virtual bool _can_do_next_pass() const override;
public:
void set_panorama(const Ref<Texture2D> &p_panorama);
@@ -159,7 +157,6 @@ private:
protected:
static void _bind_methods();
- virtual bool _can_do_next_pass() const override;
public:
void set_rayleigh_coefficient(float p_rayleigh);