Improved Blender/Collada shadeless->unshaded import
(cherry picked from commit 101e0c9ec6
)
This commit is contained in:
parent
afbc9d550f
commit
08c9e566bf
|
@ -718,6 +718,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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -463,6 +463,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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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>')
|
||||||
|
|
Loading…
Reference in New Issue