[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - 4 commits - avmedia/source external/collada2gltf external/opencollada
Zolnai Tamás
tamas.zolnai at collabora.com
Thu May 22 07:25:08 PDT 2014
avmedia/source/framework/modeltools.cxx | 32
external/collada2gltf/UnpackedTarball_collada2gltf.mk | 5
external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 | 8522 ----------
external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3 | 8522 ++++++++++
external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0 | 128
external/collada2gltf/patches/wrong_uri_usage.patch.1 | 77
external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 | 128
external/opencollada/UnpackedTarball_opencollada.mk | 5
external/opencollada/opencollada.clang.patch.0 | 22
external/opencollada/opencollada.libxml.patch.0 | 12
external/opencollada/patches/generatedsaxparser_utils_touri_fix.patch.1 | 35
external/opencollada/patches/opencollada.clang.patch.0 | 22
external/opencollada/patches/opencollada.libxml.patch.0 | 12
13 files changed, 8822 insertions(+), 8700 deletions(-)
New commits:
commit 6d80ca0e521dfb5cf3c3eda0658e2ca4b172067b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 15:59:34 2014 +0200
collada2gltf: move patches to an own folder
Change-Id: Ife28845af92883d8090bb80283c59a0a9a350b32
diff --git a/external/collada2gltf/UnpackedTarball_collada2gltf.mk b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
index 0ced364..a3ba218 100644
--- a/external/collada2gltf/UnpackedTarball_collada2gltf.mk
+++ b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
@@ -14,9 +14,9 @@ $(eval $(call gb_UnpackedTarball_set_tarball,collada2gltf,$(COLLADA2GLTF_TARBALL
$(eval $(call gb_UnpackedTarball_add_file,collada2gltf,.,external/collada2gltf/GitSHA1.cpp))
$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
- external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 \
- external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 \
- external/collada2gltf/wrong_uri_usage.patch.1 \
+ external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3 \
+ external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0 \
+ external/collada2gltf/patches/wrong_uri_usage.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 b/external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3
similarity index 100%
rename from external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3
rename to external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3
diff --git a/external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 b/external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0
similarity index 100%
rename from external/collada2gltf/write-only-.dae-file-which-we-need.patch.0
rename to external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0
diff --git a/external/collada2gltf/wrong_uri_usage.patch.1 b/external/collada2gltf/patches/wrong_uri_usage.patch.1
similarity index 100%
rename from external/collada2gltf/wrong_uri_usage.patch.1
rename to external/collada2gltf/patches/wrong_uri_usage.patch.1
commit 4a75abfa09b493d39dbff8ad1d6970a79f31b5d6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 15:56:19 2014 +0200
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
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index c3fa11e..a7237d5 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
diff --git a/external/collada2gltf/UnpackedTarball_collada2gltf.mk b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
index 3112cd9..0ced364 100644
--- a/external/collada2gltf/UnpackedTarball_collada2gltf.mk
+++ b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_add_file,collada2gltf,.,external/collada2gltf/G
$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 \
external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 \
+ external/collada2gltf/wrong_uri_usage.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/collada2gltf/wrong_uri_usage.patch.1 b/external/collada2gltf/wrong_uri_usage.patch.1
new file mode 100644
index 0000000..050fdaa
--- /dev/null
+++ b/external/collada2gltf/wrong_uri_usage.patch.1
@@ -0,0 +1,77 @@
+diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
+--- collada2gltf.org/GLTF/GLTFAsset.cpp 2014-05-22 11:12:21.823216900 +0200
++++ collada2gltf/GLTF/GLTFAsset.cpp 2014-05-22 14:59:04.963439700 +0200
+@@ -191,12 +191,9 @@
+ shared_ptr<GLTFOutputStream> GLTFAsset::createOutputStreamIfNeeded(const std::string& streamName) {
+
+ if (this->_nameToOutputStream.count(streamName) == 0) {
+- COLLADABU::URI inputURI(this->getInputFilePath().c_str());
+ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
+
+- std::string folder = outputURI.getPathDir();
+- std::string fileName = inputURI.getPathFileBase();
+-
++ std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
+ shared_ptr<GLTFOutputStream> outputStream = shared_ptr <GLTFOutputStream> (new GLTFOutputStream(folder, streamName, ""));
+ this->_nameToOutputStream[streamName] = outputStream;
+ }
+@@ -280,13 +277,13 @@
+ this->_bundleOutputPath = outputBundlePathURI.toNativePath();
+
+ COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
+- this->_outputFilePath = outputPathURI.toNativePath();
++ this->_outputFilePath = outputPathURI.getURIString();
+ // this->log("outputBundlePath:%s\n",outputBundlePathURI.toNativePath().c_str());
+ // this->log("outputPath:%s\n",outputPathURI.toNativePath().c_str());
+ } else {
+ this->_bundleOutputPath = outputBundlePathURI.toNativePath();
+ COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
+- this->_outputFilePath = outputPathURI.toNativePath();
++ this->_outputFilePath = outputPathURI.getURIString();
+ }
+ COLLADABU::Utils::createDirectoryIfNeeded(this->_bundleOutputPath.c_str());
+ }
+@@ -376,9 +373,9 @@
+ COLLADABU::URI outputImagePathURI(inputImagePath.c_str());
+
+ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
+- std::string folder = outputURI.getPathDir();
++ std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
+ std::string outputPath = folder + outputImagePathURI.getPathFile();
+-
++
+ std::ifstream f1(inputImagePath.c_str(), std::fstream::binary);
+ std::ofstream f2(outputPath.c_str(), std::fstream::binary);
+
+@@ -397,8 +394,8 @@
+ this->_root = shared_ptr <GLTF::JSONObject> (new GLTF::JSONObject());
+ this->_root->setString(kProfile, profile->id());
+ this->_root->createObjectIfNeeded(kNodes);
+-
+- this->_writer.initWithPath(this->getOutputFilePath().c_str());
++ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
++ this->_writer.initWithPath(outputURI.toNativePath().c_str());
+ }
+
+ static void __eval(JSONValue* value, void *context) {
+@@ -427,7 +424,7 @@
+ void GLTFAsset::_writeJSONResource(const std::string &path, shared_ptr<JSONObject> obj) {
+ GLTF::GLTFWriter resultsWriter;
+ COLLADABU::URI outputURI(this->resourceOuputPathForPath(path));
+- std::string aPath = this->getOutputFolderPath() + outputURI.getPathFile();
++ std::string aPath = COLLADABU::URI(this->getOutputFolderPath() + outputURI.getPathFile()).toNativePath();
+ resultsWriter.initWithPath(aPath);
+ obj->write(&resultsWriter);
+
+diff -ur collada2gltf.org/shaders/commonProfileShaders.cpp collada2gltf/shaders/commonProfileShaders.cpp
+--- collada2gltf.org/shaders/commonProfileShaders.cpp 2014-05-22 11:12:21.854416900 +0200
++++ collada2gltf/shaders/commonProfileShaders.cpp 2014-05-22 14:24:57.063126800 +0200
+@@ -294,7 +294,7 @@
+ //also write the file on disk
+ if (shaderString.size() > 0) {
+ COLLADABU::URI outputURI(asset->getOutputFilePath());
+- std::string shaderPath = outputURI.getPathDir() + path;
++ std::string shaderPath = COLLADABU::URI(outputURI.getPathDir()).toNativePath() + path;
+ GLTF::GLTFUtils::writeData(shaderPath, "w",(unsigned char*)shaderString.c_str(), shaderString.size());
+ if (!CONFIG_BOOL(asset, "outputProgress") && asset->converterConfig()->boolForKeyPath("verboseLogging")) {
+ asset->log("[shader]: %s\n", shaderPath.c_str());
commit 42530f5729363c2e524054f7b726d9ad4861c4bf
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 15:39:43 2014 +0200
opencollada: move patches to an own folder
Change-Id: I0b60fa5b0af8224b4c517367130aa9738f071531
diff --git a/external/opencollada/UnpackedTarball_opencollada.mk b/external/opencollada/UnpackedTarball_opencollada.mk
index 487a858..7670784 100644
--- a/external/opencollada/UnpackedTarball_opencollada.mk
+++ b/external/opencollada/UnpackedTarball_opencollada.mk
@@ -12,9 +12,9 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,opencollada))
$(eval $(call gb_UnpackedTarball_set_tarball,opencollada,$(OPENCOLLADA_TARBALL)))
$(eval $(call gb_UnpackedTarball_add_patches,opencollada,\
- external/opencollada/opencollada.clang.patch.0 \
- external/opencollada/opencollada.libxml.patch.0 \
- external/opencollada/generatedsaxparser_utils_touri_fix.patch.1 \
+ external/opencollada/patches/opencollada.clang.patch.0 \
+ external/opencollada/patches/opencollada.libxml.patch.0 \
+ external/opencollada/patches/generatedsaxparser_utils_touri_fix.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/opencollada/generatedsaxparser_utils_touri_fix.patch.1 b/external/opencollada/patches/generatedsaxparser_utils_touri_fix.patch.1
similarity index 100%
rename from external/opencollada/generatedsaxparser_utils_touri_fix.patch.1
rename to external/opencollada/patches/generatedsaxparser_utils_touri_fix.patch.1
diff --git a/external/opencollada/opencollada.clang.patch.0 b/external/opencollada/patches/opencollada.clang.patch.0
similarity index 100%
rename from external/opencollada/opencollada.clang.patch.0
rename to external/opencollada/patches/opencollada.clang.patch.0
diff --git a/external/opencollada/opencollada.libxml.patch.0 b/external/opencollada/patches/opencollada.libxml.patch.0
similarity index 100%
rename from external/opencollada/opencollada.libxml.patch.0
rename to external/opencollada/patches/opencollada.libxml.patch.0
commit 395bff144405002db6ae55282e538596188a8a44
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 15:36:32 2014 +0200
opencollada: uninitialized bool variable broke the parsing
GeneratedSaxParser::Utils:toURI() method has a bool output
parameter called failed, which is assumed to be set inside
the method before return. At some place the caller code does
not initialize the bool variable passed to this failed parameter
and so when the caller checkes the returned value it is
undefined.
e.g. it can be false when the method called successfully so
the error handling throws away the returned URI.
Change-Id: I3f90fab657a86b42bba0f492518e36c343e69d21
diff --git a/external/opencollada/UnpackedTarball_opencollada.mk b/external/opencollada/UnpackedTarball_opencollada.mk
index 579efc2..487a858 100644
--- a/external/opencollada/UnpackedTarball_opencollada.mk
+++ b/external/opencollada/UnpackedTarball_opencollada.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,opencollada,$(OPENCOLLADA_TARBALL))
$(eval $(call gb_UnpackedTarball_add_patches,opencollada,\
external/opencollada/opencollada.clang.patch.0 \
external/opencollada/opencollada.libxml.patch.0 \
+ external/opencollada/generatedsaxparser_utils_touri_fix.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/opencollada/generatedsaxparser_utils_touri_fix.patch.1 b/external/opencollada/generatedsaxparser_utils_touri_fix.patch.1
new file mode 100644
index 0000000..892d4b9
--- /dev/null
+++ b/external/opencollada/generatedsaxparser_utils_touri_fix.patch.1
@@ -0,0 +1,35 @@
+diff -ur opencollada.org/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp opencollada/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
+--- opencollada.org/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp 2014-05-22 15:24:25.437939696 +0200
++++ opencollada/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp 2014-05-22 15:24:50.769938623 +0200
+@@ -865,13 +865,14 @@
+ {
+ if ( *buffer == bufferEnd )
+ {
+- failed = false;
++ failed = true;
+ return COLLADABU::URI(0);
+ }
+ //Just get the string as it is for ids, so that we are able to read FBX-COLLADA
+ //Otherwise, calling toStringItem would result in a truncated string when an id contains spaces
+ //const ParserString& string = toStringListItem(buffer, bufferEnd, failed);
+ //return COLLADABU::URI(string.str, string.length);
++ failed = false;
+ return COLLADABU::URI((const char*)*buffer, bufferEnd - *buffer);
+ }
+
+@@ -880,13 +881,14 @@
+ {
+ if ( **buffer == '\0' )
+ {
+- failed = false;
++ failed = true;
+ return COLLADABU::URI(0);
+ }
+ //Just get the string as it is for ids, so that we are able to read FBX-COLLADA
+ //Otherwise, calling toStringItem would result in a truncated string when an id contains spaces
+ //const ParserString& string = toStringListItem(buffer, failed);
+ //return COLLADABU::URI(string.str, string.length);
++ failed = false;
+ return COLLADABU::URI((const char*)*buffer);
+ }
+
More information about the Libreoffice-commits
mailing list