summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RepositoryExternal.mk6
-rw-r--r--avmedia/Library_avmedia.mk5
-rw-r--r--avmedia/source/framework/modeltools.cxx9
-rw-r--r--config_host.mk.in1
-rw-r--r--config_host/config_features.h.in5
-rw-r--r--configure.ac23
-rw-r--r--include/avmedia/modeltools.hxx4
-rw-r--r--sd/source/ui/func/fuinsert.cxx9
8 files changed, 50 insertions, 12 deletions
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index b42dce252f53..cd991084ec35 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3324,6 +3324,8 @@ endef
endif # SYSTEN_LIBGLTF
+ifeq ($(ENABLE_COLLADA),TRUE)
+
define gb_LinkTarget__use_opencollada_parser
$(call gb_LinkTarget_set_include,$(1),\
-I$(call gb_UnpackedTarball_get_dir,opencollada)/COLLADABaseUtils/include \
@@ -3354,7 +3356,9 @@ $(call gb_LinkTarget_use_static_libraries,$(1),\
)
endef
-endif
+endif # ENABLE_COLLADA
+
+endif # ENABLE_GLTF
### Jars ############################################################
diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk
index 184c66c7d201..7cc08fac16ef 100644
--- a/avmedia/Library_avmedia.mk
+++ b/avmedia/Library_avmedia.mk
@@ -52,7 +52,7 @@ $(eval $(call gb_Library_add_exception_objects,avmedia,\
))
endif
-ifneq (,$(filter COLLADA2GLTF,$(BUILD_TYPE)))
+ifeq ($(ENABLE_COLLADA),TRUE)
$(eval $(call gb_Library_set_warnings_not_errors,avmedia))
ifeq ($(OS),LINUX)
@@ -68,9 +68,6 @@ $(eval $(call gb_Library_use_externals,avmedia,\
png \
))
-$(eval $(call gb_Library_add_defs,avmedia,\
- -DENABLE_COLLADA2GLTF \
-))
endif
$(eval $(call gb_Library_add_exception_objects,avmedia,\
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 6119cb71acbf..8c4251e32041 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -29,7 +29,9 @@
#include <boost/foreach.hpp>
#include <boost/optional.hpp>
-#ifdef ENABLE_COLLADA2GLTF
+#include <config_features.h>
+
+#if HAVE_FEATURE_COLLADA
#include <COLLADA2GLTFWriter.h>
#include <GLTFAsset.h>
#endif
@@ -42,7 +44,7 @@ using namespace boost::property_tree;
namespace avmedia {
-#ifdef ENABLE_COLLADA2GLTF
+#if HAVE_FEATURE_COLLADA
static void lcl_UnzipKmz(const OUString& rSourceURL, const OUString& rOutputFolderURL, OUString& o_rDaeFileURL)
{
@@ -242,7 +244,8 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
const OUString& rSourceURL, OUString& o_rEmbeddedURL)
{
OUString sSource = rSourceURL;
-#ifdef ENABLE_COLLADA2GLTF
+
+#if HAVE_FEATURE_COLLADA
if( !rSourceURL.endsWithIgnoreAsciiCase(".json") )
KmzDae2Gltf(rSourceURL, sSource);
#endif
diff --git a/config_host.mk.in b/config_host.mk.in
index aec0fa5dd429..36a686608cab 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -109,6 +109,7 @@ export ENABLE_CAIRO_CANVAS=@ENABLE_CAIRO_CANVAS@
export ENABLE_CHART_TESTS=@ENABLE_CHART_TESTS@
export ENABLE_CMIS=@ENABLE_CMIS@
export ENABLE_COINMP=@ENABLE_COINMP@
+export ENABLE_COLLADA=@ENABLE_COLLADA@
export ENABLE_CRASHDUMP=@ENABLE_CRASHDUMP@
export ENABLE_CUPS=@ENABLE_CUPS@
export ENABLE_CURL=@ENABLE_CURL@
diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 3fd1da5b5dce..f87ee277ebf1 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -142,4 +142,9 @@
*/
#define HAVE_FEATURE_GLTF 0
+/*
+ * Whether we have COLLADA support.
+ */
+#define HAVE_FEATURE_COLLADA 0
+
#endif
diff --git a/configure.ac b/configure.ac
index 63e067bb4e9c..b6e81245bb91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1395,6 +1395,10 @@ AC_ARG_ENABLE(gltf,
AS_HELP_STRING([--disable-gltf],
[Determines whether to build libraries related to glTF 3D model rendering.]))
+AC_ARG_ENABLE(collada,
+ AS_HELP_STRING([--disable-collada],
+ [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
+
dnl ===================================================================
dnl Optional Packages (--with/without-)
dnl ===================================================================
@@ -10572,10 +10576,6 @@ if test "x$enable_gltf" != "xno" -a $_os != Darwin -a $_os != iOS -a $_os != And
else
BUILD_TYPE="$BUILD_TYPE LIBGLTF"
fi
- # otherwise build fails in collada2gltf external because of std::shared_ptr
- if test "$have_std_shared_ptr" = "yes"; then
- BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
- fi
else
AC_MSG_RESULT([no])
fi
@@ -10584,6 +10584,21 @@ AC_SUBST(SYSTEM_LIBGLTF)
AC_SUBST(LIBGLTF_CFLAGS)
AC_SUBST(LIBGLTF_LIBS)
+dnl ===================================================================
+dnl Check whether to enable COLLADA support
+dnl ===================================================================
+AC_MSG_CHECKING([whether to enable COLLADA support])
+ENABLE_COLLADA=
+if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE" -a "$have_std_shared_ptr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ ENABLE_COLLADA=TRUE
+ AC_DEFINE(HAVE_FEATURE_COLLADA,1)
+ BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
+else
+ AC_MSG_RESULT([no])
+fi
+AC_SUBST(ENABLE_COLLADA)
+
# pdf import?
AC_MSG_CHECKING([whether to build the PDF import feature])
ENABLE_PDFIMPORT=
diff --git a/include/avmedia/modeltools.hxx b/include/avmedia/modeltools.hxx
index ed2de44cf64b..526b2403f6b3 100644
--- a/include/avmedia/modeltools.hxx
+++ b/include/avmedia/modeltools.hxx
@@ -11,9 +11,13 @@
#include <com/sun/star/frame/XModel.hpp>
#include <avmedia/avmediadllapi.h>
+#include <config_features.h>
+
namespace avmedia {
+#if HAVE_FEATURE_COLLADA
bool KmzDae2Gltf(const OUString& rSourceURL, OUString& o_rOutput);
+#endif
bool AVMEDIA_DLLPUBLIC Embed3DModel(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel,
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index cd0370011819..9c1c4ad5dcac 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -789,10 +789,19 @@ void FuInsert3DModel::DoExecute( SfxRequest& )
sfx2::FileDialogHelper aDlg( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
aDlg.SetTitle( "Insert 3D Model" );
+
+#if HAVE_FEATURE_COLLADA
aDlg.AddFilter( "All supported formats", "*.json;*.dae;*.kmz" );
+#else
+ aDlg.AddFilter( "All supported formats", "*.json" );
+#endif
+
aDlg.AddFilter( "JSON - GL Transmission Format", "*.json" );
+
+#if HAVE_FEATURE_COLLADA
aDlg.AddFilter( "DAE - COLLADA", "*.dae" );
aDlg.AddFilter( "KMZ - Keyhole Markup language Zipped", "*.kmz" );
+#endif
OUString sURL;
if( aDlg.Execute() == ERRCODE_NONE )