Merge pull request #3965 from Pankaj003/master
FBX module unable to read uv rotation angle and write all the uv transformation data.pull/3973/head
commit
3ea4baad81
|
@ -1766,6 +1766,7 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const TextureMap
|
|||
// XXX handle all kinds of UV transformations
|
||||
uvTrafo.mScaling = tex->UVScaling();
|
||||
uvTrafo.mTranslation = tex->UVTranslation();
|
||||
uvTrafo.mRotation = tex->UVRotation();
|
||||
out_mat->AddProperty(&uvTrafo, 1, _AI_MATKEY_UVTRANSFORM_BASE, target, 0);
|
||||
|
||||
const PropertyTable &props = tex->Props();
|
||||
|
@ -1885,6 +1886,7 @@ void FBXConverter::TrySetTextureProperties(aiMaterial *out_mat, const LayeredTex
|
|||
// XXX handle all kinds of UV transformations
|
||||
uvTrafo.mScaling = tex->UVScaling();
|
||||
uvTrafo.mTranslation = tex->UVTranslation();
|
||||
uvTrafo.mRotation = tex->UVRotation();
|
||||
out_mat->AddProperty(&uvTrafo, 1, _AI_MATKEY_UVTRANSFORM_BASE, target, texIndex);
|
||||
|
||||
const PropertyTable &props = tex->Props();
|
||||
|
@ -2324,6 +2326,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial *out_mat, const PropertyTa
|
|||
// XXX handle all kinds of UV transformations
|
||||
uvTrafo.mScaling = tex->UVScaling();
|
||||
uvTrafo.mTranslation = tex->UVTranslation();
|
||||
uvTrafo.mRotation = tex->UVRotation();
|
||||
out_mat->AddProperty(&uvTrafo, 1, (name + "|uvtrafo").c_str(), aiTextureType_UNKNOWN, 0);
|
||||
|
||||
int uvIndex = 0;
|
||||
|
|
|
@ -500,6 +500,10 @@ public:
|
|||
return uvScaling;
|
||||
}
|
||||
|
||||
const ai_real &UVRotation() const {
|
||||
return uvRotation;
|
||||
}
|
||||
|
||||
const PropertyTable& Props() const {
|
||||
ai_assert(props.get());
|
||||
return *props.get();
|
||||
|
@ -517,6 +521,7 @@ public:
|
|||
private:
|
||||
aiVector2D uvTrans;
|
||||
aiVector2D uvScaling;
|
||||
ai_real uvRotation;
|
||||
|
||||
std::string type;
|
||||
std::string relativeFileName;
|
||||
|
|
|
@ -1688,6 +1688,10 @@ void FBXExporter::WriteObjects ()
|
|||
// link the image data to the texture
|
||||
connections.emplace_back("C", "OO", image_uid, texture_uid);
|
||||
|
||||
aiUVTransform trafo;
|
||||
unsigned int max = sizeof(aiUVTransform);
|
||||
aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE, 0), (float *)&trafo, &max);
|
||||
|
||||
// now write the actual texture node
|
||||
FBX::Node tnode("Texture");
|
||||
// TODO: some way to determine texture name?
|
||||
|
@ -1698,6 +1702,9 @@ void FBXExporter::WriteObjects ()
|
|||
tnode.AddChild("Version", int32_t(202));
|
||||
tnode.AddChild("TextureName", texture_name);
|
||||
FBX::Node p("Properties70");
|
||||
p.AddP70vectorA("Translation", trafo.mTranslation[0], trafo.mTranslation[1], 0.0);
|
||||
p.AddP70vectorA("Rotation", 0, 0, trafo.mRotation);
|
||||
p.AddP70vectorA("Scaling", trafo.mScaling[0], trafo.mScaling[1], 0.0);
|
||||
p.AddP70enum("CurrentTextureBlendMode", 0); // TODO: verify
|
||||
//p.AddP70string("UVSet", ""); // TODO: how should this work?
|
||||
p.AddP70bool("UseMaterial", 1);
|
||||
|
|
|
@ -210,6 +210,11 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
|
|||
uvTrans.y = trans.y;
|
||||
}
|
||||
|
||||
const aiVector3D &rotation = PropertyGet<aiVector3D>(*props, "Rotation", ok);
|
||||
if (ok) {
|
||||
uvRotation = rotation.z;
|
||||
}
|
||||
|
||||
// resolve video links
|
||||
if(doc.Settings().readTextures) {
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||
|
|
Loading…
Reference in New Issue