summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-05-13 17:19:36 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-05-14 21:27:17 +0200
commit436f2aa8208decd022069c52544169030a6913db (patch)
tree26c6c9eb650185ce3e36728724d163efe3daa278 /avmedia
parent969df2a069d5b9bd90467a0ed447fcf36a90557e (diff)
Add kmz support to collada2gltf and use it.
Change-Id: I37cda0e326af00ef369c4415bcec1e03c91ce401
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/framework/modeltools.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 0d517441a3ca..ea400a3182e2 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -29,6 +29,7 @@
#ifdef ENABLE_COLLADA2GLTF
#include <COLLADA2GLTFWriter.h>
#include <GLTFAsset.h>
+#include <KMZ2Collada.h>
#endif
#include <string>
@@ -139,7 +140,7 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
{
OUString sSource = rSourceURL;
#ifdef ENABLE_COLLADA2GLTF
- if (rSourceURL.endsWith("dae"))
+ if (rSourceURL.endsWith(".dae") || rSourceURL.endsWith(".kmz"))
{
OUString sName = ::utl::TempFile::CreateTempName();
// remove .tmp extension
@@ -149,6 +150,14 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
std::shared_ptr <GLTF::GLTFAsset> asset(new GLTF::GLTFAsset());
asset->setInputFilePath(sSourcePath);
+
+ if (rSourceURL.endsWith(".kmz"))
+ {
+ std::string strDaeFilePath = GLTF::Kmz2Collada()(asset->getInputFilePath());
+ if (strDaeFilePath == "")
+ return false;
+ asset->setInputFilePath(strDaeFilePath);
+ }
asset->setBundleOutputPath(OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr());
GLTF::COLLADA2GLTFWriter writer(asset);
writer.write();