- add example for python rna property update

- edit the copyright for blender specific cmake find modules
This commit is contained in:
Campbell Barton 2011-06-20 02:54:56 +00:00
parent 6d7e3509a9
commit 97a85fe100
9 changed files with 165 additions and 107 deletions

@ -12,7 +12,7 @@
# FFTW3_LIBRARY, where to find the Fftw3 library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2011 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -21,8 +21,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# If FFTW3_ROOT_DIR was defined in the environment, use it.
IF(NOT FFTW3_ROOT_DIR AND NOT $ENV{FFTW3_ROOT_DIR} STREQUAL "")
@ -37,7 +35,9 @@ SET(_fftw3_SEARCH_DIRS
/opt/csw # Blastwave
)
FIND_PATH(FFTW3_INCLUDE_DIR fftw3.h
FIND_PATH(FFTW3_INCLUDE_DIR
NAMES
fftw3.h
HINTS
${_fftw3_SEARCH_DIRS}
PATH_SUFFIXES
@ -45,9 +45,12 @@ FIND_PATH(FFTW3_INCLUDE_DIR fftw3.h
)
FIND_LIBRARY(FFTW3_LIBRARY
NAMES "fftw3"
HINTS ${_fftw3_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
NAMES
fftw3
HINTS
${_fftw3_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if

@ -12,7 +12,7 @@
# JACK_LIBRARY, where to find the Jack library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2011 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -21,8 +21,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# If JACK_ROOT_DIR was defined in the environment, use it.
IF(NOT JACK_ROOT_DIR AND NOT $ENV{JACK_ROOT_DIR} STREQUAL "")
@ -37,7 +35,9 @@ SET(_jack_SEARCH_DIRS
/opt/csw # Blastwave
)
FIND_PATH(JACK_INCLUDE_DIR jack.h
FIND_PATH(JACK_INCLUDE_DIR
NAMES
jack.h
HINTS
${_jack_SEARCH_DIRS}
PATH_SUFFIXES
@ -45,9 +45,12 @@ FIND_PATH(JACK_INCLUDE_DIR jack.h
)
FIND_LIBRARY(JACK_LIBRARY
NAMES "jack"
HINTS ${_jack_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
NAMES
jack
HINTS
${_jack_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if

@ -12,7 +12,7 @@
# JEMALLOC_LIBRARY, where to find the JeMalloc library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2011 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -21,8 +21,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# If JEMALLOC_ROOT_DIR was defined in the environment, use it.
IF(NOT JEMALLOC_ROOT_DIR AND NOT $ENV{JEMALLOC_ROOT_DIR} STREQUAL "")
@ -37,7 +35,9 @@ SET(_jemalloc_SEARCH_DIRS
/opt/csw # Blastwave
)
FIND_PATH(JEMALLOC_INCLUDE_DIR jemalloc.h
FIND_PATH(JEMALLOC_INCLUDE_DIR
NAMES
jemalloc.h
HINTS
${_jemalloc_SEARCH_DIRS}
PATH_SUFFIXES
@ -45,9 +45,12 @@ FIND_PATH(JEMALLOC_INCLUDE_DIR jemalloc.h
)
FIND_LIBRARY(JEMALLOC_LIBRARY
NAMES "jemalloc"
HINTS ${_jemalloc_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
NAMES
jemalloc
HINTS
${_jemalloc_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if

@ -19,7 +19,7 @@
# OPENEXR_LIBRARY, where to find the OpenEXR library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2011 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -28,8 +28,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# If OPENEXR_ROOT_DIR was defined in the environment, use it.
IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
@ -52,7 +50,9 @@ SET(_openexr_SEARCH_DIRS
/opt/csw # Blastwave
)
FIND_PATH(OPENEXR_INCLUDE_DIR ImfXdr.h
FIND_PATH(OPENEXR_INCLUDE_DIR
NAMES
ImfXdr.h
HINTS
${_openexr_SEARCH_DIRS}
PATH_SUFFIXES
@ -64,10 +64,13 @@ FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
NAMES ${COMPONENT}
HINTS ${_openexr_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
)
NAMES
${COMPONENT}
HINTS
${_openexr_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
LIST(APPEND _openexr_LIBRARIES "${OPENEXR_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()

@ -12,7 +12,7 @@
# OPENJPEG_LIBRARY, where to find the OpenJPEG library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2011 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -21,8 +21,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# If OPENJPEG_ROOT_DIR was defined in the environment, use it.
IF(NOT OPENJPEG_ROOT_DIR AND NOT $ENV{OPENJPEG_ROOT_DIR} STREQUAL "")
@ -37,7 +35,9 @@ SET(_openjpeg_SEARCH_DIRS
/opt/csw # Blastwave
)
FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h
FIND_PATH(OPENJPEG_INCLUDE_DIR
NAMES
openjpeg.h
HINTS
${_openjpeg_SEARCH_DIRS}
PATH_SUFFIXES
@ -45,9 +45,12 @@ FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h
)
FIND_LIBRARY(OPENJPEG_LIBRARY
NAMES "openjpeg"
HINTS ${_openjpeg_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
NAMES
openjpeg
HINTS
${_openjpeg_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if

@ -1,5 +1,12 @@
# - Find python libraries
# - Find Python libraries
# Find the native Python includes and library
#
# Note:, This is not _yet_ intended to be a general python module for other
# projects to use since its hard coded to python 3.2 as blender only supports
# a single python version.
# This is for blender/unix python only.
#
# This module defines
# PYTHON_VERSION
# PYTHON_INCLUDE_DIRS
# PYTHON_LIBRARIES
@ -7,87 +14,99 @@
# PYTHON_LINKFLAGS
# PYTHON_ROOT_DIR, The base directory to search for Python.
# This can also be an environment variable.
#
# also defined, but not for general use are
# PYTHON_LIBRARY, where to find the python library.
#=============================================================================
# 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 PYTHON_ROOT_DIR was defined in the environment, use it.
if(NOT PYTHON_ROOT_DIR AND NOT $ENV{PYTHON_ROOT_DIR} STREQUAL "")
set(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR})
endif()
IF(NOT PYTHON_ROOT_DIR AND NOT $ENV{PYTHON_ROOT_DIR} STREQUAL "")
SET(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR})
ENDIF()
set(PYTHON_VERSION 3.2 CACHE STRING "")
mark_as_advanced(PYTHON_VERSION)
SET(PYTHON_VERSION 3.2 CACHE STRING "")
MARK_AS_ADVANCED(PYTHON_VERSION)
set(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
mark_as_advanced(PYTHON_LINKFLAGS)
SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
set(_python_ABI_FLAGS
"m;mu;u; " # release
"md;mud;ud" # debug
SET(_python_ABI_FLAGS
"m;mu;u; " # release
"md;mud;ud" # debug
)
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
set(_python_SEARCH_DIRS
${PYTHON_ROOT_DIR}
"$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
"/opt/py${_PYTHON_VERSION_NO_DOTS}"
SET(_python_SEARCH_DIRS
${PYTHON_ROOT_DIR}
"$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
"/opt/py${_PYTHON_VERSION_NO_DOTS}"
)
foreach(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS})
#if(CMAKE_BUILD_TYPE STREQUAL Debug)
# set(_CURRENT_ABI_FLAGS "d${_CURRENT_ABI_FLAGS}")
#endif()
string(REPLACE " " "" _CURRENT_ABI_FLAGS ${_CURRENT_ABI_FLAGS})
FOREACH(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS})
#IF(CMAKE_BUILD_TYPE STREQUAL Debug)
# SET(_CURRENT_ABI_FLAGS "d${_CURRENT_ABI_FLAGS}")
#ENDIF()
STRING(REPLACE " " "" _CURRENT_ABI_FLAGS ${_CURRENT_ABI_FLAGS})
find_path(PYTHON_INCLUDE_DIR
NAMES Python.h
HINTS ${_python_SEARCH_DIRS}
PATH_SUFFIXES include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
)
FIND_PATH(PYTHON_INCLUDE_DIR
NAMES Python.h
HINTS ${_python_SEARCH_DIRS}
PATH_SUFFIXES include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
)
find_library(PYTHON_LIBRARY
NAMES "python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}"
HINTS ${_python_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
)
FIND_LIBRARY(PYTHON_LIBRARY
NAMES "python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}"
HINTS ${_python_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
)
if(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
break()
else()
# ensure we dont find values from 2 different ABI versions
unset(PYTHON_INCLUDE_DIR CACHE)
unset(PYTHON_LIBRARY CACHE)
endif()
endforeach()
IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
break()
ELSE()
# ensure we dont find values from 2 different ABI versions
UNSET(PYTHON_INCLUDE_DIR CACHE)
UNSET(PYTHON_LIBRARY CACHE)
ENDIF()
ENDFOREACH()
unset(_CURRENT_ABI_FLAGS)
unset(_CURRENT_PATH)
UNSET(_CURRENT_ABI_FLAGS)
UNSET(_CURRENT_PATH)
unset(_python_ABI_FLAGS)
unset(_python_SEARCH_DIRS)
UNSET(_python_ABI_FLAGS)
UNSET(_python_SEARCH_DIRS)
# handle the QUIETLY and REQUIRED arguments and set PYTHONLIBSUNIX_FOUND to TRUE if
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG
PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
if(PYTHONLIBSUNIX_FOUND)
# Assign cache items
set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
set(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
IF(PYTHONLIBSUNIX_FOUND)
# Assign cache items
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
# we need this for installation
get_filename_component(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
# we need this for installation
GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
# not used
# set(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
# not used
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
mark_as_advanced(
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY
)
endif()
MARK_AS_ADVANCED(
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY
)
ENDIF()

@ -12,7 +12,7 @@
# SAMPLERATE_LIBRARY, where to find the Samplerate library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2011 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -21,8 +21,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# If SAMPLERATE_ROOT_DIR was defined in the environment, use it.
IF(NOT SAMPLERATE_ROOT_DIR AND NOT $ENV{SAMPLERATE_ROOT_DIR} STREQUAL "")
@ -37,7 +35,9 @@ SET(_samplerate_SEARCH_DIRS
/opt/csw # Blastwave
)
FIND_PATH(SAMPLERATE_INCLUDE_DIR samplerate.h
FIND_PATH(SAMPLERATE_INCLUDE_DIR
NAMES
samplerate.h
HINTS
${_samplerate_SEARCH_DIRS}
PATH_SUFFIXES
@ -45,9 +45,12 @@ FIND_PATH(SAMPLERATE_INCLUDE_DIR samplerate.h
)
FIND_LIBRARY(SAMPLERATE_LIBRARY
NAMES "samplerate"
HINTS ${_samplerate_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
NAMES
samplerate
HINTS
${_samplerate_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set SAMPLERATE_FOUND to TRUE if

@ -12,7 +12,7 @@
# SNDFILE_LIBRARY, where to find the SndFile library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
# Copyright 2011 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -21,8 +21,6 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# If SNDFILE_ROOT_DIR was defined in the environment, use it.
IF(NOT SNDFILE_ROOT_DIR AND NOT $ENV{SNDFILE_ROOT_DIR} STREQUAL "")
@ -45,9 +43,12 @@ FIND_PATH(SNDFILE_INCLUDE_DIR sndfile.h
)
FIND_LIBRARY(SNDFILE_LIBRARY
NAMES "sndfile"
HINTS ${_sndfile_SEARCH_DIRS}
PATH_SUFFIXES lib64 lib
NAMES
sndfile
HINTS
${_sndfile_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if

@ -0,0 +1,20 @@
"""
Update Example
++++++++++++++
It can be useful to perform an action when a property is changed and can be
used to update other properties or synchronize with external data.
All properties define update functions except for CollectionProperty.
"""
import bpy
def update_func(self, context):
print("my test function", self)
bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
bpy.context.scene.testprop = 11.0
# >>> my test function <bpy_struct, Scene("Scene")>