[Bf-blender-cvs] [61050f7] master: Basic Alembic support

Kévin Dietrich noreply at git.blender.org
Sat Aug 6 11:00:20 CEST 2016


Commit: 61050f75b13ef706d3a80b86137436d3fb0bfa93
Author: Kévin Dietrich
Date:   Sat Aug 6 06:20:37 2016 +0200
Branches: master
https://developer.blender.org/rB61050f75b13ef706d3a80b86137436d3fb0bfa93

Basic Alembic support

All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.

A more in-depth documentation is to be found on the wiki, as well as a
 guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.

Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.

Reviewers: sergey, campbellbarton, mont29

Reviewed By: sergey, campbellbarton, mont29

Differential Revision: https://developer.blender.org/D2060

===================================================================

M	CMakeLists.txt
M	build_files/build_environment/install_deps.sh
A	build_files/cmake/Modules/FindAlembic.cmake
A	build_files/cmake/Modules/FindHDF5.cmake
M	build_files/cmake/config/blender_full.cmake
M	build_files/cmake/config/blender_lite.cmake
M	build_files/cmake/config/bpy_module.cmake
M	build_files/cmake/macros.cmake
M	release/scripts/modules/sys_info.py
M	release/scripts/startup/bl_ui/properties_constraint.py
M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	release/scripts/startup/bl_ui/space_info.py
M	source/blender/CMakeLists.txt
A	source/blender/alembic/ABC_alembic.h
A	source/blender/alembic/CMakeLists.txt
A	source/blender/alembic/intern/abc_camera.cc
A	source/blender/alembic/intern/abc_camera.h
A	source/blender/alembic/intern/abc_curves.cc
A	source/blender/alembic/intern/abc_curves.h
A	source/blender/alembic/intern/abc_customdata.cc
A	source/blender/alembic/intern/abc_customdata.h
A	source/blender/alembic/intern/abc_exporter.cc
A	source/blender/alembic/intern/abc_exporter.h
A	source/blender/alembic/intern/abc_hair.cc
A	source/blender/alembic/intern/abc_hair.h
A	source/blender/alembic/intern/abc_mesh.cc
A	source/blender/alembic/intern/abc_mesh.h
A	source/blender/alembic/intern/abc_nurbs.cc
A	source/blender/alembic/intern/abc_nurbs.h
A	source/blender/alembic/intern/abc_object.cc
A	source/blender/alembic/intern/abc_object.h
A	source/blender/alembic/intern/abc_points.cc
A	source/blender/alembic/intern/abc_points.h
A	source/blender/alembic/intern/abc_transform.cc
A	source/blender/alembic/intern/abc_transform.h
A	source/blender/alembic/intern/abc_util.cc
A	source/blender/alembic/intern/abc_util.h
A	source/blender/alembic/intern/alembic_capi.cc
A	source/blender/blenkernel/BKE_cachefile.h
M	source/blender/blenkernel/BKE_context.h
M	source/blender/blenkernel/BKE_library.h
M	source/blender/blenkernel/BKE_main.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/blenkernel/intern/bpath.c
A	source/blender/blenkernel/intern/cachefile.c
M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/context.c
M	source/blender/blenkernel/intern/depsgraph.c
M	source/blender/blenkernel/intern/idcode.c
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenkernel/intern/library_query.c
M	source/blender/blenkernel/intern/library_remap.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/CMakeLists.txt
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/blentranslation/BLT_translation.h
M	source/blender/depsgraph/DEG_depsgraph_build.h
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
M	source/blender/depsgraph/intern/depsgraph_build.cc
M	source/blender/depsgraph/intern/depsgraph_types.h
M	source/blender/depsgraph/intern/nodes/deg_node_component.cc
M	source/blender/depsgraph/intern/nodes/deg_node_component.h
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_channels_edit.c
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/include/ED_anim_api.h
M	source/blender/editors/include/ED_keyframes_draw.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/io/CMakeLists.txt
A	source/blender/editors/io/io_alembic.c
A	source/blender/editors/io/io_alembic.h
A	source/blender/editors/io/io_cache.c
A	source/blender/editors/io/io_cache.h
M	source/blender/editors/io/io_ops.c
M	source/blender/editors/object/object_constraint.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/editors/space_nla/nla_buttons.c
M	source/blender/editors/space_nla/nla_channels.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesdna/DNA_action_types.h
A	source/blender/makesdna/DNA_cachefile_types.h
M	source/blender/makesdna/DNA_constraint_types.h
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_ID.c
A	source/blender/makesrna/intern/rna_cachefile.c
M	source/blender/makesrna/intern/rna_constraint.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_main.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_scene_api.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_ui_api.c
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/MOD_modifiertypes.h
A	source/blender/modifiers/intern/MOD_meshsequencecache.c
M	source/blender/modifiers/intern/MOD_util.c
M	source/blender/python/intern/CMakeLists.txt
M	source/blender/python/intern/bpy_app.c
A	source/blender/python/intern/bpy_app_alembic.c
A	source/blender/python/intern/bpy_app_alembic.h
M	source/blender/python/intern/bpy_app_build_options.c
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/intern/wm_operator_props.c
M	source/blenderplayer/CMakeLists.txt
M	source/blenderplayer/bad_level_call_stubs/stubs.c

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1dfa838..d291628 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -323,6 +323,10 @@ option(WITH_CODEC_AVI           "Enable Blenders own AVI file support (raw/jpeg)
 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" ${_init_CODEC_FFMPEG})
 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 
+# Alembic support
+option(WITH_ALEMBIC             "Enable Alembic Support" OFF)
+option(WITH_ALEMBIC_HDF5        "Enable Legacy Alembic Support (not officially supported)" OFF)
+
 if(APPLE)
 	option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" ON)
 endif()
@@ -720,6 +724,11 @@ if(WITH_OPENIMAGEIO)
 	set(WITH_IMAGE_TIFF ON)
 endif()
 
+# auto enable alembic linking dependencies
+if(WITH_ALEMBIC)
+	set(WITH_IMAGE_OPENEXR ON)
+endif()
+
 # don't store paths to libs for portable distribution
 if(WITH_INSTALL_PORTABLE)
 	set(CMAKE_SKIP_BUILD_RPATH TRUE)
@@ -1091,6 +1100,21 @@ if(UNIX AND NOT APPLE)
 		endif()
 	endif()
 
+	if(WITH_ALEMBIC)
+		set(ALEMBIC_ROOT_DIR ${LIBDIR}/alembic)
+		find_package_wrapper(Alembic)
+
+		if(WITH_ALEMBIC_HDF5)
+			set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
+			find_package_wrapper(HDF5)
+		endif()
+
+		if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
+			set(WITH_ALEMBIC OFF)
+			set(WITH_ALEMBIC_HDF5 OFF)
+		endif()
+	endif()
+
 	if(WITH_BOOST)
 		# uses in build instructions to override include and library variables
 		if(NOT BOOST_CUSTOM)
@@ -1660,6 +1684,21 @@ elseif(WIN32)
 			set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
 		endif()
 
+		if(WITH_ALEMBIC)
+			set(ALEMBIC_ROOT_DIR ${LIBDIR}/alembic)
+			find_package(Alembic)
+
+			if(WITH_ALEMBIC_HDF5)
+				set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
+				find_package(HDF5)
+			endif()
+
+			if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
+				set(WITH_ALEMBIC OFF)
+				set(WITH_ALEMBIC_HDF5 OFF)
+			endif()
+		endif()
+
 		if(WITH_MOD_CLOTH_ELTOPO)
 			set(LAPACK ${LIBDIR}/lapack)
 			# set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
@@ -1959,6 +1998,21 @@ elseif(WIN32)
 			set(OPENVDB_DEFINITIONS)
 		endif()
 
+		if(WITH_ALEMBIC)
+			set(ALEMBIC_ROOT_DIR ${LIBDIR}/alembic)
+			find_package_wrapper(Alembic)
+
+			if(WITH_ALEMBIC_HDF5)
+				set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
+				find_package_wrapper(HDF5)
+			endif()
+
+			if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
+				set(WITH_ALEMBIC OFF)
+				set(WITH_ALEMBIC_HDF5 OFF)
+			endif()
+		endif()
+
 		set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
 
 		## DISABLE - causes linking errors 
@@ -2043,6 +2097,20 @@ elseif(APPLE)
 		endif()
 	endif()
 
+	if(WITH_ALEMBIC)
+		set(ALEMBIC_ROOT_DIR ${LIBDIR}/alembic)
+		find_package(Alembic)
+		if(WITH_ALEMBIC_HDF5)
+			set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
+			find_package(HDF5)
+		endif()
+
+		if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
+			set(WITH_ALEMBIC OFF)
+			set(WITH_ALEMBIC_HDF5 OFF)
+		endif()
+	endif()
+
 	if(WITH_OPENSUBDIV)
 		set(OPENSUBDIV ${LIBDIR}/opensubdiv)
 		set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
@@ -3215,6 +3283,7 @@ if(FIRST_RUN)
 	info_cfg_option(WITH_FREESTYLE)
 	info_cfg_option(WITH_OPENCOLORIO)
 	info_cfg_option(WITH_OPENVDB)
+	info_cfg_option(WITH_ALEMBIC)
 
 	info_cfg_text("Compiler Options:")
 	info_cfg_option(WITH_BUILDINFO)
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 068ac66..7230fc4 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -29,13 +29,13 @@ getopt \
 ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
 force-all,force-python,force-numpy,force-boost,\
 force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
-force-ffmpeg,force-opencollada,\
+force-ffmpeg,force-opencollada,force-alembic,\
 build-all,build-python,build-numpy,build-boost,\
 build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
-build-ffmpeg,build-opencollada,\
+build-ffmpeg,build-opencollada,build-alembic,\
 skip-python,skip-numpy,skip-boost,\
 skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
-skip-ffmpeg,skip-opencollada \
+skip-ffmpeg,skip-opencollada,skip-alembic \
 -- "$@" \
 )
 
@@ -167,6 +167,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --build-openvdb
         Force the build of OpenVDB.
 
+    --build-alembic
+        Force the build of Alembic.
+
     --build-opencollada
         Force the build of OpenCOLLADA.
 
@@ -216,6 +219,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --force-openvdb
         Force the rebuild of OpenVDB.
 
+    --force-alembic
+        Force the rebuild of Alembic.
+
     --force-opencollada
         Force the rebuild of OpenCOLLADA.
 
@@ -258,6 +264,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --skip-openvdb
         Unconditionally skip OpenVDB installation/building.
 
+    --skip-alembic
+        Unconditionally skip Alembic installation/building.
+
     --skip-opencollada
         Unconditionally skip OpenCOLLADA installation/building.
 
@@ -343,6 +352,13 @@ OPENVDB_FORCE_BUILD=false
 OPENVDB_FORCE_REBUILD=false
 OPENVDB_SKIP=false
 
+# Alembic needs to be compiled for now
+ALEMBIC_VERSION="1.6.0"
+ALEMBIC_VERSION_MIN=$ALEMBIC_VERSION
+ALEMBIC_FORCE_BUILD=false
+ALEMBIC_FORCE_REBUILD=false
+ALEMBIC_SKIP=false
+
 # Version??
 OPENCOLLADA_VERSION="1.3"
 OPENCOLLADA_FORCE_BUILD=false
@@ -525,6 +541,7 @@ while true; do
       OPENVDB_FORCE_BUILD=true
       OPENCOLLADA_FORCE_BUILD=true
       FFMPEG_FORCE_BUILD=true
+      ALEMBIC_FORCE_BUILD=true
       shift; continue
     ;;
     --build-python)
@@ -567,6 +584,9 @@ while true; do
     --build-ffmpeg)
       FFMPEG_FORCE_BUILD=true; shift; continue
     ;;
+    --build-alembic)
+      ALEMBIC_FORCE_BUILD=true; shift; continue
+    ;;
     --force-all)
       PYTHON_FORCE_REBUILD=true
       NUMPY_FORCE_REBUILD=true
@@ -580,6 +600,7 @@ while true; do
       OPENVDB_FORCE_REBUILD=true
       OPENCOLLADA_FORCE_REBUILD=true
       FFMPEG_FORCE_REBUILD=true
+      ALEMBIC_FORCE_REBUILD=true
       shift; continue
     ;;
     --force-python)
@@ -620,6 +641,9 @@ while true; do
     --force-ffmpeg)
       FFMPEG_FORCE_REBUILD=true; shift; continue
     ;;
+    --force-alembic)
+      ALEMBIC_FORCE_REBUILD=true; shift; continue
+    ;;
     --skip-python)
       PYTHON_SKIP=true; shift; continue
     ;;
@@ -656,6 +680,9 @@ while true; do
     --skip-ffmpeg)
       FFMPEG_SKIP=true; shift; continue
     ;;
+    --skip-alembic)
+      ALEMBIC_SKIP=true; shift; continue
+    ;;
     --)
       # no more arguments to parse
       break
@@ -683,7 +710,7 @@ NUMPY_SOURCE=( "http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION
 
 _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
 BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
-BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams"
+BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options"
 
 OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
 
@@ -727,6 +754,12 @@ OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPEN
 #~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
 #~ OPENVDB_SOURCE_REPO_BRANCH="dev"
 
+ALEMBIC_USE_REPO=false
+ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" )
+# ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
+# ALEMBIC_SOURCE_REPO_UID="e6c90d4faa32c4550adeaaf3f556dad4b73a92bb"
+# ALEMBIC_SOURCE_REPO_BRANCH="master"
+
 OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
 OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
 OPENCOLLADA_REPO_BRANCH="master"
@@ -767,7 +800,8 @@ You may also want to build them yourself (optional ones are [between brackets]):
     * [OpenShadingLanguage $OSL_VERSION_MIN] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID).
     * [OpenSubDiv $OSD_VERSION_MIN] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID).
     * [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE).
-    * [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).\""
+    * [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).
+    * [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).\""
 
 if [ "$DO_SHOW_DEPS" = true ]; then
   PRINT ""
@@ -1118,7 +1152,7 @@ compile_Boost() {
   fi
 
   # To be changed each time we make edits that would modify the compiled result!
-  boost_magic=10
+  boost_magic=11
 
   _init_boost
 
@@ -2138,6 +2172,102 @@ compile_OPENVDB() {
   run_ldconfig "openvdb"
 }
 
+#### Build Alembic ####
+_init_alembic() {
+  _src=$SRC/alembic-$ALEMBIC_VERSION
+  _git=false
+  _inst=$INST/alembic-$ALEMBIC_VERSION
+  _inst_shortcut=$INST/alembic
+}
+
+clean_ALEMBIC() {
+  _init_alembic
+  _clean
+}
+
+compile_ALEMBIC() {
+  if [ "$NO_BUILD" = true ]; then
+    WARNING "--no-build enabled, Alembic will not be compiled!"
+    return
+  fi
+
+  compile_HDF5
+  PRINT ""
+
+  # To be changed each time we make edits that would modify the compiled result!
+  alembic_magic=2
+  _init_alembic
+
+  # Clean install if needed!
+  magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
+  if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then
+    clean_ALEMBIC
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building Alembic-$ALEMBIC_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src -o true ]; then
+      mkdir -p $SRC
+      download ALEMBIC_SOURCE[@] "$_src.tar.gz"
+
+      INFO "Unpacking Alembic-$ALEMBIC_VERSION"
+      tar -C $SRC -xf $_src.tar.gz
+    fi
+
+    cd $_src
+
+    cmake_d="-D CMAKE_INSTALL_PREFIX=$_in

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list