summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-05-22 15:56:19 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-06-11 19:27:25 +0200
commit478f7d8a88c36eb955d44558b10df2ed93a01561 (patch)
tree1d02fc1ae5fdc386d990995d147c65a7fd1ff166 /avmedia
parentcdee4e73eb7a6fa64dd382af7dfad707631d8fe5 (diff)
collada2gltf: fix URL problems
collada2gltf does not handle Windows pathes, the used COLLADABU::URI class can't parse native Windows pathes so call COLLADA2GLTFWriter with URL only. Other problems: collada2gltf uses the URL path for creating/opening files, instead of native ones. collada2gltf initializes _outputFilePath member in different way, sometimes as an URL path, sometimes as a native one, but handle it on the same way(as an URL). Change-Id: I104182653c07e7dcf6fc5b6e32c7031d59246b84 (cherry picked from commit 1dd84fc4674141449c78f6c5838e2254c5a28f35)
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/framework/modeltools.cxx32
1 files changed, 20 insertions, 12 deletions
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index c3fa11ef8d0b..a7237d585c5f 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -152,28 +152,36 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
const bool bIsKMZ = rSourceURL.endsWithIgnoreAsciiCase(".kmz");
if (bIsDAE || bIsKMZ)
{
- OUString sName;
- ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sName);
- // remove .tmp extension
- sName = sName.copy(0, sName.getLength() - 4);
- const INetURLObject aSourceURLObj(rSourceURL);
- std::string sSourcePath = OUStringToOString( aSourceURLObj.getFSysPath(INetURLObject::FSYS_DETECT), RTL_TEXTENCODING_UTF8 ).getStr();
-
std::shared_ptr <GLTF::GLTFAsset> asset(new GLTF::GLTFAsset());
- asset->setInputFilePath(sSourcePath);
+ asset->setInputFilePath(OUStringToOString( rSourceURL, RTL_TEXTENCODING_UTF8 ).getStr());
if (bIsKMZ)
{
- std::string strDaeFilePath = GLTF::Kmz2Collada()(asset->getInputFilePath());
+ // KMZ converter needs a system path
+ const INetURLObject aSourceURLObj(rSourceURL);
+ const std::string sSourcePath =
+ OUStringToOString( aSourceURLObj.getFSysPath(INetURLObject::FSYS_DETECT), RTL_TEXTENCODING_UTF8 ).getStr();
+ const std::string strDaeFilePath = GLTF::Kmz2Collada()(sSourcePath);
if (strDaeFilePath == "")
return false;
- asset->setInputFilePath(strDaeFilePath);
+
+ // DAE converter needs URL
+ OUString sDaeFilePath;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL(
+ OStringToOUString(OString(strDaeFilePath.c_str()), RTL_TEXTENCODING_UTF8 ), sDaeFilePath);
+ asset->setInputFilePath(OUStringToOString( sDaeFilePath, RTL_TEXTENCODING_UTF8 ).getStr());
}
- asset->setBundleOutputPath(OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr());
+
+ OUString sOutput;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sOutput);
+ // remove .tmp extension
+ sOutput = sOutput.copy(0, sOutput.getLength()-4);
+ asset->setBundleOutputPath(OUStringToOString( sOutput, RTL_TEXTENCODING_UTF8 ).getStr());
+
GLTF::COLLADA2GLTFWriter writer(asset);
writer.write();
// Path to the .json file created by COLLADA2GLTFWriter
- sSource = sName + "/" + GetFilename(sName) + ".json";
+ sSource = sOutput + "/" + GetFilename(sOutput) + ".json";
}
#endif