Improved Blender/Collada shadeless->unshaded import

This commit is contained in:
Pawel Kowal 2016-06-07 22:07:48 +02:00
parent 5e01566d01
commit 101e0c9ec6
4 changed files with 12 additions and 1 deletions

View File

@ -736,6 +736,9 @@ void Collada::_parse_effect_material(XMLParser& parser,Effect &effect,String &id
effect.found_double_sided=true; effect.found_double_sided=true;
effect.double_sided=parser.get_node_data().to_int(); effect.double_sided=parser.get_node_data().to_int();
COLLADA_PRINT("double sided: "+itos(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") { } else if (parser.get_node_name()=="bump") {
// color or texture types // color or texture types

View File

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

View File

@ -467,6 +467,7 @@ Error ColladaImport::_create_material(const String& p_target) {
material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess);
material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); 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,5,'<technique profile="GOOGLEEARTH">')
self.writel(S_FX,6,'<double_sided>'+["0","1"][double_sided_hint]+"</double_sided>") self.writel(S_FX,6,'<double_sided>'+["0","1"][double_sided_hint]+"</double_sided>")
self.writel(S_FX,5,'</technique>') 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,4,'</extra>')
self.writel(S_FX,3,'</technique>') self.writel(S_FX,3,'</technique>')