[Bf-blender-cvs] [bfd6e43] alembic_basic_io: Apply patch in a new branch.
Kévin Dietrich
noreply at git.blender.org
Sun Mar 27 23:31:07 CEST 2016
Commit: bfd6e4363e8103f3ef6df093c680569820cd15c4
Author: Kévin Dietrich
Date: Sun Mar 27 18:16:50 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBbfd6e4363e8103f3ef6df093c680569820cd15c4
Apply patch in a new branch.
===================================================================
M CMakeLists.txt
A build_files/cmake/Modules/FindALEMBIC.cmake
M build_files/cmake/macros.cmake
M release/scripts/startup/bl_operators/__init__.py
A release/scripts/startup/bl_operators/alembic_import.py
M release/scripts/startup/bl_ui/properties_data_camera.py
M release/scripts/startup/bl_ui/properties_data_modifier.py
M release/scripts/startup/bl_ui/properties_object.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_export_options.cc
A source/blender/alembic/intern/abc_export_options.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_shape.cc
A source/blender/alembic/intern/abc_shape.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
M source/blender/blenkernel/CMakeLists.txt
M source/blender/blenkernel/intern/depsgraph.c
M source/blender/blenkernel/intern/object.c
M source/blender/blenlib/BLI_math_matrix.h
M source/blender/blenlib/intern/math_matrix.c
M source/blender/editors/io/CMakeLists.txt
A source/blender/editors/io/io_alembic.c
A source/blender/editors/io/io_alembic.h
M source/blender/editors/io/io_ops.c
M source/blender/makesdna/DNA_camera_types.h
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesdna/DNA_object_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/CMakeLists.txt
M source/blender/makesrna/intern/rna_camera.c
M source/blender/makesrna/intern/rna_main_api.c
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_object.c
M source/blender/makesrna/intern/rna_scene_api.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/modifiers/MOD_modifiertypes.h
A source/blender/modifiers/intern/MOD_alembic.c
M source/blender/modifiers/intern/MOD_util.c
M source/blender/python/intern/CMakeLists.txt
M source/blender/python/intern/bpy_app_build_options.c
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12f5870..160e6fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -314,6 +314,27 @@ 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)
+if(WITH_HDF5)
+ find_package(HDF5)
+
+ if(NOT HDF5_FOUND)
+ set(WITH_HDF5 OFF)
+ set(WITH_ALEMBIC OFF)
+ endif()
+endif()
+
+# alembic
+if(WITH_ALEMBIC)
+ find_package(ALEMBIC)
+
+ if(NOT ALEMBIC_FOUND)
+ set(WITH_ALEMBIC OFF)
+ endif()
+endif()
+
+
if(APPLE)
option(WITH_CODEC_QUICKTIME "Enable Quicktime Support" ON)
endif()
@@ -3041,6 +3062,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/cmake/Modules/FindALEMBIC.cmake b/build_files/cmake/Modules/FindALEMBIC.cmake
new file mode 100644
index 0000000..6504c20
--- /dev/null
+++ b/build_files/cmake/Modules/FindALEMBIC.cmake
@@ -0,0 +1,78 @@
+# - Find Alembic library
+# Find the native Alembic includes and libraries
+# This module defines
+# ALEMBIC_INCLUDE_DIRS, where to find samplerate.h, Set when
+# ALEMBIC_INCLUDE_DIR is found.
+# ALEMBIC_LIBRARIES, libraries to link against to use Samplerate.
+# ALEMBIC_ROOT_DIR, The base directory to search for Samplerate.
+# This can also be an environment variable.
+# ALEMBIC_FOUND, If false, do not try to use Samplerate.
+#
+
+#=============================================================================
+# Copyright 2011 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If ALEMBIC_ROOT_DIR was defined in the environment, use it.
+IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
+ SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
+ENDIF()
+
+SET(_alembic_SEARCH_DIRS
+ ${ALEMBIC_ROOT_DIR}
+ ${ALEMBIC_ROOT_DIR}/lib/static
+ ${HDF5_ROOT_DIR}/lib
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+)
+
+FIND_PATH(ALEMBIC_INCLUDE_DIR NAMES Alembic/Abc/All.h HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES include)
+
+FIND_LIBRARY(ALEMBIC_ABC_LIBRARY NAMES AlembicAbc HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_ABCGEOM_LIBRARY NAMES AlembicAbcGeom HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_ABCCORE_ABC_LIBRARY NAMES AlembicAbcCoreAbstract HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_ABCUTIL_LIBRARY NAMES AlembicUtil HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_ABCCORE_HDF5_LIBRARY NAMES AlembicAbcCoreHDF5 HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_OGAWA_LIBRARY NAMES AlembicOgawa HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_ABCOGAWA_LIBRARY NAMES AlembicAbcCoreOgawa HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_ABCMATERIAL NAMES AlembicAbcMaterial HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(ALEMBIC_ABCCOREFACTORY NAMES AlembicAbcCoreFactory HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+
+FIND_LIBRARY(HDF5_LIBRARY NAMES hdf5 HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+FIND_LIBRARY(HDF5_HL_LIBRARY NAMES hdf5_hl HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
+
+# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_ABC_LIBRARY ALEMBIC_INCLUDE_DIR)
+
+IF(ALEMBIC_FOUND)
+ SET(ALEMBIC_LIBRARIES ${ALEMBIC_ABC_LIBRARY}
+ ${ALEMBIC_OGAWA_LIBRARY}
+ ${ALEMBIC_ABCGEOM_LIBRARY}
+ ${ALEMBIC_ABCCORE_ABC_LIBRARY}
+ ${ALEMBIC_ABCCOREFACTORY}
+ ${ALEMBIC_ABCUTIL_LIBRARY}
+ ${ALEMBIC_ABCCORE_HDF5_LIBRARY}
+ ${ALEMBIC_ABCOGAWA_LIBRARY}
+ ${ALEMBIC_ABCMATERIAL}
+ ${HDF5_HL_LIBRARY}
+ ${HDF5_LIBRARY}
+ )
+
+ SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
+ENDIF(ALEMBIC_FOUND)
+
+MARK_AS_ADVANCED(
+ ALEMBIC_INCLUDE_DIR
+ ALEMBIC_LIBRARY
+)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index c9cee92..4811490 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -310,6 +310,11 @@ function(SETUP_LIBDIRS)
link_directories(${LLVM_LIBPATH})
endif()
+ if(WITH_ALEMBIC)
+ link_directories(${ALEMBIC_LIBPATH})
+ link_directories(${HDF5_LIBPATH})
+ endif()
+
if(WIN32 AND NOT UNIX)
link_directories(${PTHREADS_LIBPATH})
endif()
@@ -467,6 +472,9 @@ function(setup_liblinks
if(WITH_LLVM)
target_link_libraries(${target} ${LLVM_LIBRARY})
endif()
+ if(WITH_ALEMBIC)
+ target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES} ${PYTHON_LIBRARIES})
+ endif()
if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
endif()
@@ -590,6 +598,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_imbuf_openimageio
bf_imbuf_dds
bf_collada
+ bf_abc
bf_intern_elbeem
bf_intern_memutil
bf_intern_guardedalloc
diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py
index a696410..66563ae 100644
--- a/release/scripts/startup/bl_operators/__init__.py
+++ b/release/scripts/startup/bl_operators/__init__.py
@@ -49,6 +49,7 @@ _modules = [
"vertexpaint_dirt",
"view3d",
"wm",
+ "alembic_import"
]
import bpy
diff --git a/release/scripts/startup/bl_operators/alembic_import.py b/release/scripts/startup/bl_operators/alembic_import.py
new file mode 100644
index 0000000..38bf70a
--- /dev/null
+++ b/release/scripts/startup/bl_operators/alembic_import.py
@@ -0,0 +1,237 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+from bpy.props import *
+from bpy.types import Menu, Panel, UIList
+
+from bpy_extras import object_utils
+
+
+def find_object(obj_path, parent=None):
+ if parent is None:
+ parent = bpy.context.scene.objects
+ else:
+ parent = parent.children
+ parts = obj_path.split('/')[1:]
+ value = None
+ for o in parent:
+ if o.name == parts[0]:
+ value = o
+
+ if not value:
+ return None
+
+ if len(parts) == 1:
+ return value
+
+ return find_object("/" + "/".join(parts[1:]), value)
+
+
+def _create_hierarchy(dag, filename=None, freeze=False, parent=None, namespace=None):
+ parts = dag.split("/")
+ parts.remove("")
+
+ sub_object = ""
+ for part in parts:
+ sub_object += "/" + part
+
+ if namespace is not None:
+ part = "%s:%s" % (namespace, part)
+ p = find_object("/" + part, parent)
+
+ if p:
+ parent = p
+ continue
+
+ if sub_object is "/":
+ parent = None
+ continue
+
+ # bpy.ops.object.add(type='EMPTY')
+ empty = bpy.data.objects.new('Empty', None)
+ bpy.context.scene.objects.link(empty)
+ empty.name = part
+
+ empty.hide = True
+ empty.parent = parent
+ if filename is not None:
+ empty.abc_file = filename
+ empty.abc_subobject = sub_object
+ empty.use_abc_xform = True
+ empty.set_alembic_props()
+ bpy.context.scene.update()
+ if freeze:
+ empty.lock_location[0] = True
+ empty.lock_location[1] = True
+ empty.lock_location[2] = True
+ empty.lock_rotation[0] = True
+ empty.lock_rotation[1] = True
+ empty.lock_rotation[2] = True
+ empty.lock_scale[0] = True
+ empty.lock_scale[1] = True
+ empty.lock_scale[2] = True
+ else:
+ empty.abc_file = ""
+ empty.abc_subobject = ""
+ empty.use_abc_xform = False
+ parent = empty
+
+ return parent
+
+
+def _import_abc(filename, sub_object, object_name=None, object_type='mesh', freeze=False, parent=None, namespace=None):
+ parts = sub_object.split("/")
+ parts.remove("")
+ if object_name is None:
+ object_name = parts[-2]
+ data_name = parts[-1]
+ mesh = None
+ camera = None
+
+ if namespace is not None:
+ object_name = "%s:%s" % (namespace, object_name)
+ data_name = "%s:%s" % (namespace, data_name)
+
+ if object_type == 'nurbs':
+ nurbs = bpy.data.objects.new_nurbs_from_alembic(filename, sub_object, object_name, True)
+ nurbs.data.name = data_name
+ bpy.context.scene.objects.link(nurbs)
+ obj = nurbs
+ elif object_type == 'camera':
+ cameradata = bpy.data.cameras.new(data_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list