[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - 3 commits - avmedia/source external/collada2gltf

Jan Holesovsky kendy at collabora.com
Tue May 20 01:11:12 PDT 2014


 avmedia/source/framework/modeltools.cxx                          |   11 ++++++----
 external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 |    2 -
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 7110b392942a73094cecbabb77a44c684d2cd1fb
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue May 20 09:37:47 2014 +0200

    collada2gltf: Ignore case of the extension.
    
    Change-Id: If7f39a1a0537c561373137e6a9dcdb22b48037f0

diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 2366dc7..1adef63 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -140,7 +140,9 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
 {
     OUString sSource = rSourceURL;
 #ifdef ENABLE_COLLADA2GLTF
-    if (rSourceURL.endsWith(".dae") || rSourceURL.endsWith(".kmz"))
+    const bool bIsDAE = rSourceURL.endsWithIgnoreAsciiCase(".dae");
+    const bool bIsKMZ = rSourceURL.endsWithIgnoreAsciiCase(".kmz");
+    if (bIsDAE || bIsKMZ)
     {
         OUString sName;
         ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sName);
@@ -152,7 +154,7 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
         std::shared_ptr <GLTF::GLTFAsset> asset(new GLTF::GLTFAsset());
         asset->setInputFilePath(sSourcePath);
 
-        if (rSourceURL.endsWith(".kmz"))
+        if (bIsKMZ)
         {
             std::string strDaeFilePath = GLTF::Kmz2Collada()(asset->getInputFilePath());
             if (strDaeFilePath == "")
commit 95adbe9fbd156ed0227aca98a3fe7ac9664f09b8
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue May 20 02:48:43 2014 +0200

    fix .kmz support on Windows; no idea why this int was unsigned
    
    Change-Id: I08fa1c3956b48bcd65edb74add010fafa17bfe82

diff --git a/external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 b/external/collada2gltf/write-only-.dae-file-which-we-need.patch.0
index 68980e2..56ff909 100644
--- a/external/collada2gltf/write-only-.dae-file-which-we-need.patch.0
+++ b/external/collada2gltf/write-only-.dae-file-which-we-need.patch.0
@@ -74,7 +74,7 @@ index d193784..3b5bdfc 100644
 +                continue;
  
 -            FILE *fp = fopen(strFilePath.c_str(),"wb");
-+            unsigned int pos = strlen(pFileName) - 1;
++            int pos = strlen(pFileName) - 1;
 +            while (pos >= 0) {
 +                if (pFileName[pos] == '\\' || pFileName[pos] == '/')
 +                    break;
commit e1fff3d529aa3bb0a8b559d642cc2f5f55416d8d
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue May 20 02:34:38 2014 +0200

    collada2gltf: output bundle path needs to be in url format
    
    Otherwise it does not work on Windows.
    
    It's strange though that input path has to be converted from url to
    native path format. At least that was my observation.
    
    Change-Id: Ia8d9e9719d927cab2ae4d928eb8066cab4588281

diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 9b48552..2366dc7 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -142,7 +142,8 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
 #ifdef ENABLE_COLLADA2GLTF
     if (rSourceURL.endsWith(".dae") || rSourceURL.endsWith(".kmz"))
     {
-        OUString sName = ::utl::TempFile::CreateTempName();
+        OUString sName;
+        ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sName);
         // remove .tmp extension
         sName = sName.copy(0, sName.getLength() - 4);
         const INetURLObject aSourceURLObj(rSourceURL);
@@ -162,7 +163,7 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
         GLTF::COLLADA2GLTFWriter writer(asset);
         writer.write();
         // Path to the .json file created by COLLADA2GLTFWriter
-        ::utl::LocalFileHelper::ConvertPhysicalNameToURL(sName + "/" + GetFilename(sName) + ".json", sSource);
+        sSource = sName + "/" + GetFilename(sName) + ".json";
     }
 #endif
 


More information about the Libreoffice-commits mailing list