[Libreoffice-commits] core.git: 2 commits - avmedia/source sd/source

Zolnai Tamás tamas.zolnai at collabora.com
Wed May 21 06:27:05 PDT 2014


 avmedia/source/framework/modeltools.cxx |   20 ++++++++++++++------
 sd/source/ui/view/sdview4.cxx           |    6 +++++-
 2 files changed, 19 insertions(+), 7 deletions(-)

New commits:
commit d1711bb430b68e2a0ac2eb86efc998cf6a152b4a
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Tue May 20 16:46:43 2014 +0200

    glTF embedding: handle missing image on a better way
    
    Using empty tree leads to empty image url which
    cause problem.
    
    Change-Id: If815ce588fb303905035185404ede93fa424fcba

diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 2366dc7..66a95b3 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -25,6 +25,7 @@
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/json_parser.hpp>
 #include <boost/foreach.hpp>
+#include <boost/optional.hpp>
 
 #ifdef ENABLE_COLLADA2GLTF
 #include <COLLADA2GLTFWriter.h>
@@ -71,7 +72,7 @@ static void lcl_EmbedExternals(const OUString& rSourceURL, uno::Reference<embed:
 
     // Parse json, read externals' URI and modify this relative URI's so they remain valid in the new context.
     std::vector<std::string> vExternals;
-    ptree aTree, aEmptyTree;
+    ptree aTree;
     try
     {
         json_parser::read_json( sUrl, aTree );
@@ -85,12 +86,19 @@ static void lcl_EmbedExternals(const OUString& rSourceURL, uno::Reference<embed:
             aTree.put("buffers." + rVal.first + ".path.",sBufferUri.substr(sBufferUri.find_last_of('/')+1));
         }
         // Images for textures
-        BOOST_FOREACH(ptree::value_type &rVal,aTree.get_child("images", aEmptyTree))
+        boost::optional< ptree& > aImages = aTree.get_child_optional("images");
+        if( aImages )
         {
-            const std::string sImageUri(rVal.second.get<std::string>("path"));
-            vExternals.push_back(sImageUri);
-            // Change path: make it contain only a file name
-            aTree.put("images." + rVal.first + ".path.",sImageUri.substr(sImageUri.find_last_of('/')+1));
+            BOOST_FOREACH(ptree::value_type &rVal,aImages.get())
+            {
+                const std::string sImageUri(rVal.second.get<std::string>("path"));
+                if( !sImageUri.empty() )
+                {
+                    vExternals.push_back(sImageUri);
+                    // Change path: make it contain only a file name
+                    aTree.put("images." + rVal.first + ".path.",sImageUri.substr(sImageUri.find_last_of('/')+1));
+                }
+            }
         }
         // Shaders (contains names only)
         BOOST_FOREACH(ptree::value_type &rVal,aTree.get_child("programs"))
commit ee734562dfb36ed1025bfe8a4bfd4eece2c53533
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon May 19 18:39:02 2014 +0200

    glTF objects: set playback loop by default
    
    Change-Id: I17f5636196ba2b14f46f805ce013af5e6bede9a8

diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 2802435..c14465d 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -307,7 +307,11 @@ SdrMediaObj* View::Insert3DModelURL(
         if (!bRet) { return 0; }
     }
 
-    return InsertMediaObj( sRealURL, "application/vnd.gltf+json", rAction, rPos, rSize );
+    SdrMediaObj* pRetObject = InsertMediaObj( sRealURL, "application/vnd.gltf+json", rAction, rPos, rSize );
+    avmedia::MediaItem aItem = pRetObject->getMediaProperties();
+    aItem.setLoop(true);
+    pRetObject->setMediaProperties(aItem);
+    return pRetObject;
 }
 
 SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rMimeType, sal_Int8& rAction,


More information about the Libreoffice-commits mailing list