CMake: optionally disable OBJ, STL & GPencil SVG support
The following CMake options have been added (enabled by default), except for the lite build configuration. - WITH_IO_STL - WITH_IO_WAVEFRONT_OBJ - WITH_IO_GPENCIL (for grease pencil SVG importing). Note that it was already possible to disable grease pencil export by disabling WITH_PUGIXML & WITH_HARU. This is intended to keep the lite builds fast and small for building, linking & execution. Reviewed By: iyadahmed2001, aras_p, antoniov, mont29 Ref D15141
This commit is contained in:
parent
a1d2efd190
commit
8edd1d8aa5
|
@ -300,6 +300,9 @@ option(WITH_USD "Enable Universal Scene Description (USD) Suppor
|
|||
# 3D format support
|
||||
# Disable opencollada when we don't have precompiled libs
|
||||
option(WITH_OPENCOLLADA "Enable OpenCollada Support (http://www.opencollada.org)" ON)
|
||||
option(WITH_IO_WAVEFRONT_OBJ "Enable Wavefront-OBJ 3D file format support (*.obj)" ON)
|
||||
option(WITH_IO_STL "Enable STL 3D file format support (*.stl)" ON)
|
||||
option(WITH_IO_GPENCIL "Enable grease-pencil file format IO (*.svg, *.pdf)" ON)
|
||||
|
||||
# Sound output
|
||||
option(WITH_SDL "Enable SDL for sound" ON)
|
||||
|
|
|
@ -37,6 +37,9 @@ set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
|
|||
set(WITH_IMAGE_WEBP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_STL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_WAVEFRONT_OBJ OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_GPENCIL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_JACK OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -453,9 +453,13 @@ class TOPBAR_MT_file_import(Menu):
|
|||
self.layout.operator(
|
||||
"wm.usd_import", text="Universal Scene Description (.usd, .usdc, .usda)")
|
||||
|
||||
self.layout.operator("wm.gpencil_import_svg", text="SVG as Grease Pencil")
|
||||
self.layout.operator("wm.obj_import", text="Wavefront (.obj) (experimental)")
|
||||
self.layout.operator("wm.stl_import", text="STL (.stl) (experimental)")
|
||||
if bpy.app.build_options.io_gpencil:
|
||||
self.layout.operator("wm.gpencil_import_svg", text="SVG as Grease Pencil")
|
||||
|
||||
if bpy.app.build_options.io_wavefront_obj:
|
||||
self.layout.operator("wm.obj_import", text="Wavefront (.obj) (experimental)")
|
||||
if bpy.app.build_options.io_stl:
|
||||
self.layout.operator("wm.stl_import", text="STL (.stl) (experimental)")
|
||||
|
||||
|
||||
class TOPBAR_MT_file_export(Menu):
|
||||
|
@ -472,14 +476,16 @@ class TOPBAR_MT_file_export(Menu):
|
|||
self.layout.operator(
|
||||
"wm.usd_export", text="Universal Scene Description (.usd, .usdc, .usda)")
|
||||
|
||||
# Pugixml lib dependency
|
||||
if bpy.app.build_options.pugixml:
|
||||
self.layout.operator("wm.gpencil_export_svg", text="Grease Pencil as SVG")
|
||||
# Haru lib dependency
|
||||
if bpy.app.build_options.haru:
|
||||
self.layout.operator("wm.gpencil_export_pdf", text="Grease Pencil as PDF")
|
||||
if bpy.app.build_options.io_gpencil:
|
||||
# Pugixml lib dependency
|
||||
if bpy.app.build_options.pugixml:
|
||||
self.layout.operator("wm.gpencil_export_svg", text="Grease Pencil as SVG")
|
||||
# Haru lib dependency
|
||||
if bpy.app.build_options.haru:
|
||||
self.layout.operator("wm.gpencil_export_pdf", text="Grease Pencil as PDF")
|
||||
|
||||
self.layout.operator("wm.obj_export", text="Wavefront (.obj) (experimental)")
|
||||
if bpy.app.build_options.io_wavefront_obj:
|
||||
self.layout.operator("wm.obj_export", text="Wavefront (.obj) (experimental)")
|
||||
|
||||
|
||||
class TOPBAR_MT_file_external_data(Menu):
|
||||
|
|
|
@ -49,8 +49,6 @@ set(SRC
|
|||
set(LIB
|
||||
bf_blenkernel
|
||||
bf_blenlib
|
||||
bf_wavefront_obj
|
||||
bf_stl
|
||||
)
|
||||
|
||||
if(WITH_OPENCOLLADA)
|
||||
|
@ -60,6 +58,27 @@ if(WITH_OPENCOLLADA)
|
|||
add_definitions(-DWITH_COLLADA)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_WAVEFRONT_OBJ)
|
||||
list(APPEND LIB
|
||||
bf_wavefront_obj
|
||||
)
|
||||
add_definitions(-DWITH_IO_WAVEFRONT_OBJ)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_STL)
|
||||
list(APPEND LIB
|
||||
bf_stl
|
||||
)
|
||||
add_definitions(-DWITH_IO_STL)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_GPENCIL)
|
||||
list(APPEND LIB
|
||||
bf_gpencil
|
||||
)
|
||||
add_definitions(-DWITH_IO_GPENCIL)
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
list(APPEND LIB
|
||||
bf_alembic
|
||||
|
@ -82,6 +101,4 @@ if(WITH_HARU)
|
|||
add_definitions(-DWITH_HARU)
|
||||
endif()
|
||||
|
||||
list(APPEND LIB bf_gpencil)
|
||||
|
||||
blender_add_lib(bf_editor_io "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
|
|
|
@ -5,36 +5,38 @@
|
|||
* \ingroup editor/io
|
||||
*/
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
#ifdef WITH_IO_GPENCIL
|
||||
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
# include "BLI_path_util.h"
|
||||
# include "BLI_string.h"
|
||||
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_screen.h"
|
||||
# include "DNA_gpencil_types.h"
|
||||
# include "DNA_space_types.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
# include "BKE_gpencil.h"
|
||||
# include "BKE_main.h"
|
||||
# include "BKE_report.h"
|
||||
# include "BKE_screen.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
# include "BLT_translation.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
# include "RNA_access.h"
|
||||
# include "RNA_define.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
# include "UI_interface.h"
|
||||
# include "UI_resources.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
# include "WM_api.h"
|
||||
# include "WM_types.h"
|
||||
|
||||
#include "io_gpencil.h"
|
||||
# include "DEG_depsgraph.h"
|
||||
# include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "gpencil_io.h"
|
||||
# include "io_gpencil.h"
|
||||
|
||||
#if defined(WITH_PUGIXML) || defined(WITH_HARU)
|
||||
# include "gpencil_io.h"
|
||||
|
||||
# if defined(WITH_PUGIXML) || defined(WITH_HARU)
|
||||
/* Definition of enum elements to export. */
|
||||
/* Common props for exporting. */
|
||||
static void gpencil_export_common_props_definition(wmOperatorType *ot)
|
||||
|
@ -87,10 +89,10 @@ static void set_export_filepath(bContext *C, wmOperator *op, const char *extensi
|
|||
RNA_string_set(op->ptr, "filepath", filepath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* <-------- SVG single frame export. --------> */
|
||||
#ifdef WITH_PUGIXML
|
||||
# ifdef WITH_PUGIXML
|
||||
static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
char filepath[FILE_MAX];
|
||||
|
@ -241,10 +243,10 @@ void WM_OT_gpencil_export_svg(wmOperatorType *ot)
|
|||
"Clip Camera",
|
||||
"Clip drawings to camera size when export in camera view");
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* <-------- PDF single frame export. --------> */
|
||||
#ifdef WITH_HARU
|
||||
# ifdef WITH_HARU
|
||||
static bool wm_gpencil_export_pdf_common_check(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
|
||||
|
@ -406,4 +408,6 @@ void WM_OT_gpencil_export_pdf(wmOperatorType *ot)
|
|||
"Frames",
|
||||
"Which frames to include in the export");
|
||||
}
|
||||
#endif
|
||||
# endif /* WITH_HARU */
|
||||
|
||||
#endif /* WITH_IO_GPENCIL */
|
||||
|
|
|
@ -5,34 +5,36 @@
|
|||
* \ingroup editor/io
|
||||
*/
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
#ifdef WITH_IO_GPENCIL
|
||||
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
# include "BLI_path_util.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_report.h"
|
||||
# include "DNA_gpencil_types.h"
|
||||
# include "DNA_space_types.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
# include "BKE_context.h"
|
||||
# include "BKE_gpencil.h"
|
||||
# include "BKE_report.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
# include "BLT_translation.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
# include "RNA_access.h"
|
||||
# include "RNA_define.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
# include "UI_interface.h"
|
||||
# include "UI_resources.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
# include "WM_api.h"
|
||||
# include "WM_types.h"
|
||||
|
||||
#include "ED_gpencil.h"
|
||||
# include "DEG_depsgraph.h"
|
||||
# include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "io_gpencil.h"
|
||||
# include "ED_gpencil.h"
|
||||
|
||||
#include "gpencil_io.h"
|
||||
# include "io_gpencil.h"
|
||||
|
||||
# include "gpencil_io.h"
|
||||
|
||||
/* <-------- SVG single frame import. --------> */
|
||||
static bool wm_gpencil_import_svg_common_check(bContext *UNUSED(C), wmOperator *op)
|
||||
|
@ -174,3 +176,5 @@ void WM_OT_gpencil_import_svg(wmOperatorType *ot)
|
|||
0.001f,
|
||||
100.0f);
|
||||
}
|
||||
|
||||
#endif /* WITH_IO_GPENCIL */
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
* \ingroup editor/io
|
||||
*/
|
||||
|
||||
#include "DNA_space_types.h"
|
||||
#ifdef WITH_IO_GPENCIL
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
# include "DNA_space_types.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
# include "BKE_context.h"
|
||||
# include "BKE_screen.h"
|
||||
|
||||
#include "io_gpencil.h"
|
||||
# include "WM_api.h"
|
||||
|
||||
# include "io_gpencil.h"
|
||||
|
||||
ARegion *get_invoke_region(bContext *C)
|
||||
{
|
||||
|
@ -46,3 +48,5 @@ View3D *get_invoke_view3d(bContext *C)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* WITH_IO_GPENCIL */
|
||||
|
|
|
@ -4,37 +4,39 @@
|
|||
* \ingroup editor/io
|
||||
*/
|
||||
|
||||
#include "DNA_space_types.h"
|
||||
#ifdef WITH_IO_WAVEFRONT_OBJ
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_report.h"
|
||||
# include "DNA_space_types.h"
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
# include "BKE_context.h"
|
||||
# include "BKE_main.h"
|
||||
# include "BKE_report.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
# include "BLI_path_util.h"
|
||||
# include "BLI_string.h"
|
||||
# include "BLI_utildefines.h"
|
||||
|
||||
#include "ED_outliner.h"
|
||||
# include "BLT_translation.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
# include "ED_outliner.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
# include "MEM_guardedalloc.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
# include "RNA_access.h"
|
||||
# include "RNA_define.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
# include "UI_interface.h"
|
||||
# include "UI_resources.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
# include "WM_api.h"
|
||||
# include "WM_types.h"
|
||||
|
||||
#include "IO_orientation.h"
|
||||
#include "IO_path_util_types.h"
|
||||
#include "IO_wavefront_obj.h"
|
||||
#include "io_obj.h"
|
||||
# include "DEG_depsgraph.h"
|
||||
|
||||
# include "IO_orientation.h"
|
||||
# include "IO_path_util_types.h"
|
||||
# include "IO_wavefront_obj.h"
|
||||
# include "io_obj.h"
|
||||
|
||||
static const EnumPropertyItem io_obj_export_evaluation_mode[] = {
|
||||
{DAG_EVAL_RENDER, "DAG_EVAL_RENDER", 0, "Render", "Export objects as they appear in render"},
|
||||
|
@ -472,3 +474,5 @@ void WM_OT_obj_import(struct wmOperatorType *ot)
|
|||
prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
}
|
||||
|
||||
#endif /* WITH_IO_WAVEFRONT_OBJ */
|
||||
|
|
|
@ -42,14 +42,14 @@ void ED_operatortypes_io(void)
|
|||
WM_operatortype_append(WM_OT_usd_export);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_IO_GPENCIL
|
||||
WM_operatortype_append(WM_OT_gpencil_import_svg);
|
||||
|
||||
#ifdef WITH_PUGIXML
|
||||
# ifdef WITH_PUGIXML
|
||||
WM_operatortype_append(WM_OT_gpencil_export_svg);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_HARU
|
||||
# endif
|
||||
# ifdef WITH_HARU
|
||||
WM_operatortype_append(WM_OT_gpencil_export_pdf);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
WM_operatortype_append(CACHEFILE_OT_open);
|
||||
|
@ -59,8 +59,12 @@ void ED_operatortypes_io(void)
|
|||
WM_operatortype_append(CACHEFILE_OT_layer_remove);
|
||||
WM_operatortype_append(CACHEFILE_OT_layer_move);
|
||||
|
||||
#ifdef WITH_IO_WAVEFRONT_OBJ
|
||||
WM_operatortype_append(WM_OT_obj_export);
|
||||
WM_operatortype_append(WM_OT_obj_import);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_IO_STL
|
||||
WM_operatortype_append(WM_OT_stl_import);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -4,21 +4,23 @@
|
|||
* \ingroup editor/io
|
||||
*/
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_report.h"
|
||||
#ifdef WITH_IO_STL
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
# include "BKE_context.h"
|
||||
# include "BKE_report.h"
|
||||
|
||||
#include "DNA_space_types.h"
|
||||
# include "WM_api.h"
|
||||
# include "WM_types.h"
|
||||
|
||||
#include "ED_outliner.h"
|
||||
# include "DNA_space_types.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
# include "ED_outliner.h"
|
||||
|
||||
#include "IO_stl.h"
|
||||
#include "io_stl_ops.h"
|
||||
# include "RNA_access.h"
|
||||
# include "RNA_define.h"
|
||||
|
||||
# include "IO_stl.h"
|
||||
# include "io_stl_ops.h"
|
||||
|
||||
static int wm_stl_import_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
|
@ -127,3 +129,5 @@ void WM_OT_stl_import(struct wmOperatorType *ot)
|
|||
prop = RNA_def_string(ot->srna, "filter_glob", "*.stl", 0, "Extension Filter", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
}
|
||||
|
||||
#endif /* WITH_IO_STL */
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright 2020 Blender Foundation. All rights reserved.
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(wavefront_obj)
|
||||
add_subdirectory(stl)
|
||||
if(WITH_IO_WAVEFRONT_OBJ OR WITH_IO_STL OR WITH_IO_GPENCIL OR WITH_ALEMBIC OR WITH_USD)
|
||||
add_subdirectory(common)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_WAVEFRONT_OBJ)
|
||||
add_subdirectory(wavefront_obj)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_STL)
|
||||
add_subdirectory(stl)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_GPENCIL)
|
||||
add_subdirectory(gpencil)
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
add_subdirectory(alembic)
|
||||
|
@ -20,5 +32,3 @@ endif()
|
|||
if(WITH_USD)
|
||||
add_subdirectory(usd)
|
||||
endif()
|
||||
|
||||
add_subdirectory(gpencil)
|
||||
|
|
|
@ -310,6 +310,18 @@ if(WITH_OPENCOLLADA)
|
|||
add_definitions(-DWITH_COLLADA)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_WAVEFRONT_OBJ)
|
||||
add_definitions(-DWITH_IO_WAVEFRONT_OBJ)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_STL)
|
||||
add_definitions(-DWITH_IO_STL)
|
||||
endif()
|
||||
|
||||
if(WITH_IO_GPENCIL)
|
||||
add_definitions(-DWITH_IO_GPENCIL)
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
add_definitions(-DWITH_ALEMBIC)
|
||||
endif()
|
||||
|
|
|
@ -43,6 +43,9 @@ static PyStructSequence_Field app_builtopts_info_fields[] = {
|
|||
{"mod_oceansim", NULL},
|
||||
{"mod_remesh", NULL},
|
||||
{"collada", NULL},
|
||||
{"io_wavefront_obj", NULL},
|
||||
{"io_stl", NULL},
|
||||
{"io_gpencil", NULL},
|
||||
{"opencolorio", NULL},
|
||||
{"openmp", NULL},
|
||||
{"openvdb", NULL},
|
||||
|
@ -251,6 +254,24 @@ static PyObject *make_builtopts_info(void)
|
|||
SetObjIncref(Py_False);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_IO_WAVEFRONT_OBJ
|
||||
SetObjIncref(Py_True);
|
||||
#else
|
||||
SetObjIncref(Py_False);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_IO_STL
|
||||
SetObjIncref(Py_True);
|
||||
#else
|
||||
SetObjIncref(Py_False);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_IO_GPENCIL
|
||||
SetObjIncref(Py_True);
|
||||
#else
|
||||
SetObjIncref(Py_False);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OCIO
|
||||
SetObjIncref(Py_True);
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue