Browse Source

Merge pull request #70602 from Calinou/environment-no-sky-hide-ambient-light-properties

Hide Ambient Light properties in Environment inspector depending on mode
Rémi Verschelde 2 years ago
parent
commit
fc5fafbb32
1 changed files with 12 additions and 0 deletions
  1. 12 0
      scene/resources/environment.cpp

+ 12 - 0
scene/resources/environment.cpp

@@ -1043,6 +1043,18 @@ void Environment::_validate_property(PropertyInfo &p_property) const {
 		}
 		}
 	}
 	}
 
 
+	if (p_property.name == "ambient_light_color" || p_property.name == "ambient_light_energy") {
+		if (ambient_source == AMBIENT_SOURCE_DISABLED) {
+			p_property.usage = PROPERTY_USAGE_NO_EDITOR;
+		}
+	}
+
+	if (p_property.name == "ambient_light_sky_contribution") {
+		if (ambient_source == AMBIENT_SOURCE_DISABLED || ambient_source == AMBIENT_SOURCE_COLOR) {
+			p_property.usage = PROPERTY_USAGE_NO_EDITOR;
+		}
+	}
+
 	if (p_property.name == "fog_aerial_perspective") {
 	if (p_property.name == "fog_aerial_perspective") {
 		if (bg_mode != BG_SKY) {
 		if (bg_mode != BG_SKY) {
 			p_property.usage = PROPERTY_USAGE_NO_EDITOR;
 			p_property.usage = PROPERTY_USAGE_NO_EDITOR;