Merged changes in the trunk up to revision 33765.
This commit is contained in:
1457
CMakeLists.txt
1457
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
#
|
#
|
||||||
@@ -30,10 +32,13 @@ IGNORE = \
|
|||||||
"/ik_glut_test/"
|
"/ik_glut_test/"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from os.path import join, dirname, normpath
|
from os.path import join, dirname, normpath, abspath
|
||||||
|
|
||||||
base = join(os.getcwd(), "..", "..")
|
base = join(os.path.dirname(__file__), "..", "..")
|
||||||
base = normpath(base)
|
base = normpath(base)
|
||||||
|
base = abspath(base)
|
||||||
|
|
||||||
|
print("Scanning:", base)
|
||||||
|
|
||||||
global_h = set()
|
global_h = set()
|
||||||
global_c = set()
|
global_c = set()
|
||||||
@@ -76,7 +81,7 @@ def cmake_get_src(f):
|
|||||||
sources_h = []
|
sources_h = []
|
||||||
sources_c = []
|
sources_c = []
|
||||||
|
|
||||||
filen = open(f, "r")
|
filen = open(f, "r", encoding="utf8")
|
||||||
it = iter(filen)
|
it = iter(filen)
|
||||||
found = False
|
found = False
|
||||||
i = 0
|
i = 0
|
||||||
@@ -91,15 +96,15 @@ def cmake_get_src(f):
|
|||||||
break
|
break
|
||||||
l = l.strip()
|
l = l.strip()
|
||||||
if not l.startswith("#"):
|
if not l.startswith("#"):
|
||||||
if 'SET(SRC' in l or ('SET(' in l and l.endswith("SRC")):
|
if 'set(SRC' in l or ('set(' in l and l.endswith("SRC")):
|
||||||
if len(l.split()) > 1:
|
if len(l.split()) > 1:
|
||||||
raise Exception("strict formatting not kept 'SET(SRC*' %s:%d" % (f, i))
|
raise Exception("strict formatting not kept 'set(SRC*' %s:%d" % (f, i))
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if "LIST(APPEND SRC" in l:
|
if "list(APPEND SRC" in l:
|
||||||
if l.endswith(")"):
|
if l.endswith(")"):
|
||||||
raise Exception("strict formatting not kept 'LIST(APPEND SRC...)' on 1 line %s:%d" % (f, i))
|
raise Exception("strict formatting not kept 'list(APPEND SRC...)' on 1 line %s:%d" % (f, i))
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -189,3 +194,16 @@ for hf in sorted(source_list(base, is_c_header)):
|
|||||||
if not is_ignore(hf):
|
if not is_ignore(hf):
|
||||||
if hf not in global_h:
|
if hf not in global_h:
|
||||||
print("missing_h: ", hf)
|
print("missing_h: ", hf)
|
||||||
|
|
||||||
|
# test encoding
|
||||||
|
import traceback
|
||||||
|
for files in (global_c, global_h):
|
||||||
|
for f in sorted(files):
|
||||||
|
i = 1
|
||||||
|
try:
|
||||||
|
for l in open(f, "r", encoding="utf8"):
|
||||||
|
i += 1
|
||||||
|
except:
|
||||||
|
print("Non utf8: %s:%d" % (f, i))
|
||||||
|
if i > 1:
|
||||||
|
traceback.print_exc()
|
||||||
|
|||||||
94
build_files/cmake/cmake_qtcreator_project.py
Normal file
94
build_files/cmake/cmake_qtcreator_project.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# $Id:
|
||||||
|
# ***** 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.
|
||||||
|
#
|
||||||
|
# Contributor(s): Campbell Barton
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
import os
|
||||||
|
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
|
||||||
|
|
||||||
|
base = join(os.path.dirname(__file__), "..", "..")
|
||||||
|
base = normpath(base)
|
||||||
|
base = abspath(base)
|
||||||
|
|
||||||
|
def source_list(path, filename_check=None):
|
||||||
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
|
|
||||||
|
# skip '.svn'
|
||||||
|
if dirpath.startswith("."):
|
||||||
|
continue
|
||||||
|
|
||||||
|
for filename in filenames:
|
||||||
|
filepath = join(dirpath, filename)
|
||||||
|
if filename_check is None or filename_check(filepath):
|
||||||
|
yield filepath
|
||||||
|
|
||||||
|
# extension checking
|
||||||
|
def is_c_header(filename):
|
||||||
|
ext = splitext(filename)[1]
|
||||||
|
return (ext in (".h", ".hpp", ".hxx"))
|
||||||
|
|
||||||
|
def is_cmake(filename):
|
||||||
|
ext = splitext(filename)[1]
|
||||||
|
return (ext == ".cmake") or (filename == "CMakeLists.txt")
|
||||||
|
|
||||||
|
def is_c_header(filename):
|
||||||
|
ext = splitext(filename)[1]
|
||||||
|
return (ext in (".h", ".hpp", ".hxx"))
|
||||||
|
|
||||||
|
def is_c(filename):
|
||||||
|
ext = splitext(filename)[1]
|
||||||
|
return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
|
||||||
|
|
||||||
|
def is_c_any(filename):
|
||||||
|
return is_c(filename) or is_c_header(filename)
|
||||||
|
|
||||||
|
def is_svn_file(filename):
|
||||||
|
dn, fn = os.path.split(filename)
|
||||||
|
filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
|
||||||
|
return exists(filename_svn)
|
||||||
|
|
||||||
|
def is_project_file(filename):
|
||||||
|
return (is_c_any(filename) or is_cmake(filename)) and is_svn_file(filename)
|
||||||
|
|
||||||
|
files = list(source_list(base, filename_check=is_project_file))
|
||||||
|
files_rel = [relpath(f, start=base) for f in files]
|
||||||
|
files_rel.sort()
|
||||||
|
|
||||||
|
|
||||||
|
# --- qtcreator spesific, simple format
|
||||||
|
PROJECT_NAME = "Blender"
|
||||||
|
f = open(join(base, "%s.files" % PROJECT_NAME), 'w')
|
||||||
|
f.write("\n".join(files_rel))
|
||||||
|
|
||||||
|
f = open(join(base, "%s.includes" % PROJECT_NAME), 'w')
|
||||||
|
f.write("\n".join(sorted(list(set(dirname(f) for f in files_rel if is_c_header(f))))))
|
||||||
|
|
||||||
|
qtc_prj = join(base, "%s.creator" % PROJECT_NAME)
|
||||||
|
f = open(qtc_prj, 'w')
|
||||||
|
f.write("[General]\n")
|
||||||
|
|
||||||
|
qtc_cfg = join(base, "%s.config" % PROJECT_NAME)
|
||||||
|
if not exists(qtc_cfg):
|
||||||
|
f = open(qtc_cfg, 'w')
|
||||||
|
f.write("// ADD PREDEFINED MACROS HERE!\n")
|
||||||
|
|
||||||
|
print("Project file written to: %s" % qtc_prj)
|
||||||
|
# --- end
|
||||||
@@ -1,311 +1,362 @@
|
|||||||
|
|
||||||
# only MSVC uses SOURCE_GROUP
|
# only MSVC uses SOURCE_GROUP
|
||||||
MACRO(BLENDERLIB_NOLIST
|
macro(blenderlib_nolist
|
||||||
name
|
name
|
||||||
sources
|
sources
|
||||||
includes)
|
includes)
|
||||||
|
|
||||||
MESSAGE(STATUS "Configuring library ${name}")
|
# message(STATUS "Configuring library ${name}")
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${includes})
|
include_directories(${includes})
|
||||||
ADD_LIBRARY(${name} ${sources})
|
add_library(${name} ${sources})
|
||||||
|
|
||||||
# Group by location on disk
|
# Group by location on disk
|
||||||
SOURCE_GROUP("Source Files" FILES CMakeLists.txt)
|
source_group("Source Files" FILES CMakeLists.txt)
|
||||||
FOREACH(SRC ${sources})
|
foreach(SRC ${sources})
|
||||||
GET_FILENAME_COMPONENT(SRC_EXT ${SRC} EXT)
|
get_filename_component(SRC_EXT ${SRC} EXT)
|
||||||
IF(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp")
|
if(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp")
|
||||||
SOURCE_GROUP("Header Files" FILES ${SRC})
|
source_group("Header Files" FILES ${SRC})
|
||||||
ELSE()
|
else()
|
||||||
SOURCE_GROUP("Source Files" FILES ${SRC})
|
source_group("Source Files" FILES ${SRC})
|
||||||
ENDIF()
|
endif()
|
||||||
ENDFOREACH(SRC)
|
endforeach()
|
||||||
ENDMACRO(BLENDERLIB_NOLIST)
|
endmacro()
|
||||||
|
|
||||||
# # works fine but having the includes listed is helpful for IDE's (QtCreator/MSVC)
|
# # works fine but having the includes listed is helpful for IDE's (QtCreator/MSVC)
|
||||||
# MACRO(BLENDERLIB_NOLIST
|
# macro(blenderlib_nolist
|
||||||
# name
|
# name
|
||||||
# sources
|
# sources
|
||||||
# includes)
|
# includes)
|
||||||
#
|
#
|
||||||
# MESSAGE(STATUS "Configuring library ${name}")
|
# message(STATUS "Configuring library ${name}")
|
||||||
# INCLUDE_DIRECTORIES(${includes})
|
# include_directories(${includes})
|
||||||
# ADD_LIBRARY(${name} ${sources})
|
# add_library(${name} ${sources})
|
||||||
# ENDMACRO(BLENDERLIB_NOLIST)
|
# endmacro()
|
||||||
|
|
||||||
|
|
||||||
MACRO(BLENDERLIB
|
macro(blenderlib
|
||||||
name
|
name
|
||||||
sources
|
sources
|
||||||
includes)
|
includes)
|
||||||
|
|
||||||
BLENDERLIB_NOLIST(${name} "${sources}" "${includes}")
|
blenderlib_nolist(${name} "${sources}" "${includes}")
|
||||||
|
|
||||||
# Add to blender's list of libraries
|
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "${name};")
|
|
||||||
ENDMACRO(BLENDERLIB)
|
|
||||||
|
|
||||||
MACRO(SETUP_LIBDIRS)
|
endmacro()
|
||||||
|
|
||||||
|
macro(SETUP_LIBDIRS)
|
||||||
# see "cmake --help-policy CMP0003"
|
# see "cmake --help-policy CMP0003"
|
||||||
if(COMMAND cmake_policy)
|
if(COMMAND cmake_policy)
|
||||||
CMAKE_POLICY(SET CMP0003 NEW)
|
cmake_policy(SET CMP0003 NEW)
|
||||||
endif(COMMAND cmake_policy)
|
endif()
|
||||||
|
|
||||||
LINK_DIRECTORIES(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
||||||
|
|
||||||
IF(WITH_PYTHON)
|
if(WITH_PYTHON)
|
||||||
LINK_DIRECTORIES(${PYTHON_LIBPATH})
|
link_directories(${PYTHON_LIBPATH})
|
||||||
ENDIF(WITH_PYTHON)
|
endif()
|
||||||
IF(WITH_INTERNATIONAL)
|
if(WITH_INTERNATIONAL)
|
||||||
LINK_DIRECTORIES(${ICONV_LIBPATH})
|
link_directories(${ICONV_LIBPATH})
|
||||||
LINK_DIRECTORIES(${GETTEXT_LIBPATH})
|
link_directories(${GETTEXT_LIBPATH})
|
||||||
ENDIF(WITH_INTERNATIONAL)
|
endif()
|
||||||
IF(WITH_SDL)
|
if(WITH_SDL)
|
||||||
LINK_DIRECTORIES(${SDL_LIBPATH})
|
link_directories(${SDL_LIBPATH})
|
||||||
ENDIF(WITH_SDL)
|
endif()
|
||||||
IF(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
LINK_DIRECTORIES(${FFMPEG_LIBPATH})
|
link_directories(${FFMPEG_LIBPATH})
|
||||||
ENDIF(WITH_CODEC_FFMPEG)
|
endif()
|
||||||
IF(WITH_IMAGE_OPENEXR)
|
if(WITH_IMAGE_OPENEXR)
|
||||||
LINK_DIRECTORIES(${OPENEXR_LIBPATH})
|
link_directories(${OPENEXR_LIBPATH})
|
||||||
ENDIF(WITH_IMAGE_OPENEXR)
|
endif()
|
||||||
IF(WITH_IMAGE_TIFF)
|
if(WITH_IMAGE_TIFF)
|
||||||
LINK_DIRECTORIES(${TIFF_LIBPATH})
|
link_directories(${TIFF_LIBPATH})
|
||||||
ENDIF(WITH_IMAGE_TIFF)
|
endif()
|
||||||
IF(WITH_LCMS)
|
if(WITH_LCMS)
|
||||||
LINK_DIRECTORIES(${LCMS_LIBPATH})
|
link_directories(${LCMS_LIBPATH})
|
||||||
ENDIF(WITH_LCMS)
|
endif()
|
||||||
IF(WITH_CODEC_QUICKTIME)
|
if(WITH_CODEC_QUICKTIME)
|
||||||
LINK_DIRECTORIES(${QUICKTIME_LIBPATH})
|
link_directories(${QUICKTIME_LIBPATH})
|
||||||
ENDIF(WITH_CODEC_QUICKTIME)
|
endif()
|
||||||
IF(WITH_OPENAL)
|
if(WITH_OPENAL)
|
||||||
LINK_DIRECTORIES(${OPENAL_LIBPATH})
|
link_directories(${OPENAL_LIBPATH})
|
||||||
ENDIF(WITH_OPENAL)
|
endif()
|
||||||
IF(WITH_JACK)
|
if(WITH_JACK)
|
||||||
LINK_DIRECTORIES(${JACK_LIBPATH})
|
link_directories(${JACK_LIBPATH})
|
||||||
ENDIF(WITH_JACK)
|
endif()
|
||||||
IF(WITH_CODEC_SNDFILE)
|
if(WITH_CODEC_SNDFILE)
|
||||||
LINK_DIRECTORIES(${SNDFILE_LIBPATH})
|
link_directories(${SNDFILE_LIBPATH})
|
||||||
ENDIF(WITH_CODEC_SNDFILE)
|
endif()
|
||||||
IF(WITH_SAMPLERATE)
|
if(WITH_SAMPLERATE)
|
||||||
LINK_DIRECTORIES(${LIBSAMPLERATE_LIBPATH})
|
link_directories(${LIBSAMPLERATE_LIBPATH})
|
||||||
ENDIF(WITH_SAMPLERATE)
|
endif()
|
||||||
IF(WITH_FFTW3)
|
if(WITH_FFTW3)
|
||||||
LINK_DIRECTORIES(${FFTW3_LIBPATH})
|
link_directories(${FFTW3_LIBPATH})
|
||||||
ENDIF(WITH_FFTW3)
|
endif()
|
||||||
IF(WITH_OPENCOLLADA)
|
if(WITH_OPENCOLLADA)
|
||||||
LINK_DIRECTORIES(${OPENCOLLADA_LIBPATH})
|
link_directories(${OPENCOLLADA_LIBPATH})
|
||||||
LINK_DIRECTORIES(${PCRE_LIBPATH})
|
link_directories(${PCRE_LIBPATH})
|
||||||
LINK_DIRECTORIES(${EXPAT_LIBPATH})
|
link_directories(${EXPAT_LIBPATH})
|
||||||
ENDIF(WITH_OPENCOLLADA)
|
endif()
|
||||||
|
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
LINK_DIRECTORIES(${PTHREADS_LIBPATH})
|
link_directories(${PTHREADS_LIBPATH})
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
ENDMACRO(SETUP_LIBDIRS)
|
endmacro()
|
||||||
|
|
||||||
MACRO(SETUP_LIBLINKS
|
macro(setup_liblinks
|
||||||
target)
|
target)
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${LLIBS})
|
target_link_libraries(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${LLIBS})
|
||||||
|
|
||||||
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
||||||
IF(WITH_PYTHON)
|
if(WITH_PYTHON)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LINKFLAGS})
|
target_link_libraries(${target} ${PYTHON_LINKFLAGS})
|
||||||
|
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
|
target_link_libraries(${target} debug ${PYTHON_LIB}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
|
target_link_libraries(${target} optimized ${PYTHON_LIB})
|
||||||
ELSE(WIN32 AND NOT UNIX)
|
else()
|
||||||
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
|
target_link_libraries(${target} ${PYTHON_LIB})
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
ENDIF(WITH_PYTHON)
|
endif()
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB})
|
target_link_libraries(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB})
|
||||||
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIBRARY})
|
target_link_libraries(${target} ${FREETYPE_LIBRARY})
|
||||||
|
|
||||||
IF(WITH_INTERNATIONAL)
|
if(WITH_INTERNATIONAL)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
|
target_link_libraries(${target} ${GETTEXT_LIB})
|
||||||
|
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${ICONV_LIB})
|
target_link_libraries(${target} ${ICONV_LIB})
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
ENDIF(WITH_INTERNATIONAL)
|
endif()
|
||||||
|
|
||||||
IF(WITH_OPENAL)
|
if(WITH_OPENAL)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENAL_LIBRARY})
|
target_link_libraries(${target} ${OPENAL_LIBRARY})
|
||||||
ENDIF(WITH_OPENAL)
|
endif()
|
||||||
IF(WITH_FFTW3)
|
if(WITH_FFTW3)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${FFTW3_LIB})
|
target_link_libraries(${target} ${FFTW3_LIB})
|
||||||
ENDIF(WITH_FFTW3)
|
endif()
|
||||||
IF(WITH_JACK)
|
if(WITH_JACK)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${JACK_LIB})
|
target_link_libraries(${target} ${JACK_LIB})
|
||||||
ENDIF(WITH_JACK)
|
endif()
|
||||||
IF(WITH_CODEC_SNDFILE)
|
if(WITH_CODEC_SNDFILE)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${SNDFILE_LIB})
|
target_link_libraries(${target} ${SNDFILE_LIB})
|
||||||
ENDIF(WITH_CODEC_SNDFILE)
|
endif()
|
||||||
IF(WITH_SAMPLERATE)
|
if(WITH_SAMPLERATE)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${LIBSAMPLERATE_LIB})
|
target_link_libraries(${target} ${LIBSAMPLERATE_LIB})
|
||||||
ENDIF(WITH_SAMPLERATE)
|
endif()
|
||||||
IF(WITH_SDL)
|
if(WITH_SDL)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${SDL_LIBRARY})
|
target_link_libraries(${target} ${SDL_LIBRARY})
|
||||||
ENDIF(WITH_SDL)
|
endif()
|
||||||
IF(WITH_CODEC_QUICKTIME)
|
if(WITH_CODEC_QUICKTIME)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${QUICKTIME_LIB})
|
target_link_libraries(${target} ${QUICKTIME_LIB})
|
||||||
ENDIF(WITH_CODEC_QUICKTIME)
|
endif()
|
||||||
IF(WITH_IMAGE_TIFF)
|
if(WITH_IMAGE_TIFF)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${TIFF_LIBRARY})
|
target_link_libraries(${target} ${TIFF_LIBRARY})
|
||||||
ENDIF(WITH_IMAGE_TIFF)
|
endif()
|
||||||
IF(WITH_IMAGE_OPENEXR)
|
if(WITH_IMAGE_OPENEXR)
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
FOREACH(loop_var ${OPENEXR_LIB})
|
foreach(loop_var ${OPENEXR_LIB})
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
|
target_link_libraries(${target} debug ${loop_var}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
|
target_link_libraries(${target} optimized ${loop_var})
|
||||||
ENDFOREACH(loop_var)
|
endforeach()
|
||||||
ELSE(WIN32 AND NOT UNIX)
|
else()
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENEXR_LIB})
|
target_link_libraries(${target} ${OPENEXR_LIB})
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
ENDIF(WITH_IMAGE_OPENEXR)
|
endif()
|
||||||
IF(WITH_LCMS)
|
if(WITH_LCMS)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${LCMS_LIBRARY})
|
target_link_libraries(${target} ${LCMS_LIBRARY})
|
||||||
ENDIF(WITH_LCMS)
|
endif()
|
||||||
IF(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${FFMPEG_LIB})
|
target_link_libraries(${target} ${FFMPEG_LIB})
|
||||||
ENDIF(WITH_CODEC_FFMPEG)
|
endif()
|
||||||
IF(WITH_OPENCOLLADA)
|
if(WITH_OPENCOLLADA)
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
FOREACH(loop_var ${OPENCOLLADA_LIB})
|
foreach(loop_var ${OPENCOLLADA_LIB})
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
|
target_link_libraries(${target} debug ${loop_var}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
|
target_link_libraries(${target} optimized ${loop_var})
|
||||||
ENDFOREACH(loop_var)
|
endforeach()
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${PCRE_LIB}_d)
|
target_link_libraries(${target} debug ${PCRE_LIB}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${PCRE_LIB})
|
target_link_libraries(${target} optimized ${PCRE_LIB})
|
||||||
IF(EXPAT_LIB)
|
if(EXPAT_LIB)
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${EXPAT_LIB}_d)
|
target_link_libraries(${target} debug ${EXPAT_LIB}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${EXPAT_LIB})
|
target_link_libraries(${target} optimized ${EXPAT_LIB})
|
||||||
ENDIF(EXPAT_LIB)
|
endif()
|
||||||
ELSE(WIN32 AND NOT UNIX)
|
else()
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB})
|
target_link_libraries(${target} ${OPENCOLLADA_LIB})
|
||||||
TARGET_LINK_LIBRARIES(${target} ${PCRE_LIB})
|
target_link_libraries(${target} ${PCRE_LIB})
|
||||||
TARGET_LINK_LIBRARIES(${target} ${EXPAT_LIB})
|
target_link_libraries(${target} ${EXPAT_LIB})
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
ENDIF(WITH_OPENCOLLADA)
|
endif()
|
||||||
IF(WITH_LCMS)
|
if(WITH_LCMS)
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${LCMS_LIB}_d)
|
target_link_libraries(${target} debug ${LCMS_LIB}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${LCMS_LIB})
|
target_link_libraries(${target} optimized ${LCMS_LIB})
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
ENDIF(WITH_LCMS)
|
endif()
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB})
|
target_link_libraries(${target} ${PTHREADS_LIB})
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
ENDMACRO(SETUP_LIBLINKS)
|
endmacro()
|
||||||
|
|
||||||
MACRO(TEST_SSE_SUPPORT)
|
macro(TEST_SSE_SUPPORT)
|
||||||
INCLUDE(CheckCSourceRuns)
|
include(CheckCSourceRuns)
|
||||||
|
|
||||||
MESSAGE(STATUS "Detecting SSE support")
|
# message(STATUS "Detecting SSE support")
|
||||||
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||||
SET(CMAKE_REQUIRED_FLAGS "-msse -msse2")
|
set(CMAKE_REQUIRED_FLAGS "-msse -msse2")
|
||||||
ELSEIF(MSVC)
|
elseif(MSVC)
|
||||||
SET(CMAKE_REQUIRED_FLAGS "/arch:SSE2") # TODO, SSE 1 ?
|
set(CMAKE_REQUIRED_FLAGS "/arch:SSE2") # TODO, SSE 1 ?
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
CHECK_C_SOURCE_RUNS("
|
check_c_source_runs("
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
int main() { __m128 v = _mm_setzero_ps(); return 0; }"
|
int main() { __m128 v = _mm_setzero_ps(); return 0; }"
|
||||||
SUPPORT_SSE_BUILD)
|
SUPPORT_SSE_BUILD)
|
||||||
|
|
||||||
CHECK_C_SOURCE_RUNS("
|
check_c_source_runs("
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
int main() { __m128d v = _mm_setzero_pd(); return 0; }"
|
int main() { __m128d v = _mm_setzero_pd(); return 0; }"
|
||||||
SUPPORT_SSE2_BUILD)
|
SUPPORT_SSE2_BUILD)
|
||||||
MESSAGE(STATUS "Detecting SSE support")
|
# message(STATUS "Detecting SSE support")
|
||||||
|
|
||||||
IF(SUPPORT_SSE_BUILD)
|
if(SUPPORT_SSE_BUILD)
|
||||||
MESSAGE(STATUS " ...SSE support found.")
|
message(STATUS "SSE Support: detected.")
|
||||||
ELSE(SUPPORT_SSE_BUILD)
|
else()
|
||||||
MESSAGE(STATUS " ...SSE support missing.")
|
message(STATUS "SSE Support: missing.")
|
||||||
ENDIF(SUPPORT_SSE_BUILD)
|
endif()
|
||||||
|
|
||||||
IF(SUPPORT_SSE2_BUILD)
|
if(SUPPORT_SSE2_BUILD)
|
||||||
MESSAGE(STATUS " ...SSE2 support found.")
|
message(STATUS "SSE2 Support: detected.")
|
||||||
ELSE(SUPPORT_SSE2_BUILD)
|
else()
|
||||||
MESSAGE(STATUS " ...SSE2 support missing.")
|
message(STATUS "SSE2 Support: missing.")
|
||||||
ENDIF(SUPPORT_SSE2_BUILD)
|
endif()
|
||||||
|
|
||||||
ENDMACRO(TEST_SSE_SUPPORT)
|
endmacro()
|
||||||
|
|
||||||
# when we have warnings as errors applied globally this
|
# when we have warnings as errors applied globally this
|
||||||
# needs to be removed for some external libs which we dont maintain.
|
# needs to be removed for some external libs which we dont maintain.
|
||||||
|
|
||||||
# utility macro
|
# utility macro
|
||||||
MACRO(_REMOVE_STRICT_FLAGS
|
macro(_remove_strict_flags
|
||||||
flag)
|
flag)
|
||||||
|
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||||
|
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||||
|
|
||||||
ENDMACRO(_REMOVE_STRICT_FLAGS)
|
endmacro()
|
||||||
|
|
||||||
MACRO(REMOVE_STRICT_FLAGS)
|
macro(remove_strict_flags)
|
||||||
|
|
||||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
_REMOVE_STRICT_FLAGS("-Wstrict-prototypes")
|
_remove_strict_flags("-Wstrict-prototypes")
|
||||||
_REMOVE_STRICT_FLAGS("-Wunused-parameter")
|
_remove_strict_flags("-Wunused-parameter")
|
||||||
_REMOVE_STRICT_FLAGS("-Wwrite-strings")
|
_remove_strict_flags("-Wwrite-strings")
|
||||||
_REMOVE_STRICT_FLAGS("-Wshadow")
|
_remove_strict_flags("-Wshadow")
|
||||||
_REMOVE_STRICT_FLAGS("-Werror=[^ ]+")
|
_remove_strict_flags("-Werror=[^ ]+")
|
||||||
_REMOVE_STRICT_FLAGS("-Werror")
|
_remove_strict_flags("-Werror")
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
endif()
|
||||||
|
|
||||||
IF(MSVC)
|
if(MSVC)
|
||||||
# TODO
|
# TODO
|
||||||
ENDIF(MSVC)
|
endif()
|
||||||
|
|
||||||
ENDMACRO(REMOVE_STRICT_FLAGS)
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
MACRO(GET_BLENDER_VERSION)
|
# XXX, until cmake fix this bug! from CheckCCompilerFlag.cmakem reported 11615
|
||||||
FILE(READ ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h CONTENT)
|
INCLUDE(CheckCSourceCompiles)
|
||||||
STRING(REGEX REPLACE "\n" ";" CONTENT "${CONTENT}")
|
MACRO (CHECK_C_COMPILER_FLAG__INTERNAL _FLAG _RESULT)
|
||||||
STRING(REGEX REPLACE "\t" ";" CONTENT "${CONTENT}")
|
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||||
STRING(REGEX REPLACE " " ";" CONTENT "${CONTENT}")
|
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
|
||||||
|
CHECK_C_SOURCE_COMPILES("int main(void) { return 0;}" ${_RESULT}
|
||||||
|
# Some compilers do not fail with a bad flag
|
||||||
|
FAIL_REGEX "unrecognized .*option" # GNU
|
||||||
|
FAIL_REGEX "ignoring unknown option" # MSVC
|
||||||
|
FAIL_REGEX "[Uu]nknown option" # HP
|
||||||
|
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
|
||||||
|
FAIL_REGEX "command option .* is not recognized" # XL
|
||||||
|
)
|
||||||
|
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
|
||||||
|
ENDMACRO (CHECK_C_COMPILER_FLAG__INTERNAL)
|
||||||
|
# XXX, end duplicate code.
|
||||||
|
|
||||||
FOREACH(ITEM ${CONTENT})
|
macro(ADD_CHECK_C_COMPILER_FLAG
|
||||||
IF(LASTITEM MATCHES "BLENDER_VERSION")
|
_CFLAGS
|
||||||
|
_FLAG)
|
||||||
|
|
||||||
|
# include(CheckCCompilerFlag)
|
||||||
|
|
||||||
|
# odd workaround
|
||||||
|
set(CFLAG_TEST "CFLAG_TEST")
|
||||||
|
CHECK_C_COMPILER_FLAG__INTERNAL("${_FLAG}" CFLAG_TEST)
|
||||||
|
if(CFLAG_TEST)
|
||||||
|
# message(STATUS "Using CFLAG: ${_FLAG}")
|
||||||
|
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}")
|
||||||
|
else()
|
||||||
|
message(STATUS "Unsupported CFLAG: ${_FLAG}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(ADD_CHECK_CXX_COMPILER_FLAG
|
||||||
|
_CXXFLAGS
|
||||||
|
_FLAG)
|
||||||
|
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
|
# odd workaround
|
||||||
|
set(CFLAG_TEST "CXXFLAG_TEST")
|
||||||
|
CHECK_CXX_COMPILER_FLAG("${_FLAG}" CXXFLAG_TEST)
|
||||||
|
if(CXXFLAG_TEST)
|
||||||
|
# message(STATUS "Using CXXFLAG: ${_FLAG}")
|
||||||
|
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}")
|
||||||
|
else()
|
||||||
|
message(STATUS "Unsupported CXXFLAG: ${_FLAG}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(get_blender_version)
|
||||||
|
file(READ ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h CONTENT)
|
||||||
|
string(REGEX REPLACE "\n" ";" CONTENT "${CONTENT}")
|
||||||
|
string(REGEX REPLACE "\t" ";" CONTENT "${CONTENT}")
|
||||||
|
string(REGEX REPLACE " " ";" CONTENT "${CONTENT}")
|
||||||
|
|
||||||
|
foreach(ITEM ${CONTENT})
|
||||||
|
if(LASTITEM MATCHES "BLENDER_VERSION")
|
||||||
MATH(EXPR BLENDER_VERSION_MAJOR "${ITEM} / 100")
|
MATH(EXPR BLENDER_VERSION_MAJOR "${ITEM} / 100")
|
||||||
MATH(EXPR BLENDER_VERSION_MINOR "${ITEM} % 100")
|
MATH(EXPR BLENDER_VERSION_MINOR "${ITEM} % 100")
|
||||||
SET(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}")
|
set(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}")
|
||||||
ENDIF(LASTITEM MATCHES "BLENDER_VERSION")
|
endif()
|
||||||
|
|
||||||
IF(LASTITEM MATCHES "BLENDER_SUBVERSION")
|
if(LASTITEM MATCHES "BLENDER_SUBVERSION")
|
||||||
SET(BLENDER_SUBVERSION ${ITEM})
|
set(BLENDER_SUBVERSION ${ITEM})
|
||||||
ENDIF(LASTITEM MATCHES "BLENDER_SUBVERSION")
|
endif()
|
||||||
|
|
||||||
IF(LASTITEM MATCHES "BLENDER_MINVERSION")
|
if(LASTITEM MATCHES "BLENDER_MINVERSION")
|
||||||
MATH(EXPR BLENDER_MINVERSION_MAJOR "${ITEM} / 100")
|
MATH(EXPR BLENDER_MINVERSION_MAJOR "${ITEM} / 100")
|
||||||
MATH(EXPR BLENDER_MINVERSION_MINOR "${ITEM} % 100")
|
MATH(EXPR BLENDER_MINVERSION_MINOR "${ITEM} % 100")
|
||||||
SET(BLENDER_MINVERSION "${BLENDER_MINVERSION_MAJOR}.${BLENDER_MINVERSION_MINOR}")
|
set(BLENDER_MINVERSION "${BLENDER_MINVERSION_MAJOR}.${BLENDER_MINVERSION_MINOR}")
|
||||||
ENDIF(LASTITEM MATCHES "BLENDER_MINVERSION")
|
endif()
|
||||||
|
|
||||||
IF(LASTITEM MATCHES "BLENDER_MINSUBVERSION")
|
if(LASTITEM MATCHES "BLENDER_MINSUBVERSION")
|
||||||
SET(BLENDER_MINSUBVERSION ${ITEM})
|
set(BLENDER_MINSUBVERSION ${ITEM})
|
||||||
ENDIF(LASTITEM MATCHES "BLENDER_MINSUBVERSION")
|
endif()
|
||||||
|
|
||||||
SET(LASTITEM ${ITEM})
|
set(LASTITEM ${ITEM})
|
||||||
ENDFOREACH(ITEM ${CONTENT})
|
endforeach()
|
||||||
|
|
||||||
MESSAGE(STATUS "Version major: ${BLENDER_VERSION_MAJOR}, Version minor: ${BLENDER_VERSION_MINOR}, Subversion: ${BLENDER_SUBVERSION}, Version: ${BLENDER_VERSION}")
|
# message(STATUS "Version major: ${BLENDER_VERSION_MAJOR}, Version minor: ${BLENDER_VERSION_MINOR}, Subversion: ${BLENDER_SUBVERSION}, Version: ${BLENDER_VERSION}")
|
||||||
MESSAGE(STATUS "Minversion major: ${BLENDER_MINVERSION_MAJOR}, Minversion minor: ${BLENDER_MINVERSION_MINOR}, MinSubversion: ${BLENDER_MINSUBVERSION}, Minversion: ${BLENDER_MINVERSION}")
|
# message(STATUS "Minversion major: ${BLENDER_MINVERSION_MAJOR}, Minversion minor: ${BLENDER_MINVERSION_MINOR}, MinSubversion: ${BLENDER_MINSUBVERSION}, Minversion: ${BLENDER_MINVERSION}")
|
||||||
ENDMACRO(GET_BLENDER_VERSION)
|
endmacro()
|
||||||
|
|||||||
@@ -92,8 +92,7 @@ def validate_arguments(args, bc):
|
|||||||
'WITH_BF_RAYOPTIMIZATION',
|
'WITH_BF_RAYOPTIMIZATION',
|
||||||
'BF_RAYOPTIMIZATION_SSE_FLAGS',
|
'BF_RAYOPTIMIZATION_SSE_FLAGS',
|
||||||
'BF_NO_ELBEEM',
|
'BF_NO_ELBEEM',
|
||||||
'WITH_BF_CXX_GUARDEDALLOC',
|
'WITH_BF_CXX_GUARDEDALLOC'
|
||||||
'BF_VCREDIST' # Windows-only, and useful only when creating installer
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Have options here that scons expects to be lists
|
# Have options here that scons expects to be lists
|
||||||
@@ -454,8 +453,7 @@ def read_opts(env, cfg, args):
|
|||||||
|
|
||||||
(BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)),
|
(BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)),
|
||||||
('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''),
|
('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''),
|
||||||
(BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)),
|
(BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False))
|
||||||
('BF_VCREDIST', 'Full path to vcredist', '')
|
|
||||||
) # end of opts.AddOptions()
|
) # end of opts.AddOptions()
|
||||||
|
|
||||||
return localopts
|
return localopts
|
||||||
@@ -547,12 +545,6 @@ def NSIS_Installer(target=None, source=None, env=None):
|
|||||||
|
|
||||||
ns_cnt = string.replace(ns_cnt, "[DODATAFILES]", datafiles)
|
ns_cnt = string.replace(ns_cnt, "[DODATAFILES]", datafiles)
|
||||||
|
|
||||||
# Setup vcredist part
|
|
||||||
vcredist = "File \""+env['BF_VCREDIST'] + "\"\n"
|
|
||||||
vcredist += " ExecWait '\"$TEMP\\" + os.path.basename(env['BF_VCREDIST']) + "\" /q'\n"
|
|
||||||
vcredist += " Delete \"$TEMP\\" + os.path.basename(env['BF_VCREDIST'])+"\""
|
|
||||||
ns_cnt = string.replace(ns_cnt, "[VCREDIST]", vcredist)
|
|
||||||
|
|
||||||
tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
|
tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
|
||||||
new_nsis = open(tmpnsi, 'w')
|
new_nsis = open(tmpnsi, 'w')
|
||||||
new_nsis.write(ns_cnt)
|
new_nsis.write(ns_cnt)
|
||||||
|
|||||||
@@ -65,11 +65,16 @@ EXAMPLE_SET_USED = set()
|
|||||||
_BPY_STRUCT_FAKE = "bpy_struct"
|
_BPY_STRUCT_FAKE = "bpy_struct"
|
||||||
_BPY_FULL_REBUILD = False
|
_BPY_FULL_REBUILD = False
|
||||||
|
|
||||||
|
|
||||||
def undocumented_message(module_name, type_name, identifier):
|
def undocumented_message(module_name, type_name, identifier):
|
||||||
|
if str(type_name).startswith('<module'):
|
||||||
|
preloadtitle = '%s.%s' % (module_name, identifier)
|
||||||
|
else:
|
||||||
|
preloadtitle = '%s.%s.%s' % (module_name, type_name, identifier)
|
||||||
message = "Undocumented (`contribute " \
|
message = "Undocumented (`contribute " \
|
||||||
"<http://wiki.blender.org/index.php/Dev:2.5/Py/API/Documentation/Contribute" \
|
"<http://wiki.blender.org/index.php/Dev:2.5/Py/API/Documentation/Contribute" \
|
||||||
"?action=edit§ion=new&preload=Dev:2.5/Py/API/Documentation/Contribute/Howto-message" \
|
"?action=edit§ion=new&preload=Dev:2.5/Py/API/Documentation/Contribute/Howto-message" \
|
||||||
"&preloadtitle=%s.%s.%s>`_)\n\n" % (module_name, type_name, identifier)
|
"&preloadtitle=%s>`_)\n\n" % preloadtitle
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
@@ -225,6 +230,16 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
|||||||
# write members of the module
|
# write members of the module
|
||||||
# only tested with PyStructs which are not exactly modules
|
# only tested with PyStructs which are not exactly modules
|
||||||
for key, descr in sorted(type(module).__dict__.items()):
|
for key, descr in sorted(type(module).__dict__.items()):
|
||||||
|
if key.startswith("__"):
|
||||||
|
continue
|
||||||
|
# naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect.
|
||||||
|
if type(descr) == types.GetSetDescriptorType: # 'bpy_app_type' name is only used for examples and messages
|
||||||
|
py_descr2sphinx("", fw, descr, module_name, "bpy_app_type", key)
|
||||||
|
attribute_set.add(key)
|
||||||
|
for key, descr in sorted(type(module).__dict__.items()):
|
||||||
|
if key.startswith("__"):
|
||||||
|
continue
|
||||||
|
|
||||||
if type(descr) == types.MemberDescriptorType:
|
if type(descr) == types.MemberDescriptorType:
|
||||||
if descr.__doc__:
|
if descr.__doc__:
|
||||||
fw(".. data:: %s\n\n" % key)
|
fw(".. data:: %s\n\n" % key)
|
||||||
@@ -403,6 +418,9 @@ def rna2sphinx(BASEPATH):
|
|||||||
|
|
||||||
fw(" mathutils.rst\n\n")
|
fw(" mathutils.rst\n\n")
|
||||||
fw(" Freestyle.rst\n\n")
|
fw(" Freestyle.rst\n\n")
|
||||||
|
fw(" mathutils.geometry.rst\n\n")
|
||||||
|
# XXX TODO
|
||||||
|
#fw(" bgl.rst\n\n")
|
||||||
fw(" blf.rst\n\n")
|
fw(" blf.rst\n\n")
|
||||||
fw(" aud.rst\n\n")
|
fw(" aud.rst\n\n")
|
||||||
|
|
||||||
@@ -484,6 +502,10 @@ def rna2sphinx(BASEPATH):
|
|||||||
pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
|
pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
|
||||||
del module
|
del module
|
||||||
|
|
||||||
|
import mathutils.geometry as module
|
||||||
|
pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities (mathutils.geometry)")
|
||||||
|
del module
|
||||||
|
|
||||||
import Freestyle as module
|
import Freestyle as module
|
||||||
pymodule2sphinx(BASEPATH, "Freestyle", module, "Freestyle Data Types & Operators (Freestyle)")
|
pymodule2sphinx(BASEPATH, "Freestyle", module, "Freestyle Data Types & Operators (Freestyle)")
|
||||||
del module
|
del module
|
||||||
@@ -492,6 +514,11 @@ def rna2sphinx(BASEPATH):
|
|||||||
pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
|
pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
|
||||||
del module
|
del module
|
||||||
|
|
||||||
|
# XXX TODO
|
||||||
|
#import bgl as module
|
||||||
|
#pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper (bgl)")
|
||||||
|
#del module
|
||||||
|
|
||||||
import aud as module
|
import aud as module
|
||||||
pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
|
pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
|
||||||
del module
|
del module
|
||||||
|
|||||||
40
extern/CMakeLists.txt
vendored
40
extern/CMakeLists.txt
vendored
@@ -25,30 +25,30 @@
|
|||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
# Otherwise we get warnings here that we cant fix in external projects
|
# Otherwise we get warnings here that we cant fix in external projects
|
||||||
REMOVE_STRICT_FLAGS()
|
remove_strict_flags()
|
||||||
|
|
||||||
IF(WITH_BULLET)
|
if(WITH_BULLET)
|
||||||
ADD_SUBDIRECTORY(bullet2)
|
add_subdirectory(bullet2)
|
||||||
ENDIF(WITH_BULLET)
|
endif()
|
||||||
|
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
ADD_SUBDIRECTORY(binreloc)
|
add_subdirectory(binreloc)
|
||||||
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
endif()
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(glew)
|
add_subdirectory(glew)
|
||||||
|
|
||||||
IF(WITH_IMAGE_OPENJPEG)
|
if(WITH_IMAGE_OPENJPEG)
|
||||||
ADD_SUBDIRECTORY(libopenjpeg)
|
add_subdirectory(libopenjpeg)
|
||||||
ENDIF(WITH_IMAGE_OPENJPEG)
|
endif()
|
||||||
|
|
||||||
IF(WITH_IMAGE_REDCODE)
|
if(WITH_IMAGE_REDCODE)
|
||||||
ADD_SUBDIRECTORY(libredcode)
|
add_subdirectory(libredcode)
|
||||||
ENDIF(WITH_IMAGE_REDCODE)
|
endif()
|
||||||
|
|
||||||
IF(WITH_LZO)
|
if(WITH_LZO)
|
||||||
ADD_SUBDIRECTORY(lzo)
|
add_subdirectory(lzo)
|
||||||
ENDIF(WITH_LZO)
|
endif()
|
||||||
|
|
||||||
IF(WITH_LZMA)
|
if(WITH_LZMA)
|
||||||
ADD_SUBDIRECTORY(lzma)
|
add_subdirectory(lzma)
|
||||||
ENDIF(WITH_LZMA)
|
endif()
|
||||||
|
|||||||
8
extern/binreloc/CMakeLists.txt
vendored
8
extern/binreloc/CMakeLists.txt
vendored
@@ -18,17 +18,17 @@
|
|||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
binreloc.c
|
binreloc.c
|
||||||
|
|
||||||
include/binreloc.h
|
include/binreloc.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
./include
|
./include
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DENABLE_BINRELOC)
|
add_definitions(-DENABLE_BINRELOC)
|
||||||
|
|
||||||
|
|
||||||
BLENDERLIB(extern_binreloc "${SRC}" "${INC}")
|
blenderlib(extern_binreloc "${SRC}" "${INC}")
|
||||||
|
|||||||
6
extern/bullet2/CMakeLists.txt
vendored
6
extern/bullet2/CMakeLists.txt
vendored
@@ -24,12 +24,12 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
src
|
src
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp
|
src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp
|
||||||
src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp
|
src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp
|
||||||
src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp
|
src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp
|
||||||
@@ -319,4 +319,4 @@ SET(SRC
|
|||||||
src/btBulletDynamicsCommon.h
|
src/btBulletDynamicsCommon.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(extern_bullet "${SRC}" "${INC}")
|
blenderlib(extern_bullet "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/src } )
|
include_directories( ${BULLET_PHYSICS_SOURCE_DIR}/src } )
|
||||||
|
|
||||||
SET(BulletCollision_SRCS
|
set(BulletCollision_SRCS
|
||||||
BroadphaseCollision/btAxisSweep3.cpp
|
BroadphaseCollision/btAxisSweep3.cpp
|
||||||
BroadphaseCollision/btBroadphaseProxy.cpp
|
BroadphaseCollision/btBroadphaseProxy.cpp
|
||||||
BroadphaseCollision/btCollisionAlgorithm.cpp
|
BroadphaseCollision/btCollisionAlgorithm.cpp
|
||||||
@@ -88,10 +88,10 @@ SET(BulletCollision_SRCS
|
|||||||
NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
|
NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(Root_HDRS
|
set(Root_HDRS
|
||||||
../btBulletCollisionCommon.h
|
../btBulletCollisionCommon.h
|
||||||
)
|
)
|
||||||
SET(BroadphaseCollision_HDRS
|
set(BroadphaseCollision_HDRS
|
||||||
BroadphaseCollision/btAxisSweep3.h
|
BroadphaseCollision/btAxisSweep3.h
|
||||||
BroadphaseCollision/btBroadphaseInterface.h
|
BroadphaseCollision/btBroadphaseInterface.h
|
||||||
BroadphaseCollision/btBroadphaseProxy.h
|
BroadphaseCollision/btBroadphaseProxy.h
|
||||||
@@ -105,7 +105,7 @@ SET(BroadphaseCollision_HDRS
|
|||||||
BroadphaseCollision/btQuantizedBvh.h
|
BroadphaseCollision/btQuantizedBvh.h
|
||||||
BroadphaseCollision/btSimpleBroadphase.h
|
BroadphaseCollision/btSimpleBroadphase.h
|
||||||
)
|
)
|
||||||
SET(CollisionDispatch_HDRS
|
set(CollisionDispatch_HDRS
|
||||||
CollisionDispatch/btActivatingCollisionAlgorithm.h
|
CollisionDispatch/btActivatingCollisionAlgorithm.h
|
||||||
CollisionDispatch/btCollisionConfiguration.h
|
CollisionDispatch/btCollisionConfiguration.h
|
||||||
CollisionDispatch/btCollisionCreateFunc.h
|
CollisionDispatch/btCollisionCreateFunc.h
|
||||||
@@ -129,7 +129,7 @@ SET(CollisionDispatch_HDRS
|
|||||||
CollisionDispatch/btUnionFind.h
|
CollisionDispatch/btUnionFind.h
|
||||||
CollisionDispatch/SphereTriangleDetector.h
|
CollisionDispatch/SphereTriangleDetector.h
|
||||||
)
|
)
|
||||||
SET(CollisionShapes_HDRS
|
set(CollisionShapes_HDRS
|
||||||
CollisionShapes/btBoxShape.h
|
CollisionShapes/btBoxShape.h
|
||||||
CollisionShapes/btBvhTriangleMeshShape.h
|
CollisionShapes/btBvhTriangleMeshShape.h
|
||||||
CollisionShapes/btCapsuleShape.h
|
CollisionShapes/btCapsuleShape.h
|
||||||
@@ -166,7 +166,7 @@ SET(CollisionShapes_HDRS
|
|||||||
CollisionShapes/btTriangleMeshShape.h
|
CollisionShapes/btTriangleMeshShape.h
|
||||||
CollisionShapes/btUniformScalingShape.h
|
CollisionShapes/btUniformScalingShape.h
|
||||||
)
|
)
|
||||||
SET(Gimpact_HDRS
|
set(Gimpact_HDRS
|
||||||
Gimpact/btGImpactShape.h
|
Gimpact/btGImpactShape.h
|
||||||
Gimpact/gim_contact.h
|
Gimpact/gim_contact.h
|
||||||
Gimpact/btGImpactBvh.h
|
Gimpact/btGImpactBvh.h
|
||||||
@@ -178,7 +178,7 @@ SET(Gimpact_HDRS
|
|||||||
Gimpact/btGImpactQuantizedBvh.h
|
Gimpact/btGImpactQuantizedBvh.h
|
||||||
Gimpact/gim_box_set.h
|
Gimpact/gim_box_set.h
|
||||||
)
|
)
|
||||||
SET(NarrowPhaseCollision_HDRS
|
set(NarrowPhaseCollision_HDRS
|
||||||
NarrowPhaseCollision/btContinuousConvexCollision.h
|
NarrowPhaseCollision/btContinuousConvexCollision.h
|
||||||
NarrowPhaseCollision/btConvexCast.h
|
NarrowPhaseCollision/btConvexCast.h
|
||||||
NarrowPhaseCollision/btConvexPenetrationDepthSolver.h
|
NarrowPhaseCollision/btConvexPenetrationDepthSolver.h
|
||||||
@@ -197,7 +197,7 @@ SET(NarrowPhaseCollision_HDRS
|
|||||||
NarrowPhaseCollision/btVoronoiSimplexSolver.h
|
NarrowPhaseCollision/btVoronoiSimplexSolver.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(BulletCollision_HDRS
|
set(BulletCollision_HDRS
|
||||||
${Root_HDRS}
|
${Root_HDRS}
|
||||||
${BroadphaseCollision_HDRS}
|
${BroadphaseCollision_HDRS}
|
||||||
${CollisionDispatch_HDRS}
|
${CollisionDispatch_HDRS}
|
||||||
@@ -207,28 +207,28 @@ SET(BulletCollision_HDRS
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
ADD_LIBRARY(BulletCollision ${BulletCollision_SRCS} ${BulletCollision_HDRS})
|
add_library(BulletCollision ${BulletCollision_SRCS} ${BulletCollision_HDRS})
|
||||||
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES VERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES VERSION ${BULLET_VERSION})
|
||||||
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES SOVERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES SOVERSION ${BULLET_VERSION})
|
||||||
IF (BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
TARGET_LINK_LIBRARIES(BulletCollision LinearMath)
|
target_link_libraries(BulletCollision LinearMath)
|
||||||
ENDIF (BUILD_SHARED_LIBS)
|
endif()
|
||||||
|
|
||||||
#INSTALL of other files requires CMake 2.6
|
#INSTALL of other files requires CMake 2.6
|
||||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||||
INSTALL(TARGETS BulletCollision DESTINATION lib)
|
install(TARGETS BulletCollision DESTINATION lib)
|
||||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
||||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
endif()
|
||||||
|
|
||||||
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
||||||
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES FRAMEWORK true)
|
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES FRAMEWORK true)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES PUBLIC_HEADER "${Root_HDRS}")
|
SET_TARGET_PROPERTIES(BulletCollision PROPERTIES PUBLIC_HEADER "${Root_HDRS}")
|
||||||
# Have to list out sub-directories manually:
|
# Have to list out sub-directories manually:
|
||||||
SET_PROPERTY(SOURCE ${BroadphaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/BroadphaseCollision)
|
set_property(SOURCE ${BroadphaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/BroadphaseCollision)
|
||||||
SET_PROPERTY(SOURCE ${CollisionDispatch_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionDispatch)
|
set_property(SOURCE ${CollisionDispatch_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionDispatch)
|
||||||
SET_PROPERTY(SOURCE ${CollisionShapes_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionShapes)
|
set_property(SOURCE ${CollisionShapes_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionShapes)
|
||||||
SET_PROPERTY(SOURCE ${Gimpact_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Gimpact)
|
set_property(SOURCE ${Gimpact_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Gimpact)
|
||||||
SET_PROPERTY(SOURCE ${NarrowPhaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/NarrowPhaseCollision)
|
set_property(SOURCE ${NarrowPhaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/NarrowPhaseCollision)
|
||||||
|
|
||||||
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
endif()
|
||||||
|
|||||||
44
extern/bullet2/src/BulletDynamics/CMakeLists.txt
vendored
44
extern/bullet2/src/BulletDynamics/CMakeLists.txt
vendored
@@ -1,6 +1,6 @@
|
|||||||
INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/src } )
|
include_directories( ${BULLET_PHYSICS_SOURCE_DIR}/src } )
|
||||||
|
|
||||||
SET(BulletDynamics_SRCS
|
set(BulletDynamics_SRCS
|
||||||
ConstraintSolver/btContactConstraint.cpp
|
ConstraintSolver/btContactConstraint.cpp
|
||||||
ConstraintSolver/btConeTwistConstraint.cpp
|
ConstraintSolver/btConeTwistConstraint.cpp
|
||||||
ConstraintSolver/btGeneric6DofConstraint.cpp
|
ConstraintSolver/btGeneric6DofConstraint.cpp
|
||||||
@@ -19,11 +19,11 @@ SET(BulletDynamics_SRCS
|
|||||||
Character/btKinematicCharacterController.cpp
|
Character/btKinematicCharacterController.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(Root_HDRS
|
set(Root_HDRS
|
||||||
../btBulletDynamicsCommon.h
|
../btBulletDynamicsCommon.h
|
||||||
../btBulletCollisionCommon.h
|
../btBulletCollisionCommon.h
|
||||||
)
|
)
|
||||||
SET(ConstraintSolver_HDRS
|
set(ConstraintSolver_HDRS
|
||||||
ConstraintSolver/btConstraintSolver.h
|
ConstraintSolver/btConstraintSolver.h
|
||||||
ConstraintSolver/btContactConstraint.h
|
ConstraintSolver/btContactConstraint.h
|
||||||
ConstraintSolver/btContactSolverInfo.h
|
ConstraintSolver/btContactSolverInfo.h
|
||||||
@@ -39,27 +39,27 @@ SET(ConstraintSolver_HDRS
|
|||||||
ConstraintSolver/btSolverConstraint.h
|
ConstraintSolver/btSolverConstraint.h
|
||||||
ConstraintSolver/btTypedConstraint.h
|
ConstraintSolver/btTypedConstraint.h
|
||||||
)
|
)
|
||||||
SET(Dynamics_HDRS
|
set(Dynamics_HDRS
|
||||||
Dynamics/btContinuousDynamicsWorld.h
|
Dynamics/btContinuousDynamicsWorld.h
|
||||||
Dynamics/btDiscreteDynamicsWorld.h
|
Dynamics/btDiscreteDynamicsWorld.h
|
||||||
Dynamics/btDynamicsWorld.h
|
Dynamics/btDynamicsWorld.h
|
||||||
Dynamics/btSimpleDynamicsWorld.h
|
Dynamics/btSimpleDynamicsWorld.h
|
||||||
Dynamics/btRigidBody.h
|
Dynamics/btRigidBody.h
|
||||||
)
|
)
|
||||||
SET(Vehicle_HDRS
|
set(Vehicle_HDRS
|
||||||
Vehicle/btRaycastVehicle.h
|
Vehicle/btRaycastVehicle.h
|
||||||
Vehicle/btVehicleRaycaster.h
|
Vehicle/btVehicleRaycaster.h
|
||||||
Vehicle/btWheelInfo.h
|
Vehicle/btWheelInfo.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(Character_HDRS
|
set(Character_HDRS
|
||||||
Character/btCharacterControllerInterface.h
|
Character/btCharacterControllerInterface.h
|
||||||
Character/btKinematicCharacterController.h
|
Character/btKinematicCharacterController.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SET(BulletDynamics_HDRS
|
set(BulletDynamics_HDRS
|
||||||
${Root_HDRS}
|
${Root_HDRS}
|
||||||
${ConstraintSolver_HDRS}
|
${ConstraintSolver_HDRS}
|
||||||
${Dynamics_HDRS}
|
${Dynamics_HDRS}
|
||||||
@@ -68,26 +68,26 @@ SET(BulletDynamics_HDRS
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
ADD_LIBRARY(BulletDynamics ${BulletDynamics_SRCS} ${BulletDynamics_HDRS})
|
add_library(BulletDynamics ${BulletDynamics_SRCS} ${BulletDynamics_HDRS})
|
||||||
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES VERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES VERSION ${BULLET_VERSION})
|
||||||
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES SOVERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES SOVERSION ${BULLET_VERSION})
|
||||||
IF (BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
TARGET_LINK_LIBRARIES(BulletDynamics BulletCollision LinearMath)
|
target_link_libraries(BulletDynamics BulletCollision LinearMath)
|
||||||
ENDIF (BUILD_SHARED_LIBS)
|
endif()
|
||||||
|
|
||||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||||
INSTALL(TARGETS BulletDynamics DESTINATION lib)
|
install(TARGETS BulletDynamics DESTINATION lib)
|
||||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
||||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
endif()
|
||||||
|
|
||||||
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
||||||
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES FRAMEWORK true)
|
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES FRAMEWORK true)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES PUBLIC_HEADER "${Root_HDRS}")
|
SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES PUBLIC_HEADER "${Root_HDRS}")
|
||||||
# Have to list out sub-directories manually:
|
# Have to list out sub-directories manually:
|
||||||
SET_PROPERTY(SOURCE ${ConstraintSolver_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/ConstraintSolver)
|
set_property(SOURCE ${ConstraintSolver_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/ConstraintSolver)
|
||||||
SET_PROPERTY(SOURCE ${Dynamics_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Dynamics)
|
set_property(SOURCE ${Dynamics_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Dynamics)
|
||||||
SET_PROPERTY(SOURCE ${Vehicle_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Vehicle)
|
set_property(SOURCE ${Vehicle_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Vehicle)
|
||||||
SET_PROPERTY(SOURCE ${Character_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Character)
|
set_property(SOURCE ${Character_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Character)
|
||||||
|
|
||||||
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
endif()
|
||||||
|
|||||||
26
extern/bullet2/src/BulletSoftBody/CMakeLists.txt
vendored
26
extern/bullet2/src/BulletSoftBody/CMakeLists.txt
vendored
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
include_directories(
|
||||||
${BULLET_PHYSICS_SOURCE_DIR}/src }
|
${BULLET_PHYSICS_SOURCE_DIR}/src }
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(BulletSoftBody_SRCS
|
set(BulletSoftBody_SRCS
|
||||||
btSoftBody.cpp
|
btSoftBody.cpp
|
||||||
btSoftBodyHelpers.cpp
|
btSoftBodyHelpers.cpp
|
||||||
btSoftBodyRigidBodyCollisionConfiguration.cpp
|
btSoftBodyRigidBodyCollisionConfiguration.cpp
|
||||||
@@ -13,7 +13,7 @@ SET(BulletSoftBody_SRCS
|
|||||||
btSoftRigidDynamicsWorld.cpp
|
btSoftRigidDynamicsWorld.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(BulletSoftBody_HDRS
|
set(BulletSoftBody_HDRS
|
||||||
btSoftBody.h
|
btSoftBody.h
|
||||||
btSparseSDF.h
|
btSparseSDF.h
|
||||||
btSoftBodyHelpers.h
|
btSoftBodyHelpers.h
|
||||||
@@ -25,19 +25,19 @@ SET(BulletSoftBody_HDRS
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ADD_LIBRARY(BulletSoftBody ${BulletSoftBody_SRCS} ${BulletSoftBody_HDRS})
|
add_library(BulletSoftBody ${BulletSoftBody_SRCS} ${BulletSoftBody_HDRS})
|
||||||
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES VERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES VERSION ${BULLET_VERSION})
|
||||||
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES SOVERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES SOVERSION ${BULLET_VERSION})
|
||||||
IF (BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
TARGET_LINK_LIBRARIES(BulletSoftBody BulletDynamics)
|
target_link_libraries(BulletSoftBody BulletDynamics)
|
||||||
ENDIF (BUILD_SHARED_LIBS)
|
endif()
|
||||||
|
|
||||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||||
INSTALL(TARGETS BulletSoftBody DESTINATION lib)
|
install(TARGETS BulletSoftBody DESTINATION lib)
|
||||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
||||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
endif()
|
||||||
|
|
||||||
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
||||||
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES FRAMEWORK true)
|
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES FRAMEWORK true)
|
||||||
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES PUBLIC_HEADER "${BulletSoftBody_HDRS}")
|
SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES PUBLIC_HEADER "${BulletSoftBody_HDRS}")
|
||||||
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
endif()
|
||||||
|
|||||||
8
extern/bullet2/src/CMakeLists.txt
vendored
8
extern/bullet2/src/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
ADD_SUBDIRECTORY(BulletCollision)
|
add_subdirectory(BulletCollision)
|
||||||
ADD_SUBDIRECTORY(BulletDynamics)
|
add_subdirectory(BulletDynamics)
|
||||||
ADD_SUBDIRECTORY(LinearMath)
|
add_subdirectory(LinearMath)
|
||||||
ADD_SUBDIRECTORY(BulletSoftBody )
|
add_subdirectory(BulletSoftBody )
|
||||||
|
|||||||
20
extern/bullet2/src/LinearMath/CMakeLists.txt
vendored
20
extern/bullet2/src/LinearMath/CMakeLists.txt
vendored
@@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
include_directories(
|
||||||
${BULLET_PHYSICS_SOURCE_DIR}/src }
|
${BULLET_PHYSICS_SOURCE_DIR}/src }
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(LinearMath_SRCS
|
set(LinearMath_SRCS
|
||||||
btConvexHull.cpp
|
btConvexHull.cpp
|
||||||
btQuickprof.cpp
|
btQuickprof.cpp
|
||||||
btGeometryUtil.cpp
|
btGeometryUtil.cpp
|
||||||
btAlignedAllocator.cpp
|
btAlignedAllocator.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(LinearMath_HDRS
|
set(LinearMath_HDRS
|
||||||
btAlignedObjectArray.h
|
btAlignedObjectArray.h
|
||||||
btList.h
|
btList.h
|
||||||
btPoolAllocator.h
|
btPoolAllocator.h
|
||||||
@@ -35,17 +35,17 @@ SET(LinearMath_HDRS
|
|||||||
btTransformUtil.h
|
btTransformUtil.h
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_LIBRARY(LinearMath ${LinearMath_SRCS} ${LinearMath_HDRS})
|
add_library(LinearMath ${LinearMath_SRCS} ${LinearMath_HDRS})
|
||||||
SET_TARGET_PROPERTIES(LinearMath PROPERTIES VERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(LinearMath PROPERTIES VERSION ${BULLET_VERSION})
|
||||||
SET_TARGET_PROPERTIES(LinearMath PROPERTIES SOVERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(LinearMath PROPERTIES SOVERSION ${BULLET_VERSION})
|
||||||
|
|
||||||
#FILES_MATCHING requires CMake 2.6
|
#FILES_MATCHING requires CMake 2.6
|
||||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||||
INSTALL(TARGETS LinearMath DESTINATION lib)
|
install(TARGETS LinearMath DESTINATION lib)
|
||||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
|
||||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
endif()
|
||||||
|
|
||||||
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
||||||
SET_TARGET_PROPERTIES(LinearMath PROPERTIES FRAMEWORK true)
|
SET_TARGET_PROPERTIES(LinearMath PROPERTIES FRAMEWORK true)
|
||||||
SET_TARGET_PROPERTIES(LinearMath PROPERTIES PUBLIC_HEADER "${LinearMath_HDRS}")
|
SET_TARGET_PROPERTIES(LinearMath PROPERTIES PUBLIC_HEADER "${LinearMath_HDRS}")
|
||||||
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
endif()
|
||||||
|
|||||||
14
extern/glew/CMakeLists.txt
vendored
14
extern/glew/CMakeLists.txt
vendored
@@ -24,15 +24,15 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
./include
|
./include
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(UNIX)
|
if(UNIX)
|
||||||
LIST(APPEND INC ${X11_X11_INCLUDE_PATH})
|
list(APPEND INC ${X11_X11_INCLUDE_PATH})
|
||||||
ENDIF(UNIX)
|
endif()
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
src/glew.c
|
src/glew.c
|
||||||
|
|
||||||
include/GL/glew.h
|
include/GL/glew.h
|
||||||
@@ -40,6 +40,6 @@ SET(SRC
|
|||||||
include/GL/wglew.h
|
include/GL/wglew.h
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DGLEW_STATIC)
|
add_definitions(-DGLEW_STATIC)
|
||||||
|
|
||||||
BLENDERLIB(extern_glew "${SRC}" "${INC}")
|
blenderlib(extern_glew "${SRC}" "${INC}")
|
||||||
|
|||||||
6
extern/libopenjpeg/CMakeLists.txt
vendored
6
extern/libopenjpeg/CMakeLists.txt
vendored
@@ -24,11 +24,11 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
bio.c
|
bio.c
|
||||||
cio.c
|
cio.c
|
||||||
dwt.c
|
dwt.c
|
||||||
@@ -73,4 +73,4 @@ SET(SRC
|
|||||||
tgt.h
|
tgt.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(extern_openjpeg "${SRC}" "${INC}")
|
blenderlib(extern_openjpeg "${SRC}" "${INC}")
|
||||||
|
|||||||
6
extern/libredcode/CMakeLists.txt
vendored
6
extern/libredcode/CMakeLists.txt
vendored
@@ -24,12 +24,12 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
../libopenjpeg
|
../libopenjpeg
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
codec.c
|
codec.c
|
||||||
debayer.c
|
debayer.c
|
||||||
format.c
|
format.c
|
||||||
@@ -39,4 +39,4 @@ SET(SRC
|
|||||||
format.h
|
format.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(extern_redcode "${SRC}" "${INC}")
|
blenderlib(extern_redcode "${SRC}" "${INC}")
|
||||||
|
|||||||
6
extern/lzma/CMakeLists.txt
vendored
6
extern/lzma/CMakeLists.txt
vendored
@@ -24,11 +24,11 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
Alloc.c
|
Alloc.c
|
||||||
LzFind.c
|
LzFind.c
|
||||||
LzmaDec.c
|
LzmaDec.c
|
||||||
@@ -44,4 +44,4 @@ SET(SRC
|
|||||||
Types.h
|
Types.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(extern_lzma "${SRC}" "${INC}")
|
blenderlib(extern_lzma "${SRC}" "${INC}")
|
||||||
|
|||||||
6
extern/lzo/CMakeLists.txt
vendored
6
extern/lzo/CMakeLists.txt
vendored
@@ -24,11 +24,11 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
minilzo/minilzo.c
|
minilzo/minilzo.c
|
||||||
|
|
||||||
minilzo/lzoconf.h
|
minilzo/lzoconf.h
|
||||||
@@ -36,4 +36,4 @@ SET(SRC
|
|||||||
minilzo/minilzo.h
|
minilzo/minilzo.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(extern_minilzo "${SRC}" "${INC}")
|
blenderlib(extern_minilzo "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,30 +24,30 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(audaspace)
|
add_subdirectory(audaspace)
|
||||||
ADD_SUBDIRECTORY(string)
|
add_subdirectory(string)
|
||||||
ADD_SUBDIRECTORY(ghost)
|
add_subdirectory(ghost)
|
||||||
ADD_SUBDIRECTORY(guardedalloc)
|
add_subdirectory(guardedalloc)
|
||||||
ADD_SUBDIRECTORY(moto)
|
add_subdirectory(moto)
|
||||||
ADD_SUBDIRECTORY(memutil)
|
add_subdirectory(memutil)
|
||||||
ADD_SUBDIRECTORY(iksolver)
|
add_subdirectory(iksolver)
|
||||||
ADD_SUBDIRECTORY(opennl)
|
add_subdirectory(opennl)
|
||||||
ADD_SUBDIRECTORY(smoke)
|
add_subdirectory(smoke)
|
||||||
|
|
||||||
IF(WITH_MOD_FLUID)
|
if(WITH_MOD_FLUID)
|
||||||
ADD_SUBDIRECTORY(elbeem)
|
add_subdirectory(elbeem)
|
||||||
ENDIF(WITH_MOD_FLUID)
|
endif()
|
||||||
|
|
||||||
IF(WITH_MOD_DECIMATE)
|
if(WITH_MOD_DECIMATE)
|
||||||
ADD_SUBDIRECTORY(container)
|
add_subdirectory(container)
|
||||||
ADD_SUBDIRECTORY(decimation)
|
add_subdirectory(decimation)
|
||||||
ENDIF(WITH_MOD_DECIMATE)
|
endif()
|
||||||
|
|
||||||
IF(WITH_MOD_BOOLEAN)
|
if(WITH_MOD_BOOLEAN)
|
||||||
ADD_SUBDIRECTORY(boolop)
|
add_subdirectory(boolop)
|
||||||
ADD_SUBDIRECTORY(bsp)
|
add_subdirectory(bsp)
|
||||||
ENDIF(WITH_MOD_BOOLEAN)
|
endif()
|
||||||
|
|
||||||
IF(WITH_IK_ITASC)
|
if(WITH_IK_ITASC)
|
||||||
ADD_SUBDIRECTORY(itasc)
|
add_subdirectory(itasc)
|
||||||
ENDIF(WITH_IK_ITASC)
|
endif()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END LGPL LICENSE BLOCK *****
|
# ***** END LGPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
intern
|
intern
|
||||||
FX SRC
|
FX SRC
|
||||||
@@ -28,7 +28,7 @@ SET(INC
|
|||||||
${LIBSAMPLERATE_INC}
|
${LIBSAMPLERATE_INC}
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
FX/AUD_AccumulatorFactory.cpp
|
FX/AUD_AccumulatorFactory.cpp
|
||||||
FX/AUD_BaseIIRFilterReader.cpp
|
FX/AUD_BaseIIRFilterReader.cpp
|
||||||
FX/AUD_ButterworthFactory.cpp
|
FX/AUD_ButterworthFactory.cpp
|
||||||
@@ -153,94 +153,94 @@ SET(SRC
|
|||||||
FX/AUD_VolumeFactory.h
|
FX/AUD_VolumeFactory.h
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
ADD_DEFINITIONS(-DWITH_FFMPEG)
|
add_definitions(-DWITH_FFMPEG)
|
||||||
LIST(APPEND INC ffmpeg ${FFMPEG_INC})
|
list(APPEND INC ffmpeg ${FFMPEG_INC})
|
||||||
SET(FFMPEGSRC
|
set(FFMPEGSRC
|
||||||
ffmpeg/AUD_FFMPEGFactory.cpp
|
ffmpeg/AUD_FFMPEGFactory.cpp
|
||||||
ffmpeg/AUD_FFMPEGReader.cpp
|
ffmpeg/AUD_FFMPEGReader.cpp
|
||||||
|
|
||||||
ffmpeg/AUD_FFMPEGFactory.h
|
ffmpeg/AUD_FFMPEGFactory.h
|
||||||
ffmpeg/AUD_FFMPEGReader.h
|
ffmpeg/AUD_FFMPEGReader.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_CODEC_FFMPEG)
|
endif()
|
||||||
|
|
||||||
IF(WITH_SDL)
|
if(WITH_SDL)
|
||||||
ADD_DEFINITIONS(-DWITH_SDL)
|
add_definitions(-DWITH_SDL)
|
||||||
LIST(APPEND INC SDL ${SDL_INCLUDE_DIR})
|
list(APPEND INC SDL ${SDL_INCLUDE_DIR})
|
||||||
SET(SDLSRC
|
set(SDLSRC
|
||||||
SDL/AUD_SDLDevice.cpp
|
SDL/AUD_SDLDevice.cpp
|
||||||
|
|
||||||
SDL/AUD_SDLDevice.h
|
SDL/AUD_SDLDevice.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_SDL)
|
endif()
|
||||||
|
|
||||||
IF(WITH_OPENAL)
|
if(WITH_OPENAL)
|
||||||
ADD_DEFINITIONS(-DWITH_OPENAL)
|
add_definitions(-DWITH_OPENAL)
|
||||||
LIST(APPEND INC OpenAL ${OPENAL_INCLUDE_DIR})
|
list(APPEND INC OpenAL ${OPENAL_INCLUDE_DIR})
|
||||||
SET(OPENALSRC
|
set(OPENALSRC
|
||||||
OpenAL/AUD_OpenALDevice.cpp
|
OpenAL/AUD_OpenALDevice.cpp
|
||||||
|
|
||||||
OpenAL/AUD_OpenALDevice.h
|
OpenAL/AUD_OpenALDevice.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_OPENAL)
|
endif()
|
||||||
|
|
||||||
IF(WITH_JACK)
|
if(WITH_JACK)
|
||||||
ADD_DEFINITIONS(-DWITH_JACK)
|
add_definitions(-DWITH_JACK)
|
||||||
LIST(APPEND INC jack ${JACK_INC})
|
list(APPEND INC jack ${JACK_INC})
|
||||||
SET(JACKSRC
|
set(JACKSRC
|
||||||
jack/AUD_JackDevice.cpp
|
jack/AUD_JackDevice.cpp
|
||||||
|
|
||||||
jack/AUD_JackDevice.h
|
jack/AUD_JackDevice.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_JACK)
|
endif()
|
||||||
|
|
||||||
IF(WITH_CODEC_SNDFILE)
|
if(WITH_CODEC_SNDFILE)
|
||||||
ADD_DEFINITIONS(-DWITH_SNDFILE)
|
add_definitions(-DWITH_SNDFILE)
|
||||||
LIST(APPEND INC sndfile ${SNDFILE_INC})
|
list(APPEND INC sndfile ${SNDFILE_INC})
|
||||||
SET(SNDFILESRC
|
set(SNDFILESRC
|
||||||
sndfile/AUD_SndFileFactory.cpp
|
sndfile/AUD_SndFileFactory.cpp
|
||||||
sndfile/AUD_SndFileReader.cpp
|
sndfile/AUD_SndFileReader.cpp
|
||||||
|
|
||||||
sndfile/AUD_SndFileFactory.h
|
sndfile/AUD_SndFileFactory.h
|
||||||
sndfile/AUD_SndFileReader.h
|
sndfile/AUD_SndFileReader.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_CODEC_SNDFILE)
|
endif()
|
||||||
|
|
||||||
IF(WITH_SAMPLERATE)
|
if(WITH_SAMPLERATE)
|
||||||
ADD_DEFINITIONS(-DWITH_SAMPLERATE)
|
add_definitions(-DWITH_SAMPLERATE)
|
||||||
SET(SRCFILESRC
|
set(SRCFILESRC
|
||||||
SRC/AUD_SRCResampleFactory.cpp
|
SRC/AUD_SRCResampleFactory.cpp
|
||||||
SRC/AUD_SRCResampleReader.cpp
|
SRC/AUD_SRCResampleReader.cpp
|
||||||
|
|
||||||
SRC/AUD_SRCResampleFactory.h
|
SRC/AUD_SRCResampleFactory.h
|
||||||
SRC/AUD_SRCResampleReader.h
|
SRC/AUD_SRCResampleReader.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_SAMPLERATE)
|
endif()
|
||||||
|
|
||||||
IF(WITH_FFTW3 AND FALSE)
|
if(WITH_FFTW3 AND FALSE)
|
||||||
ADD_DEFINITIONS(-DWITH_FFTW3)
|
add_definitions(-DWITH_FFTW3)
|
||||||
LIST(APPEND INC fftw ${FFTW3_INC})
|
list(APPEND INC fftw ${FFTW3_INC})
|
||||||
SET(FFTW3SRC
|
set(FFTW3SRC
|
||||||
fftw/AUD_BandPassFactory.cpp
|
fftw/AUD_BandPassFactory.cpp
|
||||||
fftw/AUD_BandPassReader.cpp
|
fftw/AUD_BandPassReader.cpp
|
||||||
|
|
||||||
fftw/AUD_BandPassFactory.h
|
fftw/AUD_BandPassFactory.h
|
||||||
fftw/AUD_BandPassReader.h
|
fftw/AUD_BandPassReader.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_FFTW3 AND FALSE)
|
endif()
|
||||||
|
|
||||||
IF(WITH_PYTHON)
|
if(WITH_PYTHON)
|
||||||
LIST(APPEND INC Python ${PYTHON_INC})
|
list(APPEND INC Python ${PYTHON_INC})
|
||||||
SET(PYTHONSRC
|
set(PYTHONSRC
|
||||||
Python/AUD_PyAPI.cpp
|
Python/AUD_PyAPI.cpp
|
||||||
|
|
||||||
Python/AUD_PyAPI.h
|
Python/AUD_PyAPI.h
|
||||||
)
|
)
|
||||||
ADD_DEFINITIONS(-DWITH_PYTHON)
|
add_definitions(-DWITH_PYTHON)
|
||||||
ENDIF(WITH_PYTHON)
|
endif()
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
${SRC}
|
${SRC}
|
||||||
${FFMPEGSRC}
|
${FFMPEGSRC}
|
||||||
${SNDFILESRC}
|
${SNDFILESRC}
|
||||||
@@ -252,4 +252,4 @@ SET(SRC
|
|||||||
${PYTHONSRC}
|
${PYTHONSRC}
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_audaspace "${SRC}" "${INC}")
|
blenderlib(bf_intern_audaspace "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
./intern
|
./intern
|
||||||
./extern
|
./extern
|
||||||
@@ -36,7 +36,7 @@ SET(INC
|
|||||||
../../source/blender/makesdna
|
../../source/blender/makesdna
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/BOP_BBox.cpp
|
intern/BOP_BBox.cpp
|
||||||
intern/BOP_BSPNode.cpp
|
intern/BOP_BSPNode.cpp
|
||||||
intern/BOP_BSPTree.cpp
|
intern/BOP_BSPTree.cpp
|
||||||
@@ -75,4 +75,4 @@ SET(SRC
|
|||||||
intern/BOP_Vertex.h
|
intern/BOP_Vertex.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_bop "${SRC}" "${INC}")
|
blenderlib(bf_intern_bop "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,14 +24,14 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
./intern
|
./intern
|
||||||
../container
|
../container
|
||||||
../moto/include
|
../moto/include
|
||||||
../memutil
|
../memutil
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/BSP_CSGMesh.cpp
|
intern/BSP_CSGMesh.cpp
|
||||||
intern/BSP_MeshPrimitives.cpp
|
intern/BSP_MeshPrimitives.cpp
|
||||||
intern/CSG_BooleanOps.cpp
|
intern/CSG_BooleanOps.cpp
|
||||||
@@ -43,4 +43,4 @@ SET(SRC
|
|||||||
intern/BSP_MeshPrimitives.h
|
intern/BSP_MeshPrimitives.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_bsp "${SRC}" "${INC}")
|
blenderlib(bf_intern_bsp "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/CTR_List.cpp
|
intern/CTR_List.cpp
|
||||||
|
|
||||||
CTR_List.h
|
CTR_List.h
|
||||||
@@ -38,4 +38,4 @@ SET(SRC
|
|||||||
CTR_UHeap.h
|
CTR_UHeap.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_ctr "${SRC}" "${INC}")
|
blenderlib(bf_intern_ctr "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,14 +24,14 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
../container
|
../container
|
||||||
../memutil
|
../memutil
|
||||||
../moto/include
|
../moto/include
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/LOD_EdgeCollapser.cpp
|
intern/LOD_EdgeCollapser.cpp
|
||||||
intern/LOD_ExternNormalEditor.cpp
|
intern/LOD_ExternNormalEditor.cpp
|
||||||
intern/LOD_FaceNormalEditor.cpp
|
intern/LOD_FaceNormalEditor.cpp
|
||||||
@@ -56,4 +56,4 @@ SET(SRC
|
|||||||
intern/LOD_QuadricEditor.h
|
intern/LOD_QuadricEditor.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_decimate "${SRC}" "${INC}")
|
blenderlib(bf_intern_decimate "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
extern
|
extern
|
||||||
${PNG_INC}
|
${PNG_INC}
|
||||||
${ZLIB_INC}
|
${ZLIB_INC}
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/attributes.cpp
|
intern/attributes.cpp
|
||||||
intern/controlparticles.cpp
|
intern/controlparticles.cpp
|
||||||
intern/elbeem.cpp
|
intern/elbeem.cpp
|
||||||
@@ -86,13 +86,13 @@ SET(SRC
|
|||||||
intern/utilities.h
|
intern/utilities.h
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DNOGUI -DELBEEM_BLENDER=1)
|
add_definitions(-DNOGUI -DELBEEM_BLENDER=1)
|
||||||
IF(WINDOWS)
|
if(WINDOWS)
|
||||||
ADD_DEFINITIONS(-DUSE_MSVC6FIXES)
|
add_definitions(-DUSE_MSVC6FIXES)
|
||||||
ENDIF(WINDOWS)
|
endif()
|
||||||
|
|
||||||
IF(WITH_OPENMP)
|
if(WITH_OPENMP)
|
||||||
ADD_DEFINITIONS(-DPARALLEL=1)
|
add_definitions(-DPARALLEL=1)
|
||||||
ENDIF(WITH_OPENMP)
|
endif()
|
||||||
|
|
||||||
BLENDERLIB_NOLIST(bf_intern_elbeem "${SRC}" "${INC}")
|
blenderlib_nolist(bf_intern_elbeem "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
../string
|
../string
|
||||||
../../extern/glew/include
|
../../extern/glew/include
|
||||||
@@ -32,7 +32,7 @@ SET(INC
|
|||||||
../../source/blender/makesdna
|
../../source/blender/makesdna
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/GHOST_Buttons.cpp
|
intern/GHOST_Buttons.cpp
|
||||||
intern/GHOST_CallbackEventConsumer.cpp
|
intern/GHOST_CallbackEventConsumer.cpp
|
||||||
intern/GHOST_C-api.cpp
|
intern/GHOST_C-api.cpp
|
||||||
@@ -82,9 +82,9 @@ SET(SRC
|
|||||||
intern/GHOST_WindowManager.h
|
intern/GHOST_WindowManager.h
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(APPLE)
|
if(APPLE)
|
||||||
IF(WITH_COCOA)
|
if(WITH_COCOA)
|
||||||
LIST(APPEND SRC
|
list(APPEND SRC
|
||||||
intern/GHOST_DisplayManagerCocoa.mm
|
intern/GHOST_DisplayManagerCocoa.mm
|
||||||
intern/GHOST_SystemCocoa.mm
|
intern/GHOST_SystemCocoa.mm
|
||||||
intern/GHOST_WindowCocoa.mm
|
intern/GHOST_WindowCocoa.mm
|
||||||
@@ -93,8 +93,8 @@ IF(APPLE)
|
|||||||
intern/GHOST_SystemCocoa.h
|
intern/GHOST_SystemCocoa.h
|
||||||
intern/GHOST_WindowCocoa.h
|
intern/GHOST_WindowCocoa.h
|
||||||
)
|
)
|
||||||
ELSE(WITH_COCOA)
|
else()
|
||||||
LIST(APPEND SRC
|
list(APPEND SRC
|
||||||
intern/GHOST_DisplayManagerCarbon.cpp
|
intern/GHOST_DisplayManagerCarbon.cpp
|
||||||
intern/GHOST_SystemCarbon.cpp
|
intern/GHOST_SystemCarbon.cpp
|
||||||
intern/GHOST_WindowCarbon.cpp
|
intern/GHOST_WindowCarbon.cpp
|
||||||
@@ -103,16 +103,16 @@ IF(APPLE)
|
|||||||
intern/GHOST_SystemCarbon.h
|
intern/GHOST_SystemCarbon.h
|
||||||
intern/GHOST_WindowCarbon.h
|
intern/GHOST_WindowCarbon.h
|
||||||
)
|
)
|
||||||
ENDIF(WITH_COCOA)
|
endif()
|
||||||
|
|
||||||
IF(WITH_CODEC_QUICKTIME)
|
if(WITH_CODEC_QUICKTIME)
|
||||||
ADD_DEFINITIONS(-DWITH_QUICKTIME)
|
add_definitions(-DWITH_QUICKTIME)
|
||||||
ENDIF(WITH_CODEC_QUICKTIME)
|
endif()
|
||||||
|
|
||||||
ELSEIF(UNIX)
|
elseif(UNIX)
|
||||||
LIST(APPEND INC ${X11_X11_INCLUDE_PATH})
|
list(APPEND INC ${X11_X11_INCLUDE_PATH})
|
||||||
|
|
||||||
LIST(APPEND SRC
|
list(APPEND SRC
|
||||||
intern/GHOST_DisplayManagerX11.cpp
|
intern/GHOST_DisplayManagerX11.cpp
|
||||||
intern/GHOST_SystemX11.cpp
|
intern/GHOST_SystemX11.cpp
|
||||||
intern/GHOST_WindowX11.cpp
|
intern/GHOST_WindowX11.cpp
|
||||||
@@ -122,16 +122,16 @@ ELSEIF(UNIX)
|
|||||||
intern/GHOST_WindowX11.h
|
intern/GHOST_WindowX11.h
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
|
add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
ELSEIF(WIN32)
|
elseif(WIN32)
|
||||||
IF(MSVC)
|
if(MSVC)
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
|
||||||
ENDIF(MSVC)
|
endif()
|
||||||
|
|
||||||
LIST(APPEND INC ${WINTAB_INC})
|
list(APPEND INC ${WINTAB_INC})
|
||||||
|
|
||||||
LIST(APPEND SRC
|
list(APPEND SRC
|
||||||
intern/GHOST_DisplayManagerWin32.cpp
|
intern/GHOST_DisplayManagerWin32.cpp
|
||||||
intern/GHOST_SystemWin32.cpp
|
intern/GHOST_SystemWin32.cpp
|
||||||
intern/GHOST_WindowWin32.cpp
|
intern/GHOST_WindowWin32.cpp
|
||||||
@@ -142,7 +142,7 @@ ELSEIF(WIN32)
|
|||||||
intern/GHOST_SystemWin32.h
|
intern/GHOST_SystemWin32.h
|
||||||
intern/GHOST_WindowWin32.h
|
intern/GHOST_WindowWin32.h
|
||||||
)
|
)
|
||||||
ENDIF(APPLE)
|
endif()
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_ghost "${SRC}" "${INC}")
|
blenderlib(bf_intern_ghost "${SRC}" "${INC}")
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ public:
|
|||||||
* @return The event data.
|
* @return The event data.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TEventDataPtr getData() = 0;
|
virtual GHOST_TEventDataPtr getData() = 0;
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
public:
|
||||||
|
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent"); }
|
||||||
|
void operator delete( void *mem ) { MEM_freeN(mem); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GHOST_IEVENT_H_
|
#endif // _GHOST_IEVENT_H_
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ public:
|
|||||||
* @return Indication as to whether the event was handled.
|
* @return Indication as to whether the event was handled.
|
||||||
*/
|
*/
|
||||||
virtual bool processEvent(GHOST_IEvent* event) = 0;
|
virtual bool processEvent(GHOST_IEvent* event) = 0;
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
public:
|
||||||
|
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IEventConsumer"); }
|
||||||
|
void operator delete( void *mem ) { MEM_freeN(mem); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GHOST_EVENT_CONSUMER_H_
|
#endif // _GHOST_EVENT_CONSUMER_H_
|
||||||
|
|||||||
@@ -404,6 +404,12 @@ protected:
|
|||||||
|
|
||||||
/** The one and only system */
|
/** The one and only system */
|
||||||
static GHOST_ISystem* m_system;
|
static GHOST_ISystem* m_system;
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
public:
|
||||||
|
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem"); }
|
||||||
|
void operator delete( void *mem ) { MEM_freeN(mem); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GHOST_ISYSTEM_H_
|
#endif // _GHOST_ISYSTEM_H_
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ public:
|
|||||||
* @param data The timer user data.
|
* @param data The timer user data.
|
||||||
*/
|
*/
|
||||||
virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
|
virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
public:
|
||||||
|
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask"); }
|
||||||
|
void operator delete( void *mem ) { MEM_freeN(mem); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GHOST_ITIMER_TASK_H_
|
#endif // _GHOST_ITIMER_TASK_H_
|
||||||
|
|||||||
@@ -305,6 +305,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds) { return GHOST_kSuccess; };
|
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds) { return GHOST_kSuccess; };
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
public:
|
||||||
|
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IWindow"); }
|
||||||
|
void operator delete( void *mem ) { MEM_freeN(mem); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GHOST_IWINDOW_H_
|
#endif // _GHOST_IWINDOW_H_
|
||||||
|
|||||||
@@ -185,6 +185,12 @@ public:
|
|||||||
GHOST_TInt32 m_r;
|
GHOST_TInt32 m_r;
|
||||||
/** Bottom coordinate of the rectangle */
|
/** Bottom coordinate of the rectangle */
|
||||||
GHOST_TInt32 m_b;
|
GHOST_TInt32 m_b;
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
public:
|
||||||
|
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_Rect"); }
|
||||||
|
void operator delete( void *mem ) { MEM_freeN(mem); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
#ifndef _GHOST_TYPES_H_
|
#ifndef _GHOST_TYPES_H_
|
||||||
#define _GHOST_TYPES_H_
|
#define _GHOST_TYPES_H_
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
#include "MEM_guardedalloc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef char GHOST_TInt8;
|
typedef char GHOST_TInt8;
|
||||||
typedef unsigned char GHOST_TUns8;
|
typedef unsigned char GHOST_TUns8;
|
||||||
typedef short GHOST_TInt16;
|
typedef short GHOST_TInt16;
|
||||||
|
|||||||
@@ -855,7 +855,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
* specifies a character code generated by a dead key. A dead key is a key that
|
* specifies a character code generated by a dead key. A dead key is a key that
|
||||||
* generates a character, such as the umlaut (double-dot), that is combined with
|
* generates a character, such as the umlaut (double-dot), that is combined with
|
||||||
* another character to form a composite character. For example, the umlaut-O
|
* another character to form a composite character. For example, the umlaut-O
|
||||||
* character (<EFBFBD>) is generated by typing the dead key for the umlaut character, and
|
* character (Ö) is generated by typing the dead key for the umlaut character, and
|
||||||
* then typing the O key.
|
* then typing the O key.
|
||||||
*/
|
*/
|
||||||
case WM_SYSDEADCHAR:
|
case WM_SYSDEADCHAR:
|
||||||
|
|||||||
@@ -160,6 +160,13 @@ protected:
|
|||||||
|
|
||||||
/** Window that was active before entering fullscreen state. */
|
/** Window that was active before entering fullscreen state. */
|
||||||
GHOST_IWindow* m_activeWindowBeforeFullScreen;
|
GHOST_IWindow* m_activeWindowBeforeFullScreen;
|
||||||
|
|
||||||
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
|
public:
|
||||||
|
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_WindowManager"); }
|
||||||
|
void operator delete( void *mem ) { MEM_freeN(mem); }
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GHOST_WINDOW_MANAGER_H_
|
#endif // _GHOST_WINDOW_MANAGER_H_
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ GHOST_WindowX11(
|
|||||||
int attributes[40], i, samples;
|
int attributes[40], i, samples;
|
||||||
Atom atoms[2];
|
Atom atoms[2];
|
||||||
int natom;
|
int natom;
|
||||||
int glxVersionMajor, glxVersionMinor; // As in GLX major.mino
|
int glxVersionMajor, glxVersionMinor; // As in GLX major.minor
|
||||||
|
|
||||||
/* initialize incase X11 fails to load */
|
/* initialize incase X11 fails to load */
|
||||||
memset(&m_xtablet, 0, sizeof(m_xtablet));
|
memset(&m_xtablet, 0, sizeof(m_xtablet));
|
||||||
|
|||||||
@@ -24,29 +24,29 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC .)
|
set(INC .)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
./intern/mallocn.c
|
./intern/mallocn.c
|
||||||
|
|
||||||
BLO_sys_types.h
|
BLO_sys_types.h
|
||||||
MEM_guardedalloc.h
|
MEM_guardedalloc.h
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
LIST(APPEND SRC
|
list(APPEND SRC
|
||||||
intern/mmap_win.c
|
intern/mmap_win.c
|
||||||
|
|
||||||
mmap_win.h
|
mmap_win.h
|
||||||
)
|
)
|
||||||
ENDIF(WIN32 AND NOT UNIX)
|
endif()
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_guardedalloc "${SRC}" "${INC}")
|
blenderlib(bf_intern_guardedalloc "${SRC}" "${INC}")
|
||||||
|
|
||||||
# Override C++ alloc, optional.
|
# Override C++ alloc, optional.
|
||||||
IF(WITH_CXX_GUARDEDALLOC)
|
if(WITH_CXX_GUARDEDALLOC)
|
||||||
SET(SRC
|
set(SRC
|
||||||
cpp/mallocn.cpp
|
cpp/mallocn.cpp
|
||||||
)
|
)
|
||||||
BLENDERLIB(bf_intern_guardedalloc_cpp "${SRC}" "${INC}")
|
blenderlib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}")
|
||||||
ENDIF(WITH_CXX_GUARDEDALLOC)
|
endif()
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
intern
|
intern
|
||||||
../memutil
|
../memutil
|
||||||
../moto/include
|
../moto/include
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/IK_QJacobian.cpp
|
intern/IK_QJacobian.cpp
|
||||||
intern/IK_QJacobianSolver.cpp
|
intern/IK_QJacobianSolver.cpp
|
||||||
intern/IK_QSegment.cpp
|
intern/IK_QSegment.cpp
|
||||||
@@ -70,4 +70,4 @@ SET(SRC
|
|||||||
intern/TNT/version.h
|
intern/TNT/version.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_ik "${SRC}" "${INC}")
|
blenderlib(bf_intern_ik "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
../../extern/Eigen2
|
../../extern/Eigen2
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
Armature.cpp
|
Armature.cpp
|
||||||
Cache.cpp
|
Cache.cpp
|
||||||
ConstraintSet.cpp
|
ConstraintSet.cpp
|
||||||
@@ -222,4 +222,4 @@ SET(SRC
|
|||||||
../../extern/Eigen2/Eigen/src/Sparse/UmfPackSupport.h
|
../../extern/Eigen2/Eigen/src/Sparse/UmfPackSupport.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_itasc "${SRC}" "${INC}")
|
blenderlib(bf_intern_itasc "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
..
|
..
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/MEM_CacheLimiterC-Api.cpp
|
intern/MEM_CacheLimiterC-Api.cpp
|
||||||
intern/MEM_RefCountedC-Api.cpp
|
intern/MEM_RefCountedC-Api.cpp
|
||||||
|
|
||||||
@@ -43,4 +43,4 @@ SET(SRC
|
|||||||
MEM_SmartPtr.h
|
MEM_SmartPtr.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_memutil "${SRC}" "${INC}")
|
blenderlib(bf_intern_memutil "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/MT_Assert.cpp
|
intern/MT_Assert.cpp
|
||||||
intern/MT_CmMatrix4x4.cpp
|
intern/MT_CmMatrix4x4.cpp
|
||||||
intern/MT_Matrix3x3.cpp
|
intern/MT_Matrix3x3.cpp
|
||||||
@@ -67,4 +67,4 @@ SET(SRC
|
|||||||
include/NM_Scalar.h
|
include/NM_Scalar.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_moto "${SRC}" "${INC}")
|
blenderlib(bf_intern_moto "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -25,14 +25,14 @@
|
|||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
# External project, better not fix warnings.
|
# External project, better not fix warnings.
|
||||||
REMOVE_STRICT_FLAGS()
|
remove_strict_flags()
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
extern
|
extern
|
||||||
superlu
|
superlu
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/opennl.c
|
intern/opennl.c
|
||||||
superlu/colamd.c
|
superlu/colamd.c
|
||||||
superlu/get_perm_c.c
|
superlu/get_perm_c.c
|
||||||
@@ -75,4 +75,4 @@ SET(SRC
|
|||||||
superlu/util.h
|
superlu/util.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_opennl "${SRC}" "${INC}")
|
blenderlib(bf_intern_opennl "${SRC}" "${INC}")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
intern
|
intern
|
||||||
../memutil
|
../memutil
|
||||||
../../extern/bullet2/src
|
../../extern/bullet2/src
|
||||||
@@ -32,7 +32,7 @@ SET(INC
|
|||||||
${ZLIB_INC}
|
${ZLIB_INC}
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/EIGENVALUE_HELPER.cpp
|
intern/EIGENVALUE_HELPER.cpp
|
||||||
intern/FLUID_3D.cpp
|
intern/FLUID_3D.cpp
|
||||||
intern/FLUID_3D_SOLVERS.cpp
|
intern/FLUID_3D_SOLVERS.cpp
|
||||||
@@ -80,14 +80,14 @@ SET(SRC
|
|||||||
intern/tnt/tnt_version.h
|
intern/tnt/tnt_version.h
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(WITH_OPENMP)
|
if(WITH_OPENMP)
|
||||||
ADD_DEFINITIONS(-DPARALLEL=1)
|
add_definitions(-DPARALLEL=1)
|
||||||
ENDIF(WITH_OPENMP)
|
endif()
|
||||||
|
|
||||||
IF(WITH_FFTW3)
|
if(WITH_FFTW3)
|
||||||
ADD_DEFINITIONS(-DFFTW3=1)
|
add_definitions(-DFFTW3=1)
|
||||||
LIST(APPEND INC ${FFTW3_INC})
|
list(APPEND INC ${FFTW3_INC})
|
||||||
ENDIF(WITH_FFTW3)
|
endif()
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_smoke "${SRC}" "${INC}")
|
blenderlib(bf_intern_smoke "${SRC}" "${INC}")
|
||||||
|
|
||||||
|
|||||||
@@ -24,15 +24,15 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC
|
set(INC
|
||||||
.
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(SRC
|
set(SRC
|
||||||
intern/STR_String.cpp
|
intern/STR_String.cpp
|
||||||
|
|
||||||
STR_HashedString.h
|
STR_HashedString.h
|
||||||
STR_String.h
|
STR_String.h
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(bf_intern_string "${SRC}" "${INC}")
|
blenderlib(bf_intern_string "${SRC}" "${INC}")
|
||||||
|
|||||||
58
release/datafiles/ctodata.py
Normal file
58
release/datafiles/ctodata.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# ***** 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.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Contributor(s): Campbell Barton
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENCE BLOCK *****
|
||||||
|
|
||||||
|
|
||||||
|
# <pep8 compliant>
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
sys.stdout.write("Usage: ctodata <c_file>\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
filename = sys.argv[1]
|
||||||
|
|
||||||
|
try:
|
||||||
|
fpin = open(filename, "r")
|
||||||
|
except:
|
||||||
|
sys.stdout.write("Unable to open input %s\n" % sys.argv[1])
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
data = fpin.read().rsplit("{")[-1].split("}")[0]
|
||||||
|
data = data.replace(",", " ")
|
||||||
|
data = data.split()
|
||||||
|
data = bytes([int(v) for v in data])
|
||||||
|
|
||||||
|
dname = filename + ".ctodata"
|
||||||
|
|
||||||
|
try:
|
||||||
|
fpout = open(dname, "wb")
|
||||||
|
except:
|
||||||
|
sys.stdout.write("Unable to open output %s\n" % dname)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
fpout.write(data)
|
||||||
@@ -187,12 +187,13 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
|||||||
double gamma_table[256];
|
double gamma_table[256];
|
||||||
double uv_table[256];
|
double uv_table[256];
|
||||||
float *destf = out->rect_float;
|
float *destf = out->rect_float;
|
||||||
float *src1f = ibuf1->rect_float;
|
float *src1f;
|
||||||
|
|
||||||
if (!ibuf1) return;
|
if (!ibuf1) return;
|
||||||
|
|
||||||
dest= (char *) out->rect;
|
dest= (char *) out->rect;
|
||||||
src1= (char *) ibuf1->rect;
|
src1= (char *) ibuf1->rect;
|
||||||
|
src1f= ibuf1->rect_float;
|
||||||
|
|
||||||
for (y = 0; y < 256; y++) {
|
for (y = 0; y < 256; y++) {
|
||||||
float v = 1.0 * y / 255;
|
float v = 1.0 * y / 255;
|
||||||
|
|||||||
@@ -120,12 +120,13 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
|||||||
float gamma_table[256];
|
float gamma_table[256];
|
||||||
float uv_table[256];
|
float uv_table[256];
|
||||||
float *destf = out->rect_float;
|
float *destf = out->rect_float;
|
||||||
float *src1f = ibuf1->rect_float;
|
float *src1f;
|
||||||
|
|
||||||
if (!ibuf1) return;
|
if (!ibuf1) return;
|
||||||
|
|
||||||
dest= (char *) out->rect;
|
dest= (char *) out->rect;
|
||||||
src1= (char *) ibuf1->rect;
|
src1= (char *) ibuf1->rect;
|
||||||
|
src1f= ibuf1->rect_float;
|
||||||
|
|
||||||
for (y = 0; y < 256; y++) {
|
for (y = 0; y < 256; y++) {
|
||||||
float v = 1.0 * y / 255;
|
float v = 1.0 * y / 255;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def add_object_align_init(context, operator):
|
|||||||
return location * rotation
|
return location * rotation
|
||||||
|
|
||||||
|
|
||||||
def add_object_data(context, obdata, operator=None):
|
def object_data_add(context, obdata, operator=None):
|
||||||
|
|
||||||
scene = context.scene
|
scene = context.scene
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ def _main():
|
|||||||
pydoc.getpager = lambda: pydoc.plainpager
|
pydoc.getpager = lambda: pydoc.plainpager
|
||||||
pydoc.Helper.getline = lambda self, prompt: None
|
pydoc.Helper.getline = lambda self, prompt: None
|
||||||
pydoc.TextDoc.use_bold = lambda self, text: text
|
pydoc.TextDoc.use_bold = lambda self, text: text
|
||||||
|
|
||||||
|
# Possibly temp. addons path
|
||||||
|
from os.path import join, dirname, normpath
|
||||||
|
_sys.path.append(normpath(join(dirname(__file__), "..", "..", "addons", "modules")))
|
||||||
|
|
||||||
# if "-d" in sys.argv: # Enable this to measure startup speed
|
# if "-d" in sys.argv: # Enable this to measure startup speed
|
||||||
if 0:
|
if 0:
|
||||||
|
|||||||
@@ -203,7 +203,9 @@ def module_names(path, recursive=False):
|
|||||||
modules = []
|
modules = []
|
||||||
|
|
||||||
for filename in sorted(_os.listdir(path)):
|
for filename in sorted(_os.listdir(path)):
|
||||||
if filename.endswith(".py") and filename != "__init__.py":
|
if filename == "modules":
|
||||||
|
pass # XXX, hard coded exception.
|
||||||
|
elif filename.endswith(".py") and filename != "__init__.py":
|
||||||
fullpath = join(path, filename)
|
fullpath = join(path, filename)
|
||||||
modules.append((filename[0:-3], fullpath))
|
modules.append((filename[0:-3], fullpath))
|
||||||
elif ("." not in filename):
|
elif ("." not in filename):
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ This module contains utility functions specific to blender but
|
|||||||
not assosiated with blenders internal data.
|
not assosiated with blenders internal data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from _bpy import blend_paths, user_resource
|
from _bpy import blend_paths
|
||||||
from _bpy import script_paths as _bpy_script_paths
|
from _bpy import script_paths as _bpy_script_paths
|
||||||
|
from _bpy import user_resource as _user_resource
|
||||||
|
|
||||||
import bpy as _bpy
|
import bpy as _bpy
|
||||||
import os as _os
|
import os as _os
|
||||||
@@ -559,3 +560,36 @@ def keyconfig_set(filepath):
|
|||||||
keyconfigs.active = kc_new
|
keyconfigs.active = kc_new
|
||||||
|
|
||||||
|
|
||||||
|
def user_resource(type, path, create=False):
|
||||||
|
"""
|
||||||
|
Return a user resource path (normally from the users home directory).
|
||||||
|
|
||||||
|
:arg type: Resource type in ['DATAFILES', 'CONFIG', 'SCRIPTS', 'AUTOSAVE'].
|
||||||
|
:type type: string
|
||||||
|
:arg subdir: Optional subdirectory.
|
||||||
|
:type subdir: string
|
||||||
|
:arg create: Treat the path as a directory and create it if its not existing.
|
||||||
|
:type create: boolean
|
||||||
|
:return: a path.
|
||||||
|
:rtype: string
|
||||||
|
"""
|
||||||
|
|
||||||
|
target_path = _user_resource(type, path)
|
||||||
|
|
||||||
|
if create:
|
||||||
|
# should always be true.
|
||||||
|
if target_path:
|
||||||
|
# create path if not existing.
|
||||||
|
if not _os.path.exists(target_path):
|
||||||
|
try:
|
||||||
|
_os.makedirs(target_path)
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
target_path = ""
|
||||||
|
elif not _os.path.isdir(target_path):
|
||||||
|
print("Path %r found but isn't a directory!" % path)
|
||||||
|
target_path = ""
|
||||||
|
|
||||||
|
return target_path
|
||||||
|
|
||||||
|
|||||||
@@ -1,195 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
import time
|
|
||||||
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
from extensions_framework.ui import EF_OT_msg
|
|
||||||
|
|
||||||
bpy.types.register(EF_OT_msg)
|
|
||||||
del EF_OT_msg
|
|
||||||
|
|
||||||
|
|
||||||
def log(str, popup=False, module_name='EF'):
|
|
||||||
"""Print a message to the console, prefixed with the module_name
|
|
||||||
and the current time. If the popup flag is True, the message will
|
|
||||||
be raised in the UI as a warning using the operator bpy.ops.ef.msg.
|
|
||||||
|
|
||||||
"""
|
|
||||||
print("[%s %s] %s" %
|
|
||||||
(module_name, time.strftime('%Y-%b-%d %H:%M:%S'), str))
|
|
||||||
if popup:
|
|
||||||
bpy.ops.ef.msg(
|
|
||||||
msg_type='WARNING',
|
|
||||||
msg_text=str
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
added_property_cache = {}
|
|
||||||
|
|
||||||
def init_properties(obj, props, cache=True):
|
|
||||||
"""Initialise custom properties in the given object or type.
|
|
||||||
The props list is described in the declarative_property_group
|
|
||||||
class definition. If the cache flag is False, this function
|
|
||||||
will attempt to redefine properties even if they have already been
|
|
||||||
added.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
if not obj in added_property_cache.keys():
|
|
||||||
added_property_cache[obj] = []
|
|
||||||
|
|
||||||
for prop in props:
|
|
||||||
try:
|
|
||||||
if cache and prop['attr'] in added_property_cache[obj]:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if prop['type'] == 'bool':
|
|
||||||
t = bpy.props.BoolProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ['name',
|
|
||||||
'description','default']}
|
|
||||||
elif prop['type'] == 'collection':
|
|
||||||
t = bpy.props.CollectionProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ["ptype", "name",
|
|
||||||
"description"]}
|
|
||||||
a['type'] = a['ptype']
|
|
||||||
del a['ptype']
|
|
||||||
elif prop['type'] == 'enum':
|
|
||||||
t = bpy.props.EnumProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ["items", "name",
|
|
||||||
"description", "default"]}
|
|
||||||
elif prop['type'] == 'float':
|
|
||||||
t = bpy.props.FloatProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ["name",
|
|
||||||
"description", "min", "max", "soft_min", "soft_max",
|
|
||||||
"default", "precision"]}
|
|
||||||
elif prop['type'] == 'float_vector':
|
|
||||||
t = bpy.props.FloatVectorProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ["name",
|
|
||||||
"description", "min", "max", "soft_min", "soft_max",
|
|
||||||
"default", "precision", "size", "subtype"]}
|
|
||||||
elif prop['type'] == 'int':
|
|
||||||
t = bpy.props.IntProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ["name",
|
|
||||||
"description", "min", "max", "soft_min", "soft_max",
|
|
||||||
"default"]}
|
|
||||||
elif prop['type'] == 'pointer':
|
|
||||||
t = bpy.props.PointerProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ["ptype", "name",
|
|
||||||
"description"]}
|
|
||||||
a['type'] = a['ptype']
|
|
||||||
del a['ptype']
|
|
||||||
elif prop['type'] == 'string':
|
|
||||||
t = bpy.props.StringProperty
|
|
||||||
a = {k: v for k,v in prop.items() if k in ["name",
|
|
||||||
"description", "maxlen", "default", "subtype"]}
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
|
|
||||||
setattr(obj, prop['attr'], t(**a))
|
|
||||||
|
|
||||||
added_property_cache[obj].append(prop['attr'])
|
|
||||||
except KeyError:
|
|
||||||
# Silently skip invalid entries in props
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
|
||||||
class declarative_property_group(bpy.types.IDPropertyGroup):
|
|
||||||
"""A declarative_property_group describes a set of logically
|
|
||||||
related properties, using a declarative style to list each
|
|
||||||
property type, name, values, and other relevant information.
|
|
||||||
The information provided for each property depends on the
|
|
||||||
property's type.
|
|
||||||
|
|
||||||
The properties list attribute in this class describes the
|
|
||||||
properties present in this group.
|
|
||||||
|
|
||||||
Some additional information about the properties in this group
|
|
||||||
can be specified, so that a UI can be generated to display them.
|
|
||||||
To that end, the controls list attribute and the visibility dict
|
|
||||||
attribute are present here, to be read and interpreted by a
|
|
||||||
property_group_renderer object.
|
|
||||||
See extensions_framework.ui.property_group_renderer.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""This list controls the order of property layout when rendered
|
|
||||||
by a property_group_renderer. This can be a nested list, where each
|
|
||||||
list becomes a row in the panel layout. Nesting may be to any depth.
|
|
||||||
|
|
||||||
"""
|
|
||||||
controls = []
|
|
||||||
|
|
||||||
"""The visibility dict controls the display of properties based on
|
|
||||||
the value of other properties. See extensions_framework.validate
|
|
||||||
for test syntax.
|
|
||||||
|
|
||||||
"""
|
|
||||||
visibility = {}
|
|
||||||
|
|
||||||
"""The properties list describes each property to be created. Each
|
|
||||||
item should be a dict of args to pass to a
|
|
||||||
bpy.props.<?>Property function, with the exception of 'type'
|
|
||||||
which is used and stripped by extensions_framework in order to
|
|
||||||
determine which Property creation function to call.
|
|
||||||
|
|
||||||
Example item:
|
|
||||||
{
|
|
||||||
'type': 'int', # bpy.props.IntProperty
|
|
||||||
'attr': 'threads', # bpy.types.<type>.threads
|
|
||||||
'name': 'Render Threads', # Rendered next to the UI
|
|
||||||
'description': 'Number of threads to use', # Tooltip text in the UI
|
|
||||||
'default': 1,
|
|
||||||
'min': 1,
|
|
||||||
'soft_min': 1,
|
|
||||||
'max': 64,
|
|
||||||
'soft_max': 64
|
|
||||||
}
|
|
||||||
|
|
||||||
"""
|
|
||||||
properties = []
|
|
||||||
|
|
||||||
def draw_callback(self, context):
|
|
||||||
"""Sub-classes can override this to get a callback when
|
|
||||||
rendering is completed by a property_group_renderer sub-class.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_exportable_properties(cls):
|
|
||||||
"""Return a list of properties which have the 'save_in_preset' key
|
|
||||||
set to True, and hence should be saved into preset files.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
out = []
|
|
||||||
for prop in cls.properties:
|
|
||||||
if 'save_in_preset' in prop.keys() and prop['save_in_preset']:
|
|
||||||
out.append(prop)
|
|
||||||
return out
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
from extensions_framework.plugin import plugin
|
|
||||||
|
|
||||||
class engine_base(plugin):
|
|
||||||
"""Render Engine plugin base class
|
|
||||||
|
|
||||||
TODO: Remove, this class hasn't grown to be useful
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
bl_label = 'Abstract Render Engine Base Class'
|
|
||||||
|
|
||||||
def render(self, scene):
|
|
||||||
pass
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
import xml.etree.cElementTree as ET
|
|
||||||
import xml.dom.minidom as MD
|
|
||||||
|
|
||||||
class xml_output(object):
|
|
||||||
"""This class serves to describe an XML output, it uses
|
|
||||||
cElementTree and minidom to construct and format the XML
|
|
||||||
data.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""The format dict describes the XML structure that this class
|
|
||||||
should generate, and which properties should be used to fill
|
|
||||||
the XML data structure
|
|
||||||
|
|
||||||
"""
|
|
||||||
format = {}
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return ET.tostring(self.root)
|
|
||||||
|
|
||||||
def write_pretty(self, file):
|
|
||||||
"""Write a formatted XML string to file"""
|
|
||||||
xml_dom = MD.parseString(ET.tostring(self.root, encoding='utf-8'))
|
|
||||||
xml_dom.writexml(file, addindent=' ', newl='\n', encoding='utf-8')
|
|
||||||
|
|
||||||
def pretty(self):
|
|
||||||
"""Return a formatted XML string"""
|
|
||||||
xml_str = MD.parseString(ET.tostring(self.root))
|
|
||||||
return xml_str.toprettyxml()
|
|
||||||
|
|
||||||
def get_format(self):
|
|
||||||
"""This should be overridden in classes that produce XML
|
|
||||||
conditionally
|
|
||||||
|
|
||||||
"""
|
|
||||||
return self.format
|
|
||||||
|
|
||||||
def compute(self, context):
|
|
||||||
"""Compute the XML output from the input format"""
|
|
||||||
self.context = context
|
|
||||||
|
|
||||||
self.root = ET.Element(self.root_element)
|
|
||||||
self.parse_dict(self.get_format(), self.root)
|
|
||||||
|
|
||||||
return self.root
|
|
||||||
|
|
||||||
"""Formatting functions for various data types"""
|
|
||||||
format_types = {
|
|
||||||
'bool': lambda c,x: str(x).lower(),
|
|
||||||
'collection': lambda c,x: x,
|
|
||||||
'enum': lambda c,x: x,
|
|
||||||
'float': lambda c,x: x,
|
|
||||||
'int': lambda c,x: x,
|
|
||||||
'pointer': lambda c,x: x,
|
|
||||||
'string': lambda c,x: x,
|
|
||||||
}
|
|
||||||
|
|
||||||
def parse_dict(self, d, elem):
|
|
||||||
"""Parse the values in the format dict and collect the
|
|
||||||
formatted data into XML structure starting at self.root
|
|
||||||
|
|
||||||
"""
|
|
||||||
for key in d.keys():
|
|
||||||
# tuple provides multiple child elements
|
|
||||||
if type(d[key]) is tuple:
|
|
||||||
for cd in d[key]:
|
|
||||||
self.parse_dict({key:cd}, elem)
|
|
||||||
continue # don't create empty element for tuple child
|
|
||||||
|
|
||||||
x = ET.SubElement(elem, key)
|
|
||||||
|
|
||||||
# dictionary provides nested elements
|
|
||||||
if type(d[key]) is dict:
|
|
||||||
self.parse_dict(d[key], x)
|
|
||||||
|
|
||||||
# list provides direct value insertion
|
|
||||||
elif type(d[key]) is list:
|
|
||||||
x.text = ' '.join([str(i) for i in d[key]])
|
|
||||||
|
|
||||||
# else look up property
|
|
||||||
else:
|
|
||||||
for p in self.properties:
|
|
||||||
if d[key] == p['attr']:
|
|
||||||
if 'compute' in p.keys():
|
|
||||||
x.text = str(p['compute'](self.context, self))
|
|
||||||
else:
|
|
||||||
x.text = str(
|
|
||||||
self.format_types[p['type']](self.context,
|
|
||||||
getattr(self, d[key]))
|
|
||||||
)
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
from extensions_framework import init_properties
|
|
||||||
from extensions_framework import log
|
|
||||||
|
|
||||||
class plugin(object):
|
|
||||||
"""Base class for plugins which wish to make use of utilities
|
|
||||||
provided in extensions_framework. Using the property_groups
|
|
||||||
attribute and the install() and uninstall() methods, a large number
|
|
||||||
of custom scene properties can be easily defined, displayed and
|
|
||||||
managed.
|
|
||||||
|
|
||||||
TODO: Rename, 'extension' would be more appropriate than 'plugin'
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""The property_groups defines a list of declarative_property_group
|
|
||||||
types to create in specified types during the initialisation of the
|
|
||||||
plugin.
|
|
||||||
Item format:
|
|
||||||
('bpy.type prototype to attach to', <declarative_property_group>)
|
|
||||||
|
|
||||||
Example item:
|
|
||||||
('Scene', myaddon_property_group)
|
|
||||||
In this example, a new property group will be attached to
|
|
||||||
bpy.types.Scene and all of the properties described in that group
|
|
||||||
will be added to it.
|
|
||||||
See extensions_framework.declarative_property_group.
|
|
||||||
|
|
||||||
"""
|
|
||||||
property_groups = []
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def install(r_class):
|
|
||||||
"""Initialise this plugin. So far, all this does is to create
|
|
||||||
custom property groups specified in the property_groups
|
|
||||||
attribute.
|
|
||||||
|
|
||||||
"""
|
|
||||||
for property_group_parent, property_group in r_class.property_groups:
|
|
||||||
call_init = False
|
|
||||||
if property_group_parent is not None:
|
|
||||||
prototype = getattr(bpy.types, property_group_parent)
|
|
||||||
if not hasattr(prototype, property_group.__name__):
|
|
||||||
init_properties(prototype, [{
|
|
||||||
'type': 'pointer',
|
|
||||||
'attr': property_group.__name__,
|
|
||||||
'ptype': property_group,
|
|
||||||
'name': property_group.__name__,
|
|
||||||
'description': property_group.__name__
|
|
||||||
}])
|
|
||||||
call_init = True
|
|
||||||
else:
|
|
||||||
call_init = True
|
|
||||||
|
|
||||||
if call_init:
|
|
||||||
init_properties(property_group, property_group.properties)
|
|
||||||
|
|
||||||
log('Extension "%s" initialised' % r_class.bl_label)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def uninstall(r_class):
|
|
||||||
"""Unregister property groups in reverse order"""
|
|
||||||
reverse_property_groups = [p for p in r_class.property_groups]
|
|
||||||
reverse_property_groups.reverse()
|
|
||||||
for property_group_parent, property_group in reverse_property_groups:
|
|
||||||
prototype = getattr(bpy.types, property_group_parent)
|
|
||||||
prototype.RemoveProperty(property_group.__name__)
|
|
||||||
@@ -1,253 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
from extensions_framework.validate import Visibility
|
|
||||||
|
|
||||||
class EF_OT_msg(bpy.types.Operator):
|
|
||||||
"""An operator to show simple messages in the UI"""
|
|
||||||
bl_idname = 'ef.msg'
|
|
||||||
bl_label = 'Show UI Message'
|
|
||||||
msg_type = bpy.props.StringProperty(default='INFO')
|
|
||||||
msg_text = bpy.props.StringProperty(default='')
|
|
||||||
def execute(self, context):
|
|
||||||
self.report({self.properties.msg_type}, self.properties.msg_text)
|
|
||||||
return {'FINISHED'}
|
|
||||||
|
|
||||||
def _get_item_from_context(context, path):
|
|
||||||
"""Utility to get an object when the path to it is known:
|
|
||||||
_get_item_from_context(context, ['a','b','c']) returns
|
|
||||||
context.a.b.c
|
|
||||||
No error checking is performed other than checking that context
|
|
||||||
is not None. Exceptions caused by invalid path should be caught in
|
|
||||||
the calling code.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
if context is not None:
|
|
||||||
for p in path:
|
|
||||||
context = getattr(context, p)
|
|
||||||
return context
|
|
||||||
|
|
||||||
class property_group_renderer(object):
|
|
||||||
"""Mix-in class for sub-classes of bpy.types.Panel. This class
|
|
||||||
will provide the draw() method which implements drawing one or
|
|
||||||
more property groups derived from
|
|
||||||
extensions_framework.declarative_propery_group.
|
|
||||||
The display_property_groups list attribute describes which
|
|
||||||
declarative_property_groups should be drawn in the Panel, and
|
|
||||||
how to extract those groups from the context passed to draw().
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""The display_property_groups list attribute specifies which
|
|
||||||
custom declarative_property_groups this panel should draw, and
|
|
||||||
where to find that property group in the active context.
|
|
||||||
Example item:
|
|
||||||
( ('scene',), 'myaddon_property_group')
|
|
||||||
In this case, this renderer will look for properties in
|
|
||||||
context.scene.myaddon_property_group to draw in the Panel.
|
|
||||||
|
|
||||||
"""
|
|
||||||
display_property_groups = []
|
|
||||||
|
|
||||||
def draw(self, context):
|
|
||||||
"""Sub-classes should override this if they need to display
|
|
||||||
other (object-related) property groups. super().draw(context)
|
|
||||||
can be a useful call in those cases.
|
|
||||||
|
|
||||||
"""
|
|
||||||
for property_group_path, property_group_name in \
|
|
||||||
self.display_property_groups:
|
|
||||||
ctx = _get_item_from_context(context, property_group_path)
|
|
||||||
property_group = getattr(ctx, property_group_name)
|
|
||||||
for p in property_group.controls:
|
|
||||||
self.draw_column(p, self.layout, ctx, context,
|
|
||||||
property_group=property_group)
|
|
||||||
property_group.draw_callback(context)
|
|
||||||
|
|
||||||
def check_visibility(self, lookup_property, property_group):
|
|
||||||
"""Determine if the lookup_property should be drawn in the Panel"""
|
|
||||||
vt = Visibility(property_group)
|
|
||||||
if lookup_property in property_group.visibility.keys():
|
|
||||||
if hasattr(property_group, lookup_property):
|
|
||||||
member = getattr(property_group, lookup_property)
|
|
||||||
else:
|
|
||||||
member = None
|
|
||||||
return vt.test_logic(member,
|
|
||||||
property_group.visibility[lookup_property])
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
# tab_level = 0
|
|
||||||
|
|
||||||
def is_real_property(self, lookup_property, property_group):
|
|
||||||
for prop in property_group.properties:
|
|
||||||
if prop['attr'] == lookup_property:
|
|
||||||
return prop['type'] not in ['text', 'prop_search']
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def draw_column(self, control_list_item, layout, context,
|
|
||||||
supercontext=None, property_group=None):
|
|
||||||
# self.tab_level += 1
|
|
||||||
"""Draw a column's worth of UI controls in this Panel"""
|
|
||||||
if type(control_list_item) is list:
|
|
||||||
draw_row = False
|
|
||||||
|
|
||||||
found_percent = None
|
|
||||||
# print('\t'*self.tab_level, '--', property_group, '--')
|
|
||||||
for sp in control_list_item:
|
|
||||||
# print('\t'*self.tab_level, sp)
|
|
||||||
if type(sp) is float:
|
|
||||||
found_percent = sp
|
|
||||||
elif type(sp) is list:
|
|
||||||
for ssp in [s for s in sp if self.is_real_property(s, property_group)]:
|
|
||||||
draw_row = draw_row or self.check_visibility(ssp,
|
|
||||||
property_group)
|
|
||||||
# print('\t'*self.tab_level, 'List: ', draw_row)
|
|
||||||
else:
|
|
||||||
draw_row = draw_row or self.check_visibility(sp,
|
|
||||||
property_group)
|
|
||||||
# print('\t'*self.tab_level, 'Single: ', draw_row)
|
|
||||||
# print('\t'*self.tab_level, '-->', draw_row)
|
|
||||||
# print('\t'*self.tab_level, '--', property_group, '--')
|
|
||||||
|
|
||||||
next_items = [s for s in control_list_item if type(s) in [str, list]]
|
|
||||||
if draw_row and len(next_items) > 0:
|
|
||||||
if found_percent is not None:
|
|
||||||
splt = layout.split(percentage=found_percent)
|
|
||||||
else:
|
|
||||||
splt = layout.row(True)
|
|
||||||
for sp in next_items:
|
|
||||||
col2 = splt.column()
|
|
||||||
self.draw_column(sp, col2, context, supercontext,
|
|
||||||
property_group)
|
|
||||||
else:
|
|
||||||
if self.check_visibility(control_list_item, property_group):
|
|
||||||
|
|
||||||
for current_property in property_group.properties:
|
|
||||||
if current_property['attr'] == control_list_item:
|
|
||||||
current_property_keys = current_property.keys()
|
|
||||||
if 'type' in current_property_keys:
|
|
||||||
|
|
||||||
if current_property['type'] in ['int', 'float',
|
|
||||||
'float_vector', 'enum', 'string']:
|
|
||||||
layout.prop(
|
|
||||||
property_group,
|
|
||||||
control_list_item,
|
|
||||||
text = current_property['name'],
|
|
||||||
expand = current_property['expand'] \
|
|
||||||
if 'expand' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
slider = current_property['slider'] \
|
|
||||||
if 'slider' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
toggle = current_property['toggle'] \
|
|
||||||
if 'toggle' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
icon_only = current_property['icon_only'] \
|
|
||||||
if 'icon_only' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
event = current_property['event'] \
|
|
||||||
if 'event' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
full_event = current_property['full_event'] \
|
|
||||||
if 'full_event' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
emboss = current_property['emboss'] \
|
|
||||||
if 'emboss' in current_property_keys \
|
|
||||||
else True,
|
|
||||||
)
|
|
||||||
if current_property['type'] in ['bool']:
|
|
||||||
layout.prop(
|
|
||||||
property_group,
|
|
||||||
control_list_item,
|
|
||||||
text = current_property['name'],
|
|
||||||
toggle = current_property['toggle'] \
|
|
||||||
if 'toggle' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
icon_only = current_property['icon_only'] \
|
|
||||||
if 'icon_only' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
event = current_property['event'] \
|
|
||||||
if 'event' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
full_event = current_property['full_event'] \
|
|
||||||
if 'full_event' in current_property_keys \
|
|
||||||
else False,
|
|
||||||
emboss = current_property['emboss'] \
|
|
||||||
if 'emboss' in current_property_keys \
|
|
||||||
else True,
|
|
||||||
)
|
|
||||||
elif current_property['type'] in ['operator']:
|
|
||||||
layout.operator(current_property['operator'],
|
|
||||||
text = current_property['text'],
|
|
||||||
icon = current_property['icon']
|
|
||||||
)
|
|
||||||
|
|
||||||
elif current_property['type'] in ['text']:
|
|
||||||
layout.label(
|
|
||||||
text = current_property['name']
|
|
||||||
)
|
|
||||||
|
|
||||||
elif current_property['type'] in ['template_list']:
|
|
||||||
layout.template_list(
|
|
||||||
current_property['src'](supercontext, context),
|
|
||||||
current_property['src_attr'],
|
|
||||||
current_property['trg'](supercontext, context),
|
|
||||||
current_property['trg_attr'],
|
|
||||||
rows = 4 \
|
|
||||||
if not 'rows' in current_property_keys \
|
|
||||||
else current_property['rows'],
|
|
||||||
maxrows = 4 \
|
|
||||||
if not 'rows' in current_property_keys \
|
|
||||||
else current_property['rows'],
|
|
||||||
type = 'DEFAULT' \
|
|
||||||
if not 'list_type' in current_property_keys \
|
|
||||||
else current_property['list_type']
|
|
||||||
)
|
|
||||||
|
|
||||||
elif current_property['type'] in ['prop_search']:
|
|
||||||
layout.prop_search(
|
|
||||||
current_property['trg'](supercontext,
|
|
||||||
context),
|
|
||||||
current_property['trg_attr'],
|
|
||||||
current_property['src'](supercontext,
|
|
||||||
context),
|
|
||||||
current_property['src_attr'],
|
|
||||||
text = current_property['name'],
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
layout.prop(property_group, control_list_item)
|
|
||||||
|
|
||||||
# Fire a draw callback if specified
|
|
||||||
if 'draw' in current_property_keys:
|
|
||||||
current_property['draw'](supercontext, context)
|
|
||||||
|
|
||||||
break
|
|
||||||
# self.tab_level -= 1
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
import configparser
|
|
||||||
import datetime
|
|
||||||
import os
|
|
||||||
import tempfile
|
|
||||||
import threading
|
|
||||||
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
"""List of possibly appropriate paths to load/save addon config from/to"""
|
|
||||||
config_paths = []
|
|
||||||
if bpy.utils.user_resource('CONFIG') != "": config_paths.append(bpy.utils.user_resource('CONFIG'))
|
|
||||||
if bpy.utils.user_resource('SCRIPTS') != "": config_paths.append(bpy.utils.user_resource('SCRIPTS'))
|
|
||||||
for pth in bpy.utils.script_paths():
|
|
||||||
if pth != "": config_paths.append(pth)
|
|
||||||
|
|
||||||
"""This path is set at the start of export, so that calls to
|
|
||||||
path_relative_to_export() can make all exported paths relative to
|
|
||||||
this one.
|
|
||||||
"""
|
|
||||||
export_path = '';
|
|
||||||
|
|
||||||
def path_relative_to_export(p):
|
|
||||||
"""Return a path that is relative to the export path"""
|
|
||||||
global export_path
|
|
||||||
p = filesystem_path(p)
|
|
||||||
try:
|
|
||||||
relp = os.path.relpath(p, os.path.dirname(export_path))
|
|
||||||
except ValueError: # path on different drive on windows
|
|
||||||
relp = p
|
|
||||||
|
|
||||||
return relp.replace('\\', '/')
|
|
||||||
|
|
||||||
def filesystem_path(p):
|
|
||||||
"""Resolve a relative Blender path to a real filesystem path"""
|
|
||||||
if p.startswith('//'):
|
|
||||||
pout = bpy.path.abspath(p)
|
|
||||||
else:
|
|
||||||
pout = os.path.realpath(p)
|
|
||||||
|
|
||||||
return pout.replace('\\', '/')
|
|
||||||
|
|
||||||
# TODO: - somehow specify TYPES to get/set from config
|
|
||||||
|
|
||||||
def find_config_value(module, section, key, default):
|
|
||||||
"""Attempt to find the configuration value specified by string key
|
|
||||||
in the specified section of module's configuration file. If it is
|
|
||||||
not found, return default.
|
|
||||||
|
|
||||||
"""
|
|
||||||
global config_paths
|
|
||||||
fc = []
|
|
||||||
for p in config_paths:
|
|
||||||
if os.path.exists(p) and os.path.isdir(p) and os.access(p, os.W_OK):
|
|
||||||
fc.append( '/'.join([p, '%s.cfg' % module]))
|
|
||||||
|
|
||||||
if len(fc) < 1:
|
|
||||||
print('Cannot find %s config file path' % module)
|
|
||||||
return default
|
|
||||||
|
|
||||||
cp = configparser.SafeConfigParser()
|
|
||||||
|
|
||||||
cfg_files = cp.read(fc)
|
|
||||||
if len(cfg_files) > 0:
|
|
||||||
try:
|
|
||||||
val = cp.get(section, key)
|
|
||||||
if val == 'true':
|
|
||||||
return True
|
|
||||||
elif val == 'false':
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return val
|
|
||||||
except:
|
|
||||||
return default
|
|
||||||
else:
|
|
||||||
return default
|
|
||||||
|
|
||||||
def write_config_value(module, section, key, value):
|
|
||||||
"""Attempt to write the configuration value specified by string key
|
|
||||||
in the specified section of module's configuration file.
|
|
||||||
|
|
||||||
"""
|
|
||||||
global config_paths
|
|
||||||
fc = []
|
|
||||||
for p in config_paths:
|
|
||||||
if os.path.exists(p) and os.path.isdir(p) and os.access(p, os.W_OK):
|
|
||||||
fc.append( '/'.join([p, '%s.cfg' % module]))
|
|
||||||
|
|
||||||
if len(fc) < 1:
|
|
||||||
raise Exception('Cannot find a writable path to store %s config file' %
|
|
||||||
module)
|
|
||||||
|
|
||||||
cp = configparser.SafeConfigParser()
|
|
||||||
|
|
||||||
cfg_files = cp.read(fc)
|
|
||||||
|
|
||||||
if not cp.has_section(section):
|
|
||||||
cp.add_section(section)
|
|
||||||
|
|
||||||
if value == True:
|
|
||||||
cp.set(section, key, 'true')
|
|
||||||
elif value == False:
|
|
||||||
cp.set(section, key, 'false')
|
|
||||||
else:
|
|
||||||
cp.set(section, key, value)
|
|
||||||
|
|
||||||
if len(cfg_files) < 1:
|
|
||||||
cfg_files = fc
|
|
||||||
|
|
||||||
fh=open(cfg_files[0],'w')
|
|
||||||
cp.write(fh)
|
|
||||||
fh.close()
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def scene_filename():
|
|
||||||
"""Construct a safe scene filename, using 'untitled' instead of ''"""
|
|
||||||
filename = os.path.splitext(os.path.basename(bpy.data.filepath))[0]
|
|
||||||
if filename == '':
|
|
||||||
filename = 'untitled'
|
|
||||||
return bpy.path.clean_name(filename)
|
|
||||||
|
|
||||||
def temp_directory():
|
|
||||||
"""Return the system temp directory"""
|
|
||||||
return tempfile.gettempdir()
|
|
||||||
|
|
||||||
def temp_file(ext='tmp'):
|
|
||||||
"""Get a temporary filename with the given extension. This function
|
|
||||||
will actually attempt to create the file."""
|
|
||||||
tf, fn = tempfile.mkstemp(suffix='.%s'%ext)
|
|
||||||
os.close(tf)
|
|
||||||
return fn
|
|
||||||
|
|
||||||
class TimerThread(threading.Thread):
|
|
||||||
"""Periodically call self.kick(). The period of time in seconds
|
|
||||||
between calling is given by self.KICK_PERIOD, and the first call
|
|
||||||
may be delayed by setting self.STARTUP_DELAY, also in seconds.
|
|
||||||
self.kick() will continue to be called at regular intervals until
|
|
||||||
self.stop() is called. Since this is a thread, calling self.join()
|
|
||||||
may be wise after calling self.stop() if self.kick() is performing
|
|
||||||
a task necessary for the continuation of the program.
|
|
||||||
The object that creates this TimerThread may pass into it data
|
|
||||||
needed during self.kick() as a dict LocalStorage in __init__().
|
|
||||||
|
|
||||||
"""
|
|
||||||
STARTUP_DELAY = 0
|
|
||||||
KICK_PERIOD = 8
|
|
||||||
|
|
||||||
active = True
|
|
||||||
timer = None
|
|
||||||
|
|
||||||
LocalStorage = None
|
|
||||||
|
|
||||||
def __init__(self, LocalStorage=dict()):
|
|
||||||
threading.Thread.__init__(self)
|
|
||||||
self.LocalStorage = LocalStorage
|
|
||||||
|
|
||||||
def set_kick_period(self, period):
|
|
||||||
"""Adjust the KICK_PERIOD between __init__() and start()"""
|
|
||||||
self.KICK_PERIOD = period + self.STARTUP_DELAY
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
"""Stop this timer. This method does not join()"""
|
|
||||||
self.active = False
|
|
||||||
if self.timer is not None:
|
|
||||||
self.timer.cancel()
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
"""Timed Thread loop"""
|
|
||||||
while self.active:
|
|
||||||
self.timer = threading.Timer(self.KICK_PERIOD, self.kick_caller)
|
|
||||||
self.timer.start()
|
|
||||||
if self.timer.isAlive(): self.timer.join()
|
|
||||||
|
|
||||||
def kick_caller(self):
|
|
||||||
"""Intermediary between the kick-wait-loop and kick to allow
|
|
||||||
adjustment of the first KICK_PERIOD by STARTUP_DELAY
|
|
||||||
|
|
||||||
"""
|
|
||||||
if self.STARTUP_DELAY > 0:
|
|
||||||
self.KICK_PERIOD -= self.STARTUP_DELAY
|
|
||||||
self.STARTUP_DELAY = 0
|
|
||||||
|
|
||||||
self.kick()
|
|
||||||
|
|
||||||
def kick(self):
|
|
||||||
"""Sub-classes do their work here"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def format_elapsed_time(t):
|
|
||||||
"""Format a duration in seconds as an HH:MM:SS format time"""
|
|
||||||
|
|
||||||
td = datetime.timedelta(seconds=t)
|
|
||||||
min = td.days*1440 + td.seconds/60.0
|
|
||||||
hrs = td.days*24 + td.seconds/3600.0
|
|
||||||
|
|
||||||
return '%i:%02i:%02i' % (hrs, min%60, td.seconds%60)
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
# -*- coding: utf8 -*-
|
|
||||||
#
|
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Blender 2.5 Extensions Framework
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Doug Hammond
|
|
||||||
#
|
|
||||||
# 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# ***** END GPL LICENCE BLOCK *****
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
Pure logic and validation class.
|
|
||||||
|
|
||||||
By using a Subject object, and a dict of described logic tests, it
|
|
||||||
is possible to arrive at a True or False result for various purposes:
|
|
||||||
1. Data validation
|
|
||||||
2. UI control visibility
|
|
||||||
|
|
||||||
A Subject can be any object whose members are readable with getattr() :
|
|
||||||
class Subject(object):
|
|
||||||
a = 0
|
|
||||||
b = 1
|
|
||||||
c = 'foo'
|
|
||||||
d = True
|
|
||||||
e = False
|
|
||||||
f = 8
|
|
||||||
g = 'bar'
|
|
||||||
|
|
||||||
|
|
||||||
Tests are described thus:
|
|
||||||
|
|
||||||
Use the special list types Logic_AND and Logic_OR to describe
|
|
||||||
combinations of values and other members. Use Logic_Operator for
|
|
||||||
numerical comparison.
|
|
||||||
|
|
||||||
With regards to Subject, each of these evaluate to True:
|
|
||||||
TESTA = {
|
|
||||||
'a': 0,
|
|
||||||
'c': Logic_OR([ 'foo', 'bar' ]),
|
|
||||||
'd': Logic_AND([True, True]),
|
|
||||||
'f': Logic_AND([8, {'b': 1}]),
|
|
||||||
'e': {'b': Logic_Operator({'gte':1, 'lt':3}) },
|
|
||||||
'g': Logic_OR([ 'baz', Logic_AND([{'b': 1}, {'f': 8}]) ])
|
|
||||||
}
|
|
||||||
|
|
||||||
With regards to Subject, each of these evaluate to False:
|
|
||||||
TESTB = {
|
|
||||||
'a': 'foo',
|
|
||||||
'c': Logic_OR([ 'bar', 'baz' ]),
|
|
||||||
'd': Logic_AND([ True, 'foo' ]),
|
|
||||||
'f': Logic_AND([9, {'b': 1}]),
|
|
||||||
'e': {'b': Logic_Operator({'gte':-10, 'lt': 1}) },
|
|
||||||
'g': Logic_OR([ 'baz', Logic_AND([{'b':0}, {'f': 8}]) ])
|
|
||||||
}
|
|
||||||
|
|
||||||
With regards to Subject, this test is invalid
|
|
||||||
TESTC = {
|
|
||||||
'n': 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Tests are executed thus:
|
|
||||||
S = Subject()
|
|
||||||
L = Logician(S)
|
|
||||||
L.execute(TESTA)
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
class Logic_AND(list):
|
|
||||||
pass
|
|
||||||
class Logic_OR(list):
|
|
||||||
pass
|
|
||||||
class Logic_Operator(dict):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class Logician(object):
|
|
||||||
"""Given a subject and a dict that describes tests to perform on
|
|
||||||
its members, this class will evaluate True or False results for
|
|
||||||
each member/test pair. See the examples below for test syntax.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
subject = None
|
|
||||||
def __init__(self, subject):
|
|
||||||
self.subject = subject
|
|
||||||
|
|
||||||
def get_member(self, member_name):
|
|
||||||
"""Get a member value from the subject object. Raise exception
|
|
||||||
if subject is None or member not found.
|
|
||||||
|
|
||||||
"""
|
|
||||||
if self.subject is None:
|
|
||||||
raise Exception('Cannot run tests on a subject which is None')
|
|
||||||
|
|
||||||
return getattr(self.subject, member_name)
|
|
||||||
|
|
||||||
def test_logic(self, member, logic, operator='eq'):
|
|
||||||
"""Find the type of test to run on member, and perform that test"""
|
|
||||||
|
|
||||||
if type(logic) is dict:
|
|
||||||
return self.test_dict(member, logic)
|
|
||||||
elif type(logic) is Logic_AND:
|
|
||||||
return self.test_and(member, logic)
|
|
||||||
elif type(logic) is Logic_OR:
|
|
||||||
return self.test_or(member, logic)
|
|
||||||
elif type(logic) is Logic_Operator:
|
|
||||||
return self.test_operator(member, logic)
|
|
||||||
else:
|
|
||||||
# compare the value, I think using Logic_Operator() here
|
|
||||||
# allows completeness in test_operator(), but I can't put
|
|
||||||
# my finger on why for the minute
|
|
||||||
return self.test_operator(member,
|
|
||||||
Logic_Operator({operator: logic}))
|
|
||||||
|
|
||||||
def test_operator(self, member, value):
|
|
||||||
"""Execute the operators contained within value and expect that
|
|
||||||
ALL operators are True
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# something in this method is incomplete, what if operand is
|
|
||||||
# a dict, Logic_AND, Logic_OR or another Logic_Operator ?
|
|
||||||
# Do those constructs even make any sense ?
|
|
||||||
|
|
||||||
result = True
|
|
||||||
for operator, operand in value.items():
|
|
||||||
operator = operator.lower().strip()
|
|
||||||
if operator in ['eq', '==']:
|
|
||||||
result &= member==operand
|
|
||||||
if operator in ['not', '!=']:
|
|
||||||
result &= member!=operand
|
|
||||||
if operator in ['lt', '<']:
|
|
||||||
result &= member<operand
|
|
||||||
if operator in ['lte', '<=']:
|
|
||||||
result &= member<=operand
|
|
||||||
if operator in ['gt', '>']:
|
|
||||||
result &= member>operand
|
|
||||||
if operator in ['gte', '>=']:
|
|
||||||
result &= member>=operand
|
|
||||||
if operator in ['and', '&']:
|
|
||||||
result &= member&operand
|
|
||||||
if operator in ['or', '|']:
|
|
||||||
result &= member|operand
|
|
||||||
if operator in ['len']:
|
|
||||||
result &= len(member)==operand
|
|
||||||
# I can think of some more, but they're probably not useful.
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def test_or(self, member, logic):
|
|
||||||
"""Member is a value, logic is a set of values, ANY of which
|
|
||||||
can be True
|
|
||||||
|
|
||||||
"""
|
|
||||||
result = False
|
|
||||||
for test in logic:
|
|
||||||
result |= self.test_logic(member, test)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def test_and(self, member, logic):
|
|
||||||
"""Member is a value, logic is a list of values, ALL of which
|
|
||||||
must be True
|
|
||||||
|
|
||||||
"""
|
|
||||||
result = True
|
|
||||||
for test in logic:
|
|
||||||
result &= self.test_logic(member, test)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def test_dict(self, member, logic):
|
|
||||||
"""Member is a value, logic is a dict of other members to
|
|
||||||
compare to. All other member tests must be True
|
|
||||||
|
|
||||||
"""
|
|
||||||
result = True
|
|
||||||
for other_member, test in logic.items():
|
|
||||||
result &= self.test_logic(self.get_member(other_member), test)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def execute(self, test):
|
|
||||||
"""Subject is an object, test is a dict of {member: test} pairs
|
|
||||||
to perform on subject's members. Wach key in test is a member
|
|
||||||
of subject.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
for member_name, logic in test.items():
|
|
||||||
result = self.test_logic(self.get_member(member_name), logic)
|
|
||||||
print('member %s is %s' % (member_name, result))
|
|
||||||
|
|
||||||
# A couple of name aliases
|
|
||||||
class Validation(Logician):
|
|
||||||
pass
|
|
||||||
class Visibility(Logician):
|
|
||||||
pass
|
|
||||||
@@ -37,7 +37,7 @@ class ExportHelper:
|
|||||||
|
|
||||||
self.filepath = blend_filepath + self.filename_ext
|
self.filepath = blend_filepath + self.filename_ext
|
||||||
|
|
||||||
context.window_manager.add_fileselect(self)
|
context.window_manager.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
def check(self, context):
|
def check(self, context):
|
||||||
@@ -53,7 +53,7 @@ class ImportHelper:
|
|||||||
filepath = StringProperty(name="File Path", description="Filepath used for importing the file", maxlen=1024, default="", subtype='FILE_PATH')
|
filepath = StringProperty(name="File Path", description="Filepath used for importing the file", maxlen=1024, default="", subtype='FILE_PATH')
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
context.window_manager.add_fileselect(self)
|
context.window_manager.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,20 @@ def rna_idprop_ui_prop_clear(item, prop):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def draw(layout, context, context_member, use_edit=True):
|
def rna_idprop_context_value(context, context_member, property_type):
|
||||||
|
space = context.space_data
|
||||||
|
pin_id = space.pin_id
|
||||||
|
|
||||||
|
if pin_id and isinstance(pin_id, property_type):
|
||||||
|
rna_item = pin_id
|
||||||
|
context_member = "space_data.pin_id"
|
||||||
|
else:
|
||||||
|
rna_item = eval("context." + context_member)
|
||||||
|
|
||||||
|
return rna_item, context_member
|
||||||
|
|
||||||
|
|
||||||
|
def draw(layout, context, context_member, property_type, use_edit=True):
|
||||||
|
|
||||||
def assign_props(prop, val, key):
|
def assign_props(prop, val, key):
|
||||||
prop.data_path = context_member
|
prop.data_path = context_member
|
||||||
@@ -69,12 +82,14 @@ def draw(layout, context, context_member, use_edit=True):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
rna_item = eval("context." + context_member)
|
rna_item, context_member = rna_idprop_context_value(context, context_member, property_type)
|
||||||
|
|
||||||
# poll should really get this...
|
# poll should really get this...
|
||||||
if not rna_item:
|
if not rna_item:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
assert(isinstance(rna_item, property_type))
|
||||||
|
|
||||||
items = rna_item.items()
|
items = rna_item.items()
|
||||||
items.sort()
|
items.sort()
|
||||||
|
|
||||||
@@ -139,7 +154,16 @@ class PropertyPanel():
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return bool(eval("context.%s" % cls._context_path))
|
rna_item, context_member = rna_idprop_context_value(context, cls._context_path, cls._property_type)
|
||||||
|
return bool(rna_item)
|
||||||
|
|
||||||
|
"""
|
||||||
|
def draw_header(self, context):
|
||||||
|
rna_item, context_member = rna_idprop_context_value(context, self._context_path, self._property_type)
|
||||||
|
tot = len(rna_item.keys())
|
||||||
|
if tot:
|
||||||
|
self.layout().label("%d:" % tot)
|
||||||
|
"""
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
draw(self.layout, context, self._context_path)
|
draw(self.layout, context, self._context_path, self._property_type)
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class AddTorus(bpy.types.Operator):
|
|||||||
mesh.update()
|
mesh.update()
|
||||||
|
|
||||||
import add_object_utils
|
import add_object_utils
|
||||||
add_object_utils.add_object_data(context, mesh, operator=self)
|
add_object_utils.object_data_add(context, mesh, operator=self)
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,8 @@ def banner(context):
|
|||||||
sc = context.space_data
|
sc = context.space_data
|
||||||
version_string = sys.version.strip().replace('\n', ' ')
|
version_string = sys.version.strip().replace('\n', ' ')
|
||||||
|
|
||||||
add_scrollback(" * Python Interactive Console %s *" % version_string, 'OUTPUT')
|
add_scrollback("PYTHON INTERACTIVE CONSOLE %s" % version_string, 'OUTPUT')
|
||||||
|
add_scrollback("", 'OUTPUT')
|
||||||
add_scrollback("Command History: Up/Down Arrow", 'OUTPUT')
|
add_scrollback("Command History: Up/Down Arrow", 'OUTPUT')
|
||||||
add_scrollback("Cursor: Left/Right Home/End", 'OUTPUT')
|
add_scrollback("Cursor: Left/Right Home/End", 'OUTPUT')
|
||||||
add_scrollback("Remove: Backspace/Delete", 'OUTPUT')
|
add_scrollback("Remove: Backspace/Delete", 'OUTPUT')
|
||||||
|
|||||||
@@ -86,8 +86,11 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
|
|||||||
if self.TX_ZROT90:
|
if self.TX_ZROT90:
|
||||||
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
|
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
|
||||||
|
|
||||||
|
keywords = self.as_keywords(ignore=("TX_XROT90", "TX_YROT90", "TX_ZROT90", "TX_SCALE", "check_existing", "filter_glob"))
|
||||||
|
keywords["GLOBAL_MATRIX"] = GLOBAL_MATRIX
|
||||||
|
|
||||||
import io_scene_fbx.export_fbx
|
import io_scene_fbx.export_fbx
|
||||||
return io_scene_fbx.export_fbx.save(self, context, **self.as_keywords(ignore=("TX_XROT90", "TX_YROT90", "TX_ZROT90", "TX_SCALE", "check_existing", "filter_glob")))
|
return io_scene_fbx.export_fbx.save(self, context, **keywords)
|
||||||
|
|
||||||
|
|
||||||
def menu_func(self, context):
|
def menu_func(self, context):
|
||||||
|
|||||||
@@ -42,7 +42,11 @@ import mathutils
|
|||||||
from io_utils import create_derived_objects, free_derived_objects
|
from io_utils import create_derived_objects, free_derived_objects
|
||||||
|
|
||||||
DEG2RAD=0.017453292519943295
|
DEG2RAD=0.017453292519943295
|
||||||
MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X')
|
RAD_90D = -(math.pi / 2.0)
|
||||||
|
MATWORLD= mathutils.Matrix.Rotation(RAD_90D, 4, 'X')
|
||||||
|
|
||||||
|
def round_color(col, cp):
|
||||||
|
return tuple([round(max(min(c, 1.0), 0.0), cp) for c in col])
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Global Variables
|
# Global Variables
|
||||||
@@ -65,8 +69,6 @@ class x3d_class:
|
|||||||
self.writingtexture = 0
|
self.writingtexture = 0
|
||||||
self.writingcoords = 0
|
self.writingcoords = 0
|
||||||
self.proto = 1
|
self.proto = 1
|
||||||
self.matonly = 0
|
|
||||||
self.share = 0
|
|
||||||
self.billnode = 0
|
self.billnode = 0
|
||||||
self.halonode = 0
|
self.halonode = 0
|
||||||
self.collnode = 0
|
self.collnode = 0
|
||||||
@@ -189,46 +191,27 @@ class x3d_class:
|
|||||||
|
|
||||||
def writeViewpoint(self, ob, mat, scene):
|
def writeViewpoint(self, ob, mat, scene):
|
||||||
context = scene.render
|
context = scene.render
|
||||||
# context = scene.render
|
|
||||||
ratio = float(context.resolution_x)/float(context.resolution_y)
|
|
||||||
# ratio = float(context.imageSizeY())/float(context.imageSizeX())
|
|
||||||
lens = (360* (math.atan(ratio *16 / ob.data.lens) / math.pi))*(math.pi/180)
|
|
||||||
# lens = (360* (math.atan(ratio *16 / ob.data.getLens()) / math.pi))*(math.pi/180)
|
|
||||||
lens = min(lens, math.pi)
|
|
||||||
|
|
||||||
# get the camera location, subtract 90 degress from X to orient like X3D does
|
loc, quat, scale = (MATWORLD * mat).decompose()
|
||||||
# mat = ob.matrix_world - mat is now passed!
|
angleAxis = tuple(quat.axis) + (quat.angle, )
|
||||||
|
|
||||||
loc = self.rotatePointForVRML(mat.translation_part())
|
|
||||||
rot = mat.to_euler()
|
|
||||||
rot = (((rot[0]-90)), rot[1], rot[2])
|
|
||||||
# rot = (((rot[0]-90)*DEG2RAD), rot[1]*DEG2RAD, rot[2]*DEG2RAD)
|
|
||||||
nRot = self.rotatePointForVRML( rot )
|
|
||||||
# convert to Quaternion and to Angle Axis
|
|
||||||
Q = self.eulerToQuaternions(nRot[0], nRot[1], nRot[2])
|
|
||||||
Q1 = self.multiplyQuaternions(Q[0], Q[1])
|
|
||||||
Qf = self.multiplyQuaternions(Q1, Q[2])
|
|
||||||
angleAxis = self.quaternionToAngleAxis(Qf)
|
|
||||||
self.file.write("<Viewpoint DEF=\"%s\" " % (self.cleanStr(ob.name)))
|
self.file.write("<Viewpoint DEF=\"%s\" " % (self.cleanStr(ob.name)))
|
||||||
self.file.write("description=\"%s\" " % (ob.name))
|
self.file.write("description=\"%s\" " % (ob.name))
|
||||||
self.file.write("centerOfRotation=\"0 0 0\" ")
|
self.file.write("centerOfRotation=\"0 0 0\" ")
|
||||||
self.file.write("position=\"%3.2f %3.2f %3.2f\" " % (loc[0], loc[1], loc[2]))
|
self.file.write("position=\"%3.2f %3.2f %3.2f\" " % tuple(loc))
|
||||||
self.file.write("orientation=\"%3.2f %3.2f %3.2f %3.2f\" " % (angleAxis[0], angleAxis[1], -angleAxis[2], angleAxis[3]))
|
self.file.write("orientation=\"%3.2f %3.2f %3.2f %3.2f\" " % angleAxis)
|
||||||
self.file.write("fieldOfView=\"%.3f\" />\n\n" % (lens))
|
self.file.write("fieldOfView=\"%.3f\" />\n\n" % ob.data.angle)
|
||||||
|
|
||||||
def writeFog(self, world):
|
def writeFog(self, world):
|
||||||
if world:
|
if world:
|
||||||
mtype = world.mist_settings.falloff
|
mtype = world.mist_settings.falloff
|
||||||
mparam = world.mist_settings
|
mparam = world.mist_settings
|
||||||
grd = world.horizon_color
|
|
||||||
grd0, grd1, grd2 = grd[0], grd[1], grd[2]
|
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
if (mtype == 'LINEAR' or mtype == 'INVERSE_QUADRATIC'):
|
if (mtype == 'LINEAR' or mtype == 'INVERSE_QUADRATIC'):
|
||||||
mtype = 1 if mtype == 'LINEAR' else 2
|
mtype = 1 if mtype == 'LINEAR' else 2
|
||||||
# if (mtype == 1 or mtype == 2):
|
# if (mtype == 1 or mtype == 2):
|
||||||
self.file.write("<Fog fogType=\"%s\" " % self.namesFog[mtype])
|
self.file.write("<Fog fogType=\"%s\" " % self.namesFog[mtype])
|
||||||
self.file.write("color=\"%s %s %s\" " % (round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
self.file.write("color=\"%s %s %s\" " % round_color(world.horizon_color, self.cp))
|
||||||
self.file.write("visibilityRange=\"%s\" />\n\n" % round(mparam[2],self.cp))
|
self.file.write("visibilityRange=\"%s\" />\n\n" % round(mparam[2],self.cp))
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
@@ -240,11 +223,10 @@ class x3d_class:
|
|||||||
safeName = self.cleanStr(ob.name)
|
safeName = self.cleanStr(ob.name)
|
||||||
if world:
|
if world:
|
||||||
ambi = world.ambient_color
|
ambi = world.ambient_color
|
||||||
# ambi = world.amb
|
ambientIntensity = ((ambi[0] + ambi[1] + ambi[2]) / 3.0) / 2.5
|
||||||
ambientIntensity = ((float(ambi[0] + ambi[1] + ambi[2]))/3)/2.5
|
del ambi
|
||||||
else:
|
else:
|
||||||
ambi = 0
|
ambientIntensity = 0.0
|
||||||
ambientIntensity = 0
|
|
||||||
|
|
||||||
# compute cutoff and beamwidth
|
# compute cutoff and beamwidth
|
||||||
intensity=min(lamp.energy/1.75,1.0)
|
intensity=min(lamp.energy/1.75,1.0)
|
||||||
@@ -258,7 +240,7 @@ class x3d_class:
|
|||||||
# note dy seems to equal om[3][2]
|
# note dy seems to equal om[3][2]
|
||||||
|
|
||||||
#location=(ob.matrix_world*MATWORLD).translation_part() # now passed
|
#location=(ob.matrix_world*MATWORLD).translation_part() # now passed
|
||||||
location=(mtx*MATWORLD).translation_part()
|
location=(MATWORLD * mtx).translation_part()
|
||||||
|
|
||||||
radius = lamp.distance*math.cos(beamWidth)
|
radius = lamp.distance*math.cos(beamWidth)
|
||||||
# radius = lamp.dist*math.cos(beamWidth)
|
# radius = lamp.dist*math.cos(beamWidth)
|
||||||
@@ -266,8 +248,7 @@ class x3d_class:
|
|||||||
self.file.write("radius=\"%s\" " % (round(radius,self.cp)))
|
self.file.write("radius=\"%s\" " % (round(radius,self.cp)))
|
||||||
self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
|
self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
|
||||||
self.file.write("intensity=\"%s\" " % (round(intensity,self.cp)))
|
self.file.write("intensity=\"%s\" " % (round(intensity,self.cp)))
|
||||||
self.file.write("color=\"%s %s %s\" " % (round(lamp.color[0],self.cp), round(lamp.color[1],self.cp), round(lamp.color[2],self.cp)))
|
self.file.write("color=\"%s %s %s\" " % round_color(lamp.color, self.cp))
|
||||||
# self.file.write("color=\"%s %s %s\" " % (round(lamp.col[0],self.cp), round(lamp.col[1],self.cp), round(lamp.col[2],self.cp)))
|
|
||||||
self.file.write("beamWidth=\"%s\" " % (round(beamWidth,self.cp)))
|
self.file.write("beamWidth=\"%s\" " % (round(beamWidth,self.cp)))
|
||||||
self.file.write("cutOffAngle=\"%s\" " % (round(cutOffAngle,self.cp)))
|
self.file.write("cutOffAngle=\"%s\" " % (round(cutOffAngle,self.cp)))
|
||||||
self.file.write("direction=\"%s %s %s\" " % (round(dx,3),round(dy,3),round(dz,3)))
|
self.file.write("direction=\"%s %s %s\" " % (round(dx,3),round(dy,3),round(dz,3)))
|
||||||
@@ -303,8 +284,7 @@ class x3d_class:
|
|||||||
ambi = 0
|
ambi = 0
|
||||||
ambientIntensity = 0
|
ambientIntensity = 0
|
||||||
|
|
||||||
# location=(ob.matrix_world*MATWORLD).translation_part() # now passed
|
location= (MATWORLD * mtx).translation_part()
|
||||||
location= (mtx*MATWORLD).translation_part()
|
|
||||||
|
|
||||||
self.file.write("<PointLight DEF=\"%s\" " % safeName)
|
self.file.write("<PointLight DEF=\"%s\" " % safeName)
|
||||||
self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
|
self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
|
||||||
@@ -321,8 +301,8 @@ class x3d_class:
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
dx,dy,dz = self.computeDirection(mtx)
|
dx,dy,dz = self.computeDirection(mtx)
|
||||||
# location=(ob.matrix_world*MATWORLD).translation_part()
|
# location=(MATWORLD * ob.matrix_world).translation_part()
|
||||||
location=(mtx*MATWORLD).translation_part()
|
location=(MATWORLD * mtx).translation_part()
|
||||||
self.writeIndented("<%s\n" % obname,1)
|
self.writeIndented("<%s\n" % obname,1)
|
||||||
self.writeIndented("direction=\"%s %s %s\"\n" % (round(dx,3),round(dy,3),round(dz,3)))
|
self.writeIndented("direction=\"%s %s %s\"\n" % (round(dx,3),round(dy,3),round(dz,3)))
|
||||||
self.writeIndented("location=\"%s %s %s\"\n" % (round(location[0],3), round(location[1],3), round(location[2],3)))
|
self.writeIndented("location=\"%s %s %s\"\n" % (round(location[0],3), round(location[1],3), round(location[2],3)))
|
||||||
@@ -351,7 +331,6 @@ class x3d_class:
|
|||||||
def writeIndexedFaceSet(self, ob, mesh, mtx, world, EXPORT_TRI = False):
|
def writeIndexedFaceSet(self, ob, mesh, mtx, world, EXPORT_TRI = False):
|
||||||
imageMap={} # set of used images
|
imageMap={} # set of used images
|
||||||
sided={} # 'one':cnt , 'two':cnt
|
sided={} # 'one':cnt , 'two':cnt
|
||||||
vColors={} # 'multi':1
|
|
||||||
meshName = self.cleanStr(ob.name)
|
meshName = self.cleanStr(ob.name)
|
||||||
|
|
||||||
meshME = self.cleanStr(ob.data.name) # We dont care if its the mesh name or not
|
meshME = self.cleanStr(ob.data.name) # We dont care if its the mesh name or not
|
||||||
@@ -381,9 +360,6 @@ class x3d_class:
|
|||||||
# elif mode & Mesh.FaceModes.BILLBOARD and self.billnode == 0:
|
# elif mode & Mesh.FaceModes.BILLBOARD and self.billnode == 0:
|
||||||
self.writeIndented("<Billboard axisOfRotation=\"0 1 0\">\n",1)
|
self.writeIndented("<Billboard axisOfRotation=\"0 1 0\">\n",1)
|
||||||
self.billnode = 1
|
self.billnode = 1
|
||||||
elif 'OBJECT_COLOR' in mode and self.matonly == 0:
|
|
||||||
# elif mode & Mesh.FaceModes.OBCOL and self.matonly == 0:
|
|
||||||
self.matonly = 1
|
|
||||||
# TF_TILES is marked as deprecated in DNA_meshdata_types.h
|
# TF_TILES is marked as deprecated in DNA_meshdata_types.h
|
||||||
# elif mode & Mesh.FaceModes.TILES and self.tilenode == 0:
|
# elif mode & Mesh.FaceModes.TILES and self.tilenode == 0:
|
||||||
# self.tilenode = 1
|
# self.tilenode = 1
|
||||||
@@ -392,7 +368,7 @@ class x3d_class:
|
|||||||
self.writeIndented("<Collision enabled=\"false\">\n",1)
|
self.writeIndented("<Collision enabled=\"false\">\n",1)
|
||||||
self.collnode = 1
|
self.collnode = 1
|
||||||
|
|
||||||
nIFSCnt=self.countIFSSetsNeeded(mesh, imageMap, sided, vColors)
|
nIFSCnt=self.countIFSSetsNeeded(mesh, imageMap, sided)
|
||||||
|
|
||||||
if nIFSCnt > 1:
|
if nIFSCnt > 1:
|
||||||
self.writeIndented("<Group DEF=\"%s%s\">\n" % ("G_", meshName),1)
|
self.writeIndented("<Group DEF=\"%s%s\">\n" % ("G_", meshName),1)
|
||||||
@@ -402,8 +378,7 @@ class x3d_class:
|
|||||||
else:
|
else:
|
||||||
bTwoSided=0
|
bTwoSided=0
|
||||||
|
|
||||||
# mtx = ob.matrix_world * MATWORLD # mtx is now passed
|
mtx = MATWORLD * mtx
|
||||||
mtx = mtx * MATWORLD
|
|
||||||
|
|
||||||
loc= mtx.translation_part()
|
loc= mtx.translation_part()
|
||||||
sca= mtx.scale_part()
|
sca= mtx.scale_part()
|
||||||
@@ -482,10 +457,9 @@ class x3d_class:
|
|||||||
|
|
||||||
#--- output textureCoordinates if UV texture used
|
#--- output textureCoordinates if UV texture used
|
||||||
if mesh.uv_textures.active:
|
if mesh.uv_textures.active:
|
||||||
if self.matonly == 1 and self.share == 1:
|
self.writeTextureCoordinates(mesh)
|
||||||
self.writeFaceColors(mesh)
|
if mesh.vertex_colors.active:
|
||||||
elif hasImageTexture == True:
|
self.writeFaceColors(mesh)
|
||||||
self.writeTextureCoordinates(mesh)
|
|
||||||
#--- output coordinates
|
#--- output coordinates
|
||||||
self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
|
self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
|
||||||
|
|
||||||
@@ -496,14 +470,10 @@ class x3d_class:
|
|||||||
|
|
||||||
#--- output textureCoordinates if UV texture used
|
#--- output textureCoordinates if UV texture used
|
||||||
if mesh.uv_textures.active:
|
if mesh.uv_textures.active:
|
||||||
# if mesh.faceUV:
|
self.writeTextureCoordinates(mesh)
|
||||||
if hasImageTexture == True:
|
if mesh.vertex_colors.active:
|
||||||
self.writeTextureCoordinates(mesh)
|
self.writeFaceColors(mesh)
|
||||||
elif self.matonly == 1 and self.share == 1:
|
|
||||||
self.writeFaceColors(mesh)
|
|
||||||
#--- output vertexColors
|
#--- output vertexColors
|
||||||
self.matonly = 0
|
|
||||||
self.share = 0
|
|
||||||
|
|
||||||
self.writingcoords = 0
|
self.writingcoords = 0
|
||||||
self.writingtexture = 0
|
self.writingtexture = 0
|
||||||
@@ -629,45 +599,33 @@ class x3d_class:
|
|||||||
self.matNames[matName]+=1
|
self.matNames[matName]+=1
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self.matNames[matName]=1
|
self.matNames[matName] = 1
|
||||||
|
|
||||||
ambient = mat.ambient/3
|
emit = mat.emit
|
||||||
# ambient = mat.amb/3
|
ambient = mat.ambient / 3.0
|
||||||
diffuseR, diffuseG, diffuseB = tuple(mat.diffuse_color)
|
diffuseColor = tuple(mat.diffuse_color)
|
||||||
# diffuseR, diffuseG, diffuseB = mat.rgbCol[0], mat.rgbCol[1],mat.rgbCol[2]
|
|
||||||
if world:
|
if world:
|
||||||
ambi = world.ambient_color
|
ambiColor = tuple(((c * mat.ambient) * 2.0) for c in world.ambient_color)
|
||||||
# ambi = world.getAmb()
|
|
||||||
ambi0, ambi1, ambi2 = (ambi[0]*mat.ambient)*2, (ambi[1]*mat.ambient)*2, (ambi[2]*mat.ambient)*2
|
|
||||||
# ambi0, ambi1, ambi2 = (ambi[0]*mat.amb)*2, (ambi[1]*mat.amb)*2, (ambi[2]*mat.amb)*2
|
|
||||||
else:
|
else:
|
||||||
ambi0, ambi1, ambi2 = 0, 0, 0
|
ambiColor = 0.0, 0.0, 0.0
|
||||||
emisR, emisG, emisB = (diffuseR*mat.emit+ambi0)/2, (diffuseG*mat.emit+ambi1)/2, (diffuseB*mat.emit+ambi2)/2
|
|
||||||
|
emitColor = tuple(((c * emit) + ambiColor[i]) / 2.0 for i, c in enumerate(diffuseColor))
|
||||||
|
shininess = mat.specular_hardness / 512.0
|
||||||
|
specColor = tuple((c + 0.001) / (1.25 / (mat.specular_intensity + 0.001)) for c in mat.specular_color)
|
||||||
|
transp = 1.0 - mat.alpha
|
||||||
|
|
||||||
shininess = mat.specular_hardness/512.0
|
|
||||||
# shininess = mat.hard/512.0
|
|
||||||
specR = (mat.specular_color[0]+0.001)/(1.25/(mat.specular_intensity+0.001))
|
|
||||||
# specR = (mat.specCol[0]+0.001)/(1.25/(mat.spec+0.001))
|
|
||||||
specG = (mat.specular_color[1]+0.001)/(1.25/(mat.specular_intensity+0.001))
|
|
||||||
# specG = (mat.specCol[1]+0.001)/(1.25/(mat.spec+0.001))
|
|
||||||
specB = (mat.specular_color[2]+0.001)/(1.25/(mat.specular_intensity+0.001))
|
|
||||||
# specB = (mat.specCol[2]+0.001)/(1.25/(mat.spec+0.001))
|
|
||||||
transp = 1-mat.alpha
|
|
||||||
# matFlags = mat.getMode()
|
|
||||||
if mat.use_shadeless:
|
if mat.use_shadeless:
|
||||||
# if matFlags & Blender.Material.Modes['SHADELESS']:
|
ambient = 1.0
|
||||||
ambient = 1
|
shininess = 0.0
|
||||||
shine = 1
|
specColor = emitColor = diffuseColor
|
||||||
specR = emitR = diffuseR
|
|
||||||
specG = emitG = diffuseG
|
|
||||||
specB = emitB = diffuseB
|
|
||||||
self.writeIndented("<Material DEF=\"MA_%s\" " % matName, 1)
|
self.writeIndented("<Material DEF=\"MA_%s\" " % matName, 1)
|
||||||
self.file.write("diffuseColor=\"%s %s %s\" " % (round(diffuseR,self.cp), round(diffuseG,self.cp), round(diffuseB,self.cp)))
|
self.file.write("diffuseColor=\"%s %s %s\" " % round_color(diffuseColor, self.cp))
|
||||||
self.file.write("specularColor=\"%s %s %s\" " % (round(specR,self.cp), round(specG,self.cp), round(specB,self.cp)))
|
self.file.write("specularColor=\"%s %s %s\" " % round_color(specColor, self.cp))
|
||||||
self.file.write("emissiveColor=\"%s %s %s\" \n" % (round(emisR,self.cp), round(emisG,self.cp), round(emisB,self.cp)))
|
self.file.write("emissiveColor=\"%s %s %s\" \n" % round_color(emitColor, self.cp))
|
||||||
self.writeIndented("ambientIntensity=\"%s\" " % (round(ambient,self.cp)))
|
self.writeIndented("ambientIntensity=\"%s\" " % (round(ambient, self.cp)))
|
||||||
self.file.write("shininess=\"%s\" " % (round(shininess,self.cp)))
|
self.file.write("shininess=\"%s\" " % (round(shininess, self.cp)))
|
||||||
self.file.write("transparency=\"%s\" />" % (round(transp,self.cp)))
|
self.file.write("transparency=\"%s\" />" % (round(transp, self.cp)))
|
||||||
self.writeIndented("\n",-1)
|
self.writeIndented("\n",-1)
|
||||||
|
|
||||||
def writeImageTexture(self, image):
|
def writeImageTexture(self, image):
|
||||||
@@ -685,54 +643,45 @@ class x3d_class:
|
|||||||
def writeBackground(self, world, alltextures):
|
def writeBackground(self, world, alltextures):
|
||||||
if world: worldname = world.name
|
if world: worldname = world.name
|
||||||
else: return
|
else: return
|
||||||
blending = (world.use_sky_blend, world.use_sky_paper, world.use_sky_real)
|
blending = world.use_sky_blend, world.use_sky_paper, world.use_sky_real
|
||||||
# blending = world.getSkytype()
|
|
||||||
grd = world.horizon_color
|
grd_triple = round_color(world.horizon_color, self.cp)
|
||||||
# grd = world.getHor()
|
sky_triple = round_color(world.zenith_color, self.cp)
|
||||||
grd0, grd1, grd2 = grd[0], grd[1], grd[2]
|
mix_triple = round_color(((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3)), self.cp)
|
||||||
sky = world.zenith_color
|
|
||||||
# sky = world.getZen()
|
|
||||||
sky0, sky1, sky2 = sky[0], sky[1], sky[2]
|
|
||||||
mix0, mix1, mix2 = grd[0]+sky[0], grd[1]+sky[1], grd[2]+sky[2]
|
|
||||||
mix0, mix1, mix2 = mix0/2, mix1/2, mix2/2
|
|
||||||
self.file.write("<Background ")
|
self.file.write("<Background ")
|
||||||
if worldname not in self.namesStandard:
|
if worldname not in self.namesStandard:
|
||||||
self.file.write("DEF=\"%s\" " % self.secureName(worldname))
|
self.file.write("DEF=\"%s\" " % self.secureName(worldname))
|
||||||
# No Skytype - just Hor color
|
# No Skytype - just Hor color
|
||||||
if blending == (0, 0, 0):
|
if blending == (False, False, False):
|
||||||
# if blending == 0:
|
self.file.write("groundColor=\"%s %s %s\" " % grd_triple)
|
||||||
self.file.write("groundColor=\"%s %s %s\" " % (round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
self.file.write("skyColor=\"%s %s %s\" " % grd_triple)
|
||||||
self.file.write("skyColor=\"%s %s %s\" " % (round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
|
||||||
# Blend Gradient
|
# Blend Gradient
|
||||||
elif blending == (1, 0, 0):
|
elif blending == (True, False, False):
|
||||||
# elif blending == 1:
|
self.file.write("groundColor=\"%s %s %s, " % grd_triple)
|
||||||
self.file.write("groundColor=\"%s %s %s, " % (round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
self.file.write("%s %s %s\" groundAngle=\"1.57, 1.57\" " % mix_triple)
|
||||||
self.file.write("%s %s %s\" groundAngle=\"1.57, 1.57\" " %(round(mix0,self.cp), round(mix1,self.cp), round(mix2,self.cp)))
|
self.file.write("skyColor=\"%s %s %s, " % sky_triple)
|
||||||
self.file.write("skyColor=\"%s %s %s, " % (round(sky0,self.cp), round(sky1,self.cp), round(sky2,self.cp)))
|
self.file.write("%s %s %s\" skyAngle=\"1.57, 1.57\" " % mix_triple)
|
||||||
self.file.write("%s %s %s\" skyAngle=\"1.57, 1.57\" " %(round(mix0,self.cp), round(mix1,self.cp), round(mix2,self.cp)))
|
|
||||||
# Blend+Real Gradient Inverse
|
# Blend+Real Gradient Inverse
|
||||||
elif blending == (1, 0, 1):
|
elif blending == (True, False, True):
|
||||||
# elif blending == 3:
|
self.file.write("groundColor=\"%s %s %s, " % sky_triple)
|
||||||
self.file.write("groundColor=\"%s %s %s, " % (round(sky0,self.cp), round(sky1,self.cp), round(sky2,self.cp)))
|
self.file.write("%s %s %s\" groundAngle=\"1.57, 1.57\" " % mix_triple)
|
||||||
self.file.write("%s %s %s\" groundAngle=\"1.57, 1.57\" " %(round(mix0,self.cp), round(mix1,self.cp), round(mix2,self.cp)))
|
self.file.write("skyColor=\"%s %s %s, " % grd_triple)
|
||||||
self.file.write("skyColor=\"%s %s %s, " % (round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
self.file.write("%s %s %s\" skyAngle=\"1.57, 1.57\" " % mix_triple)
|
||||||
self.file.write("%s %s %s\" skyAngle=\"1.57, 1.57\" " %(round(mix0,self.cp), round(mix1,self.cp), round(mix2,self.cp)))
|
|
||||||
# Paper - just Zen Color
|
# Paper - just Zen Color
|
||||||
elif blending == (0, 0, 1):
|
elif blending == (False, False, True):
|
||||||
# elif blending == 4:
|
self.file.write("groundColor=\"%s %s %s\" " % sky_triple)
|
||||||
self.file.write("groundColor=\"%s %s %s\" " % (round(sky0,self.cp), round(sky1,self.cp), round(sky2,self.cp)))
|
self.file.write("skyColor=\"%s %s %s\" " % sky_triple)
|
||||||
self.file.write("skyColor=\"%s %s %s\" " % (round(sky0,self.cp), round(sky1,self.cp), round(sky2,self.cp)))
|
|
||||||
# Blend+Real+Paper - komplex gradient
|
# Blend+Real+Paper - komplex gradient
|
||||||
elif blending == (1, 1, 1):
|
elif blending == (True, True, True):
|
||||||
# elif blending == 7:
|
self.writeIndented("groundColor=\"%s %s %s, " % sky_triple)
|
||||||
self.writeIndented("groundColor=\"%s %s %s, " % (round(sky0,self.cp), round(sky1,self.cp), round(sky2,self.cp)))
|
self.writeIndented("%s %s %s\" groundAngle=\"1.57, 1.57\" " % grd_triple)
|
||||||
self.writeIndented("%s %s %s\" groundAngle=\"1.57, 1.57\" " %(round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
self.writeIndented("skyColor=\"%s %s %s, " % sky_triple)
|
||||||
self.writeIndented("skyColor=\"%s %s %s, " % (round(sky0,self.cp), round(sky1,self.cp), round(sky2,self.cp)))
|
self.writeIndented("%s %s %s\" skyAngle=\"1.57, 1.57\" " % grd_triple)
|
||||||
self.writeIndented("%s %s %s\" skyAngle=\"1.57, 1.57\" " %(round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
|
||||||
# Any Other two colors
|
# Any Other two colors
|
||||||
else:
|
else:
|
||||||
self.file.write("groundColor=\"%s %s %s\" " % (round(grd0,self.cp), round(grd1,self.cp), round(grd2,self.cp)))
|
self.file.write("groundColor=\"%s %s %s\" " % grd_triple)
|
||||||
self.file.write("skyColor=\"%s %s %s\" " % (round(sky0,self.cp), round(sky1,self.cp), round(sky2,self.cp)))
|
self.file.write("skyColor=\"%s %s %s\" " % sky_triple)
|
||||||
|
|
||||||
alltexture = len(alltextures)
|
alltexture = len(alltextures)
|
||||||
|
|
||||||
@@ -751,25 +700,18 @@ class x3d_class:
|
|||||||
basename = os.path.basename(bpy.path.abspath(pic.filepath))
|
basename = os.path.basename(bpy.path.abspath(pic.filepath))
|
||||||
|
|
||||||
pic = alltextures[i].image
|
pic = alltextures[i].image
|
||||||
# pic = alltextures[i].getImage()
|
|
||||||
if (namemat == "back") and (pic != None):
|
if (namemat == "back") and (pic != None):
|
||||||
self.file.write("\n\tbackUrl=\"%s\" " % basename)
|
self.file.write("\n\tbackUrl=\"%s\" " % basename)
|
||||||
# self.file.write("\n\tbackUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1])
|
|
||||||
elif (namemat == "bottom") and (pic != None):
|
elif (namemat == "bottom") and (pic != None):
|
||||||
self.writeIndented("bottomUrl=\"%s\" " % basename)
|
self.writeIndented("bottomUrl=\"%s\" " % basename)
|
||||||
# self.writeIndented("bottomUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1])
|
|
||||||
elif (namemat == "front") and (pic != None):
|
elif (namemat == "front") and (pic != None):
|
||||||
self.writeIndented("frontUrl=\"%s\" " % basename)
|
self.writeIndented("frontUrl=\"%s\" " % basename)
|
||||||
# self.writeIndented("frontUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1])
|
|
||||||
elif (namemat == "left") and (pic != None):
|
elif (namemat == "left") and (pic != None):
|
||||||
self.writeIndented("leftUrl=\"%s\" " % basename)
|
self.writeIndented("leftUrl=\"%s\" " % basename)
|
||||||
# self.writeIndented("leftUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1])
|
|
||||||
elif (namemat == "right") and (pic != None):
|
elif (namemat == "right") and (pic != None):
|
||||||
self.writeIndented("rightUrl=\"%s\" " % basename)
|
self.writeIndented("rightUrl=\"%s\" " % basename)
|
||||||
# self.writeIndented("rightUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1])
|
|
||||||
elif (namemat == "top") and (pic != None):
|
elif (namemat == "top") and (pic != None):
|
||||||
self.writeIndented("topUrl=\"%s\" " % basename)
|
self.writeIndented("topUrl=\"%s\" " % basename)
|
||||||
# self.writeIndented("topUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1])
|
|
||||||
self.writeIndented("/>\n\n")
|
self.writeIndented("/>\n\n")
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
@@ -817,19 +759,13 @@ class x3d_class:
|
|||||||
# for ob, ob_mat in BPyObject.getDerivedObjects(ob_main):
|
# for ob, ob_mat in BPyObject.getDerivedObjects(ob_main):
|
||||||
objType=ob.type
|
objType=ob.type
|
||||||
objName=ob.name
|
objName=ob.name
|
||||||
self.matonly = 0
|
if objType == 'CAMERA':
|
||||||
if objType == "CAMERA":
|
|
||||||
# if objType == "Camera":
|
|
||||||
self.writeViewpoint(ob, ob_mat, scene)
|
self.writeViewpoint(ob, ob_mat, scene)
|
||||||
elif objType in ("MESH", "CURVE", "SURF", "TEXT") :
|
elif objType in ('MESH', 'CURVE', 'SURF', 'FONT') :
|
||||||
# elif objType in ("Mesh", "Curve", "Surf", "Text") :
|
|
||||||
if EXPORT_APPLY_MODIFIERS or objType != 'MESH':
|
if EXPORT_APPLY_MODIFIERS or objType != 'MESH':
|
||||||
# if EXPORT_APPLY_MODIFIERS or objType != 'Mesh':
|
|
||||||
me = ob.create_mesh(scene, EXPORT_APPLY_MODIFIERS, 'PREVIEW')
|
me = ob.create_mesh(scene, EXPORT_APPLY_MODIFIERS, 'PREVIEW')
|
||||||
# me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, False, scene)
|
|
||||||
else:
|
else:
|
||||||
me = ob.data
|
me = ob.data
|
||||||
# me = ob.getData(mesh=1)
|
|
||||||
|
|
||||||
self.writeIndexedFaceSet(ob, me, ob_mat, world, EXPORT_TRI = EXPORT_TRI)
|
self.writeIndexedFaceSet(ob, me, ob_mat, world, EXPORT_TRI = EXPORT_TRI)
|
||||||
|
|
||||||
@@ -837,24 +773,17 @@ class x3d_class:
|
|||||||
if me != ob.data:
|
if me != ob.data:
|
||||||
bpy.data.meshes.remove(me)
|
bpy.data.meshes.remove(me)
|
||||||
|
|
||||||
elif objType == "LAMP":
|
elif objType == 'LAMP':
|
||||||
# elif objType == "Lamp":
|
|
||||||
data= ob.data
|
data= ob.data
|
||||||
datatype=data.type
|
datatype=data.type
|
||||||
if datatype == 'POINT':
|
if datatype == 'POINT':
|
||||||
# if datatype == Lamp.Types.Lamp:
|
|
||||||
self.writePointLight(ob, ob_mat, data, world)
|
self.writePointLight(ob, ob_mat, data, world)
|
||||||
elif datatype == 'SPOT':
|
elif datatype == 'SPOT':
|
||||||
# elif datatype == Lamp.Types.Spot:
|
|
||||||
self.writeSpotLight(ob, ob_mat, data, world)
|
self.writeSpotLight(ob, ob_mat, data, world)
|
||||||
elif datatype == 'SUN':
|
elif datatype == 'SUN':
|
||||||
# elif datatype == Lamp.Types.Sun:
|
|
||||||
self.writeDirectionalLight(ob, ob_mat, data, world)
|
self.writeDirectionalLight(ob, ob_mat, data, world)
|
||||||
else:
|
else:
|
||||||
self.writeDirectionalLight(ob, ob_mat, data, world)
|
self.writeDirectionalLight(ob, ob_mat, data, world)
|
||||||
# do you think x3d could document what to do with dummy objects?
|
|
||||||
#elif objType == "Empty" and objName != "Empty":
|
|
||||||
# self.writeNode(ob, ob_mat)
|
|
||||||
else:
|
else:
|
||||||
#print "Info: Ignoring [%s], object type [%s] not handle yet" % (object.name,object.getType)
|
#print "Info: Ignoring [%s], object type [%s] not handle yet" % (object.name,object.getType)
|
||||||
pass
|
pass
|
||||||
@@ -899,7 +828,7 @@ class x3d_class:
|
|||||||
newName=newName.replace(bad,'_')
|
newName=newName.replace(bad,'_')
|
||||||
return newName
|
return newName
|
||||||
|
|
||||||
def countIFSSetsNeeded(self, mesh, imageMap, sided, vColors):
|
def countIFSSetsNeeded(self, mesh, imageMap, sided):
|
||||||
"""
|
"""
|
||||||
countIFFSetsNeeded() - should look at a blender mesh to determine
|
countIFFSetsNeeded() - should look at a blender mesh to determine
|
||||||
how many VRML IndexFaceSets or IndexLineSets are needed. A
|
how many VRML IndexFaceSets or IndexLineSets are needed. A
|
||||||
@@ -995,41 +924,12 @@ class x3d_class:
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
def computeDirection(self, mtx):
|
def computeDirection(self, mtx):
|
||||||
x,y,z=(0,-1.0,0) # point down
|
return (mathutils.Vector((0, -1, 0)) * (MATWORLD * mtx).rotation_part())[:]
|
||||||
|
|
||||||
ax,ay,az = (mtx*MATWORLD).to_euler()
|
|
||||||
|
|
||||||
# ax *= DEG2RAD
|
|
||||||
# ay *= DEG2RAD
|
|
||||||
# az *= DEG2RAD
|
|
||||||
|
|
||||||
# rot X
|
|
||||||
x1=x
|
|
||||||
y1=y*math.cos(ax)-z*math.sin(ax)
|
|
||||||
z1=y*math.sin(ax)+z*math.cos(ax)
|
|
||||||
|
|
||||||
# rot Y
|
|
||||||
x2=x1*math.cos(ay)+z1*math.sin(ay)
|
|
||||||
y2=y1
|
|
||||||
z2=z1*math.cos(ay)-x1*math.sin(ay)
|
|
||||||
|
|
||||||
# rot Z
|
|
||||||
x3=x2*math.cos(az)-y2*math.sin(az)
|
|
||||||
y3=x2*math.sin(az)+y2*math.cos(az)
|
|
||||||
z3=z2
|
|
||||||
|
|
||||||
return [x3,y3,z3]
|
|
||||||
|
|
||||||
|
|
||||||
# swap Y and Z to handle axis difference between Blender and VRML
|
# swap Y and Z to handle axis difference between Blender and VRML
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
def rotatePointForVRML(self, v):
|
def rotatePointForVRML(self, v):
|
||||||
x = v[0]
|
return v[0], v[2], -v[1]
|
||||||
y = v[2]
|
|
||||||
z = -v[1]
|
|
||||||
|
|
||||||
vrmlPoint=[x, y, z]
|
|
||||||
return vrmlPoint
|
|
||||||
|
|
||||||
# For writing well formed VRML code
|
# For writing well formed VRML code
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@@ -1045,46 +945,6 @@ class x3d_class:
|
|||||||
if inc > 0:
|
if inc > 0:
|
||||||
self.indentLevel = self.indentLevel + inc
|
self.indentLevel = self.indentLevel + inc
|
||||||
|
|
||||||
# Converts a Euler to three new Quaternions
|
|
||||||
# Angles of Euler are passed in as radians
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def eulerToQuaternions(self, x, y, z):
|
|
||||||
Qx = [math.cos(x/2), math.sin(x/2), 0, 0]
|
|
||||||
Qy = [math.cos(y/2), 0, math.sin(y/2), 0]
|
|
||||||
Qz = [math.cos(z/2), 0, 0, math.sin(z/2)]
|
|
||||||
|
|
||||||
quaternionVec=[Qx,Qy,Qz]
|
|
||||||
return quaternionVec
|
|
||||||
|
|
||||||
# Multiply two Quaternions together to get a new Quaternion
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def multiplyQuaternions(self, Q1, Q2):
|
|
||||||
result = [((Q1[0] * Q2[0]) - (Q1[1] * Q2[1]) - (Q1[2] * Q2[2]) - (Q1[3] * Q2[3])),
|
|
||||||
((Q1[0] * Q2[1]) + (Q1[1] * Q2[0]) + (Q1[2] * Q2[3]) - (Q1[3] * Q2[2])),
|
|
||||||
((Q1[0] * Q2[2]) + (Q1[2] * Q2[0]) + (Q1[3] * Q2[1]) - (Q1[1] * Q2[3])),
|
|
||||||
((Q1[0] * Q2[3]) + (Q1[3] * Q2[0]) + (Q1[1] * Q2[2]) - (Q1[2] * Q2[1]))]
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
# Convert a Quaternion to an Angle Axis (ax, ay, az, angle)
|
|
||||||
# angle is in radians
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def quaternionToAngleAxis(self, Qf):
|
|
||||||
scale = math.pow(Qf[1],2) + math.pow(Qf[2],2) + math.pow(Qf[3],2)
|
|
||||||
ax = Qf[1]
|
|
||||||
ay = Qf[2]
|
|
||||||
az = Qf[3]
|
|
||||||
|
|
||||||
if scale > .0001:
|
|
||||||
ax/=scale
|
|
||||||
ay/=scale
|
|
||||||
az/=scale
|
|
||||||
|
|
||||||
angle = 2 * math.acos(Qf[0])
|
|
||||||
|
|
||||||
result = [ax, ay, az, angle]
|
|
||||||
return result
|
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# Callbacks, needed before Main
|
# Callbacks, needed before Main
|
||||||
##########################################################
|
##########################################################
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ def load(operator, context, filepath, frame_start=0, frame_step=1):
|
|||||||
try:
|
try:
|
||||||
num_keys = len(obj.data.shape_keys.keys)
|
num_keys = len(obj.data.shape_keys.keys)
|
||||||
except:
|
except:
|
||||||
basis = obj.add_shape_key()
|
basis = obj.shape_key_add()
|
||||||
basis.name = "Basis"
|
basis.name = "Basis"
|
||||||
obj.data.update()
|
obj.data.update()
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ def load(operator, context, filepath, frame_start=0, frame_step=1):
|
|||||||
def UpdateMesh(ob, fr):
|
def UpdateMesh(ob, fr):
|
||||||
|
|
||||||
# Insert new shape key
|
# Insert new shape key
|
||||||
new_shapekey = obj.add_shape_key()
|
new_shapekey = obj.shape_key_add()
|
||||||
new_shapekey.name = ("frame_%.4d" % fr)
|
new_shapekey.name = ("frame_%.4d" % fr)
|
||||||
new_shapekey_name = new_shapekey.name
|
new_shapekey_name = new_shapekey.name
|
||||||
|
|
||||||
|
|||||||
@@ -246,10 +246,10 @@ class ShapeTransfer(bpy.types.Operator):
|
|||||||
|
|
||||||
def ob_add_shape(ob, name):
|
def ob_add_shape(ob, name):
|
||||||
me = ob.data
|
me = ob.data
|
||||||
key = ob.add_shape_key(from_mix=False)
|
key = ob.shape_key_add(from_mix=False)
|
||||||
if len(me.shape_keys.keys) == 1:
|
if len(me.shape_keys.keys) == 1:
|
||||||
key.name = "Basis"
|
key.name = "Basis"
|
||||||
key = ob.add_shape_key(from_mix=False) # we need a rest
|
key = ob.shape_key_add(from_mix=False) # we need a rest
|
||||||
key.name = name
|
key.name = name
|
||||||
ob.active_shape_key_index = len(me.shape_keys.keys) - 1
|
ob.active_shape_key_index = len(me.shape_keys.keys) - 1
|
||||||
ob.show_only_shape_key = True
|
ob.show_only_shape_key = True
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
|
||||||
def randomize_selected(seed, loc, rot, scale, scale_even, scale_min):
|
def randomize_selected(seed, delta, loc, rot, scale, scale_even):
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from random import uniform
|
from random import uniform
|
||||||
@@ -35,20 +35,31 @@ def randomize_selected(seed, loc, rot, scale, scale_even, scale_min):
|
|||||||
for obj in bpy.context.selected_objects:
|
for obj in bpy.context.selected_objects:
|
||||||
|
|
||||||
if loc:
|
if loc:
|
||||||
obj.location += rand_vec(loc)
|
if delta:
|
||||||
|
obj.delta_location += rand_vec(loc)
|
||||||
|
else:
|
||||||
|
obj.location += rand_vec(loc)
|
||||||
else: # otherwise the values change under us
|
else: # otherwise the values change under us
|
||||||
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||||
|
|
||||||
if rot: # TODO, non euler's
|
if rot: # TODO, non euler's
|
||||||
vec = rand_vec(rot)
|
vec = rand_vec(rot)
|
||||||
obj.rotation_euler[0] += vec[0]
|
if delta:
|
||||||
obj.rotation_euler[1] += vec[1]
|
obj.delta_rotation_euler[0] += vec[0]
|
||||||
obj.rotation_euler[2] += vec[2]
|
obj.delta_rotation_euler[1] += vec[1]
|
||||||
|
obj.delta_rotation_euler[2] += vec[2]
|
||||||
|
else:
|
||||||
|
obj.rotation_euler[0] += vec[0]
|
||||||
|
obj.rotation_euler[1] += vec[1]
|
||||||
|
obj.rotation_euler[2] += vec[2]
|
||||||
else:
|
else:
|
||||||
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||||
|
|
||||||
if scale:
|
if scale:
|
||||||
org_sca_x, org_sca_y, org_sca_z = obj.scale
|
if delta:
|
||||||
|
org_sca_x, org_sca_y, org_sca_z = obj.delta_scale
|
||||||
|
else:
|
||||||
|
org_sca_x, org_sca_y, org_sca_z = obj.scale
|
||||||
|
|
||||||
if scale_even:
|
if scale_even:
|
||||||
sca_x = sca_y = sca_z = uniform(scale[0], - scale[0])
|
sca_x = sca_y = sca_z = uniform(scale[0], - scale[0])
|
||||||
@@ -56,28 +67,24 @@ def randomize_selected(seed, loc, rot, scale, scale_even, scale_min):
|
|||||||
else:
|
else:
|
||||||
sca_x, sca_y, sca_z = rand_vec(scale)
|
sca_x, sca_y, sca_z = rand_vec(scale)
|
||||||
|
|
||||||
aX = sca_x + org_sca_x
|
if scale_even:
|
||||||
bX = org_sca_x * scale_min
|
aX = -(sca_x * org_sca_x) + org_sca_x
|
||||||
|
aY = -(sca_x * org_sca_y) + org_sca_y
|
||||||
|
aZ = -(sca_x * org_sca_z) + org_sca_z
|
||||||
|
else:
|
||||||
|
aX = sca_x + org_sca_x
|
||||||
|
aY = sca_y + org_sca_y
|
||||||
|
aZ = sca_z + org_sca_z
|
||||||
|
|
||||||
aY = sca_y + org_sca_y
|
if delta:
|
||||||
bY = org_sca_y * scale_min
|
obj.delta_scale = aX, aY, aZ
|
||||||
|
else:
|
||||||
aZ = sca_z + org_sca_z
|
obj.scale = aX, aY, aZ
|
||||||
bZ = org_sca_z * scale_min
|
|
||||||
|
|
||||||
if aX < bX:
|
|
||||||
aX = bX
|
|
||||||
if aY < bY:
|
|
||||||
aY = bY
|
|
||||||
if aZ < bZ:
|
|
||||||
aZ = bZ
|
|
||||||
|
|
||||||
obj.scale = aX, aY, aZ
|
|
||||||
else:
|
else:
|
||||||
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
|
||||||
|
|
||||||
from bpy.props import *
|
|
||||||
|
|
||||||
|
from bpy.props import *
|
||||||
|
|
||||||
class RandomizeLocRotSize(bpy.types.Operator):
|
class RandomizeLocRotSize(bpy.types.Operator):
|
||||||
'''Randomize objects loc/rot/scale'''
|
'''Randomize objects loc/rot/scale'''
|
||||||
@@ -89,8 +96,11 @@ class RandomizeLocRotSize(bpy.types.Operator):
|
|||||||
description="Seed value for the random generator",
|
description="Seed value for the random generator",
|
||||||
default=0, min=0, max=1000)
|
default=0, min=0, max=1000)
|
||||||
|
|
||||||
|
use_delta = BoolProperty(name="Transform Delta",
|
||||||
|
description="Randomize delta transform values instead of regular transform", default=False)
|
||||||
|
|
||||||
use_loc = BoolProperty(name="Randomize Location",
|
use_loc = BoolProperty(name="Randomize Location",
|
||||||
description="Randomize the scale values", default=True)
|
description="Randomize the location values", default=True)
|
||||||
|
|
||||||
loc = FloatVectorProperty(name="Location",
|
loc = FloatVectorProperty(name="Location",
|
||||||
description="Maximun distance the objects can spread over each axis",
|
description="Maximun distance the objects can spread over each axis",
|
||||||
@@ -109,9 +119,9 @@ class RandomizeLocRotSize(bpy.types.Operator):
|
|||||||
scale_even = BoolProperty(name="Scale Even",
|
scale_even = BoolProperty(name="Scale Even",
|
||||||
description="Use the same scale value for all axis", default=False)
|
description="Use the same scale value for all axis", default=False)
|
||||||
|
|
||||||
scale_min = FloatProperty(name="Minimun Scale Factor",
|
'''scale_min = FloatProperty(name="Minimun Scale Factor",
|
||||||
description="Lowest scale percentage possible",
|
description="Lowest scale percentage possible",
|
||||||
default=0.15, min=-1.0, max=1.0, precision=3)
|
default=0.15, min=-1.0, max=1.0, precision=3)'''
|
||||||
|
|
||||||
scale = FloatVectorProperty(name="Scale",
|
scale = FloatVectorProperty(name="Scale",
|
||||||
description="Maximum scale randomization over each axis",
|
description="Maximum scale randomization over each axis",
|
||||||
@@ -119,16 +129,19 @@ class RandomizeLocRotSize(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
from math import radians
|
from math import radians
|
||||||
|
|
||||||
seed = self.random_seed
|
seed = self.random_seed
|
||||||
|
|
||||||
|
delta = self.use_delta
|
||||||
|
|
||||||
loc = None if not self.use_loc else self.loc
|
loc = None if not self.use_loc else self.loc
|
||||||
rot = None if not self.use_rot else self.rot * radians(1.0)
|
rot = None if not self.use_rot else self.rot * radians(1.0)
|
||||||
scale = None if not self.use_scale else self.scale
|
scale = None if not self.use_scale else self.scale
|
||||||
|
|
||||||
scale_even = self.scale_even
|
scale_even = self.scale_even
|
||||||
scale_min = self.scale_min
|
#scale_min = self.scale_min
|
||||||
|
|
||||||
randomize_selected(seed, loc, rot, scale, scale_even, scale_min)
|
randomize_selected(seed, delta, loc, rot, scale, scale_even)
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|||||||
@@ -49,13 +49,17 @@ class AddPresetBase():
|
|||||||
preset_menu_class = getattr(bpy.types, self.preset_menu)
|
preset_menu_class = getattr(bpy.types, self.preset_menu)
|
||||||
|
|
||||||
if not self.remove_active:
|
if not self.remove_active:
|
||||||
|
|
||||||
if not self.name:
|
if not self.name:
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
filename = self.as_filename(self.name)
|
filename = self.as_filename(self.name)
|
||||||
|
|
||||||
target_path = bpy.utils.preset_paths(self.preset_subdir)[0] # we need some way to tell the user and system preset path
|
target_path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", self.preset_subdir), create=True)
|
||||||
|
|
||||||
|
if not target_path:
|
||||||
|
self.report({'WARNING'}, "Failed to create presets path")
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
filepath = os.path.join(target_path, filename) + ".py"
|
filepath = os.path.join(target_path, filename) + ".py"
|
||||||
|
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ class ExportUVLayout(bpy.types.Operator):
|
|||||||
|
|
||||||
def _space_image(self, context):
|
def _space_image(self, context):
|
||||||
space_data = context.space_data
|
space_data = context.space_data
|
||||||
if type(space_data) == bpy.types.SpaceImageEditor:
|
if isinstance(space_data, bpy.types.SpaceImageEditor):
|
||||||
return space_data
|
return space_data
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@@ -365,7 +365,7 @@ class ExportUVLayout(bpy.types.Operator):
|
|||||||
self.size = self._image_size(context)
|
self.size = self._image_size(context)
|
||||||
self.filepath = os.path.splitext(bpy.data.filepath)[0]
|
self.filepath = os.path.splitext(bpy.data.filepath)[0]
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
wm.add_fileselect(self)
|
wm.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
|
|||||||
else:
|
else:
|
||||||
self.initial_x = event.mouse_x
|
self.initial_x = event.mouse_x
|
||||||
|
|
||||||
context.window_manager.add_modal_handler(self)
|
context.window_manager.modal_handler_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
|
||||||
@@ -528,7 +528,7 @@ class WM_OT_path_open(bpy.types.Operator):
|
|||||||
bl_idname = "wm.path_open"
|
bl_idname = "wm.path_open"
|
||||||
bl_label = ""
|
bl_label = ""
|
||||||
|
|
||||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH')
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
|
|||||||
kmi.properties.data_path = 'space_data.pivot_point'
|
kmi.properties.data_path = 'space_data.pivot_point'
|
||||||
kmi.properties.value = 'MEDIAN_POINT'
|
kmi.properties.value = 'MEDIAN_POINT'
|
||||||
kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
|
kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
|
||||||
kmi.properties.data_path = 'space_data.use_pivot_point_align'
|
kmi.properties.data_path = 'space_data.use_pivot_point'
|
||||||
kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS')
|
kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS')
|
||||||
kmi.properties.data_path = 'space_data.show_manipulator'
|
kmi.properties.data_path = 'space_data.show_manipulator'
|
||||||
kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
|
kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
|
||||||
@@ -314,7 +314,7 @@ kmi = km.items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ct
|
|||||||
kmi.properties.sharpness = 135.0
|
kmi.properties.sharpness = 135.0
|
||||||
kmi = km.items.new('mesh.select_similar', 'G', 'PRESS', shift=True)
|
kmi = km.items.new('mesh.select_similar', 'G', 'PRESS', shift=True)
|
||||||
kmi = km.items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
|
kmi = km.items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
|
||||||
kmi.properties.name = 'VIEW3D_MT_edit_mesh_selection_mode'
|
kmi.properties.name = 'VIEW3D_MT_edit_mesh_select_mode'
|
||||||
kmi = km.items.new('mesh.hide', 'H', 'PRESS')
|
kmi = km.items.new('mesh.hide', 'H', 'PRESS')
|
||||||
kmi = km.items.new('mesh.hide', 'H', 'PRESS', shift=True)
|
kmi = km.items.new('mesh.hide', 'H', 'PRESS', shift=True)
|
||||||
kmi.properties.unselected = True
|
kmi.properties.unselected = True
|
||||||
|
|||||||
109
release/scripts/templates/background_job.py
Normal file
109
release/scripts/templates/background_job.py
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# This script is an example of how you can run blender from the command line (in background mode with no interface)
|
||||||
|
# to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it.
|
||||||
|
# This example also shows how you can parse command line options to python scripts.
|
||||||
|
#
|
||||||
|
# Example usage for this test.
|
||||||
|
# blender -b -P $HOME/background_job.py -- --text="Hello World" --render="/tmp/hello" --save="/tmp/hello.blend"
|
||||||
|
#
|
||||||
|
# Notice all python args are after the "--" argument.
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
def example_function(body_text, save_path, render_path):
|
||||||
|
|
||||||
|
scene = bpy.context.scene
|
||||||
|
|
||||||
|
# Clear existing objects.
|
||||||
|
scene.camera = None
|
||||||
|
for obj in scene.objects:
|
||||||
|
scene.objects.unlink(obj)
|
||||||
|
|
||||||
|
txt_data = bpy.data.curves.new(name="MyText", type='FONT')
|
||||||
|
|
||||||
|
# Text Object
|
||||||
|
txt_ob = bpy.data.objects.new(name="MyText", object_data=txt_data)
|
||||||
|
scene.objects.link(txt_ob) # add the data to the scene as an object
|
||||||
|
txt_data.body = body_text # set the body text to the command line arg given
|
||||||
|
txt_data.align = 'CENTER' # center text
|
||||||
|
|
||||||
|
# Camera
|
||||||
|
cam_data = bpy.data.cameras.new("MyCam") # create new camera data
|
||||||
|
cam_ob = bpy.data.objects.new(name="MyCam", object_data=cam_data)
|
||||||
|
scene.objects.link(cam_ob) # add the camera data to the scene (creating a new object)
|
||||||
|
scene.camera = cam_ob # set the active camera
|
||||||
|
cam_ob.location = 0.0, 0.0, 10.0
|
||||||
|
|
||||||
|
# Lamp
|
||||||
|
lamp_data = bpy.data.lamps.new("MyLamp")
|
||||||
|
lamp_ob = bpy.data.objects.new(name="MyCam", object_data=lamp_data)
|
||||||
|
scene.objects.link(lamp_ob)
|
||||||
|
lamp_ob.location = 2.0, 2.0, 5.0
|
||||||
|
|
||||||
|
if save_path:
|
||||||
|
try:
|
||||||
|
f = open(save_path, 'w')
|
||||||
|
f.close()
|
||||||
|
ok = True
|
||||||
|
except:
|
||||||
|
print("Cannot save to path %r" % save_path)
|
||||||
|
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
if ok:
|
||||||
|
bpy.ops.wm.save_as_mainfile(filepath=save_path)
|
||||||
|
|
||||||
|
if render_path:
|
||||||
|
render = scene.render
|
||||||
|
render.use_file_extension = True
|
||||||
|
render.filepath = render_path
|
||||||
|
bpy.ops.render.render(write_still=True)
|
||||||
|
|
||||||
|
|
||||||
|
import sys # to get command line args
|
||||||
|
import optparse # to parse options for us and print a nice help message
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
# get the args passed to blender after "--", all of which are ignored by blender specifically
|
||||||
|
# so python may receive its own arguments
|
||||||
|
argv = sys.argv
|
||||||
|
|
||||||
|
if "--" not in argv:
|
||||||
|
argv = [] # as if no args are passed
|
||||||
|
else:
|
||||||
|
argv = argv[argv.index("--") + 1:] # get all args after "--"
|
||||||
|
|
||||||
|
# When --help or no args are given, print this help
|
||||||
|
usage_text = "Run blender in background mode with this script:"
|
||||||
|
usage_text += " blender -b -P " + __file__ + " -- [options]"
|
||||||
|
|
||||||
|
parser = optparse.OptionParser(usage=usage_text)
|
||||||
|
|
||||||
|
|
||||||
|
# Example background utility, add some text and renders or saves it (with options)
|
||||||
|
# Possible types are: string, int, long, choice, float and complex.
|
||||||
|
parser.add_option("-t", "--text", dest="body_text", help="This text will be used to render an image", type="string")
|
||||||
|
|
||||||
|
parser.add_option("-s", "--save", dest="save_path", help="Save the generated file to the specified path", metavar='FILE')
|
||||||
|
parser.add_option("-r", "--render", dest="render_path", help="Render an image to the specified path", metavar='FILE')
|
||||||
|
|
||||||
|
options, args = parser.parse_args(argv) # In this example we wont use the args
|
||||||
|
|
||||||
|
if not argv:
|
||||||
|
parser.print_help()
|
||||||
|
return
|
||||||
|
|
||||||
|
if not options.body_text:
|
||||||
|
print("Error: --text=\"some string\" argument not given, aborting.")
|
||||||
|
parser.print_help()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Run the example function
|
||||||
|
example_function(options.body_text, options.save_path, options.render_path)
|
||||||
|
|
||||||
|
print("batch job finished, exiting")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -25,7 +25,7 @@ class ModalOperator(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
if context.object:
|
if context.object:
|
||||||
context.window_manager.add_modal_handler(self)
|
context.window_manager.modal_handler_add(self)
|
||||||
self.first_mouse_x = event.mouse_x
|
self.first_mouse_x = event.mouse_x
|
||||||
self.first_value = context.object.location.x
|
self.first_value = context.object.location.x
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class ModalDrawOperator(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
if context.area.type == 'VIEW_3D':
|
if context.area.type == 'VIEW_3D':
|
||||||
context.window_manager.add_modal_handler(self)
|
context.window_manager.modal_handler_add(self)
|
||||||
|
|
||||||
# Add the region OpenGL drawing callback
|
# Add the region OpenGL drawing callback
|
||||||
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ViewOperator(bpy.types.Operator):
|
|||||||
v3d = context.space_data
|
v3d = context.space_data
|
||||||
rv3d = v3d.region_3d
|
rv3d = v3d.region_3d
|
||||||
|
|
||||||
context.window_manager.add_modal_handler(self)
|
context.window_manager.modal_handler_add(self)
|
||||||
|
|
||||||
if rv3d.view_perspective == 'CAMERA':
|
if rv3d.view_perspective == 'CAMERA':
|
||||||
rv3d.view_perspective = 'PERSP'
|
rv3d.view_perspective = 'PERSP'
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(arm, "show_group_colors", text="Colors")
|
col.prop(arm, "show_group_colors", text="Colors")
|
||||||
col.prop(ob, "show_x_ray", text="X-Ray")
|
if ob:
|
||||||
|
col.prop(ob, "show_x_ray", text="X-Ray")
|
||||||
col.prop(arm, "use_deform_delay", text="Delay Refresh")
|
col.prop(arm, "use_deform_delay", text="Delay Refresh")
|
||||||
|
|
||||||
|
|
||||||
@@ -287,6 +288,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # in
|
|||||||
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
_property_type = bpy.types.Armature
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -50,13 +50,21 @@ class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
|
|||||||
class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
|
class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
|
||||||
bl_label = "Transform"
|
bl_label = "Transform"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
if context.edit_bone:
|
||||||
|
return True
|
||||||
|
|
||||||
|
ob = context.object
|
||||||
|
return ob and ob.mode == 'POSE' and context.bone
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
ob = context.object
|
ob = context.object
|
||||||
bone = context.bone
|
bone = context.bone
|
||||||
|
|
||||||
if bone:
|
if bone and ob:
|
||||||
pchan = ob.pose.bones[bone.name]
|
pchan = ob.pose.bones[bone.name]
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
@@ -79,7 +87,7 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
layout.prop(pchan, "rotation_mode")
|
layout.prop(pchan, "rotation_mode")
|
||||||
|
|
||||||
else:
|
elif context.edit_bone:
|
||||||
bone = context.edit_bone
|
bone = context.edit_bone
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.column().prop(bone, "head")
|
row.column().prop(bone, "head")
|
||||||
@@ -99,7 +107,8 @@ class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.bone
|
ob = context.object
|
||||||
|
return ob and ob.mode == 'POSE' and context.bone
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
@@ -134,12 +143,12 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
|
|||||||
ob = context.object
|
ob = context.object
|
||||||
bone = context.bone
|
bone = context.bone
|
||||||
arm = context.armature
|
arm = context.armature
|
||||||
|
pchan = None
|
||||||
|
|
||||||
if bone:
|
if ob and bone:
|
||||||
pchan = ob.pose.bones[bone.name]
|
pchan = ob.pose.bones[bone.name]
|
||||||
else:
|
elif bone is None:
|
||||||
bone = context.edit_bone
|
bone = context.edit_bone
|
||||||
pchan = None
|
|
||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
@@ -184,12 +193,12 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
ob = context.object
|
ob = context.object
|
||||||
bone = context.bone
|
bone = context.bone
|
||||||
|
pchan = None
|
||||||
|
|
||||||
if bone:
|
if ob and bone:
|
||||||
pchan = ob.pose.bones[bone.name]
|
pchan = ob.pose.bones[bone.name]
|
||||||
else:
|
elif bone is None:
|
||||||
bone = context.edit_bone
|
bone = context.edit_bone
|
||||||
pchan = None
|
|
||||||
|
|
||||||
if bone:
|
if bone:
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
@@ -213,14 +222,15 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.active_pose_bone
|
ob = context.object
|
||||||
|
return ob and ob.mode == 'POSE' and context.bone
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
pchan = context.active_pose_bone
|
ob = context.object
|
||||||
# incase pose bone context is pinned don't use 'context.object'
|
bone = context.bone
|
||||||
ob = pchan.id_data
|
pchan = ob.pose.bones[bone.name]
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(ob.pose, "ik_solver")
|
row.prop(ob.pose, "ik_solver")
|
||||||
@@ -348,6 +358,7 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
|
_property_type = bpy.types.Bone, bpy.types.EditBone, bpy.types.PoseBone
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _context_path(self):
|
def _context_path(self):
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
|
|||||||
class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
_property_type = bpy.types.Camera
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -270,7 +270,18 @@ class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel):
|
|||||||
text = context.curve
|
text = context.curve
|
||||||
char = context.curve.edit_format
|
char = context.curve.edit_format
|
||||||
|
|
||||||
layout.template_ID(text, "font", open="font.open", unlink="font.unlink")
|
row = layout.split(percentage=0.25)
|
||||||
|
row.label(text="Regular")
|
||||||
|
row.template_ID(text, "font", open="font.open", unlink="font.unlink")
|
||||||
|
row = layout.split(percentage=0.25)
|
||||||
|
row.label(text="Bold")
|
||||||
|
row.template_ID(text, "font_bold", open="font.open", unlink="font.unlink")
|
||||||
|
row = layout.split(percentage=0.25)
|
||||||
|
row.label(text="Italic")
|
||||||
|
row.template_ID(text, "font_italic", open="font.open", unlink="font.unlink")
|
||||||
|
row = layout.split(percentage=0.25)
|
||||||
|
row.label(text="Bold & Italic")
|
||||||
|
row.template_ID(text, "font_bold_italic", open="font.open", unlink="font.unlink")
|
||||||
|
|
||||||
#layout.prop(text, "font")
|
#layout.prop(text, "font")
|
||||||
|
|
||||||
@@ -385,6 +396,7 @@ class DATA_PT_textboxes(CurveButtonsPanel, bpy.types.Panel):
|
|||||||
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
_property_type = bpy.types.Curve
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -390,6 +390,7 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
|
|||||||
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
_property_type = bpy.types.Lamp
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
|
|||||||
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
_property_type = bpy.types.Lattice
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
col = split.column()
|
col = split.column()
|
||||||
|
|
||||||
col.prop(tf, "use_image")
|
col.prop(tf, "use_image")
|
||||||
col.prop(tf, "use_light")
|
col.prop(tf, "use_light")
|
||||||
col.prop(tf, "hide")
|
col.prop(tf, "hide")
|
||||||
@@ -352,6 +352,7 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
|
|||||||
class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
_property_type = bpy.types.Mesh
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
|
|||||||
class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
_property_type = bpy.types.MetaBall
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
mat = active_node_mat(context.material)
|
mat = active_node_mat(context.material)
|
||||||
engine = context.scene.render.engine
|
engine = context.scene.render.engine
|
||||||
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
|
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
@@ -294,9 +294,6 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
|
|||||||
sub.prop(mat, "use_tangent_shading")
|
sub.prop(mat, "use_tangent_shading")
|
||||||
sub.prop(mat, "use_cubic")
|
sub.prop(mat, "use_cubic")
|
||||||
|
|
||||||
elif mat.type == 'HALO':
|
|
||||||
layout.prop(mat, "alpha")
|
|
||||||
|
|
||||||
|
|
||||||
class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
|
class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
|
||||||
bl_label = "Transparency"
|
bl_label = "Transparency"
|
||||||
@@ -486,14 +483,30 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
|
|||||||
mat = context.material # dont use node material
|
mat = context.material # dont use node material
|
||||||
halo = mat.halo
|
halo = mat.halo
|
||||||
|
|
||||||
|
def number_but(layout, toggle, number, name, color):
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(halo, toggle, text="")
|
||||||
|
sub = row.column()
|
||||||
|
sub.active = getattr(halo, toggle)
|
||||||
|
sub.prop(halo, number, text=name)
|
||||||
|
if not color == "":
|
||||||
|
sub.prop(mat, color, text="")
|
||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
|
col.prop(mat, "alpha")
|
||||||
col.prop(mat, "diffuse_color", text="")
|
col.prop(mat, "diffuse_color", text="")
|
||||||
|
|
||||||
|
col = split.column()
|
||||||
col.prop(halo, "size")
|
col.prop(halo, "size")
|
||||||
col.prop(halo, "hardness")
|
col.prop(halo, "hardness")
|
||||||
col.prop(halo, "add")
|
col.prop(halo, "add")
|
||||||
col.label(text="Options:")
|
|
||||||
|
layout.label(text="Options:")
|
||||||
|
|
||||||
|
split = layout.split()
|
||||||
|
col = split.column()
|
||||||
col.prop(halo, "use_texture")
|
col.prop(halo, "use_texture")
|
||||||
col.prop(halo, "use_vertex_normal")
|
col.prop(halo, "use_vertex_normal")
|
||||||
col.prop(halo, "use_extreme_alpha")
|
col.prop(halo, "use_extreme_alpha")
|
||||||
@@ -501,22 +514,9 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
|
|||||||
col.prop(halo, "use_soft")
|
col.prop(halo, "use_soft")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(halo, "use_ring")
|
number_but(col, "use_ring", "ring_count", "Rings", "mirror_color")
|
||||||
sub = col.column()
|
number_but(col, "use_lines", "line_count", "Lines", "specular_color")
|
||||||
sub.active = halo.use_ring
|
number_but(col, "use_star", "star_tip_count", "Star tips", "")
|
||||||
sub.prop(halo, "ring_count")
|
|
||||||
sub.prop(mat, "mirror_color", text="")
|
|
||||||
col.separator()
|
|
||||||
col.prop(halo, "use_lines")
|
|
||||||
sub = col.column()
|
|
||||||
sub.active = halo.use_lines
|
|
||||||
sub.prop(halo, "line_count", text="Lines")
|
|
||||||
sub.prop(mat, "specular_color", text="")
|
|
||||||
col.separator()
|
|
||||||
col.prop(halo, "use_star")
|
|
||||||
sub = col.column()
|
|
||||||
sub.active = halo.use_star
|
|
||||||
sub.prop(halo, "star_tip_count")
|
|
||||||
|
|
||||||
|
|
||||||
class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
|
class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
|
||||||
@@ -892,6 +892,7 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
|
|||||||
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "material"
|
_context_path = "material"
|
||||||
|
_property_type = bpy.types.Material
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel):
|
|||||||
#row.column().prop(pchan, "delta_rotation_angle", text="Angle")
|
#row.column().prop(pchan, "delta_rotation_angle", text="Angle")
|
||||||
#row.column().prop(pchan, "delta_rotation_axis", text="Axis")
|
#row.column().prop(pchan, "delta_rotation_axis", text="Axis")
|
||||||
#row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation")
|
#row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation")
|
||||||
row.column().label(ob, text="Not for Axis-Angle")
|
row.column().label(text="Not for Axis-Angle")
|
||||||
else:
|
else:
|
||||||
row.column().prop(ob, "delta_rotation_euler", text="Rotation")
|
row.column().prop(ob, "delta_rotation_euler", text="Rotation")
|
||||||
|
|
||||||
@@ -335,9 +335,10 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): #
|
|||||||
self.draw_settings(context, ob.animation_visualisation)
|
self.draw_settings(context, ob.animation_visualisation)
|
||||||
|
|
||||||
|
|
||||||
class OBJECT_PT_custom_props(bpy.types.Panel, PropertyPanel, ObjectButtonsPanel):
|
class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "object"
|
_context_path = "object"
|
||||||
|
_property_type = bpy.types.Object
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -125,7 +125,9 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
|
|||||||
if psys.is_edited:
|
if psys.is_edited:
|
||||||
split.operator("particle.edited_clear", text="Free Edit")
|
split.operator("particle.edited_clear", text="Free Edit")
|
||||||
else:
|
else:
|
||||||
split.label(text="")
|
row = split.row()
|
||||||
|
row.enabled = particle_panel_enabled(context, psys)
|
||||||
|
row.prop(part, "regrow_hair")
|
||||||
row = split.row()
|
row = split.row()
|
||||||
row.enabled = particle_panel_enabled(context, psys)
|
row.enabled = particle_panel_enabled(context, psys)
|
||||||
row.prop(part, "hair_step")
|
row.prop(part, "hair_step")
|
||||||
@@ -234,7 +236,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
|
|||||||
#part = psys.settings
|
#part = psys.settings
|
||||||
cloth = psys.cloth.settings
|
cloth = psys.cloth.settings
|
||||||
|
|
||||||
layout.enabled = psys.use_hair_dynamics
|
layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked == False
|
||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
@@ -274,12 +276,12 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
|
|||||||
phystype = psys.settings.physics_type
|
phystype = psys.settings.physics_type
|
||||||
if phystype == 'NO' or phystype == 'KEYED':
|
if phystype == 'NO' or phystype == 'KEYED':
|
||||||
return False
|
return False
|
||||||
return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.use_hair_dynamics)) and engine in cls.COMPAT_ENGINES
|
return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked))) and engine in cls.COMPAT_ENGINES
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
psys = context.particle_system
|
psys = context.particle_system
|
||||||
|
|
||||||
point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if psys.use_hair_dynamics else 'PSYS')
|
point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS')
|
||||||
|
|
||||||
|
|
||||||
class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
|
class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
|
||||||
@@ -1091,6 +1093,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
|
|||||||
class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||||
_context_path = "particle_system.settings"
|
_context_path = "particle_system.settings"
|
||||||
|
_property_type = bpy.types.ParticleSettings
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -819,6 +819,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
|
|||||||
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
|
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
|
||||||
row.operator("render.preset_add", text="", icon="ZOOMIN")
|
row.operator("render.preset_add", text="", icon="ZOOMIN")
|
||||||
row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True
|
row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
@@ -846,8 +847,6 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
|
|||||||
sub.prop(scene, "frame_step", text="Step")
|
sub.prop(scene, "frame_step", text="Step")
|
||||||
|
|
||||||
sub.label(text="Frame Rate:")
|
sub.label(text="Frame Rate:")
|
||||||
|
|
||||||
sub = col.column(align=True)
|
|
||||||
sub.prop(rd, "fps")
|
sub.prop(rd, "fps")
|
||||||
sub.prop(rd, "fps_base", text="/")
|
sub.prop(rd, "fps_base", text="/")
|
||||||
subrow = sub.row(align=True)
|
subrow = sub.row(align=True)
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
|
|||||||
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "scene"
|
_context_path = "scene"
|
||||||
|
_property_type = bpy.types.Scene
|
||||||
|
|
||||||
|
|
||||||
from bpy.props import *
|
from bpy.props import *
|
||||||
@@ -305,7 +306,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
wm.add_fileselect(self)
|
wm.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,11 +94,16 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
|
|||||||
space = context.space_data
|
space = context.space_data
|
||||||
tex = context.texture
|
tex = context.texture
|
||||||
idblock = context_tex_datablock(context)
|
idblock = context_tex_datablock(context)
|
||||||
tex_collection = space.pin_id is None and type(idblock) != bpy.types.Brush and not node
|
pin_id = space.pin_id
|
||||||
|
|
||||||
|
if not isinstance(pin_id, bpy.types.Material):
|
||||||
|
pin_id = None
|
||||||
|
|
||||||
|
tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, bpy.types.Brush))
|
||||||
|
|
||||||
if tex_collection:
|
if tex_collection:
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
|
row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
|
||||||
|
|
||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
@@ -116,7 +121,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
|
|||||||
elif idblock:
|
elif idblock:
|
||||||
col.template_ID(idblock, "texture", new="texture.new")
|
col.template_ID(idblock, "texture", new="texture.new")
|
||||||
|
|
||||||
if space.pin_id:
|
if pin_id:
|
||||||
col.template_ID(space, "pin_id")
|
col.template_ID(space, "pin_id")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
@@ -542,12 +547,14 @@ class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
|
|||||||
col.prop(tex, "lacunarity")
|
col.prop(tex, "lacunarity")
|
||||||
col.prop(tex, "octaves")
|
col.prop(tex, "octaves")
|
||||||
|
|
||||||
|
musgrave_type = tex.musgrave_type
|
||||||
col = split.column()
|
col = split.column()
|
||||||
if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
|
if musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'):
|
||||||
col.prop(tex, "offset")
|
col.prop(tex, "offset")
|
||||||
if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
|
if musgrave_type in ('MULTIFRACTAL', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'):
|
||||||
col.prop(tex, "gain")
|
|
||||||
col.prop(tex, "noise_intensity", text="Intensity")
|
col.prop(tex, "noise_intensity", text="Intensity")
|
||||||
|
if musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'):
|
||||||
|
col.prop(tex, "gain")
|
||||||
|
|
||||||
layout.label(text="Noise:")
|
layout.label(text="Noise:")
|
||||||
|
|
||||||
@@ -769,7 +776,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
idblock = context_tex_datablock(context)
|
idblock = context_tex_datablock(context)
|
||||||
if type(idblock) == bpy.types.Brush and not context.sculpt_object:
|
if isinstance(idblock, bpy.types.Brush) and not context.sculpt_object:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not getattr(context, "texture_slot", None):
|
if not getattr(context, "texture_slot", None):
|
||||||
@@ -786,7 +793,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
|
|||||||
tex = context.texture_slot
|
tex = context.texture_slot
|
||||||
# textype = context.texture
|
# textype = context.texture
|
||||||
|
|
||||||
if type(idblock) != bpy.types.Brush:
|
if not isinstance(idblock, bpy.types.Brush):
|
||||||
split = layout.split(percentage=0.3)
|
split = layout.split(percentage=0.3)
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.label(text="Coordinates:")
|
col.label(text="Coordinates:")
|
||||||
@@ -815,7 +822,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
|
|||||||
split.label(text="Object:")
|
split.label(text="Object:")
|
||||||
split.prop(tex, "object", text="")
|
split.prop(tex, "object", text="")
|
||||||
|
|
||||||
if type(idblock) == bpy.types.Brush:
|
if isinstance(idblock, bpy.types.Brush):
|
||||||
if context.sculpt_object:
|
if context.sculpt_object:
|
||||||
layout.label(text="Brush Mapping:")
|
layout.label(text="Brush Mapping:")
|
||||||
layout.prop(tex, "map_mode", expand=True)
|
layout.prop(tex, "map_mode", expand=True)
|
||||||
@@ -824,7 +831,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
|
|||||||
row.active = tex.map_mode in ('FIXED', 'TILED')
|
row.active = tex.map_mode in ('FIXED', 'TILED')
|
||||||
row.prop(tex, "angle")
|
row.prop(tex, "angle")
|
||||||
else:
|
else:
|
||||||
if type(idblock) == bpy.types.Material:
|
if isinstance(idblock, bpy.types.Material):
|
||||||
split = layout.split(percentage=0.3)
|
split = layout.split(percentage=0.3)
|
||||||
split.label(text="Projection:")
|
split.label(text="Projection:")
|
||||||
split.prop(tex, "mapping", text="")
|
split.prop(tex, "mapping", text="")
|
||||||
@@ -862,7 +869,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
idblock = context_tex_datablock(context)
|
idblock = context_tex_datablock(context)
|
||||||
if type(idblock) == bpy.types.Brush:
|
if isinstance(idblock, bpy.types.Brush):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not getattr(context, "texture_slot", None):
|
if not getattr(context, "texture_slot", None):
|
||||||
@@ -880,79 +887,96 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
|||||||
# textype = context.texture
|
# textype = context.texture
|
||||||
tex = context.texture_slot
|
tex = context.texture_slot
|
||||||
|
|
||||||
def factor_but(layout, active, toggle, factor, name):
|
def factor_but(layout, toggle, factor, name):
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(tex, toggle, text="")
|
row.prop(tex, toggle, text="")
|
||||||
sub = row.row()
|
sub = row.row()
|
||||||
sub.active = active
|
sub.active = getattr(tex, toggle)
|
||||||
sub.prop(tex, factor, text=name, slider=True)
|
sub.prop(tex, factor, text=name, slider=True)
|
||||||
|
return sub # XXX, temp. use_map_normal needs to override.
|
||||||
|
|
||||||
if type(idblock) == bpy.types.Material:
|
if isinstance(idblock, bpy.types.Material):
|
||||||
if idblock.type in ('SURFACE', 'HALO', 'WIRE'):
|
if idblock.type in ('SURFACE', 'WIRE'):
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.label(text="Diffuse:")
|
col.label(text="Diffuse:")
|
||||||
factor_but(col, tex.use_map_diffuse, "use_map_diffuse", "diffuse_factor", "Intensity")
|
factor_but(col, "use_map_diffuse", "diffuse_factor", "Intensity")
|
||||||
factor_but(col, tex.use_map_color_diffuse, "use_map_color_diffuse", "diffuse_color_factor", "Color")
|
factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
|
||||||
factor_but(col, tex.use_map_alpha, "use_map_alpha", "alpha_factor", "Alpha")
|
factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
|
||||||
factor_but(col, tex.use_map_translucency, "use_map_translucency", "translucency_factor", "Translucency")
|
factor_but(col, "use_map_translucency", "translucency_factor", "Translucency")
|
||||||
|
|
||||||
col.label(text="Specular:")
|
col.label(text="Specular:")
|
||||||
factor_but(col, tex.use_map_specular, "use_map_specular", "specular_factor", "Intensity")
|
factor_but(col, "use_map_specular", "specular_factor", "Intensity")
|
||||||
factor_but(col, tex.use_map_color_spec, "use_map_color_spec", "specular_color_factor", "Color")
|
factor_but(col, "use_map_color_spec", "specular_color_factor", "Color")
|
||||||
factor_but(col, tex.use_map_hardness, "use_map_hardness", "hardness_factor", "Hardness")
|
factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.label(text="Shading:")
|
col.label(text="Shading:")
|
||||||
factor_but(col, tex.use_map_ambient, "use_map_ambient", "ambient_factor", "Ambient")
|
factor_but(col, "use_map_ambient", "ambient_factor", "Ambient")
|
||||||
factor_but(col, tex.use_map_emit, "use_map_emit", "emit_factor", "Emit")
|
factor_but(col, "use_map_emit", "emit_factor", "Emit")
|
||||||
factor_but(col, tex.use_map_mirror, "use_map_mirror", "mirror_factor", "Mirror")
|
factor_but(col, "use_map_mirror", "mirror_factor", "Mirror")
|
||||||
factor_but(col, tex.use_map_raymir, "use_map_raymir", "raymir_factor", "Ray Mirror")
|
factor_but(col, "use_map_raymir", "raymir_factor", "Ray Mirror")
|
||||||
|
|
||||||
col.label(text="Geometry:")
|
col.label(text="Geometry:")
|
||||||
# XXX replace 'or' when displacement is fixed to not rely on normal influence value.
|
# XXX replace 'or' when displacement is fixed to not rely on normal influence value.
|
||||||
factor_but(col, (tex.use_map_normal or tex.use_map_displacement), "use_map_normal", "normal_factor", "Normal")
|
sub_tmp = factor_but(col, "use_map_normal", "normal_factor", "Normal")
|
||||||
factor_but(col, tex.use_map_warp, "use_map_warp", "warp_factor", "Warp")
|
sub_tmp.active = (tex.use_map_normal or tex.use_map_displacement)
|
||||||
factor_but(col, tex.use_map_displacement, "use_map_displacement", "displacement_factor", "Displace")
|
# END XXX
|
||||||
|
|
||||||
|
factor_but(col, "use_map_warp", "warp_factor", "Warp")
|
||||||
|
factor_but(col, "use_map_displacement", "displacement_factor", "Displace")
|
||||||
|
|
||||||
#sub = col.column()
|
#sub = col.column()
|
||||||
#sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
|
#sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
|
||||||
#sub.prop(tex, "default_value", text="Amount", slider=True)
|
#sub.prop(tex, "default_value", text="Amount", slider=True)
|
||||||
|
elif idblock.type == 'HALO':
|
||||||
|
layout.label(text="Halo:")
|
||||||
|
|
||||||
|
split = layout.split()
|
||||||
|
|
||||||
|
col = split.column()
|
||||||
|
factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
|
||||||
|
factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
|
||||||
|
|
||||||
|
col = split.column()
|
||||||
|
factor_but(col, "use_map_raymir", "raymir_factor", "Size")
|
||||||
|
factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
|
||||||
|
factor_but(col, "use_map_translucency", "translucency_factor", "Add")
|
||||||
elif idblock.type == 'VOLUME':
|
elif idblock.type == 'VOLUME':
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
factor_but(col, tex.use_map_density, "use_map_density", "density_factor", "Density")
|
factor_but(col, "use_map_density", "density_factor", "Density")
|
||||||
factor_but(col, tex.use_map_emission, "use_map_emission", "emission_factor", "Emission")
|
factor_but(col, "use_map_emission", "emission_factor", "Emission")
|
||||||
factor_but(col, tex.use_map_scatter, "use_map_scatter", "scattering_factor", "Scattering")
|
factor_but(col, "use_map_scatter", "scattering_factor", "Scattering")
|
||||||
factor_but(col, tex.use_map_reflect, "use_map_reflect", "reflection_factor", "Reflection")
|
factor_but(col, "use_map_reflect", "reflection_factor", "Reflection")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.label(text=" ")
|
col.label(text=" ")
|
||||||
factor_but(col, tex.use_map_color_emission, "use_map_color_emission", "emission_color_factor", "Emission Color")
|
factor_but(col, "use_map_color_emission", "emission_color_factor", "Emission Color")
|
||||||
factor_but(col, tex.use_map_color_transmission, "use_map_color_transmission", "transmission_color_factor", "Transmission Color")
|
factor_but(col, "use_map_color_transmission", "transmission_color_factor", "Transmission Color")
|
||||||
factor_but(col, tex.use_map_color_reflection, "use_map_color_reflection", "reflection_color_factor", "Reflection Color")
|
factor_but(col, "use_map_color_reflection", "reflection_color_factor", "Reflection Color")
|
||||||
|
|
||||||
elif type(idblock) == bpy.types.Lamp:
|
elif isinstance(idblock, bpy.types.Lamp):
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
factor_but(col, tex.use_map_color, "map_color", "color_factor", "Color")
|
factor_but(col, "use_map_color", "color_factor", "Color")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
factor_but(col, tex.use_map_shadow, "map_shadow", "shadow_factor", "Shadow")
|
factor_but(col, "use_map_shadow", "shadow_factor", "Shadow")
|
||||||
|
|
||||||
elif type(idblock) == bpy.types.World:
|
elif isinstance(idblock, bpy.types.World):
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
factor_but(col, tex.use_map_blend, "use_map_blend", "blend_factor", "Blend")
|
factor_but(col, "use_map_blend", "blend_factor", "Blend")
|
||||||
factor_but(col, tex.use_map_horizon, "use_map_horizon", "horizon_factor", "Horizon")
|
factor_but(col, "use_map_horizon", "horizon_factor", "Horizon")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
factor_but(col, tex.use_map_zenith_up, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
|
factor_but(col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
|
||||||
factor_but(col, tex.use_map_zenith_down, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")
|
factor_but(col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@@ -961,21 +985,25 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
|||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(tex, "blend_type", text="Blend")
|
col.prop(tex, "blend_type", text="Blend")
|
||||||
col.prop(tex, "use_rgb_to_intensity")
|
col.prop(tex, "use_rgb_to_intensity")
|
||||||
sub = col.column()
|
# color is used on grayscale textures even when use_rgb_to_intensity is disabled.
|
||||||
sub.active = tex.use_rgb_to_intensity
|
col.prop(tex, "color", text="")
|
||||||
sub.prop(tex, "color", text="")
|
|
||||||
|
if isinstance(idblock, bpy.types.Material):
|
||||||
|
# XXX, dont remove since old files have this users need to be able to disable!
|
||||||
|
col.prop(tex, "use_old_bump", text="Old Bump Mapping")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(tex, "invert", text="Negative")
|
col.prop(tex, "invert", text="Negative")
|
||||||
col.prop(tex, "use_stencil")
|
col.prop(tex, "use_stencil")
|
||||||
|
|
||||||
if type(idblock) in (bpy.types.Material, bpy.types.World):
|
if isinstance(idblock, bpy.types.Material) or isinstance(idblock, bpy.types.World):
|
||||||
col.prop(tex, "default_value", text="DVar", slider=True)
|
col.prop(tex, "default_value", text="DVar", slider=True)
|
||||||
|
|
||||||
|
|
||||||
class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "texture"
|
_context_path = "texture"
|
||||||
|
_property_type = bpy.types.Texture
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
|
|||||||
class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
|
class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
_context_path = "world"
|
_context_path = "world"
|
||||||
|
_property_type = bpy.types.World
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ class GRAPH_MT_channel(bpy.types.Menu):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("anim.channels_editable_toggle")
|
layout.operator("anim.channels_editable_toggle")
|
||||||
layout.operator("anim.channels_visibility_set")
|
layout.operator("anim.channels_visibility_set")
|
||||||
|
layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("anim.channels_expand")
|
layout.operator("anim.channels_expand")
|
||||||
@@ -187,8 +188,7 @@ class GRAPH_MT_key(bpy.types.Menu):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
|
layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
|
||||||
layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
|
layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
|
||||||
layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode")
|
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("graph.clean")
|
layout.operator("graph.clean")
|
||||||
layout.operator("graph.sample")
|
layout.operator("graph.sample")
|
||||||
|
|||||||
@@ -250,18 +250,6 @@ class INFO_MT_surface_add(bpy.types.Menu):
|
|||||||
layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
|
layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
|
||||||
layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
|
layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
|
||||||
|
|
||||||
class INFO_MT_curve_handle_type_set(bpy.types.Menu):
|
|
||||||
bl_idname = "INFO_MT_curve_handle_type_set"
|
|
||||||
bl_label = "Handle Type"
|
|
||||||
|
|
||||||
def draw(self, context):
|
|
||||||
layout = self.layout
|
|
||||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
|
||||||
layout.operator("curve.handle_type_set", text="Automatic").type = "AUTOMATIC"
|
|
||||||
layout.operator("curve.handle_type_set", text="Vector").type = "VECTOR"
|
|
||||||
layout.operator("curve.handle_type_set", text="Align").type = "ALIGN"
|
|
||||||
layout.operator("curve.handle_type_set", text="Free Align").type = "FREE_ALIGN"
|
|
||||||
|
|
||||||
|
|
||||||
class INFO_MT_armature_add(bpy.types.Menu):
|
class INFO_MT_armature_add(bpy.types.Menu):
|
||||||
bl_idname = "INFO_MT_armature_add"
|
bl_idname = "INFO_MT_armature_add"
|
||||||
@@ -360,6 +348,8 @@ class INFO_MT_help(bpy.types.Menu):
|
|||||||
bl_label = "Help"
|
bl_label = "Help"
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
import sys
|
||||||
|
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
layout.operator("wm.url_open", text="Manual", icon='HELP').url = 'http://wiki.blender.org/index.php/Doc:Manual'
|
layout.operator("wm.url_open", text="Manual", icon='HELP').url = 'http://wiki.blender.org/index.php/Doc:Manual'
|
||||||
@@ -378,7 +368,7 @@ class INFO_MT_help(bpy.types.Menu):
|
|||||||
layout.operator("help.operator_cheat_sheet", icon='TEXT')
|
layout.operator("help.operator_cheat_sheet", icon='TEXT')
|
||||||
layout.operator("wm.sysinfo", icon='TEXT')
|
layout.operator("wm.sysinfo", icon='TEXT')
|
||||||
layout.separator()
|
layout.separator()
|
||||||
if bpy.app.build_platform[0:7] == 'Windows':
|
if sys.platform == "win32":
|
||||||
layout.operator("wm.toggle_console", icon='CONSOLE')
|
layout.operator("wm.toggle_console", icon='CONSOLE')
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
|
layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
|
||||||
|
|||||||
@@ -330,8 +330,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
|
|||||||
row.separator()
|
row.separator()
|
||||||
|
|
||||||
col = row.column()
|
col = row.column()
|
||||||
row = col.row(align=True)
|
col.prop(edit, "sculpt_paint_overlay_color", text="Sculpt Overlay Color")
|
||||||
row.prop(edit, "sculpt_paint_overlay_color", text="Sculpt Overlay Color")
|
|
||||||
|
|
||||||
col.separator()
|
col.separator()
|
||||||
col.separator()
|
col.separator()
|
||||||
@@ -712,10 +711,10 @@ class USERPREF_PT_file(bpy.types.Panel):
|
|||||||
col.separator()
|
col.separator()
|
||||||
col.separator()
|
col.separator()
|
||||||
|
|
||||||
col.label(text="Auto Save:")
|
|
||||||
col.prop(paths, "save_version")
|
col.prop(paths, "save_version")
|
||||||
col.prop(paths, "recent_files")
|
col.prop(paths, "recent_files")
|
||||||
col.prop(paths, "use_save_preview_images")
|
col.prop(paths, "use_save_preview_images")
|
||||||
|
col.label(text="Auto Save:")
|
||||||
col.prop(paths, "use_auto_save_temporary_files")
|
col.prop(paths, "use_auto_save_temporary_files")
|
||||||
sub = col.column()
|
sub = col.column()
|
||||||
sub.active = paths.use_auto_save_temporary_files
|
sub.active = paths.use_auto_save_temporary_files
|
||||||
@@ -1141,23 +1140,12 @@ class WM_OT_addon_install(bpy.types.Operator):
|
|||||||
pyfile = self.filepath
|
pyfile = self.filepath
|
||||||
|
|
||||||
# dont use bpy.utils.script_paths("addons") because we may not be able to write to it.
|
# dont use bpy.utils.script_paths("addons") because we may not be able to write to it.
|
||||||
path_addons = bpy.utils.user_resource('SCRIPTS', 'addons')
|
path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True)
|
||||||
|
|
||||||
# should never happen.
|
|
||||||
if not path_addons:
|
if not path_addons:
|
||||||
self.report({'WARNING'}, "Failed to get addons path\n")
|
self.report({'WARNING'}, "Failed to get addons path\n")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
# create path if not existing.
|
|
||||||
if not os.path.exists(path_addons):
|
|
||||||
try:
|
|
||||||
os.makedirs(path_addons)
|
|
||||||
except:
|
|
||||||
self.report({'WARNING'}, "Failed to create %r\n" % path_addons)
|
|
||||||
|
|
||||||
traceback.print_exc()
|
|
||||||
return {'CANCELLED'}
|
|
||||||
|
|
||||||
contents = set(os.listdir(path_addons))
|
contents = set(os.listdir(path_addons))
|
||||||
|
|
||||||
#check to see if the file is in compressed format (.zip)
|
#check to see if the file is in compressed format (.zip)
|
||||||
@@ -1210,7 +1198,7 @@ class WM_OT_addon_install(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
wm.add_fileselect(self)
|
wm.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ class InputKeyMapPanel(bpy.types.Panel):
|
|||||||
else:
|
else:
|
||||||
row.label()
|
row.label()
|
||||||
|
|
||||||
if kmi.id:
|
if not kmi.is_user_defined:
|
||||||
op = row.operator("wm.keyitem_restore", text="", icon='BACK')
|
op = row.operator("wm.keyitem_restore", text="", icon='BACK')
|
||||||
op.item_id = kmi.id
|
op.item_id = kmi.id
|
||||||
op = row.operator("wm.keyitem_remove", text="", icon='X')
|
op = row.operator("wm.keyitem_remove", text="", icon='X')
|
||||||
@@ -575,7 +575,7 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
wm.add_fileselect(self)
|
wm.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
# This operator is also used by interaction presets saving - AddPresetBase
|
# This operator is also used by interaction presets saving - AddPresetBase
|
||||||
@@ -665,7 +665,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
wm.add_fileselect(self)
|
wm.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
|
||||||
@@ -708,12 +708,18 @@ class WM_OT_keyitem_restore(bpy.types.Operator):
|
|||||||
|
|
||||||
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
|
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
km = context.keymap
|
||||||
|
return km.is_user_defined
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
km = context.keymap
|
km = context.keymap
|
||||||
kmi = km.items.from_id(self.item_id)
|
kmi = km.items.from_id(self.item_id)
|
||||||
|
|
||||||
km.restore_item_to_default(kmi)
|
if not kmi.is_user_defined:
|
||||||
|
km.restore_item_to_default(kmi)
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
@@ -749,8 +755,12 @@ class WM_OT_keyitem_remove(bpy.types.Operator):
|
|||||||
|
|
||||||
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
|
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
km = context.keymap
|
||||||
|
return km.is_user_defined
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
wm = context.window_manager
|
|
||||||
km = context.keymap
|
km = context.keymap
|
||||||
kmi = km.items.from_id(self.item_id)
|
kmi = km.items.from_id(self.item_id)
|
||||||
km.items.remove(kmi)
|
km.items.remove(kmi)
|
||||||
|
|||||||
@@ -755,7 +755,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
|
|||||||
props.data_path_item = "data.dof_distance"
|
props.data_path_item = "data.dof_distance"
|
||||||
props.input_scale = 0.02
|
props.input_scale = 0.02
|
||||||
|
|
||||||
if obj.type in ('CURVE', 'TEXT'):
|
if obj.type in ('CURVE', 'FONT'):
|
||||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||||
|
|
||||||
props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
|
props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
|
||||||
@@ -2159,7 +2159,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
|
|||||||
view = context.space_data
|
view = context.space_data
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.operator("view3d.add_background_image", text="Add Image")
|
col.operator("view3d.background_image_add", text="Add Image")
|
||||||
|
|
||||||
for i, bg in enumerate(view.background_images):
|
for i, bg in enumerate(view.background_images):
|
||||||
layout.active = view.show_background_images
|
layout.active = view.show_background_images
|
||||||
@@ -2170,7 +2170,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
|
|||||||
row.prop(bg.image, "name", text="", emboss=False)
|
row.prop(bg.image, "name", text="", emboss=False)
|
||||||
else:
|
else:
|
||||||
row.label(text="Not Set")
|
row.label(text="Not Set")
|
||||||
row.operator("view3d.remove_background_image", text="", emboss=False, icon='X').index = i
|
row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
|
||||||
|
|
||||||
box.prop(bg, "view_axis", text="Axis")
|
box.prop(bg, "view_axis", text="Axis")
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel):
|
|||||||
row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
|
row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
|
||||||
row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
|
row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
|
||||||
row = col.row()
|
row = col.row()
|
||||||
row.operator("curve.handle_type_set", text="Align").type = 'ALIGN'
|
row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
|
||||||
row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
|
row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
|
||||||
|
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
@@ -1077,8 +1077,11 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
|
ob = context.active_object
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
|
col.active = ob.vertex_groups.active != None
|
||||||
col.operator("object.vertex_group_normalize_all", text="Normalize All")
|
col.operator("object.vertex_group_normalize_all", text="Normalize All")
|
||||||
col.operator("object.vertex_group_normalize", text="Normalize")
|
col.operator("object.vertex_group_normalize", text="Normalize")
|
||||||
col.operator("object.vertex_group_invert", text="Invert")
|
col.operator("object.vertex_group_invert", text="Invert")
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(blender)
|
add_subdirectory(blender)
|
||||||
|
|
||||||
IF(WITH_GAMEENGINE)
|
if(WITH_GAMEENGINE)
|
||||||
ADD_SUBDIRECTORY(kernel)
|
add_subdirectory(kernel)
|
||||||
ADD_SUBDIRECTORY(gameengine)
|
add_subdirectory(gameengine)
|
||||||
ENDIF(WITH_GAMEENGINE)
|
endif()
|
||||||
|
|
||||||
IF(WINDOWS)
|
if(WINDOWS)
|
||||||
ADD_SUBDIRECTORY(icons)
|
add_subdirectory(icons)
|
||||||
ENDIF(WINDOWS)
|
endif()
|
||||||
|
|||||||
@@ -24,46 +24,46 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(editors)
|
add_subdirectory(editors)
|
||||||
ADD_SUBDIRECTORY(windowmanager)
|
add_subdirectory(windowmanager)
|
||||||
ADD_SUBDIRECTORY(blenkernel)
|
add_subdirectory(blenkernel)
|
||||||
ADD_SUBDIRECTORY(blenlib)
|
add_subdirectory(blenlib)
|
||||||
ADD_SUBDIRECTORY(render)
|
add_subdirectory(render)
|
||||||
ADD_SUBDIRECTORY(blenfont)
|
add_subdirectory(blenfont)
|
||||||
ADD_SUBDIRECTORY(blenloader)
|
add_subdirectory(blenloader)
|
||||||
ADD_SUBDIRECTORY(readblenfile)
|
add_subdirectory(readblenfile)
|
||||||
ADD_SUBDIRECTORY(blenpluginapi)
|
add_subdirectory(blenpluginapi)
|
||||||
ADD_SUBDIRECTORY(ikplugin)
|
add_subdirectory(ikplugin)
|
||||||
ADD_SUBDIRECTORY(gpu)
|
add_subdirectory(gpu)
|
||||||
ADD_SUBDIRECTORY(imbuf)
|
add_subdirectory(imbuf)
|
||||||
ADD_SUBDIRECTORY(avi)
|
add_subdirectory(avi)
|
||||||
ADD_SUBDIRECTORY(nodes)
|
add_subdirectory(nodes)
|
||||||
ADD_SUBDIRECTORY(modifiers)
|
add_subdirectory(modifiers)
|
||||||
ADD_SUBDIRECTORY(makesdna)
|
add_subdirectory(makesdna)
|
||||||
ADD_SUBDIRECTORY(makesrna)
|
add_subdirectory(makesrna)
|
||||||
ADD_SUBDIRECTORY(freestyle)
|
ADD_SUBDIRECTORY(freestyle)
|
||||||
|
|
||||||
IF(WITH_IMAGE_OPENEXR)
|
if(WITH_IMAGE_OPENEXR)
|
||||||
ADD_SUBDIRECTORY(imbuf/intern/openexr)
|
add_subdirectory(imbuf/intern/openexr)
|
||||||
ENDIF(WITH_IMAGE_OPENEXR)
|
endif()
|
||||||
|
|
||||||
IF(WITH_IMAGE_DDS)
|
if(WITH_IMAGE_DDS)
|
||||||
ADD_SUBDIRECTORY(imbuf/intern/dds)
|
add_subdirectory(imbuf/intern/dds)
|
||||||
ENDIF(WITH_IMAGE_DDS)
|
endif()
|
||||||
|
|
||||||
IF(WITH_IMAGE_CINEON)
|
if(WITH_IMAGE_CINEON)
|
||||||
ADD_SUBDIRECTORY(imbuf/intern/cineon)
|
add_subdirectory(imbuf/intern/cineon)
|
||||||
ENDIF(WITH_IMAGE_CINEON)
|
endif()
|
||||||
|
|
||||||
IF(WITH_CODEC_QUICKTIME)
|
if(WITH_CODEC_QUICKTIME)
|
||||||
ADD_SUBDIRECTORY(quicktime)
|
add_subdirectory(quicktime)
|
||||||
ENDIF(WITH_CODEC_QUICKTIME)
|
endif()
|
||||||
|
|
||||||
IF(WITH_PYTHON)
|
if(WITH_PYTHON)
|
||||||
ADD_SUBDIRECTORY(python)
|
add_subdirectory(python)
|
||||||
ENDIF(WITH_PYTHON)
|
endif()
|
||||||
|
|
||||||
IF(WITH_OPENCOLLADA)
|
if(WITH_OPENCOLLADA)
|
||||||
ADD_SUBDIRECTORY(collada)
|
add_subdirectory(collada)
|
||||||
ENDIF(WITH_OPENCOLLADA)
|
endif()
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user