Improved Blender/Collada shadeless->unshaded import

(cherry picked from commit 101e0c9ec6)
This commit is contained in:
Pawel Kowal 2016-06-07 22:07:48 +02:00 committed by Rémi Verschelde
parent afbc9d550f
commit 08c9e566bf
4 changed files with 12 additions and 1 deletions

View File

@ -718,6 +718,9 @@ void Collada::_parse_effect_material(XMLParser& parser,Effect &effect,String &id
effect.found_double_sided=true;
effect.double_sided=parser.get_node_data().to_int();
COLLADA_PRINT("double sided: "+itos(parser.get_node_data().to_int()));
} else if (parser.get_node_name()=="unshaded") {
parser.read();
effect.unshaded=parser.get_node_data().to_int();
} else if (parser.get_node_name()=="bump") {
// color or texture types

View File

@ -75,6 +75,7 @@ public:
float shininess;
bool found_double_sided;
bool double_sided;
bool unshaded;
String get_texture_path(const String& p_source,Collada& state) const;
@ -83,7 +84,7 @@ public:
double_sided=true;
found_double_sided=false;
shininess=40;
unshaded=false;
}
};

View File

@ -463,6 +463,7 @@ Error ColladaImport::_create_material(const String& p_target) {
material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess);
material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided);
material->set_flag(Material::FLAG_UNSHADED,effect.unshaded);

View File

@ -351,6 +351,12 @@ class DaeExporter:
self.writel(S_FX,5,'<technique profile="GOOGLEEARTH">')
self.writel(S_FX,6,'<double_sided>'+["0","1"][double_sided_hint]+"</double_sided>")
self.writel(S_FX,5,'</technique>')
if (material.use_shadeless):
self.writel(S_FX,5,'<technique profile="GODOT">')
self.writel(S_FX,6,'<unshaded>1</unshaded>')
self.writel(S_FX,5,'</technique>')
self.writel(S_FX,4,'</extra>')
self.writel(S_FX,3,'</technique>')