Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
0bd49edc
Kaydet (Commit)
0bd49edc
authored
May 12, 2014
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use collada2gltf to open .dae files and convert them to .json.
Change-Id: Idb70da1db2516eeb6d518b39eb732a7e7d0a14ab
üst
d5759170
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
3 deletions
+45
-3
Library_avmedia.mk
avmedia/Library_avmedia.mk
+15
-0
modeltools.cxx
avmedia/source/framework/modeltools.cxx
+30
-3
No files found.
avmedia/Library_avmedia.mk
Dosyayı görüntüle @
0bd49edc
...
@@ -46,6 +46,21 @@ $(eval $(call gb_Library_use_libraries,avmedia,\
...
@@ -46,6 +46,21 @@ $(eval $(call gb_Library_use_libraries,avmedia,\
$(gb_UWINAPI) \
$(gb_UWINAPI) \
))
))
ifneq (,$(filter COLLADA2GLTF,$(BUILD_TYPE)))
$(eval $(call gb_Library_set_warnings_not_errors,avmedia))
$(eval $(call gb_Library_use_externals,avmedia,\
collada2gltf \
libxml2 \
opencollada_parser \
png \
))
$(eval $(call gb_Library_add_defs,avmedia,\
-DENABLE_COLLADA2GLTF \
))
endif
$(eval $(call gb_Library_add_exception_objects,avmedia,\
$(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/framework/mediacontrol \
avmedia/source/framework/mediacontrol \
avmedia/source/framework/mediaitem \
avmedia/source/framework/mediaitem \
...
...
avmedia/source/framework/modeltools.cxx
Dosyayı görüntüle @
0bd49edc
...
@@ -19,11 +19,18 @@
...
@@ -19,11 +19,18 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <tools/urlobj.hxx>
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/content.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/tempfile.hxx>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
#ifdef ENABLE_COLLADA2GLTF
#include <COLLADA2GLTFWriter.h>
#include <GLTFAsset.h>
#endif
#include <string>
#include <string>
#include <vector>
#include <vector>
...
@@ -130,9 +137,29 @@ static void lcl_EmbedExternals(const OUString& rSourceURL, uno::Reference<embed:
...
@@ -130,9 +137,29 @@ static void lcl_EmbedExternals(const OUString& rSourceURL, uno::Reference<embed:
bool
Embed3DModel
(
const
uno
::
Reference
<
frame
::
XModel
>&
xModel
,
bool
Embed3DModel
(
const
uno
::
Reference
<
frame
::
XModel
>&
xModel
,
const
OUString
&
rSourceURL
,
OUString
&
o_rEmbeddedURL
)
const
OUString
&
rSourceURL
,
OUString
&
o_rEmbeddedURL
)
{
{
OUString
sSource
=
rSourceURL
;
#ifdef ENABLE_COLLADA2GLTF
if
(
rSourceURL
.
endsWith
(
"dae"
))
{
OUString
sName
=
::
utl
::
TempFile
::
CreateTempName
();
// 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
->
setBundleOutputPath
(
OUStringToOString
(
sName
,
RTL_TEXTENCODING_UTF8
).
getStr
());
GLTF
::
COLLADA2GLTFWriter
writer
(
asset
);
writer
.
write
();
// Path to the .json file created by COLLADA2GLTFWriter
::
utl
::
LocalFileHelper
::
ConvertPhysicalNameToURL
(
sName
+
"/"
+
GetFilename
(
sName
)
+
".json"
,
sSource
);
}
#endif
try
try
{
{
::
ucbhelper
::
Content
aSourceContent
(
rSourceURL
,
::
ucbhelper
::
Content
aSourceContent
(
sSource
,
uno
::
Reference
<
ucb
::
XCommandEnvironment
>
(),
uno
::
Reference
<
ucb
::
XCommandEnvironment
>
(),
comphelper
::
getProcessComponentContext
());
comphelper
::
getProcessComponentContext
());
...
@@ -148,13 +175,13 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
...
@@ -148,13 +175,13 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
xStorage
->
openStorageElement
(
sModel
,
embed
::
ElementModes
::
WRITE
));
xStorage
->
openStorageElement
(
sModel
,
embed
::
ElementModes
::
WRITE
));
// Own storage of the corresponding model
// Own storage of the corresponding model
const
OUString
sFilename
(
GetFilename
(
rSourceURL
));
const
OUString
sFilename
(
GetFilename
(
sSource
));
const
OUString
sGLTFDir
(
sFilename
.
copy
(
0
,
sFilename
.
lastIndexOf
(
'.'
)));
const
OUString
sGLTFDir
(
sFilename
.
copy
(
0
,
sFilename
.
lastIndexOf
(
'.'
)));
uno
::
Reference
<
embed
::
XStorage
>
const
xSubStorage
(
uno
::
Reference
<
embed
::
XStorage
>
const
xSubStorage
(
xModelStorage
->
openStorageElement
(
sGLTFDir
,
embed
::
ElementModes
::
WRITE
));
xModelStorage
->
openStorageElement
(
sGLTFDir
,
embed
::
ElementModes
::
WRITE
));
// Embed external resources
// Embed external resources
lcl_EmbedExternals
(
rSourceURL
,
xSubStorage
,
aSourceContent
);
lcl_EmbedExternals
(
sSource
,
xSubStorage
,
aSourceContent
);
// Save model file (.json)
// Save model file (.json)
uno
::
Reference
<
io
::
XStream
>
const
xStream
(
uno
::
Reference
<
io
::
XStream
>
const
xStream
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment