Hide shading options in SpatialMaterial when 'FLAG_UNSHADED' is set

This commit is contained in:
Dominique LaSalle 2018-09-26 16:44:43 -07:00
parent a2b6be23ad
commit 4a60679f31

View file

@ -1313,7 +1313,7 @@ void SpatialMaterial::set_flag(Flags p_flag, bool p_enabled) {
return;
flags[p_flag] = p_enabled;
if (p_flag == FLAG_USE_ALPHA_SCISSOR) {
if (p_flag == FLAG_USE_ALPHA_SCISSOR || p_flag == FLAG_UNSHADED) {
_change_notify();
}
_queue_shader_change();
@ -1407,6 +1407,48 @@ void SpatialMaterial::_validate_property(PropertyInfo &property) const {
if ((property.name == "depth_min_layers" || property.name == "depth_max_layers") && !deep_parallax) {
property.usage = 0;
}
if (flags[FLAG_UNSHADED]) {
if (property.name.begins_with("anisotropy")) {
property.usage = 0;
}
if (property.name.begins_with("ao")) {
property.usage = 0;
}
if (property.name.begins_with("clearcoat")) {
property.usage = 0;
}
if (property.name.begins_with("emission")) {
property.usage = 0;
}
if (property.name.begins_with("metallic")) {
property.usage = 0;
}
if (property.name.begins_with("normal")) {
property.usage = 0;
}
if (property.name.begins_with("rim")) {
property.usage = 0;
}
if (property.name.begins_with("roughness")) {
property.usage = 0;
}
if (property.name.begins_with("subsurf_scatter")) {
property.usage = 0;
}
if (property.name.begins_with("transmission")) {
property.usage = 0;
}
}
}
void SpatialMaterial::set_line_width(float p_line_width) {