Compare commits
231 Commits
tmp-pointc
...
apricot
Author | SHA1 | Date | |
---|---|---|---|
360f831339 | |||
7e8a3aa0b1 | |||
0d5ec24a05 | |||
36d3ae12c6 | |||
546127d964 | |||
bb57536018 | |||
12200c39df | |||
87b7ba70a1 | |||
4d368cb298 | |||
7e4eb371fe | |||
2b1c7fe4f9 | |||
ce70b6bf3b | |||
1aa359ab7b | |||
3a5b40d8f5 | |||
7c9e742dce | |||
b5f48d78b4 | |||
b4680f5ca1 | |||
3b8ed715b6 | |||
76f35a1e9a | |||
76d03839ac | |||
4988a1b7f9 | |||
01ba073f46 | |||
b766ff4a00 | |||
468b25e0f5 | |||
8eedcfcc3f | |||
93fc6cb680 | |||
2d428a4061 | |||
2febacefe2 | |||
c98ae55666 | |||
c594a6f25c | |||
2a9a2825f5 | |||
10af2a3cd5 | |||
75570d9410 | |||
f98d21ca84 | |||
9873352b02 | |||
d535770c18 | |||
e174b34eef | |||
9ffc3d065d | |||
009f826006 | |||
46131fbcd4 | |||
9cc4173c60 | |||
15fd22c6bd | |||
b5fcdc4074 | |||
17c81efced | |||
4043226064 | |||
81602d9b85 | |||
cd6cec0ebb | |||
56d3bfc28a | |||
0253b73fcb | |||
b818016d77 | |||
c235327152 | |||
3131858792 | |||
42f957f910 | |||
b059a3c765 | |||
ad27c65d02 | |||
3801120669 | |||
848694370e | |||
3bb931789d | |||
c6d799a3dc | |||
8c5249d9e1 | |||
788befdb57 | |||
2e695226d6 | |||
c44670f6cd | |||
4dc1ac2a7c | |||
706c784b4c | |||
2b1c790951 | |||
63408f4e02 | |||
d09ce02613 | |||
2c436f660b | |||
31cbb6060c | |||
d3758828b8 | |||
1a8fa0dd2a | |||
3e7c57098a | |||
42459bad2e | |||
af4262d03f | |||
1c2fd65ddb | |||
95fbf83423 | |||
a1fea54c18 | |||
00c4265bda | |||
151c8cc864 | |||
e84b2bd948 | |||
06354f7f75 | |||
ad103954e6 | |||
64e584fc0a | |||
437b207d3a | |||
f43c66f384 | |||
178be13f65 | |||
9bf054b7a9 | |||
f26485d28d | |||
e232ea3a4f | |||
00703cc507 | |||
6f9c6e5c80 | |||
f78fb5d232 | |||
264546961a | |||
68927fdeb6 | |||
7499860e80 | |||
9907889c8f | |||
f7d704fcf9 | |||
bca0d2d3e8 | |||
3282d85627 | |||
cf8807581e | |||
8a7eab4e56 | |||
![]() |
0a92399afd | ||
![]() |
ef8d649815 | ||
deabd2a280 | |||
3afb8c19a3 | |||
b474283367 | |||
c302bfcb7c | |||
13d00b5dcd | |||
ccc58f4491 | |||
a790d75dc8 | |||
00b742cf20 | |||
dc8776cafb | |||
8fd0b50602 | |||
a379a50f2b | |||
0fc753cfc5 | |||
0b02b01892 | |||
3caa27fa24 | |||
e414d79808 | |||
39cecc6044 | |||
9725cb1186 | |||
6df6d6be72 | |||
f1aa2edca3 | |||
38fa819cbd | |||
07e5dc0b96 | |||
38fe96e1ad | |||
6d62a18a51 | |||
9fb4cbc668 | |||
a40c48ce78 | |||
82863827ca | |||
8a84639207 | |||
02ca9d55e6 | |||
3304f85e0a | |||
88dd8e21d1 | |||
a2147e1089 | |||
e7fc44da7e | |||
3ac5c5e770 | |||
326f7060f3 | |||
444318431b | |||
e6c26fbb4e | |||
dafafabc7c | |||
94a087ce54 | |||
516635ea76 | |||
beafbe21f4 | |||
449dc4951c | |||
fedaaa1629 | |||
d3f6b7e6a7 | |||
dfbdaabef8 | |||
6b4d33b634 | |||
7e714967e9 | |||
3a4f0bcda2 | |||
1911f3f8ed | |||
72166c2192 | |||
2ae427d55f | |||
555dff358f | |||
39da0b7619 | |||
0d44ba56bb | |||
1aff5de748 | |||
0b01c20bed | |||
81cbfc5c9e | |||
c5cc2d8fc2 | |||
6ab7d3e1b1 | |||
1a91266864 | |||
f36b06e17a | |||
ff0833412c | |||
9c8bec4aec | |||
d34091386e | |||
3dcdf75f50 | |||
3f303b092b | |||
2bab988b85 | |||
59fd401ddf | |||
829ad0e999 | |||
4dd421204b | |||
06cee7fef9 | |||
10f7cb934f | |||
baf0b79446 | |||
61fa2043e5 | |||
edbd5d9d42 | |||
94028bc126 | |||
30142a3b92 | |||
c29a95acf9 | |||
ee74a440eb | |||
ee1bb9e26d | |||
b8f1393d4e | |||
fe78d082bd | |||
7861cd7c1b | |||
c3bb4e1961 | |||
03d1ef41c7 | |||
defc4d2dc7 | |||
d721c743cb | |||
f9b0ba6ef3 | |||
56cba0bb76 | |||
e66002841d | |||
cff63412cc | |||
8e4f1a7705 | |||
6546305b60 | |||
3181fcb984 | |||
7d7991ccaf | |||
f969d560c0 | |||
7fbf8080e6 | |||
70f7b998fc | |||
63b73469d8 | |||
7bb6187209 | |||
5c97dfbca1 | |||
c97975e879 | |||
5e0e27a180 | |||
4b7c271311 | |||
9e07b7fdfd | |||
8999c3d6dd | |||
2ff5edc2a0 | |||
6bfa99e695 | |||
79280bb4c7 | |||
228132ca55 | |||
7a23da05d3 | |||
0821fc4377 | |||
9fdd01d3e5 | |||
35536cfc48 | |||
5644546c5a | |||
41bf809327 | |||
071c679093 | |||
5333d4855d | |||
e3ebe509e2 | |||
1f1fdf1d7b | |||
3a14f1d601 | |||
c44bffaf90 | |||
7fd7d080a2 | |||
f6a2f47cfe | |||
fa66376e36 | |||
1d03d93e39 | |||
67a506401a | |||
9a86799f1d |
@@ -38,6 +38,8 @@ MACRO(BLENDERLIB
|
|||||||
ENDMACRO(BLENDERLIB)
|
ENDMACRO(BLENDERLIB)
|
||||||
|
|
||||||
MACRO(SETUP_LIBDIRS)
|
MACRO(SETUP_LIBDIRS)
|
||||||
|
# see "cmake --help-policy CMP0003"
|
||||||
|
CMAKE_POLICY(SET CMP0003 NEW)
|
||||||
LINK_DIRECTORIES(${PYTHON_LIBPATH} ${SDL_LIBPATH} ${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${ICONV_LIBPATH} ${OPENEXR_LIBPATH} ${QUICKTIME_LIBPATH} ${FFMPEG_LIBPATH})
|
LINK_DIRECTORIES(${PYTHON_LIBPATH} ${SDL_LIBPATH} ${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${ICONV_LIBPATH} ${OPENEXR_LIBPATH} ${QUICKTIME_LIBPATH} ${FFMPEG_LIBPATH})
|
||||||
IF(WITH_INTERNATIONAL)
|
IF(WITH_INTERNATIONAL)
|
||||||
LINK_DIRECTORIES(${GETTEXT_LIBPATH})
|
LINK_DIRECTORIES(${GETTEXT_LIBPATH})
|
||||||
|
@@ -63,7 +63,6 @@ OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
|
|||||||
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
|
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
|
||||||
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
|
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
|
||||||
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
|
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
|
||||||
OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
|
|
||||||
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
|
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
|
||||||
|
|
||||||
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
|
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
|
||||||
@@ -183,24 +182,38 @@ IF(UNIX)
|
|||||||
SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++")
|
SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++")
|
||||||
|
|
||||||
IF(WITH_OPENMP)
|
IF(WITH_OPENMP)
|
||||||
SET(LLIBS "${LLIBS} -lgomp ")
|
SET(LLIBS "${LLIBS} -lgomp")
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
|
||||||
ENDIF(WITH_OPENMP)
|
ENDIF(WITH_OPENMP)
|
||||||
|
|
||||||
|
|
||||||
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
|
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
|
||||||
|
|
||||||
SET(PLATFORM_LINKFLAGS "-pthread")
|
SET(PLATFORM_LINKFLAGS "-pthread")
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
|
INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
|
||||||
|
|
||||||
|
# msvc already hides symbols, for others do it if the compiler supports it
|
||||||
|
EXECUTE_PROCESS(COMMAND echo "int main() { return 0; }" COMMAND ${CMAKE_C_COMPILER} -fvisibility=hidden -o /dev/null -xc - RESULT_VARIABLE VISIBILITY_RESULT OUTPUT_QUIET ERROR_QUIET)
|
||||||
|
IF(NOT VISIBILITY_RESULT)
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -DGCC_HASCLASSVISIBILITY")
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -DGCC_HASCLASSVISIBILITY")
|
||||||
|
ENDIF(NOT VISIBILITY_RESULT)
|
||||||
|
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
|
|
||||||
|
|
||||||
|
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
|
||||||
|
|
||||||
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
|
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
|
||||||
|
|
||||||
|
# Setup 64bit and 64bit windows systems
|
||||||
|
IF(CMAKE_CL_64)
|
||||||
|
message("64 bit compiler detected.")
|
||||||
|
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
|
|
||||||
SET(PYTHON ${LIBDIR}/python)
|
SET(PYTHON ${LIBDIR}/python)
|
||||||
SET(PYTHON_VERSION 2.5)
|
SET(PYTHON_VERSION 2.5)
|
||||||
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
|
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
|
||||||
@@ -214,12 +227,20 @@ IF(WIN32)
|
|||||||
SET(OPENAL_LIB openal_static)
|
SET(OPENAL_LIB openal_static)
|
||||||
SET(OPENAL_LIBPATH ${OPENAL}/lib)
|
SET(OPENAL_LIBPATH ${OPENAL}/lib)
|
||||||
|
|
||||||
SET(PNG_LIB libpng_st)
|
IF(CMAKE_CL_64)
|
||||||
|
SET(PNG_LIB libpng)
|
||||||
|
ELSE(CMAKE_CL_64)
|
||||||
|
SET(PNG_LIB libpng_st)
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
SET(JPEG_LIB libjpeg)
|
SET(JPEG_LIB libjpeg)
|
||||||
|
|
||||||
SET(ZLIB ${LIBDIR}/zlib)
|
SET(ZLIB ${LIBDIR}/zlib)
|
||||||
SET(ZLIB_INC ${ZLIB}/include)
|
SET(ZLIB_INC ${ZLIB}/include)
|
||||||
SET(ZLIB_LIB libz)
|
IF(CMAKE_CL_64)
|
||||||
|
SET(ZLIB_LIB zlib)
|
||||||
|
ELSE(CMAKE_CL_64)
|
||||||
|
SET(ZLIB_LIB libz)
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
SET(ZLIB_LIBPATH ${ZLIB}/lib)
|
SET(ZLIB_LIBPATH ${ZLIB}/lib)
|
||||||
|
|
||||||
SET(PTHREADS ${LIBDIR}/pthreads)
|
SET(PTHREADS ${LIBDIR}/pthreads)
|
||||||
@@ -234,7 +255,11 @@ IF(WIN32)
|
|||||||
|
|
||||||
SET(GETTEXT ${LIBDIR}/gettext)
|
SET(GETTEXT ${LIBDIR}/gettext)
|
||||||
SET(GETTEXT_INC ${GETTEXT}/include)
|
SET(GETTEXT_INC ${GETTEXT}/include)
|
||||||
SET(GETTEXT_LIB gnu_gettext)
|
IF(CMAKE_CL_64)
|
||||||
|
SET(GETTEXT_LIB gettextlib)
|
||||||
|
ELSE(CMAKE_CL_64)
|
||||||
|
SET(GETTEXT_LIB gnu_gettext)
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
|
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
|
||||||
|
|
||||||
SET(FREETYPE ${LIBDIR}/freetype)
|
SET(FREETYPE ${LIBDIR}/freetype)
|
||||||
@@ -265,7 +290,12 @@ IF(WIN32)
|
|||||||
SET(FFMPEG_LIB avcodec-51 avformat-52 avdevice-52 avutil-49 swscale-0)
|
SET(FFMPEG_LIB avcodec-51 avformat-52 avdevice-52 avutil-49 swscale-0)
|
||||||
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||||
|
|
||||||
|
IF(CMAKE_CL_64)
|
||||||
|
SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
|
||||||
|
ELSE(CMAKE_CL_64)
|
||||||
SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
|
SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
|
|
||||||
IF(WITH_OPENAL)
|
IF(WITH_OPENAL)
|
||||||
SET(LLIBS ${LLIBS} dxguid)
|
SET(LLIBS ${LLIBS} dxguid)
|
||||||
ENDIF(WITH_OPENAL)
|
ENDIF(WITH_OPENAL)
|
||||||
@@ -302,7 +332,11 @@ IF(WIN32)
|
|||||||
|
|
||||||
SET(WINTAB_INC ${LIBDIR}/wintab/include)
|
SET(WINTAB_INC ${LIBDIR}/wintab/include)
|
||||||
|
|
||||||
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib")
|
IF(CMAKE_CL_64)
|
||||||
|
SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
|
||||||
|
ELSE(CMAKE_CL_64)
|
||||||
|
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
|
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
@@ -384,6 +418,14 @@ IF(APPLE)
|
|||||||
SET(TIFF_INC ${TIFF}/include)
|
SET(TIFF_INC ${TIFF}/include)
|
||||||
|
|
||||||
SET(EXETYPE MACOSX_BUNDLE)
|
SET(EXETYPE MACOSX_BUNDLE)
|
||||||
|
|
||||||
|
# msvc already hides symbols, for others do it if the compiler supports it
|
||||||
|
EXECUTE_PROCESS(COMMAND echo "int main() { return 0; }" COMMAND ${CMAKE_C_COMPILER} -fvisibility=hidden -o /dev/null -xc - RESULT_VARIABLE VISIBILITY_RESULT OUTPUT_QUIET ERROR_QUIET)
|
||||||
|
IF(NOT VISIBILITY_RESULT)
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -DGCC_HASCLASSVISIBILITY")
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -DGCC_HASCLASSVISIBILITY")
|
||||||
|
ENDIF(NOT VISIBILITY_RESULT)
|
||||||
|
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
14
README
14
README
@@ -24,22 +24,22 @@ dir to one of these locations (your home directory being recommended).
|
|||||||
-------------------------------------Links--------------------------------------
|
-------------------------------------Links--------------------------------------
|
||||||
|
|
||||||
Getting Involved:
|
Getting Involved:
|
||||||
http://www.blender.org/docs/get_involved.html
|
http://www.blender.org/community/get-involved
|
||||||
|
|
||||||
Community:
|
Community:
|
||||||
http://www.blender3d.org/Community/
|
http://www.blender.org/Community
|
||||||
|
|
||||||
Main blender development site:
|
Main blender development site:
|
||||||
http://www.blender.org/
|
http://www.blender.org
|
||||||
|
|
||||||
The Blender project homepage:
|
The Blender project homepage:
|
||||||
http://projects.blender.org/projects/bf-blender/
|
http://projects.blender.org/projects/bf-blender
|
||||||
|
|
||||||
Documentation:
|
Documentation:
|
||||||
http://www.blender.org/modules.php?op=modload&name=documentation&file=index
|
http://www.blender.org/education-help
|
||||||
|
|
||||||
Bug tracker:
|
Bug tracker:
|
||||||
http://projects.blender.org/tracker/?atid=125&group_id=9&func=browse
|
http://www.blender.org/development/report-a-bug
|
||||||
|
|
||||||
Feature request tracker:
|
Feature request tracker:
|
||||||
http://projects.blender.org/tracker/?atid=128&group_id=9&func=browse
|
http://wiki.blender.org/index.php/Requests
|
||||||
|
22
SConstruct
22
SConstruct
@@ -36,6 +36,7 @@ import string
|
|||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
import re
|
import re
|
||||||
|
import commands
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
import tools.Blender
|
import tools.Blender
|
||||||
@@ -184,15 +185,16 @@ if env['WITH_BF_OPENMP'] == 1:
|
|||||||
env['CPPFLAGS'].append('/openmp')
|
env['CPPFLAGS'].append('/openmp')
|
||||||
env['CXXFLAGS'].append('/openmp')
|
env['CXXFLAGS'].append('/openmp')
|
||||||
else:
|
else:
|
||||||
if env['CC'] == 'icc':
|
if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
|
||||||
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
|
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
|
||||||
env['CCFLAGS'].append('-openmp')
|
env['CCFLAGS'].append('-openmp')
|
||||||
env['CPPFLAGS'].append('-openmp')
|
env['CPPFLAGS'].append('-openmp')
|
||||||
env['CXXFLAGS'].append('-openmp')
|
env['CXXFLAGS'].append('-openmp')
|
||||||
else:
|
else:
|
||||||
env['CCFLAGS'].append('-fopenmp')
|
env.Append(CCFLAGS=['-fopenmp'])
|
||||||
env['CPPFLAGS'].append('-fopenmp')
|
env.Append(CPPFLAGS=['-fopenmp'])
|
||||||
env['CXXFLAGS'].append('-fopenmp')
|
env.Append(CXXFLAGS=['-fopenmp'])
|
||||||
|
# env.Append(LINKFLAGS=['-fprofile-generate'])
|
||||||
|
|
||||||
#check for additional debug libnames
|
#check for additional debug libnames
|
||||||
|
|
||||||
@@ -235,6 +237,18 @@ if env['OURPLATFORM'] == 'linux2' :
|
|||||||
os.rmdir(os.path.join(root, name))
|
os.rmdir(os.path.join(root, name))
|
||||||
if root: os.rmdir(root)
|
if root: os.rmdir(root)
|
||||||
|
|
||||||
|
# msvc already hides symbols, for others do it if the compiler supports it
|
||||||
|
|
||||||
|
if env['OURPLATFORM'] != 'win32-vc':
|
||||||
|
def check_option(cc, option):
|
||||||
|
cmd = "echo \"int main() { return 0; }\" | " + cc + " " + option + " -o /dev/null -xc -"
|
||||||
|
return (commands.getstatusoutput(cmd)[0] == 0)
|
||||||
|
|
||||||
|
if check_option(env['CC'], '-fvisibility=hidden'):
|
||||||
|
env['CPPFLAGS'].extend(['-fvisibility=hidden', '-DGCC_HASCLASSVISIBILITY'])
|
||||||
|
env['CXXFLAGS'].extend(['-fvisibility=hidden', '-DGCC_HASCLASSVISIBILITY'])
|
||||||
|
env['CCFLAGS'].extend(['-fvisibility=hidden', '-DGCC_HASCLASSVISIBILITY'])
|
||||||
|
|
||||||
if len(B.quickdebug) > 0 and printdebug != 0:
|
if len(B.quickdebug) > 0 and printdebug != 0:
|
||||||
print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
|
print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
|
||||||
for l in B.quickdebug:
|
for l in B.quickdebug:
|
||||||
|
@@ -20,3 +20,4 @@ Romanian:ro
|
|||||||
Arabic:ar
|
Arabic:ar
|
||||||
Bulgarian:bg
|
Bulgarian:bg
|
||||||
Greek:el
|
Greek:el
|
||||||
|
Korean:kr
|
||||||
|
@@ -90,6 +90,7 @@ IF(UNIX)
|
|||||||
bf_soundsystem
|
bf_soundsystem
|
||||||
bf_kernel
|
bf_kernel
|
||||||
bf_nodes
|
bf_nodes
|
||||||
|
bf_gpu
|
||||||
bf_imbuf
|
bf_imbuf
|
||||||
bf_avi
|
bf_avi
|
||||||
kx_network
|
kx_network
|
||||||
|
@@ -143,7 +143,6 @@ BF_FTGL_LIB = 'extern_ftgl'
|
|||||||
|
|
||||||
WITH_BF_GAMEENGINE='true'
|
WITH_BF_GAMEENGINE='true'
|
||||||
WITH_BF_PLAYER='true'
|
WITH_BF_PLAYER='true'
|
||||||
WITH_BF_GLEXT= '1'
|
|
||||||
|
|
||||||
WITH_BF_ODE = 'false'
|
WITH_BF_ODE = 'false'
|
||||||
BF_ODE = LIBDIR + '/ode'
|
BF_ODE = LIBDIR + '/ode'
|
||||||
|
@@ -139,7 +139,7 @@ BF_OPENJPEG_LIB = ''
|
|||||||
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
|
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
|
||||||
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
||||||
|
|
||||||
WITH_BF_REDCODE = 'true'
|
WITH_BF_REDCODE = 'false'
|
||||||
BF_REDCODE = '#extern/libredcode'
|
BF_REDCODE = '#extern/libredcode'
|
||||||
BF_REDCODE_LIB = ''
|
BF_REDCODE_LIB = ''
|
||||||
# Uncomment the following two lines to use system's ffmpeg
|
# Uncomment the following two lines to use system's ffmpeg
|
||||||
|
@@ -181,7 +181,9 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
|
|||||||
btCollisionObject* collisionObject,
|
btCollisionObject* collisionObject,
|
||||||
const btCollisionShape* collisionShape,
|
const btCollisionShape* collisionShape,
|
||||||
const btTransform& colObjWorldTransform,
|
const btTransform& colObjWorldTransform,
|
||||||
RayResultCallback& resultCallback,short int collisionFilterMask)
|
RayResultCallback& resultCallback,
|
||||||
|
short int collisionFilterMask,
|
||||||
|
bool faceNormal)
|
||||||
{
|
{
|
||||||
|
|
||||||
btSphereShape pointShape(btScalar(0.0));
|
btSphereShape pointShape(btScalar(0.0));
|
||||||
@@ -191,14 +193,16 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
|
|||||||
collisionObject,
|
collisionObject,
|
||||||
collisionShape,
|
collisionShape,
|
||||||
colObjWorldTransform,
|
colObjWorldTransform,
|
||||||
resultCallback,collisionFilterMask);
|
resultCallback,collisionFilterMask,faceNormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
||||||
btCollisionObject* collisionObject,
|
btCollisionObject* collisionObject,
|
||||||
const btCollisionShape* collisionShape,
|
const btCollisionShape* collisionShape,
|
||||||
const btTransform& colObjWorldTransform,
|
const btTransform& colObjWorldTransform,
|
||||||
RayResultCallback& resultCallback,short int collisionFilterMask)
|
RayResultCallback& resultCallback,
|
||||||
|
short int collisionFilterMask,
|
||||||
|
bool faceNormal)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -257,9 +261,9 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
|
|||||||
btCollisionObject* m_collisionObject;
|
btCollisionObject* m_collisionObject;
|
||||||
btTriangleMeshShape* m_triangleMesh;
|
btTriangleMeshShape* m_triangleMesh;
|
||||||
|
|
||||||
BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
|
BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,bool faceNormal,
|
||||||
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh):
|
btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape* triangleMesh):
|
||||||
btTriangleRaycastCallback(from,to),
|
btTriangleRaycastCallback(from,to,faceNormal),
|
||||||
m_resultCallback(resultCallback),
|
m_resultCallback(resultCallback),
|
||||||
m_collisionObject(collisionObject),
|
m_collisionObject(collisionObject),
|
||||||
m_triangleMesh(triangleMesh)
|
m_triangleMesh(triangleMesh)
|
||||||
@@ -272,6 +276,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
|
|||||||
btCollisionWorld::LocalShapeInfo shapeInfo;
|
btCollisionWorld::LocalShapeInfo shapeInfo;
|
||||||
shapeInfo.m_shapePart = partId;
|
shapeInfo.m_shapePart = partId;
|
||||||
shapeInfo.m_triangleIndex = triangleIndex;
|
shapeInfo.m_triangleIndex = triangleIndex;
|
||||||
|
shapeInfo.m_triangleShape = m_triangleMesh;
|
||||||
|
|
||||||
btCollisionWorld::LocalRayResult rayResult
|
btCollisionWorld::LocalRayResult rayResult
|
||||||
(m_collisionObject,
|
(m_collisionObject,
|
||||||
@@ -287,7 +292,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,triangleMesh);
|
BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,faceNormal,&resultCallback,collisionObject,triangleMesh);
|
||||||
rcb.m_hitFraction = resultCallback.m_closestHitFraction;
|
rcb.m_hitFraction = resultCallback.m_closestHitFraction;
|
||||||
|
|
||||||
btVector3 rayAabbMinLocal = rayFromLocal;
|
btVector3 rayAabbMinLocal = rayFromLocal;
|
||||||
@@ -313,7 +318,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
|
|||||||
collisionObject,
|
collisionObject,
|
||||||
childCollisionShape,
|
childCollisionShape,
|
||||||
childWorldTrans,
|
childWorldTrans,
|
||||||
resultCallback, collisionFilterMask);
|
resultCallback, collisionFilterMask, faceNormal);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +328,7 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback,short int collisionFilterMask)
|
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback,short int collisionFilterMask, bool faceNormal)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -350,11 +355,17 @@ void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& r
|
|||||||
btVector3 hitNormal;
|
btVector3 hitNormal;
|
||||||
if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal))
|
if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal))
|
||||||
{
|
{
|
||||||
rayTestSingle(rayFromTrans,rayToTrans,
|
// before testing this object, verify that it is not filtered out
|
||||||
collisionObject,
|
if (resultCallback.NeedRayCast(collisionObject))
|
||||||
collisionObject->getCollisionShape(),
|
{
|
||||||
collisionObject->getWorldTransform(),
|
rayTestSingle(rayFromTrans,rayToTrans,
|
||||||
resultCallback);
|
collisionObject,
|
||||||
|
collisionObject->getCollisionShape(),
|
||||||
|
collisionObject->getWorldTransform(),
|
||||||
|
resultCallback,
|
||||||
|
collisionFilterMask,
|
||||||
|
faceNormal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -125,8 +125,8 @@ public:
|
|||||||
{
|
{
|
||||||
int m_shapePart;
|
int m_shapePart;
|
||||||
int m_triangleIndex;
|
int m_triangleIndex;
|
||||||
|
// needed in case of compound shape
|
||||||
//const btCollisionShape* m_shapeTemp;
|
const btCollisionShape* m_triangleShape;
|
||||||
//const btTransform* m_shapeLocalTransform;
|
//const btTransform* m_shapeLocalTransform;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -166,6 +166,10 @@ public:
|
|||||||
:m_closestHitFraction(btScalar(1.))
|
:m_closestHitFraction(btScalar(1.))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
virtual bool NeedRayCast(btCollisionObject* object)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
virtual btScalar AddSingleResult(LocalRayResult& rayResult) = 0;
|
virtual btScalar AddSingleResult(LocalRayResult& rayResult) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -209,7 +213,7 @@ public:
|
|||||||
|
|
||||||
/// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
|
/// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
|
||||||
/// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.
|
/// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.
|
||||||
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback, short int collisionFilterMask=-1);
|
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback, short int collisionFilterMask=-1, bool faceNormal=false);
|
||||||
|
|
||||||
/// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.
|
/// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.
|
||||||
/// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape.
|
/// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape.
|
||||||
@@ -218,14 +222,18 @@ public:
|
|||||||
btCollisionObject* collisionObject,
|
btCollisionObject* collisionObject,
|
||||||
const btCollisionShape* collisionShape,
|
const btCollisionShape* collisionShape,
|
||||||
const btTransform& colObjWorldTransform,
|
const btTransform& colObjWorldTransform,
|
||||||
RayResultCallback& resultCallback, short int collisionFilterMask=-1);
|
RayResultCallback& resultCallback,
|
||||||
|
short int collisionFilterMask=-1,
|
||||||
|
bool faceNormal=false);
|
||||||
|
|
||||||
/// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.
|
/// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.
|
||||||
static void objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
static void objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
||||||
btCollisionObject* collisionObject,
|
btCollisionObject* collisionObject,
|
||||||
const btCollisionShape* collisionShape,
|
const btCollisionShape* collisionShape,
|
||||||
const btTransform& colObjWorldTransform,
|
const btTransform& colObjWorldTransform,
|
||||||
RayResultCallback& resultCallback, short int collisionFilterMask=-1);
|
RayResultCallback& resultCallback,
|
||||||
|
short int collisionFilterMask=-1,
|
||||||
|
bool faceNormal=false);
|
||||||
|
|
||||||
void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1);
|
void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1);
|
||||||
|
|
||||||
|
@@ -334,6 +334,10 @@ void btOptimizedBvh::setQuantizationValues(const btVector3& bvhAabbMin,const btV
|
|||||||
m_bvhAabbMax = bvhAabbMax + clampValue;
|
m_bvhAabbMax = bvhAabbMax + clampValue;
|
||||||
btVector3 aabbSize = m_bvhAabbMax - m_bvhAabbMin;
|
btVector3 aabbSize = m_bvhAabbMax - m_bvhAabbMin;
|
||||||
m_bvhQuantization = btVector3(btScalar(65535.0),btScalar(65535.0),btScalar(65535.0)) / aabbSize;
|
m_bvhQuantization = btVector3(btScalar(65535.0),btScalar(65535.0),btScalar(65535.0)) / aabbSize;
|
||||||
|
m_bvhQuantizationInv = btVector3(
|
||||||
|
btScalar(1.0)/m_bvhQuantization.getX(),
|
||||||
|
btScalar(1.0)/m_bvhQuantization.getY(),
|
||||||
|
btScalar(1.0)/m_bvhQuantization.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -384,7 +388,7 @@ void btOptimizedBvh::buildTree (int startIndex,int endIndex)
|
|||||||
#endif //DEBUG_TREE_BUILDING
|
#endif //DEBUG_TREE_BUILDING
|
||||||
|
|
||||||
|
|
||||||
int splitAxis, splitIndex, i;
|
int splitIndex, i;
|
||||||
int numIndices =endIndex-startIndex;
|
int numIndices =endIndex-startIndex;
|
||||||
int curIndex = m_curNodeIndex;
|
int curIndex = m_curNodeIndex;
|
||||||
|
|
||||||
@@ -403,9 +407,7 @@ void btOptimizedBvh::buildTree (int startIndex,int endIndex)
|
|||||||
}
|
}
|
||||||
//calculate Best Splitting Axis and where to split it. Sort the incoming 'leafNodes' array within range 'startIndex/endIndex'.
|
//calculate Best Splitting Axis and where to split it. Sort the incoming 'leafNodes' array within range 'startIndex/endIndex'.
|
||||||
|
|
||||||
splitAxis = calcSplittingAxis(startIndex,endIndex);
|
splitIndex = sortAndCalcSplittingIndex(startIndex,endIndex);
|
||||||
|
|
||||||
splitIndex = sortAndCalcSplittingIndex(startIndex,endIndex,splitAxis);
|
|
||||||
|
|
||||||
int internalNodeIndex = m_curNodeIndex;
|
int internalNodeIndex = m_curNodeIndex;
|
||||||
|
|
||||||
@@ -482,27 +484,33 @@ void btOptimizedBvh::updateSubtreeHeaders(int leftChildNodexIndex,int rightChild
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int btOptimizedBvh::sortAndCalcSplittingIndex(int startIndex,int endIndex,int splitAxis)
|
int btOptimizedBvh::sortAndCalcSplittingIndex(int startIndex,int endIndex)
|
||||||
{
|
{
|
||||||
int i;
|
int i, splitAxis;
|
||||||
int splitIndex =startIndex;
|
int splitIndex =startIndex;
|
||||||
int numIndices = endIndex - startIndex;
|
int numIndices = endIndex - startIndex;
|
||||||
btScalar splitValue;
|
btScalar splitValue;
|
||||||
|
|
||||||
btVector3 means(btScalar(0.),btScalar(0.),btScalar(0.));
|
btVector3 means(btScalar(0.),btScalar(0.),btScalar(0.));
|
||||||
for (i=startIndex;i<endIndex;i++)
|
for (i=startIndex;i<endIndex;i++)
|
||||||
{
|
means+=getAabbCenter(i);
|
||||||
btVector3 center = btScalar(0.5)*(getAabbMax(i)+getAabbMin(i));
|
|
||||||
means+=center;
|
|
||||||
}
|
|
||||||
means *= (btScalar(1.)/(btScalar)numIndices);
|
means *= (btScalar(1.)/(btScalar)numIndices);
|
||||||
|
|
||||||
|
btVector3 variance(btScalar(0.),btScalar(0.),btScalar(0.));
|
||||||
|
for (i=startIndex;i<endIndex;i++)
|
||||||
|
{
|
||||||
|
btVector3 diff2 = getAabbCenter(i)-means;
|
||||||
|
diff2 = diff2 * diff2;
|
||||||
|
variance += diff2;
|
||||||
|
}
|
||||||
|
|
||||||
|
splitAxis = variance.maxAxis();
|
||||||
splitValue = means[splitAxis];
|
splitValue = means[splitAxis];
|
||||||
|
|
||||||
//sort leafNodes so all values larger then splitValue comes first, and smaller values start from 'splitIndex'.
|
//sort leafNodes so all values larger then splitValue comes first, and smaller values start from 'splitIndex'.
|
||||||
for (i=startIndex;i<endIndex;i++)
|
for (i=startIndex;i<endIndex;i++)
|
||||||
{
|
{
|
||||||
btVector3 center = btScalar(0.5)*(getAabbMax(i)+getAabbMin(i));
|
btVector3 center = getAabbCenter(i);
|
||||||
if (center[splitAxis] > splitValue)
|
if (center[splitAxis] > splitValue)
|
||||||
{
|
{
|
||||||
//swap
|
//swap
|
||||||
@@ -535,35 +543,6 @@ int btOptimizedBvh::sortAndCalcSplittingIndex(int startIndex,int endIndex,int sp
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int btOptimizedBvh::calcSplittingAxis(int startIndex,int endIndex)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
btVector3 means(btScalar(0.),btScalar(0.),btScalar(0.));
|
|
||||||
btVector3 variance(btScalar(0.),btScalar(0.),btScalar(0.));
|
|
||||||
int numIndices = endIndex-startIndex;
|
|
||||||
|
|
||||||
for (i=startIndex;i<endIndex;i++)
|
|
||||||
{
|
|
||||||
btVector3 center = btScalar(0.5)*(getAabbMax(i)+getAabbMin(i));
|
|
||||||
means+=center;
|
|
||||||
}
|
|
||||||
means *= (btScalar(1.)/(btScalar)numIndices);
|
|
||||||
|
|
||||||
for (i=startIndex;i<endIndex;i++)
|
|
||||||
{
|
|
||||||
btVector3 center = btScalar(0.5)*(getAabbMax(i)+getAabbMin(i));
|
|
||||||
btVector3 diff2 = center-means;
|
|
||||||
diff2 = diff2 * diff2;
|
|
||||||
variance += diff2;
|
|
||||||
}
|
|
||||||
variance *= (btScalar(1.)/ ((btScalar)numIndices-1) );
|
|
||||||
|
|
||||||
return variance.maxAxis();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btOptimizedBvh::reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
void btOptimizedBvh::reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||||
{
|
{
|
||||||
//either choose recursive traversal (walkTree) or stackless (walkStacklessTree)
|
//either choose recursive traversal (walkTree) or stackless (walkStacklessTree)
|
||||||
@@ -810,13 +789,31 @@ btVector3 btOptimizedBvh::unQuantize(const unsigned short* vecIn) const
|
|||||||
{
|
{
|
||||||
btVector3 vecOut;
|
btVector3 vecOut;
|
||||||
vecOut.setValue(
|
vecOut.setValue(
|
||||||
(btScalar)(vecIn[0]) / (m_bvhQuantization.getX()),
|
(btScalar)(vecIn[0]) * (m_bvhQuantizationInv.getX()),
|
||||||
(btScalar)(vecIn[1]) / (m_bvhQuantization.getY()),
|
(btScalar)(vecIn[1]) * (m_bvhQuantizationInv.getY()),
|
||||||
(btScalar)(vecIn[2]) / (m_bvhQuantization.getZ()));
|
(btScalar)(vecIn[2]) * (m_bvhQuantizationInv.getZ()));
|
||||||
vecOut += m_bvhAabbMin;
|
vecOut += m_bvhAabbMin;
|
||||||
return vecOut;
|
return vecOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btVector3 btOptimizedBvh::unQuantizeCenter(const unsigned short* vecMin, const unsigned short *vecMax) const
|
||||||
|
{
|
||||||
|
btVector3 vecOut;
|
||||||
|
unsigned int center[3];
|
||||||
|
|
||||||
|
center[0]= (unsigned int)vecMin[0] + (unsigned int)vecMax[0];
|
||||||
|
center[1]= (unsigned int)vecMin[1] + (unsigned int)vecMax[1];
|
||||||
|
center[2]= (unsigned int)vecMin[2] + (unsigned int)vecMax[2];
|
||||||
|
|
||||||
|
vecOut.setValue(
|
||||||
|
(btScalar)(center[0]) * (m_bvhQuantizationInv.getX()),
|
||||||
|
(btScalar)(center[1]) * (m_bvhQuantizationInv.getY()),
|
||||||
|
(btScalar)(center[2]) * (m_bvhQuantizationInv.getZ()));
|
||||||
|
vecOut = m_bvhAabbMin + btScalar(0.5)*vecOut;
|
||||||
|
return vecOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btOptimizedBvh::swapLeafNodes(int i,int splitIndex)
|
void btOptimizedBvh::swapLeafNodes(int i,int splitIndex)
|
||||||
{
|
{
|
||||||
|
@@ -144,6 +144,7 @@ ATTRIBUTE_ALIGNED16(class) btOptimizedBvh
|
|||||||
btVector3 m_bvhAabbMin;
|
btVector3 m_bvhAabbMin;
|
||||||
btVector3 m_bvhAabbMax;
|
btVector3 m_bvhAabbMax;
|
||||||
btVector3 m_bvhQuantization;
|
btVector3 m_bvhQuantization;
|
||||||
|
btVector3 m_bvhQuantizationInv;
|
||||||
|
|
||||||
enum btTraversalMode
|
enum btTraversalMode
|
||||||
{
|
{
|
||||||
@@ -204,6 +205,17 @@ ATTRIBUTE_ALIGNED16(class) btOptimizedBvh
|
|||||||
return m_leafNodes[nodeIndex].m_aabbMaxOrg;
|
return m_leafNodes[nodeIndex].m_aabbMaxOrg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
btVector3 getAabbCenter(int nodeIndex) const
|
||||||
|
{
|
||||||
|
if (m_useQuantization)
|
||||||
|
{
|
||||||
|
const btQuantizedBvhNode& node = m_quantizedLeafNodes[nodeIndex];
|
||||||
|
return unQuantizeCenter(node.m_quantizedAabbMin, node.m_quantizedAabbMax);
|
||||||
|
}
|
||||||
|
//non-quantized
|
||||||
|
return btScalar(0.5)*(m_leafNodes[nodeIndex].m_aabbMinOrg+m_leafNodes[nodeIndex].m_aabbMaxOrg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
|
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
|
||||||
|
|
||||||
@@ -255,9 +267,7 @@ protected:
|
|||||||
|
|
||||||
void buildTree (int startIndex,int endIndex);
|
void buildTree (int startIndex,int endIndex);
|
||||||
|
|
||||||
int calcSplittingAxis(int startIndex,int endIndex);
|
int sortAndCalcSplittingIndex(int startIndex,int endIndex);
|
||||||
|
|
||||||
int sortAndCalcSplittingIndex(int startIndex,int endIndex,int splitAxis);
|
|
||||||
|
|
||||||
void walkStacklessTree(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
void walkStacklessTree(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||||
|
|
||||||
@@ -298,6 +308,8 @@ public:
|
|||||||
void quantizeWithClamp(unsigned short* out, const btVector3& point) const;
|
void quantizeWithClamp(unsigned short* out, const btVector3& point) const;
|
||||||
|
|
||||||
btVector3 unQuantize(const unsigned short* vecIn) const;
|
btVector3 unQuantize(const unsigned short* vecIn) const;
|
||||||
|
btVector3 unQuantizeCenter(const unsigned short* vecMin, const unsigned short *vecMax) const;
|
||||||
|
btVector3 unQuantize(const unsigned int* vecIn) const;
|
||||||
|
|
||||||
///setTraversalMode let's you choose between stackless, recursive or stackless cache friendly tree traversal. Note this is only implemented for quantized trees.
|
///setTraversalMode let's you choose between stackless, recursive or stackless cache friendly tree traversal. Note this is only implemented for quantized trees.
|
||||||
void setTraversalMode(btTraversalMode traversalMode)
|
void setTraversalMode(btTraversalMode traversalMode)
|
||||||
|
@@ -16,10 +16,11 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
#include "btRaycastCallback.h"
|
#include "btRaycastCallback.h"
|
||||||
|
|
||||||
btTriangleRaycastCallback::btTriangleRaycastCallback(const btVector3& from,const btVector3& to)
|
btTriangleRaycastCallback::btTriangleRaycastCallback(const btVector3& from,const btVector3& to,bool faceNormal)
|
||||||
:
|
:
|
||||||
m_from(from),
|
m_from(from),
|
||||||
m_to(to),
|
m_to(to),
|
||||||
|
m_faceNormal(faceNormal),
|
||||||
m_hitFraction(btScalar(1.))
|
m_hitFraction(btScalar(1.))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -84,8 +85,7 @@ void btTriangleRaycastCallback::processTriangle(btVector3* triangle,int partId,
|
|||||||
|
|
||||||
if ( (btScalar)(cp2.dot(triangleNormal)) >=edge_tolerance)
|
if ( (btScalar)(cp2.dot(triangleNormal)) >=edge_tolerance)
|
||||||
{
|
{
|
||||||
|
if (m_faceNormal || dist_a > 0)
|
||||||
if ( dist_a > 0 )
|
|
||||||
{
|
{
|
||||||
m_hitFraction = reportHit(triangleNormal,distance,partId,triangleIndex);
|
m_hitFraction = reportHit(triangleNormal,distance,partId,triangleIndex);
|
||||||
}
|
}
|
||||||
|
@@ -27,10 +27,11 @@ public:
|
|||||||
//input
|
//input
|
||||||
btVector3 m_from;
|
btVector3 m_from;
|
||||||
btVector3 m_to;
|
btVector3 m_to;
|
||||||
|
bool m_faceNormal;
|
||||||
|
|
||||||
btScalar m_hitFraction;
|
btScalar m_hitFraction;
|
||||||
|
|
||||||
btTriangleRaycastCallback(const btVector3& from,const btVector3& to);
|
btTriangleRaycastCallback(const btVector3& from,const btVector3& to,bool faceNormal);
|
||||||
|
|
||||||
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
|
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
|
||||||
|
|
||||||
|
@@ -856,10 +856,26 @@ void btDiscreteDynamicsWorld::debugDrawObject(const btTransform& worldTransform,
|
|||||||
btScalar radius = coneShape->getRadius();//+coneShape->getMargin();
|
btScalar radius = coneShape->getRadius();//+coneShape->getMargin();
|
||||||
btScalar height = coneShape->getHeight();//+coneShape->getMargin();
|
btScalar height = coneShape->getHeight();//+coneShape->getMargin();
|
||||||
btVector3 start = worldTransform.getOrigin();
|
btVector3 start = worldTransform.getOrigin();
|
||||||
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(radius,btScalar(0.),btScalar(-0.5)*height),color);
|
// insert here Bullet 2.69 that fixes representation of cone
|
||||||
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(-radius,btScalar(0.),btScalar(-0.5)*height),color);
|
int upAxis= coneShape->getConeUpIndex();
|
||||||
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),radius,btScalar(-0.5)*height),color);
|
|
||||||
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),-radius,btScalar(-0.5)*height),color);
|
btVector3 offsetHeight(0,0,0);
|
||||||
|
offsetHeight[upAxis] = height * btScalar(0.5);
|
||||||
|
btVector3 offsetRadius(0,0,0);
|
||||||
|
offsetRadius[(upAxis+1)%3] = radius;
|
||||||
|
btVector3 offset2Radius(0,0,0);
|
||||||
|
offset2Radius[(upAxis+2)%3] = radius;
|
||||||
|
|
||||||
|
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight+offsetRadius),color);
|
||||||
|
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight-offsetRadius),color);
|
||||||
|
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight+offset2Radius),color);
|
||||||
|
getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight-offset2Radius),color);
|
||||||
|
|
||||||
|
// buggy code that does not take into account the direction of the cone
|
||||||
|
//getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(radius,btScalar(0.),btScalar(-0.5)*height),color);
|
||||||
|
//getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(-radius,btScalar(0.),btScalar(-0.5)*height),color);
|
||||||
|
//getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),radius,btScalar(-0.5)*height),color);
|
||||||
|
//getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),-radius,btScalar(-0.5)*height),color);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
2
extern/glew/SConscript
vendored
2
extern/glew/SConscript
vendored
@@ -9,4 +9,4 @@ sources = ['src/glew.c']
|
|||||||
defs = ''
|
defs = ''
|
||||||
incs = 'include'
|
incs = 'include'
|
||||||
|
|
||||||
env.BlenderLib ( 'extern_glew', sources, Split(incs), Split(defs), libtype=['intern', 'player'], priority=[25, 50])
|
env.BlenderLib ( 'extern_glew', sources, Split(incs), Split(defs), libtype=['blender', 'player'], priority=[50, 50])
|
||||||
|
7
extern/glew/include/GL/glew.h
vendored
7
extern/glew/include/GL/glew.h
vendored
@@ -58,8 +58,11 @@
|
|||||||
** version 1.2.1 Specification.
|
** version 1.2.1 Specification.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* added this here for blender, should be moved elsewhere */
|
#define BLENDER_CHANGES
|
||||||
|
|
||||||
|
#ifdef BLENDER_CHANGES
|
||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __glew_h__
|
#ifndef __glew_h__
|
||||||
#define __glew_h__
|
#define __glew_h__
|
||||||
@@ -1805,6 +1808,7 @@ typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuin
|
|||||||
typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);
|
typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);
|
||||||
typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
|
typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
|
||||||
|
|
||||||
|
#ifndef BLENDER_CHANGES
|
||||||
#define glAttachShader GLEW_GET_FUN(__glewAttachShader)
|
#define glAttachShader GLEW_GET_FUN(__glewAttachShader)
|
||||||
#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)
|
#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)
|
||||||
#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)
|
#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)
|
||||||
@@ -1898,6 +1902,7 @@ typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint si
|
|||||||
#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)
|
#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)
|
||||||
#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)
|
#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)
|
||||||
#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)
|
#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)
|
#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)
|
||||||
|
|
||||||
|
2
extern/glew/src/glew.c
vendored
2
extern/glew/src/glew.c
vendored
@@ -1836,6 +1836,7 @@ static GLboolean _glewInit_GL_VERSION_2_0 (GLEW_CONTEXT_ARG_DEF_INIT)
|
|||||||
{
|
{
|
||||||
GLboolean r = GL_FALSE;
|
GLboolean r = GL_FALSE;
|
||||||
|
|
||||||
|
#ifndef BLENDER_CHANGES
|
||||||
r = ((glAttachShader = (PFNGLATTACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glAttachShader")) == NULL) || r;
|
r = ((glAttachShader = (PFNGLATTACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glAttachShader")) == NULL) || r;
|
||||||
r = ((glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocation")) == NULL) || r;
|
r = ((glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocation")) == NULL) || r;
|
||||||
r = ((glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparate")) == NULL) || r;
|
r = ((glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparate")) == NULL) || r;
|
||||||
@@ -1929,6 +1930,7 @@ static GLboolean _glewInit_GL_VERSION_2_0 (GLEW_CONTEXT_ARG_DEF_INIT)
|
|||||||
r = ((glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uiv")) == NULL) || r;
|
r = ((glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uiv")) == NULL) || r;
|
||||||
r = ((glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usv")) == NULL) || r;
|
r = ((glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usv")) == NULL) || r;
|
||||||
r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r;
|
r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r;
|
||||||
|
#endif
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ incs += ' ../../source/blender/makesdna ../../intern/guardedalloc'
|
|||||||
incs += ' ../../source/blender/blenlib'
|
incs += ' ../../source/blender/blenlib'
|
||||||
|
|
||||||
if (env['OURPLATFORM'] == 'win32-mingw'):
|
if (env['OURPLATFORM'] == 'win32-mingw'):
|
||||||
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [5,50] )
|
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [30,85] )
|
||||||
else:
|
else:
|
||||||
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='common', priority = 5 )
|
env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='common', priority = 5 )
|
||||||
|
|
||||||
|
@@ -75,4 +75,47 @@ void BOP_Edge::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
|
|||||||
else if (m_vertexs[1] == oldIndex) m_vertexs[1] = newIndex;
|
else if (m_vertexs[1] == oldIndex) m_vertexs[1] = newIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if this edge contains the specified face index.
|
||||||
|
* @param i face index
|
||||||
|
* @return true if this edge contains the specified face index, false otherwise
|
||||||
|
*/
|
||||||
|
bool BOP_Edge::removeFace(BOP_Index i)
|
||||||
|
{
|
||||||
|
int pos=0;
|
||||||
|
for(BOP_IT_Indexs it = m_faces.begin();it!=m_faces.end();pos++,it++) {
|
||||||
|
if ((*it) == i) {
|
||||||
|
m_faces.erase(it);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BOP_DEBUG
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements operator <<.
|
||||||
|
*/
|
||||||
|
ostream &operator<<(ostream &stream, BOP_Edge *e)
|
||||||
|
{
|
||||||
|
stream << "Edge[" << e->getVertex1() << "," << e->getVertex2();
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
if(e->m_used)
|
||||||
|
stream << "] (used)";
|
||||||
|
else
|
||||||
|
stream << "] (unused)";
|
||||||
|
#endif
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -29,12 +29,16 @@
|
|||||||
#define BOP_EDGE_H
|
#define BOP_EDGE_H
|
||||||
|
|
||||||
#include "BOP_Indexs.h"
|
#include "BOP_Indexs.h"
|
||||||
|
#include "BOP_Misc.h"
|
||||||
|
|
||||||
class BOP_Edge
|
class BOP_Edge
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
BOP_Index m_vertexs[2];
|
BOP_Index m_vertexs[2];
|
||||||
BOP_Indexs m_faces;
|
BOP_Indexs m_faces;
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
bool m_used;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool containsFace(BOP_Index i);
|
bool containsFace(BOP_Index i);
|
||||||
|
|
||||||
@@ -47,6 +51,15 @@ public:
|
|||||||
inline unsigned int getNumFaces(){return m_faces.size();};
|
inline unsigned int getNumFaces(){return m_faces.size();};
|
||||||
inline BOP_Indexs &getFaces(){return m_faces;};
|
inline BOP_Indexs &getFaces(){return m_faces;};
|
||||||
void addFace(BOP_Index face);
|
void addFace(BOP_Index face);
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
bool removeFace(BOP_Index i);
|
||||||
|
bool getUsed() { return m_used;};
|
||||||
|
void setUsed(bool setting) { m_used=setting;};
|
||||||
|
#endif
|
||||||
|
#ifdef BOP_DEBUG
|
||||||
|
friend ostream &operator<<(ostream &stream, BOP_Edge *e);
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -402,6 +402,7 @@ bool BOP_Face4::getEdgeIndex(BOP_Index v1, BOP_Index v2, unsigned int &e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOP_DEBUG
|
||||||
/**
|
/**
|
||||||
* Implements operator <<.
|
* Implements operator <<.
|
||||||
*/
|
*/
|
||||||
@@ -421,3 +422,4 @@ ostream &operator<<(ostream &stream, BOP_Face *f)
|
|||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "MT_Plane3.h"
|
#include "MT_Plane3.h"
|
||||||
#include "BOP_Indexs.h"
|
#include "BOP_Indexs.h"
|
||||||
#include "BOP_BBox.h"
|
#include "BOP_BBox.h"
|
||||||
|
#include "BOP_Misc.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -80,7 +81,9 @@ public:
|
|||||||
virtual void replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex) = 0;
|
virtual void replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex) = 0;
|
||||||
virtual bool containsVertex(BOP_Index v) = 0;
|
virtual bool containsVertex(BOP_Index v) = 0;
|
||||||
|
|
||||||
|
#ifdef BOP_DEBUG
|
||||||
friend ostream &operator<<(ostream &stream, BOP_Face *f);
|
friend ostream &operator<<(ostream &stream, BOP_Face *f);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class BOP_Face3: public BOP_Face
|
class BOP_Face3: public BOP_Face
|
||||||
|
@@ -33,9 +33,12 @@
|
|||||||
#include "BOP_Mesh.h"
|
#include "BOP_Mesh.h"
|
||||||
#include "BOP_Face2Face.h"
|
#include "BOP_Face2Face.h"
|
||||||
#include "BOP_Merge.h"
|
#include "BOP_Merge.h"
|
||||||
|
#include "BOP_Merge2.h"
|
||||||
#include "BOP_Chrono.h"
|
#include "BOP_Chrono.h"
|
||||||
|
|
||||||
//#define DEBUG
|
#if defined(BOP_ORIG_MERGE) && defined(BOP_NEW_MERGE)
|
||||||
|
#include "../../../source/blender/blenkernel/BKE_global.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
|
BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
|
||||||
BOP_Faces* facesA,
|
BOP_Faces* facesA,
|
||||||
@@ -208,7 +211,32 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Merge faces
|
// Merge faces
|
||||||
|
#ifdef BOP_ORIG_MERGE
|
||||||
|
#ifndef BOP_NEW_MERGE
|
||||||
BOP_Merge::getInstance().mergeFaces(meshC,numVertices);
|
BOP_Merge::getInstance().mergeFaces(meshC,numVertices);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
#ifndef BOP_ORIG_MERGE
|
||||||
|
BOP_Merge2::getInstance().mergeFaces(meshC,numVertices);
|
||||||
|
#else
|
||||||
|
static int state = -1;
|
||||||
|
if (G.rt == 100) {
|
||||||
|
if( state != 1 ) {
|
||||||
|
cout << "Boolean code using old merge technique." << endl;
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
BOP_Merge::getInstance().mergeFaces(meshC,numVertices);
|
||||||
|
} else {
|
||||||
|
if( state != 0 ) {
|
||||||
|
cout << "Boolean code using new merge technique." << endl;
|
||||||
|
state = 0;
|
||||||
|
}
|
||||||
|
BOP_Merge2::getInstance().mergeFaces(meshC,numVertices);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
c = chrono.stamp(); t += c;
|
c = chrono.stamp(); t += c;
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "BOP_Merge.h"
|
#include "BOP_Merge.h"
|
||||||
|
|
||||||
|
#ifdef BOP_ORIG_MERGE
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#if _MSC_VER < 1300
|
#if _MSC_VER < 1300
|
||||||
@@ -802,3 +803,5 @@ void BOP_Merge::getFaces(BOP_LFaces &facesByOriginalFace, BOP_Indexs vertices, B
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* BOP_ORIG_MERGE */
|
||||||
|
@@ -28,6 +28,9 @@
|
|||||||
#ifndef BOP_MERGE_H
|
#ifndef BOP_MERGE_H
|
||||||
#define BOP_MERGE_H
|
#define BOP_MERGE_H
|
||||||
|
|
||||||
|
#include "BOP_Misc.h"
|
||||||
|
|
||||||
|
#ifdef BOP_ORIG_MERGE
|
||||||
#include "BOP_Mesh.h"
|
#include "BOP_Mesh.h"
|
||||||
#include "BOP_Tag.h"
|
#include "BOP_Tag.h"
|
||||||
#include "BOP_MathUtils.h"
|
#include "BOP_MathUtils.h"
|
||||||
@@ -68,4 +71,6 @@ class BOP_Merge {
|
|||||||
void mergeFaces(BOP_Mesh *m, BOP_Index v);
|
void mergeFaces(BOP_Mesh *m, BOP_Index v);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* BOP_ORIG_MERGE */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
944
intern/boolop/intern/BOP_Merge2.cpp
Normal file
944
intern/boolop/intern/BOP_Merge2.cpp
Normal file
@@ -0,0 +1,944 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* $Id: BOP_Merge22.cpp 14444 2008-04-16 22:40:48Z hos $
|
||||||
|
*
|
||||||
|
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): Marc Freixas, Ken Hughes
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "BOP_Merge2.h"
|
||||||
|
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
|
||||||
|
static void deleteFace(BOP_Mesh *m, BOP_Face *face);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SINGLETON (use method BOP_Merge2.getInstance).
|
||||||
|
*/
|
||||||
|
BOP_Merge2 BOP_Merge2::SINGLETON;
|
||||||
|
|
||||||
|
#ifdef BOP_DEBUG
|
||||||
|
void dumpmesh ( BOP_Mesh *m, bool force )
|
||||||
|
{
|
||||||
|
unsigned int nonmanifold = 0;
|
||||||
|
{
|
||||||
|
BOP_Edges edges = m->getEdges();
|
||||||
|
int count = 0;
|
||||||
|
for (BOP_IT_Edges edge = edges.begin(); edge != edges.end();
|
||||||
|
++count, ++edge) {
|
||||||
|
if (!(*edge)->getUsed() && (*edge)->getFaces().size() == 0 ) continue;
|
||||||
|
BOP_Vertex * v1 = m->getVertex((*edge)->getVertex1());
|
||||||
|
BOP_Vertex * v2 = m->getVertex((*edge)->getVertex2());
|
||||||
|
|
||||||
|
if(v1->getTAG()!= BROKEN || v2->getTAG()!= BROKEN ) {
|
||||||
|
int fcount = 0;
|
||||||
|
BOP_Indexs faces = (*edge)->getFaces();
|
||||||
|
for (BOP_IT_Indexs face = faces.begin(); face != faces.end(); face++) {
|
||||||
|
BOP_Face *f = m->getFace(*face);
|
||||||
|
if(f->getTAG()== UNCLASSIFIED) ++fcount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(fcount !=0 && fcount !=2 ) {
|
||||||
|
++nonmanifold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!force && nonmanifold == 0) return;
|
||||||
|
}
|
||||||
|
if( nonmanifold )
|
||||||
|
cout << nonmanifold << " edges detected" << endl;
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "---------------------------" << endl;
|
||||||
|
|
||||||
|
BOP_Edges edges = m->getEdges();
|
||||||
|
int count = 0;
|
||||||
|
for (BOP_IT_Edges edge = edges.begin(); edge != edges.end();
|
||||||
|
++count, ++edge) {
|
||||||
|
BOP_Vertex * v1 = m->getVertex((*edge)->getVertex1());
|
||||||
|
BOP_Vertex * v2 = m->getVertex((*edge)->getVertex2());
|
||||||
|
|
||||||
|
if(v1->getTAG()!= BROKEN || v2->getTAG()!= BROKEN ) {
|
||||||
|
int fcount = 0;
|
||||||
|
BOP_Indexs faces = (*edge)->getFaces();
|
||||||
|
cout << count << ", " << (*edge) << ", " << faces.size() << endl;
|
||||||
|
for (BOP_IT_Indexs face = faces.begin(); face != faces.end(); face++) {
|
||||||
|
BOP_Face *f = m->getFace(*face);
|
||||||
|
if(f->getTAG()== UNCLASSIFIED) ++fcount;
|
||||||
|
cout << " face " << f << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(fcount !=0 && fcount !=2 )
|
||||||
|
cout << " NON-MANIFOLD" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOP_Faces faces = m->getFaces();
|
||||||
|
count = 0;
|
||||||
|
for (BOP_IT_Faces face = faces.begin(); face != faces.end(); face++) {
|
||||||
|
if( count < 12*2 || (*face)->getTAG() != BROKEN ) {
|
||||||
|
cout << count << ", " << *face << endl;
|
||||||
|
}
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOP_Vertexs verts = m->getVertexs();
|
||||||
|
count = 0;
|
||||||
|
for (BOP_IT_Vertexs vert = verts.begin(); vert != verts.end(); vert++) {
|
||||||
|
cout << count++ << ", " << *vert << " " << (*vert)->getNumEdges() << endl;
|
||||||
|
BOP_Indexs edges = (*vert)->getEdges();
|
||||||
|
for( BOP_IT_Indexs it = edges.begin(); it != edges.end(); ++it) {
|
||||||
|
BOP_Edge *edge = m->getEdge(*it);
|
||||||
|
cout << " " << edge << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout << "===========================" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplifies a mesh, merging its faces.
|
||||||
|
* @param m mesh
|
||||||
|
* @param v index of the first mergeable vertex (can be removed by merge)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v)
|
||||||
|
{
|
||||||
|
m_mesh = m;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "##############################" << endl;
|
||||||
|
#endif
|
||||||
|
cleanup( );
|
||||||
|
|
||||||
|
m_firstVertex = v;
|
||||||
|
bool cont = false;
|
||||||
|
|
||||||
|
// Merge faces
|
||||||
|
mergeFaces();
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Add quads ...
|
||||||
|
cont = createQuads();
|
||||||
|
// ... and merge new faces
|
||||||
|
if( cont ) cont = mergeFaces();
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "called mergeFaces " << cont << endl;
|
||||||
|
#endif
|
||||||
|
// ... until the merge is not succesful
|
||||||
|
} while(cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clean_nonmanifold( BOP_Mesh *m )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
|
BOP_Edges nme;
|
||||||
|
BOP_Edges e = m->getEdges();
|
||||||
|
for( BOP_IT_Edges it = e.begin(); it != e.end(); ++it ) {
|
||||||
|
BOP_Indexs faces = (*it)->getFaces();
|
||||||
|
if( faces.size() & ~2 )
|
||||||
|
nme.push_back(*it);
|
||||||
|
}
|
||||||
|
if (nme.size() == 0) return;
|
||||||
|
for( BOP_IT_Edges it = nme.begin(); it != nme.end(); ++it ) {
|
||||||
|
if( (*it)->getFaces().size() > 1 ) {
|
||||||
|
BOP_Indexs faces = (*it)->getFaces();
|
||||||
|
for( BOP_IT_Indexs face = faces.begin(); face != faces.end(); ++face ) {
|
||||||
|
MT_Point3 vertex1 = m->getVertex(m->getFace(*face)->getVertex(0))->getPoint();
|
||||||
|
MT_Point3 vertex2 = m->getVertex(m->getFace(*face)->getVertex(1))->getPoint();
|
||||||
|
MT_Point3 vertex3 = m->getVertex(m->getFace(*face)->getVertex(2))->getPoint();
|
||||||
|
if (BOP_collinear(vertex1,vertex2,vertex3)) // collinear triangle
|
||||||
|
deleteFace(m,m->getFace(*face));
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BOP_Face *oface1 = m->getFace((*it)->getFaces().front());
|
||||||
|
BOP_Face *oface2, *tmpface;
|
||||||
|
BOP_Index first =(*it)->getVertex1();
|
||||||
|
BOP_Index next =(*it)->getVertex2();
|
||||||
|
BOP_Index last = first;
|
||||||
|
unsigned short facecount = 0;
|
||||||
|
bool found = false;
|
||||||
|
BOP_Indexs vertList;
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " first edge is " << (*it) << endl;
|
||||||
|
#endif
|
||||||
|
vertList.push_back(first);
|
||||||
|
BOP_Edge *edge;
|
||||||
|
while(true) {
|
||||||
|
BOP_Vertex *vert = m->getVertex(next);
|
||||||
|
BOP_Indexs edges = vert->getEdges();
|
||||||
|
edge = NULL;
|
||||||
|
for( BOP_IT_Indexs eit = edges.begin(); eit != edges.end(); ++eit) {
|
||||||
|
edge = m->getEdge(*eit);
|
||||||
|
if( edge->getFaces().size() > 1) {
|
||||||
|
edge = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if( edge->getVertex1() == next && edge->getVertex2() != last ) {
|
||||||
|
last = next;
|
||||||
|
next = edge->getVertex2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( edge->getVertex2() == next && edge->getVertex1() != last ) {
|
||||||
|
last = next;
|
||||||
|
next = edge->getVertex1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
edge = NULL;
|
||||||
|
}
|
||||||
|
if( !edge ) break;
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " next edge is " << edge << endl;
|
||||||
|
#endif
|
||||||
|
tmpface = m->getFace(edge->getFaces().front());
|
||||||
|
if( oface1->getOriginalFace() != tmpface->getOriginalFace() )
|
||||||
|
oface2 = tmpface;
|
||||||
|
else
|
||||||
|
++facecount;
|
||||||
|
vertList.push_back(last);
|
||||||
|
if( vertList.size() > 3 ) break;
|
||||||
|
if( next == first ) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(found) {
|
||||||
|
edge = *it;
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " --> found a loop" << endl;
|
||||||
|
#endif
|
||||||
|
if( vertList.size() == 3 ) {
|
||||||
|
BOP_Face3 *face = (BOP_Face3 *)m->getFace(edge->getFaces().front());
|
||||||
|
face->getNeighbours(first,last,next);
|
||||||
|
} else if( vertList.size() == 4 ) {
|
||||||
|
BOP_Face4 *face = (BOP_Face4 *)m->getFace(edge->getFaces().front());
|
||||||
|
face->getNeighbours(first,last,next,last);
|
||||||
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "loop has " << vertList.size() << "verts";
|
||||||
|
#endif
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(facecount == 1) oface1 = oface2;
|
||||||
|
next = vertList[1];
|
||||||
|
last = vertList[2];
|
||||||
|
if( edge->getVertex2() == next ) {
|
||||||
|
BOP_Face3 *f = new BOP_Face3(next,first,last,
|
||||||
|
oface1->getPlane(),oface1->getOriginalFace());
|
||||||
|
m->addFace( f );
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " face is backward: " << f << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
BOP_Face3 *f = new BOP_Face3(last,first,next,
|
||||||
|
oface1->getPlane(),oface1->getOriginalFace());
|
||||||
|
m->addFace( f );
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " face is forward: " << f << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs through mesh and makes sure vert/face/edge data is consistent. Most
|
||||||
|
* importantly:
|
||||||
|
* (1) mark edges which are no longer used
|
||||||
|
* (2) remove broken faces from edges
|
||||||
|
* (3) remove faces from mesh which have a single edge belonging to no other
|
||||||
|
* face (non-manifold edges)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void BOP_Merge2::cleanup( void )
|
||||||
|
{
|
||||||
|
BOP_Edges edges = m_mesh->getEdges();
|
||||||
|
for (BOP_IT_Edges edge = edges.begin(); edge != edges.end(); ++edge) {
|
||||||
|
BOP_Indexs faces = (*edge)->getFaces();
|
||||||
|
for (BOP_IT_Indexs face = faces.begin(); face != faces.end(); ++face) {
|
||||||
|
BOP_Face *f = m_mesh->getFace(*face);
|
||||||
|
if(f->getTAG()== UNCLASSIFIED) ;
|
||||||
|
else (*edge)->removeFace(*face);
|
||||||
|
}
|
||||||
|
if( (*edge)->getFaces().size() == 0) (*edge)->setUsed(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOP_Vertexs v = m_mesh->getVertexs();
|
||||||
|
for( BOP_IT_Vertexs it = v.begin(); it != v.end(); ++it ) {
|
||||||
|
if( (*it)->getTAG() != BROKEN) {
|
||||||
|
BOP_Indexs edges = (*it)->getEdges();
|
||||||
|
for(BOP_IT_Indexs i = edges.begin();i!=edges.end();i++)
|
||||||
|
if( m_mesh->getEdge((*i))->getUsed( ) == false) (*it)->removeEdge( *i );
|
||||||
|
if( (*it)->getEdges().size() == 0 ) (*it)->setTAG(BROKEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// clean_nonmanifold( m_mesh );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplifies a mesh, merging its faces.
|
||||||
|
*/
|
||||||
|
bool BOP_Merge2::mergeFaces()
|
||||||
|
{
|
||||||
|
BOP_Indexs mergeVertices;
|
||||||
|
BOP_Vertexs vertices = m_mesh->getVertexs();
|
||||||
|
BOP_IT_Vertexs v = vertices.begin();
|
||||||
|
const BOP_IT_Vertexs verticesEnd = vertices.end();
|
||||||
|
|
||||||
|
// Advance to first mergeable vertex
|
||||||
|
advance(v,m_firstVertex);
|
||||||
|
BOP_Index pos = m_firstVertex;
|
||||||
|
|
||||||
|
// Add unbroken vertices to the list
|
||||||
|
while(v!=verticesEnd) {
|
||||||
|
if ((*v)->getTAG() != BROKEN) {
|
||||||
|
mergeVertices.push_back(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
v++;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge faces with that vertices
|
||||||
|
return mergeFaces(mergeVertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove edges from vertices when the vertex is removed
|
||||||
|
*/
|
||||||
|
void BOP_Merge2::freeVerts(BOP_Index v, BOP_Vertex *vert)
|
||||||
|
{
|
||||||
|
BOP_Indexs edges = vert->getEdges();
|
||||||
|
BOP_Vertex *other;
|
||||||
|
|
||||||
|
for( BOP_IT_Indexs it = edges.begin(); it != edges.end(); ++it) {
|
||||||
|
BOP_Edge *edge = m_mesh->getEdge(*it);
|
||||||
|
BOP_Indexs edges2;
|
||||||
|
if( edge->getVertex1() != v )
|
||||||
|
other = m_mesh->getVertex( edge->getVertex1() );
|
||||||
|
else
|
||||||
|
other = m_mesh->getVertex( edge->getVertex2() );
|
||||||
|
other->removeEdge(*it);
|
||||||
|
vert->removeEdge(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplifies a mesh, merging the faces with the specified vertices.
|
||||||
|
* @param mergeVertices vertices to test
|
||||||
|
* @return true if a face merge was performed
|
||||||
|
*/
|
||||||
|
bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices)
|
||||||
|
{
|
||||||
|
// Check size > 0!
|
||||||
|
if (mergeVertices.size() == 0) return false;
|
||||||
|
bool didMerge = false;
|
||||||
|
|
||||||
|
for( BOP_Index i = 0; i < mergeVertices.size(); ++i ) {
|
||||||
|
BOP_LFaces facesByOriginalFace;
|
||||||
|
BOP_Index v = mergeVertices[i];
|
||||||
|
BOP_Vertex *vert = m_mesh->getVertex(v);
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "i = " << i << ", v = " << v << ", vert = " << vert << endl;
|
||||||
|
if (v==48)
|
||||||
|
cout << "found vert 48" << endl;
|
||||||
|
#endif
|
||||||
|
if ( vert->getTAG() != BROKEN ) {
|
||||||
|
getFaces(facesByOriginalFace,v);
|
||||||
|
|
||||||
|
switch (facesByOriginalFace.size()) {
|
||||||
|
case 0:
|
||||||
|
// v has no unbroken faces (so it's a new BROKEN vertex)
|
||||||
|
freeVerts( v, vert );
|
||||||
|
vert->setTAG(BROKEN);
|
||||||
|
break;
|
||||||
|
case 2: {
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "size of fBOF = " << facesByOriginalFace.size() << endl;
|
||||||
|
#endif
|
||||||
|
BOP_Faces ff = facesByOriginalFace.front();
|
||||||
|
BOP_Faces fb = facesByOriginalFace.back();
|
||||||
|
BOP_Index eindexs[2];
|
||||||
|
int ecount = 0;
|
||||||
|
|
||||||
|
// look for two edges adjacent to v which contain both ofaces
|
||||||
|
BOP_Indexs edges = vert->getEdges();
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " ff has " << ff.size() << " faces" << endl;
|
||||||
|
cout << " fb has " << fb.size() << " faces" << endl;
|
||||||
|
cout << " v has " << edges.size() << " edges" << endl;
|
||||||
|
#endif
|
||||||
|
for(BOP_IT_Indexs it = edges.begin(); it != edges.end();
|
||||||
|
++it ) {
|
||||||
|
BOP_Edge *edge = m_mesh->getEdge(*it);
|
||||||
|
BOP_Indexs faces = edge->getFaces();
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " " << edge << " has " << edge->getFaces().size() << " faces" << endl;
|
||||||
|
#endif
|
||||||
|
if( faces.size() == 2 ) {
|
||||||
|
BOP_Face *f0 = m_mesh->getFace(faces[0]);
|
||||||
|
BOP_Face *f1 = m_mesh->getFace(faces[1]);
|
||||||
|
if( f0->getOriginalFace() != f1->getOriginalFace() ) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " " << f0 << endl;
|
||||||
|
cout << " " << f1 << endl;
|
||||||
|
#endif
|
||||||
|
eindexs[ecount++] = (*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ecount == 2) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " edge indexes are " << eindexs[0];
|
||||||
|
cout << " and " << eindexs[1] << endl;
|
||||||
|
#endif
|
||||||
|
BOP_Edge *edge = m_mesh->getEdge(eindexs[0]);
|
||||||
|
BOP_Index N = edge->getVertex1();
|
||||||
|
if(N == v) N = edge->getVertex2();
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " ## OK, replace "<<v<<" with "<<N << endl;
|
||||||
|
#endif
|
||||||
|
mergeVertex(ff , v, N );
|
||||||
|
mergeVertex(fb , v, N );
|
||||||
|
// now remove v and its edges
|
||||||
|
vert->setTAG(BROKEN);
|
||||||
|
for(BOP_IT_Indexs it = edges.begin(); it != edges.end();
|
||||||
|
++it ) {
|
||||||
|
BOP_Edge *edge = m_mesh->getEdge(*it);
|
||||||
|
edge->setUsed(false);
|
||||||
|
}
|
||||||
|
didMerge = true;
|
||||||
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
else {
|
||||||
|
cout << " HUH: ecount was " << ecount << endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return didMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BOP_Merge2::mergeVertex(BOP_Faces &faces, BOP_Index v1, BOP_Index v2)
|
||||||
|
{
|
||||||
|
for(BOP_IT_Faces face=faces.begin();face!=faces.end();face++) {
|
||||||
|
if( (*face)->size() == 3)
|
||||||
|
mergeVertex((BOP_Face3 *) *face, v1, v2);
|
||||||
|
else
|
||||||
|
mergeVertex((BOP_Face4 *) *face, v1, v2);
|
||||||
|
(*face)->setTAG(BROKEN);
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << " breaking " << (*face) << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove a face from the mesh and from each edges's face list
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void deleteFace(BOP_Mesh *m, BOP_Face *face)
|
||||||
|
{
|
||||||
|
BOP_Index l2 = face->getVertex(0);
|
||||||
|
BOP_Faces faces = m->getFaces();
|
||||||
|
for(int i = face->size(); i-- ; ) {
|
||||||
|
BOP_Indexs edges = m->getVertex(l2)->getEdges();
|
||||||
|
BOP_Index l1 = face->getVertex(i);
|
||||||
|
for(BOP_IT_Indexs it1 = edges.begin(); it1 != edges.end(); ++it1 ) {
|
||||||
|
BOP_Edge *edge = m->getEdge(*it1);
|
||||||
|
if( ( edge->getVertex1() == l1 && edge->getVertex2() == l2 ) ||
|
||||||
|
( edge->getVertex1() == l2 && edge->getVertex2() == l1 ) ) {
|
||||||
|
BOP_Indexs ef = edge->getFaces();
|
||||||
|
for(BOP_IT_Indexs it = ef.begin(); it != ef.end(); ++it ) {
|
||||||
|
if( m->getFace(*it) == face) {
|
||||||
|
edge->removeFace(*it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l2 = l1;
|
||||||
|
}
|
||||||
|
face->setTAG(BROKEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BOP_Merge2::mergeVertex(BOP_Face3 *face, BOP_Index v1, BOP_Index v2)
|
||||||
|
{
|
||||||
|
BOP_Index next, prev;
|
||||||
|
face->getNeighbours(v1,prev,next);
|
||||||
|
|
||||||
|
// if new vertex is not already in the tri, make a new tri
|
||||||
|
if( prev != v2 && next != v2 ) {
|
||||||
|
m_mesh->addFace( new BOP_Face3(prev,v2,next,
|
||||||
|
face->getPlane(),face->getOriginalFace()) );
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "mv3: add " << prev << "," << v2 << "," << next << endl;
|
||||||
|
} else {
|
||||||
|
cout << "mv3: vertex already in tri: doing nothing" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
deleteFace(m_mesh, face);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2)
|
||||||
|
{
|
||||||
|
BOP_Index next, prev, opp;
|
||||||
|
face->getNeighbours(v1,prev,next,opp);
|
||||||
|
|
||||||
|
// if new vertex is already in the quad, replace quad with new tri
|
||||||
|
if( prev == v2 || next == v2 ) {
|
||||||
|
m_mesh->addFace( new BOP_Face3(prev,next,opp,
|
||||||
|
face->getPlane(),face->getOriginalFace()) );
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "mv4a: add " << prev << "," << next << "," << opp << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// otherwise make a new quad
|
||||||
|
else {
|
||||||
|
m_mesh->addFace( new BOP_Face4(prev,v2,next,opp,
|
||||||
|
face->getPlane(),face->getOriginalFace()) );
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "mv4b: add "<<prev<<","<<v2<<","<<next<<","<<opp<<endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
deleteFace(m_mesh, face);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #define OLD_QUAD
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplifies the mesh, merging the pairs of triangles that come frome the
|
||||||
|
* same original face and define a quad.
|
||||||
|
* @return true if a quad was added, false otherwise
|
||||||
|
*/
|
||||||
|
bool BOP_Merge2::createQuads()
|
||||||
|
{
|
||||||
|
|
||||||
|
BOP_Faces quads;
|
||||||
|
|
||||||
|
// Get mesh faces
|
||||||
|
BOP_Faces faces = m_mesh->getFaces();
|
||||||
|
|
||||||
|
// Merge mesh triangles
|
||||||
|
const BOP_IT_Faces facesIEnd = (faces.end()-1);
|
||||||
|
const BOP_IT_Faces facesJEnd = faces.end();
|
||||||
|
for(BOP_IT_Faces faceI=faces.begin();faceI!=facesIEnd;faceI++) {
|
||||||
|
#ifdef OLD_QUAD
|
||||||
|
if ((*faceI)->getTAG() == BROKEN || (*faceI)->size() != 3) continue;
|
||||||
|
for(BOP_IT_Faces faceJ=(faceI+1);faceJ!=facesJEnd;faceJ++) {
|
||||||
|
if ((*faceJ)->getTAG() == BROKEN || (*faceJ)->size() != 3 ||
|
||||||
|
(*faceJ)->getOriginalFace() != (*faceI)->getOriginalFace()) continue;
|
||||||
|
|
||||||
|
|
||||||
|
BOP_Face *faceK = createQuad((BOP_Face3*)*faceI,(BOP_Face3*)*faceJ);
|
||||||
|
if (faceK != NULL) {
|
||||||
|
// Set triangles to BROKEN
|
||||||
|
deleteFace(m_mesh, *faceI);
|
||||||
|
deleteFace(m_mesh, *faceJ);
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "createQuad: del " << *faceI << endl;
|
||||||
|
cout << "createQuad: del " << *faceJ << endl;
|
||||||
|
cout << "createQuad: add " << faceK << endl;
|
||||||
|
#endif
|
||||||
|
quads.push_back(faceK);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if ((*faceI)->getTAG() == BROKEN ) continue;
|
||||||
|
for(BOP_IT_Faces faceJ=(faceI+1);faceJ!=facesJEnd;faceJ++) {
|
||||||
|
if ((*faceJ)->getTAG() == BROKEN ||
|
||||||
|
(*faceJ)->getOriginalFace() != (*faceI)->getOriginalFace()) continue;
|
||||||
|
|
||||||
|
BOP_Face *faceK = NULL;
|
||||||
|
if((*faceI)->size() == 3) {
|
||||||
|
if((*faceJ)->size() == 3)
|
||||||
|
faceK = createQuad((BOP_Face3*)*faceI,(BOP_Face3*)*faceJ);
|
||||||
|
else
|
||||||
|
faceK = createQuad((BOP_Face3*)*faceI,(BOP_Face4*)*faceJ);
|
||||||
|
} else {
|
||||||
|
if((*faceJ)->size() == 3)
|
||||||
|
faceK = createQuad((BOP_Face3*)*faceJ,(BOP_Face4*)*faceI);
|
||||||
|
else
|
||||||
|
faceK = createQuad((BOP_Face4*)*faceI,(BOP_Face4*)*faceJ);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (faceK != NULL) {
|
||||||
|
// Set triangles to BROKEN
|
||||||
|
deleteFace(m_mesh, *faceI);
|
||||||
|
deleteFace(m_mesh, *faceJ);
|
||||||
|
#ifdef DEBUG
|
||||||
|
cout << "createQuad: del " << *faceI << endl;
|
||||||
|
cout << "createQuad: del " << *faceJ << endl;
|
||||||
|
cout << "createQuad: add " << faceK << endl;
|
||||||
|
#endif
|
||||||
|
quads.push_back(faceK);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add quads to mesh
|
||||||
|
const BOP_IT_Faces quadsEnd = quads.end();
|
||||||
|
for(BOP_IT_Faces quad=quads.begin();quad!=quadsEnd;quad++) m_mesh->addFace(*quad);
|
||||||
|
return (quads.size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new quad (convex) from the merge of two triangles that share the
|
||||||
|
* vertex index v.
|
||||||
|
* @param faceI mesh triangle
|
||||||
|
* @param faceJ mesh triangle
|
||||||
|
* @param v vertex index shared by both triangles
|
||||||
|
* @return a new convex quad if the merge is possible
|
||||||
|
*/
|
||||||
|
BOP_Face* BOP_Merge2::createQuad(BOP_Face3 *faceI, BOP_Face3 *faceJ)
|
||||||
|
{
|
||||||
|
// Test if both triangles share a vertex index
|
||||||
|
BOP_Index v;
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0;i<3 ;i++) {
|
||||||
|
v = faceI->getVertex(i);
|
||||||
|
if( faceJ->containsVertex(v) ) break;
|
||||||
|
}
|
||||||
|
if (i == 3) return NULL;
|
||||||
|
|
||||||
|
BOP_Face *faceK = NULL;
|
||||||
|
|
||||||
|
// Get faces data
|
||||||
|
BOP_Index prevI, nextI, prevJ, nextJ;
|
||||||
|
faceI->getNeighbours(v,prevI,nextI);
|
||||||
|
faceJ->getNeighbours(v,prevJ,nextJ);
|
||||||
|
MT_Point3 vertex = m_mesh->getVertex(v)->getPoint();
|
||||||
|
MT_Point3 vPrevI = m_mesh->getVertex(prevI)->getPoint();
|
||||||
|
MT_Point3 vNextI = m_mesh->getVertex(nextI)->getPoint();
|
||||||
|
MT_Point3 vPrevJ = m_mesh->getVertex(prevJ)->getPoint();
|
||||||
|
MT_Point3 vNextJ = m_mesh->getVertex(nextJ)->getPoint();
|
||||||
|
|
||||||
|
// Quad test
|
||||||
|
if (prevI == nextJ) {
|
||||||
|
if (!BOP_collinear(vNextI,vertex,vPrevJ) && !BOP_collinear(vNextI,vPrevI,vPrevJ) &&
|
||||||
|
BOP_convex(vertex,vNextI,vPrevI,vPrevJ)) {
|
||||||
|
faceK = new BOP_Face4(v,nextI,prevI,prevJ,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
BOP_Index edge;
|
||||||
|
m_mesh->getIndexEdge(v,prevI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (nextI == prevJ) {
|
||||||
|
if (!BOP_collinear(vPrevI,vertex,vNextJ) && !BOP_collinear(vPrevI,vNextI,vNextJ) &&
|
||||||
|
BOP_convex(vertex,vNextJ,vNextI,vPrevI)) {
|
||||||
|
faceK = new BOP_Face4(v,nextJ,nextI,prevI,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
BOP_Index edge;
|
||||||
|
m_mesh->getIndexEdge(v,nextI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return faceK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new quad (convex) from the merge of two triangles that share the
|
||||||
|
* vertex index v.
|
||||||
|
* @param faceI mesh triangle
|
||||||
|
* @param faceJ mesh triangle
|
||||||
|
* @param v vertex index shared by both triangles
|
||||||
|
* @return a new convex quad if the merge is possible
|
||||||
|
*/
|
||||||
|
BOP_Face* BOP_Merge2::createQuad(BOP_Face3 *faceI, BOP_Face4 *faceJ)
|
||||||
|
{
|
||||||
|
// Test if triangle and quad share a vertex index
|
||||||
|
BOP_Index v;
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0;i<3 ;i++) {
|
||||||
|
v = faceI->getVertex(i);
|
||||||
|
if( faceJ->containsVertex(v) ) break;
|
||||||
|
}
|
||||||
|
if (i == 3) return NULL;
|
||||||
|
|
||||||
|
BOP_Face *faceK = NULL;
|
||||||
|
|
||||||
|
// Get faces data
|
||||||
|
BOP_Index prevI, nextI, prevJ, nextJ, oppJ;
|
||||||
|
faceI->getNeighbours(v,prevI,nextI);
|
||||||
|
faceJ->getNeighbours(v,prevJ,nextJ,oppJ);
|
||||||
|
|
||||||
|
// Quad test
|
||||||
|
BOP_Index edge;
|
||||||
|
if (nextI == prevJ) {
|
||||||
|
if (prevI == nextJ) { // v is in center
|
||||||
|
faceK = new BOP_Face3(nextJ,oppJ,prevJ,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
m_mesh->getIndexEdge(v,prevI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
m_mesh->getIndexEdge(v,nextI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
freeVerts(v, m_mesh->getVertex(v));
|
||||||
|
} else if (prevI == oppJ) { // nextI is in center
|
||||||
|
faceK = new BOP_Face3(v,nextJ,oppJ,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
m_mesh->getIndexEdge(v,nextI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
m_mesh->getIndexEdge(prevI,nextI,edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
freeVerts(nextI, m_mesh->getVertex(nextI));
|
||||||
|
}
|
||||||
|
} else if (nextI == oppJ && prevI == nextJ ) { // prevI is in center
|
||||||
|
faceK = new BOP_Face3(prevJ,v,oppJ,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
m_mesh->getIndexEdge(v,prevI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
m_mesh->getIndexEdge(nextI,prevI,edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
freeVerts(prevI, m_mesh->getVertex(prevI));
|
||||||
|
}
|
||||||
|
return faceK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new quad (convex) from the merge of two triangles that share the
|
||||||
|
* vertex index v.
|
||||||
|
* @param faceI mesh triangle
|
||||||
|
* @param faceJ mesh triangle
|
||||||
|
* @param v vertex index shared by both triangles
|
||||||
|
* @return a new convex quad if the merge is possible
|
||||||
|
*/
|
||||||
|
BOP_Face* BOP_Merge2::createQuad(BOP_Face4 *faceI, BOP_Face4 *faceJ)
|
||||||
|
{
|
||||||
|
BOP_Face *faceK = NULL;
|
||||||
|
//
|
||||||
|
// Test if both quads share a vertex index
|
||||||
|
//
|
||||||
|
BOP_Index v;
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0;i<4 ;i++) {
|
||||||
|
v = faceI->getVertex(i);
|
||||||
|
if( faceJ->containsVertex(v) ) break;
|
||||||
|
}
|
||||||
|
if (i == 3) return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
// Get faces data
|
||||||
|
BOP_Index prevI, nextI, oppI, prevJ, nextJ, oppJ;
|
||||||
|
faceI->getNeighbours(v,prevI,nextI,oppI);
|
||||||
|
faceJ->getNeighbours(v,prevJ,nextJ,oppJ);
|
||||||
|
|
||||||
|
// Quad test
|
||||||
|
BOP_Index edge;
|
||||||
|
if (nextI == prevJ) {
|
||||||
|
if (prevI == nextJ) { // v is in center
|
||||||
|
faceK = new BOP_Face4(nextI,oppI,nextJ,oppJ,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
m_mesh->getIndexEdge(v,prevI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
m_mesh->getIndexEdge(v,nextI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
freeVerts(v, m_mesh->getVertex(v));
|
||||||
|
} else if (oppI == oppJ) { // nextI is in center
|
||||||
|
faceK = new BOP_Face4(v,nextJ,oppJ,prevI,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
m_mesh->getIndexEdge(v,nextI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
m_mesh->getIndexEdge(prevI,nextI,edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
freeVerts(nextI, m_mesh->getVertex(nextI));
|
||||||
|
}
|
||||||
|
} else if (prevI == nextJ && oppI == oppJ) { // prevI is in center
|
||||||
|
faceK = new BOP_Face4(v,nextI,oppJ,prevJ,faceI->getPlane(),faceI->getOriginalFace());
|
||||||
|
faceK->setTAG(faceI->getTAG());
|
||||||
|
m_mesh->getIndexEdge(v,prevI,edge);
|
||||||
|
m_mesh->getVertex(v)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
m_mesh->getIndexEdge(nextI,prevI,edge);
|
||||||
|
m_mesh->getVertex(nextI)->removeEdge(edge);
|
||||||
|
m_mesh->getVertex(prevI)->removeEdge(edge);
|
||||||
|
freeVerts(prevI, m_mesh->getVertex(prevI));
|
||||||
|
}
|
||||||
|
return faceK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if a index is inside a set of indexs.
|
||||||
|
* @param indexs set of indexs
|
||||||
|
* @param i index
|
||||||
|
* @return true if the index is inside the set, false otherwise
|
||||||
|
*/
|
||||||
|
bool BOP_Merge2::containsIndex(BOP_Indexs indexs, BOP_Index i)
|
||||||
|
{
|
||||||
|
const BOP_IT_Indexs indexsEnd = indexs.end();
|
||||||
|
for(BOP_IT_Indexs it=indexs.begin();it!=indexsEnd;it++) {
|
||||||
|
if (*it == i) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a list of lists L1, L2, ... LN where
|
||||||
|
* LX = mesh faces with vertex v that come from the same original face
|
||||||
|
* @param facesByOriginalFace list of faces lists
|
||||||
|
* @param v vertex index
|
||||||
|
*/
|
||||||
|
void BOP_Merge2::getFaces(BOP_LFaces &facesByOriginalFace, BOP_Index v)
|
||||||
|
{
|
||||||
|
// Get edges with vertex v
|
||||||
|
|
||||||
|
BOP_Indexs edgeIndexs = m_mesh->getVertex(v)->getEdges();
|
||||||
|
const BOP_IT_Indexs edgeEnd = edgeIndexs.end();
|
||||||
|
for(BOP_IT_Indexs edgeIndex = edgeIndexs.begin();edgeIndex != edgeEnd;edgeIndex++) {
|
||||||
|
// For each edge, add its no broken faces to the output list
|
||||||
|
BOP_Edge* edge = m_mesh->getEdge(*edgeIndex);
|
||||||
|
BOP_Indexs faceIndexs = edge->getFaces();
|
||||||
|
const BOP_IT_Indexs faceEnd = faceIndexs.end();
|
||||||
|
for(BOP_IT_Indexs faceIndex=faceIndexs.begin();faceIndex!=faceEnd;faceIndex++) {
|
||||||
|
BOP_Face* face = m_mesh->getFace(*faceIndex);
|
||||||
|
if (face->getTAG() != BROKEN) {
|
||||||
|
bool found = false;
|
||||||
|
// Search if we already have created a list for the
|
||||||
|
// faces that come from the same original face
|
||||||
|
const BOP_IT_LFaces lfEnd = facesByOriginalFace.end();
|
||||||
|
for(BOP_IT_LFaces facesByOriginalFaceX=facesByOriginalFace.begin();
|
||||||
|
facesByOriginalFaceX!=lfEnd; facesByOriginalFaceX++) {
|
||||||
|
if (((*facesByOriginalFaceX)[0])->getOriginalFace() == face->getOriginalFace()) {
|
||||||
|
// Search that the face has not been added to the list before
|
||||||
|
for(unsigned int i = 0;i<(*facesByOriginalFaceX).size();i++) {
|
||||||
|
if ((*facesByOriginalFaceX)[i] == face) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// Add the face to the list
|
||||||
|
if (face->getTAG()==OVERLAPPED) facesByOriginalFaceX->insert(facesByOriginalFaceX->begin(),face);
|
||||||
|
else facesByOriginalFaceX->push_back(face);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// Create a new list and add the current face
|
||||||
|
BOP_Faces facesByOriginalFaceX;
|
||||||
|
facesByOriginalFaceX.push_back(face);
|
||||||
|
facesByOriginalFace.push_back(facesByOriginalFaceX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a list of lists L1, L2, ... LN where
|
||||||
|
* LX = mesh faces with vertex v that come from the same original face
|
||||||
|
* and without any of the vertices that appear before v in vertices
|
||||||
|
* @param facesByOriginalFace list of faces lists
|
||||||
|
* @param vertices vector with vertices indexs that contains v
|
||||||
|
* @param v vertex index
|
||||||
|
*/
|
||||||
|
void BOP_Merge2::getFaces(BOP_LFaces &facesByOriginalFace, BOP_Indexs vertices, BOP_Index v)
|
||||||
|
{
|
||||||
|
// Get edges with vertex v
|
||||||
|
BOP_Indexs edgeIndexs = m_mesh->getVertex(v)->getEdges();
|
||||||
|
const BOP_IT_Indexs edgeEnd = edgeIndexs.end();
|
||||||
|
for(BOP_IT_Indexs edgeIndex = edgeIndexs.begin();edgeIndex != edgeEnd;edgeIndex++) {
|
||||||
|
// Foreach edge, add its no broken faces to the output list
|
||||||
|
BOP_Edge* edge = m_mesh->getEdge(*edgeIndex);
|
||||||
|
BOP_Indexs faceIndexs = edge->getFaces();
|
||||||
|
const BOP_IT_Indexs faceEnd = faceIndexs.end();
|
||||||
|
for(BOP_IT_Indexs faceIndex=faceIndexs.begin();faceIndex!=faceEnd;faceIndex++) {
|
||||||
|
BOP_Face* face = m_mesh->getFace(*faceIndex);
|
||||||
|
if (face->getTAG() != BROKEN) {
|
||||||
|
// Search if the face contains any of the forbidden vertices
|
||||||
|
bool found = false;
|
||||||
|
for(BOP_IT_Indexs vertex = vertices.begin();*vertex!= v;vertex++) {
|
||||||
|
if (face->containsVertex(*vertex)) {
|
||||||
|
// face contains a forbidden vertex!
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// Search if we already have created a list with the
|
||||||
|
// faces that come from the same original face
|
||||||
|
const BOP_IT_LFaces lfEnd = facesByOriginalFace.end();
|
||||||
|
for(BOP_IT_LFaces facesByOriginalFaceX=facesByOriginalFace.begin();
|
||||||
|
facesByOriginalFaceX!=lfEnd; facesByOriginalFaceX++) {
|
||||||
|
if (((*facesByOriginalFaceX)[0])->getOriginalFace() == face->getOriginalFace()) {
|
||||||
|
// Search that the face has not been added to the list before
|
||||||
|
for(unsigned int i = 0;i<(*facesByOriginalFaceX).size();i++) {
|
||||||
|
if ((*facesByOriginalFaceX)[i] == face) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// Add face to the list
|
||||||
|
if (face->getTAG()==OVERLAPPED) facesByOriginalFaceX->insert(facesByOriginalFaceX->begin(),face);
|
||||||
|
else facesByOriginalFaceX->push_back(face);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// Create a new list and add the current face
|
||||||
|
BOP_Faces facesByOriginalFaceX;
|
||||||
|
facesByOriginalFaceX.push_back(face);
|
||||||
|
facesByOriginalFace.push_back(facesByOriginalFaceX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BOP_NEW_MERGE */
|
99
intern/boolop/intern/BOP_Merge2.h
Normal file
99
intern/boolop/intern/BOP_Merge2.h
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/**
|
||||||
|
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOP_MERGE2_H
|
||||||
|
#define BOP_MERGE2_H
|
||||||
|
|
||||||
|
#include "BOP_Misc.h"
|
||||||
|
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
|
||||||
|
#include "BOP_Mesh.h"
|
||||||
|
#include "BOP_Tag.h"
|
||||||
|
#include "BOP_MathUtils.h"
|
||||||
|
#include "MEM_SmartPtr.h"
|
||||||
|
|
||||||
|
typedef vector< BOP_Faces > BOP_LFaces;
|
||||||
|
typedef vector< BOP_Faces >::iterator BOP_IT_LFaces;
|
||||||
|
|
||||||
|
class BOP_Merge2 {
|
||||||
|
private:
|
||||||
|
BOP_Mesh* m_mesh;
|
||||||
|
BOP_Index m_firstVertex;
|
||||||
|
static BOP_Merge2 SINGLETON;
|
||||||
|
|
||||||
|
BOP_Merge2() {};
|
||||||
|
bool mergeFaces();
|
||||||
|
bool mergeFaces(BOP_Indexs &mergeVertices);
|
||||||
|
bool mergeFaces(BOP_Faces &oldFaces, BOP_Faces &newFaces, BOP_Indexs &vertices, BOP_Index v);
|
||||||
|
bool mergeFaces(BOP_Faces &faces, BOP_Faces &oldFaces, BOP_Faces &newFaces, BOP_Indexs &vertices, BOP_Index v);
|
||||||
|
BOP_Face *mergeFaces(BOP_Face *faceI, BOP_Face *faceJ, BOP_Index v);
|
||||||
|
BOP_Face *mergeFaces(BOP_Face *faceI, BOP_Face *faceJ, BOP_Indexs &pending, BOP_Index v);
|
||||||
|
BOP_Face *mergeFaces(BOP_Face3 *faceI, BOP_Face3 *faceJ, BOP_Index v);
|
||||||
|
BOP_Face *mergeFaces(BOP_Face4 *faceI, BOP_Face3 *faceJ, BOP_Index v);
|
||||||
|
BOP_Face *mergeFaces(BOP_Face4 *faceI, BOP_Face3 *faceJ, BOP_Indexs &pending, BOP_Index v);
|
||||||
|
BOP_Face *mergeFaces(BOP_Face4 *faceI, BOP_Face4 *faceJ, BOP_Indexs &pending, BOP_Index v);
|
||||||
|
bool createQuads();
|
||||||
|
bool containsIndex(BOP_Indexs indexs, BOP_Index index);
|
||||||
|
void getFaces(BOP_LFaces &facesByOriginalFace, BOP_Index v);
|
||||||
|
void getFaces(BOP_LFaces &facesByOriginalFace, BOP_Indexs vertices, BOP_Index v);
|
||||||
|
BOP_Face *createQuad(BOP_Face3 *faceI, BOP_Face3 *faceJ);
|
||||||
|
BOP_Face *createQuad(BOP_Face3 *faceI, BOP_Face4 *faceJ);
|
||||||
|
BOP_Face *createQuad(BOP_Face4 *faceI, BOP_Face4 *faceJ);
|
||||||
|
|
||||||
|
bool mergeVertex(BOP_Face *faceI, BOP_Face *faceJ, BOP_Index v,
|
||||||
|
BOP_Indexs &mergeVertices);
|
||||||
|
bool mergeVertex(BOP_Face *faceI, BOP_Face *faceJ, BOP_Index v,
|
||||||
|
BOP_Indexs &pending, BOP_Faces &oldFaces, BOP_Faces &newFaces );
|
||||||
|
BOP_Face *find3Neighbor(BOP_Face *faceI, BOP_Face *faceJ,
|
||||||
|
BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N );
|
||||||
|
BOP_Face *find4Neighbor(BOP_Face *faceI, BOP_Face *faceJ,
|
||||||
|
BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N,
|
||||||
|
BOP_Face **faceL, BOP_Index &O);
|
||||||
|
BOP_Face3 *collapse(BOP_Face4 *faceC, BOP_Index X);
|
||||||
|
void mergeFaces(BOP_Face *A, BOP_Face *B, BOP_Index X,
|
||||||
|
BOP_Index I, BOP_Index N, BOP_Index P, BOP_Faces &newFaces );
|
||||||
|
void freeVerts(BOP_Index v, BOP_Vertex *vert);
|
||||||
|
|
||||||
|
void mergeVertex(BOP_Faces&, BOP_Index, BOP_Index);
|
||||||
|
void mergeVertex(BOP_Face3 *, BOP_Index, BOP_Index);
|
||||||
|
void mergeVertex(BOP_Face4 *, BOP_Index, BOP_Index);
|
||||||
|
void cleanup( void );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
static BOP_Merge2 &getInstance() {
|
||||||
|
return SINGLETON;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mergeFaces(BOP_Mesh *m, BOP_Index v);
|
||||||
|
};
|
||||||
|
|
||||||
|
void dumpmesh(BOP_Mesh *, bool);
|
||||||
|
|
||||||
|
#endif /* BOP_NEW_MERGE2 */
|
||||||
|
#endif
|
@@ -449,6 +449,13 @@ bool BOP_Mesh::getIndexEdge(BOP_Index v1, BOP_Index v2, BOP_Index &e)
|
|||||||
printf ("found edge (%d %d)\n",v1,v2);
|
printf ("found edge (%d %d)\n",v1,v2);
|
||||||
#endif
|
#endif
|
||||||
e = edge->index;
|
e = edge->index;
|
||||||
|
#ifdef BOP_NEW_MERGE
|
||||||
|
if( m_edges[e]->getUsed() == false ) {
|
||||||
|
m_edges[e]->setUsed(true);
|
||||||
|
m_vertexs[v1]->addEdge(e);
|
||||||
|
m_vertexs[v2]->addEdge(e);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#ifdef HASH_PRINTF_DEBUG
|
#ifdef HASH_PRINTF_DEBUG
|
||||||
@@ -794,7 +801,8 @@ bool BOP_Mesh::isClosedMesh()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** ***************************************************************************
|
#ifdef BOP_DEBUG
|
||||||
|
/******************************************************************************
|
||||||
* DEBUG METHODS *
|
* DEBUG METHODS *
|
||||||
* This functions are used to test the mesh state and debug program errors. *
|
* This functions are used to test the mesh state and debug program errors. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@@ -1075,3 +1083,4 @@ void BOP_Mesh::updatePlanes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -1,10 +1,3 @@
|
|||||||
/*
|
|
||||||
* TEMPORARY defines to enable hashing support
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */
|
|
||||||
// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
|
54
intern/boolop/intern/BOP_Misc.h
Normal file
54
intern/boolop/intern/BOP_Misc.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* $Id: BOP_Misc.h 14444 2008-04-16 22:40:48Z khughes $
|
||||||
|
*
|
||||||
|
* ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): Ken Hughes
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file contains various definitions used across the modules
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* define operator>> for faces, edges and vertices, and also add some
|
||||||
|
* debugging functions for displaying various internal data structures
|
||||||
|
*/
|
||||||
|
|
||||||
|
// #define BOP_DEBUG
|
||||||
|
|
||||||
|
#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */
|
||||||
|
// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* temporary: control which method is used to merge final triangles and
|
||||||
|
* quads back together after an operation. If both methods are included,
|
||||||
|
* the "rt" debugging button on the Scene panel (F10) is used to control
|
||||||
|
* which is active. Setting it to 100 enables the original method, any
|
||||||
|
* other value enables the new method.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOP_ORIG_MERGE /* include original merge code */
|
||||||
|
#define BOP_NEW_MERGE /* include new merge code */
|
@@ -39,7 +39,7 @@
|
|||||||
#define OUTON_TAG 0x11 // Above and on the plane
|
#define OUTON_TAG 0x11 // Above and on the plane
|
||||||
#define UNCLASSIFIED_TAG 0x0F // Expecting to be classified
|
#define UNCLASSIFIED_TAG 0x0F // Expecting to be classified
|
||||||
|
|
||||||
#define PHANTOM_TAG 0x0C // Phantom face
|
#define PHANTOM_TAG 0x0C // Phantom face: verts form collinear triangle
|
||||||
#define OVERLAPPED_TAG 0x0D // Overlapped face
|
#define OVERLAPPED_TAG 0x0D // Overlapped face
|
||||||
#define BROKEN_TAG 0x0B // Splitted and unused ...
|
#define BROKEN_TAG 0x0B // Splitted and unused ...
|
||||||
|
|
||||||
|
@@ -89,3 +89,22 @@ bool BOP_Vertex::containsEdge(BOP_Index i)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOP_DEBUG
|
||||||
|
/**
|
||||||
|
* Implements operator <<.
|
||||||
|
*/
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
ostream &operator<<(ostream &stream, BOP_Vertex *v)
|
||||||
|
{
|
||||||
|
char aux[20];
|
||||||
|
BOP_stringTAG(v->m_tag,aux);
|
||||||
|
MT_Point3 point = v->getPoint();
|
||||||
|
stream << setprecision(6) << showpoint << fixed;
|
||||||
|
stream << "Vertex[" << point[0] << "," << point[1] << ",";
|
||||||
|
stream << point[2] << "] (" << aux << ")";
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "BOP_Tag.h"
|
#include "BOP_Tag.h"
|
||||||
#include "BOP_Indexs.h"
|
#include "BOP_Indexs.h"
|
||||||
#include "MT_Point3.h"
|
#include "MT_Point3.h"
|
||||||
|
#include "BOP_Misc.h"
|
||||||
|
|
||||||
class BOP_Vertex
|
class BOP_Vertex
|
||||||
{
|
{
|
||||||
@@ -52,6 +53,10 @@ public:
|
|||||||
inline MT_Point3 getPoint() const { return m_point;};
|
inline MT_Point3 getPoint() const { return m_point;};
|
||||||
inline BOP_TAG getTAG() { return m_tag;};
|
inline BOP_TAG getTAG() { return m_tag;};
|
||||||
inline void setTAG(BOP_TAG t) { m_tag = t;};
|
inline void setTAG(BOP_TAG t) { m_tag = t;};
|
||||||
|
#ifdef BOP_DEBUG
|
||||||
|
friend ostream &operator<<(ostream &stream, BOP_Vertex *v);
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -278,6 +278,9 @@ ECHO Done
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\intern\BOP_Merge.cpp">
|
RelativePath="..\..\intern\BOP_Merge.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\intern\BOP_Merge2.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\intern\BOP_Mesh.cpp">
|
RelativePath="..\..\intern\BOP_Mesh.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -330,9 +333,15 @@ ECHO Done
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\intern\BOP_Merge.h">
|
RelativePath="..\..\intern\BOP_Merge.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\intern\BOP_Merge2.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\intern\BOP_Mesh.h">
|
RelativePath="..\..\intern\BOP_Mesh.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\intern\BOP_Misc.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\intern\BOP_Segment.h">
|
RelativePath="..\..\intern\BOP_Segment.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -6,7 +6,7 @@ sources = env.Glob('intern/*.cpp')
|
|||||||
incs = 'intern ../container ../moto/include ../memutil'
|
incs = 'intern ../container ../moto/include ../memutil'
|
||||||
|
|
||||||
if (env['OURPLATFORM'] == 'win32-mingw'):
|
if (env['OURPLATFORM'] == 'win32-mingw'):
|
||||||
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,26] )
|
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,69] )
|
||||||
else:
|
else:
|
||||||
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=26 )
|
env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=26 )
|
||||||
|
|
||||||
|
@@ -197,7 +197,7 @@ BuildEdges(
|
|||||||
|
|
||||||
for (int vert = 0; vert < vertex_num; ++vert) {
|
for (int vert = 0; vert < vertex_num; ++vert) {
|
||||||
|
|
||||||
BSP_FaceInd fi(f_it - f_it_begin);
|
BSP_FaceInd fi(size_t (f_it - f_it_begin));
|
||||||
InsertEdge(prev_vi,face.m_verts[vert],fi,dummy);
|
InsertEdge(prev_vi,face.m_verts[vert],fi,dummy);
|
||||||
prev_vi = face.m_verts[vert];
|
prev_vi = face.m_verts[vert];
|
||||||
}
|
}
|
||||||
|
@@ -93,6 +93,16 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_WIN64)
|
||||||
|
CTR_TaggedIndex(
|
||||||
|
const unsigned __int64 val
|
||||||
|
) :
|
||||||
|
m_val ( ((unsigned __int64)val & index_mask)
|
||||||
|
| ( (empty_tag << tag_shift)
|
||||||
|
& (~index_mask) ) ) {
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CTR_TaggedIndex(
|
CTR_TaggedIndex(
|
||||||
const CTR_TaggedIndex &my_index
|
const CTR_TaggedIndex &my_index
|
||||||
):
|
):
|
||||||
@@ -124,6 +134,12 @@ public:
|
|||||||
return (long int)(m_val & index_mask);
|
return (long int)(m_val & index_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_WIN64)
|
||||||
|
operator unsigned __int64 () const {
|
||||||
|
return (unsigned __int64)(m_val & index_mask);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
IsEmpty(
|
IsEmpty(
|
||||||
) const {
|
) const {
|
||||||
|
@@ -477,7 +477,7 @@ DeleteVertex(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOD_VertexInd last = LOD_VertexInd(verts.end() - verts.begin() - 1);
|
LOD_VertexInd last = LOD_VertexInd(size_t(verts.end() - verts.begin() - 1));
|
||||||
|
|
||||||
if (!(last == v)) {
|
if (!(last == v)) {
|
||||||
|
|
||||||
@@ -533,7 +533,7 @@ DeleteEdge(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOD_EdgeInd last = LOD_EdgeInd(edges.end() - edges.begin() - 1);
|
LOD_EdgeInd last = LOD_EdgeInd(size_t(edges.end() - edges.begin() - 1));
|
||||||
|
|
||||||
if (!(last == e)) {
|
if (!(last == e)) {
|
||||||
vector<LOD_EdgeInd> e_verts;
|
vector<LOD_EdgeInd> e_verts;
|
||||||
@@ -573,7 +573,7 @@ DeleteFace(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOD_FaceInd last = LOD_FaceInd(faces.end() - faces.begin() - 1);
|
LOD_FaceInd last = LOD_FaceInd(size_t (faces.end() - faces.begin() - 1));
|
||||||
|
|
||||||
if (!(last == f)) {
|
if (!(last == f)) {
|
||||||
|
|
||||||
|
@@ -694,7 +694,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
|
|||||||
double maxDefaultMemChunk = 2.*1024.*1024.*1024.;
|
double maxDefaultMemChunk = 2.*1024.*1024.*1024.;
|
||||||
//std::cerr<<" memEstFine "<< memEstFine <<" maxWin:" <<maxWinMemChunk <<" maxMac:" <<maxMacMemChunk ; // DEBUG
|
//std::cerr<<" memEstFine "<< memEstFine <<" maxWin:" <<maxWinMemChunk <<" maxMac:" <<maxMacMemChunk ; // DEBUG
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if(memEstFine> maxWinMemChunk) {
|
if(sizeof(void *)==4 && memEstFine>maxWinMemChunk) {
|
||||||
memBlockAllocProblem = true;
|
memBlockAllocProblem = true;
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
@@ -42,6 +42,14 @@
|
|||||||
|
|
||||||
#include "GHOST_SystemWin32.h"
|
#include "GHOST_SystemWin32.h"
|
||||||
|
|
||||||
|
// win64 doesn't define GWL_USERDATA
|
||||||
|
#ifdef WIN32
|
||||||
|
#ifndef GWL_USERDATA
|
||||||
|
#define GWL_USERDATA GWLP_USERDATA
|
||||||
|
#define GWL_WNDPROC GWLP_WNDPROC
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* According to the docs the mouse wheel message is supported from windows 98
|
* According to the docs the mouse wheel message is supported from windows 98
|
||||||
* upwards. Leaving WINVER at default value, the WM_MOUSEWHEEL message and the
|
* upwards. Leaving WINVER at default value, the WM_MOUSEWHEEL message and the
|
||||||
@@ -909,8 +917,12 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(int flag) const
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
char *temp_buff;
|
char *temp_buff;
|
||||||
|
|
||||||
if ( OpenClipboard(NULL) ) {
|
if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
|
||||||
HANDLE hData = GetClipboardData( CF_TEXT );
|
HANDLE hData = GetClipboardData( CF_TEXT );
|
||||||
|
if (hData == NULL) {
|
||||||
|
CloseClipboard();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
buffer = (char*)GlobalLock( hData );
|
buffer = (char*)GlobalLock( hData );
|
||||||
|
|
||||||
temp_buff = (char*) malloc(strlen(buffer)+1);
|
temp_buff = (char*) malloc(strlen(buffer)+1);
|
||||||
|
@@ -48,6 +48,14 @@
|
|||||||
#define M_PI 3.1415926536
|
#define M_PI 3.1415926536
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// win64 doesn't define GWL_USERDATA
|
||||||
|
#ifdef WIN32
|
||||||
|
#ifndef GWL_USERDATA
|
||||||
|
#define GWL_USERDATA GWLP_USERDATA
|
||||||
|
#define GWL_WNDPROC GWLP_WNDPROC
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
LPCSTR GHOST_WindowWin32::s_windowClassName = "GHOST_WindowClass";
|
LPCSTR GHOST_WindowWin32::s_windowClassName = "GHOST_WindowClass";
|
||||||
const int GHOST_WindowWin32::s_maxTitleLength = 128;
|
const int GHOST_WindowWin32::s_maxTitleLength = 128;
|
||||||
HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL;
|
HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL;
|
||||||
|
125
intern/guardedalloc/BLO_sys_types.h
Normal file
125
intern/guardedalloc/BLO_sys_types.h
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/**
|
||||||
|
* $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
* A platform-independent definition of [u]intXX_t
|
||||||
|
* Plus the accompanying header include for htonl/ntohl
|
||||||
|
*
|
||||||
|
* This file includes <sys/types.h> to define [u]intXX_t types, where
|
||||||
|
* XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this
|
||||||
|
* file.
|
||||||
|
* - Windows uses __intXX compiler-builtin types. These are signed,
|
||||||
|
* so we have to flip the signs.
|
||||||
|
* For these rogue platforms, we make the typedefs ourselves.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
// DG: original BLO_sys_types.h is in source/blender/blenkernel
|
||||||
|
// but is not allowed be accessed here because of bad-level-call
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BLO_SYS_TYPES_H
|
||||||
|
#define BLO_SYS_TYPES_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
||||||
|
|
||||||
|
/* The __intXX are built-in types of the visual complier! So we don't
|
||||||
|
* need to include anything else here. */
|
||||||
|
|
||||||
|
typedef signed __int8 int8_t;
|
||||||
|
typedef signed __int16 int16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
|
||||||
|
#ifndef _INTPTR_T_DEFINED
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef __int64 intptr_t;
|
||||||
|
#else
|
||||||
|
typedef long intptr_t;
|
||||||
|
#endif
|
||||||
|
#define _INTPTR_T_DEFINED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _UINTPTR_T_DEFINED
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef unsigned __int64 uintptr_t;
|
||||||
|
#else
|
||||||
|
typedef unsigned long uintptr_t;
|
||||||
|
#endif
|
||||||
|
#define _UINTPTR_T_DEFINED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(__linux__)
|
||||||
|
|
||||||
|
/* Linux-i386, Linux-Alpha, Linux-ppc */
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#elif defined (__APPLE__)
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#elif defined(FREE_WINDOWS)
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* FreeBSD, Irix, Solaris */
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#endif /* ifdef platform for types */
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#ifndef htonl
|
||||||
|
#define htonl(x) correctByteOrder(x)
|
||||||
|
#endif
|
||||||
|
#ifndef ntohl
|
||||||
|
#define ntohl(x) correctByteOrder(x)
|
||||||
|
#endif
|
||||||
|
#elif defined (__FreeBSD__) || defined (__OpenBSD__)
|
||||||
|
#include <sys/param.h>
|
||||||
|
#elif defined (__APPLE__)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#else /* irix sun linux */
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif /* ifdef platform for htonl/ntohl */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* eof */
|
||||||
|
|
@@ -58,8 +58,8 @@
|
|||||||
#ifndef MEM_MALLOCN_H
|
#ifndef MEM_MALLOCN_H
|
||||||
#define MEM_MALLOCN_H
|
#define MEM_MALLOCN_H
|
||||||
|
|
||||||
/* Needed for FILE* */
|
#include "stdio.h" /* needed for FILE* */
|
||||||
#include "stdio.h"
|
#include "BLO_sys_types.h" /* needed for uintptr_t */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -123,6 +123,12 @@ extern "C" {
|
|||||||
/** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */
|
/** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */
|
||||||
void MEM_set_memory_debug(void);
|
void MEM_set_memory_debug(void);
|
||||||
|
|
||||||
|
/* Memory usage stats
|
||||||
|
* - MEM_get_memory_in_use is all memory
|
||||||
|
* - MEM_get_mapped_memory_in_use is a subset of all memory */
|
||||||
|
uintptr_t MEM_get_memory_in_use(void);
|
||||||
|
uintptr_t MEM_get_mapped_memory_in_use(void);
|
||||||
|
int MEM_get_memory_blocks_in_use(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -111,8 +111,8 @@ static const char *check_memlist(MemHead *memh);
|
|||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
volatile int totblock= 0;
|
static volatile int totblock= 0;
|
||||||
volatile unsigned long mem_in_use= 0, mmap_in_use= 0;
|
static volatile uintptr_t mem_in_use= 0, mmap_in_use= 0;
|
||||||
|
|
||||||
static volatile struct localListBase _membase;
|
static volatile struct localListBase _membase;
|
||||||
static volatile struct localListBase *membase = &_membase;
|
static volatile struct localListBase *membase = &_membase;
|
||||||
@@ -335,7 +335,7 @@ void *MEM_mapallocN(unsigned int len, const char *str)
|
|||||||
/* Memory statistics print */
|
/* Memory statistics print */
|
||||||
typedef struct MemPrintBlock {
|
typedef struct MemPrintBlock {
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned long len;
|
uintptr_t len;
|
||||||
int items;
|
int items;
|
||||||
} MemPrintBlock;
|
} MemPrintBlock;
|
||||||
|
|
||||||
@@ -485,14 +485,14 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sizeof(long)==8) {
|
if(sizeof(intptr_t)==8) {
|
||||||
if (((long) memh) & 0x7) {
|
if (((intptr_t) memh) & 0x7) {
|
||||||
MemorY_ErroR("free","attempt to free illegal pointer");
|
MemorY_ErroR("free","attempt to free illegal pointer");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (((long) memh) & 0x3) {
|
if (((intptr_t) memh) & 0x3) {
|
||||||
MemorY_ErroR("free","attempt to free illegal pointer");
|
MemorY_ErroR("free","attempt to free illegal pointer");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@@ -696,4 +696,19 @@ static const char *check_memlist(MemHead *memh)
|
|||||||
return(name);
|
return(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uintptr_t MEM_get_memory_in_use(void)
|
||||||
|
{
|
||||||
|
return mem_in_use;
|
||||||
|
}
|
||||||
|
|
||||||
|
uintptr_t MEM_get_mapped_memory_in_use(void)
|
||||||
|
{
|
||||||
|
return mmap_in_use;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MEM_get_memory_blocks_in_use(void)
|
||||||
|
{
|
||||||
|
return totblock;
|
||||||
|
}
|
||||||
|
|
||||||
/* eof */
|
/* eof */
|
||||||
|
@@ -151,7 +151,7 @@ void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* munmap for windows */
|
/* munmap for windows */
|
||||||
long munmap(void *ptr, long size)
|
intptr_t munmap(void *ptr, intptr_t size)
|
||||||
{
|
{
|
||||||
MemMap *mm = mmap_findlink(mmapbase, ptr);
|
MemMap *mm = mmap_findlink(mmapbase, ptr);
|
||||||
if (!mm) {
|
if (!mm) {
|
||||||
|
@@ -261,6 +261,9 @@ ECHO Done
|
|||||||
<Filter
|
<Filter
|
||||||
Name="extern"
|
Name="extern"
|
||||||
Filter="">
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\BLO_sys_types.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\MEM_guardedalloc.h">
|
RelativePath="..\..\MEM_guardedalloc.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -45,8 +45,10 @@
|
|||||||
|
|
||||||
#define MAP_FAILED ((void *)-1)
|
#define MAP_FAILED ((void *)-1)
|
||||||
|
|
||||||
|
#include "BLO_sys_types.h" // needed for intptr_t
|
||||||
|
|
||||||
void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset);
|
void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset);
|
||||||
long munmap(void *ptr, long size);
|
intptr_t munmap(void *ptr, intptr_t size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#define __MEM_Allocator_h_included__ 1
|
#define __MEM_Allocator_h_included__ 1
|
||||||
|
|
||||||
#include "guardedalloc/MEM_guardedalloc.h"
|
#include "guardedalloc/MEM_guardedalloc.h"
|
||||||
|
#include "guardedalloc/BLO_sys_types.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#if _MSC_VER < 1300 // 1200 == VC++ 6.0 according to boost
|
#if _MSC_VER < 1300 // 1200 == VC++ 6.0 according to boost
|
||||||
|
@@ -61,11 +61,8 @@ class MEM_CacheLimiter;
|
|||||||
|
|
||||||
#ifndef __MEM_cache_limiter_c_api_h_included__
|
#ifndef __MEM_cache_limiter_c_api_h_included__
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern void MEM_CacheLimiter_set_maximum(int m);
|
extern void MEM_CacheLimiter_set_maximum(intptr_t m);
|
||||||
extern int MEM_CacheLimiter_get_maximum();
|
extern intptr_t MEM_CacheLimiter_get_maximum();
|
||||||
// this is rather _ugly_!
|
|
||||||
extern int mem_in_use;
|
|
||||||
extern int mmap_in_use;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -141,7 +138,10 @@ public:
|
|||||||
delete handle;
|
delete handle;
|
||||||
}
|
}
|
||||||
void enforce_limits() {
|
void enforce_limits() {
|
||||||
int max = MEM_CacheLimiter_get_maximum();
|
intptr_t max = MEM_CacheLimiter_get_maximum();
|
||||||
|
intptr_t mem_in_use= MEM_get_memory_in_use();
|
||||||
|
intptr_t mmap_in_use= MEM_get_mapped_memory_in_use();
|
||||||
|
|
||||||
if (max == 0) {
|
if (max == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -27,18 +27,18 @@
|
|||||||
#include "MEM_CacheLimiter.h"
|
#include "MEM_CacheLimiter.h"
|
||||||
#include "MEM_CacheLimiterC-Api.h"
|
#include "MEM_CacheLimiterC-Api.h"
|
||||||
|
|
||||||
static int & get_max()
|
static intptr_t & get_max()
|
||||||
{
|
{
|
||||||
static int m = 32*1024*1024;
|
static intptr_t m = 32*1024*1024;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MEM_CacheLimiter_set_maximum(int m)
|
void MEM_CacheLimiter_set_maximum(intptr_t m)
|
||||||
{
|
{
|
||||||
get_max() = m;
|
get_max() = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MEM_CacheLimiter_get_maximum()
|
intptr_t MEM_CacheLimiter_get_maximum()
|
||||||
{
|
{
|
||||||
return get_max();
|
return get_max();
|
||||||
}
|
}
|
||||||
|
@@ -50,6 +50,19 @@ public:
|
|||||||
m_buckets[i] = 0;
|
m_buckets[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GEN_Map(const GEN_Map& map)
|
||||||
|
{
|
||||||
|
m_num_buckets = map.m_num_buckets;
|
||||||
|
m_buckets = new Entry *[m_num_buckets];
|
||||||
|
|
||||||
|
for (int i = 0; i < m_num_buckets; ++i) {
|
||||||
|
m_buckets[i] = 0;
|
||||||
|
|
||||||
|
for(Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
|
||||||
|
insert(entry->m_key, entry->m_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int size() {
|
int size() {
|
||||||
int count=0;
|
int count=0;
|
||||||
@@ -82,6 +95,24 @@ public:
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Key* getKey(int index) {
|
||||||
|
int count=0;
|
||||||
|
for (int i=0;i<m_num_buckets;i++)
|
||||||
|
{
|
||||||
|
Entry* bucket = m_buckets[i];
|
||||||
|
while(bucket)
|
||||||
|
{
|
||||||
|
if (count==index)
|
||||||
|
{
|
||||||
|
return &bucket->m_key;
|
||||||
|
}
|
||||||
|
bucket = bucket->m_next;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
for (int i = 0; i < m_num_buckets; ++i) {
|
for (int i = 0; i < m_num_buckets; ++i) {
|
||||||
|
@@ -212,6 +212,7 @@ public:
|
|||||||
MT_Matrix4x4 transposed() const;
|
MT_Matrix4x4 transposed() const;
|
||||||
void transpose();
|
void transpose();
|
||||||
|
|
||||||
|
MT_Matrix4x4 inverse() const;
|
||||||
void invert();
|
void invert();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -52,14 +52,14 @@ GEN_INLINE void MT_Matrix4x4::invert() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We do things slightly different here, because the invert() modifies
|
GEN_INLINE MT_Matrix4x4 MT_Matrix4x4::inverse() const
|
||||||
* the buffer itself. This makes it impossible to make this op right
|
{
|
||||||
* away. Like other, still missing facilities, I will repair this
|
MT_Matrix4x4 invmat = *this;
|
||||||
* later. */
|
|
||||||
/* GEN_INLINE T_Matrix4x4 MT_Matrix4x4::inverse() const */
|
|
||||||
/* { */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
|
invmat.invert();
|
||||||
|
|
||||||
|
return invmat;
|
||||||
|
}
|
||||||
|
|
||||||
GEN_INLINE MT_Matrix4x4& MT_Matrix4x4::operator*=(const MT_Matrix4x4& m)
|
GEN_INLINE MT_Matrix4x4& MT_Matrix4x4::operator*=(const MT_Matrix4x4& m)
|
||||||
{
|
{
|
||||||
|
@@ -715,6 +715,9 @@ ECHO Done
|
|||||||
<Filter
|
<Filter
|
||||||
Name="superlu"
|
Name="superlu"
|
||||||
Filter="">
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\superlu\BLO_sys_types.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\superlu\Cnames.h">
|
RelativePath="..\..\superlu\Cnames.h">
|
||||||
</File>
|
</File>
|
||||||
|
127
intern/opennl/superlu/BLO_sys_types.h
Normal file
127
intern/opennl/superlu/BLO_sys_types.h
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
/**
|
||||||
|
* $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
* A platform-independent definition of [u]intXX_t
|
||||||
|
* Plus the accompanying header include for htonl/ntohl
|
||||||
|
*
|
||||||
|
* This file includes <sys/types.h> to define [u]intXX_t types, where
|
||||||
|
* XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this
|
||||||
|
* file.
|
||||||
|
* - Windows uses __intXX compiler-builtin types. These are signed,
|
||||||
|
* so we have to flip the signs.
|
||||||
|
* For these rogue platforms, we make the typedefs ourselves.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
// DG: original BLO_sys_types.h is in source/blender/blenkernel
|
||||||
|
// but is not allowed be accessed here because of bad-level-call
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BLO_SYS_TYPES_H
|
||||||
|
#define BLO_SYS_TYPES_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
||||||
|
|
||||||
|
/* The __intXX are built-in types of the visual complier! So we don't
|
||||||
|
* need to include anything else here. */
|
||||||
|
|
||||||
|
|
||||||
|
typedef signed __int8 int8_t;
|
||||||
|
typedef signed __int16 int16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
|
||||||
|
#ifndef _INTPTR_T_DEFINED
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef __int64 intptr_t;
|
||||||
|
#else
|
||||||
|
typedef long intptr_t;
|
||||||
|
#endif
|
||||||
|
#define _INTPTR_T_DEFINED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _UINTPTR_T_DEFINED
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef unsigned __int64 uintptr_t;
|
||||||
|
#else
|
||||||
|
typedef unsigned long uintptr_t;
|
||||||
|
#endif
|
||||||
|
#define _UINTPTR_T_DEFINED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(__linux__)
|
||||||
|
|
||||||
|
/* Linux-i386, Linux-Alpha, Linux-ppc */
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#elif defined (__APPLE__)
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#elif defined(FREE_WINDOWS)
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* FreeBSD, Irix, Solaris */
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#endif /* ifdef platform for types */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#ifndef htonl
|
||||||
|
#define htonl(x) correctByteOrder(x)
|
||||||
|
#endif
|
||||||
|
#ifndef ntohl
|
||||||
|
#define ntohl(x) correctByteOrder(x)
|
||||||
|
#endif
|
||||||
|
#elif defined (__FreeBSD__) || defined (__OpenBSD__)
|
||||||
|
#include <sys/param.h>
|
||||||
|
#elif defined (__APPLE__)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#else /* irix sun linux */
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif /* ifdef platform for htonl/ntohl */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* eof */
|
||||||
|
|
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "ssp_defs.h"
|
#include "ssp_defs.h"
|
||||||
|
|
||||||
|
#include "BLO_sys_types.h" // needed for intptr_t
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define NO_MEMTYPE 4 /* 0: lusup;
|
#define NO_MEMTYPE 4 /* 0: lusup;
|
||||||
1: ucol;
|
1: ucol;
|
||||||
@@ -49,8 +51,8 @@ static int no_expand;
|
|||||||
|
|
||||||
/* Macros to manipulate stack */
|
/* Macros to manipulate stack */
|
||||||
#define StackFull(x) ( x + stack.used >= stack.size )
|
#define StackFull(x) ( x + stack.used >= stack.size )
|
||||||
#define NotDoubleAlign(addr) ( (long int)addr & 7 )
|
#define NotDoubleAlign(addr) ( (intptr_t)addr & 7 )
|
||||||
#define DoubleAlign(addr) ( ((long int)addr + 7) & ~7L )
|
#define DoubleAlign(addr) ( ((intptr_t)addr + 7) & ~7L )
|
||||||
#define TempSpace(m, w) ( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \
|
#define TempSpace(m, w) ( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \
|
||||||
(w + 1) * m * sizeof(float) )
|
(w + 1) * m * sizeof(float) )
|
||||||
#define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */
|
#define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */
|
||||||
@@ -611,8 +613,8 @@ sStackCompress(GlobalLU_t *Glu)
|
|||||||
|
|
||||||
last = (char*)usub + xusub[ndim] * iword;
|
last = (char*)usub + xusub[ndim] * iword;
|
||||||
fragment = (char*) (((char*)stack.array + stack.top1) - last);
|
fragment = (char*) (((char*)stack.array + stack.top1) - last);
|
||||||
stack.used -= (long int) fragment;
|
stack.used -= (intptr_t) fragment;
|
||||||
stack.top1 -= (long int) fragment;
|
stack.top1 -= (intptr_t) fragment;
|
||||||
|
|
||||||
Glu->ucol = ucol;
|
Glu->ucol = ucol;
|
||||||
Glu->lsub = lsub;
|
Glu->lsub = lsub;
|
||||||
|
@@ -118,6 +118,114 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="BlenderPlayer Debug|Win32"
|
||||||
|
OutputDirectory="$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\iksolver\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\lib\windows\ffmpeg\include;..\..\..\source\blender;..\..\..\source\blender\avi;..\..\..\source\blender\img;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenloader;..\..\..\source\blender\renderconverter;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\SoundSystem"
|
||||||
|
PreprocessorDefinitions="_DEBUG,WIN32,_LIB;WITH_FFMPEG"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
DisableLanguageExtensions="FALSE"
|
||||||
|
DefaultCharIsUnsigned="TRUE"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\blender\python\debug\BPY_python.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\blender\python\debug\"
|
||||||
|
ObjectFile="..\..\..\..\build\msvc_7\source\blender\python\debug\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\build\msvc_7\source\blender\python\debug\"
|
||||||
|
WarningLevel="4"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
Detect64BitPortabilityProblems="FALSE"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CompileAs="0"
|
||||||
|
DisableSpecificWarnings="4100"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\build\msvc_7\libs\debug\BPY_python.lib"
|
||||||
|
SuppressStartupBanner="TRUE"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
Culture="1033"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="BlenderPlayer Release|Win32"
|
||||||
|
OutputDirectory="$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\iksolver\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender;..\..\..\source\blender\avi;..\..\..\source\blender\img;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenloader;..\..\..\source\blender\renderconverter;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\SoundSystem;..\..\..\..\lib\windows\ffmpeg\include"
|
||||||
|
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
|
||||||
|
StringPooling="TRUE"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableFunctionLevelLinking="TRUE"
|
||||||
|
DefaultCharIsUnsigned="TRUE"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\blender\python\BPY_python.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\blender\python\"
|
||||||
|
ObjectFile="..\..\..\..\build\msvc_7\source\blender\python\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\build\msvc_7\source\blender\python\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
Detect64BitPortabilityProblems="FALSE"
|
||||||
|
CompileAs="0"
|
||||||
|
DisableSpecificWarnings="4100"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\build\msvc_7\libs\BPY_python.lib"
|
||||||
|
SuppressStartupBanner="TRUE"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1033"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
|
@@ -152,6 +152,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GP_ghost", "..\gameengine\g
|
|||||||
{E109F1A5-FDD3-4F56-A1C4-96867EEA4C5B} = {E109F1A5-FDD3-4F56-A1C4-96867EEA4C5B}
|
{E109F1A5-FDD3-4F56-A1C4-96867EEA4C5B} = {E109F1A5-FDD3-4F56-A1C4-96867EEA4C5B}
|
||||||
{727F90AC-ABE6-40BF-8937-C2F2F1D13DEA} = {727F90AC-ABE6-40BF-8937-C2F2F1D13DEA}
|
{727F90AC-ABE6-40BF-8937-C2F2F1D13DEA} = {727F90AC-ABE6-40BF-8937-C2F2F1D13DEA}
|
||||||
{E90C7BC2-CF30-4A60-A8F2-0050D592E358} = {E90C7BC2-CF30-4A60-A8F2-0050D592E358}
|
{E90C7BC2-CF30-4A60-A8F2-0050D592E358} = {E90C7BC2-CF30-4A60-A8F2-0050D592E358}
|
||||||
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA} = {5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}
|
||||||
{32CC75E2-EE85-45E6-8E3D-513F58464F43} = {32CC75E2-EE85-45E6-8E3D-513F58464F43}
|
{32CC75E2-EE85-45E6-8E3D-513F58464F43} = {32CC75E2-EE85-45E6-8E3D-513F58464F43}
|
||||||
{9A307EE5-CD77-47BC-BD87-62508C7E19D8} = {9A307EE5-CD77-47BC-BD87-62508C7E19D8}
|
{9A307EE5-CD77-47BC-BD87-62508C7E19D8} = {9A307EE5-CD77-47BC-BD87-62508C7E19D8}
|
||||||
{AB590CED-F71F-4A17-A89B-18583ECD633D} = {AB590CED-F71F-4A17-A89B-18583ECD633D}
|
{AB590CED-F71F-4A17-A89B-18583ECD633D} = {AB590CED-F71F-4A17-A89B-18583ECD633D}
|
||||||
@@ -248,6 +249,8 @@ Global
|
|||||||
Debug = Debug
|
Debug = Debug
|
||||||
Release = Release
|
Release = Release
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectDependencies) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
GlobalSection(ProjectConfiguration) = postSolution
|
||||||
{F78B7FC9-DE32-465E-9F26-BB0B6B7A2EAF}.3D Plugin Debug.ActiveCfg = Blender Debug|Win32
|
{F78B7FC9-DE32-465E-9F26-BB0B6B7A2EAF}.3D Plugin Debug.ActiveCfg = Blender Debug|Win32
|
||||||
{F78B7FC9-DE32-465E-9F26-BB0B6B7A2EAF}.3D Plugin Release.ActiveCfg = Blender Release|Win32
|
{F78B7FC9-DE32-465E-9F26-BB0B6B7A2EAF}.3D Plugin Release.ActiveCfg = Blender Release|Win32
|
||||||
@@ -387,8 +390,10 @@ Global
|
|||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Debug.Build.0 = Blender Debug|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Debug.Build.0 = Blender Debug|Win32
|
||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Release.ActiveCfg = Blender Release|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Release.ActiveCfg = Blender Release|Win32
|
||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Release.Build.0 = Blender Release|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Blender Release.Build.0 = Blender Release|Win32
|
||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Debug.ActiveCfg = Blender Debug|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Debug.ActiveCfg = BlenderPlayer Debug|Win32
|
||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Release.ActiveCfg = Blender Release|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Debug.Build.0 = BlenderPlayer Debug|Win32
|
||||||
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Release.ActiveCfg = BlenderPlayer Release|Win32
|
||||||
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.BlenderPlayer Release.Build.0 = BlenderPlayer Release|Win32
|
||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Debug.ActiveCfg = Blender Debug|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Debug.ActiveCfg = Blender Debug|Win32
|
||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Debug.Build.0 = Blender Debug|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Debug.Build.0 = Blender Debug|Win32
|
||||||
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Release.ActiveCfg = Blender Release|Win32
|
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}.Release.ActiveCfg = Blender Release|Win32
|
||||||
|
@@ -365,6 +365,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\intern\brush.c">
|
RelativePath="..\..\..\source\blender\blenkernel\intern\brush.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\blenkernel\intern\bvhutils.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\intern\CCGSubSurf.c">
|
RelativePath="..\..\..\source\blender\blenkernel\intern\CCGSubSurf.c">
|
||||||
</File>
|
</File>
|
||||||
@@ -491,6 +494,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\intern\script.c">
|
RelativePath="..\..\..\source\blender\blenkernel\intern\script.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\blenkernel\intern\shrinkwrap.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\intern\softbody.c">
|
RelativePath="..\..\..\source\blender\blenkernel\intern\softbody.c">
|
||||||
</File>
|
</File>
|
||||||
@@ -500,6 +506,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\intern\subsurf_ccg.c">
|
RelativePath="..\..\..\source\blender\blenkernel\intern\subsurf_ccg.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\blenkernel\intern\suggestions.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\intern\text.c">
|
RelativePath="..\..\..\source\blender\blenkernel\intern\text.c">
|
||||||
</File>
|
</File>
|
||||||
@@ -576,6 +585,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_brush.h">
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_brush.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_bvhutils.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_cdderivedmesh.h">
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_cdderivedmesh.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -702,6 +714,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_script.h">
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_script.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_shrinkwrap.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_softbody.h">
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_softbody.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -711,6 +726,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_subsurf.h">
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_subsurf.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_suggestions.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_text.h">
|
RelativePath="..\..\..\source\blender\blenkernel\BKE_text.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -471,6 +471,9 @@ DNA_makesdna.exe dna.c
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\makesdna\DNA_fileglobal_types.h">
|
RelativePath="..\..\..\source\blender\makesdna\DNA_fileglobal_types.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\makesdna\DNA_gpencil_types.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\makesdna\DNA_group_types.h">
|
RelativePath="..\..\..\source\blender\makesdna\DNA_group_types.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\lib\windows\QTDevWin\CIncludes;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\ghost\include;..\..\..\..\build\msvc_7\intern\elbeem\include;..\..\..\..\build\msvc_7\intern\opennl\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\blenkey\include;..\..\..\..\build\msvc_7\intern\decimation\include;..\..\..\..\build\msvc_7\intern\memutil\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\source\blender;..\..\..\source\blender\img;..\..\..\source\blender\verify;..\..\..\source\blender\ftfont;..\..\..\source\blender\misc;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\renderui;..\..\..\source\blender\blenloader;..\..\..\source\blender\quicktime;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\nodes;..\..\..\source\blender\blenpluginapi;..\..\..\source\blender\renderconverter;..\..\..\source\blender\readstreamglue;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\network;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\..\build\msvc_7\extern\verse\include;..\..\..\..\lib\windows\pthreads\include;..\..\..\..\lib\windows\ffmpeg\include"
|
AdditionalIncludeDirectories="..\..\..\..\lib\windows\QTDevWin\CIncludes;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\ghost\include;..\..\..\..\build\msvc_7\intern\elbeem\include;..\..\..\..\build\msvc_7\intern\opennl\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\blenkey\include;..\..\..\..\build\msvc_7\intern\decimation\include;..\..\..\..\build\msvc_7\intern\memutil\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\source\blender;..\..\..\source\blender\img;..\..\..\source\blender\verify;..\..\..\source\blender\ftfont;..\..\..\source\blender\misc;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\renderui;..\..\..\source\blender\blenloader;..\..\..\source\blender\quicktime;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\nodes;..\..\..\source\blender\blenpluginapi;..\..\..\source\blender\renderconverter;..\..\..\source\blender\readstreamglue;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\network;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\..\build\msvc_7\extern\verse\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\pthreads\include;..\..\..\..\lib\windows\ffmpeg\include"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER=1;WITH_QUICKTIME;INTERNATIONAL;WITH_VERSE;WITH_OPENEXR;WITH_DDS;WITH_BULLET=1;WITH_FFMPEG"
|
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER=1;WITH_QUICKTIME;INTERNATIONAL;WITH_VERSE;WITH_OPENEXR;WITH_DDS;WITH_BULLET=1;WITH_FFMPEG"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\lib\windows\QTDevWin\CIncludes;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\ghost\include;..\..\..\..\build\msvc_7\intern\elbeem\include;..\..\..\..\build\msvc_7\intern\opennl\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\blenkey\include;..\..\..\..\build\msvc_7\intern\decimation\include;..\..\..\..\build\msvc_7\intern\memutil\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\source\blender;..\..\..\source\blender\img;..\..\..\source\blender\verify;..\..\..\source\blender\ftfont;..\..\..\source\blender\misc;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\renderui;..\..\..\source\blender\blenloader;..\..\..\source\blender\quicktime;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\nodes;..\..\..\source\blender\blenpluginapi;..\..\..\source\blender\renderconverter;..\..\..\source\blender\readstreamglue;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\network;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\..\build\msvc_7\extern\verse\include;..\..\..\..\lib\windows\pthreads\include;..\..\..\..\lib\windows\ffmpeg\include"
|
AdditionalIncludeDirectories="..\..\..\..\lib\windows\QTDevWin\CIncludes;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\build\msvc_7\intern\bsp\include;..\..\..\..\build\msvc_7\intern\ghost\include;..\..\..\..\build\msvc_7\intern\elbeem\include;..\..\..\..\build\msvc_7\intern\opennl\include;..\..\..\..\build\msvc_7\intern\bmfont\include;..\..\..\..\build\msvc_7\intern\blenkey\include;..\..\..\..\build\msvc_7\intern\decimation\include;..\..\..\..\build\msvc_7\intern\memutil\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\source\blender;..\..\..\source\blender\img;..\..\..\source\blender\verify;..\..\..\source\blender\ftfont;..\..\..\source\blender\misc;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\include;..\..\..\source\blender\renderui;..\..\..\source\blender\blenloader;..\..\..\source\blender\quicktime;..\..\..\source\blender\blenkernel;..\..\..\source\blender\makesdna;..\..\..\source\blender\nodes;..\..\..\source\blender\blenpluginapi;..\..\..\source\blender\renderconverter;..\..\..\source\blender\readstreamglue;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\network;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\..\build\msvc_7\extern\verse\include;..\..\..\..\lib\windows\pthreads\include;..\..\..\..\lib\windows\ffmpeg\include;..\..\..\..\build\msvc_7\extern\glew\include"
|
||||||
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER;WITH_QUICKTIME;INTERNATIONAL;WITH_VERSE;WITH_OPENEXR;WITH_DDS;WITH_BULLET = 1;WITH_FFMPEG"
|
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER;WITH_QUICKTIME;INTERNATIONAL;WITH_VERSE;WITH_OPENEXR;WITH_DDS;WITH_BULLET = 1;WITH_FFMPEG"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -181,6 +181,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\src\drawdeps.c">
|
RelativePath="..\..\..\source\blender\src\drawdeps.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\src\drawgpencil.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\src\drawimage.c">
|
RelativePath="..\..\..\source\blender\src\drawimage.c">
|
||||||
</File>
|
</File>
|
||||||
@@ -232,6 +235,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\src\editaction.c">
|
RelativePath="..\..\..\source\blender\src\editaction.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\src\editaction_gpencil.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\src\editarmature.c">
|
RelativePath="..\..\..\source\blender\src\editarmature.c">
|
||||||
</File>
|
</File>
|
||||||
@@ -349,6 +355,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\src\glutil.c">
|
RelativePath="..\..\..\source\blender\src\glutil.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\src\gpencil.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\src\hddaudio.c">
|
RelativePath="..\..\..\source\blender\src\hddaudio.c">
|
||||||
</File>
|
</File>
|
||||||
@@ -617,6 +626,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\include\BDR_editobject.h">
|
RelativePath="..\..\..\source\blender\include\BDR_editobject.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\include\BDR_gpencil.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\include\BDR_imagepaint.h">
|
RelativePath="..\..\..\source\blender\include\BDR_imagepaint.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -635,6 +647,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\include\BIF_cursors.h">
|
RelativePath="..\..\..\source\blender\include\BIF_cursors.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\include\BIF_drawgpencil.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\blender\include\BIF_drawimage.h">
|
RelativePath="..\..\..\source\blender\include\BIF_drawimage.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -142,9 +142,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderMouseDevice.cpp">
|
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderMouseDevice.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderPolyMaterial.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderRenderTools.cpp">
|
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderRenderTools.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -170,9 +167,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderMouseDevice.h">
|
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderMouseDevice.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderPolyMaterial.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderRenderTools.h">
|
RelativePath="..\..\..\source\gameengine\BlenderRoutines\KX_BlenderRenderTools.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -347,6 +347,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_ANDController.cpp">
|
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_ANDController.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_DelaySensor.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_EventManager.cpp">
|
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_EventManager.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -465,6 +468,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_ANDController.h">
|
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_ANDController.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_DelaySensor.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_EventManager.h">
|
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_EventManager.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -126,7 +126,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\lib\windows\sdl\include;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
|
||||||
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
|
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\lib\windows\sdl\include;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
|
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
@@ -232,11 +232,12 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\lib\windows\sdl\include;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
|
||||||
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
|
PreprocessorDefinitions="JANCODEPANCO;WIN32;_LIB;EXP_PYTHON_EMBEDDING;_DEBUG;USE_SUMO_SOLID;WITH_GLEXT"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
DefaultCharIsUnsigned="TRUE"
|
DefaultCharIsUnsigned="TRUE"
|
||||||
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\KX_ketsji.pch"
|
PrecompiledHeaderFile="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\KX_ketsji.pch"
|
||||||
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\"
|
AssemblerListingLocation="..\..\..\..\build\msvc_7\source\gameengine\ketsji\debug\"
|
||||||
@@ -284,7 +285,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\soundsystem\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include;..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\build\msvc_7\extern\solid\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\lib\windows\sdl\include;..\..\..\source\blender\imbuf;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\physics;..\..\..\source\gameengine\rasterizer;..\..\..\source\gameengine\network;..\..\..\source\gameengine\Converter;..\..\..\source\gameengine\gamelogic;..\..\..\source\gameengine\scenegraph;..\..\..\source\gameengine\expressions;..\..\..\source\gameengine\physics\sumo;..\..\..\source\gameengine\physics\dummy;..\..\..\source\gameengine\physics\BlOde;..\..\..\source\gameengine\ketsji\kxnetwork;..\..\..\source\gameengine\physics\common;..\..\..\source\gameengine\physics\sumo\include;..\..\..\source\gameengine\physics\common\dummy;..\..\..\source\gameengine\Rasterizer\RAS_OpenGLRasterizer;..\..\..\source\gameengine\physics\sumo\fuzzics\include;..\..\..\source\sumo\include;..\..\..\source\sumo\fuzzics\include;..\..\..\source\gameengine\physics\bullet;..\..\..\source\blender\python\api2_2x"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
|
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;USE_SUMO_SOLID;WITH_GLEXT"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
@@ -393,6 +394,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PolygonMaterial.cpp">
|
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PolygonMaterial.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PolyProxy.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PyConstraintBinding.cpp">
|
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PyConstraintBinding.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -620,6 +624,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PolygonMaterial.h">
|
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PolygonMaterial.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PolyProxy.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PyConstraintBinding.h">
|
RelativePath="..\..\..\source\gameengine\Ketsji\KX_PyConstraintBinding.h">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet"
|
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\gameengine\Rasterizer"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||||
MinimalRebuild="FALSE"
|
MinimalRebuild="FALSE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet"
|
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\gameengine\Rasterizer"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet"
|
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\kernel\gen_system;..\..\..\..\..\source\gameengine\Rasterizer"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet"
|
AdditionalIncludeDirectories="..\..\..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\..\..\build\msvc_7\extern\bullet\include;..\..\..\..\..\source\gameengine\Physics\common;..\..\..\..\..\source\gameengine\Physics\Bullet;..\..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\..\source\kernel\gen_system"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||||
MinimalRebuild="FALSE"
|
MinimalRebuild="FALSE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
|
@@ -171,6 +171,7 @@
|
|||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\PHY_Sumo.pch"
|
PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\PHY_Sumo.pch"
|
||||||
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\"
|
AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\source\gameengine\physics\sumo\debug\"
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5"
|
||||||
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
|
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
|
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5"
|
||||||
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
|
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -281,7 +281,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
|
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
|
@@ -125,7 +125,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
|
||||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -177,7 +177,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
|
||||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
|
||||||
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -281,7 +281,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
|
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
|
||||||
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
|
@@ -1 +1 @@
|
|||||||
2.46
|
2.47
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 66 KiB |
@@ -35,7 +35,7 @@ int main(int argc, char**argv) {
|
|||||||
FILE *fpin, *fpout;
|
FILE *fpin, *fpout;
|
||||||
char cname[256];
|
char cname[256];
|
||||||
char sizest[256];
|
char sizest[256];
|
||||||
long size;
|
size_t size;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (argc<1) {
|
if (argc<1) {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 50 KiB |
431
release/scripts/animation_proto.py
Normal file
431
release/scripts/animation_proto.py
Normal file
@@ -0,0 +1,431 @@
|
|||||||
|
#!BPY
|
||||||
|
|
||||||
|
"""
|
||||||
|
Name: 'NLA Prototype...'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'Animation'
|
||||||
|
Tip: 'Interactivly prototype the NLA'
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = "Campbell Barton"
|
||||||
|
__url__ = ("blender.org", "blenderartists.org")
|
||||||
|
__version__ = "0.01 05/22/2008"
|
||||||
|
|
||||||
|
__bpydoc__ = """\
|
||||||
|
"""
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Anim Prototype v0.01 by Campbell Barton (AKA Ideasman42)
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENCE BLOCK *****
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
import Blender
|
||||||
|
from Blender import Window, Draw
|
||||||
|
|
||||||
|
FLAG_IS_STATE = 1<<0 # Is this a switch state
|
||||||
|
FLAG_IS_LOOP = 1<<1 # Is this a switch state
|
||||||
|
|
||||||
|
|
||||||
|
IDLE = 'Frankie_Idle1'
|
||||||
|
|
||||||
|
KMKEY = 0
|
||||||
|
KMNAME = 1
|
||||||
|
KMFLAG = 2
|
||||||
|
KMSTATE = 3
|
||||||
|
KMPRIORITY = 4
|
||||||
|
|
||||||
|
# key, actionName, flags, pressed?
|
||||||
|
KEYMAP = [\
|
||||||
|
[Draw.UPARROWKEY, 'Frankie_Walk', FLAG_IS_STATE|FLAG_IS_LOOP, False, 10],\
|
||||||
|
[Draw.LEFTARROWKEY, IDLE, FLAG_IS_STATE|FLAG_IS_LOOP, False, 0],\
|
||||||
|
[Draw.RIGHTARROWKEY, IDLE, FLAG_IS_STATE|FLAG_IS_LOOP, False, 0],\
|
||||||
|
[Draw.DOWNARROWKEY, 'Frankie_Runs', FLAG_IS_STATE|FLAG_IS_LOOP, False, 10],\
|
||||||
|
[Draw.SPACEKEY, 'Frankie_StandJump', FLAG_IS_STATE, False, 20],\
|
||||||
|
[Draw.RETKEY, 'Frankie_Throw1', FLAG_IS_STATE, False, 10],\
|
||||||
|
]
|
||||||
|
|
||||||
|
ESC = Draw.ESCKEY
|
||||||
|
|
||||||
|
def recalcRepeat(s):
|
||||||
|
actlen= s.actionEnd-s.actionStart
|
||||||
|
s.repeat = ((s.stripEnd-s.stripStart) / actlen)
|
||||||
|
|
||||||
|
|
||||||
|
def setStripStart(s, frame):
|
||||||
|
stripStart = s.stripStart
|
||||||
|
stripEnd = s.stripEnd
|
||||||
|
|
||||||
|
if frame == stripStart:
|
||||||
|
return
|
||||||
|
|
||||||
|
stripLen = stripEnd - stripStart
|
||||||
|
|
||||||
|
if frame < stripStart:
|
||||||
|
s.stripStart = frame
|
||||||
|
s.stripEnd = frame + stripLen
|
||||||
|
else:
|
||||||
|
s.stripEnd = frame + stripLen
|
||||||
|
s.stripStart = frame
|
||||||
|
|
||||||
|
def setStripEnd(s, frame):
|
||||||
|
stripStart = s.stripStart
|
||||||
|
stripEnd = s.stripEnd
|
||||||
|
|
||||||
|
if frame == stripEnd:
|
||||||
|
return
|
||||||
|
stripLen = stripEnd - stripStart
|
||||||
|
|
||||||
|
if frame < stripEnd:
|
||||||
|
s.stripStart = frame-stripLen
|
||||||
|
s.stripEnd = frame
|
||||||
|
else:
|
||||||
|
s.stripEnd = frame
|
||||||
|
s.stripStart = frame-stripLen
|
||||||
|
|
||||||
|
def setStripInf(s):
|
||||||
|
s.stripEnd = s.stripStart + 1000
|
||||||
|
recalcRepeat(s)
|
||||||
|
|
||||||
|
def setStripOnce(s):
|
||||||
|
actlen= s.actionEnd-s.actionStart
|
||||||
|
s.stripEnd = s.stripStart + actlen
|
||||||
|
recalcRepeat(s)
|
||||||
|
|
||||||
|
def fadeIn(s, frame):
|
||||||
|
#setStripStart(s, frame)
|
||||||
|
setStripStart(s, frame)
|
||||||
|
setStripInf(s)
|
||||||
|
|
||||||
|
def fadeOut(s, frame):
|
||||||
|
'''
|
||||||
|
length = s.actionEnd - s.actionStart
|
||||||
|
setStripEnd(s, frame + int(s.blendOut))
|
||||||
|
'''
|
||||||
|
|
||||||
|
if s.stripStart > frame:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
stripStartNew = s.stripStart
|
||||||
|
stripLenNew = frame - stripStartNew
|
||||||
|
actlen = s.actionEnd-s.actionStart
|
||||||
|
|
||||||
|
while stripLenNew - (s.blendIn+s.blendOut) < 0:
|
||||||
|
stripStartNew -= actlen
|
||||||
|
stripLenNew = frame - stripStartNew
|
||||||
|
#print "make way!", s.action.name
|
||||||
|
#print frame,stripLenNew
|
||||||
|
|
||||||
|
s.stripStart = stripStartNew
|
||||||
|
s.stripEnd = frame
|
||||||
|
|
||||||
|
recalcRepeat(s)
|
||||||
|
|
||||||
|
#s.stripEnd = frame - s.blendOut
|
||||||
|
#recalcRepeat(s)
|
||||||
|
|
||||||
|
#setStripEnd(s, frame)
|
||||||
|
|
||||||
|
def animloop(sce, rend, ob):
|
||||||
|
|
||||||
|
jump_momentum = None
|
||||||
|
|
||||||
|
def IS_ACTIVE_STATE(km_context):
|
||||||
|
for km in KEYMAP:
|
||||||
|
if km_context != km and km[KMSTATE] and km[KMFLAG] & FLAG_IS_STATE:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cfra = rend.cFrame
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
strips = []
|
||||||
|
|
||||||
|
|
||||||
|
def BUILD_STRIPS():
|
||||||
|
strips[:] = [(s,s.action) for s in ob.actionStrips]
|
||||||
|
|
||||||
|
BUILD_STRIPS()
|
||||||
|
|
||||||
|
def GET_PRIORITY(flag):
|
||||||
|
priority = -1
|
||||||
|
for km in KEYMAP:
|
||||||
|
if km[KMSTATE]: # Make sure this wasnt set
|
||||||
|
if km[KMFLAG] & flag:
|
||||||
|
priority = max(priority, km[KMPRIORITY])
|
||||||
|
return priority
|
||||||
|
|
||||||
|
|
||||||
|
def TEST_STRIP(frame):
|
||||||
|
for s,a in strips:
|
||||||
|
if not (s.flag & Blender.Armature.NLA.Flags.MUTE):
|
||||||
|
if s.stripStart+s.blendIn <= frame and s.stripEnd-s.blendOut >= frame:
|
||||||
|
# print s.action.name
|
||||||
|
return True
|
||||||
|
# print "NBOPATHC"
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def SET_ACTIVE(km):
|
||||||
|
blend = 0
|
||||||
|
ok = False
|
||||||
|
|
||||||
|
for s,a in strips:
|
||||||
|
if a.name == km[KMNAME]:
|
||||||
|
ok = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if ok:
|
||||||
|
# blend = s.blendOut
|
||||||
|
|
||||||
|
fadeIn(s, cfra)
|
||||||
|
s.flag &= ~Blender.Armature.NLA.Flags.MUTE
|
||||||
|
|
||||||
|
if not (km[KMFLAG] & FLAG_IS_LOOP):
|
||||||
|
setStripOnce(s)
|
||||||
|
|
||||||
|
for i in xrange(len(strips)):
|
||||||
|
ob.actionStrips.moveUp(s)
|
||||||
|
BUILD_STRIPS()
|
||||||
|
|
||||||
|
|
||||||
|
for s,a in strips:
|
||||||
|
if a.name != km[KMNAME]:
|
||||||
|
fadeOut(s, cfra + s.blendOut)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def SET_IDLE():
|
||||||
|
blend = 0
|
||||||
|
ok = False
|
||||||
|
for s,a in strips:
|
||||||
|
# print a.name
|
||||||
|
if a.name == IDLE:
|
||||||
|
# setStripStart(s, cfra)
|
||||||
|
ok = True
|
||||||
|
break
|
||||||
|
if ok:
|
||||||
|
blend = s.blendOut
|
||||||
|
fadeIn(s, cfra)
|
||||||
|
s.flag &= ~Blender.Armature.NLA.Flags.MUTE
|
||||||
|
|
||||||
|
for i in xrange(len(strips)):
|
||||||
|
ob.actionStrips.moveUp(s)
|
||||||
|
BUILD_STRIPS()
|
||||||
|
|
||||||
|
for s,a in strips:
|
||||||
|
if a.name != IDLE:
|
||||||
|
fadeOut(s, cfra+s.blendOut)
|
||||||
|
|
||||||
|
for s,a in strips:
|
||||||
|
# print a.name
|
||||||
|
if a.name == IDLE:
|
||||||
|
setStripStart(s, cfra)
|
||||||
|
setStripInf(s)
|
||||||
|
s.flag &= ~Blender.Armature.NLA.Flags.MUTE
|
||||||
|
else:
|
||||||
|
setStripOnce(s)
|
||||||
|
setStripEnd(s, 0)
|
||||||
|
s.flag |= Blender.Armature.NLA.Flags.MUTE
|
||||||
|
|
||||||
|
context_act = IDLE
|
||||||
|
|
||||||
|
while 1:
|
||||||
|
cfra = rend.cFrame
|
||||||
|
# sce.update()
|
||||||
|
#print "cfra", cfra
|
||||||
|
while Window.QTest():
|
||||||
|
evt, val = Window.QRead()
|
||||||
|
if evt == Draw.MOUSEX or evt == Draw.MOUSEY:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print evt, val
|
||||||
|
|
||||||
|
priority = GET_PRIORITY(FLAG_IS_STATE)
|
||||||
|
|
||||||
|
for km in KEYMAP:
|
||||||
|
if km[0] == evt:
|
||||||
|
if val:
|
||||||
|
if not km[KMSTATE]: # Make sure this wasnt set
|
||||||
|
if km[KMFLAG] & FLAG_IS_STATE and priority <= km[KMPRIORITY]:
|
||||||
|
if context_act != km[KMNAME]:
|
||||||
|
context_act = km[KMNAME]
|
||||||
|
SET_ACTIVE(km)
|
||||||
|
|
||||||
|
km[KMSTATE] = val
|
||||||
|
else:
|
||||||
|
if km[KMFLAG] & FLAG_IS_STATE and (km[KMFLAG] & FLAG_IS_LOOP):
|
||||||
|
if not IS_ACTIVE_STATE(km):
|
||||||
|
if context_act != IDLE:
|
||||||
|
# print "SETTING IDLE1"
|
||||||
|
context_act = IDLE
|
||||||
|
SET_IDLE()
|
||||||
|
context_act = IDLE
|
||||||
|
|
||||||
|
km[KMSTATE] = val
|
||||||
|
|
||||||
|
# In some cases we want to keep km[KMSTATE] even if the key is off
|
||||||
|
|
||||||
|
if evt == ESC:
|
||||||
|
return
|
||||||
|
|
||||||
|
for s,a in strips:
|
||||||
|
if s.stripEnd < cfra:
|
||||||
|
s.flag |= Blender.Armature.NLA.Flags.MUTE
|
||||||
|
|
||||||
|
# End all loops that are active but have finished
|
||||||
|
for km in KEYMAP:
|
||||||
|
if km[KMSTATE] and not (km[KMFLAG] & FLAG_IS_LOOP):
|
||||||
|
for s,a in strips:
|
||||||
|
if a.name == km[KMNAME]:
|
||||||
|
if s.stripEnd - s.blendOut <= cfra:
|
||||||
|
# print s.stripEnd, cfra
|
||||||
|
km[KMSTATE] = False
|
||||||
|
# print "TEST!!!"
|
||||||
|
|
||||||
|
|
||||||
|
# Set Idle if none are active
|
||||||
|
if not IS_ACTIVE_STATE(None):
|
||||||
|
if context_act != IDLE:
|
||||||
|
context_act = IDLE
|
||||||
|
SET_IDLE()
|
||||||
|
context_act = IDLE
|
||||||
|
else:
|
||||||
|
priority = GET_PRIORITY(FLAG_IS_STATE | FLAG_IS_LOOP)
|
||||||
|
if not TEST_STRIP(cfra):
|
||||||
|
for km in KEYMAP:
|
||||||
|
if km[KMSTATE]:
|
||||||
|
if km[KMFLAG] & FLAG_IS_STATE and km[KMFLAG] & FLAG_IS_LOOP and priority <= km[KMPRIORITY]:
|
||||||
|
context_act = km[KMNAME]
|
||||||
|
SET_ACTIVE(km)
|
||||||
|
|
||||||
|
|
||||||
|
for km in KEYMAP:
|
||||||
|
if km[KMSTATE]: # This key is held
|
||||||
|
if km[KMKEY] == Draw.LEFTARROWKEY:
|
||||||
|
ob.RotZ-=0.1
|
||||||
|
elif km[KMKEY] == Draw.RIGHTARROWKEY:
|
||||||
|
ob.RotZ+=0.1
|
||||||
|
elif km[KMKEY] == Draw.UPARROWKEY or km[KMKEY] == Draw.DOWNARROWKEY:
|
||||||
|
mat = ob.matrixWorld.rotationPart()
|
||||||
|
if km[KMKEY] == Draw.DOWNARROWKEY:
|
||||||
|
ofs = Blender.Mathutils.Vector(0,0.04,0) * mat
|
||||||
|
else:
|
||||||
|
ofs = Blender.Mathutils.Vector(0,0.02,0) * mat
|
||||||
|
ob.LocX += ofs.x
|
||||||
|
ob.LocY += ofs.y
|
||||||
|
#ob.LocZ += ofs.z
|
||||||
|
elif km[KMKEY] == Draw.SPACEKEY:
|
||||||
|
if jump_momentum == None:
|
||||||
|
jump_momentum = 0.15
|
||||||
|
|
||||||
|
|
||||||
|
if jump_momentum != None:
|
||||||
|
ob.LocZ += jump_momentum
|
||||||
|
|
||||||
|
if ob.LocZ < 0:
|
||||||
|
ob.LocZ = 0
|
||||||
|
jump_momentum = None
|
||||||
|
|
||||||
|
# Force the key off
|
||||||
|
for km in KEYMAP:
|
||||||
|
if km[KMKEY] == Draw.SPACEKEY:
|
||||||
|
km[KMSTATE] = False
|
||||||
|
else:
|
||||||
|
jump_momentum -= 0.01
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rend.cFrame = cfra+1
|
||||||
|
|
||||||
|
ob.makeDisplayList()
|
||||||
|
|
||||||
|
Window.RedrawAll()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
sce = bpy.data.scenes.active
|
||||||
|
rend = sce.render
|
||||||
|
ob = sce.objects.active
|
||||||
|
|
||||||
|
back_cfra = rend.cFrame
|
||||||
|
back_sfra = rend.sFrame
|
||||||
|
back_efra = rend.eFrame
|
||||||
|
|
||||||
|
rend.sFrame = 1
|
||||||
|
rend.eFrame = 300000
|
||||||
|
|
||||||
|
|
||||||
|
if not ob:
|
||||||
|
print 'No Active Object'
|
||||||
|
return
|
||||||
|
|
||||||
|
animloop(sce, rend, ob)
|
||||||
|
|
||||||
|
rend.cFrame = back_cfra
|
||||||
|
rend.sFrame = back_sfra
|
||||||
|
rend.eFrame = back_efra
|
||||||
|
|
||||||
|
|
||||||
|
Window.RedrawAll()
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
def debug():
|
||||||
|
sce = bpy.data.scenes.active
|
||||||
|
rend = sce.render
|
||||||
|
ob = sce.objects.active
|
||||||
|
for s in ob.actionStrips:
|
||||||
|
# print s.action.name
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#recalcRepeat(s)
|
||||||
|
#setStripEnd(s, 100)
|
||||||
|
#setStripEnd(s, 100)
|
||||||
|
#setStripEnd(s, 200)
|
||||||
|
#setStripEnd(s, 100)
|
||||||
|
#setStripEnd(s, 100)
|
||||||
|
|
||||||
|
Window.RedrawAll()
|
||||||
|
ob.makeDisplayList()
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
#debug()
|
||||||
|
|
||||||
|
|
||||||
|
|
814
release/scripts/bpymodules/BPyTextPlugin.py
Normal file
814
release/scripts/bpymodules/BPyTextPlugin.py
Normal file
@@ -0,0 +1,814 @@
|
|||||||
|
"""The BPyTextPlugin Module
|
||||||
|
|
||||||
|
Use get_cached_descriptor(txt) to retrieve information about the script held in
|
||||||
|
the txt Text object.
|
||||||
|
|
||||||
|
Use print_cache_for(txt) to print the information to the console.
|
||||||
|
|
||||||
|
Use line, cursor = current_line(txt) to get the logical line and cursor position
|
||||||
|
|
||||||
|
Use get_targets(line, cursor) to find out what precedes the cursor:
|
||||||
|
aaa.bbb.cc|c.ddd -> ['aaa', 'bbb', 'cc']
|
||||||
|
|
||||||
|
Use resolve_targets(txt, targets) to turn a target list into a usable object if
|
||||||
|
one is found to match.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import bpy, sys, os
|
||||||
|
import __builtin__, tokenize
|
||||||
|
from Blender.sys import time
|
||||||
|
from tokenize import generate_tokens, TokenError, \
|
||||||
|
COMMENT, DEDENT, INDENT, NAME, NEWLINE, NL, STRING, NUMBER
|
||||||
|
|
||||||
|
class Definition():
|
||||||
|
"""Describes a definition or defined object through its name, line number
|
||||||
|
and docstring. This is the base class for definition based descriptors.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name, lineno, doc=''):
|
||||||
|
self.name = name
|
||||||
|
self.lineno = lineno
|
||||||
|
self.doc = doc
|
||||||
|
|
||||||
|
class ScriptDesc():
|
||||||
|
"""Describes a script through lists of further descriptor objects (classes,
|
||||||
|
defs, vars) and dictionaries to built-in types (imports). If a script has
|
||||||
|
not been fully parsed, its incomplete flag will be set. The time of the last
|
||||||
|
parse is held by the time field and the name of the text object from which
|
||||||
|
it was parsed, the name field.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name, imports, classes, defs, vars, incomplete=False):
|
||||||
|
self.name = name
|
||||||
|
self.imports = imports
|
||||||
|
self.classes = classes
|
||||||
|
self.defs = defs
|
||||||
|
self.vars = vars
|
||||||
|
self.incomplete = incomplete
|
||||||
|
self.parse_due = 0
|
||||||
|
|
||||||
|
def set_delay(self, delay):
|
||||||
|
self.parse_due = time() + delay
|
||||||
|
|
||||||
|
class ClassDesc(Definition):
|
||||||
|
"""Describes a class through lists of further descriptor objects (defs and
|
||||||
|
vars). The name of the class is held by the name field and the line on
|
||||||
|
which it is defined is held in lineno.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name, parents, defs, vars, lineno, doc=''):
|
||||||
|
Definition.__init__(self, name, lineno, doc)
|
||||||
|
self.parents = parents
|
||||||
|
self.defs = defs
|
||||||
|
self.vars = vars
|
||||||
|
|
||||||
|
class FunctionDesc(Definition):
|
||||||
|
"""Describes a function through its name and list of parameters (name,
|
||||||
|
params) and the line on which it is defined (lineno).
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name, params, lineno, doc=''):
|
||||||
|
Definition.__init__(self, name, lineno, doc)
|
||||||
|
self.params = params
|
||||||
|
|
||||||
|
class VarDesc(Definition):
|
||||||
|
"""Describes a variable through its name and type (if ascertainable) and the
|
||||||
|
line on which it is defined (lineno). If no type can be determined, type
|
||||||
|
will equal None.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name, type, lineno):
|
||||||
|
Definition.__init__(self, name, lineno)
|
||||||
|
self.type = type # None for unknown (supports: dict/list/str)
|
||||||
|
|
||||||
|
# Context types
|
||||||
|
CTX_UNSET = -1
|
||||||
|
CTX_NORMAL = 0
|
||||||
|
CTX_SINGLE_QUOTE = 1
|
||||||
|
CTX_DOUBLE_QUOTE = 2
|
||||||
|
CTX_COMMENT = 3
|
||||||
|
|
||||||
|
# Python keywords
|
||||||
|
KEYWORDS = ['and', 'del', 'from', 'not', 'while', 'as', 'elif', 'global',
|
||||||
|
'or', 'with', 'assert', 'else', 'if', 'pass', 'yield',
|
||||||
|
'break', 'except', 'import', 'print', 'class', 'exec', 'in',
|
||||||
|
'raise', 'continue', 'finally', 'is', 'return', 'def', 'for',
|
||||||
|
'lambda', 'try' ]
|
||||||
|
|
||||||
|
# Module file extensions
|
||||||
|
MODULE_EXTS = ['.py', '.pyc', '.pyo', '.pyw', '.pyd']
|
||||||
|
|
||||||
|
ModuleType = type(__builtin__)
|
||||||
|
NoneScriptDesc = ScriptDesc('', dict(), dict(), dict(), dict(), True)
|
||||||
|
|
||||||
|
_modules = {}
|
||||||
|
_modules_updated = 0
|
||||||
|
_parse_cache = dict()
|
||||||
|
|
||||||
|
def _load_module_names():
|
||||||
|
"""Searches the sys.path for module files and lists them, along with
|
||||||
|
sys.builtin_module_names, in the global dict _modules.
|
||||||
|
"""
|
||||||
|
|
||||||
|
global _modules
|
||||||
|
|
||||||
|
for n in sys.builtin_module_names:
|
||||||
|
_modules[n] = None
|
||||||
|
for p in sys.path:
|
||||||
|
if p == '': p = os.curdir
|
||||||
|
if not os.path.isdir(p): continue
|
||||||
|
for f in os.listdir(p):
|
||||||
|
for ext in MODULE_EXTS:
|
||||||
|
if f.endswith(ext):
|
||||||
|
_modules[f[:-len(ext)]] = None
|
||||||
|
break
|
||||||
|
|
||||||
|
_load_module_names()
|
||||||
|
|
||||||
|
def _trim_doc(doc):
|
||||||
|
"""Trims the quotes from a quoted STRING token (eg. "'''text'''" -> "text")
|
||||||
|
"""
|
||||||
|
|
||||||
|
l = len(doc)
|
||||||
|
i = 0
|
||||||
|
while i < l/2 and (doc[i] == "'" or doc[i] == '"'):
|
||||||
|
i += 1
|
||||||
|
return doc[i:-i]
|
||||||
|
|
||||||
|
def resolve_targets(txt, targets):
|
||||||
|
"""Attempts to return a useful object for the locally or externally defined
|
||||||
|
entity described by targets. If the object is local (defined in txt), a
|
||||||
|
Definition instance is returned. If the object is external (imported or
|
||||||
|
built in), the object itself is returned. If no object can be found, None is
|
||||||
|
returned.
|
||||||
|
"""
|
||||||
|
|
||||||
|
count = len(targets)
|
||||||
|
if count==0: return None
|
||||||
|
|
||||||
|
obj = None
|
||||||
|
local = None
|
||||||
|
i = 1
|
||||||
|
|
||||||
|
desc = get_cached_descriptor(txt)
|
||||||
|
b = targets[0].find('(')
|
||||||
|
if b==-1: b = None # Trick to let us use [:b] and get the whole string
|
||||||
|
|
||||||
|
if desc.classes.has_key(targets[0][:b]):
|
||||||
|
local = desc.classes[targets[0][:b]]
|
||||||
|
elif desc.defs.has_key(targets[0]):
|
||||||
|
local = desc.defs[targets[0]]
|
||||||
|
elif desc.vars.has_key(targets[0]):
|
||||||
|
obj = desc.vars[targets[0]].type
|
||||||
|
|
||||||
|
if local:
|
||||||
|
while i < count:
|
||||||
|
b = targets[i].find('(')
|
||||||
|
if b==-1: b = None
|
||||||
|
if hasattr(local, 'classes') and local.classes.has_key(targets[i][:b]):
|
||||||
|
local = local.classes[targets[i][:b]]
|
||||||
|
elif hasattr(local, 'defs') and local.defs.has_key(targets[i]):
|
||||||
|
local = local.defs[targets[i]]
|
||||||
|
elif hasattr(local, 'vars') and local.vars.has_key(targets[i]):
|
||||||
|
obj = local.vars[targets[i]].type
|
||||||
|
local = None
|
||||||
|
i += 1
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
local = None
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
if local: return local
|
||||||
|
|
||||||
|
if not obj:
|
||||||
|
if desc.imports.has_key(targets[0]):
|
||||||
|
obj = desc.imports[targets[0]]
|
||||||
|
else:
|
||||||
|
builtins = get_builtins()
|
||||||
|
if builtins.has_key(targets[0]):
|
||||||
|
obj = builtins[targets[0]]
|
||||||
|
|
||||||
|
while obj and i < count:
|
||||||
|
if hasattr(obj, targets[i]):
|
||||||
|
obj = getattr(obj, targets[i])
|
||||||
|
else:
|
||||||
|
obj = None
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
return obj
|
||||||
|
|
||||||
|
def get_cached_descriptor(txt, force_parse=0):
|
||||||
|
"""Returns the cached ScriptDesc for the specified Text object 'txt'. If the
|
||||||
|
script has not been parsed in the last 'period' seconds it will be reparsed
|
||||||
|
to obtain this descriptor.
|
||||||
|
|
||||||
|
Specifying TP_AUTO for the period (default) will choose a period based on the
|
||||||
|
size of the Text object. Larger texts are parsed less often.
|
||||||
|
"""
|
||||||
|
|
||||||
|
global _parse_cache
|
||||||
|
|
||||||
|
parse = True
|
||||||
|
key = hash(txt)
|
||||||
|
if not force_parse and _parse_cache.has_key(key):
|
||||||
|
desc = _parse_cache[key]
|
||||||
|
if desc.parse_due > time():
|
||||||
|
parse = desc.incomplete
|
||||||
|
|
||||||
|
if parse:
|
||||||
|
desc = parse_text(txt)
|
||||||
|
|
||||||
|
return desc
|
||||||
|
|
||||||
|
def parse_text(txt):
|
||||||
|
"""Parses an entire script's text and returns a ScriptDesc instance
|
||||||
|
containing information about the script.
|
||||||
|
|
||||||
|
If the text is not a valid Python script (for example if brackets are left
|
||||||
|
open), parsing may fail to complete. However, if this occurs, no exception
|
||||||
|
is thrown. Instead the returned ScriptDesc instance will have its incomplete
|
||||||
|
flag set and information processed up to this point will still be accessible.
|
||||||
|
"""
|
||||||
|
|
||||||
|
start_time = time()
|
||||||
|
txt.reset()
|
||||||
|
tokens = generate_tokens(txt.readline) # Throws TokenError
|
||||||
|
|
||||||
|
curl, cursor = txt.getCursorPos()
|
||||||
|
linen = curl + 1 # Token line numbers are one-based
|
||||||
|
|
||||||
|
imports = dict()
|
||||||
|
imp_step = 0
|
||||||
|
|
||||||
|
classes = dict()
|
||||||
|
cls_step = 0
|
||||||
|
|
||||||
|
defs = dict()
|
||||||
|
def_step = 0
|
||||||
|
|
||||||
|
vars = dict()
|
||||||
|
var1_step = 0
|
||||||
|
var2_step = 0
|
||||||
|
var3_step = 0
|
||||||
|
var_accum = dict()
|
||||||
|
var_forflag = False
|
||||||
|
|
||||||
|
indent = 0
|
||||||
|
prev_type = -1
|
||||||
|
prev_text = ''
|
||||||
|
incomplete = False
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
type, text, start, end, line = tokens.next()
|
||||||
|
except StopIteration:
|
||||||
|
break
|
||||||
|
except (TokenError, IndentationError):
|
||||||
|
incomplete = True
|
||||||
|
break
|
||||||
|
|
||||||
|
# Skip all comments and line joining characters
|
||||||
|
if type == COMMENT or type == NL:
|
||||||
|
continue
|
||||||
|
|
||||||
|
#################
|
||||||
|
## Indentation ##
|
||||||
|
#################
|
||||||
|
|
||||||
|
if type == INDENT:
|
||||||
|
indent += 1
|
||||||
|
elif type == DEDENT:
|
||||||
|
indent -= 1
|
||||||
|
|
||||||
|
#########################
|
||||||
|
## Module importing... ##
|
||||||
|
#########################
|
||||||
|
|
||||||
|
imp_store = False
|
||||||
|
|
||||||
|
# Default, look for 'from' or 'import' to start
|
||||||
|
if imp_step == 0:
|
||||||
|
if text == 'from':
|
||||||
|
imp_tmp = []
|
||||||
|
imp_step = 1
|
||||||
|
elif text == 'import':
|
||||||
|
imp_from = None
|
||||||
|
imp_tmp = []
|
||||||
|
imp_step = 2
|
||||||
|
|
||||||
|
# Found a 'from', create imp_from in form '???.???...'
|
||||||
|
elif imp_step == 1:
|
||||||
|
if text == 'import':
|
||||||
|
imp_from = '.'.join(imp_tmp)
|
||||||
|
imp_tmp = []
|
||||||
|
imp_step = 2
|
||||||
|
elif type == NAME:
|
||||||
|
imp_tmp.append(text)
|
||||||
|
elif text != '.':
|
||||||
|
imp_step = 0 # Invalid syntax
|
||||||
|
|
||||||
|
# Found 'import', imp_from is populated or None, create imp_name
|
||||||
|
elif imp_step == 2:
|
||||||
|
if text == 'as':
|
||||||
|
imp_name = '.'.join(imp_tmp)
|
||||||
|
imp_step = 3
|
||||||
|
elif type == NAME or text == '*':
|
||||||
|
imp_tmp.append(text)
|
||||||
|
elif text != '.':
|
||||||
|
imp_name = '.'.join(imp_tmp)
|
||||||
|
imp_symb = imp_name
|
||||||
|
imp_store = True
|
||||||
|
|
||||||
|
# Found 'as', change imp_symb to this value and go back to step 2
|
||||||
|
elif imp_step == 3:
|
||||||
|
if type == NAME:
|
||||||
|
imp_symb = text
|
||||||
|
else:
|
||||||
|
imp_store = True
|
||||||
|
|
||||||
|
# Both imp_name and imp_symb have now been populated so we can import
|
||||||
|
if imp_store:
|
||||||
|
|
||||||
|
# Handle special case of 'import *'
|
||||||
|
if imp_name == '*':
|
||||||
|
parent = get_module(imp_from)
|
||||||
|
imports.update(parent.__dict__)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Try importing the name as a module
|
||||||
|
try:
|
||||||
|
if imp_from:
|
||||||
|
module = get_module(imp_from +'.'+ imp_name)
|
||||||
|
else:
|
||||||
|
module = get_module(imp_name)
|
||||||
|
except (ImportError, ValueError, AttributeError, TypeError):
|
||||||
|
# Try importing name as an attribute of the parent
|
||||||
|
try:
|
||||||
|
module = __import__(imp_from, globals(), locals(), [imp_name])
|
||||||
|
imports[imp_symb] = getattr(module, imp_name)
|
||||||
|
except (ImportError, ValueError, AttributeError, TypeError):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
imports[imp_symb] = module
|
||||||
|
|
||||||
|
# More to import from the same module?
|
||||||
|
if text == ',':
|
||||||
|
imp_tmp = []
|
||||||
|
imp_step = 2
|
||||||
|
else:
|
||||||
|
imp_step = 0
|
||||||
|
|
||||||
|
###################
|
||||||
|
## Class parsing ##
|
||||||
|
###################
|
||||||
|
|
||||||
|
# If we are inside a class then def and variable parsing should be done
|
||||||
|
# for the class. Otherwise the definitions are considered global
|
||||||
|
|
||||||
|
# Look for 'class'
|
||||||
|
if cls_step == 0:
|
||||||
|
if text == 'class':
|
||||||
|
cls_name = None
|
||||||
|
cls_lineno = start[0]
|
||||||
|
cls_indent = indent
|
||||||
|
cls_step = 1
|
||||||
|
|
||||||
|
# Found 'class', look for cls_name followed by '(' parents ')'
|
||||||
|
elif cls_step == 1:
|
||||||
|
if not cls_name:
|
||||||
|
if type == NAME:
|
||||||
|
cls_name = text
|
||||||
|
cls_sline = False
|
||||||
|
cls_parents = dict()
|
||||||
|
cls_defs = dict()
|
||||||
|
cls_vars = dict()
|
||||||
|
elif type == NAME:
|
||||||
|
if classes.has_key(text):
|
||||||
|
parent = classes[text]
|
||||||
|
cls_parents[text] = parent
|
||||||
|
cls_defs.update(parent.defs)
|
||||||
|
cls_vars.update(parent.vars)
|
||||||
|
elif text == ':':
|
||||||
|
cls_step = 2
|
||||||
|
|
||||||
|
# Found 'class' name ... ':', now check if it's a single line statement
|
||||||
|
elif cls_step == 2:
|
||||||
|
if type == NEWLINE:
|
||||||
|
cls_sline = False
|
||||||
|
else:
|
||||||
|
cls_sline = True
|
||||||
|
cls_doc = ''
|
||||||
|
cls_step = 3
|
||||||
|
|
||||||
|
elif cls_step == 3:
|
||||||
|
if not cls_doc and type == STRING:
|
||||||
|
cls_doc = _trim_doc(text)
|
||||||
|
if cls_sline:
|
||||||
|
if type == NEWLINE:
|
||||||
|
classes[cls_name] = ClassDesc(cls_name, cls_parents, cls_defs, cls_vars, cls_lineno, cls_doc)
|
||||||
|
cls_step = 0
|
||||||
|
else:
|
||||||
|
if type == DEDENT and indent <= cls_indent:
|
||||||
|
classes[cls_name] = ClassDesc(cls_name, cls_parents, cls_defs, cls_vars, cls_lineno, cls_doc)
|
||||||
|
cls_step = 0
|
||||||
|
|
||||||
|
#################
|
||||||
|
## Def parsing ##
|
||||||
|
#################
|
||||||
|
|
||||||
|
# Look for 'def'
|
||||||
|
if def_step == 0:
|
||||||
|
if text == 'def':
|
||||||
|
def_name = None
|
||||||
|
def_lineno = start[0]
|
||||||
|
def_step = 1
|
||||||
|
|
||||||
|
# Found 'def', look for def_name followed by '('
|
||||||
|
elif def_step == 1:
|
||||||
|
if type == NAME:
|
||||||
|
def_name = text
|
||||||
|
def_params = []
|
||||||
|
elif def_name and text == '(':
|
||||||
|
def_step = 2
|
||||||
|
|
||||||
|
# Found 'def' name '(', now identify the parameters upto ')'
|
||||||
|
# TODO: Handle ellipsis '...'
|
||||||
|
elif def_step == 2:
|
||||||
|
if type == NAME:
|
||||||
|
def_params.append(text)
|
||||||
|
elif text == ':':
|
||||||
|
def_step = 3
|
||||||
|
|
||||||
|
# Found 'def' ... ':', now check if it's a single line statement
|
||||||
|
elif def_step == 3:
|
||||||
|
if type == NEWLINE:
|
||||||
|
def_sline = False
|
||||||
|
else:
|
||||||
|
def_sline = True
|
||||||
|
def_doc = ''
|
||||||
|
def_step = 4
|
||||||
|
|
||||||
|
elif def_step == 4:
|
||||||
|
if type == STRING:
|
||||||
|
def_doc = _trim_doc(text)
|
||||||
|
newdef = None
|
||||||
|
if def_sline:
|
||||||
|
if type == NEWLINE:
|
||||||
|
newdef = FunctionDesc(def_name, def_params, def_lineno, def_doc)
|
||||||
|
else:
|
||||||
|
if type == NAME:
|
||||||
|
newdef = FunctionDesc(def_name, def_params, def_lineno, def_doc)
|
||||||
|
if newdef:
|
||||||
|
if cls_step > 0: # Parsing a class
|
||||||
|
cls_defs[def_name] = newdef
|
||||||
|
else:
|
||||||
|
defs[def_name] = newdef
|
||||||
|
def_step = 0
|
||||||
|
|
||||||
|
##########################
|
||||||
|
## Variable assignation ##
|
||||||
|
##########################
|
||||||
|
|
||||||
|
if cls_step > 0: # Parsing a class
|
||||||
|
# Look for 'self.???'
|
||||||
|
if var1_step == 0:
|
||||||
|
if text == 'self':
|
||||||
|
var1_step = 1
|
||||||
|
elif var1_step == 1:
|
||||||
|
if text == '.':
|
||||||
|
var_name = None
|
||||||
|
var1_step = 2
|
||||||
|
else:
|
||||||
|
var1_step = 0
|
||||||
|
elif var1_step == 2:
|
||||||
|
if type == NAME:
|
||||||
|
var_name = text
|
||||||
|
if cls_vars.has_key(var_name):
|
||||||
|
var_step = 0
|
||||||
|
else:
|
||||||
|
var1_step = 3
|
||||||
|
elif var1_step == 3:
|
||||||
|
if text == '=':
|
||||||
|
var1_step = 4
|
||||||
|
elif text != ',':
|
||||||
|
var1_step = 0
|
||||||
|
elif var1_step == 4:
|
||||||
|
var_type = None
|
||||||
|
if type == NUMBER:
|
||||||
|
close = end[1]
|
||||||
|
if text.find('.') != -1: var_type = float
|
||||||
|
else: var_type = int
|
||||||
|
elif type == STRING:
|
||||||
|
close = end[1]
|
||||||
|
var_type = str
|
||||||
|
elif text == '[':
|
||||||
|
close = line.find(']', end[1])
|
||||||
|
var_type = list
|
||||||
|
elif text == '(':
|
||||||
|
close = line.find(')', end[1])
|
||||||
|
var_type = tuple
|
||||||
|
elif text == '{':
|
||||||
|
close = line.find('}', end[1])
|
||||||
|
var_type = dict
|
||||||
|
elif text == 'dict':
|
||||||
|
close = line.find(')', end[1])
|
||||||
|
var_type = dict
|
||||||
|
if var_type and close+1 < len(line):
|
||||||
|
if line[close+1] != ' ' and line[close+1] != '\t':
|
||||||
|
var_type = None
|
||||||
|
cls_vars[var_name] = VarDesc(var_name, var_type, start[0])
|
||||||
|
var1_step = 0
|
||||||
|
|
||||||
|
elif def_step > 0: # Parsing a def
|
||||||
|
# Look for 'global ???[,???]'
|
||||||
|
if var2_step == 0:
|
||||||
|
if text == 'global':
|
||||||
|
var2_step = 1
|
||||||
|
elif var2_step == 1:
|
||||||
|
if type == NAME:
|
||||||
|
if not vars.has_key(text):
|
||||||
|
vars[text] = VarDesc(text, None, start[0])
|
||||||
|
elif text != ',' and type != NL:
|
||||||
|
var2_step == 0
|
||||||
|
|
||||||
|
else: # In global scope
|
||||||
|
if var3_step == 0:
|
||||||
|
# Look for names
|
||||||
|
if text == 'for':
|
||||||
|
var_accum = dict()
|
||||||
|
var_forflag = True
|
||||||
|
elif text == '=' or (var_forflag and text == 'in'):
|
||||||
|
var_forflag = False
|
||||||
|
var3_step = 1
|
||||||
|
elif type == NAME:
|
||||||
|
if prev_text != '.' and not vars.has_key(text):
|
||||||
|
var_accum[text] = VarDesc(text, None, start[0])
|
||||||
|
elif not text in [',', '(', ')', '[', ']']:
|
||||||
|
var_accum = dict()
|
||||||
|
var_forflag = False
|
||||||
|
elif var3_step == 1:
|
||||||
|
if len(var_accum) != 1:
|
||||||
|
var_type = None
|
||||||
|
vars.update(var_accum)
|
||||||
|
else:
|
||||||
|
var_name = var_accum.keys()[0]
|
||||||
|
var_type = None
|
||||||
|
if type == NUMBER:
|
||||||
|
if text.find('.') != -1: var_type = float
|
||||||
|
else: var_type = int
|
||||||
|
elif type == STRING: var_type = str
|
||||||
|
elif text == '[': var_type = list
|
||||||
|
elif text == '(': var_type = tuple
|
||||||
|
elif text == '{': var_type = dict
|
||||||
|
vars[var_name] = VarDesc(var_name, var_type, start[0])
|
||||||
|
var3_step = 0
|
||||||
|
|
||||||
|
#######################
|
||||||
|
## General utilities ##
|
||||||
|
#######################
|
||||||
|
|
||||||
|
prev_type = type
|
||||||
|
prev_text = text
|
||||||
|
|
||||||
|
desc = ScriptDesc(txt.name, imports, classes, defs, vars, incomplete)
|
||||||
|
desc.set_delay(10 * (time()-start_time) + 0.05)
|
||||||
|
|
||||||
|
global _parse_cache
|
||||||
|
_parse_cache[hash(txt)] = desc
|
||||||
|
return desc
|
||||||
|
|
||||||
|
def get_modules(since=1):
|
||||||
|
"""Returns the set of built-in modules and any modules that have been
|
||||||
|
imported into the system upto 'since' seconds ago.
|
||||||
|
"""
|
||||||
|
|
||||||
|
global _modules, _modules_updated
|
||||||
|
|
||||||
|
t = time()
|
||||||
|
if _modules_updated < t - since:
|
||||||
|
_modules.update(sys.modules)
|
||||||
|
_modules_updated = t
|
||||||
|
return _modules.keys()
|
||||||
|
|
||||||
|
def suggest_cmp(x, y):
|
||||||
|
"""Use this method when sorting a list of suggestions.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return cmp(x[0].upper(), y[0].upper())
|
||||||
|
|
||||||
|
def get_module(name):
|
||||||
|
"""Returns the module specified by its name. The module itself is imported
|
||||||
|
by this method and, as such, any initialization code will be executed.
|
||||||
|
"""
|
||||||
|
|
||||||
|
mod = __import__(name)
|
||||||
|
components = name.split('.')
|
||||||
|
for comp in components[1:]:
|
||||||
|
mod = getattr(mod, comp)
|
||||||
|
return mod
|
||||||
|
|
||||||
|
def type_char(v):
|
||||||
|
"""Returns the character used to signify the type of a variable. Use this
|
||||||
|
method to identify the type character for an item in a suggestion list.
|
||||||
|
|
||||||
|
The following values are returned:
|
||||||
|
'm' if the parameter is a module
|
||||||
|
'f' if the parameter is callable
|
||||||
|
'v' if the parameter is variable or otherwise indeterminable
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
if isinstance(v, ModuleType):
|
||||||
|
return 'm'
|
||||||
|
elif callable(v):
|
||||||
|
return 'f'
|
||||||
|
else:
|
||||||
|
return 'v'
|
||||||
|
|
||||||
|
def get_context(txt):
|
||||||
|
"""Establishes the context of the cursor in the given Blender Text object
|
||||||
|
|
||||||
|
Returns one of:
|
||||||
|
CTX_NORMAL - Cursor is in a normal context
|
||||||
|
CTX_SINGLE_QUOTE - Cursor is inside a single quoted string
|
||||||
|
CTX_DOUBLE_QUOTE - Cursor is inside a double quoted string
|
||||||
|
CTX_COMMENT - Cursor is inside a comment
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
l, cursor = txt.getCursorPos()
|
||||||
|
lines = txt.asLines(0, l+1)
|
||||||
|
|
||||||
|
# FIXME: This method is too slow in large files for it to be called as often
|
||||||
|
# as it is. So for lines below the 1000th line we do this... (quorn)
|
||||||
|
if l > 1000: return CTX_NORMAL
|
||||||
|
|
||||||
|
# Detect context (in string or comment)
|
||||||
|
in_str = CTX_NORMAL
|
||||||
|
for line in lines:
|
||||||
|
if l == 0:
|
||||||
|
end = cursor
|
||||||
|
else:
|
||||||
|
end = len(line)
|
||||||
|
l -= 1
|
||||||
|
|
||||||
|
# Comments end at new lines
|
||||||
|
if in_str == CTX_COMMENT:
|
||||||
|
in_str = CTX_NORMAL
|
||||||
|
|
||||||
|
for i in range(end):
|
||||||
|
if in_str == 0:
|
||||||
|
if line[i] == "'": in_str = CTX_SINGLE_QUOTE
|
||||||
|
elif line[i] == '"': in_str = CTX_DOUBLE_QUOTE
|
||||||
|
elif line[i] == '#': in_str = CTX_COMMENT
|
||||||
|
else:
|
||||||
|
if in_str == CTX_SINGLE_QUOTE:
|
||||||
|
if line[i] == "'":
|
||||||
|
in_str = CTX_NORMAL
|
||||||
|
# In again if ' escaped, out again if \ escaped, and so on
|
||||||
|
for a in range(i-1, -1, -1):
|
||||||
|
if line[a] == '\\': in_str = 1-in_str
|
||||||
|
else: break
|
||||||
|
elif in_str == CTX_DOUBLE_QUOTE:
|
||||||
|
if line[i] == '"':
|
||||||
|
in_str = CTX_NORMAL
|
||||||
|
# In again if " escaped, out again if \ escaped, and so on
|
||||||
|
for a in range(i-1, -1, -1):
|
||||||
|
if line[i-a] == '\\': in_str = 2-in_str
|
||||||
|
else: break
|
||||||
|
|
||||||
|
return in_str
|
||||||
|
|
||||||
|
def current_line(txt):
|
||||||
|
"""Extracts the Python script line at the cursor in the Blender Text object
|
||||||
|
provided and cursor position within this line as the tuple pair (line,
|
||||||
|
cursor).
|
||||||
|
"""
|
||||||
|
|
||||||
|
lineindex, cursor = txt.getCursorPos()
|
||||||
|
lines = txt.asLines()
|
||||||
|
line = lines[lineindex]
|
||||||
|
|
||||||
|
# Join previous lines to this line if spanning
|
||||||
|
i = lineindex - 1
|
||||||
|
while i > 0:
|
||||||
|
earlier = lines[i].rstrip()
|
||||||
|
if earlier.endswith('\\'):
|
||||||
|
line = earlier[:-1] + ' ' + line
|
||||||
|
cursor += len(earlier)
|
||||||
|
i -= 1
|
||||||
|
|
||||||
|
# Join later lines while there is an explicit joining character
|
||||||
|
i = lineindex
|
||||||
|
while i < len(lines)-1 and lines[i].rstrip().endswith('\\'):
|
||||||
|
later = lines[i+1].strip()
|
||||||
|
line = line + ' ' + later[:-1]
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
return line, cursor
|
||||||
|
|
||||||
|
def get_targets(line, cursor):
|
||||||
|
"""Parses a period separated string of valid names preceding the cursor and
|
||||||
|
returns them as a list in the same order.
|
||||||
|
"""
|
||||||
|
|
||||||
|
brk = 0
|
||||||
|
targets = []
|
||||||
|
j = cursor
|
||||||
|
i = j-1
|
||||||
|
while i >= 0:
|
||||||
|
if line[i] == ')': brk += 1
|
||||||
|
elif brk:
|
||||||
|
if line[i] == '(': brk -= 1
|
||||||
|
else:
|
||||||
|
if line[i] == '.':
|
||||||
|
targets.insert(0, line[i+1:j]); j=i
|
||||||
|
elif not (line[i].isalnum() or line[i] == '_' or line[i] == '.'):
|
||||||
|
break
|
||||||
|
i -= 1
|
||||||
|
targets.insert(0, line[i+1:j])
|
||||||
|
return targets
|
||||||
|
|
||||||
|
def get_defs(txt):
|
||||||
|
"""Returns a dictionary which maps definition names in the source code to
|
||||||
|
a list of their parameter names.
|
||||||
|
|
||||||
|
The line 'def doit(one, two, three): print one' for example, results in the
|
||||||
|
mapping 'doit' : [ 'one', 'two', 'three' ]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return get_cached_descriptor(txt).defs
|
||||||
|
|
||||||
|
def get_vars(txt):
|
||||||
|
"""Returns a dictionary of variable names found in the specified Text
|
||||||
|
object. This method locates all names followed directly by an equal sign:
|
||||||
|
'a = ???' or indirectly as part of a tuple/list assignment or inside a
|
||||||
|
'for ??? in ???:' block.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return get_cached_descriptor(txt).vars
|
||||||
|
|
||||||
|
def get_imports(txt):
|
||||||
|
"""Returns a dictionary which maps symbol names in the source code to their
|
||||||
|
respective modules.
|
||||||
|
|
||||||
|
The line 'from Blender import Text as BText' for example, results in the
|
||||||
|
mapping 'BText' : <module 'Blender.Text' (built-in)>
|
||||||
|
|
||||||
|
Note that this method imports the modules to provide this mapping as as such
|
||||||
|
will execute any initilization code found within.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return get_cached_descriptor(txt).imports
|
||||||
|
|
||||||
|
def get_builtins():
|
||||||
|
"""Returns a dictionary of built-in modules, functions and variables."""
|
||||||
|
|
||||||
|
return __builtin__.__dict__
|
||||||
|
|
||||||
|
|
||||||
|
#################################
|
||||||
|
## Debugging utility functions ##
|
||||||
|
#################################
|
||||||
|
|
||||||
|
def print_cache_for(txt, period=sys.maxint):
|
||||||
|
"""Prints out the data cached for a given Text object. If no period is
|
||||||
|
given the text will not be reparsed and the cached version will be returned.
|
||||||
|
Otherwise if the period has expired the text will be reparsed.
|
||||||
|
"""
|
||||||
|
|
||||||
|
desc = get_cached_descriptor(txt, period)
|
||||||
|
print '================================================'
|
||||||
|
print 'Name:', desc.name, '('+str(hash(txt))+')'
|
||||||
|
print '------------------------------------------------'
|
||||||
|
print 'Defs:'
|
||||||
|
for name, ddesc in desc.defs.items():
|
||||||
|
print ' ', name, ddesc.params, ddesc.lineno
|
||||||
|
print ' ', ddesc.doc
|
||||||
|
print '------------------------------------------------'
|
||||||
|
print 'Vars:'
|
||||||
|
for name, vdesc in desc.vars.items():
|
||||||
|
print ' ', name, vdesc.type, vdesc.lineno
|
||||||
|
print '------------------------------------------------'
|
||||||
|
print 'Imports:'
|
||||||
|
for name, item in desc.imports.items():
|
||||||
|
print ' ', name.ljust(15), item
|
||||||
|
print '------------------------------------------------'
|
||||||
|
print 'Classes:'
|
||||||
|
for clsnme, clsdsc in desc.classes.items():
|
||||||
|
print ' *********************************'
|
||||||
|
print ' Name:', clsnme
|
||||||
|
print ' ', clsdsc.doc
|
||||||
|
print ' ---------------------------------'
|
||||||
|
print ' Defs:'
|
||||||
|
for name, ddesc in clsdsc.defs.items():
|
||||||
|
print ' ', name, ddesc.params, ddesc.lineno
|
||||||
|
print ' ', ddesc.doc
|
||||||
|
print ' ---------------------------------'
|
||||||
|
print ' Vars:'
|
||||||
|
for name, vdesc in clsdsc.vars.items():
|
||||||
|
print ' ', name, vdesc.type, vdesc.lineno
|
||||||
|
print ' *********************************'
|
||||||
|
print '================================================'
|
1112
release/scripts/export_cal3d.py
Normal file
1112
release/scripts/export_cal3d.py
Normal file
File diff suppressed because it is too large
Load Diff
835
release/scripts/flt_dofedit.py
Normal file
835
release/scripts/flt_dofedit.py
Normal file
@@ -0,0 +1,835 @@
|
|||||||
|
#!BPY
|
||||||
|
|
||||||
|
"""
|
||||||
|
Name: 'FLT DOF Editor'
|
||||||
|
Blender: 240
|
||||||
|
Group: 'Misc'
|
||||||
|
Tooltip: 'Degree of Freedom editor for FLT nodes'
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = "Geoffrey Bantle"
|
||||||
|
__version__ = "1.0 11/21/07"
|
||||||
|
__email__ = ('scripts', 'Author, ')
|
||||||
|
__url__ = ('blender', 'blenderartists.org')
|
||||||
|
|
||||||
|
__bpydoc__ ="""\
|
||||||
|
This script provides tools for working with OpenFlight databases in Blender. OpenFlight is a
|
||||||
|
registered trademark of MultiGen-Paradigm, Inc.
|
||||||
|
|
||||||
|
Feature overview and more availible at:
|
||||||
|
http://wiki.blender.org/index.php/Scripts/Manual/FLTools
|
||||||
|
"""
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# flt_palettemanager.py version 0.1 2005/04/08
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007: Blender Foundation
|
||||||
|
#
|
||||||
|
# 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 Blender.Draw as Draw
|
||||||
|
from Blender.BGL import *
|
||||||
|
import Blender
|
||||||
|
import flt_properties
|
||||||
|
reload(flt_properties)
|
||||||
|
from flt_properties import *
|
||||||
|
|
||||||
|
#event codes
|
||||||
|
evcode = {
|
||||||
|
"DOF_MAKE" : 100,
|
||||||
|
"DOF_UPDATE" : 138,
|
||||||
|
"DOF_DELETE" : 101,
|
||||||
|
"DOF_TRANSX" : 102,
|
||||||
|
"DOF_TRANSY" : 103,
|
||||||
|
"DOF_TRANSZ" : 104,
|
||||||
|
"DOF_ROTX" : 105,
|
||||||
|
"DOF_ROTY" : 106,
|
||||||
|
"DOF_ROTZ" : 107,
|
||||||
|
"DOF_SCALEX" : 108,
|
||||||
|
"DOF_SCALEY" : 109,
|
||||||
|
"DOF_SCALEZ" : 110,
|
||||||
|
"DOF_MIN_TRANSX" : 111,
|
||||||
|
"DOF_MIN_TRANSY" : 112,
|
||||||
|
"DOF_MIN_TRANSZ" : 113,
|
||||||
|
"DOF_MIN_ROTX" : 114,
|
||||||
|
"DOF_MIN_ROTY" : 115,
|
||||||
|
"DOF_MIN_ROTZ" : 116,
|
||||||
|
"DOF_MIN_SCALEX" : 117,
|
||||||
|
"DOF_MIN_SCALEY" : 118,
|
||||||
|
"DOF_MIN_SCALEZ" : 119,
|
||||||
|
"DOF_MAX_TRANSX" : 120,
|
||||||
|
"DOF_MAX_TRANSY" : 121,
|
||||||
|
"DOF_MAX_TRANSZ" : 122,
|
||||||
|
"DOF_MAX_ROTX" : 123,
|
||||||
|
"DOF_MAX_ROTY" : 124,
|
||||||
|
"DOF_MAX_ROTZ" : 125,
|
||||||
|
"DOF_MAX_SCALEX" : 126,
|
||||||
|
"DOF_MAX_SCALEY" : 127,
|
||||||
|
"DOF_MAX_SCALEZ" : 128,
|
||||||
|
"DOF_STEP_TRANSX" : 129,
|
||||||
|
"DOF_STEP_TRANSY" : 130,
|
||||||
|
"DOF_STEP_TRANSZ" : 131,
|
||||||
|
"DOF_STEP_ROTX" : 132,
|
||||||
|
"DOF_STEP_ROTY" : 133,
|
||||||
|
"DOF_STEP_ROTZ" : 134,
|
||||||
|
"DOF_STEP_SCALEX" : 135,
|
||||||
|
"DOF_STEP_SCALEY" : 136,
|
||||||
|
"DOF_STEP_SCALEZ" : 137
|
||||||
|
}
|
||||||
|
|
||||||
|
#system
|
||||||
|
DOF_MAKE = None
|
||||||
|
DOF_UPDATE = None
|
||||||
|
DOF_DELETE = None
|
||||||
|
|
||||||
|
#toggle buttons
|
||||||
|
DOF_TRANSX = None
|
||||||
|
DOF_TRANSY = None
|
||||||
|
DOF_TRANSZ = None
|
||||||
|
DOF_ROTX = None
|
||||||
|
DOF_ROTY = None
|
||||||
|
DOF_ROTZ = None
|
||||||
|
DOF_SCALEX = None
|
||||||
|
DOF_SCALEY = None
|
||||||
|
DOF_SCALEZ = None
|
||||||
|
|
||||||
|
#Minimums
|
||||||
|
DOF_MIN_TRANSX = None
|
||||||
|
DOF_MIN_TRANSY = None
|
||||||
|
DOF_MIN_TRANSZ = None
|
||||||
|
DOF_MIN_ROTX = None
|
||||||
|
DOF_MIN_ROTY = None
|
||||||
|
DOF_MIN_ROTZ = None
|
||||||
|
DOF_MIN_SCALEX = None
|
||||||
|
DOF_MIN_SCALEY = None
|
||||||
|
DOF_MIN_SCALEZ = None
|
||||||
|
|
||||||
|
#maximums
|
||||||
|
DOF_MAX_TRANSX = None
|
||||||
|
DOF_MAX_TRANSY = None
|
||||||
|
DOF_MAX_TRANSZ = None
|
||||||
|
DOF_MAX_ROTX = None
|
||||||
|
DOF_MAX_ROTY = None
|
||||||
|
DOF_MAX_ROTZ = None
|
||||||
|
DOF_MAX_SCALEX = None
|
||||||
|
DOF_MAX_SCALEY = None
|
||||||
|
DOF_MAX_SCALEZ = None
|
||||||
|
|
||||||
|
#step
|
||||||
|
DOF_STEP_TRANSX = None
|
||||||
|
DOF_STEP_TRANSY = None
|
||||||
|
DOF_STEP_TRANSZ = None
|
||||||
|
DOF_STEP_ROTX = None
|
||||||
|
DOF_STEP_ROTY = None
|
||||||
|
DOF_STEP_ROTZ = None
|
||||||
|
DOF_STEP_SCALEX = None
|
||||||
|
DOF_STEP_SCALEY = None
|
||||||
|
DOF_STEP_SCALEZ = None
|
||||||
|
|
||||||
|
#labels
|
||||||
|
DOF_ROTSTRING = None
|
||||||
|
DOF_TRANSTRING = None
|
||||||
|
DOF_SCALESTRING = None
|
||||||
|
DOF_EDITLABEL = None
|
||||||
|
|
||||||
|
#make ID props easier/morereadable
|
||||||
|
zmin = '14d!ZMIN'
|
||||||
|
zmax = '15d!ZMAX'
|
||||||
|
zcur = '16d!ZCUR'
|
||||||
|
zstep = '17d!ZSTEP'
|
||||||
|
ymin = '18d!YMIN'
|
||||||
|
ymax = '19d!YMAX'
|
||||||
|
ycur = '20d!YCUR'
|
||||||
|
ystep = '21d!YSTEP'
|
||||||
|
xmin = '22d!XMIN'
|
||||||
|
xmax = '23d!XMAX'
|
||||||
|
xcur = '24d!XCUR'
|
||||||
|
xstep = '25d!XSTEP'
|
||||||
|
pitchmin = '26d!PITCH-MIN'
|
||||||
|
pitchmax = '27d!PITCH-MAX'
|
||||||
|
pitchcur = '28d!PITCH-CUR'
|
||||||
|
pitchstep = '29d!PITCH-STEP'
|
||||||
|
rollmin = '30d!ROLL-MIN'
|
||||||
|
rollmax = '31d!ROLL-MAX'
|
||||||
|
rollcur = '32d!ROLL-CUR'
|
||||||
|
rollstep = '33d!ROLL-STEP'
|
||||||
|
yawmin = '34d!YAW-MIN'
|
||||||
|
yawmax = '35d!YAW-MAX'
|
||||||
|
yawcur = '36d!YAW-CUR'
|
||||||
|
yawstep = '37d!YAW-STEP'
|
||||||
|
zscalemin = '38d!ZSIZE-MIN'
|
||||||
|
zscalemax = '39d!ZSIZE-MAX'
|
||||||
|
zscalecur = '40d!ZSIZE-CUR'
|
||||||
|
zscalestep = '41d!ZSIZE-STEP'
|
||||||
|
yscalemin = '42d!YSIZE-MIN'
|
||||||
|
yscalemax = '43d!YSIZE-MAX'
|
||||||
|
yscalecur = '44d!YSIZE-CUR'
|
||||||
|
yscalestep = '45d!YSIZE-STEP'
|
||||||
|
xscalemin = '46d!XSIZE-MIN'
|
||||||
|
xscalemax = '47d!XSIZE-MAX'
|
||||||
|
xscalecur = '48d!XSIZE-CUR'
|
||||||
|
xscalestep = '49d!XSIZE-STEP'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def update_state():
|
||||||
|
state = dict()
|
||||||
|
state["activeScene"] = Blender.Scene.GetCurrent()
|
||||||
|
state["activeObject"] = state["activeScene"].objects.active
|
||||||
|
if state["activeObject"] and not state["activeObject"].sel:
|
||||||
|
state["activeObject"] = None
|
||||||
|
state["activeMesh"] = None
|
||||||
|
if state["activeObject"] and state["activeObject"].type == 'Mesh':
|
||||||
|
state["activeMesh"] = state["activeObject"].getData(mesh=True)
|
||||||
|
|
||||||
|
|
||||||
|
state["activeFace"] = None
|
||||||
|
if state["activeMesh"]:
|
||||||
|
if state["activeMesh"].faceUV and state["activeMesh"].activeFace != None:
|
||||||
|
state["activeFace"] = state["activeMesh"].faces[state["activeMesh"].activeFace]
|
||||||
|
|
||||||
|
|
||||||
|
#update editmode
|
||||||
|
state["editmode"] = Blender.Window.EditMode()
|
||||||
|
|
||||||
|
return state
|
||||||
|
|
||||||
|
def idprops_append(object, typecode, props):
|
||||||
|
object.properties["FLT"] = dict()
|
||||||
|
object.properties["FLT"]['type'] = typecode
|
||||||
|
for prop in props:
|
||||||
|
object.properties["FLT"][prop] = props[prop]
|
||||||
|
object.properties["FLT"]['3t8!id'] = object.name
|
||||||
|
|
||||||
|
def idprops_kill():
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and state["activeObject"].properties.has_key('FLT'):
|
||||||
|
state["activeObject"].properties.pop('FLT')
|
||||||
|
|
||||||
|
def idprops_copy(source):
|
||||||
|
state = update_state()
|
||||||
|
if source.properties.has_key('FLT'):
|
||||||
|
for object in state["activeScene"].objects:
|
||||||
|
if object.sel and object != source and (state["activeScene"].Layers & object.Layers):
|
||||||
|
idprops_kill(object)
|
||||||
|
object.properties['FLT'] = dict()
|
||||||
|
for key in source.properties['FLT']:
|
||||||
|
object.properties['FLT'][key] = source.properties['FLT'][key]
|
||||||
|
|
||||||
|
def select_by_typecode(typecode):
|
||||||
|
state = update_state()
|
||||||
|
|
||||||
|
for object in state["activeScene"].objects:
|
||||||
|
if object.properties.has_key('FLT') and object.properties['FLT']['type'] == typecode and state["activeScene"].Layers & object.Layers:
|
||||||
|
object.select(1)
|
||||||
|
|
||||||
|
def DOF_get_frame():
|
||||||
|
state = update_state()
|
||||||
|
|
||||||
|
if not state["activeObject"] and not id_props_type(state["activeObject"], 14):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Warning! assumes 1 BU == 10 meters.
|
||||||
|
#do origin
|
||||||
|
state["activeObject"].properties['FLT']['5d!ORIGX'] = state["activeObject"].getLocation('worldspace')[0]*10.0
|
||||||
|
state["activeObject"].properties['FLT']['6d!ORIGY'] = state["activeObject"].getLocation('worldspace')[1]*10.0
|
||||||
|
state["activeObject"].properties['FLT']['7d!ORIGZ'] = state["activeObject"].getLocation('worldspace')[2]*10.0
|
||||||
|
#do X axis
|
||||||
|
x = Blender.Mathutils.Vector(1.0,0.0,0.0)
|
||||||
|
x = x * state["activeObject"].getMatrix('worldspace')
|
||||||
|
x = x * 10.0
|
||||||
|
state["activeObject"].properties['FLT']['8d!XAXIS-X'] = x[0]
|
||||||
|
state["activeObject"].properties['FLT']['9d!XAXIS-Y'] = x[1]
|
||||||
|
state["activeObject"].properties['FLT']['10d!XAXIS-Z'] = x[2]
|
||||||
|
#do X/Y plane
|
||||||
|
x = Blender.Mathutils.Vector(0.0,1.0,0.0)
|
||||||
|
x.normalize()
|
||||||
|
x = x * state["activeObject"].getMatrix('worldspace')
|
||||||
|
x = x * 10.0
|
||||||
|
state["activeObject"].properties['FLT']['11d!XYPLANE-X'] = x[0]
|
||||||
|
state["activeObject"].properties['FLT']['12d!XYPLANE-Y'] = x[1]
|
||||||
|
state["activeObject"].properties['FLT']['13d!XZPLANE-Z'] = x[2]
|
||||||
|
|
||||||
|
def idprops_type(object, typecode):
|
||||||
|
if object.properties.has_key('FLT') and object.properties['FLT'].has_key('type') and object.properties['FLT']['type'] == typecode:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
#ui type code
|
||||||
|
def get_prop(typecode, prop):
|
||||||
|
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], typecode):
|
||||||
|
props = state["activeObject"].properties['FLT']
|
||||||
|
else:
|
||||||
|
props = flt_properties.FLTDOF
|
||||||
|
|
||||||
|
return props[prop]
|
||||||
|
|
||||||
|
def set_prop(typecode, prop, value):
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"],typecode):
|
||||||
|
state["activeObject"].properties['FLT'][prop] = value
|
||||||
|
|
||||||
|
lockxtrans = (1 << 31)
|
||||||
|
lockytrans = (1 << 30)
|
||||||
|
lockztrans = (1 << 29)
|
||||||
|
lockxrot = (1 << 28)
|
||||||
|
lockyrot = (1 << 27)
|
||||||
|
lockzrot = (1 << 26)
|
||||||
|
lockxscale = (1 << 25)
|
||||||
|
lockyscale = (1 << 24)
|
||||||
|
lockzscale = (1 << 23)
|
||||||
|
|
||||||
|
def get_lockmask(mask):
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"]:
|
||||||
|
flag = get_prop(14,'50I!FLAG')
|
||||||
|
if flag & mask:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def set_lockmask(mask):
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], 14):
|
||||||
|
oldvalue = state["activeObject"].properties['FLT']['50I!FLAG']
|
||||||
|
oldvalue = struct.unpack('>I', struct.pack('>i', oldvalue))[0]
|
||||||
|
oldvalue |= mask
|
||||||
|
state["activeObject"].properties['FLT']['50I!FLAG'] = struct.unpack('>i', struct.pack(">I", oldvalue))[0]
|
||||||
|
|
||||||
|
def clear_lockmask(mask):
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], 14):
|
||||||
|
oldvalue = state["activeObject"].properties['FLT']['50I!FLAG']
|
||||||
|
oldvalue = struct.unpack('>I', struct.pack('>i', oldvalue))[0]
|
||||||
|
oldvalue &= ~mask
|
||||||
|
state["activeObject"].properties['FLT']['50I!FLAG'] = struct.unpack('>i',struct.pack('>I',oldvalue))[0]
|
||||||
|
|
||||||
|
|
||||||
|
def create_dof():
|
||||||
|
state = update_state()
|
||||||
|
actobj = state["activeObject"]
|
||||||
|
if actobj and not idprops_type(actobj, 14):
|
||||||
|
idprops_kill()
|
||||||
|
idprops_append(actobj,14, flt_properties.FLTDOF)
|
||||||
|
DOF_get_frame()
|
||||||
|
|
||||||
|
|
||||||
|
def event(evt,val):
|
||||||
|
if evt == Draw.ESCKEY:
|
||||||
|
Draw.Exit()
|
||||||
|
|
||||||
|
def but_event(evt):
|
||||||
|
global DOF_MAKE
|
||||||
|
global DOF_UPDATE
|
||||||
|
global DOF_DELETE
|
||||||
|
|
||||||
|
global DOF_TRANSX
|
||||||
|
global DOF_TRANSY
|
||||||
|
global DOF_TRANSZ
|
||||||
|
global DOF_ROTX
|
||||||
|
global DOF_ROTY
|
||||||
|
global DOF_ROTZ
|
||||||
|
global DOF_SCALEX
|
||||||
|
global DOF_SCALEY
|
||||||
|
global DOF_SCALEZ
|
||||||
|
|
||||||
|
global DOF_MIN_TRANSX
|
||||||
|
global DOF_MIN_TRANSY
|
||||||
|
global DOF_MIN_TRANSZ
|
||||||
|
global DOF_MIN_ROTX
|
||||||
|
global DOF_MIN_ROTY
|
||||||
|
global DOF_MIN_ROTZ
|
||||||
|
global DOF_MIN_SCALEX
|
||||||
|
global DOF_MIN_SCALEY
|
||||||
|
global DOF_MIN_SCALEZ
|
||||||
|
|
||||||
|
global DOF_MAX_TRANSX
|
||||||
|
global DOF_MAX_TRANSY
|
||||||
|
global DOF_MAX_TRANSZ
|
||||||
|
global DOF_MAX_ROTX
|
||||||
|
global DOF_MAX_ROTY
|
||||||
|
global DOF_MAX_ROTZ
|
||||||
|
global DOF_MAX_SCALEX
|
||||||
|
global DOF_MAX_SCALEY
|
||||||
|
global DOF_MAX_SCALEZ
|
||||||
|
|
||||||
|
global DOF_STEP_TRANSX
|
||||||
|
global DOF_STEP_TRANSY
|
||||||
|
global DOF_STEP_TRANSZ
|
||||||
|
global DOF_STEP_ROTX
|
||||||
|
global DOF_STEP_ROTY
|
||||||
|
global DOF_STEP_ROTZ
|
||||||
|
global DOF_STEP_SCALEX
|
||||||
|
global DOF_STEP_SCALEY
|
||||||
|
global DOF_STEP_SCALEZ
|
||||||
|
|
||||||
|
#labels
|
||||||
|
global DOF_ROTSTRING
|
||||||
|
global DOF_TRANSTRING
|
||||||
|
global DOF_SCALESTRING
|
||||||
|
|
||||||
|
|
||||||
|
#masks
|
||||||
|
global lockxtrans
|
||||||
|
global lockytrans
|
||||||
|
global lockztrans
|
||||||
|
global lockxrot
|
||||||
|
global lockyrot
|
||||||
|
global lockzrot
|
||||||
|
global lockxscale
|
||||||
|
global lockyscale
|
||||||
|
global lockzscale
|
||||||
|
|
||||||
|
global zmin
|
||||||
|
global zmax
|
||||||
|
global zcur
|
||||||
|
global zstep
|
||||||
|
global ymin
|
||||||
|
global ymax
|
||||||
|
global ycur
|
||||||
|
global ystep
|
||||||
|
global xmin
|
||||||
|
global xmax
|
||||||
|
global xcur
|
||||||
|
global xstep
|
||||||
|
global pitchmin
|
||||||
|
global pitchmax
|
||||||
|
global pitchcur
|
||||||
|
global pitchstep
|
||||||
|
global rollmin
|
||||||
|
global rollmax
|
||||||
|
global rollcur
|
||||||
|
global rollstep
|
||||||
|
global yawmin
|
||||||
|
global yawmax
|
||||||
|
global yawcur
|
||||||
|
global yawstep
|
||||||
|
global zscalemin
|
||||||
|
global zscalemax
|
||||||
|
global zscalecur
|
||||||
|
global zscalestep
|
||||||
|
global yscalemin
|
||||||
|
global yscalemax
|
||||||
|
global yscalecur
|
||||||
|
global yscalestep
|
||||||
|
global xscalemin
|
||||||
|
global xscalemax
|
||||||
|
global xscalecur
|
||||||
|
global xscalestep
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#do "system" events
|
||||||
|
if evt == evcode["DOF_MAKE"]:
|
||||||
|
create_dof()
|
||||||
|
|
||||||
|
if evt == evcode["DOF_UPDATE"]:
|
||||||
|
DOF_get_frame()
|
||||||
|
|
||||||
|
if evt == evcode["DOF_DELETE"]:
|
||||||
|
idprops_kill()
|
||||||
|
#do translation lock events
|
||||||
|
if evt == evcode["DOF_TRANSX"]:
|
||||||
|
if DOF_TRANSX.val == True:
|
||||||
|
set_lockmask(lockxtrans)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockxtrans)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_TRANSY"]:
|
||||||
|
if DOF_TRANSY.val == True:
|
||||||
|
set_lockmask(lockytrans)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockytrans)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_TRANSZ"]:
|
||||||
|
if DOF_TRANSZ.val == True:
|
||||||
|
set_lockmask(lockztrans)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockztrans)
|
||||||
|
|
||||||
|
|
||||||
|
#do rotation lock events
|
||||||
|
if evt == evcode["DOF_ROTX"]:
|
||||||
|
if DOF_ROTX.val == True:
|
||||||
|
set_lockmask(lockxrot)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockxrot)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_ROTY"]:
|
||||||
|
if DOF_ROTY.val == True:
|
||||||
|
set_lockmask(lockyrot)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockyrot)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_ROTZ"]:
|
||||||
|
if DOF_ROTZ.val == True:
|
||||||
|
set_lockmask(lockzrot)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockzrot)
|
||||||
|
|
||||||
|
#do scale lock events
|
||||||
|
if evt == evcode["DOF_SCALEX"]:
|
||||||
|
if DOF_SCALEX.val == True:
|
||||||
|
set_lockmask(lockxscale)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockxscale)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_SCALEY"]:
|
||||||
|
if DOF_SCALEY.val == True:
|
||||||
|
set_lockmask(lockyscale)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockyscale)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_SCALEZ"]:
|
||||||
|
if DOF_SCALEZ.val == True:
|
||||||
|
set_lockmask(lockzscale)
|
||||||
|
else:
|
||||||
|
clear_lockmask(lockzscale)
|
||||||
|
|
||||||
|
|
||||||
|
#do translation buttons
|
||||||
|
if evt == evcode["DOF_MIN_TRANSX"]:
|
||||||
|
set_prop(14, xmin, DOF_MIN_TRANSX.val)
|
||||||
|
if evt == evcode["DOF_MAX_TRANSX"]:
|
||||||
|
set_prop(14,xmax, DOF_MAX_TRANSX.val)
|
||||||
|
if evt == evcode["DOF_STEP_TRANSX"]:
|
||||||
|
set_prop(14,xstep, DOF_STEP_TRANSX.val)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_MIN_TRANSY"]:
|
||||||
|
set_prop(14, ymin, DOF_MIN_TRANSY.val)
|
||||||
|
if evt == evcode["DOF_MAX_TRANSY"]:
|
||||||
|
set_prop(14,ymax, DOF_MAX_TRANSY.val)
|
||||||
|
if evt == evcode["DOF_STEP_TRANSY"]:
|
||||||
|
set_prop(14,ystep, DOF_STEP_TRANSY.val)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_MIN_TRANSZ"]:
|
||||||
|
set_prop(14, zmin, DOF_MIN_TRANSZ.val)
|
||||||
|
if evt == evcode["DOF_MAX_TRANSZ"]:
|
||||||
|
set_prop(14, zmax, DOF_MAX_TRANSZ.val)
|
||||||
|
if evt == evcode["DOF_STEP_TRANSZ"]:
|
||||||
|
set_prop(14, zstep, DOF_STEP_TRANSZ.val)
|
||||||
|
|
||||||
|
#do rotation buttons
|
||||||
|
if evt == evcode["DOF_MIN_ROTX"]:
|
||||||
|
set_prop(14, pitchmin, DOF_MIN_ROTX.val)
|
||||||
|
if evt == evcode["DOF_MAX_ROTX"]:
|
||||||
|
set_prop(14, pitchmax, DOF_MAX_ROTX.val)
|
||||||
|
if evt == evcode["DOF_STEP_ROTX"]:
|
||||||
|
set_prop(14, pitchstep, DOF_STEP_ROTX.val)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_MIN_ROTY"]:
|
||||||
|
set_prop(14, rollmin, DOF_MIN_ROTY.val)
|
||||||
|
if evt == evcode["DOF_MAX_ROTY"]:
|
||||||
|
set_prop(14, rollmax, DOF_MAX_ROTY.val)
|
||||||
|
if evt == evcode["DOF_STEP_ROTY"]:
|
||||||
|
set_prop(14, rollstep, DOF_STEP_ROTY.val)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_MIN_ROTZ"]:
|
||||||
|
set_prop(14, yawmin, DOF_MIN_ROTZ.val)
|
||||||
|
if evt == evcode["DOF_MAX_ROTZ"]:
|
||||||
|
set_prop(14, yawmax, DOF_MAX_ROTZ.val)
|
||||||
|
if evt == evcode["DOF_STEP_ROTZ"]:
|
||||||
|
set_prop(14, yawstep, DOF_STEP_ROTZ.val)
|
||||||
|
|
||||||
|
#do scale buttons
|
||||||
|
if evt == evcode["DOF_MIN_SCALEX"]:
|
||||||
|
set_prop(14, xscalemin, DOF_MIN_SCALEX.val)
|
||||||
|
if evt == evcode["DOF_MAX_SCALEX"]:
|
||||||
|
set_prop(14, xscalemax, DOF_MAX_SCALEX.val)
|
||||||
|
if evt == evcode["DOF_STEP_SCALEX"]:
|
||||||
|
set_prop(14, xscalestep, DOF_STEP_SCALEX.val)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_MIN_SCALEY"]:
|
||||||
|
set_prop(14, yscalemin, DOF_MIN_SCALEY.val)
|
||||||
|
if evt == evcode["DOF_MAX_SCALEY"]:
|
||||||
|
set_prop(14, yscalemax, DOF_MAX_SCALEY.val)
|
||||||
|
if evt == evcode["DOF_STEP_SCALEY"]:
|
||||||
|
set_prop(14, yscalestep, DOF_STEP_SCALEY.val)
|
||||||
|
|
||||||
|
if evt == evcode["DOF_MIN_SCALEZ"]:
|
||||||
|
set_prop(14, zscalemin, DOF_MIN_SCALEZ.val)
|
||||||
|
if evt == evcode["DOF_MAX_SCALEZ"]:
|
||||||
|
set_prop(14, zscalemax, DOF_MAX_SCALEZ.val)
|
||||||
|
if evt == evcode["DOF_STEP_SCALEZ"]:
|
||||||
|
set_prop(14, zscalestep, DOF_STEP_SCALEZ.val)
|
||||||
|
|
||||||
|
|
||||||
|
Draw.Redraw(1)
|
||||||
|
Blender.Window.RedrawAll()
|
||||||
|
|
||||||
|
def draw_propsheet(x,y):
|
||||||
|
#UI buttons
|
||||||
|
global DOF_MAKE
|
||||||
|
global DOF_UPDATE
|
||||||
|
global DOF_DELETE
|
||||||
|
|
||||||
|
global DOF_TRANSX
|
||||||
|
global DOF_TRANSY
|
||||||
|
global DOF_TRANSZ
|
||||||
|
global DOF_ROTX
|
||||||
|
global DOF_ROTY
|
||||||
|
global DOF_ROTZ
|
||||||
|
global DOF_SCALEX
|
||||||
|
global DOF_SCALEY
|
||||||
|
global DOF_SCALEZ
|
||||||
|
|
||||||
|
global DOF_MIN_TRANSX
|
||||||
|
global DOF_MIN_TRANSY
|
||||||
|
global DOF_MIN_TRANSZ
|
||||||
|
global DOF_MIN_ROTX
|
||||||
|
global DOF_MIN_ROTY
|
||||||
|
global DOF_MIN_ROTZ
|
||||||
|
global DOF_MIN_SCALEX
|
||||||
|
global DOF_MIN_SCALEY
|
||||||
|
global DOF_MIN_SCALEZ
|
||||||
|
|
||||||
|
global DOF_MAX_TRANSX
|
||||||
|
global DOF_MAX_TRANSY
|
||||||
|
global DOF_MAX_TRANSZ
|
||||||
|
global DOF_MAX_ROTX
|
||||||
|
global DOF_MAX_ROTY
|
||||||
|
global DOF_MAX_ROTZ
|
||||||
|
global DOF_MAX_SCALEX
|
||||||
|
global DOF_MAX_SCALEY
|
||||||
|
global DOF_MAX_SCALEZ
|
||||||
|
|
||||||
|
global DOF_STEP_TRANSX
|
||||||
|
global DOF_STEP_TRANSY
|
||||||
|
global DOF_STEP_TRANSZ
|
||||||
|
global DOF_STEP_ROTX
|
||||||
|
global DOF_STEP_ROTY
|
||||||
|
global DOF_STEP_ROTZ
|
||||||
|
global DOF_STEP_SCALEX
|
||||||
|
global DOF_STEP_SCALEY
|
||||||
|
global DOF_STEP_SCALEZ
|
||||||
|
|
||||||
|
#labels
|
||||||
|
global DOF_ROTSTRING
|
||||||
|
global DOF_TRANSTRING
|
||||||
|
global DOF_SCALESTRING
|
||||||
|
global DOF_EDITLABEL
|
||||||
|
|
||||||
|
#masks
|
||||||
|
global lockxtrans
|
||||||
|
global lockytrans
|
||||||
|
global lockztrans
|
||||||
|
global lockxrot
|
||||||
|
global lockyrot
|
||||||
|
global lockzrot
|
||||||
|
global lockxscale
|
||||||
|
global lockyscale
|
||||||
|
global lockzscale
|
||||||
|
|
||||||
|
global zmin
|
||||||
|
global zmax
|
||||||
|
global zcur
|
||||||
|
global zstep
|
||||||
|
global ymin
|
||||||
|
global ymax
|
||||||
|
global ycur
|
||||||
|
global ystep
|
||||||
|
global xmin
|
||||||
|
global xmax
|
||||||
|
global xcur
|
||||||
|
global xstep
|
||||||
|
global pitchmin
|
||||||
|
global pitchmax
|
||||||
|
global pitchcur
|
||||||
|
global pitchstep
|
||||||
|
global rollmin
|
||||||
|
global rollmax
|
||||||
|
global rollcur
|
||||||
|
global rollstep
|
||||||
|
global yawmin
|
||||||
|
global yawmax
|
||||||
|
global yawcur
|
||||||
|
global yawstep
|
||||||
|
global zscalemin
|
||||||
|
global zscalemax
|
||||||
|
global zscalecur
|
||||||
|
global zscalestep
|
||||||
|
global yscalemin
|
||||||
|
global yscalemax
|
||||||
|
global yscalecur
|
||||||
|
global yscalestep
|
||||||
|
global xscalemin
|
||||||
|
global xscalemax
|
||||||
|
global xscalecur
|
||||||
|
global xscalestep
|
||||||
|
|
||||||
|
|
||||||
|
global evcode
|
||||||
|
|
||||||
|
state = update_state()
|
||||||
|
|
||||||
|
row_height = 20
|
||||||
|
toggle_width = 50
|
||||||
|
input_width = 100
|
||||||
|
pad = 10
|
||||||
|
origx = x
|
||||||
|
origy = (row_height * 15) + (pad * 15)
|
||||||
|
|
||||||
|
|
||||||
|
#editor label
|
||||||
|
x = origx
|
||||||
|
y = origy
|
||||||
|
#y = y - (row_height + pad)
|
||||||
|
DOF_EDITLABEL = Blender.Draw.Label("FLT Degree of Freedom Editor", x, y, 200, row_height)
|
||||||
|
|
||||||
|
|
||||||
|
#draw Translation limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_TRANSTRING = Blender.Draw.Label("Translation Limits", x, y, input_width, row_height)
|
||||||
|
|
||||||
|
|
||||||
|
#X limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_TRANSX = Blender.Draw.Toggle("LimX", evcode["DOF_TRANSX"], x, y, toggle_width, row_height, get_lockmask(lockxtrans), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_TRANSX = Blender.Draw.Number("MinX", evcode["DOF_MIN_TRANSX"], x, y, input_width, row_height,get_prop(14,xmin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_TRANSX = Blender.Draw.Number("MaxX", evcode["DOF_MAX_TRANSX"], x, y, input_width, row_height,get_prop(14,xmax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_TRANSX = Blender.Draw.Number("StepX", evcode["DOF_STEP_TRANSX"], x, y, input_width, row_height,get_prop(14,xstep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#Y limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_TRANSY = Blender.Draw.Toggle("LimY", evcode["DOF_TRANSY"], x, y, toggle_width, row_height, get_lockmask(lockytrans), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_TRANSY = Blender.Draw.Number("MinY", evcode["DOF_MIN_TRANSY"], x, y, input_width, row_height, get_prop(14,ymin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_TRANSY = Blender.Draw.Number("MaxY", evcode["DOF_MAX_TRANSY"], x, y, input_width, row_height, get_prop(14,ymax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_TRANSY = Blender.Draw.Number("StepY", evcode["DOF_STEP_TRANSY"], x, y, input_width, row_height, get_prop(14,ystep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#Z limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_TRANSZ = Blender.Draw.Toggle("LimZ", evcode["DOF_TRANSZ"], x, y, toggle_width, row_height, get_lockmask(lockztrans), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_TRANSZ = Blender.Draw.Number("MinZ", evcode["DOF_MIN_TRANSZ"], x, y, input_width, row_height, get_prop(14,zmin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_TRANSZ = Blender.Draw.Number("MaxZ", evcode["DOF_MAX_TRANSZ"], x, y, input_width, row_height, get_prop(14,zmax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_TRANSZ = Blender.Draw.Number("StepZ", evcode["DOF_STEP_TRANSZ"], x, y, input_width, row_height, get_prop(14,zstep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#draw Rotation limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_ROTSTRING = Blender.Draw.Label("Rotation Limits", x, y, input_width, row_height)
|
||||||
|
|
||||||
|
#draw Rotation limits
|
||||||
|
#X limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_ROTX = Blender.Draw.Toggle("LimX", evcode["DOF_ROTX"], x, y, toggle_width, row_height, get_lockmask(lockxrot), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_ROTX = Blender.Draw.Number("MinX", evcode["DOF_MIN_ROTX"], x, y, input_width, row_height, get_prop(14,pitchmin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_ROTX = Blender.Draw.Number("MaxX", evcode["DOF_MAX_ROTX"], x, y, input_width, row_height, get_prop(14,pitchmax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_ROTX = Blender.Draw.Number("StepX", evcode["DOF_STEP_ROTX"], x, y, input_width, row_height, get_prop(14,pitchstep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#Y limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_ROTY = Blender.Draw.Toggle("LimY", evcode["DOF_ROTY"], x, y, toggle_width, row_height, get_lockmask(lockyrot), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_ROTY = Blender.Draw.Number("MinY", evcode["DOF_MIN_ROTY"], x, y, input_width, row_height, get_prop(14,rollmin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_ROTY = Blender.Draw.Number("MaxY", evcode["DOF_MAX_ROTY"], x, y, input_width, row_height, get_prop(14,rollmax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_ROTY = Blender.Draw.Number("StepY", evcode["DOF_STEP_ROTY"], x, y, input_width, row_height, get_prop(14,rollstep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#Z limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_ROTZ = Blender.Draw.Toggle("LimZ", evcode["DOF_ROTZ"], x, y, toggle_width, row_height, get_lockmask(lockzrot), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_ROTZ = Blender.Draw.Number("MinZ", evcode["DOF_MIN_ROTZ"], x, y, input_width, row_height, get_prop(14, yawmin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_ROTZ = Blender.Draw.Number("MaxZ", evcode["DOF_MAX_ROTZ"], x, y, input_width, row_height, get_prop(14, yawmax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_ROTZ = Blender.Draw.Number("StepZ", evcode["DOF_STEP_ROTZ"], x, y, input_width, row_height, get_prop(14, yawstep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
|
||||||
|
#draw Scale limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_SCALESTRING = Blender.Draw.Label("Scale Limits", x, y, input_width, row_height)
|
||||||
|
|
||||||
|
#draw Scale limits
|
||||||
|
#X limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_SCALEX = Blender.Draw.Toggle("LimX", evcode["DOF_SCALEX"], x, y, toggle_width, row_height, get_lockmask(lockxscale), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_SCALEX = Blender.Draw.Number("MinX", evcode["DOF_MIN_SCALEX"], x, y, input_width, row_height, get_prop(14, xscalemin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_SCALEX = Blender.Draw.Number("MaxX", evcode["DOF_MAX_SCALEX"], x, y, input_width, row_height, get_prop(14, xscalemax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_SCALEX = Blender.Draw.Number("StepX", evcode["DOF_STEP_SCALEX"], x, y, input_width, row_height, get_prop(14, xscalestep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#Y limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_SCALEY = Blender.Draw.Toggle("LimY", evcode["DOF_SCALEY"], x, y, toggle_width, row_height, get_lockmask(lockyscale), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_SCALEY = Blender.Draw.Number("MinY", evcode["DOF_MIN_SCALEY"], x, y, input_width, row_height, get_prop(14, yscalemin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_SCALEY = Blender.Draw.Number("MaxY", evcode["DOF_MAX_SCALEY"], x, y, input_width, row_height, get_prop(14, yscalemax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_SCALEY = Blender.Draw.Number("StepY", evcode["DOF_STEP_SCALEY"], x, y, input_width, row_height, get_prop(14, yscalestep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#Z limits
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
DOF_SCALEZ = Blender.Draw.Toggle("LimZ", evcode["DOF_SCALEZ"], x, y, toggle_width, row_height, get_lockmask(lockzscale), "")
|
||||||
|
x = x + (toggle_width + pad)
|
||||||
|
DOF_MIN_SCALEZ = Blender.Draw.Number("MinZ", evcode["DOF_MIN_SCALEZ"], x, y, input_width, row_height, get_prop(14, zscalemin), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_MAX_SCALEZ = Blender.Draw.Number("MaxZ", evcode["DOF_MAX_SCALEZ"], x, y, input_width, row_height, get_prop(14, zscalemax), -1000000.0, 1000000.0, "")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_STEP_SCALEZ = Blender.Draw.Number("StepZ", evcode["DOF_STEP_SCALEZ"], x, y, input_width, row_height, get_prop(14, zscalestep), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
#System
|
||||||
|
x = origx
|
||||||
|
y = y - (row_height + (pad)*3)
|
||||||
|
DOF_MAKE = Blender.Draw.PushButton("Make DOF", evcode["DOF_MAKE"], x, y, input_width, row_height, "Make a Dof Node out of Active Object")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_UPDATE = Blender.Draw.PushButton("Grab Loc/Rot", evcode["DOF_UPDATE"], x, y, input_width, row_height, "Update the Dof Node position/orientation")
|
||||||
|
x = x + (input_width + pad)
|
||||||
|
DOF_DELETE = Blender.Draw.PushButton("Delete DOF", evcode["DOF_DELETE"], x, y, input_width, row_height, "Delete the Dof Node properties")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def gui():
|
||||||
|
#draw the propsheet/toolbox.
|
||||||
|
psheety = 800
|
||||||
|
#psheetx = psheety + 10
|
||||||
|
draw_propsheet(20,psheety)
|
||||||
|
|
||||||
|
Draw.Register(gui,event,but_event)
|
||||||
|
|
@@ -525,8 +525,8 @@ class FaceDesc:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.vertex_index_lst = []
|
self.vertex_index_lst = []
|
||||||
self.mface = None
|
self.mface = None
|
||||||
self.texture_index = -1
|
self.texture_index = 65535
|
||||||
self.material_index = -1
|
self.material_index = 65535
|
||||||
self.color_index = 127
|
self.color_index = 127
|
||||||
self.renderstyle = 0
|
self.renderstyle = 0
|
||||||
self.twoside = 0
|
self.twoside = 0
|
||||||
@@ -979,8 +979,14 @@ class FLTNode(Node):
|
|||||||
self.header.fw.write_char(0) # Reserved
|
self.header.fw.write_char(0) # Reserved
|
||||||
self.header.fw.write_char(alpha) # Template
|
self.header.fw.write_char(alpha) # Template
|
||||||
self.header.fw.write_short(-1) # Detail tex pat index
|
self.header.fw.write_short(-1) # Detail tex pat index
|
||||||
self.header.fw.write_short(face_desc.texture_index) # Tex pattern index
|
if face_desc.texture_index == -1:
|
||||||
self.header.fw.write_short(face_desc.material_index) # material index
|
self.header.fw.write_ushort(65535)
|
||||||
|
else:
|
||||||
|
self.header.fw.write_ushort(face_desc.texture_index) # Tex pattern index
|
||||||
|
if face_desc.material_index == -1:
|
||||||
|
self.header.fw.write_ushort(65535)
|
||||||
|
else:
|
||||||
|
self.header.fw.write_ushort(face_desc.material_index) # material index
|
||||||
self.header.fw.write_short(0) # SMC code
|
self.header.fw.write_short(0) # SMC code
|
||||||
self.header.fw.write_short(0) # Feature code
|
self.header.fw.write_short(0) # Feature code
|
||||||
self.header.fw.write_int(0) # IR material code
|
self.header.fw.write_int(0) # IR material code
|
||||||
@@ -1015,7 +1021,10 @@ class FLTNode(Node):
|
|||||||
self.header.fw.write_ushort(8 + (mtex * 8)) # Length
|
self.header.fw.write_ushort(8 + (mtex * 8)) # Length
|
||||||
self.header.fw.write_uint(uvmask) # UV mask
|
self.header.fw.write_uint(uvmask) # UV mask
|
||||||
for i in xrange(mtex):
|
for i in xrange(mtex):
|
||||||
self.header.fw.write_ushort(face_desc.images[i]) # Tex pattern index
|
if face_desc.images[i] == -1:
|
||||||
|
self.header.fw.write_ushort(65535)
|
||||||
|
else:
|
||||||
|
self.header.fw.write_ushort(face_desc.images[i]) # Tex pattern index
|
||||||
self.header.fw.write_ushort(0) # Tex effect
|
self.header.fw.write_ushort(0) # Tex effect
|
||||||
self.header.fw.write_ushort(0) # Tex Mapping index
|
self.header.fw.write_ushort(0) # Tex Mapping index
|
||||||
self.header.fw.write_ushort(0) # Tex data. User defined
|
self.header.fw.write_ushort(0) # Tex data. User defined
|
||||||
@@ -1070,7 +1079,7 @@ class FLTNode(Node):
|
|||||||
|
|
||||||
if self.opcode == 63 and options.state['externalspath']:
|
if self.opcode == 63 and options.state['externalspath']:
|
||||||
try:
|
try:
|
||||||
exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt')
|
exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt').replace("\\", "/")
|
||||||
self.header.xrefnames.append(self.object.DupGroup.name)
|
self.header.xrefnames.append(self.object.DupGroup.name)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@@ -1092,7 +1101,7 @@ class FLTNode(Node):
|
|||||||
write_prop(self.header.fw,ftype,self.object.properties['FLT']['EXT'][propname],length)
|
write_prop(self.header.fw,ftype,self.object.properties['FLT']['EXT'][propname],length)
|
||||||
#write extension data
|
#write extension data
|
||||||
for i in xrange(datalen):
|
for i in xrange(datalen):
|
||||||
self.header.fw.write_char(self.object.properties['FLT']['EXT']['data'][i])
|
self.header.fw.write_uchar(struct.unpack('>B', struct.pack('>B', self.object.properties['FLT']['EXT']['data'][i]))[0])
|
||||||
self.write_pop_extension()
|
self.write_pop_extension()
|
||||||
|
|
||||||
|
|
||||||
@@ -1180,8 +1189,8 @@ class Database(Node):
|
|||||||
desc = self.GRR.request_vertex_desc(i)
|
desc = self.GRR.request_vertex_desc(i)
|
||||||
self.fw.write_short(70) # Vertex with color normal and uv opcode.
|
self.fw.write_short(70) # Vertex with color normal and uv opcode.
|
||||||
self.fw.write_ushort(64) # Length of record
|
self.fw.write_ushort(64) # Length of record
|
||||||
self.fw.write_ushort(0) # Color name index
|
self.fw.write_ushort(0) # Color name index
|
||||||
self.fw.write_short(0x20000000) # Flags
|
self.fw.write_short(1 << 14) # Frozen Normal
|
||||||
self.fw.write_double(desc.x)
|
self.fw.write_double(desc.x)
|
||||||
self.fw.write_double(desc.y)
|
self.fw.write_double(desc.y)
|
||||||
self.fw.write_double(desc.z)
|
self.fw.write_double(desc.z)
|
||||||
@@ -1245,7 +1254,7 @@ class Database(Node):
|
|||||||
cpalette = defaultp.pal
|
cpalette = defaultp.pal
|
||||||
count = len(cpalette)
|
count = len(cpalette)
|
||||||
for i in xrange(count):
|
for i in xrange(count):
|
||||||
color = struct.unpack('>BBBB',struct.pack('>I',cpalette[i]))
|
color = struct.unpack('>BBBB',struct.pack('>i',cpalette[i]))
|
||||||
self.fw.write_uchar(color[3]) # alpha
|
self.fw.write_uchar(color[3]) # alpha
|
||||||
self.fw.write_uchar(color[2]) # b
|
self.fw.write_uchar(color[2]) # b
|
||||||
self.fw.write_uchar(color[1]) # g
|
self.fw.write_uchar(color[1]) # g
|
||||||
|
502
release/scripts/flt_lodedit.py
Normal file
502
release/scripts/flt_lodedit.py
Normal file
@@ -0,0 +1,502 @@
|
|||||||
|
#!BPY
|
||||||
|
|
||||||
|
"""
|
||||||
|
Name: 'FLT LOD Editor'
|
||||||
|
Blender: 240
|
||||||
|
Group: 'Misc'
|
||||||
|
Tooltip: 'Level of Detail Edtior for FLT nodes'
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = "Geoffrey Bantle"
|
||||||
|
__version__ = "1.0 11/21/07"
|
||||||
|
__email__ = ('scripts', 'Author, ')
|
||||||
|
__url__ = ('blender', 'blenderartists.org')
|
||||||
|
|
||||||
|
__bpydoc__ ="""\
|
||||||
|
This script provides tools for working with OpenFlight databases in Blender. OpenFlight is a
|
||||||
|
registered trademark of MultiGen-Paradigm, Inc.
|
||||||
|
|
||||||
|
Feature overview and more availible at:
|
||||||
|
http://wiki.blender.org/index.php/Scripts/Manual/FLTools
|
||||||
|
"""
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# flt_palettemanager.py version 0.1 2005/04/08
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007: Blender Foundation
|
||||||
|
#
|
||||||
|
# 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 Blender.Draw as Draw
|
||||||
|
from Blender.BGL import *
|
||||||
|
import Blender
|
||||||
|
import flt_properties
|
||||||
|
reload(flt_properties)
|
||||||
|
from flt_properties import *
|
||||||
|
|
||||||
|
#event codes
|
||||||
|
evcode = {
|
||||||
|
"LOD_MAKE" : 100,
|
||||||
|
"LOD_DELETE" : 101,
|
||||||
|
"LOD_CALC_CENTER" : 102,
|
||||||
|
"LOD_GRAB_CENTER" : 103,
|
||||||
|
"LOD_X" : 104,
|
||||||
|
"LOD_Y" : 105,
|
||||||
|
"LOD_Z" : 106,
|
||||||
|
"LOD_FREEZE" : 107,
|
||||||
|
"LOD_SIG" : 108,
|
||||||
|
"LOD_IN" : 109,
|
||||||
|
"LOD_OUT" : 110,
|
||||||
|
"LOD_TRANS" : 111,
|
||||||
|
"LOD_PREVIOUS" : 112
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#system
|
||||||
|
LOD_MAKE = None #PushButton
|
||||||
|
LOD_DELETE = None #PushButton
|
||||||
|
LOD_CALC_CENTER = None #PushButton
|
||||||
|
LOD_GRAB_CENTER = None #Pushbutton
|
||||||
|
LOD_FREEZE = None #Toggle
|
||||||
|
LOD_PREVIOUS = None #Toggle
|
||||||
|
|
||||||
|
LOD_X = None #Input
|
||||||
|
LOD_Y = None #Input
|
||||||
|
LOD_Z = None #Input
|
||||||
|
|
||||||
|
LOD_SIG = None #Input
|
||||||
|
LOD_IN = None #Input
|
||||||
|
LOD_OUT = None #Input
|
||||||
|
LOD_TRANS = None #Input
|
||||||
|
|
||||||
|
#labels
|
||||||
|
LOD_EDITLABEL = None
|
||||||
|
LOD_SWITCHLABEL = None
|
||||||
|
LOD_CENTERLABEL = None
|
||||||
|
|
||||||
|
LOD_XLABEL = None
|
||||||
|
LOD_YLABEL = None
|
||||||
|
LOD_ZLABEL = None
|
||||||
|
LOD_SIGLABEL = None
|
||||||
|
LOD_INLABEL = None
|
||||||
|
LOD_OUTLABEL = None
|
||||||
|
LOD_TRANSLABEL = None
|
||||||
|
|
||||||
|
|
||||||
|
#ID Props
|
||||||
|
switch_in = '5d!switch in'
|
||||||
|
switch_out = '6d!switch out'
|
||||||
|
xco = '10d!X co'
|
||||||
|
yco = '11d!Y co'
|
||||||
|
zco = '12d!Z co'
|
||||||
|
trans = '13d!Transition'
|
||||||
|
sig_size = '14d!Sig Size'
|
||||||
|
|
||||||
|
#Flags
|
||||||
|
lodflag = '9I!flags'
|
||||||
|
previous_mask = (1 << 31)
|
||||||
|
freeze_mask = (1 << 29)
|
||||||
|
|
||||||
|
def update_state():
|
||||||
|
state = dict()
|
||||||
|
state["activeScene"] = Blender.Scene.GetCurrent()
|
||||||
|
state["activeObject"] = state["activeScene"].objects.active
|
||||||
|
if state["activeObject"] and not state["activeObject"].sel:
|
||||||
|
state["activeObject"] = None
|
||||||
|
state["activeMesh"] = None
|
||||||
|
if state["activeObject"] and state["activeObject"].type == 'Mesh':
|
||||||
|
state["activeMesh"] = state["activeObject"].getData(mesh=True)
|
||||||
|
|
||||||
|
state["activeFace"] = None
|
||||||
|
if state["activeMesh"]:
|
||||||
|
if state["activeMesh"].faceUV and state["activeMesh"].activeFace != None:
|
||||||
|
state["activeFace"] = state["activeMesh"].faces[state["activeMesh"].activeFace]
|
||||||
|
|
||||||
|
|
||||||
|
#update editmode
|
||||||
|
state["editmode"] = Blender.Window.EditMode()
|
||||||
|
|
||||||
|
return state
|
||||||
|
|
||||||
|
def idprops_append(object, typecode, props):
|
||||||
|
object.properties["FLT"] = dict()
|
||||||
|
object.properties["FLT"]['type'] = typecode
|
||||||
|
for prop in props:
|
||||||
|
object.properties["FLT"][prop] = props[prop]
|
||||||
|
object.properties["FLT"]['3t8!id'] = object.name
|
||||||
|
|
||||||
|
def idprops_kill():
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and state["activeObject"].properties.has_key('FLT'):
|
||||||
|
state["activeObject"].properties.pop('FLT')
|
||||||
|
|
||||||
|
def idprops_copy(source):
|
||||||
|
state = update_state()
|
||||||
|
if source.properties.has_key('FLT'):
|
||||||
|
for object in state["activeScene"].objects:
|
||||||
|
if object.sel and object != source and (state["activeScene"].Layers & object.Layers):
|
||||||
|
idprops_kill(object)
|
||||||
|
object.properties['FLT'] = dict()
|
||||||
|
for key in source.properties['FLT']:
|
||||||
|
object.properties['FLT'][key] = source.properties['FLT'][key]
|
||||||
|
|
||||||
|
def select_by_typecode(typecode):
|
||||||
|
state = update_state()
|
||||||
|
|
||||||
|
for object in state["activeScene"].objects:
|
||||||
|
if object.properties.has_key('FLT') and object.properties['FLT']['type'] == typecode and state["activeScene"].Layers & object.Layers:
|
||||||
|
object.select(1)
|
||||||
|
|
||||||
|
def idprops_type(object, typecode):
|
||||||
|
if object.properties.has_key('FLT') and object.properties['FLT'].has_key('type') and object.properties['FLT']['type'] == typecode:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
#ui type code
|
||||||
|
def get_prop(typecode, prop):
|
||||||
|
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], typecode):
|
||||||
|
props = state["activeObject"].properties['FLT']
|
||||||
|
else:
|
||||||
|
props = flt_properties.FLTLOD
|
||||||
|
|
||||||
|
return props[prop]
|
||||||
|
|
||||||
|
def set_prop(typecode, prop, value):
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"],typecode):
|
||||||
|
state["activeObject"].properties['FLT'][prop] = value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_lockmask(mask):
|
||||||
|
global lodflag
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"]:
|
||||||
|
flag = get_prop(73,lodflag)
|
||||||
|
if flag & mask:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def set_lockmask(mask):
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], 73):
|
||||||
|
oldvalue = state["activeObject"].properties['FLT'][lodflag]
|
||||||
|
oldvalue = struct.unpack('>I', struct.pack('>i', oldvalue))[0]
|
||||||
|
oldvalue |= mask
|
||||||
|
state["activeObject"].properties['FLT'][lodflag] = struct.unpack('>i', struct.pack(">I", oldvalue))[0]
|
||||||
|
|
||||||
|
def clear_lockmask(mask):
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], 73):
|
||||||
|
oldvalue = state["activeObject"].properties['FLT'][lodflag]
|
||||||
|
oldvalue = struct.unpack('>I', struct.pack('>i', oldvalue))[0]
|
||||||
|
oldvalue &= ~mask
|
||||||
|
state["activeObject"].properties['FLT'][lodflag] = struct.unpack('>i',struct.pack('>I',oldvalue))[0]
|
||||||
|
|
||||||
|
def findchildren(object):
|
||||||
|
state = update_state()
|
||||||
|
children = list()
|
||||||
|
for candidate in state["activeScene"].objects:
|
||||||
|
if candidate.parent == object:
|
||||||
|
children.append(candidate)
|
||||||
|
retlist = list(children)
|
||||||
|
for child in children:
|
||||||
|
retlist = retlist + findchildren(child)
|
||||||
|
return retlist
|
||||||
|
|
||||||
|
def get_object_center(object):
|
||||||
|
bbox = object.getBoundBox(1)
|
||||||
|
average = Blender.Mathutils.Vector(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
for point in bbox:
|
||||||
|
average[0] += point[0]
|
||||||
|
average[1] += point[1]
|
||||||
|
average[2] += point[2]
|
||||||
|
|
||||||
|
average[0] = average[0] / 8.0
|
||||||
|
average[1] = average[1] / 8.0
|
||||||
|
average[2] = average[2] / 8.0
|
||||||
|
|
||||||
|
return average
|
||||||
|
|
||||||
|
|
||||||
|
def calc_center():
|
||||||
|
|
||||||
|
global xco
|
||||||
|
global yco
|
||||||
|
global zco
|
||||||
|
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], 73):
|
||||||
|
average = Blender.Mathutils.Vector(0.0, 0.0, 0.0)
|
||||||
|
children = findchildren(state["activeObject"]) #get children objects
|
||||||
|
if children:
|
||||||
|
for child in children:
|
||||||
|
center = get_object_center(child)
|
||||||
|
average[0] += center[0]
|
||||||
|
average[1] += center[1]
|
||||||
|
average[2] += center[2]
|
||||||
|
|
||||||
|
average[0] = average[0] / len(children)
|
||||||
|
average[1] = average[1] / len(children)
|
||||||
|
average[2] = average[2] / len(children)
|
||||||
|
|
||||||
|
set_prop(73, xco, average[0])
|
||||||
|
set_prop(73, yco, average[1])
|
||||||
|
set_prop(73, zco, average[2])
|
||||||
|
|
||||||
|
|
||||||
|
def grab_center():
|
||||||
|
|
||||||
|
global xco
|
||||||
|
global yco
|
||||||
|
global zco
|
||||||
|
|
||||||
|
state = update_state()
|
||||||
|
if state["activeObject"] and idprops_type(state["activeObject"], 73):
|
||||||
|
center = Blender.Window.GetCursorPos()
|
||||||
|
|
||||||
|
set_prop(73, xco, center[0])
|
||||||
|
set_prop(73, yco, center[1])
|
||||||
|
set_prop(73, zco, center[2])
|
||||||
|
|
||||||
|
|
||||||
|
def create_lod():
|
||||||
|
state = update_state()
|
||||||
|
actobj = state["activeObject"]
|
||||||
|
if actobj and not idprops_type(actobj, 73):
|
||||||
|
idprops_kill()
|
||||||
|
idprops_append(actobj,73, flt_properties.FLTLOD)
|
||||||
|
calc_center()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def event(evt,val):
|
||||||
|
if evt == Draw.ESCKEY:
|
||||||
|
Draw.Exit()
|
||||||
|
|
||||||
|
def but_event(evt):
|
||||||
|
|
||||||
|
global LOD_MAKE
|
||||||
|
global LOD_DELETE
|
||||||
|
global LOD_CALC_CENTER
|
||||||
|
global LOD_GRAB_CENTER
|
||||||
|
global LOD_FREEZE
|
||||||
|
global LOD_PREVIOUS
|
||||||
|
global LOD_X
|
||||||
|
global LOD_Y
|
||||||
|
global LOD_Z
|
||||||
|
global LOD_SIG
|
||||||
|
global LOD_IN
|
||||||
|
global LOD_OUT
|
||||||
|
global LOD_TRANS
|
||||||
|
|
||||||
|
global switch_in
|
||||||
|
global switch_out
|
||||||
|
global xco
|
||||||
|
global yco
|
||||||
|
global zco
|
||||||
|
global trans
|
||||||
|
global sig_size
|
||||||
|
|
||||||
|
global lodflag
|
||||||
|
global previous_mask
|
||||||
|
global freeze_mask
|
||||||
|
|
||||||
|
global evcode
|
||||||
|
|
||||||
|
#do "system" events
|
||||||
|
if evt == evcode["LOD_MAKE"]:
|
||||||
|
create_lod()
|
||||||
|
|
||||||
|
if evt == evcode["LOD_CALC_CENTER"]:
|
||||||
|
calc_center()
|
||||||
|
|
||||||
|
if evt == evcode["LOD_DELETE"]:
|
||||||
|
idprops_kill()
|
||||||
|
|
||||||
|
if evt == evcode["LOD_GRAB_CENTER"]:
|
||||||
|
grab_center()
|
||||||
|
|
||||||
|
#do mask events
|
||||||
|
if evt == evcode["LOD_FREEZE"]:
|
||||||
|
if LOD_FREEZE.val == True:
|
||||||
|
set_lockmask(freeze_mask)
|
||||||
|
else:
|
||||||
|
clear_lockmask(freeze_mask)
|
||||||
|
|
||||||
|
if evt == evcode["LOD_PREVIOUS"]:
|
||||||
|
if LOD_PREVIOUS.val == True:
|
||||||
|
set_lockmask(previous_mask)
|
||||||
|
else:
|
||||||
|
clear_lockmask(previous_mask)
|
||||||
|
|
||||||
|
#do input events
|
||||||
|
if evt == evcode["LOD_X"]:
|
||||||
|
set_prop(73, xco, LOD_X.val)
|
||||||
|
if evt == evcode["LOD_Y"]:
|
||||||
|
set_prop(73, yco, LOD_Y.val)
|
||||||
|
if evt == evcode["LOD_Z"]:
|
||||||
|
set_prop(73, zco, LOD_Z.val)
|
||||||
|
if evt == evcode["LOD_SIG"]:
|
||||||
|
set_prop(73, sig_size, LOD_SIG.val)
|
||||||
|
if evt == evcode["LOD_IN"]:
|
||||||
|
set_prop(73, switch_in, LOD_IN.val)
|
||||||
|
if evt == evcode["LOD_OUT"]:
|
||||||
|
set_prop(73, switch_out, LOD_OUT.val)
|
||||||
|
if evt == evcode["LOD_TRANS"]:
|
||||||
|
set_prop(73, trans, LOD_TRANS.val)
|
||||||
|
|
||||||
|
|
||||||
|
Draw.Redraw(1)
|
||||||
|
Blender.Window.RedrawAll()
|
||||||
|
|
||||||
|
def draw_propsheet(x,y):
|
||||||
|
|
||||||
|
global LOD_MAKE
|
||||||
|
global LOD_DELETE
|
||||||
|
global LOD_CALC_CENTER
|
||||||
|
global LOD_GRAB_CENTER
|
||||||
|
global LOD_FREEZE
|
||||||
|
global LOD_PREVIOUS
|
||||||
|
global LOD_X
|
||||||
|
global LOD_Y
|
||||||
|
global LOD_Z
|
||||||
|
global LOD_SIG
|
||||||
|
global LOD_IN
|
||||||
|
global LOD_OUT
|
||||||
|
global LOD_TRANS
|
||||||
|
|
||||||
|
#labels
|
||||||
|
global LOD_EDITLABEL
|
||||||
|
global LOD_SWITCHLABEL
|
||||||
|
global LOD_CENTERLABEL
|
||||||
|
global LOD_XLABEL
|
||||||
|
global LOD_YLABEL
|
||||||
|
global LOD_ZLABEL
|
||||||
|
global LOD_SIGLABEL
|
||||||
|
global LOD_INLABEL
|
||||||
|
global LOD_OUTLABEL
|
||||||
|
global LOD_TRANSLABEL
|
||||||
|
|
||||||
|
|
||||||
|
global switch_in
|
||||||
|
global switch_out
|
||||||
|
global xco
|
||||||
|
global yco
|
||||||
|
global zco
|
||||||
|
global trans
|
||||||
|
global sig_size
|
||||||
|
|
||||||
|
global lodflag
|
||||||
|
global previous_mask
|
||||||
|
global freeze_mask
|
||||||
|
|
||||||
|
global evcode
|
||||||
|
|
||||||
|
|
||||||
|
global evcode
|
||||||
|
|
||||||
|
state = update_state()
|
||||||
|
|
||||||
|
label_width = 100
|
||||||
|
row_height = 20
|
||||||
|
toggle_width = 50
|
||||||
|
input_width = 100
|
||||||
|
pad = 10
|
||||||
|
origx = x
|
||||||
|
origy = (row_height * 16) + (pad * 16)
|
||||||
|
|
||||||
|
|
||||||
|
#editor label
|
||||||
|
x = origx
|
||||||
|
y = origy
|
||||||
|
LOD_EDITLABEL = Blender.Draw.Label("FLT Level of Detail Editor", x, y, 250, row_height)
|
||||||
|
|
||||||
|
|
||||||
|
#Center inputs
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_CENTERLABEL = Blender.Draw.Label("LOD center", x, y, label_width, row_height)
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_XLABEL = Blender.Draw.Label("X Coordinate", x, y, label_width, row_height)
|
||||||
|
x = origx + (label_width + pad)
|
||||||
|
LOD_X = Blender.Draw.Number("", evcode["LOD_X"], x, y, input_width, row_height,get_prop(73,xco), -1000000.0, 1000000.0, "")
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_YLABEL = Blender.Draw.Label("Y Coordinate", x, y, label_width, row_height)
|
||||||
|
x = origx + (label_width + pad)
|
||||||
|
LOD_Y = Blender.Draw.Number("", evcode["LOD_Y"], x, y, input_width, row_height,get_prop(73,yco), -1000000.0, 1000000.0, "")
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_ZLABEL = Blender.Draw.Label("Z Coordinate", x, y, label_width, row_height)
|
||||||
|
x = origx + (label_width + pad)
|
||||||
|
LOD_Z = Blender.Draw.Number("", evcode["LOD_Z"], x, y, input_width, row_height,get_prop(73,zco), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
|
||||||
|
#Switch inputs
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_SWITCHLABEL = Blender.Draw.Label("Switch Settings", x, y, input_width, row_height)
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_SIGLABEL = Blender.Draw.Label("Significant Size", x, y, label_width, row_height)
|
||||||
|
x = origx + (label_width + pad)
|
||||||
|
LOD_SIG = Blender.Draw.Number("", evcode["LOD_SIG"], x, y, input_width, row_height, get_prop(73,sig_size), -1000000.0, 1000000.0, "")
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_INLABEL = Blender.Draw.Label("Switch In", x, y, label_width, row_height)
|
||||||
|
x = origx + (label_width + pad)
|
||||||
|
LOD_IN = Blender.Draw.Number("", evcode["LOD_IN"], x, y, input_width, row_height, get_prop(73,switch_in), -1000000.0, 1000000.0, "")
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_OUTLABEL = Blender.Draw.Label("Switch Out", x, y, label_width, row_height)
|
||||||
|
x = origx + (label_width + pad)
|
||||||
|
LOD_OUT = Blender.Draw.Number("", evcode["LOD_OUT"], x, y, input_width, row_height, get_prop(73,switch_out), -1000000.0, 1000000.0, "")
|
||||||
|
x = origx
|
||||||
|
y = y- (row_height + pad)
|
||||||
|
LOD_TRANSLABEL = Blender.Draw.Label("Transition", x, y, label_width, row_height)
|
||||||
|
x = origx + (label_width + pad)
|
||||||
|
LOD_TRANS = Blender.Draw.Number("", evcode["LOD_TRANS"], x, y, input_width, row_height, get_prop(73,trans), -1000000.0, 1000000.0, "")
|
||||||
|
|
||||||
|
|
||||||
|
x = origx
|
||||||
|
y = y - (row_height + pad)
|
||||||
|
LOD_MAKE = Blender.Draw.PushButton("Make LOD", evcode["LOD_MAKE"], x, y, input_width + label_width + pad, row_height, "Make a LOD Node out of Active Object")
|
||||||
|
y = y - (row_height + pad)
|
||||||
|
LOD_DELETE = Blender.Draw.PushButton("Delete LOD", evcode["LOD_DELETE"], x, y, input_width + label_width + pad, row_height, "Delete the LOD Node properties")
|
||||||
|
y = y - (row_height + pad)
|
||||||
|
LOD_CALC_CENTER = Blender.Draw.PushButton("Calculate Center", evcode["LOD_CALC_CENTER"], x, y, input_width + label_width + pad, row_height, "Calculate the center of this LOD")
|
||||||
|
y = y - (row_height + pad)
|
||||||
|
LOD_GRAB_CENTER = Blender.Draw.PushButton("Grab Center", evcode["LOD_GRAB_CENTER"], x, y, input_width + label_width + pad, row_height, "Grab center from 3d cursor")
|
||||||
|
y = y - (row_height + pad)
|
||||||
|
LOD_FREEZE = Blender.Draw.Toggle("Freeze Center", evcode["LOD_FREEZE"], x, y, input_width + label_width + pad, row_height, get_lockmask(freeze_mask), "")
|
||||||
|
y = y - (row_height + pad)
|
||||||
|
LOD_PREVIOUS = Blender.Draw.Toggle("Previous Range", evcode["LOD_PREVIOUS"], x, y, input_width + label_width + pad, row_height, get_lockmask(previous_mask), "")
|
||||||
|
|
||||||
|
def gui():
|
||||||
|
#draw the propsheet/toolbox.
|
||||||
|
psheety = 800
|
||||||
|
#psheetx = psheety + 10
|
||||||
|
draw_propsheet(20,psheety)
|
||||||
|
|
||||||
|
Draw.Register(gui,event,but_event)
|
||||||
|
|
@@ -25,7 +25,7 @@ http://wiki.blender.org/index.php/Scripts/Manual/FLTools
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# flt_palettemanager.py version 0.1 2005/04/08
|
# flt_palettemanager.py version 1.0 2005/04/08
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
#
|
#
|
||||||
@@ -55,6 +55,75 @@ import flt_properties
|
|||||||
import flt_defaultp as defaultp
|
import flt_defaultp as defaultp
|
||||||
from flt_properties import *
|
from flt_properties import *
|
||||||
|
|
||||||
|
def RGBtoHSV( r, g, b):
|
||||||
|
minc = min( r, g, b )
|
||||||
|
maxc = max( r, g, b )
|
||||||
|
v = maxc
|
||||||
|
|
||||||
|
delta = maxc - minc
|
||||||
|
|
||||||
|
if( max != 0 ):
|
||||||
|
s = delta / maxc
|
||||||
|
else:
|
||||||
|
s = 0
|
||||||
|
h = -1
|
||||||
|
return (h,s,v)
|
||||||
|
|
||||||
|
if( r == maxc ):
|
||||||
|
h = ( g - b ) / delta
|
||||||
|
elif( g == maxc ):
|
||||||
|
h = 2 + ( b - r ) / delta
|
||||||
|
else:
|
||||||
|
h = 4 + ( r - g ) / delta
|
||||||
|
|
||||||
|
h *= 60
|
||||||
|
if( h < 0 ):
|
||||||
|
h += 360
|
||||||
|
|
||||||
|
return(h,s,v)
|
||||||
|
|
||||||
|
def HSVtoRGB(h,s,v):
|
||||||
|
|
||||||
|
if( s == 0 ):
|
||||||
|
return (v,v,v)
|
||||||
|
|
||||||
|
|
||||||
|
h /= 60
|
||||||
|
i = math.floor( h)
|
||||||
|
f = h - i
|
||||||
|
p = v * ( 1 - s )
|
||||||
|
q = v * ( 1 - s * f )
|
||||||
|
t = v * ( 1 - s * ( 1 - f ) )
|
||||||
|
|
||||||
|
if i == 0:
|
||||||
|
r = v
|
||||||
|
g = t
|
||||||
|
b = p
|
||||||
|
elif i == 1:
|
||||||
|
r = q
|
||||||
|
g = v
|
||||||
|
b = p
|
||||||
|
|
||||||
|
elif i== 2:
|
||||||
|
r = p
|
||||||
|
g = v
|
||||||
|
b = t
|
||||||
|
elif i==3:
|
||||||
|
r = p
|
||||||
|
g = q
|
||||||
|
b = v
|
||||||
|
elif i==4:
|
||||||
|
r = t
|
||||||
|
g = p
|
||||||
|
b = v
|
||||||
|
|
||||||
|
else:
|
||||||
|
r = v
|
||||||
|
g = p
|
||||||
|
b = q
|
||||||
|
|
||||||
|
return(r,g,b)
|
||||||
|
|
||||||
|
|
||||||
palette_size = 12
|
palette_size = 12
|
||||||
palette_x = 0
|
palette_x = 0
|
||||||
@@ -68,6 +137,14 @@ cinc = 1.0 / 1024.0
|
|||||||
cstep = 0.0
|
cstep = 0.0
|
||||||
picker = None
|
picker = None
|
||||||
ptt = ""
|
ptt = ""
|
||||||
|
|
||||||
|
|
||||||
|
ts1=None
|
||||||
|
ts2=None
|
||||||
|
ts3=None
|
||||||
|
ts4=None
|
||||||
|
ts5=None
|
||||||
|
|
||||||
for i in xrange(1024):
|
for i in xrange(1024):
|
||||||
colors.append([cstep,cstep,cstep])
|
colors.append([cstep,cstep,cstep])
|
||||||
cstep = cstep + cinc
|
cstep = cstep + cinc
|
||||||
@@ -128,7 +205,7 @@ def event(evt,val):
|
|||||||
Draw.Redraw(1)
|
Draw.Redraw(1)
|
||||||
|
|
||||||
#copy current color and intensity to selected faces.
|
#copy current color and intensity to selected faces.
|
||||||
elif evt == Draw.CKEY:
|
elif evt == Draw.VKEY:
|
||||||
|
|
||||||
if Blender.Window.EditMode():
|
if Blender.Window.EditMode():
|
||||||
Blender.Window.EditMode(0)
|
Blender.Window.EditMode(0)
|
||||||
@@ -136,7 +213,7 @@ def event(evt,val):
|
|||||||
state = update_state()
|
state = update_state()
|
||||||
|
|
||||||
#retrieve color from palette
|
#retrieve color from palette
|
||||||
color = struct.unpack('>BBBB',struct.pack('>I',colors[curswatch]))
|
color = struct.unpack('>BBBB',struct.pack('>i',colors[curswatch]))
|
||||||
actmesh = state["activeMesh"]
|
actmesh = state["activeMesh"]
|
||||||
if actmesh:
|
if actmesh:
|
||||||
if(Blender.Window.GetKeyQualifiers() != Blender.Window.Qual["CTRL"]):
|
if(Blender.Window.GetKeyQualifiers() != Blender.Window.Qual["CTRL"]):
|
||||||
@@ -182,7 +259,7 @@ def event(evt,val):
|
|||||||
Blender.Window.RedrawAll()
|
Blender.Window.RedrawAll()
|
||||||
|
|
||||||
#grab color and intensity from active face
|
#grab color and intensity from active face
|
||||||
elif evt == Draw.VKEY:
|
elif evt == Draw.CKEY:
|
||||||
if Blender.Window.EditMode():
|
if Blender.Window.EditMode():
|
||||||
Blender.Window.EditMode(0)
|
Blender.Window.EditMode(0)
|
||||||
editmode = 1
|
editmode = 1
|
||||||
@@ -211,6 +288,23 @@ def event(evt,val):
|
|||||||
Blender.Window.EditMode(1)
|
Blender.Window.EditMode(1)
|
||||||
|
|
||||||
Blender.Window.RedrawAll()
|
Blender.Window.RedrawAll()
|
||||||
|
|
||||||
|
elif evt == Draw.GKEY:
|
||||||
|
if Blender.Window.EditMode():
|
||||||
|
Blender.Window.EditMode(0)
|
||||||
|
editmode =1
|
||||||
|
state = update_state()
|
||||||
|
|
||||||
|
actmesh = state["activeMesh"]
|
||||||
|
activeFace = state["activeFace"]
|
||||||
|
|
||||||
|
if activeFace and "FLT_COL" in actmesh.faces.properties:
|
||||||
|
(index,intensity) = unpack_face_index(activeFace.getProperty("FLT_COL"))
|
||||||
|
for face in actmesh.faces:
|
||||||
|
(index2, intensity2) = unpack_face_index(face.getProperty("FLT_COL"))
|
||||||
|
if index == index2:
|
||||||
|
face.sel = 1
|
||||||
|
|
||||||
|
|
||||||
elif evt == Draw.ESCKEY:
|
elif evt == Draw.ESCKEY:
|
||||||
Draw.Exit()
|
Draw.Exit()
|
||||||
@@ -225,11 +319,11 @@ def update_all():
|
|||||||
for object in state["activeScene"].objects:
|
for object in state["activeScene"].objects:
|
||||||
if object.type == "Mesh":
|
if object.type == "Mesh":
|
||||||
mesh = object.getData(mesh=True)
|
mesh = object.getData(mesh=True)
|
||||||
if 'FLT_COL' in mesh.faces.properties:
|
if 'FLT_COL' in mesh.faces.properties and "FLT_Fcol" in mesh.getColorLayerNames():
|
||||||
mesh.activeColorLayer = "FLT_Fcol"
|
mesh.activeColorLayer = "FLT_Fcol"
|
||||||
for face in mesh.faces:
|
for face in mesh.faces:
|
||||||
(index,intensity) = unpack_face_index(face.getProperty('FLT_COL'))
|
(index,intensity) = unpack_face_index(face.getProperty('FLT_COL'))
|
||||||
color = struct.unpack('>BBBB',struct.pack('>I',colors[index]))
|
color = struct.unpack('>BBBB',struct.pack('>i',colors[index]))
|
||||||
#update the vertex colors for this face
|
#update the vertex colors for this face
|
||||||
for col in face.col:
|
for col in face.col:
|
||||||
col.r = int(color[0] * intensity)
|
col.r = int(color[0] * intensity)
|
||||||
@@ -284,8 +378,13 @@ def draw_palette():
|
|||||||
global colors
|
global colors
|
||||||
global curint
|
global curint
|
||||||
global curswatch
|
global curswatch
|
||||||
global picker
|
global picker
|
||||||
|
global ts1
|
||||||
|
global ts2
|
||||||
|
global ts3
|
||||||
|
global ts4
|
||||||
|
global ts5
|
||||||
|
|
||||||
state = update_state()
|
state = update_state()
|
||||||
init_pal()
|
init_pal()
|
||||||
|
|
||||||
@@ -297,7 +396,7 @@ def draw_palette():
|
|||||||
for x in xrange(32):
|
for x in xrange(32):
|
||||||
ypos = palette_y
|
ypos = palette_y
|
||||||
for y in xrange(32):
|
for y in xrange(32):
|
||||||
color = struct.unpack('>BBBB',struct.pack('>I',colors[cid]))
|
color = struct.unpack('>BBBB',struct.pack('>i',colors[cid]))
|
||||||
glColor3f(color[0]/255.0,color[1]/255.0,color[2]/255.0)
|
glColor3f(color[0]/255.0,color[1]/255.0,color[2]/255.0)
|
||||||
glBegin(GL_POLYGON)
|
glBegin(GL_POLYGON)
|
||||||
glVertex2i(xpos,ypos)
|
glVertex2i(xpos,ypos)
|
||||||
@@ -328,7 +427,7 @@ def draw_palette():
|
|||||||
xpos = xpos + ssize
|
xpos = xpos + ssize
|
||||||
|
|
||||||
#draw intensity gradient
|
#draw intensity gradient
|
||||||
color = struct.unpack('>BBBB',struct.pack('>I',colors[curswatch]))
|
color = struct.unpack('>BBBB',struct.pack('>i',colors[curswatch]))
|
||||||
color = [color[0]/255.0,color[1]/255.0,color[2]/255.0]
|
color = [color[0]/255.0,color[1]/255.0,color[2]/255.0]
|
||||||
colsteps = [color[0]/255.0,color[1]/255.0,color[2]/255.0]
|
colsteps = [color[0]/255.0,color[1]/255.0,color[2]/255.0]
|
||||||
stripwidth = (palette_size * 32.0) / 256
|
stripwidth = (palette_size * 32.0) / 256
|
||||||
@@ -355,15 +454,15 @@ def draw_palette():
|
|||||||
xpos = ((palette_size*32) * (1.0 - curint)) + palette_x
|
xpos = ((palette_size*32) * (1.0 - curint)) + palette_x
|
||||||
glColor3f(1.0,1.0,1.0)
|
glColor3f(1.0,1.0,1.0)
|
||||||
glBegin(GL_LINE_LOOP)
|
glBegin(GL_LINE_LOOP)
|
||||||
glVertex2i(xpos-6,grady-1)
|
glVertex2i(int(xpos-6),int(grady-1))
|
||||||
glVertex2i(xpos+6,grady-1)
|
glVertex2i(int(xpos+6),int(grady-1))
|
||||||
glVertex2i(xpos+6,grady+palette_size+1)
|
glVertex2i(int(xpos+6),int(grady+palette_size+1))
|
||||||
glVertex2i(xpos-6,grady+palette_size+1)
|
glVertex2i(int(xpos-6),int(grady+palette_size+1))
|
||||||
#glVertex2i(xpos-6,grady+7)
|
#glVertex2i(xpos-6,grady+7)
|
||||||
glEnd()
|
glEnd()
|
||||||
|
|
||||||
#draw color picker
|
#draw color picker
|
||||||
color = struct.unpack('>BBBB',struct.pack('>I',colors[curswatch]))
|
color = struct.unpack('>BBBB',struct.pack('>i',colors[curswatch]))
|
||||||
pickcol = (color[0]/255.0,color[1]/255.0,color[2]/255.0)
|
pickcol = (color[0]/255.0,color[1]/255.0,color[2]/255.0)
|
||||||
picker = Blender.Draw.ColorPicker(1,highlight[0][0]+1,highlight[0][1]+1,ssize-2,ssize-2,pickcol,ptt)
|
picker = Blender.Draw.ColorPicker(1,highlight[0][0]+1,highlight[0][1]+1,ssize-2,ssize-2,pickcol,ptt)
|
||||||
|
|
||||||
@@ -377,6 +476,24 @@ def draw_palette():
|
|||||||
glVertex2i(highlight[0][0],highlight[0][1])
|
glVertex2i(highlight[0][0],highlight[0][1])
|
||||||
glEnd()
|
glEnd()
|
||||||
|
|
||||||
|
#draw text string explanations
|
||||||
|
xpos = palette_size*32+20
|
||||||
|
ypos = palette_size*32+10
|
||||||
|
glRasterPos2d(xpos,ypos)
|
||||||
|
ts1 = Blender.Draw.Text("FLT Palette Manager V 1.0")
|
||||||
|
ypos = ypos - 20
|
||||||
|
glRasterPos2d(xpos,ypos)
|
||||||
|
ts3 = Blender.Draw.Text("CKEY - Copy Active Face Color*")
|
||||||
|
ypos = ypos - 20
|
||||||
|
glRasterPos2d(xpos,ypos)
|
||||||
|
ts2 = Blender.Draw.Text("VKEY - Paste Color to Selected Faces")
|
||||||
|
ypos = ypos - 20
|
||||||
|
glRasterPos2d(xpos,ypos)
|
||||||
|
ts4 = Blender.Draw.Text("GKEY - Select Faces With Same Color")
|
||||||
|
ypos = ypos - 15
|
||||||
|
glRasterPos2d(xpos,ypos)
|
||||||
|
ts5 = Blender.Draw.Text("(*Requires mesh with UV coordinates)", 'small')
|
||||||
|
|
||||||
def gui():
|
def gui():
|
||||||
glClearColor(0.5,0.5,0.5,1.0)
|
glClearColor(0.5,0.5,0.5,1.0)
|
||||||
glClear(GL_COLOR_BUFFER_BIT)
|
glClear(GL_COLOR_BUFFER_BIT)
|
||||||
@@ -385,4 +502,4 @@ def gui():
|
|||||||
|
|
||||||
init_pal()
|
init_pal()
|
||||||
Draw.Register(gui,event,but_event)
|
Draw.Register(gui,event,but_event)
|
||||||
|
|
@@ -197,7 +197,10 @@ def write_prop(fw,type,value,length):
|
|||||||
elif type == 'i':
|
elif type == 'i':
|
||||||
fw.write_int(value)
|
fw.write_int(value)
|
||||||
elif type == 'I':
|
elif type == 'I':
|
||||||
fw.write_uint(value)
|
#NOTE!:
|
||||||
|
#there is no unsigned int type in python, but we can only store signed ints in ID props
|
||||||
|
newvalue = struct.unpack('>I', struct.pack('>i', value))[0]
|
||||||
|
fw.write_uint(newvalue)
|
||||||
elif type == 'd':
|
elif type == 'd':
|
||||||
fw.write_double(value)
|
fw.write_double(value)
|
||||||
elif type == 'f':
|
elif type == 'f':
|
||||||
@@ -267,16 +270,16 @@ FLTObjectDisplay = [10]
|
|||||||
FLTLOD = {
|
FLTLOD = {
|
||||||
'3t8!id' : 'L',
|
'3t8!id' : 'L',
|
||||||
'4i!reserved' : 0,
|
'4i!reserved' : 0,
|
||||||
'5d!switch in' : 0,
|
'5d!switch in' : 0.0,
|
||||||
'6d!switch out' : 0,
|
'6d!switch out' : 0.0,
|
||||||
'7s!sfx ID1' : 0,
|
'7s!sfx ID1' : 0,
|
||||||
'8s!sfx ID2' : 0,
|
'8s!sfx ID2' : 0,
|
||||||
'9I!flags' : 0,
|
'9I!flags' : 0,
|
||||||
'10d!X co' : 0,
|
'10d!X co' : 0.0,
|
||||||
'11d!Y co' : 0,
|
'11d!Y co' : 0.0,
|
||||||
'12d!Z co' : 0,
|
'12d!Z co' : 0.0,
|
||||||
'13d!Transition' : 0,
|
'13d!Transition' : 0.0,
|
||||||
'14d!Sig Size' : 0
|
'14d!Sig Size' : 0.0
|
||||||
}
|
}
|
||||||
FLTLODDisplay = [4]
|
FLTLODDisplay = [4]
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -121,25 +121,29 @@ def rem_unused_materials(me):
|
|||||||
material_users= dict( [(i,0) for i in xrange(len_materials)] )
|
material_users= dict( [(i,0) for i in xrange(len_materials)] )
|
||||||
|
|
||||||
for f in me.faces:
|
for f in me.faces:
|
||||||
|
f_mat = f.mat
|
||||||
# Make sure the face index isnt too big. this happens sometimes.
|
# Make sure the face index isnt too big. this happens sometimes.
|
||||||
if f.mat >= len_materials:
|
if f_mat >= len_materials:
|
||||||
f.mat=0
|
f_mat = f.mat = 0
|
||||||
material_users[f.mat] += 1
|
material_users[f_mat] += 1
|
||||||
|
|
||||||
mat_idx_subtract= 0
|
# mat_idx_subtract= 0
|
||||||
reindex_mapping= dict( [(i,0) for i in xrange(len_materials)] )
|
# reindex_mapping= dict( [(i,0) for i in xrange(len_materials)] )
|
||||||
i= len_materials
|
|
||||||
while i:
|
reindex_mapping_ls = range(len_materials)
|
||||||
i-=1
|
for i in range(len_materials-1, -1, -1):
|
||||||
|
|
||||||
if material_users[i] == 0:
|
if material_users[i] == 0:
|
||||||
mat_idx_subtract+=1
|
del reindex_mapping_ls[i]
|
||||||
reindex_mapping[i]= mat_idx_subtract
|
del materials[i]
|
||||||
materials.pop(i)
|
|
||||||
rem_materials+=1
|
rem_materials+=1
|
||||||
|
|
||||||
|
reindex_mapping= {}
|
||||||
|
|
||||||
|
for i, mat in enumerate(reindex_mapping_ls):
|
||||||
|
reindex_mapping[mat] = i
|
||||||
|
|
||||||
for f in me.faces:
|
for f in me.faces:
|
||||||
f.mat= f.mat - reindex_mapping[f.mat]
|
f.mat= reindex_mapping[f.mat]
|
||||||
|
|
||||||
me.materials= materials
|
me.materials= materials
|
||||||
return rem_materials
|
return rem_materials
|
||||||
@@ -449,4 +453,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
328
release/scripts/mesh_poly_reduce_grid.py
Normal file
328
release/scripts/mesh_poly_reduce_grid.py
Normal file
@@ -0,0 +1,328 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Poly Reduce Selection (Unsubsurf)'
|
||||||
|
Blender: 245
|
||||||
|
Group: 'Mesh'
|
||||||
|
Tooltip: 'pradictable mesh simplifaction maintaining face loops'
|
||||||
|
"""
|
||||||
|
|
||||||
|
from Blender import Scene, Mesh, Window, sys
|
||||||
|
import BPyMessages
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
def my_mesh_util(me):
|
||||||
|
me_verts = me.verts
|
||||||
|
|
||||||
|
vert_faces = [ [] for v in me_verts]
|
||||||
|
vert_faces_corner = [ [] for v in me_verts]
|
||||||
|
|
||||||
|
|
||||||
|
# Ignore topology where there are not 2 faces connected to an edge.
|
||||||
|
edge_count = {}
|
||||||
|
for f in me.faces:
|
||||||
|
for edkey in f.edge_keys:
|
||||||
|
try:
|
||||||
|
edge_count[edkey] += 1
|
||||||
|
except:
|
||||||
|
edge_count[edkey] = 1
|
||||||
|
|
||||||
|
for edkey, count in edge_count.iteritems():
|
||||||
|
|
||||||
|
# Ignore verts that connect to edges with more then 2 faces.
|
||||||
|
if count != 2:
|
||||||
|
vert_faces[edkey[0]] = None
|
||||||
|
vert_faces[edkey[1]] = None
|
||||||
|
# Done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def faces_set_verts(face_ls):
|
||||||
|
unique_verts = set()
|
||||||
|
for f in face_ls:
|
||||||
|
for v in f:
|
||||||
|
unique_verts.add(v.index)
|
||||||
|
return unique_verts
|
||||||
|
|
||||||
|
for f in me.faces:
|
||||||
|
for corner, v in enumerate(f):
|
||||||
|
i = v.index
|
||||||
|
if vert_faces[i] != None:
|
||||||
|
vert_faces[i].append(f)
|
||||||
|
vert_faces_corner[i].append( corner )
|
||||||
|
|
||||||
|
grid_data_ls = []
|
||||||
|
|
||||||
|
for vi, face_ls in enumerate(vert_faces):
|
||||||
|
if face_ls != None:
|
||||||
|
if len(face_ls) == 4:
|
||||||
|
if face_ls[0].sel and face_ls[1].sel and face_ls[2].sel and face_ls[3].sel:
|
||||||
|
# Support triangles also
|
||||||
|
unique_vert_count = len(faces_set_verts(face_ls))
|
||||||
|
quads = 0
|
||||||
|
for f in face_ls:
|
||||||
|
if len(f) ==4:
|
||||||
|
quads += 1
|
||||||
|
if unique_vert_count==5+quads: # yay we have a grid
|
||||||
|
grid_data_ls.append( (vi, face_ls) )
|
||||||
|
|
||||||
|
elif len(face_ls) == 3:
|
||||||
|
if face_ls[0].sel and face_ls[1].sel and face_ls[2].sel:
|
||||||
|
unique_vert_count = len(faces_set_verts(face_ls))
|
||||||
|
if unique_vert_count==4: # yay we have 3 triangles to make into a bigger triangle
|
||||||
|
grid_data_ls.append( (vi, face_ls) )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Now sort out which grid faces to use
|
||||||
|
|
||||||
|
|
||||||
|
# This list will be used for items we can convert, vertex is key, faces are values
|
||||||
|
grid_data_dict = {}
|
||||||
|
|
||||||
|
if not grid_data_ls:
|
||||||
|
print "doing nothing"
|
||||||
|
return
|
||||||
|
|
||||||
|
# quick lookup for the opposing corner of a qiad
|
||||||
|
quad_diag_mapping = 2,3,0,1
|
||||||
|
|
||||||
|
verts_used = [0] * len(me_verts) # 0 == untouched, 1==should touch, 2==touched
|
||||||
|
verts_used[grid_data_ls[0][0]] = 1 # start touching 1!
|
||||||
|
|
||||||
|
# From the corner vert, get the 2 edges that are not the corner or its opposing vert, this edge will make a new face
|
||||||
|
quad_edge_mapping = (1,3), (2,0), (1,3), (0,2) # hi-low, low-hi order is intended
|
||||||
|
tri_edge_mapping = (1,2), (0,2), (0,1)
|
||||||
|
|
||||||
|
done_somthing = True
|
||||||
|
while done_somthing:
|
||||||
|
done_somthing = False
|
||||||
|
grid_data_ls_index = -1
|
||||||
|
|
||||||
|
for vi, face_ls in grid_data_ls:
|
||||||
|
grid_data_ls_index += 1
|
||||||
|
if len(face_ls) == 3:
|
||||||
|
grid_data_dict[vi] = face_ls
|
||||||
|
grid_data_ls.pop( grid_data_ls_index )
|
||||||
|
break
|
||||||
|
elif len(face_ls) == 4:
|
||||||
|
# print vi
|
||||||
|
if verts_used[vi] == 1:
|
||||||
|
verts_used[vi] = 2 # dont look at this again.
|
||||||
|
done_somthing = True
|
||||||
|
|
||||||
|
grid_data_dict[vi] = face_ls
|
||||||
|
|
||||||
|
# Tag all faces verts as used
|
||||||
|
|
||||||
|
for i, f in enumerate(face_ls):
|
||||||
|
# i == face index on vert, needed to recall which corner were on.
|
||||||
|
v_corner = vert_faces_corner[vi][i]
|
||||||
|
fv =f.v
|
||||||
|
|
||||||
|
if len(f) == 4:
|
||||||
|
v_other = quad_diag_mapping[v_corner]
|
||||||
|
# get the 2 other corners
|
||||||
|
corner1, corner2 = quad_edge_mapping[v_corner]
|
||||||
|
if verts_used[fv[v_other].index] == 0:
|
||||||
|
verts_used[fv[v_other].index] = 1 # TAG for touching!
|
||||||
|
else:
|
||||||
|
corner1, corner2 = tri_edge_mapping[v_corner]
|
||||||
|
|
||||||
|
verts_used[fv[corner1].index] = 2 # Dont use these, they are
|
||||||
|
verts_used[fv[corner2].index] = 2
|
||||||
|
|
||||||
|
|
||||||
|
# remove this since we have used it.
|
||||||
|
grid_data_ls.pop( grid_data_ls_index )
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
|
if done_somthing == False:
|
||||||
|
# See if there are any that have not even been tagged, (probably on a different island), then tag them.
|
||||||
|
|
||||||
|
for vi, face_ls in grid_data_ls:
|
||||||
|
if verts_used[vi] == 0:
|
||||||
|
verts_used[vi] = 1
|
||||||
|
done_somthing = True
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
# Now we have all the areas we will fill, calculate corner triangles we need to fill in.
|
||||||
|
new_faces = []
|
||||||
|
quad_del_vt_map = (1,2,3), (0,2,3), (0,1,3), (0,1,2)
|
||||||
|
for vi, face_ls in grid_data_dict.iteritems():
|
||||||
|
for i, f in enumerate(face_ls):
|
||||||
|
if len(f) == 4:
|
||||||
|
# i == face index on vert, needed to recall which corner were on.
|
||||||
|
v_corner = vert_faces_corner[vi][i]
|
||||||
|
v_other = quad_diag_mapping[v_corner]
|
||||||
|
fv =f.v
|
||||||
|
|
||||||
|
#print verts_used[fv[v_other].index]
|
||||||
|
#if verts_used[fv[v_other].index] != 2: # DOSNT WORK ALWAYS
|
||||||
|
|
||||||
|
if 1: # THIS IS LAzY - some of these faces will be removed after adding.
|
||||||
|
# Ok we are removing half of this face, add the other half
|
||||||
|
|
||||||
|
# This is probably slower
|
||||||
|
# new_faces.append( [fv[ii].index for ii in (0,1,2,3) if ii != v_corner ] )
|
||||||
|
|
||||||
|
# do this instead
|
||||||
|
new_faces.append( (fv[quad_del_vt_map[v_corner][0]], fv[quad_del_vt_map[v_corner][1]], fv[quad_del_vt_map[v_corner][2]]) )
|
||||||
|
|
||||||
|
del grid_data_ls
|
||||||
|
|
||||||
|
|
||||||
|
# me.sel = 0
|
||||||
|
def faceCombine4(vi, face_ls):
|
||||||
|
edges = []
|
||||||
|
|
||||||
|
for i, f in enumerate(face_ls):
|
||||||
|
fv = f.v
|
||||||
|
v_corner = vert_faces_corner[vi][i]
|
||||||
|
if len(f)==4: ed = quad_edge_mapping[v_corner]
|
||||||
|
else: ed = tri_edge_mapping[v_corner]
|
||||||
|
|
||||||
|
edges.append( [fv[ed[0]].index, fv[ed[1]].index] )
|
||||||
|
|
||||||
|
# get the face from the edges
|
||||||
|
face = edges.pop()
|
||||||
|
while len(face) != 4:
|
||||||
|
# print len(edges), edges, face
|
||||||
|
for ed_idx, ed in enumerate(edges):
|
||||||
|
if face[-1] == ed[0] and (ed[1] != face[0]):
|
||||||
|
face.append(ed[1])
|
||||||
|
elif face[-1] == ed[1] and (ed[0] != face[0]):
|
||||||
|
face.append(ed[0])
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
edges.pop(ed_idx) # we used the edge alredy
|
||||||
|
break
|
||||||
|
|
||||||
|
return face
|
||||||
|
|
||||||
|
for vi, face_ls in grid_data_dict.iteritems():
|
||||||
|
if len(face_ls) == 4:
|
||||||
|
new_faces.append( faceCombine4(vi, face_ls) )
|
||||||
|
#pass
|
||||||
|
if len(face_ls) == 3: # 3 triangles
|
||||||
|
face = list(faces_set_verts(face_ls))
|
||||||
|
face.remove(vi)
|
||||||
|
new_faces.append( face )
|
||||||
|
|
||||||
|
|
||||||
|
# Now remove verts surounded by 3 triangles
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# print new_edges
|
||||||
|
# me.faces.extend(new_faces, ignoreDups=True)
|
||||||
|
|
||||||
|
'''
|
||||||
|
faces_remove = []
|
||||||
|
for vi, face_ls in grid_data_dict.iteritems():
|
||||||
|
faces_remove.extend(face_ls)
|
||||||
|
'''
|
||||||
|
|
||||||
|
orig_facelen = len(me.faces)
|
||||||
|
|
||||||
|
orig_faces = list(me.faces)
|
||||||
|
me.faces.extend(new_faces, ignoreDups=True)
|
||||||
|
new_faces = list(me.faces)[len(orig_faces):]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if me.faceUV:
|
||||||
|
uvnames = me.getUVLayerNames()
|
||||||
|
act_uvlay = me.activeUVLayer
|
||||||
|
|
||||||
|
vert_faces_uvs = []
|
||||||
|
vert_faces_images = []
|
||||||
|
|
||||||
|
|
||||||
|
act_uvlay = me.activeUVLayer
|
||||||
|
|
||||||
|
for uvlay in uvnames:
|
||||||
|
me.activeUVLayer = uvlay
|
||||||
|
vert_faces_uvs[:] = [None] * len(me.verts)
|
||||||
|
vert_faces_images[:] = vert_faces_uvs[:]
|
||||||
|
|
||||||
|
for i,f in enumerate(orig_faces):
|
||||||
|
img = f.image
|
||||||
|
fv = f.v
|
||||||
|
uv = f.uv
|
||||||
|
mat = f.mat
|
||||||
|
for i,v in enumerate(fv):
|
||||||
|
vi = v.index
|
||||||
|
vert_faces_uvs[vi] = uv[i] # no nice averaging
|
||||||
|
vert_faces_images[vi] = img
|
||||||
|
|
||||||
|
|
||||||
|
# Now copy UVs across
|
||||||
|
for f in new_faces:
|
||||||
|
fi = [v.index for v in f.v]
|
||||||
|
f.image = vert_faces_images[fi[0]]
|
||||||
|
uv = f.uv
|
||||||
|
for i,vi in enumerate(fi):
|
||||||
|
uv[i][:] = vert_faces_uvs[vi]
|
||||||
|
|
||||||
|
if len(me.materials) > 1:
|
||||||
|
vert_faces_mats = [None] * len(me.verts)
|
||||||
|
for i,f in enumerate(orig_faces):
|
||||||
|
mat = f.mat
|
||||||
|
for i,v in enumerate(f.v):
|
||||||
|
vi = v.index
|
||||||
|
vert_faces_mats[vi] = mat
|
||||||
|
|
||||||
|
# Now copy UVs across
|
||||||
|
for f in new_faces:
|
||||||
|
print vert_faces_mats[f.v[0].index]
|
||||||
|
f.mat = vert_faces_mats[f.v[0].index]
|
||||||
|
|
||||||
|
|
||||||
|
me.verts.delete(grid_data_dict.keys())
|
||||||
|
|
||||||
|
# me.faces.delete(1, faces_remove)
|
||||||
|
|
||||||
|
if me.faceUV:
|
||||||
|
me.activeUVLayer = act_uvlay
|
||||||
|
|
||||||
|
me.calcNormals()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
# Gets the current scene, there can be many scenes in 1 blend file.
|
||||||
|
sce = bpy.data.scenes.active
|
||||||
|
|
||||||
|
# Get the active object, there can only ever be 1
|
||||||
|
# and the active object is always the editmode object.
|
||||||
|
ob_act = sce.objects.active
|
||||||
|
|
||||||
|
if not ob_act or ob_act.type != 'Mesh':
|
||||||
|
BPyMessages.Error_NoMeshActive()
|
||||||
|
return
|
||||||
|
|
||||||
|
is_editmode = Window.EditMode()
|
||||||
|
if is_editmode: Window.EditMode(0)
|
||||||
|
|
||||||
|
Window.WaitCursor(1)
|
||||||
|
me = ob_act.getData(mesh=1) # old NMesh api is default
|
||||||
|
t = sys.time()
|
||||||
|
|
||||||
|
# Run the mesh editing function
|
||||||
|
my_mesh_util(me)
|
||||||
|
|
||||||
|
# Restore editmode if it was enabled
|
||||||
|
if is_editmode: Window.EditMode(1)
|
||||||
|
|
||||||
|
# Timing the script is a good way to be aware on any speed hits when scripting
|
||||||
|
print 'My Script finished in %.2f seconds' % (sys.time()-t)
|
||||||
|
Window.WaitCursor(0)
|
||||||
|
|
||||||
|
|
||||||
|
# This lets you can import the script without running it
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@@ -13,7 +13,7 @@ from Blender import Mesh, Scene, Window, sys, Image, Draw
|
|||||||
import BPyMesh
|
import BPyMesh
|
||||||
|
|
||||||
__author__ = "Bruce Merry"
|
__author__ = "Bruce Merry"
|
||||||
__version__ = "0.92"
|
__version__ = "0.93"
|
||||||
__bpydoc__ = """\
|
__bpydoc__ = """\
|
||||||
This script exports Stanford PLY files from Blender. It supports normals,
|
This script exports Stanford PLY files from Blender. It supports normals,
|
||||||
colours, and texture coordinates per face or per vertex.
|
colours, and texture coordinates per face or per vertex.
|
||||||
@@ -37,6 +37,8 @@ Only one mesh can be exported at a time.
|
|||||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
# Vector rounding se we can use as keys
|
# Vector rounding se we can use as keys
|
||||||
#
|
#
|
||||||
|
# Updated on Aug 11, 2008 by Campbell Barton
|
||||||
|
# - added 'comment' prefix to comments - Needed to comply with the PLY spec.
|
||||||
#
|
#
|
||||||
# Updated on Jan 1, 2007 by Gabe Ghearing
|
# Updated on Jan 1, 2007 by Gabe Ghearing
|
||||||
# - fixed normals so they are correctly smooth/flat
|
# - fixed normals so they are correctly smooth/flat
|
||||||
@@ -162,7 +164,7 @@ def file_callback(filename):
|
|||||||
|
|
||||||
file.write('ply\n')
|
file.write('ply\n')
|
||||||
file.write('format ascii 1.0\n')
|
file.write('format ascii 1.0\n')
|
||||||
file.write('Created by Blender3D %s - www.blender.org, source file: %s\n' % (Blender.Get('version'), Blender.Get('filename').split('/')[-1].split('\\')[-1] ))
|
file.write('comment Created by Blender3D %s - www.blender.org, source file: %s\n' % (Blender.Get('version'), Blender.Get('filename').split('/')[-1].split('\\')[-1] ))
|
||||||
|
|
||||||
file.write('element vertex %d\n' % len(verts))
|
file.write('element vertex %d\n' % len(verts))
|
||||||
|
|
||||||
@@ -210,7 +212,6 @@ def file_callback(filename):
|
|||||||
if faceUV: uvcoord= rvec2d(uv[j])
|
if faceUV: uvcoord= rvec2d(uv[j])
|
||||||
elif vertexUV: uvcoord= rvec2d(v.uvco)
|
elif vertexUV: uvcoord= rvec2d(v.uvco)
|
||||||
if vertexColors: color= col[j].r, col[j].g, col[j].b
|
if vertexColors: color= col[j].r, col[j].g, col[j].b
|
||||||
co = v.co
|
|
||||||
|
|
||||||
file.write('%d ' % vdict[v.index][normal, uvcoord, color])
|
file.write('%d ' % vdict[v.index][normal, uvcoord, color])
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ __url__ = ("blender", "blenderartists.org",
|
|||||||
__version__ = "2007/04/27"
|
__version__ = "2007/04/27"
|
||||||
|
|
||||||
__bpydoc__ = """\
|
__bpydoc__ = """\
|
||||||
"DEFORM to RVK2" copies deform data (except EDGESPLIT,DECIMATE,SUBSURF,BOOLEAN,
|
"DEFORM to RVK2" copies deform data (except EDGESPLIT,DECIMATE,SUBSURF,BOOLEAN,
|
||||||
BUILD,MIRROR,ARRAY) of the active object to the RVK (relative vertex key) of
|
BUILD,MIRROR,ARRAY) of the active object to the RVK (relative vertex key) of
|
||||||
the other selected object.
|
the other selected object.
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ key.
|
|||||||
The new version of this scrit (Blender 2.43) manages the modifier changes.
|
The new version of this scrit (Blender 2.43) manages the modifier changes.
|
||||||
There are a lot of modifiers but only the ones which just deforms the shape
|
There are a lot of modifiers but only the ones which just deforms the shape
|
||||||
can be used : LATTICE, CURVE, WAVE, ARMATURE. You can unset these modifiers
|
can be used : LATTICE, CURVE, WAVE, ARMATURE. You can unset these modifiers
|
||||||
from the script.
|
from the script.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ the 3d View. If the active object has subsurf turned on and nonzero subdiv
|
|||||||
level, the script will ask if it should change that. Before copying data to
|
level, the script will ask if it should change that. Before copying data to
|
||||||
the rvk it will also ask whether it should replace or add a new vertex group.
|
the rvk it will also ask whether it should replace or add a new vertex group.
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
@@ -70,7 +70,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
"""
|
"""
|
||||||
# Copy the rvk (1, or armature, lattice, or
|
# Copy the rvk (1, or armature, lattice, or
|
||||||
# any mesh deformation except surface
|
# any mesh deformation except surface
|
||||||
@@ -83,7 +83,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||||||
# download the script :
|
# download the script :
|
||||||
# http://jmsoler.free.fr/util/blenderfile/py/rvk1_torvk2.py
|
# http://jmsoler.free.fr/util/blenderfile/py/rvk1_torvk2.py
|
||||||
# Communicate upon problems or errors:
|
# Communicate upon problems or errors:
|
||||||
# http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender
|
# http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# Page officielle :
|
# Page officielle :
|
||||||
# http://jmsoler.free.fr/util/blenderfile/py/rvk1_torvk2.py
|
# http://jmsoler.free.fr/util/blenderfile/py/rvk1_torvk2.py
|
||||||
@@ -101,22 +101,22 @@ def Value(t):
|
|||||||
exec "t=Modifier.Types.%s"%t
|
exec "t=Modifier.Types.%s"%t
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def deform2rvk():
|
def deform2rvk():
|
||||||
POSSMOD_list=['EDGESPLIT',
|
POSSMOD_list=['EDGESPLIT',
|
||||||
'DECIMATE',
|
'DECIMATE',
|
||||||
'SUBSURF',
|
'SUBSURF',
|
||||||
'BOOLEAN',
|
'BOOLEAN',
|
||||||
'BUILD',
|
'BUILD',
|
||||||
'MIRROR',
|
'MIRROR',
|
||||||
'ARRAY']
|
'ARRAY']
|
||||||
|
|
||||||
AUTHMOD_list=['LATTICE',
|
AUTHMOD_list=['LATTICE',
|
||||||
'CURVE',
|
'CURVE',
|
||||||
'WAVE',
|
'WAVE',
|
||||||
'ARMATURE']
|
'ARMATURE']
|
||||||
|
|
||||||
MODIFIERS=0
|
MODIFIERS=0
|
||||||
|
|
||||||
BMOD=[['Possible Modifiers'],
|
BMOD=[['Possible Modifiers'],
|
||||||
['Allowed Modifiers']]
|
['Allowed Modifiers']]
|
||||||
|
|
||||||
@@ -129,8 +129,8 @@ def deform2rvk():
|
|||||||
# =============================================================
|
# =============================================================
|
||||||
# must be 2 meshes ============================================
|
# must be 2 meshes ============================================
|
||||||
# =============================================================
|
# =============================================================
|
||||||
if RVK1.getType()=='Mesh' and RVK2.getType()=='Mesh':
|
if RVK1.getType()=='Mesh' and RVK2.getType()=='Mesh':
|
||||||
FRAME=Blender.Get('curframe')
|
FRAME=Blender.Get('curframe')
|
||||||
DATA2=RVK2.getData()
|
DATA2=RVK2.getData()
|
||||||
if DEBUG: print DATA2.getKey()
|
if DEBUG: print DATA2.getKey()
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -151,7 +151,7 @@ def deform2rvk():
|
|||||||
# === Bloc Menu Modifiers ===1 doc =================
|
# === Bloc Menu Modifiers ===1 doc =================
|
||||||
# ===================================================
|
# ===================================================
|
||||||
m=0
|
m=0
|
||||||
for mod in MODRVK1:
|
for mod in MODRVK1:
|
||||||
if DEBUG: print mod.type
|
if DEBUG: print mod.type
|
||||||
if mod.type in POSSMOD:
|
if mod.type in POSSMOD:
|
||||||
BMOD[0].append([Draw.Create(0),mod.type,
|
BMOD[0].append([Draw.Create(0),mod.type,
|
||||||
@@ -183,7 +183,7 @@ def deform2rvk():
|
|||||||
retval = Blender.Draw.PupBlock("MESH 2 RVK", block)
|
retval = Blender.Draw.PupBlock("MESH 2 RVK", block)
|
||||||
# ===================================================
|
# ===================================================
|
||||||
# === unset Modifiers =============================
|
# === unset Modifiers =============================
|
||||||
# ===================================================
|
# ===================================================
|
||||||
for B in BMOD[0][1:]:
|
for B in BMOD[0][1:]:
|
||||||
if DEBUG: print B[2]
|
if DEBUG: print B[2]
|
||||||
MODRVK1[B[2]][Modifier.Settings.RENDER]=0
|
MODRVK1[B[2]][Modifier.Settings.RENDER]=0
|
||||||
@@ -193,12 +193,12 @@ def deform2rvk():
|
|||||||
# ===================================================
|
# ===================================================
|
||||||
# === update Modifiers =============================
|
# === update Modifiers =============================
|
||||||
# ===================================================
|
# ===================================================
|
||||||
RVK1.makeDisplayList()
|
#RVK1.makeDisplayList()
|
||||||
# =======================================================
|
# =======================================================
|
||||||
# === get deformed mesh ================================
|
# === get deformed mesh ================================
|
||||||
# =======================================================
|
# =======================================================
|
||||||
RVK1NAME=Object.GetSelected()[0].getName()
|
RVK1NAME=Object.GetSelected()[0].getName()
|
||||||
meshrvk1=NMesh.GetRawFromObject(RVK1NAME)
|
meshrvk1=NMesh.GetRawFromObject(RVK1NAME)
|
||||||
if DEBUG: print len(meshrvk1.verts)
|
if DEBUG: print len(meshrvk1.verts)
|
||||||
# =======================================================
|
# =======================================================
|
||||||
# === get normal mesh for vertex group =================
|
# === get normal mesh for vertex group =================
|
||||||
@@ -209,18 +209,18 @@ def deform2rvk():
|
|||||||
# =======================================================
|
# =======================================================
|
||||||
DATA2=RVK2.getData()
|
DATA2=RVK2.getData()
|
||||||
if DEBUG: print len(meshrvk1.verts)
|
if DEBUG: print len(meshrvk1.verts)
|
||||||
if DEBUG: print len(DATA2.verts)
|
if DEBUG: print len(DATA2.verts)
|
||||||
# ========================================================
|
# ========================================================
|
||||||
# ===== is there the same number of vertices =============
|
# ===== is there the same number of vertices =============
|
||||||
# ========================================================
|
# ========================================================
|
||||||
if len(meshrvk1.verts)==len(DATA2.verts):
|
if len(meshrvk1.verts)==len(DATA2.verts):
|
||||||
name = "Do you want to replace or add vertex groups ? %t| YES %x1| NO ? %x2 "
|
name = "Do you want to replace or add vertex groups ? %t| YES %x1| NO ? %x2 "
|
||||||
result = Draw.PupMenu(name)
|
result = Draw.PupMenu(name)
|
||||||
if result==1:
|
if result==1:
|
||||||
# =====================================================
|
# =====================================================
|
||||||
# ===== Do we save vertex groups ? ===================
|
# ===== Do we save vertex groups ? ===================
|
||||||
# =====================================================
|
# =====================================================
|
||||||
GROUPNAME2=DATA2.getVertGroupNames()
|
GROUPNAME2=DATA2.getVertGroupNames()
|
||||||
if len(GROUPNAME2)!=0:
|
if len(GROUPNAME2)!=0:
|
||||||
for GROUP2 in GROUPNAME2:
|
for GROUP2 in GROUPNAME2:
|
||||||
DATA2.removeVertGroup(GROUP2)
|
DATA2.removeVertGroup(GROUP2)
|
||||||
@@ -233,11 +233,11 @@ def deform2rvk():
|
|||||||
# ===== now copy the vertices coords =====================
|
# ===== now copy the vertices coords =====================
|
||||||
# ========================================================
|
# ========================================================
|
||||||
for v in meshrvk1.verts:
|
for v in meshrvk1.verts:
|
||||||
i= meshrvk1.verts.index(v)
|
i= meshrvk1.verts.index(v)
|
||||||
v1=DATA2.verts[i]
|
v1=DATA2.verts[i]
|
||||||
for n in [0,1,2]:
|
for n in [0,1,2]:
|
||||||
v1.co[n]=v.co[n]
|
v1.co[n]=v.co[n]
|
||||||
DATA2.update()
|
DATA2.update()
|
||||||
DATA2.insertKey(FRAME,'relative')
|
DATA2.insertKey(FRAME,'relative')
|
||||||
DATA2.update()
|
DATA2.update()
|
||||||
RVK2.makeDisplayList()
|
RVK2.makeDisplayList()
|
||||||
@@ -251,23 +251,23 @@ def deform2rvk():
|
|||||||
if not B[1]:
|
if not B[1]:
|
||||||
MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2]
|
MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2]
|
||||||
else:
|
else:
|
||||||
name = "Meshes Objects must the same number of vertices %t| Ok. %x1"
|
name = "Meshes Objects must the same number of vertices %t| Ok. %x1"
|
||||||
result = Draw.PupMenu(name)
|
result = Draw.PupMenu(name)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
name = "Second Object must have at least a shape key %t| Ok. %x1"
|
name = "Second Object must have at least a shape key %t| Ok. %x1"
|
||||||
result = Draw.PupMenu(name)
|
result = Draw.PupMenu(name)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
name = "Object must be Meshes %t| Ok. %x1"
|
name = "Object must be Meshes %t| Ok. %x1"
|
||||||
result = Draw.PupMenu(name)
|
result = Draw.PupMenu(name)
|
||||||
return
|
return
|
||||||
else :
|
else :
|
||||||
name = "At least 2 Meshes as to be selected %t| Ok. %x1"
|
name = "At least 2 Meshes as to be selected %t| Ok. %x1"
|
||||||
result = Draw.PupMenu(name)
|
result = Draw.PupMenu(name)
|
||||||
return
|
return
|
||||||
Blender.Redraw()
|
Blender.Redraw()
|
||||||
EDITMODE=Blender.Window.EditMode()
|
EDITMODE=Blender.Window.EditMode()
|
||||||
Blender.Window.EditMode(0)
|
Blender.Window.EditMode(0)
|
||||||
deform2rvk()
|
deform2rvk()
|
||||||
Blender.Window.EditMode(EDITMODE)
|
Blender.Window.EditMode(EDITMODE)
|
@@ -1,104 +0,0 @@
|
|||||||
#!BPY
|
|
||||||
"""
|
|
||||||
Name: 'Camera/Object Example'
|
|
||||||
Blender: 245
|
|
||||||
Group: 'ScriptTemplate'
|
|
||||||
Tooltip: 'Script template for setting the camera direction'
|
|
||||||
"""
|
|
||||||
|
|
||||||
from Blender import Window
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
script_data = \
|
|
||||||
'''#!BPY
|
|
||||||
"""
|
|
||||||
Name: 'My Camera script'
|
|
||||||
Blender: 245
|
|
||||||
Group: 'Object'
|
|
||||||
Tooltip: 'Rotate the camera to center on the active object'
|
|
||||||
"""
|
|
||||||
|
|
||||||
import Blender
|
|
||||||
from Blender import Window, Scene, Draw, Mathutils
|
|
||||||
|
|
||||||
# Rotate the camera in such a way that it centers on the currently active object
|
|
||||||
def RotCamToOb(cam, ob):
|
|
||||||
|
|
||||||
# Get the camera matrix
|
|
||||||
camMat = cam.getMatrix('worldspace');
|
|
||||||
|
|
||||||
# Get the location of the camera and object and make sure they're vectors
|
|
||||||
camLoc = Mathutils.Vector(cam.loc)
|
|
||||||
obLoc = Mathutils.Vector(ob.loc)
|
|
||||||
|
|
||||||
# Get the vector (direction) from the camera to the object
|
|
||||||
newVec = obLoc - camLoc
|
|
||||||
|
|
||||||
# Make a quaternion that points the camera along the vector
|
|
||||||
newQuat = newVec.toTrackQuat('-z', 'y')
|
|
||||||
|
|
||||||
# Convert the new quaternion to a rotation matrix (and resize it to 4x4 so it matches the other matrices)
|
|
||||||
rotMat = newQuat.toMatrix().resize4x4()
|
|
||||||
|
|
||||||
# Make a matrix with only the current location of the camera
|
|
||||||
transMat = Mathutils.TranslationMatrix(camMat.translationPart());
|
|
||||||
|
|
||||||
# Multiply the rotation and translation matrixes to make 1 matrix with all data
|
|
||||||
newMat = rotMat * transMat
|
|
||||||
|
|
||||||
# Now we make this matrix the camera matrix and voila done!
|
|
||||||
cam.setMatrix(newMat)
|
|
||||||
|
|
||||||
#Make sure blender and the objects are in the right state and start doing stuff
|
|
||||||
def SceneCheck():
|
|
||||||
|
|
||||||
# Show a neat waitcursor whilst the script runs
|
|
||||||
Window.WaitCursor(1)
|
|
||||||
|
|
||||||
# If we are in edit mode, go out of edit mode and store the status in a var
|
|
||||||
emode = int(Window.EditMode())
|
|
||||||
if emode: Window.EditMode(0)
|
|
||||||
|
|
||||||
# Get the scene, the camera and the currently active object
|
|
||||||
scn = Scene.GetCurrent()
|
|
||||||
cam = scn.getCurrentCamera()
|
|
||||||
ob = scn.getActiveObject()
|
|
||||||
|
|
||||||
# Lets do some checks to make sure we have everything
|
|
||||||
# And if we don't then call a return which stops the entire script
|
|
||||||
if not cam:
|
|
||||||
Draw.PupMenu('Error, no active camera, aborting.')
|
|
||||||
return
|
|
||||||
|
|
||||||
if not ob:
|
|
||||||
Draw.PupMenu('Error, no active object, aborting.')
|
|
||||||
return
|
|
||||||
|
|
||||||
if cam == ob:
|
|
||||||
Draw.PupMenu('Error, select an object other than the camera, aborting.')
|
|
||||||
return
|
|
||||||
|
|
||||||
# Start the main function of the script if we didn't encounter any errors
|
|
||||||
RotCamToOb(cam, ob)
|
|
||||||
|
|
||||||
# Update the scene
|
|
||||||
scn.update()
|
|
||||||
|
|
||||||
# Redraw the 3d view so we can instantly see what was changed
|
|
||||||
Window.Redraw(Window.Types.VIEW3D)
|
|
||||||
|
|
||||||
# If we were in edit mode when the script started, go back into edit mode
|
|
||||||
if emode: Window.EditMode(1)
|
|
||||||
|
|
||||||
# Remove the waitcursor
|
|
||||||
Window.WaitCursor(0)
|
|
||||||
|
|
||||||
# Start the script
|
|
||||||
SceneCheck()
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
new_text = bpy.data.texts.new('camobject_template.py')
|
|
||||||
new_text.write(script_data)
|
|
||||||
bpy.data.texts.active = new_text
|
|
||||||
Window.RedrawAll()
|
|
@@ -1,92 +0,0 @@
|
|||||||
#!BPY
|
|
||||||
"""
|
|
||||||
Name: 'Camera/Object Example'
|
|
||||||
Blender: 245
|
|
||||||
Group: 'ScriptTemplate'
|
|
||||||
Tooltip: 'Script template for setting the camera direction'
|
|
||||||
"""
|
|
||||||
|
|
||||||
from Blender import Window
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
script_data = \
|
|
||||||
'''#!BPY
|
|
||||||
"""
|
|
||||||
Name: 'My Ipo Script'
|
|
||||||
Blender: 245
|
|
||||||
Group: 'Animation'
|
|
||||||
Tooltip: 'Put some useful info here'
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Add a licence here if you wish to re-distribute, we recommend the GPL
|
|
||||||
|
|
||||||
from Blender import Ipo, Mathutils, Window
|
|
||||||
import bpy, BPyMessages
|
|
||||||
|
|
||||||
def makeRandomIpo(object, firstFrame, numberOfFrames, frameStep):
|
|
||||||
# Create an new Ipo Curve of name myIpo and type Object
|
|
||||||
myIpo = bpy.data.ipos.new('myIpo', 'Object')
|
|
||||||
|
|
||||||
# Create LocX, LocY, and LocZ Ipo curves in our new Curve Object
|
|
||||||
# and store them so we can access them later
|
|
||||||
myIpo_x = myIpo.addCurve('LocX')
|
|
||||||
myIpo_y = myIpo.addCurve('LocY')
|
|
||||||
myIpo_z = myIpo.addCurve('LocZ')
|
|
||||||
|
|
||||||
# What value we want to scale our random value by
|
|
||||||
ipoScale = 4
|
|
||||||
|
|
||||||
# This Calculates the End Frame for use in an xrange() expression
|
|
||||||
endFrame = firstFrame + (numberOfFrames * frameStep) + frameStep
|
|
||||||
|
|
||||||
for frame in xrange(firstFrame, endFrame, frameStep):
|
|
||||||
|
|
||||||
# Use the Mathutils Rand() function to get random numbers
|
|
||||||
ipoValue_x = Mathutils.Rand(-1, 1) * ipoScale
|
|
||||||
ipoValue_y = Mathutils.Rand(-1, 1) * ipoScale
|
|
||||||
ipoValue_z = Mathutils.Rand(-1, 1) * ipoScale
|
|
||||||
|
|
||||||
# Append to the Ipo curve at location frame, with the value ipoValue_x
|
|
||||||
# Note that we should pass the append function a tuple or a BezTriple
|
|
||||||
myIpo_x.append((frame, ipoValue_x))
|
|
||||||
|
|
||||||
# Similar to above
|
|
||||||
myIpo_y.append((frame, ipoValue_y))
|
|
||||||
myIpo_z.append((frame, ipoValue_z))
|
|
||||||
|
|
||||||
# Link our new Ipo Curve to the passed object
|
|
||||||
object.setIpo(myIpo)
|
|
||||||
print object
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
# Get the active scene, since there can be multiple ones
|
|
||||||
sce = bpy.data.scenes.active
|
|
||||||
|
|
||||||
# Get the active object
|
|
||||||
object = sce.objects.active
|
|
||||||
|
|
||||||
# If there is no active object, pop up an error message
|
|
||||||
if not object:
|
|
||||||
BPyMessages.Error_NoActive()
|
|
||||||
|
|
||||||
Window.WaitCursor(1)
|
|
||||||
|
|
||||||
# Call our makeRandomIpo function
|
|
||||||
# Pass it our object, Tell it to keys from the start frame until the end frame, at a step of 10 frames
|
|
||||||
# between them
|
|
||||||
|
|
||||||
makeRandomIpo(object, sce.render.sFrame, sce.render.eFrame, 10)
|
|
||||||
|
|
||||||
Window.WaitCursor(0)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
new_text = bpy.data.texts.new('ipo_template.py')
|
|
||||||
new_text.write(script_data)
|
|
||||||
bpy.data.texts.active = new_text
|
|
||||||
Window.RedrawAll()
|
|
@@ -1,76 +0,0 @@
|
|||||||
#!BPY
|
|
||||||
"""
|
|
||||||
Name: 'Metaball Generation'
|
|
||||||
Blender: 245
|
|
||||||
Group: 'ScriptTemplate'
|
|
||||||
Tooltip: 'Script template to make metaballs from a mesh'
|
|
||||||
"""
|
|
||||||
|
|
||||||
from Blender import Window
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
script_data = \
|
|
||||||
'''#!BPY
|
|
||||||
"""
|
|
||||||
Name: 'My Metaball Script'
|
|
||||||
Blender: 245
|
|
||||||
Group: 'Misc'
|
|
||||||
Tooltip: 'Put some useful info here'
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Add a license here if you wish to re-disribute, we recommend the GPL
|
|
||||||
|
|
||||||
from Blender import Metaball, Mesh, Window
|
|
||||||
import bpy
|
|
||||||
|
|
||||||
def makeMetaSculpture(sce):
|
|
||||||
#Create a base mesh for our sculpture to use
|
|
||||||
monkey = Mesh.Primitives.Monkey()
|
|
||||||
|
|
||||||
#Create a new meta datablock to use and give it a name
|
|
||||||
metaObj = Metaball.New()
|
|
||||||
metaObj.name = "MetaSuzanne"
|
|
||||||
|
|
||||||
#Increase the resolution so it looks better
|
|
||||||
metaObj.wiresize = 0.2
|
|
||||||
metaObj.rendersize = 0.1
|
|
||||||
|
|
||||||
#The radius for our new meta objects to take
|
|
||||||
metaRadius = 2.0
|
|
||||||
|
|
||||||
for f in monkey.faces:
|
|
||||||
|
|
||||||
#Create a new metaball as part of the Meta Object Data
|
|
||||||
newBall = metaObj.elements.add()
|
|
||||||
|
|
||||||
#Make the new ball have the same coordinates as a vertex on our Mesh
|
|
||||||
newBall.co = f.cent
|
|
||||||
|
|
||||||
#Assign the same radius to all balls
|
|
||||||
newBall.radius = f.area * metaRadius
|
|
||||||
|
|
||||||
#Create the new object and put our meta data there
|
|
||||||
sce.objects.new(metaObj, "MetaSuzanne")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
scene = bpy.data.scenes.active #Get the active scene
|
|
||||||
|
|
||||||
Window.WaitCursor(1)
|
|
||||||
|
|
||||||
#Call the sculpture making function
|
|
||||||
makeMetaSculpture(scene)
|
|
||||||
|
|
||||||
Window.WaitCursor(0)
|
|
||||||
|
|
||||||
#Redraw the Screen When Finished
|
|
||||||
Window.RedrawAll(1)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
'''
|
|
||||||
|
|
||||||
new_text = bpy.data.texts.new('metaball_template.py')
|
|
||||||
new_text.write(script_data)
|
|
||||||
bpy.data.texts.active = new_text
|
|
||||||
Window.RedrawAll()
|
|
69
release/scripts/scripttemplate_text_plugin.py
Normal file
69
release/scripts/scripttemplate_text_plugin.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Text Plugin'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'ScriptTemplate'
|
||||||
|
Tooltip: 'Add a new text for writing a text plugin'
|
||||||
|
"""
|
||||||
|
|
||||||
|
from Blender import Window
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
script_data = \
|
||||||
|
'''#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'My Plugin Script'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'TextPlugin'
|
||||||
|
Shortcut: 'Ctrl+Alt+U'
|
||||||
|
Tooltip: 'Put some useful info here'
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Add a licence here if you wish to re-distribute, we recommend the GPL
|
||||||
|
|
||||||
|
from Blender import Window, sys
|
||||||
|
import BPyTextPlugin, bpy
|
||||||
|
|
||||||
|
def my_script_util(txt):
|
||||||
|
# This function prints out statistical information about a script
|
||||||
|
|
||||||
|
desc = BPyTextPlugin.get_cached_descriptor(txt)
|
||||||
|
print '---------------------------------------'
|
||||||
|
print 'Script Name:', desc.name
|
||||||
|
print 'Classes:', len(desc.classes)
|
||||||
|
print ' ', desc.classes.keys()
|
||||||
|
print 'Functions:', len(desc.defs)
|
||||||
|
print ' ', desc.defs.keys()
|
||||||
|
print 'Variables:', len(desc.vars)
|
||||||
|
print ' ', desc.vars.keys()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
# Gets the active text object, there can be many in one blend file.
|
||||||
|
txt = bpy.data.texts.active
|
||||||
|
|
||||||
|
# Silently return if the script has been run with no active text
|
||||||
|
if not txt:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Text plug-ins should run quickly so we time it here
|
||||||
|
Window.WaitCursor(1)
|
||||||
|
t = sys.time()
|
||||||
|
|
||||||
|
# Run our utility function
|
||||||
|
my_script_util(txt)
|
||||||
|
|
||||||
|
# Timing the script is a good way to be aware on any speed hits when scripting
|
||||||
|
print 'Plugin script finished in %.2f seconds' % (sys.time()-t)
|
||||||
|
Window.WaitCursor(0)
|
||||||
|
|
||||||
|
|
||||||
|
# This lets you import the script without running it
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
'''
|
||||||
|
|
||||||
|
new_text = bpy.data.texts.new('textplugin_template.py')
|
||||||
|
new_text.write(script_data)
|
||||||
|
bpy.data.texts.active = new_text
|
||||||
|
Window.RedrawAll()
|
@@ -94,6 +94,8 @@ output = Blender.Text.New(output_filename)
|
|||||||
|
|
||||||
output.write(header + "\n\n")
|
output.write(header + "\n\n")
|
||||||
|
|
||||||
|
output.write("%s\n\n" % Blender.Get('buildinfo'))
|
||||||
|
|
||||||
output.write("Platform: %s\n========\n\n" % sys.platform)
|
output.write("Platform: %s\n========\n\n" % sys.platform)
|
||||||
|
|
||||||
output.write("Python:\n======\n\n")
|
output.write("Python:\n======\n\n")
|
||||||
|
64
release/scripts/textplugin_functiondocs.py
Normal file
64
release/scripts/textplugin_functiondocs.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Function Documentation | Ctrl I'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'TextPlugin'
|
||||||
|
Shortcut: 'Ctrl+I'
|
||||||
|
Tooltip: 'Attempts to display documentation about the function preceding the cursor.'
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Only run if we have the required modules
|
||||||
|
try:
|
||||||
|
import bpy
|
||||||
|
from BPyTextPlugin import *
|
||||||
|
except ImportError:
|
||||||
|
OK = False
|
||||||
|
else:
|
||||||
|
OK = True
|
||||||
|
|
||||||
|
def main():
|
||||||
|
txt = bpy.data.texts.active
|
||||||
|
if not txt:
|
||||||
|
return
|
||||||
|
|
||||||
|
(line, c) = current_line(txt)
|
||||||
|
|
||||||
|
# Check we are in a normal context
|
||||||
|
if get_context(txt) != CTX_NORMAL:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Identify the name under the cursor
|
||||||
|
llen = len(line)
|
||||||
|
while c<llen and (line[c].isalnum() or line[c]=='_'):
|
||||||
|
c += 1
|
||||||
|
|
||||||
|
targets = get_targets(line, c)
|
||||||
|
|
||||||
|
# If no name under cursor, look backward to see if we're in function parens
|
||||||
|
if len(targets) == 0 or targets[0] == '':
|
||||||
|
# Look backwards for first '(' without ')'
|
||||||
|
b = 0
|
||||||
|
found = False
|
||||||
|
for i in range(c-1, -1, -1):
|
||||||
|
if line[i] == ')': b += 1
|
||||||
|
elif line[i] == '(':
|
||||||
|
b -= 1
|
||||||
|
if b < 0:
|
||||||
|
found = True
|
||||||
|
c = i
|
||||||
|
break
|
||||||
|
if found: targets = get_targets(line, c)
|
||||||
|
if len(targets) == 0 or targets[0] == '':
|
||||||
|
return
|
||||||
|
|
||||||
|
obj = resolve_targets(txt, targets)
|
||||||
|
if not obj: return
|
||||||
|
|
||||||
|
if isinstance(obj, Definition): # Local definition
|
||||||
|
txt.showDocs(obj.doc)
|
||||||
|
elif hasattr(obj, '__doc__') and obj.__doc__:
|
||||||
|
txt.showDocs(obj.__doc__)
|
||||||
|
|
||||||
|
# Check we are running as a script and not imported as a module
|
||||||
|
if __name__ == "__main__" and OK:
|
||||||
|
main()
|
91
release/scripts/textplugin_imports.py
Normal file
91
release/scripts/textplugin_imports.py
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Import Complete|Space'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'TextPlugin'
|
||||||
|
Shortcut: 'Space'
|
||||||
|
Tooltip: 'Lists modules when import or from is typed'
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Only run if we have the required modules
|
||||||
|
try:
|
||||||
|
import bpy, sys
|
||||||
|
from BPyTextPlugin import *
|
||||||
|
except ImportError:
|
||||||
|
OK = False
|
||||||
|
else:
|
||||||
|
OK = True
|
||||||
|
|
||||||
|
def main():
|
||||||
|
txt = bpy.data.texts.active
|
||||||
|
if not txt:
|
||||||
|
return
|
||||||
|
|
||||||
|
line, c = current_line(txt)
|
||||||
|
|
||||||
|
# Check we are in a normal context
|
||||||
|
if get_context(txt) != CTX_NORMAL:
|
||||||
|
return
|
||||||
|
|
||||||
|
pos = line.rfind('from ', 0, c)
|
||||||
|
|
||||||
|
# No 'from' found
|
||||||
|
if pos == -1:
|
||||||
|
# Check instead for straight 'import xxxx'
|
||||||
|
pos2 = line.rfind('import ', 0, c)
|
||||||
|
if pos2 != -1:
|
||||||
|
pos2 += 7
|
||||||
|
for i in range(pos2, c):
|
||||||
|
if line[i]==',' or (line[i]==' ' and line[i-1]==','):
|
||||||
|
pos2 = i+1
|
||||||
|
elif not line[i].isalnum() and line[i] != '_':
|
||||||
|
return
|
||||||
|
items = [(m, 'm') for m in get_modules()]
|
||||||
|
items.sort(cmp = suggest_cmp)
|
||||||
|
txt.suggest(items, line[pos2:c].strip())
|
||||||
|
return
|
||||||
|
|
||||||
|
# Found 'from xxxxx' before cursor
|
||||||
|
immediate = True
|
||||||
|
pos += 5
|
||||||
|
for i in range(pos, c):
|
||||||
|
if not line[i].isalnum() and line[i] != '_' and line[i] != '.':
|
||||||
|
immediate = False
|
||||||
|
break
|
||||||
|
|
||||||
|
# Immediate 'from' followed by at most a module name
|
||||||
|
if immediate:
|
||||||
|
items = [(m, 'm') for m in get_modules()]
|
||||||
|
items.sort(cmp = suggest_cmp)
|
||||||
|
txt.suggest(items, line[pos:c])
|
||||||
|
return
|
||||||
|
|
||||||
|
# Found 'from' earlier, suggest import if not already there
|
||||||
|
pos2 = line.rfind('import ', pos, c)
|
||||||
|
|
||||||
|
# No 'import' found after 'from' so suggest it
|
||||||
|
if pos2 == -1:
|
||||||
|
txt.suggest([('import', 'k')], '')
|
||||||
|
return
|
||||||
|
|
||||||
|
# Immediate 'import' before cursor and after 'from...'
|
||||||
|
for i in range(pos2+7, c):
|
||||||
|
if line[i]==',' or (line[i]==' ' and line[i-1]==','):
|
||||||
|
pass
|
||||||
|
elif not line[i].isalnum() and line[i] != '_':
|
||||||
|
return
|
||||||
|
between = line[pos:pos2-1].strip()
|
||||||
|
try:
|
||||||
|
mod = get_module(between)
|
||||||
|
except ImportError:
|
||||||
|
return
|
||||||
|
|
||||||
|
items = [('*', 'k')]
|
||||||
|
for (k,v) in mod.__dict__.items():
|
||||||
|
items.append((k, type_char(v)))
|
||||||
|
items.sort(cmp = suggest_cmp)
|
||||||
|
txt.suggest(items, '')
|
||||||
|
|
||||||
|
# Check we are running as a script and not imported as a module
|
||||||
|
if __name__ == "__main__" and OK:
|
||||||
|
main()
|
90
release/scripts/textplugin_membersuggest.py
Normal file
90
release/scripts/textplugin_membersuggest.py
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Member Suggest | .'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'TextPlugin'
|
||||||
|
Shortcut: 'Period'
|
||||||
|
Tooltip: 'Lists members of the object preceding the cursor in the current text space'
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Only run if we have the required modules
|
||||||
|
try:
|
||||||
|
import bpy
|
||||||
|
from BPyTextPlugin import *
|
||||||
|
except ImportError:
|
||||||
|
OK = False
|
||||||
|
else:
|
||||||
|
OK = True
|
||||||
|
|
||||||
|
def main():
|
||||||
|
txt = bpy.data.texts.active
|
||||||
|
if not txt:
|
||||||
|
return
|
||||||
|
|
||||||
|
(line, c) = current_line(txt)
|
||||||
|
|
||||||
|
# Check we are in a normal context
|
||||||
|
if get_context(txt) != CTX_NORMAL:
|
||||||
|
return
|
||||||
|
|
||||||
|
targets = get_targets(line, c)
|
||||||
|
|
||||||
|
if targets[0] == '': # Check if we are looking at a constant [] {} '' etc.
|
||||||
|
i = c - len('.'.join(targets)) - 1
|
||||||
|
if i >= 0:
|
||||||
|
if line[i] == '"' or line[i] == "'":
|
||||||
|
targets[0] = 'str'
|
||||||
|
elif line[i] == '}':
|
||||||
|
targets[0] = 'dict'
|
||||||
|
elif line[i] == ']': # Could be array elem x[y] or list [y]
|
||||||
|
i = line.rfind('[', 0, i) - 1
|
||||||
|
while i >= 0:
|
||||||
|
if line[i].isalnum() or line[i] == '_':
|
||||||
|
break
|
||||||
|
elif line[i] != ' ' and line[i] != '\t':
|
||||||
|
i = -1
|
||||||
|
break
|
||||||
|
i -= 1
|
||||||
|
if i < 0:
|
||||||
|
targets[0] = 'list'
|
||||||
|
|
||||||
|
obj = resolve_targets(txt, targets[:-1])
|
||||||
|
if not obj:
|
||||||
|
return
|
||||||
|
|
||||||
|
items = []
|
||||||
|
|
||||||
|
if isinstance(obj, VarDesc):
|
||||||
|
obj = obj.type
|
||||||
|
|
||||||
|
if isinstance(obj, Definition): # Locally defined
|
||||||
|
if hasattr(obj, 'classes'):
|
||||||
|
items.extend([(s, 'f') for s in obj.classes.keys()])
|
||||||
|
if hasattr(obj, 'defs'):
|
||||||
|
items.extend([(s, 'f') for s in obj.defs.keys()])
|
||||||
|
if hasattr(obj, 'vars'):
|
||||||
|
items.extend([(s, 'v') for s in obj.vars.keys()])
|
||||||
|
|
||||||
|
else: # Otherwise we have an imported or builtin object
|
||||||
|
try:
|
||||||
|
attr = obj.__dict__.keys()
|
||||||
|
except AttributeError:
|
||||||
|
attr = dir(obj)
|
||||||
|
else:
|
||||||
|
if not attr: attr = dir(obj)
|
||||||
|
|
||||||
|
for k in attr:
|
||||||
|
try:
|
||||||
|
v = getattr(obj, k)
|
||||||
|
except (AttributeError, TypeError): # Some attributes are not readable
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
items.append((k, type_char(v)))
|
||||||
|
|
||||||
|
if items != []:
|
||||||
|
items.sort(cmp = suggest_cmp)
|
||||||
|
txt.suggest(items, targets[-1])
|
||||||
|
|
||||||
|
# Check we are running as a script and not imported as a module
|
||||||
|
if __name__ == "__main__" and OK:
|
||||||
|
main()
|
142
release/scripts/textplugin_outliner.py
Normal file
142
release/scripts/textplugin_outliner.py
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Code Outline | Ctrl T'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'TextPlugin'
|
||||||
|
Shortcut: 'Ctrl+T'
|
||||||
|
Tooltip: 'Provides a menu for jumping to class and functions definitions.'
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Only run if we have the required modules
|
||||||
|
try:
|
||||||
|
import bpy
|
||||||
|
from BPyTextPlugin import *
|
||||||
|
from Blender import Draw
|
||||||
|
except ImportError:
|
||||||
|
OK = False
|
||||||
|
else:
|
||||||
|
OK = True
|
||||||
|
|
||||||
|
def make_menu(items, eventoffs):
|
||||||
|
n = len(items)
|
||||||
|
if n < 20:
|
||||||
|
return [(items[i], i+1+eventoffs) for i in range(len(items))]
|
||||||
|
|
||||||
|
letters = []
|
||||||
|
check = 'abcdefghijklmnopqrstuvwxyz_' # Names cannot start 0-9
|
||||||
|
for c in check:
|
||||||
|
for item in items:
|
||||||
|
if item[0].lower() == c:
|
||||||
|
letters.append(c)
|
||||||
|
break
|
||||||
|
|
||||||
|
entries = {}
|
||||||
|
i = 0
|
||||||
|
for item in items:
|
||||||
|
i += 1
|
||||||
|
c = item[0].lower()
|
||||||
|
entries.setdefault(c, []).append((item, i+eventoffs))
|
||||||
|
|
||||||
|
subs = []
|
||||||
|
for c in letters:
|
||||||
|
subs.append((c, entries[c]))
|
||||||
|
|
||||||
|
return subs
|
||||||
|
|
||||||
|
def find_word(txt, word):
|
||||||
|
i = 0
|
||||||
|
txt.reset()
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
line = txt.readline()
|
||||||
|
except StopIteration:
|
||||||
|
break
|
||||||
|
c = line.find(word)
|
||||||
|
if c != -1:
|
||||||
|
txt.setCursorPos(i, c)
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
def main():
|
||||||
|
txt = bpy.data.texts.active
|
||||||
|
if not txt:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Identify word under cursor
|
||||||
|
if get_context(txt) == CTX_NORMAL:
|
||||||
|
line, c = current_line(txt)
|
||||||
|
start = c-1
|
||||||
|
end = c
|
||||||
|
while start >= 0:
|
||||||
|
if not line[start].lower() in 'abcdefghijklmnopqrstuvwxyz0123456789_':
|
||||||
|
break
|
||||||
|
start -= 1
|
||||||
|
while end < len(line):
|
||||||
|
if not line[end].lower() in 'abcdefghijklmnopqrstuvwxyz0123456789_':
|
||||||
|
break
|
||||||
|
end += 1
|
||||||
|
word = line[start+1:end]
|
||||||
|
if word in KEYWORDS:
|
||||||
|
word = None
|
||||||
|
else:
|
||||||
|
word = None
|
||||||
|
|
||||||
|
script = get_cached_descriptor(txt)
|
||||||
|
items = []
|
||||||
|
desc = None
|
||||||
|
|
||||||
|
tmp = script.classes.keys()
|
||||||
|
tmp.sort(cmp = suggest_cmp)
|
||||||
|
class_menu = make_menu(tmp, len(items))
|
||||||
|
class_menu_length = len(tmp)
|
||||||
|
items.extend(tmp)
|
||||||
|
|
||||||
|
tmp = script.defs.keys()
|
||||||
|
tmp.sort(cmp = suggest_cmp)
|
||||||
|
defs_menu = make_menu(tmp, len(items))
|
||||||
|
defs_menu_length = len(tmp)
|
||||||
|
items.extend(tmp)
|
||||||
|
|
||||||
|
tmp = script.vars.keys()
|
||||||
|
tmp.sort(cmp = suggest_cmp)
|
||||||
|
vars_menu = make_menu(tmp, len(items))
|
||||||
|
vars_menu_length = len(tmp)
|
||||||
|
items.extend(tmp)
|
||||||
|
|
||||||
|
menu = [('Script %t', 0),
|
||||||
|
('Classes', class_menu),
|
||||||
|
('Functions', defs_menu),
|
||||||
|
('Variables', vars_menu)]
|
||||||
|
if word:
|
||||||
|
menu.extend([None, ('Locate', [(word, -10)])])
|
||||||
|
|
||||||
|
i = Draw.PupTreeMenu(menu)
|
||||||
|
if i == -1:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Chosen to search for word under cursor
|
||||||
|
if i == -10:
|
||||||
|
if script.classes.has_key(word):
|
||||||
|
desc = script.classes[word]
|
||||||
|
elif script.defs.has_key(word):
|
||||||
|
desc = script.defs[word]
|
||||||
|
elif script.vars.has_key(word):
|
||||||
|
desc = script.vars[word]
|
||||||
|
else:
|
||||||
|
find_word(txt, word)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
i -= 1
|
||||||
|
if i < class_menu_length:
|
||||||
|
desc = script.classes[items[i]]
|
||||||
|
elif i < class_menu_length + defs_menu_length:
|
||||||
|
desc = script.defs[items[i]]
|
||||||
|
elif i < class_menu_length + defs_menu_length + vars_menu_length:
|
||||||
|
desc = script.vars[items[i]]
|
||||||
|
|
||||||
|
if desc:
|
||||||
|
txt.setCursorPos(desc.lineno-1, 0)
|
||||||
|
|
||||||
|
# Check we are running as a script and not imported as a module
|
||||||
|
if __name__ == "__main__" and OK:
|
||||||
|
main()
|
94
release/scripts/textplugin_suggest.py
Normal file
94
release/scripts/textplugin_suggest.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Suggest All | Ctrl Space'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'TextPlugin'
|
||||||
|
Shortcut: 'Ctrl+Space'
|
||||||
|
Tooltip: 'Performs suggestions based on the context of the cursor'
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Only run if we have the required modules
|
||||||
|
try:
|
||||||
|
import bpy
|
||||||
|
from BPyTextPlugin import *
|
||||||
|
except ImportError:
|
||||||
|
OK = False
|
||||||
|
else:
|
||||||
|
OK = True
|
||||||
|
|
||||||
|
def check_membersuggest(line, c):
|
||||||
|
pos = line.rfind('.', 0, c)
|
||||||
|
if pos == -1:
|
||||||
|
return False
|
||||||
|
for s in line[pos+1:c]:
|
||||||
|
if not s.isalnum() and s != '_':
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def check_imports(line, c):
|
||||||
|
pos = line.rfind('import ', 0, c)
|
||||||
|
if pos > -1:
|
||||||
|
for s in line[pos+7:c]:
|
||||||
|
if not s.isalnum() and s != '_':
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
pos = line.rfind('from ', 0, c)
|
||||||
|
if pos > -1:
|
||||||
|
for s in line[pos+5:c]:
|
||||||
|
if not s.isalnum() and s != '_':
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def main():
|
||||||
|
txt = bpy.data.texts.active
|
||||||
|
if not txt:
|
||||||
|
return
|
||||||
|
|
||||||
|
line, c = current_line(txt)
|
||||||
|
|
||||||
|
# Check we are in a normal context
|
||||||
|
if get_context(txt) != CTX_NORMAL:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Check the character preceding the cursor and execute the corresponding script
|
||||||
|
|
||||||
|
if check_membersuggest(line, c):
|
||||||
|
import textplugin_membersuggest
|
||||||
|
textplugin_membersuggest.main()
|
||||||
|
return
|
||||||
|
|
||||||
|
elif check_imports(line, c):
|
||||||
|
import textplugin_imports
|
||||||
|
textplugin_imports.main()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Otherwise we suggest globals, keywords, etc.
|
||||||
|
list = []
|
||||||
|
targets = get_targets(line, c)
|
||||||
|
desc = get_cached_descriptor(txt)
|
||||||
|
|
||||||
|
for k in KEYWORDS:
|
||||||
|
list.append((k, 'k'))
|
||||||
|
|
||||||
|
for k, v in get_builtins().items():
|
||||||
|
list.append((k, type_char(v)))
|
||||||
|
|
||||||
|
for k, v in desc.imports.items():
|
||||||
|
list.append((k, type_char(v)))
|
||||||
|
|
||||||
|
for k, v in desc.classes.items():
|
||||||
|
list.append((k, 'f'))
|
||||||
|
|
||||||
|
for k, v in desc.defs.items():
|
||||||
|
list.append((k, 'f'))
|
||||||
|
|
||||||
|
for k, v in desc.vars.items():
|
||||||
|
list.append((k, 'v'))
|
||||||
|
|
||||||
|
list.sort(cmp = suggest_cmp)
|
||||||
|
txt.suggest(list, targets[-1])
|
||||||
|
|
||||||
|
# Check we are running as a script and not imported as a module
|
||||||
|
if __name__ == "__main__" and OK:
|
||||||
|
main()
|
123
release/scripts/textplugin_templates.py
Normal file
123
release/scripts/textplugin_templates.py
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
#!BPY
|
||||||
|
"""
|
||||||
|
Name: 'Template Completion | Tab'
|
||||||
|
Blender: 246
|
||||||
|
Group: 'TextPlugin'
|
||||||
|
Shortcut: 'Tab'
|
||||||
|
Tooltip: 'Completes templates based on the text preceding the cursor'
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Only run if we have the required modules
|
||||||
|
try:
|
||||||
|
import bpy
|
||||||
|
from BPyTextPlugin import *
|
||||||
|
from Blender import Text
|
||||||
|
except ImportError:
|
||||||
|
OK = False
|
||||||
|
else:
|
||||||
|
OK = True
|
||||||
|
|
||||||
|
templates = {
|
||||||
|
'ie':
|
||||||
|
'if ${1:cond}:\n'
|
||||||
|
'\t${2}\n'
|
||||||
|
'else:\n'
|
||||||
|
'\t${3}\n',
|
||||||
|
'iei':
|
||||||
|
'if ${1:cond}:\n'
|
||||||
|
'\t${2}\n'
|
||||||
|
'elif:\n'
|
||||||
|
'\t${3}\n'
|
||||||
|
'else:\n'
|
||||||
|
'\t${4}\n',
|
||||||
|
'def':
|
||||||
|
'def ${1:name}(${2:params}):\n'
|
||||||
|
'\t"""(${2}) - ${3:comment}"""\n'
|
||||||
|
'\t${4}',
|
||||||
|
'cls':
|
||||||
|
'class ${1:name}(${2:parent}):\n'
|
||||||
|
'\t"""${3:docs}"""\n'
|
||||||
|
'\t\n'
|
||||||
|
'\tdef __init__(self, ${4:params}):\n'
|
||||||
|
'\t\t"""Creates a new ${1}"""\n'
|
||||||
|
'\t\t${5}',
|
||||||
|
'class':
|
||||||
|
'class ${1:name}(${2:parent}):\n'
|
||||||
|
'\t"""${3:docs}"""\n'
|
||||||
|
'\t\n'
|
||||||
|
'\tdef __init__(self, ${4:params}):\n'
|
||||||
|
'\t\t"""Creates a new ${1}"""\n'
|
||||||
|
'\t\t${5}'
|
||||||
|
}
|
||||||
|
|
||||||
|
def main():
|
||||||
|
txt = bpy.data.texts.active
|
||||||
|
if not txt:
|
||||||
|
return
|
||||||
|
|
||||||
|
row, c = txt.getCursorPos()
|
||||||
|
line = txt.asLines(row, row+1)[0]
|
||||||
|
indent=0
|
||||||
|
while indent<c and (line[indent]==' ' or line[indent]=='\t'):
|
||||||
|
indent += 1
|
||||||
|
|
||||||
|
# Check we are in a normal context
|
||||||
|
if get_context(txt) != CTX_NORMAL:
|
||||||
|
return
|
||||||
|
|
||||||
|
targets = get_targets(line, c-1);
|
||||||
|
if len(targets) != 1: return
|
||||||
|
|
||||||
|
color = (0, 192, 32)
|
||||||
|
|
||||||
|
for trigger, template in templates.items():
|
||||||
|
if trigger != targets[0]: continue
|
||||||
|
inserts = {}
|
||||||
|
txt.delete(-len(trigger)-1)
|
||||||
|
y, x = txt.getCursorPos()
|
||||||
|
first = None
|
||||||
|
|
||||||
|
# Insert template text and parse for insertion points
|
||||||
|
count = len(template); i = 0
|
||||||
|
while i < count:
|
||||||
|
if i<count-1 and template[i]=='$' and template[i+1]=='{':
|
||||||
|
i += 2
|
||||||
|
e = template.find('}', i)
|
||||||
|
item = template[i:e].split(':')
|
||||||
|
if len(item)<2: item.append('')
|
||||||
|
if not inserts.has_key(item[0]):
|
||||||
|
inserts[item[0]] = (item[1], [(x, y)])
|
||||||
|
else:
|
||||||
|
inserts[item[0]][1].append((x, y))
|
||||||
|
item[1] = inserts[item[0]][0]
|
||||||
|
if not first: first = (item[1], x, y)
|
||||||
|
txt.insert(item[1])
|
||||||
|
x += len(item[1])
|
||||||
|
i = e
|
||||||
|
else:
|
||||||
|
txt.insert(template[i])
|
||||||
|
if template[i] == '\n':
|
||||||
|
txt.insert(line[:indent])
|
||||||
|
y += 1
|
||||||
|
x = indent
|
||||||
|
else:
|
||||||
|
x += 1
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
# Insert markers at insertion points
|
||||||
|
for id, (text, points) in inserts.items():
|
||||||
|
for x, y in points:
|
||||||
|
txt.setCursorPos(y, x)
|
||||||
|
txt.setSelectPos(y, x+len(text))
|
||||||
|
txt.markSelection((hash(text)+int(id)) & 0xFFFF, color,
|
||||||
|
Text.TMARK_TEMP | Text.TMARK_EDITALL)
|
||||||
|
if first:
|
||||||
|
text, x, y = first
|
||||||
|
txt.setCursorPos(y, x)
|
||||||
|
txt.setSelectPos(y, x+len(text))
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
# Check we are running as a script and not imported as a module
|
||||||
|
if __name__ == "__main__" and OK:
|
||||||
|
main()
|
@@ -48,13 +48,14 @@ def AngleBetweenVecs(a1,a2):
|
|||||||
return 180.0
|
return 180.0
|
||||||
|
|
||||||
class prettyface(object):
|
class prettyface(object):
|
||||||
__slots__ = 'uv', 'width', 'height', 'children', 'xoff', 'yoff', 'has_parent', 'rot'
|
__slots__ = 'uv', 'width', 'height', 'children', 'xoff', 'yoff', 'has_parent', 'rot', 'noarea'
|
||||||
def __init__(self, data):
|
def __init__(self, data, noarea = False):
|
||||||
|
|
||||||
self.has_parent = False
|
self.has_parent = False
|
||||||
self.rot = False # only used for triables
|
self.rot = False # only used for triables
|
||||||
self.xoff = 0
|
self.xoff = 0
|
||||||
self.yoff = 0
|
self.yoff = 0
|
||||||
|
self.noarea = noarea
|
||||||
|
|
||||||
if type(data) == list: # list of data
|
if type(data) == list: # list of data
|
||||||
self.uv = None
|
self.uv = None
|
||||||
@@ -93,14 +94,18 @@ class prettyface(object):
|
|||||||
# f, (len_min, len_mid, len_max)
|
# f, (len_min, len_mid, len_max)
|
||||||
self.uv = data
|
self.uv = data
|
||||||
|
|
||||||
f1, lens1, lens1ord = data[0]
|
if noarea:
|
||||||
if data[1]:
|
self.width = 0.0
|
||||||
f2, lens2, lens2ord = data[1]
|
self.height = 0.0
|
||||||
self.width = (lens1[lens1ord[0]] + lens2[lens2ord[0]])/2
|
else:
|
||||||
self.height = (lens1[lens1ord[1]] + lens2[lens2ord[1]])/2
|
f1, lens1, lens1ord = data[0]
|
||||||
else: # 1 tri :/
|
if data[1]:
|
||||||
self.width = lens1[0]
|
f2, lens2, lens2ord = data[1]
|
||||||
self.height = lens1[1]
|
self.width = (lens1[lens1ord[0]] + lens2[lens2ord[0]])/2
|
||||||
|
self.height = (lens1[lens1ord[1]] + lens2[lens2ord[1]])/2
|
||||||
|
else: # 1 tri :/
|
||||||
|
self.width = lens1[0]
|
||||||
|
self.height = lens1[1]
|
||||||
|
|
||||||
self.children = []
|
self.children = []
|
||||||
|
|
||||||
@@ -108,9 +113,13 @@ class prettyface(object):
|
|||||||
else: # blender face
|
else: # blender face
|
||||||
self.uv = data.uv
|
self.uv = data.uv
|
||||||
|
|
||||||
cos = [v.co for v in data]
|
if noarea:
|
||||||
self.width = ((cos[0]-cos[1]).length + (cos[2]-cos[3]).length)/2
|
self.width = 0.0
|
||||||
self.height = ((cos[1]-cos[2]).length + (cos[0]-cos[3]).length)/2
|
self.height = 0.0
|
||||||
|
else:
|
||||||
|
cos = [v.co for v in data]
|
||||||
|
self.width = ((cos[0]-cos[1]).length + (cos[2]-cos[3]).length)/2
|
||||||
|
self.height = ((cos[1]-cos[2]).length + (cos[0]-cos[3]).length)/2
|
||||||
|
|
||||||
self.children = []
|
self.children = []
|
||||||
|
|
||||||
@@ -204,10 +213,13 @@ def lightmap_uvpack( meshes,\
|
|||||||
PREF_SEL_ONLY= True,\
|
PREF_SEL_ONLY= True,\
|
||||||
PREF_NEW_UVLAYER= False,\
|
PREF_NEW_UVLAYER= False,\
|
||||||
PREF_PACK_IN_ONE= False,\
|
PREF_PACK_IN_ONE= False,\
|
||||||
|
PREF_PACK_TO_MANY= 0,\
|
||||||
PREF_APPLY_IMAGE= False,\
|
PREF_APPLY_IMAGE= False,\
|
||||||
PREF_IMG_PX_SIZE= 512,\
|
PREF_IMG_PX_SIZE= 512,\
|
||||||
PREF_BOX_DIV= 8,\
|
PREF_BOX_DIV= 8,\
|
||||||
PREF_MARGIN_DIV= 512):
|
PREF_MARGIN_DIV= 512,
|
||||||
|
PREF_2PASS= False,\
|
||||||
|
PREF_2PASS_ERROR= 0.05):
|
||||||
'''
|
'''
|
||||||
BOX_DIV if the maximum division of the UV map that
|
BOX_DIV if the maximum division of the UV map that
|
||||||
a box may be consolidated into.
|
a box may be consolidated into.
|
||||||
@@ -215,6 +227,9 @@ PREF_MARGIN_DIV= 512):
|
|||||||
and a higher value will have more clumpy boxes but more waisted space
|
and a higher value will have more clumpy boxes but more waisted space
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
if PREF_PACK_TO_MANY:
|
||||||
|
PREF_PACK_IN_ONE = False # This cant be true if we are packing to many images
|
||||||
|
|
||||||
if not meshes:
|
if not meshes:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -225,19 +240,22 @@ PREF_MARGIN_DIV= 512):
|
|||||||
image = Image.New('lightmap', PREF_IMG_PX_SIZE, PREF_IMG_PX_SIZE, 24)
|
image = Image.New('lightmap', PREF_IMG_PX_SIZE, PREF_IMG_PX_SIZE, 24)
|
||||||
face_groups = [[]]
|
face_groups = [[]]
|
||||||
else:
|
else:
|
||||||
face_groups = []
|
if PREF_PACK_TO_MANY:
|
||||||
|
face_groups = [[]]
|
||||||
|
else:
|
||||||
|
face_groups = []
|
||||||
|
|
||||||
for me in meshes:
|
for me in meshes:
|
||||||
# Add face UV if it does not exist.
|
# Add face UV if it does not exist.
|
||||||
# All new faces are selected.
|
# All new faces are selected.
|
||||||
me.faceUV = True
|
me.faceUV = True
|
||||||
|
|
||||||
if PREF_SEL_ONLY:
|
if PREF_SEL_ONLY:
|
||||||
faces = [f for f in me.faces if f.sel]
|
faces = [f for f in me.faces if f.sel]
|
||||||
else:
|
else:
|
||||||
faces = list(me.faces)
|
faces = list(me.faces)
|
||||||
|
|
||||||
if PREF_PACK_IN_ONE:
|
if PREF_PACK_IN_ONE or PREF_PACK_TO_MANY: # when PREF_PACK_TO_MANY is used we'll have to seperate these later
|
||||||
face_groups[0].extend(faces)
|
face_groups[0].extend(faces)
|
||||||
else:
|
else:
|
||||||
face_groups.append(faces)
|
face_groups.append(faces)
|
||||||
@@ -254,6 +272,66 @@ PREF_MARGIN_DIV= 512):
|
|||||||
me.activeUVLayer = uvname
|
me.activeUVLayer = uvname
|
||||||
|
|
||||||
del uvnames, uvname_org, uvname
|
del uvnames, uvname_org, uvname
|
||||||
|
|
||||||
|
|
||||||
|
if PREF_PACK_TO_MANY and len(face_groups[0]) < 4:
|
||||||
|
PREF_PACK_TO_MANY = False
|
||||||
|
|
||||||
|
if PREF_PACK_TO_MANY: # We need to separate these into
|
||||||
|
if PREF_PACK_TO_MANY < 4:
|
||||||
|
PREF_PACK_TO_MANY = 4
|
||||||
|
|
||||||
|
# Split this into a grid on the shortest axis
|
||||||
|
|
||||||
|
# TODO - Take object matricies into account.
|
||||||
|
|
||||||
|
# First get the bounds
|
||||||
|
xmin=ymin=zmin = 1000000000
|
||||||
|
xmax=ymax=zmax =-1000000000
|
||||||
|
for f in face_groups[0]:
|
||||||
|
x,y,z = f.cent
|
||||||
|
if x<xmin: xmin=x
|
||||||
|
if y<ymin: ymin=y
|
||||||
|
if z<zmin: zmin=z
|
||||||
|
|
||||||
|
if x>xmax: xmax=x
|
||||||
|
if y>ymax: ymax=y
|
||||||
|
if z>zmax: zmax=z
|
||||||
|
|
||||||
|
# This is fairly terrain spesific, at least it works best for flat objects.
|
||||||
|
xdepth = xmax-xmin
|
||||||
|
ydepth = ymax-ymin
|
||||||
|
zdepth = zmax-zmin
|
||||||
|
# print xdepth, ydepth, zdepth
|
||||||
|
div = PREF_PACK_TO_MANY
|
||||||
|
|
||||||
|
if div < 2: div = 2
|
||||||
|
|
||||||
|
face_grid = {}
|
||||||
|
if xdepth <= ydepth and xdepth <= zdepth:
|
||||||
|
# y/z axis plain
|
||||||
|
# print 'y/z'
|
||||||
|
for f in face_groups[0]:
|
||||||
|
x,y,z = f.cent
|
||||||
|
face_grid.setdefault( ( int(((y-ymin)/ydepth)*div), int(((z-zmin)/zdepth)*div) ), [] ).append(f)
|
||||||
|
|
||||||
|
elif ydepth <= xdepth and ydepth <= zdepth:
|
||||||
|
# x/z axis plain
|
||||||
|
# print 'x/z'
|
||||||
|
for f in face_groups[0]:
|
||||||
|
x,y,z = f.cent
|
||||||
|
face_grid.setdefault( ( int(((x-xmin)/xdepth)*div), int(((z-zmin)/zdepth)*div) ), [] ).append(f)
|
||||||
|
|
||||||
|
elif zdepth <= xdepth and zdepth <= ydepth:
|
||||||
|
# x/y axis plain
|
||||||
|
# print 'x/y'
|
||||||
|
for f in face_groups[0]:
|
||||||
|
x,y,z = f.cent
|
||||||
|
face_grid.setdefault( ( int(((x-xmin)/xdepth)*div), int(((y-ymin)/ydepth)*div) ), [] ).append(f)
|
||||||
|
|
||||||
|
# Replace the old face list
|
||||||
|
face_groups[:] = face_grid.values()
|
||||||
|
|
||||||
|
|
||||||
for face_sel in face_groups:
|
for face_sel in face_groups:
|
||||||
print "\nStarting unwrap"
|
print "\nStarting unwrap"
|
||||||
@@ -262,14 +340,23 @@ PREF_MARGIN_DIV= 512):
|
|||||||
print '\tWarning, less then 4 faces, skipping'
|
print '\tWarning, less then 4 faces, skipping'
|
||||||
continue
|
continue
|
||||||
|
|
||||||
pretty_faces = [prettyface(f) for f in face_sel if len(f) == 4]
|
if PREF_2PASS:
|
||||||
|
m = int(PREF_2PASS_ERROR*255);
|
||||||
|
skip_faces = [ f.uvColRange<=m for f in face_sel ]
|
||||||
|
del m
|
||||||
|
else:
|
||||||
|
skip_faces = [False] * len(face_sel)
|
||||||
|
|
||||||
|
pretty_faces = [prettyface(f,skip_faces[i]) for i,f in enumerate(face_sel) if len(f) == 4]
|
||||||
|
|
||||||
# Do we have any tri's
|
# Do we have any tri's
|
||||||
if len(pretty_faces) != len(face_sel):
|
if len(pretty_faces) != len(face_sel):
|
||||||
|
|
||||||
# Now add tri's, not so simple because we need to pair them up.
|
# Now add tri's, not so simple because we need to pair them up.
|
||||||
def trylens(f):
|
def trylens(f, noarea):
|
||||||
|
|
||||||
|
if noarea:
|
||||||
|
return (f, [0.0,0.0,0.0], [0,1,2]), noarea
|
||||||
|
|
||||||
# f must be a tri
|
# f must be a tri
|
||||||
cos = [v.co for v in f]
|
cos = [v.co for v in f]
|
||||||
lens = [(cos[0] - cos[1]).length, (cos[1] - cos[2]).length, (cos[2] - cos[0]).length]
|
lens = [(cos[0] - cos[1]).length, (cos[1] - cos[2]).length, (cos[2] - cos[0]).length]
|
||||||
@@ -282,9 +369,9 @@ PREF_MARGIN_DIV= 512):
|
|||||||
break
|
break
|
||||||
lens_order = lens_min, lens_mid, lens_max
|
lens_order = lens_min, lens_mid, lens_max
|
||||||
|
|
||||||
return f, lens, lens_order
|
return (f, lens, lens_order), noarea
|
||||||
|
|
||||||
tri_lengths = [trylens(f) for f in face_sel if len(f) == 3]
|
tri_lengths = [trylens(f,skip_faces[i]) for i,f in enumerate(face_sel) if len(f) == 3]
|
||||||
del trylens
|
del trylens
|
||||||
|
|
||||||
def trilensdiff(t1,t2):
|
def trilensdiff(t1,t2):
|
||||||
@@ -294,33 +381,41 @@ PREF_MARGIN_DIV= 512):
|
|||||||
abs(t1[1][t1[2][2]]-t2[1][t2[2][2]])
|
abs(t1[1][t1[2][2]]-t2[1][t2[2][2]])
|
||||||
|
|
||||||
while tri_lengths:
|
while tri_lengths:
|
||||||
tri1 = tri_lengths.pop()
|
tri1, noarea = tri_lengths.pop()
|
||||||
|
|
||||||
if not tri_lengths:
|
if not tri_lengths:
|
||||||
pretty_faces.append(prettyface((tri1, None)))
|
pretty_faces.append(prettyface((tri1, None), noarea))
|
||||||
break
|
break
|
||||||
|
|
||||||
best_tri_index = -1
|
best_tri_index = -1
|
||||||
best_tri_diff = 100000000.0
|
best_tri_diff = 100000000.0
|
||||||
|
best_noarea = False
|
||||||
|
|
||||||
for i, tri2 in enumerate(tri_lengths):
|
i=0
|
||||||
|
for tri2, noarea in tri_lengths:
|
||||||
diff = trilensdiff(tri1, tri2)
|
diff = trilensdiff(tri1, tri2)
|
||||||
if diff < best_tri_diff:
|
if diff < best_tri_diff:
|
||||||
best_tri_index = i
|
best_tri_index = i
|
||||||
best_tri_diff = diff
|
best_tri_diff = diff
|
||||||
|
|
||||||
pretty_faces.append(prettyface((tri1, tri_lengths.pop(best_tri_index))))
|
if diff==0: break
|
||||||
|
i+=1
|
||||||
|
tri2, noarea = tri_lengths.pop(best_tri_index)
|
||||||
|
pretty_faces.append(prettyface((tri1, tri2)) )
|
||||||
|
|
||||||
|
|
||||||
# Get the min, max and total areas
|
# Get the min, max and total areas
|
||||||
max_area = 0.0
|
max_area = 0.0
|
||||||
min_area = 100000000.0
|
min_area = 100000000.0
|
||||||
tot_area = 0
|
tot_area = 0
|
||||||
for f in face_sel:
|
for i,f in enumerate(face_sel):
|
||||||
area = f.area
|
if skip_faces[i]:
|
||||||
if area > max_area: max_area = area
|
min_area = 0.0
|
||||||
if area < min_area: min_area = area
|
else:
|
||||||
tot_area += area
|
area = f.area
|
||||||
|
if area > max_area: max_area = area
|
||||||
|
if area < min_area: min_area = area
|
||||||
|
tot_area += area
|
||||||
|
|
||||||
max_len = sqrt(max_area)
|
max_len = sqrt(max_area)
|
||||||
min_len = sqrt(min_area)
|
min_len = sqrt(min_area)
|
||||||
@@ -355,6 +450,7 @@ PREF_MARGIN_DIV= 512):
|
|||||||
l_int*=2
|
l_int*=2
|
||||||
|
|
||||||
lengths_to_ints = lengths_to_ints.items()
|
lengths_to_ints = lengths_to_ints.items()
|
||||||
|
|
||||||
lengths_to_ints.sort()
|
lengths_to_ints.sort()
|
||||||
print 'done'
|
print 'done'
|
||||||
|
|
||||||
@@ -531,23 +627,31 @@ def main():
|
|||||||
PREF_SEL_ONLY = Draw.Create(1)
|
PREF_SEL_ONLY = Draw.Create(1)
|
||||||
PREF_NEW_UVLAYER = Draw.Create(0)
|
PREF_NEW_UVLAYER = Draw.Create(0)
|
||||||
PREF_PACK_IN_ONE = Draw.Create(0)
|
PREF_PACK_IN_ONE = Draw.Create(0)
|
||||||
|
PREF_PACK_IN_MANY = Draw.Create(0)
|
||||||
PREF_APPLY_IMAGE = Draw.Create(0)
|
PREF_APPLY_IMAGE = Draw.Create(0)
|
||||||
PREF_IMG_PX_SIZE = Draw.Create(512)
|
PREF_IMG_PX_SIZE = Draw.Create(512)
|
||||||
PREF_BOX_DIV = Draw.Create(12)
|
PREF_BOX_DIV = Draw.Create(12)
|
||||||
|
PREF_2PASS = Draw.Create(0)
|
||||||
|
PREF_2PASS_ERROR = Draw.Create(0.002)
|
||||||
PREF_MARGIN_DIV = Draw.Create(0.1)
|
PREF_MARGIN_DIV = Draw.Create(0.1)
|
||||||
|
|
||||||
if not Draw.PupBlock('Lightmap Pack', [\
|
if not Draw.PupBlock('Lightmap Pack', [\
|
||||||
'Context...',
|
'Context...',
|
||||||
('Active Object', PREF_ACT_ONLY, 'If disabled, include other selected objects for packing the lightmap.'),\
|
('Active Object', PREF_ACT_ONLY, 'If disabled, include other selected objects for packing the lightmap.'),\
|
||||||
('Selected Faces', PREF_SEL_ONLY, 'Use only selected faces from all selected meshes.'),\
|
('Selected Faces', PREF_SEL_ONLY, 'Use only selected faces from all selected meshes.'),\
|
||||||
|
'UV Packing...',
|
||||||
|
('Pack Quality: ', PREF_BOX_DIV, 1, 48, 'Pre Packing before the complex boxpack'),\
|
||||||
|
('Margin: ', PREF_MARGIN_DIV, 0.001, 1.0, 'Size of the margin as a division of the UV'),\
|
||||||
|
('2ndPassOptimize', PREF_2PASS, 'Faces with low contrast on the active UV layers image get scaled down.'),\
|
||||||
|
('Pass Error: ', PREF_2PASS_ERROR, 0.001, 1.0, 'Use with 2nd pass optimize, faces with a contrast lower then this margin will be scaled down'),\
|
||||||
|
|
||||||
'Image & UVs...',
|
'Image & UVs...',
|
||||||
('Share Tex Space', PREF_PACK_IN_ONE, 'Objects Share texture space, map all objects into 1 uvmap'),\
|
('Share Tex Space', PREF_PACK_IN_ONE, 'Objects Share texture space, map all objects into 1 uvmap'),\
|
||||||
|
('Tile Images: ', PREF_PACK_IN_MANY, 0, 16, 'Tile images over one or more mesh, value squared (n*n)'),\
|
||||||
('New UV Layer', PREF_NEW_UVLAYER, 'Create a new UV layer for every mesh packed'),\
|
('New UV Layer', PREF_NEW_UVLAYER, 'Create a new UV layer for every mesh packed'),\
|
||||||
('New Image', PREF_APPLY_IMAGE, 'Assign new images for every mesh (only one if shared tex space enabled)'),\
|
('New Image', PREF_APPLY_IMAGE, 'Assign new images for every mesh (only one if shared tex space enabled)'),\
|
||||||
('Image Size', PREF_IMG_PX_SIZE, 64, 5000, 'Width and Height for the new image'),\
|
('Image Size', PREF_IMG_PX_SIZE, 64, 5000, 'Width and Height for the new image'),\
|
||||||
'UV Packing...',
|
|
||||||
('Pack Quality: ', PREF_BOX_DIV, 1, 48, 'Pre Packing before the complex boxpack'),\
|
|
||||||
('Margin: ', PREF_MARGIN_DIV, 0.001, 1.0, 'Size of the margin as a division of the UV')\
|
|
||||||
]):
|
]):
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -576,10 +680,14 @@ def main():
|
|||||||
PREF_SEL_ONLY.val,\
|
PREF_SEL_ONLY.val,\
|
||||||
PREF_NEW_UVLAYER.val,\
|
PREF_NEW_UVLAYER.val,\
|
||||||
PREF_PACK_IN_ONE.val,\
|
PREF_PACK_IN_ONE.val,\
|
||||||
|
PREF_PACK_IN_MANY.val,\
|
||||||
PREF_APPLY_IMAGE.val,\
|
PREF_APPLY_IMAGE.val,\
|
||||||
PREF_IMG_PX_SIZE.val,\
|
PREF_IMG_PX_SIZE.val,\
|
||||||
PREF_BOX_DIV.val,\
|
PREF_BOX_DIV.val,\
|
||||||
int(1/(PREF_MARGIN_DIV.val/100)))
|
int(1/(PREF_MARGIN_DIV.val/100)),\
|
||||||
|
PREF_2PASS.val,\
|
||||||
|
PREF_2PASS_ERROR.val,\
|
||||||
|
)
|
||||||
|
|
||||||
if is_editmode:
|
if is_editmode:
|
||||||
Window.EditMode(1)
|
Window.EditMode(1)
|
||||||
|
@@ -25,7 +25,7 @@ It removes very low weighted verts from the current group with a weight option.
|
|||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
@@ -51,13 +51,14 @@ def weightClean(me, PREF_THRESH, PREF_KEEP_SINGLE, PREF_OTHER_GROUPS):
|
|||||||
for wd in vWeightDict:
|
for wd in vWeightDict:
|
||||||
l = len(wd)
|
l = len(wd)
|
||||||
if not PREF_KEEP_SINGLE or l > 1:
|
if not PREF_KEEP_SINGLE or l > 1:
|
||||||
|
# cant use iteritems because the dict is having items removed
|
||||||
for group in wd.keys():
|
for group in wd.keys():
|
||||||
w= wd[group]
|
w= wd[group]
|
||||||
if w <= PREF_THRESH:
|
if w <= PREF_THRESH:
|
||||||
# small weight, remove.
|
# small weight, remove.
|
||||||
del wd[group]
|
del wd[group]
|
||||||
rem_count +=1
|
rem_count +=1
|
||||||
l-=1
|
l-=1
|
||||||
|
|
||||||
if PREF_KEEP_SINGLE and l == 1:
|
if PREF_KEEP_SINGLE and l == 1:
|
||||||
break
|
break
|
||||||
@@ -117,4 +118,4 @@ def main():
|
|||||||
Draw.PupMenu('Removed %i verts from groups' % rem_count)
|
Draw.PupMenu('Removed %i verts from groups' % rem_count)
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -56,7 +56,7 @@
|
|||||||
information, claims of third parties, damages as a result of injury to
|
information, claims of third parties, damages as a result of injury to
|
||||||
any person, or any other loss) arising out of or in connection with the
|
any person, or any other loss) arising out of or in connection with the
|
||||||
license granted under this License Agreement or the use of or inability
|
license granted under this License Agreement or the use of or inability
|
||||||
to use the Software, even if VF has been advised of the possibility of
|
to use the Software, even if BF has been advised of the possibility of
|
||||||
such damages.
|
such damages.
|
||||||
|
|
||||||
5. User warning and indemnification
|
5. User warning and indemnification
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user