Merging r42621 through r42647 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin 2011-12-15 16:04:59 +00:00
commit deb95ddb44
46 changed files with 2618 additions and 2388 deletions

View File

@ -22,6 +22,10 @@
#
# ***** END GPL LICENSE BLOCK *****
# NOTEL This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template
# in that script too
set(INC
.
../Eigen3

View File

@ -1,4 +1,9 @@
#!/usr/bin/python
# NOTEL This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template
# in that script too
import sys
import os

View File

@ -33,14 +33,14 @@ rm -rf $tmp
chmod 664 ./third_party/glog/src/windows/*.cc ./third_party/glog/src/windows/*.h ./third_party/glog/src/windows/glog/*.h
sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/'`
headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t/'`
sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | sed -r 's/^\.\//\t/'`
third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | sed -r 's/^\.\//\t/'`
third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | sed -r 's/^\.\//\t/' | sort`
third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | sed -r 's/^\.\//\t/' | sort`
third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/'`
third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/'`
third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort`
third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort`
src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort | uniq`
src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort | uniq`
@ -89,7 +89,6 @@ for x in $src_dir $src_third_dir; do
done
cat > CMakeLists.txt << EOF
# \$Id\$
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
@ -114,17 +113,21 @@ cat > CMakeLists.txt << EOF
#
# ***** END GPL LICENSE BLOCK *****
# NOTEL This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template
# in that script too
set(INC
.
../Eigen3
./third_party/ssba
./third_party/ldl/Include
third_party/ssba
third_party/ldl/Include
../colamd/Include
)
set(INC_SYS
${PNG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
\${PNG_INCLUDE_DIR}
\${ZLIB_INCLUDE_DIRS}
)
set(SRC
@ -139,7 +142,7 @@ ${headers}
${third_headers}
)
IF(WIN32)
if(WIN32)
list(APPEND SRC
third_party/glog/src/logging.cc
third_party/glog/src/raw_logging.cc
@ -167,28 +170,23 @@ IF(WIN32)
)
list(APPEND INC
./third_party/glog/src/windows
third_party/glog/src/windows
)
IF(NOT MINGW)
if(NOT MINGW)
list(APPEND INC
./third_party/msinttypes
third_party/msinttypes
)
ENDIF(MINGW)
endif()
list(APPEND INC
./third_party/glog/src/windows
./third_party/msinttypes
)
IF(MSVC)
if(MSVC)
set(MSVC_OFLAGS O1 O2 Ox)
foreach(FLAG \${MSVC_OFLAGS})
string(REPLACE "\${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "\${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "\${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "\${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endforeach()
ENDIF(MSVC)
ELSE(WIN32)
endif()
else()
list(APPEND SRC
${third_glog_sources}
@ -196,17 +194,25 @@ ${third_glog_headers}
)
list(APPEND INC
./third_party/glog/src
third_party/glog/src
)
ENDIF(WIN32)
endif()
add_definitions(-DV3DLIB_ENABLE_SUITESPARSE -DGOOGLE_GLOG_DLL_DECL=)
add_definitions(
-DV3DLIB_ENABLE_SUITESPARSE
-DGOOGLE_GLOG_DLL_DECL=
)
blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}")
EOF
cat > SConscript << EOF
#!/usr/bin/python
# NOTEL This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template
# in that script too
import sys
import os
@ -229,7 +235,6 @@ incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
@ -246,16 +251,16 @@ ${win_src}
defs.append('NDEBUG')
else:
if not env['BF_DEBUG']:
cflags_libmv = Split(env['REL_CFLAGS'])
ccflags_libmv = Split(env['REL_CCFLAGS'])
cxxflags_libmv = Split(env['REL_CXXFLAGS'])
cflags_libmv += Split(env['REL_CFLAGS'])
ccflags_libmv += Split(env['REL_CCFLAGS'])
cxxflags_libmv += Split(env['REL_CXXFLAGS'])
else:
src += env.Glob("third_party/glog/src/*.cc")
incs += ' ./third_party/glog/src'
if not env['BF_DEBUG']:
cflags_libmv = Split(env['REL_CFLAGS'])
ccflags_libmv = Split(env['REL_CCFLAGS'])
cxxflags_libmv = Split(env['REL_CXXFLAGS'])
cflags_libmv += Split(env['REL_CFLAGS'])
ccflags_libmv += Split(env['REL_CCFLAGS'])
cxxflags_libmv += Split(env['REL_CXXFLAGS'])
incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'

252
extern/libmv/files.txt vendored
View File

@ -1,141 +1,151 @@
libmv/logging/logging.h
libmv/numeric/dogleg.h
libmv/numeric/levenberg_marquardt.h
libmv/numeric/poly.h
libmv/numeric/numeric.cc
libmv/numeric/function_derivative.h
libmv/numeric/poly.cc
libmv/numeric/tinyvector.cc
libmv/numeric/numeric.h
libmv/simple_pipeline/reconstruction.cc
libmv/simple_pipeline/resect.h
libmv/simple_pipeline/resect.cc
libmv/simple_pipeline/reconstruction.h
libmv/simple_pipeline/camera_intrinsics.h
libmv/simple_pipeline/intersect.cc
libmv/simple_pipeline/initialize_reconstruction.cc
libmv/simple_pipeline/camera_intrinsics.cc
libmv/simple_pipeline/pipeline.cc
libmv/simple_pipeline/tracks.h
libmv/simple_pipeline/detect.h
libmv/simple_pipeline/detect.cc
libmv/simple_pipeline/pipeline.h
libmv/simple_pipeline/tracks.cc
libmv/simple_pipeline/bundle.cc
libmv/simple_pipeline/intersect.h
libmv/simple_pipeline/bundle.h
libmv/simple_pipeline/initialize_reconstruction.h
libmv/image/convolve.h
libmv/image/tuple.h
libmv/base/id_generator.h
libmv/base/scoped_ptr.h
libmv/base/vector.h
libmv/base/vector_utils.h
libmv/image/array_nd.cc
libmv/image/array_nd.h
libmv/image/convolve.cc
libmv/image/array_nd.cc
libmv/image/sample.h
libmv/image/convolve.h
libmv/image/image.h
libmv/tracking/pyramid_region_tracker.cc
libmv/tracking/region_tracker.h
libmv/tracking/sad.cc
libmv/tracking/trklt_region_tracker.cc
libmv/tracking/klt_region_tracker.cc
libmv/tracking/retrack_region_tracker.h
libmv/tracking/sad.h
libmv/tracking/pyramid_region_tracker.h
libmv/tracking/trklt_region_tracker.h
libmv/tracking/retrack_region_tracker.cc
libmv/tracking/klt_region_tracker.h
libmv/base/id_generator.h
libmv/base/vector.h
libmv/base/scoped_ptr.h
libmv/base/vector_utils.h
libmv/multiview/projection.cc
libmv/image/sample.h
libmv/image/tuple.h
libmv/logging/logging.h
libmv/multiview/conditioning.cc
libmv/multiview/nviewtriangulation.h
libmv/multiview/resection.h
libmv/multiview/fundamental.cc
libmv/multiview/conditioning.h
libmv/multiview/euclidean_resection.cc
libmv/multiview/euclidean_resection.h
libmv/multiview/triangulation.h
libmv/multiview/projection.h
libmv/multiview/triangulation.cc
libmv/multiview/fundamental.cc
libmv/multiview/fundamental.h
libmv/multiview/conditioning.h
third_party/ssba/README.TXT
third_party/ssba/COPYING.TXT
third_party/ssba/Geometry/v3d_metricbundle.h
third_party/ssba/Geometry/v3d_metricbundle.cpp
third_party/ssba/Geometry/v3d_cameramatrix.h
third_party/ssba/Geometry/v3d_distortion.h
third_party/ssba/README.libmv
third_party/ssba/Math/v3d_linear_utils.h
third_party/ssba/Math/v3d_optimization.h
third_party/ssba/Math/v3d_mathutilities.h
third_party/ssba/Math/v3d_linear.h
third_party/ssba/Math/v3d_optimization.cpp
third_party/gflags/gflags_completions.h
third_party/gflags/mutex.h
third_party/gflags/gflags.cc
third_party/gflags/gflags_reporting.cc
third_party/gflags/README.libmv
third_party/gflags/config.h
third_party/gflags/gflags_completions.cc
third_party/gflags/gflags.h
third_party/fast/fast_9.c
libmv/multiview/nviewtriangulation.h
libmv/multiview/projection.cc
libmv/multiview/projection.h
libmv/multiview/resection.h
libmv/multiview/triangulation.cc
libmv/multiview/triangulation.h
libmv/numeric/dogleg.h
libmv/numeric/function_derivative.h
libmv/numeric/levenberg_marquardt.h
libmv/numeric/numeric.cc
libmv/numeric/numeric.h
libmv/numeric/poly.cc
libmv/numeric/poly.h
libmv/simple_pipeline/bundle.cc
libmv/simple_pipeline/bundle.h
libmv/simple_pipeline/callbacks.cc
libmv/simple_pipeline/callbacks.h
libmv/simple_pipeline/camera_intrinsics.cc
libmv/simple_pipeline/camera_intrinsics.h
libmv/simple_pipeline/detect.cc
libmv/simple_pipeline/detect.h
libmv/simple_pipeline/initialize_reconstruction.cc
libmv/simple_pipeline/initialize_reconstruction.h
libmv/simple_pipeline/intersect.cc
libmv/simple_pipeline/intersect.h
libmv/simple_pipeline/pipeline.cc
libmv/simple_pipeline/pipeline.h
libmv/simple_pipeline/reconstruction.cc
libmv/simple_pipeline/reconstruction.h
libmv/simple_pipeline/resect.cc
libmv/simple_pipeline/resect.h
libmv/simple_pipeline/tracks.cc
libmv/simple_pipeline/tracks.h
libmv/tracking/brute_region_tracker.cc
libmv/tracking/brute_region_tracker.h
libmv/tracking/esm_region_tracker.cc
libmv/tracking/esm_region_tracker.h
libmv/tracking/hybrid_region_tracker.cc
libmv/tracking/hybrid_region_tracker.h
libmv/tracking/klt_region_tracker.cc
libmv/tracking/klt_region_tracker.h
libmv/tracking/lmicklt_region_tracker.cc
libmv/tracking/lmicklt_region_tracker.h
libmv/tracking/pyramid_region_tracker.cc
libmv/tracking/pyramid_region_tracker.h
libmv/tracking/region_tracker.h
libmv/tracking/retrack_region_tracker.cc
libmv/tracking/retrack_region_tracker.h
libmv/tracking/sad.cc
libmv/tracking/sad.h
libmv/tracking/trklt_region_tracker.cc
libmv/tracking/trklt_region_tracker.h
third_party/fast/fast_10.c
third_party/fast/fast_11.c
third_party/fast/fast_12.c
third_party/fast/fast_9.c
third_party/fast/fast.c
third_party/fast/fast.h
third_party/fast/LICENSE
third_party/fast/fast_12.c
third_party/fast/fast.c
third_party/fast/nonmax.c
third_party/fast/README
third_party/fast/README.libmv
third_party/fast/nonmax.c
third_party/ldl/Include/ldl.h
third_party/ldl/CMakeLists.txt
third_party/ldl/README.libmv
third_party/ldl/Doc/ChangeLog
third_party/ldl/Doc/lesser.txt
third_party/ldl/README.txt
third_party/ldl/Source/ldl.c
third_party/gflags/config.h
third_party/gflags/gflags.cc
third_party/gflags/gflags_completions.cc
third_party/gflags/gflags_completions.h
third_party/gflags/gflags.h
third_party/gflags/gflags_reporting.cc
third_party/gflags/mutex.h
third_party/gflags/README.libmv
third_party/glog/AUTHORS
third_party/glog/ChangeLog
third_party/glog/COPYING
third_party/glog/src/utilities.cc
third_party/glog/src/utilities.h
third_party/glog/src/symbolize.cc
third_party/glog/src/stacktrace_generic-inl.h
third_party/glog/src/config_mac.h
third_party/glog/src/vlog_is_on.cc
third_party/glog/src/signalhandler.cc
third_party/glog/src/stacktrace.h
third_party/glog/src/stacktrace_x86_64-inl.h
third_party/glog/src/symbolize.h
third_party/glog/src/base/googleinit.h
third_party/glog/src/base/mutex.h
third_party/glog/src/base/commandlineflags.h
third_party/glog/src/windows/preprocess.sh
third_party/glog/src/windows/port.h
third_party/glog/src/windows/config.h
third_party/glog/src/windows/glog/raw_logging.h
third_party/glog/src/windows/glog/vlog_is_on.h
third_party/glog/src/windows/glog/logging.h
third_party/glog/src/windows/glog/log_severity.h
third_party/glog/src/windows/port.cc
third_party/glog/src/logging.cc
third_party/glog/src/stacktrace_powerpc-inl.h
third_party/glog/src/stacktrace_x86-inl.h
third_party/glog/src/demangle.cc
third_party/glog/src/config.h
third_party/glog/src/demangle.h
third_party/glog/src/stacktrace_libunwind-inl.h
third_party/glog/src/glog/raw_logging.h
third_party/glog/src/glog/vlog_is_on.h
third_party/glog/src/glog/logging.h
third_party/glog/src/glog/log_severity.h
third_party/glog/src/raw_logging.cc
third_party/glog/src/config_linux.h
third_party/glog/NEWS
third_party/glog/README
third_party/glog/README.libmv
third_party/glog/AUTHORS
third_party/msinttypes/stdint.h
third_party/glog/src/base/commandlineflags.h
third_party/glog/src/base/googleinit.h
third_party/glog/src/base/mutex.h
third_party/glog/src/config_freebsd.h
third_party/glog/src/config.h
third_party/glog/src/config_linux.h
third_party/glog/src/config_mac.h
third_party/glog/src/demangle.cc
third_party/glog/src/demangle.h
third_party/glog/src/glog/logging.h
third_party/glog/src/glog/log_severity.h
third_party/glog/src/glog/raw_logging.h
third_party/glog/src/glog/vlog_is_on.h
third_party/glog/src/logging.cc
third_party/glog/src/raw_logging.cc
third_party/glog/src/signalhandler.cc
third_party/glog/src/stacktrace_generic-inl.h
third_party/glog/src/stacktrace.h
third_party/glog/src/stacktrace_libunwind-inl.h
third_party/glog/src/stacktrace_powerpc-inl.h
third_party/glog/src/stacktrace_x86_64-inl.h
third_party/glog/src/stacktrace_x86-inl.h
third_party/glog/src/symbolize.cc
third_party/glog/src/symbolize.h
third_party/glog/src/utilities.cc
third_party/glog/src/utilities.h
third_party/glog/src/vlog_is_on.cc
third_party/glog/src/windows/config.h
third_party/glog/src/windows/glog/logging.h
third_party/glog/src/windows/glog/log_severity.h
third_party/glog/src/windows/glog/raw_logging.h
third_party/glog/src/windows/glog/vlog_is_on.h
third_party/glog/src/windows/port.cc
third_party/glog/src/windows/port.h
third_party/glog/src/windows/preprocess.sh
third_party/ldl/CMakeLists.txt
third_party/ldl/Doc/ChangeLog
third_party/ldl/Doc/lesser.txt
third_party/ldl/Include/ldl.h
third_party/ldl/README.libmv
third_party/ldl/README.txt
third_party/ldl/Source/ldl.c
third_party/msinttypes/inttypes.h
third_party/msinttypes/README.libmv
third_party/msinttypes/stdint.h
third_party/ssba/COPYING.TXT
third_party/ssba/Geometry/v3d_cameramatrix.h
third_party/ssba/Geometry/v3d_distortion.h
third_party/ssba/Geometry/v3d_metricbundle.cpp
third_party/ssba/Geometry/v3d_metricbundle.h
third_party/ssba/Math/v3d_linear.h
third_party/ssba/Math/v3d_linear_utils.h
third_party/ssba/Math/v3d_mathutilities.h
third_party/ssba/Math/v3d_optimization.cpp
third_party/ssba/Math/v3d_optimization.h
third_party/ssba/README.libmv
third_party/ssba/README.TXT

View File

@ -1,4 +1,4 @@
#!/bin/sh
find ./libmv/ -type f | sed -r 's/^\.\///' > files.txt
find ./third_party/ -type f | sed -r 's/^\.\///' >> files.txt
find ./libmv/ -type f | sed -r 's/^\.\///' | sort > files.txt
find ./third_party/ -type f | sed -r 's/^\.\///' | sort >> files.txt

View File

@ -137,8 +137,21 @@ int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
#endif
#ifdef WITH_JACK
case AUD_JACK_DEVICE:
dev = new AUD_JackDevice("Blender", specs, buffersize);
break;
#ifdef __APPLE__
struct stat st;
if(stat("/Library/Frameworks/Jackmp.framework", &st) != 0)
{
printf("Warning: Jack Framework not installed\n");
// No break, fall through to default, to return false
}
else
{
#endif
dev = new AUD_JackDevice("Blender", specs, buffersize);
break;
#ifdef __APPLE__
}
#endif
#endif
default:
return false;

View File

@ -438,8 +438,12 @@ GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw
GHOST_ModifierKeys modifiers;
system->retrieveModifierKeys(modifiers);
*keyDown = !(raw.data.keyboard.Flags & RI_KEY_BREAK);
// RI_KEY_BREAK doesn't work for sticky keys release, so we also
// check for the up message
unsigned int msg = raw.data.keyboard.Message;
*keyDown = !(raw.data.keyboard.Flags & RI_KEY_BREAK) && msg != WM_KEYUP && msg != WM_SYSKEYUP;
key = this->convertKey(window, raw.data.keyboard.VKey, raw.data.keyboard.MakeCode, (raw.data.keyboard.Flags&(RI_KEY_E1|RI_KEY_E0)));
// extra handling of modifier keys: don't send repeats out from GHOST

View File

@ -1056,7 +1056,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
# the space setting is supported for: derivative-maps + bump-maps (DEFAULT,BEST_QUALITY), not for normal-maps
sub = row.row()
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map))
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_LOW_QUALITY', 'BUMP_MEDIUM_QUALITY', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map))
sub.prop(tex, "bump_objectspace", text="Space")

View File

@ -51,7 +51,7 @@ extern "C" {
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR
/* alpha/beta/rc/release, docs use this */
#define BLENDER_VERSION_CYCLE release
#define BLENDER_VERSION_CYCLE alpha
extern char versionstr[]; /* from blender.c */

View File

@ -43,7 +43,6 @@ struct MDeformVert;
void defgroup_copy_list(struct ListBase *lb1, struct ListBase *lb2);
struct bDeformGroup *defgroup_duplicate(struct bDeformGroup *ingroup);
struct bDeformGroup *defgroup_find_name(struct Object *ob, const char *name);
int defgroup_find_index(struct Object *ob, struct bDeformGroup *dg);
int *defgroup_flip_map(struct Object *ob, int *flip_map_len, int use_default);
int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, int use_default, int defgroup);
int defgroup_flip_index(struct Object *ob, int index, int use_default);
@ -66,6 +65,7 @@ void defvert_sync_mapped(struct MDeformVert *dvert_dst, const struct MDeformVert
void defvert_remap (struct MDeformVert *dvert, int *map, const int map_len);
void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
void defvert_normalize(struct MDeformVert *dvert);
void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
/* utility function, note that 32 chars is the maximum string length since its only
* used with defgroups currently */

View File

@ -924,7 +924,6 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
float contrib = 0.0f;
float armature_weight = 1.0f; /* default to 1 if no overall def group */
float prevco_weight = 1.0f; /* weight for optional cached vertexcos */
int j;
if(use_quaternion) {
memset(&sumdq, 0, sizeof(DualQuat));
@ -971,12 +970,14 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
mul_m4_v3(premat, co);
if(use_dverts && dvert && dvert->totweight) { // use weight groups ?
MDeformWeight *dw= dvert->dw;
int deformed = 0;
unsigned int j;
for(j = 0; j < dvert->totweight; j++){
int index = dvert->dw[j].def_nr;
for (j= dvert->totweight; j != 0; j--, dw++) {
const int index = dw->def_nr;
if(index < defbase_tot && (pchan= defnrToPC[index])) {
float weight = dvert->dw[j].weight;
float weight = dw->weight;
Bone *bone= pchan->bone;
pdef_info= pdef_info_array + defnrToPCIndex[index];

View File

@ -436,16 +436,15 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
float vec[3] = {0.0f, 0.0f, 0.0f};
float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3];
float imat[3][3], tmat[3][3];
int dgroup;
const int defgroup= defgroup_name_index(ob, substring);
short freeDM = 0;
/* initialize target matrix using target matrix */
copy_m4_m4(mat, ob->obmat);
/* get index of vertex group */
dgroup = defgroup_name_index(ob, substring);
if (dgroup < 0) return;
if (defgroup == -1) return;
/* get DerivedMesh */
if (em) {
/* target is in editmode, so get a special derived mesh */
@ -463,28 +462,25 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
if (dm) {
MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
int numVerts = dm->getNumVerts(dm);
int i, j, count = 0;
int i, count = 0;
float co[3], nor[3];
/* check that dvert is a valid pointers (just in case) */
if (dvert) {
MDeformVert *dv= dvert;
/* get the average of all verts with that are in the vertex-group */
for (i = 0; i < numVerts; i++) {
for (j = 0; j < dvert[i].totweight; j++) {
/* does this vertex belong to nominated vertex group? */
if (dvert[i].dw[j].def_nr == dgroup) {
dm->getVertCo(dm, i, co);
dm->getVertNo(dm, i, nor);
add_v3_v3(vec, co);
add_v3_v3(normal, nor);
count++;
break;
}
for (i = 0; i < numVerts; i++, dv++) {
MDeformWeight *dw= defvert_find_index(dv, defgroup);
if (dw && dw->weight != 0.0f) {
dm->getVertCo(dm, i, co);
dm->getVertNo(dm, i, nor);
add_v3_v3(vec, co);
add_v3_v3(normal, nor);
count++;
}
}
/* calculate averages of normal and coordinates */
if (count > 0) {
mul_v3_fl(vec, 1.0f / count);
@ -535,43 +531,38 @@ static void contarget_get_lattice_mat (Object *ob, const char *substring, float
float *co = dl?dl->verts:NULL;
BPoint *bp = lt->def;
MDeformVert *dvert = lt->dvert;
MDeformVert *dv = lt->dvert;
int tot_verts= lt->pntsu*lt->pntsv*lt->pntsw;
float vec[3]= {0.0f, 0.0f, 0.0f}, tvec[3];
int dgroup=0, grouped=0;
int grouped=0;
int i, n;
const int defgroup= defgroup_name_index(ob, substring);
/* initialize target matrix using target matrix */
copy_m4_m4(mat, ob->obmat);
/* get index of vertex group */
dgroup = defgroup_name_index(ob, substring);
if (dgroup < 0) return;
if (dvert == NULL) return;
if (defgroup == -1) return;
if (dv == NULL) return;
/* 1. Loop through control-points checking if in nominated vertex-group.
* 2. If it is, add it to vec to find the average point.
*/
for (i=0; i < tot_verts; i++, dvert++) {
for (n= 0; n < dvert->totweight; n++) {
/* found match - vert is in vgroup */
if (dvert->dw[n].def_nr == dgroup) {
for (i=0; i < tot_verts; i++, dv++) {
for (n= 0; n < dv->totweight; n++) {
MDeformWeight *dw= defvert_find_index(dv, defgroup);
if (dw && dw->weight > 0.0f) {
/* copy coordinates of point to temporary vector, then add to find average */
if (co)
memcpy(tvec, co, 3*sizeof(float));
else
memcpy(tvec, bp->vec, 3*sizeof(float));
memcpy(tvec, co ? co : bp->vec, 3 * sizeof(float));
add_v3_v3(vec, tvec);
grouped++;
break;
}
}
/* advance pointer to coordinate data */
if (co) co+= 3;
else bp++;
if (co) co += 3;
else bp++;
}
/* find average location, then multiply by ob->obmat to find world-space location */
@ -1106,10 +1097,10 @@ static void kinematic_new_data (void *cdata)
{
bKinematicConstraint *data= (bKinematicConstraint *)cdata;
data->weight= (float)1.0;
data->orientweight= (float)1.0;
data->weight= 1.0f;
data->orientweight= 1.0f;
data->iterations = 500;
data->dist= (float)1.0;
data->dist= 1.0f;
data->flag= CONSTRAINT_IK_TIP|CONSTRAINT_IK_STRETCH|CONSTRAINT_IK_POS;
}

View File

@ -163,33 +163,85 @@ void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src,
/* be sure all flip_map values are valid */
void defvert_remap(MDeformVert *dvert, int *map, const int map_len)
{
MDeformWeight *dw;
int i;
for (i=0, dw=dvert->dw; i<dvert->totweight; i++, dw++) {
MDeformWeight *dw= dvert->dw;
unsigned int i;
for (i= dvert->totweight; i != 0; i--, dw++) {
if (dw->def_nr < map_len) {
dw->def_nr= map[dw->def_nr];
/* just incase */
BLI_assert(dw->def_nr >= 0);
}
}
}
void defvert_normalize(MDeformVert *dvert)
{
if (dvert->totweight<=0) {
if (dvert->totweight <= 0) {
/* nothing */
}
else if (dvert->totweight==1) {
dvert->dw[0].weight= 1.0f;
}
else {
int i;
float tot= 0.0f;
MDeformWeight *dw;
for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++)
tot += dw->weight;
unsigned int i;
float tot_weight= 0.0f;
if (tot > 0.0f) {
for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++)
dw->weight /= tot;
for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
tot_weight += dw->weight;
}
if (tot_weight > 0.0f) {
float scalar= 1.0f / tot_weight;
for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
dw->weight *= scalar;
/* incase of division errors with very low weights */
CLAMP(dw->weight, 0.0f, 1.0f);
}
}
}
}
void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
{
if (dvert->totweight <= 0) {
/* nothing */
}
else if (dvert->totweight==1) {
dvert->dw[0].weight= 1.0f;
}
else {
MDeformWeight *dw_lock;
MDeformWeight *dw;
unsigned int i;
float tot_weight= 0.0f;
float lock_iweight= 1.0f;
for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
if(dw->def_nr != def_nr_lock) {
tot_weight += dw->weight;
}
else {
dw_lock= dw;
lock_iweight = (1.0f - dw_lock->weight);
CLAMP(lock_iweight, 0.0f, 1.0f);
}
}
if (tot_weight > 0.0f) {
/* paranoid, should be 1.0 but incase of float error clamp anyway */
float scalar= (1.0f / tot_weight) * lock_iweight;
for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
if(dw != dw_lock) {
dw->weight *= scalar;
/* incase of division errors with very low weights */
CLAMP(dw->weight, 0.0f, 1.0f);
}
}
}
}
}
@ -227,7 +279,7 @@ bDeformGroup *defgroup_find_name(Object *ob, const char *name)
int defgroup_name_index(Object *ob, const char *name)
{
/* Return the location of the named deform group within the list of
* deform groups. This function is a combination of defgroup_find_index and
* deform groups. This function is a combination of BLI_findlink and
* defgroup_find_name. The other two could be called instead, but that
* require looping over the vertexgroups twice.
*/
@ -244,46 +296,6 @@ int defgroup_name_index(Object *ob, const char *name)
return -1;
}
int defgroup_find_index(Object *ob, bDeformGroup *dg)
{
/* Fetch the location of this deform group
* within the linked list of deform groups.
* (this number is stored in the deform
* weights of the deform verts to link them
* to this deform group).
*
* note: this is zero based, ob->actdef starts at 1.
*/
bDeformGroup *eg;
int def_nr;
eg = ob->defbase.first;
def_nr = 0;
/* loop through all deform groups */
while (eg != NULL) {
/* if the current deform group is
* the one we are after, return
* def_nr
*/
if (eg == dg) {
break;
}
++def_nr;
eg = eg->next;
}
/* if there was no deform group found then
* return -1 (should set up a nice symbolic
* constant for this)
*/
if (eg == NULL) return -1;
return def_nr;
}
/* note, must be freed */
int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
{
@ -527,6 +539,12 @@ float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup)
return dw ? dw->weight : 0.0f;
}
/* take care with this the rationale is:
* - if the object has no vertex group. act like vertex group isnt set and return 1.0,
* - if the vertex group exists but the 'defgroup' isnt found on this vertex, _still_ return 0.0
*
* This is a bit confusing, just saves some checks from the caller.
*/
float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup)
{
if (defgroup == -1 || dvert == NULL)
@ -540,9 +558,9 @@ MDeformWeight *defvert_find_index(const MDeformVert *dvert, const int defgroup)
{
if (dvert && defgroup >= 0) {
MDeformWeight *dw = dvert->dw;
int i;
unsigned int i;
for (i=dvert->totweight; i>0; i--, dw++) {
for (i= dvert->totweight; i != 0; i--, dw++) {
if (dw->def_nr == defgroup) {
return dw;
}
@ -626,10 +644,17 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
*/
if (dvert->totweight) {
dw_new = MEM_mallocN(sizeof(MDeformWeight)*(dvert->totweight), __func__);
if (dvert->dw){
if (dvert->dw) {
#if 1 /* since we dont care about order, swap this with the last, save a memcpy */
if (i != dvert->totweight) {
dvert->dw[i]= dvert->dw[dvert->totweight];
}
memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
MEM_freeN(dvert->dw);
#else
memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*i);
memcpy(dw_new+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
MEM_freeN(dvert->dw);
#endif
}
dvert->dw = dw_new;
}

View File

@ -903,7 +903,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
/* always get derivatives for these textures */
if ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP) ma->texco |= TEXCO_OSA;
else if(mtex->texflag & (MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) ma->texco |= TEXCO_OSA;
else if(mtex->texflag & (MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) ma->texco |= TEXCO_OSA;
if(ma->texco & (TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM|TEXCO_STRAND|TEXCO_STRESS)) needuv= 1;
else if(ma->texco & (TEXCO_GLOB|TEXCO_UV|TEXCO_OBJECT|TEXCO_SPEED)) needuv= 1;

View File

@ -65,7 +65,9 @@ float dist_to_plane_v3(const float p[3], const float plane_co[3], const float pl
float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]);
void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
void closest_to_plane_v3(float r[3], const float plane_co[3], const float plane_no_unit[3], const float pt[3]);
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]);
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]);

View File

@ -209,33 +209,54 @@ float dist_to_line_segment_v2(const float v1[2], const float v2[2], const float
}
/* point closest to v1 on line v2-v3 in 2D */
void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2])
void closest_to_line_segment_v2(float close_r[2], const float p[2], const float l1[2], const float l2[2])
{
float lambda, cp[2];
lambda= closest_to_line_v2(cp,p, l1, l2);
if(lambda <= 0.0f)
copy_v2_v2(closest, l1);
copy_v2_v2(close_r, l1);
else if(lambda >= 1.0f)
copy_v2_v2(closest, l2);
copy_v2_v2(close_r, l2);
else
copy_v2_v2(closest, cp);
copy_v2_v2(close_r, cp);
}
/* point closest to v1 on line v2-v3 in 3D */
void closest_to_line_segment_v3(float closest[3], const float v1[3], const float v2[3], const float v3[3])
void closest_to_line_segment_v3(float close_r[3], const float v1[3], const float v2[3], const float v3[3])
{
float lambda, cp[3];
lambda= closest_to_line_v3(cp,v1, v2, v3);
if(lambda <= 0.0f)
copy_v3_v3(closest, v2);
copy_v3_v3(close_r, v2);
else if(lambda >= 1.0f)
copy_v3_v3(closest, v3);
copy_v3_v3(close_r, v3);
else
copy_v3_v3(closest, cp);
copy_v3_v3(close_r, cp);
}
/* find the closest point on a plane to another point and store it in close_r
* close_r: return coordinate
* plane_co: a point on the plane
* plane_no_unit: the plane's normal, and d is the last number in the plane equation 0 = ax + by + cz + d
* pt: the point that you want the nearest of
*/
// const float norm[3], const float coord[3], const float point[3], float dst_r[3]
void closest_to_plane_v3(float close_r[3], const float plane_co[3], const float plane_no_unit[3], const float pt[3])
{
float temp[3];
float dotprod;
sub_v3_v3v3(temp, pt, plane_co);
dotprod= dot_v3v3(temp, plane_no_unit);
close_r[0] = pt[0] - (plane_no_unit[0] * dotprod);
close_r[1] = pt[1] - (plane_no_unit[1] * dotprod);
close_r[2] = pt[2] - (plane_no_unit[2] * dotprod);
}
/* signed distance from the point to the plane in 3D */

View File

@ -8746,9 +8746,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if(ob->soft && ob->soft->vertgroup==0) {
bDeformGroup *locGroup = defgroup_find_name(ob, "SOFTGOAL");
if(locGroup){
if (locGroup) {
/* retrieve index for that group */
ob->soft->vertgroup = 1 + defgroup_find_index(ob, locGroup);
ob->soft->vertgroup = 1 + BLI_findindex(&ob->defbase, locGroup);
}
}
}

View File

@ -137,6 +137,27 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(CURVE_OT_cyclic_toggle);
}
void ED_operatormacros_curve(void)
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
ot= WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Duplicate curve and move";
WM_operatortype_macro_define(ot, "CURVE_OT_duplicate");
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", 0);
ot= WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Extrude curve and move result";
otmacro= WM_operatortype_macro_define(ot, "CURVE_OT_extrude");
RNA_enum_set(otmacro->ptr, "type", 1);
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
RNA_boolean_set(otmacro->ptr, "mirror", 0);
}
void ED_keymap_curve(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
@ -214,8 +235,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
RNA_boolean_set(WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
WM_keymap_add_item(keymap, "CURVE_OT_separate", PKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_extrude", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_make_segment", FKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_cyclic_toggle", CKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_delete", XKEY, KM_PRESS, 0, 0);

View File

@ -4716,18 +4716,6 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if(extrude_exec(C, op) == OPERATOR_FINISHED) {
RNA_enum_set(op->ptr, "mode", TFM_TRANSLATION);
WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
}
void CURVE_OT_extrude(wmOperatorType *ot)
{
/* identifiers */
@ -4737,7 +4725,6 @@ void CURVE_OT_extrude(wmOperatorType *ot)
/* api callbacks */
ot->exec= extrude_exec;
ot->invoke= extrude_invoke;
ot->poll= ED_operator_editsurfcurve;
/* flags */
@ -5599,16 +5586,6 @@ static int duplicate_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
duplicate_exec(C, op);
RNA_enum_set(op->ptr, "mode", TFM_TRANSLATION);
WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
return OPERATOR_FINISHED;
}
void CURVE_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
@ -5618,14 +5595,10 @@ void CURVE_OT_duplicate(wmOperatorType *ot)
/* api callbacks */
ot->exec= duplicate_exec;
ot->invoke= duplicate_invoke;
ot->poll= ED_operator_editsurfcurve;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
}
/********************** delete operator *********************/

View File

@ -47,6 +47,7 @@ struct BPoint;
/* curve_ops.c */
void ED_operatortypes_curve(void);
void ED_operatormacros_curve(void);
void ED_keymap_curve (struct wmKeyConfig *keyconf);
/* editcurve.c */

File diff suppressed because it is too large Load Diff

View File

@ -383,7 +383,7 @@ typedef struct UndoImageTile {
void *rect;
int x, y;
short source;
short source, use_float;
char gen_type;
} UndoImageTile;
@ -413,11 +413,13 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
int allocsize;
short use_float = ibuf->rect_float ? 1 : 0;
for(tile=lb->first; tile; tile=tile->next)
if(tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
if(strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0)
return tile->rect;
if(tile->use_float == use_float)
if(strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0)
return tile->rect;
if (*tmpibuf==NULL)
*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect);
@ -435,6 +437,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
tile->gen_type= ima->gen_type;
tile->source= ima->source;
tile->use_float= use_float;
undo_copy_tile(tile, *tmpibuf, ibuf, 0);
undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize);
@ -455,6 +458,8 @@ static void image_undo_restore(bContext *C, ListBase *lb)
IB_rectfloat|IB_rect);
for(tile=lb->first; tile; tile=tile->next) {
short use_float;
/* find image based on name, pointer becomes invalid with global undo */
if(ima && strcmp(tile->idname, ima->id.name)==0) {
/* ima is valid */
@ -464,6 +469,7 @@ static void image_undo_restore(bContext *C, ListBase *lb)
}
ibuf= BKE_image_get_ibuf(ima, NULL);
use_float = ibuf->rect_float ? 1 : 0;
if(ima && ibuf && strcmp(tile->ibufname, ibuf->name)!=0) {
/* current ImBuf filename was changed, probably current frame
@ -480,6 +486,9 @@ static void image_undo_restore(bContext *C, ListBase *lb)
if (ima->gen_type != tile->gen_type || ima->source != tile->source)
continue;
if (use_float != tile->use_float)
continue;
undo_copy_tile(tile, tmpibuf, ibuf, 1);
GPU_free_image(ima); /* force OpenGL reload */

View File

@ -1432,15 +1432,15 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const char *
/* change the weights back to the wv's weights
* it assumes you already have the correct pointer index */
static void reset_to_prev(MDeformVert *wv, MDeformVert *dvert)
static void defvert_reset_to_prev(MDeformVert *dv_prev, MDeformVert *dv)
{
MDeformWeight *dw= dvert->dw;
MDeformWeight *w;
MDeformWeight *dw= dv->dw;
MDeformWeight *dw_prev;
unsigned int i;
for (i= dvert->totweight; i != 0; i--, dw++) {
w= defvert_find_index(wv, dw->def_nr);
for (i= dv->totweight; i != 0; i--, dw++) {
dw_prev= defvert_find_index(dv_prev, dw->def_nr);
/* if there was no w when there is a d, then the old weight was 0 */
dw->weight = w ? w->weight : 0.0f;
dw->weight = dw_prev ? dw_prev->weight : 0.0f;
}
}
@ -1652,7 +1652,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
if( testw > tuw->weight ) {
if(change > oldChange) {
/* reset the weights and use the new change */
reset_to_prev(wp->wpaint_prev+index, dv);
defvert_reset_to_prev(wp->wpaint_prev+index, dv);
}
else {
/* the old change was more significant, so set
@ -1662,7 +1662,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
}
else {
if(change < oldChange) {
reset_to_prev(wp->wpaint_prev+index, dv);
defvert_reset_to_prev(wp->wpaint_prev+index, dv);
}
else {
change = 0;
@ -1677,7 +1677,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
}
if(apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) {
reset_to_prev(&dv_copy, dv);
defvert_reset_to_prev(&dv_copy, dv);
change = 0;
oldChange = 0;
}
@ -1918,7 +1918,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
}
else {
ob->actdef= 1 + defgroup_find_index(ob, dg);
ob->actdef= 1 + BLI_findindex(&ob->defbase, dg);
BLI_assert(ob->actdef >= 0);
}
}

View File

@ -132,6 +132,7 @@ void ED_spacetypes_init(void)
ED_operatormacros_graph();
ED_operatormacros_action();
ED_operatormacros_clip();
ED_operatormacros_curve();
/* register dropboxes (can use macros) */
spacetypes = BKE_spacetypes_list();

View File

@ -688,57 +688,51 @@ static void vgroup_copy_active_to_sel(Object *ob)
}
}
static void vgroup_copy_active_to_sel_single(Object *ob, int def_nr)
static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
{
EditVert *eve_act;
MDeformVert *dvert_act;
MDeformVert *dv_act;
act_vert_def(ob, &eve_act, &dvert_act);
act_vert_def(ob, &eve_act, &dv_act);
if(dvert_act==NULL) {
if(dv_act==NULL) {
return;
}
else {
Mesh *me= ob->data;
EditMesh *em = BKE_mesh_get_editmesh(me);
EditVert *eve;
MDeformVert *dvert;
MDeformVert *dv;
MDeformWeight *dw;
float act_weight = -1.0f;
int i;
float weight_act;
int index= 0;
for(i=0, dw=dvert_act->dw; i < dvert_act->totweight; i++, dw++) {
if(def_nr == dw->def_nr) {
act_weight= dw->weight;
break;
}
}
dw= defvert_find_index(dv_act, def_nr);
if(act_weight < -0.5f)
if(dw == NULL)
return;
for(eve= em->verts.first; eve; eve= eve->next, index++) {
if(eve->f & SELECT && eve != eve_act) {
dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
if(dvert) {
for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) {
if(def_nr == dw->def_nr) {
dw->weight= act_weight;
weight_act= dw->weight;
if(me->editflag & ME_EDIT_MIRROR_X)
editvert_mirror_update(ob, eve, -1, index);
for (eve= em->verts.first; eve; eve= eve->next, index++) {
if (eve->f & SELECT && eve != eve_act) {
dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
if(dv) {
dw= defvert_find_index(dv, def_nr);
if (dw) {
dw->weight= weight_act;
break;
if (me->editflag & ME_EDIT_MIRROR_X) {
editvert_mirror_update(ob, eve, -1, index);
}
}
}
}
}
if(me->editflag & ME_EDIT_MIRROR_X)
if (me->editflag & ME_EDIT_MIRROR_X) {
editvert_mirror_update(ob, eve_act, -1, -1);
}
}
}
@ -808,14 +802,15 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
Object *ob= OBACT;
EditVert *eve;
MDeformVert *dvert;
MDeformVert *dv;
act_vert_def(ob, &eve, &dvert);
act_vert_def(ob, &eve, &dv);
if(dvert && dvert->totweight) {
if(dv && dv->totweight) {
uiLayout *col;
bDeformGroup *dg;
int i;
MDeformWeight *dw = dv->dw;
unsigned int i;
int yco = 0;
uiBlockSetHandleFunc(block, do_view3d_vgroup_buttons, NULL);
@ -825,11 +820,11 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
uiBlockBeginAlign(block);
for (i=0; i<dvert->totweight; i++){
dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
for (i= dv->totweight; i != 0; i--, dw++) {
dg = BLI_findlink (&ob->defbase, dw->def_nr);
if(dg) {
uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + dvert->dw[i].def_nr, dg->name, 0, yco, 180, 20, &dvert->dw[i].weight, 0.0, 1.0, 1, 3, "");
uiDefBut(block, BUT, B_VGRP_PNL_COPY_SINGLE + dvert->dw[i].def_nr, "C", 180,yco,20,20, NULL, 0, 0, 0, 0, "Copy this groups weight to other selected verts");
uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + dw->def_nr, dg->name, 0, yco, 180, 20, &dw->weight, 0.0, 1.0, 1, 3, "");
uiDefBut(block, BUT, B_VGRP_PNL_COPY_SINGLE + dw->def_nr, "C", 180,yco,20,20, NULL, 0, 0, 0, 0, "Copy this groups weight to other selected verts");
yco -= 20;
}
}

View File

@ -61,6 +61,8 @@ int GPU_print_error(const char *str);
int GPU_glsl_support(void);
int GPU_non_power_of_two_support(void);
int GPU_color_depth(void);
void GPU_code_generate_glsl_lib(void);
int GPU_bicubic_bump_support(void);
/* GPU Types */

View File

@ -59,6 +59,10 @@
extern char datatoc_gpu_shader_material_glsl[];
extern char datatoc_gpu_shader_vertex_glsl[];
static char *glsl_material_library = NULL;
/* structs and defines */
static const char* GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4",
@ -229,7 +233,7 @@ GPUFunction *GPU_lookup_function(const char *name)
{
if(!FUNCTION_HASH) {
FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "GPU_lookup_function gh");
gpu_parse_functions_string(FUNCTION_HASH, datatoc_gpu_shader_material_glsl);
gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);
/*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);
FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/
}
@ -248,6 +252,9 @@ void GPU_extensions_exit(void)
BLI_ghash_free(FUNCTION_HASH, NULL, (GHashValFreeFP)MEM_freeN);
FUNCTION_HASH = NULL;
}
if(glsl_material_library)
MEM_freeN(glsl_material_library);
/*if(FUNCTION_PROTOTYPES) {
MEM_freeN(FUNCTION_PROTOTYPES);
FUNCTION_PROTOTYPES = NULL;
@ -640,6 +647,35 @@ static char *code_generate_vertex(ListBase *nodes)
return code;
}
int GPU_bicubic_bump_support(void){
return GLEW_ARB_texture_gather && GLEW_ARB_texture_query_lod && GLEW_VERSION_3_0;
}
void GPU_code_generate_glsl_lib(void){
DynStr *ds;
/* only initialize the library once */
if(glsl_material_library)
return;
ds = BLI_dynstr_new();
if(GPU_bicubic_bump_support()){
BLI_dynstr_append(ds, "/* These are needed for high quality bump mapping */\n"
"#version 130\n"
"#extension GL_ARB_texture_gather: enable\n"
"#extension GL_ARB_texture_query_lod: enable\n"
"#define BUMP_BICUBIC\n");
}
BLI_dynstr_append(ds, datatoc_gpu_shader_material_glsl);
glsl_material_library = BLI_dynstr_get_cstring(ds);
BLI_dynstr_free(ds);
}
/* GPU pass binding/unbinding */
GPUShader *GPU_pass_shader(GPUPass *pass)
@ -1318,7 +1354,7 @@ GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttri
/* generate code and compile with opengl */
fragmentcode = code_generate_fragment(nodes, outlink->output, name);
vertexcode = code_generate_vertex(nodes);
shader = GPU_shader_create(vertexcode, fragmentcode, datatoc_gpu_shader_material_glsl); /*FUNCTION_LIB);*/
shader = GPU_shader_create(vertexcode, fragmentcode, glsl_material_library); /*FUNCTION_LIB);*/
/* failed? */
if (!shader) {
@ -1335,7 +1371,7 @@ GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttri
pass->shader = shader;
pass->fragmentcode = fragmentcode;
pass->vertexcode = vertexcode;
pass->libcode = datatoc_gpu_shader_material_glsl;
pass->libcode = glsl_material_library;
/* extract dynamic inputs and throw away nodes */
GPU_nodes_extract_dynamic_inputs(pass, nodes);

View File

@ -1086,7 +1086,7 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link(mat, "mtex_blend_normal", tnorfac, shi->vn, newnor, &shi->vn);
}
} else if( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) || found_deriv_map) {
} else if( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) || found_deriv_map) {
/* ntap bumpmap image */
int iBumpSpace;
float ima_x, ima_y;
@ -1184,10 +1184,21 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link( mat, "mtex_bump_tap3",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
else
GPU_link( mat, "mtex_bump_tap5",
else if( mtex->texflag & MTEX_5TAP_BUMP )
GPU_link( mat, "mtex_bump_tap5",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
else if( mtex->texflag & MTEX_BICUBIC_BUMP ){
if(GPU_bicubic_bump_support()){
GPU_link( mat, "mtex_bump_bicubic",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
}else{
GPU_link( mat, "mtex_bump_tap5",
texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
&dBs, &dBt );
}
}
if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {

View File

@ -1152,8 +1152,8 @@ void mtex_bump_init_objspace( vec3 surf_pos, vec3 surf_norm,
out float fPrevMagnitude_out, out vec3 vNacc_out,
out vec3 vR1, out vec3 vR2, out float fDet )
{
mat3 obj2view = to_mat3(mView * mObj);
mat3 view2obj = to_mat3(mObjInv * mViewInv);
mat3 obj2view = to_mat3(gl_ModelViewMatrix);
mat3 view2obj = to_mat3(gl_ModelViewMatrixInverse);
vec3 vSigmaS = view2obj * dFdx( surf_pos );
vec3 vSigmaT = view2obj * dFdy( surf_pos );
@ -1225,6 +1225,84 @@ void mtex_bump_tap3( vec3 texco, sampler2D ima, float hScale,
dBt = hScale * (Hul - Hll);
}
#ifdef BUMP_BICUBIC
void mtex_bump_bicubic( vec3 texco, sampler2D ima, float hScale,
out float dBs, out float dBt )
{
vec2 TexDx = dFdx(texco.xy);
vec2 TexDy = dFdy(texco.xy);
vec2 STl = texco.xy - 0.5 * TexDx ;
vec2 STr = texco.xy + 0.5 * TexDx ;
vec2 STd = texco.xy - 0.5 * TexDy ;
vec2 STu = texco.xy + 0.5 * TexDy ;
float Hl = texture2D(ima, STl).x;
float Hr = texture2D(ima, STr).x;
float Hd = texture2D(ima, STd).x;
float Hu = texture2D(ima, STu).x;
vec2 dHdxy = vec2(Hr - Hl, Hu - Hd);
float fBlend = clamp(1.0-textureQueryLOD(ima, texco.xy).x, 0.0, 1.0);
if(fBlend!=0.0)
{
// the derivative of the bicubic sampling of level 0
ivec2 vDim;
vDim = textureSize(ima, 0);
vec2 fTexLoc = vDim*texco.xy-vec2(0.5,0.5);
ivec2 iTexLoc = ivec2(floor(fTexLoc));
vec2 t = clamp(fTexLoc - iTexLoc, 0.0, 1.0); // sat just to be pedantic
ivec2 iTexLocMod = iTexLoc + ivec2(-1, -1);
/*******************************************************************************************
* This block will replace the one below when one channel textures are properly supported. *
*******************************************************************************************
vec4 vSamplesUL = textureGather(ima, (iTexLoc+ivec2(-1,-1) + vec2(0.5,0.5))/vDim );
vec4 vSamplesUR = textureGather(ima, (iTexLoc+ivec2(1,-1) + vec2(0.5,0.5))/vDim );
vec4 vSamplesLL = textureGather(ima, (iTexLoc+ivec2(-1,1) + vec2(0.5,0.5))/vDim );
vec4 vSamplesLR = textureGather(ima, (iTexLoc+ivec2(1,1) + vec2(0.5,0.5))/vDim );
mat4 H = mat4(vSamplesUL.w, vSamplesUL.x, vSamplesLL.w, vSamplesLL.x,
vSamplesUL.z, vSamplesUL.y, vSamplesLL.z, vSamplesLL.y,
vSamplesUR.w, vSamplesUR.x, vSamplesLR.w, vSamplesLR.x,
vSamplesUR.z, vSamplesUR.y, vSamplesLR.z, vSamplesLR.y);
*/
mat4 H;
for(int i = 0; i < 4; i++){
for(int j = 0; j < 4; j++){
mtex_rgbtoint(texelFetch(ima, (iTexLocMod + ivec2(i,j)), 0), H[i][j]);
}
}
float x = t.x, y = t.y;
float x2 = x * x, x3 = x2 * x, y2 = y * y, y3 = y2 * y;
vec4 X = vec4(-0.5*(x3+x)+x2, 1.5*x3-2.5*x2+1, -1.5*x3+2*x2+0.5*x, 0.5*(x3-x2));
vec4 Y = vec4(-0.5*(y3+y)+y2, 1.5*y3-2.5*y2+1, -1.5*y3+2*y2+0.5*y, 0.5*(y3-y2));
vec4 dX = vec4(-1.5*x2+2*x-0.5, 4.5*x2-5*x, -4.5*x2+4*x+0.5, 1.5*x2-x);
vec4 dY = vec4(-1.5*y2+2*y-0.5, 4.5*y2-5*y, -4.5*y2+4*y+0.5, 1.5*y2-y);
// complete derivative in normalized coordinates (mul by vDim)
vec2 dHdST = vDim * vec2(dot(Y, H * dX), dot(dY, H * X));
// transform derivative to screen-space
vec2 dHdxy_bicubic = vec2( dHdST.x * TexDx.x + dHdST.y * TexDx.y,
dHdST.x * TexDy.x + dHdST.y * TexDy.y );
// blend between the two
dHdxy = dHdxy*(1-fBlend) + dHdxy_bicubic*fBlend;
}
dBs = hScale * dHdxy.x;
dBt = hScale * dHdxy.y;
}
#endif
void mtex_bump_tap5( vec3 texco, sampler2D ima, float hScale,
out float dBs, out float dBt )
{

File diff suppressed because it is too large Load Diff

View File

@ -198,7 +198,8 @@ typedef enum IMB_Timecode_Type {
record date and time written by recording
device (*every* consumer camcorder can do
that :) )*/
IMB_TC_MAX_SLOT = 3
IMB_TC_RECORD_RUN_NO_GAPS = 8,
IMB_TC_MAX_SLOT = 8
} IMB_Timecode_Type;
typedef enum IMB_Proxy_Size {

View File

@ -52,8 +52,11 @@ static int proxy_sizes[] = { IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75,
static float proxy_fac[] = { 0.25, 0.50, 0.75, 1.00 };
#ifdef WITH_FFMPEG
static int tc_types[] = { IMB_TC_RECORD_RUN, IMB_TC_FREE_RUN,
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN };
static int tc_types[] = { IMB_TC_RECORD_RUN,
IMB_TC_FREE_RUN,
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN,
IMB_TC_RECORD_RUN_NO_GAPS,
};
#endif
#define INDEX_FILE_VERSION 1
@ -102,7 +105,7 @@ anim_index_builder * IMB_index_builder_create(const char * name)
}
void IMB_index_builder_add_entry(anim_index_builder * fp,
int frameno,unsigned long long seek_pos,
int frameno, unsigned long long seek_pos,
unsigned long long seek_pos_dts,
unsigned long long pts)
{
@ -344,6 +347,8 @@ int IMB_timecode_to_array_index(IMB_Timecode_Type tc)
return 1;
case IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN:
return 2;
case IMB_TC_RECORD_RUN_NO_GAPS:
return 3;
default:
return 0;
};
@ -401,8 +406,10 @@ static void get_tc_filename(struct anim * anim, IMB_Timecode_Type tc,
char index_dir[FILE_MAXDIR];
int i = IMB_timecode_to_array_index(tc);
const char * index_names[] = {
"record_run%s.blen_tc", "free_run%s.blen_tc",
"interp_free_run%s.blen_tc" };
"record_run%s.blen_tc",
"free_run%s.blen_tc",
"interp_free_run%s.blen_tc",
"record_run_no_gaps%s.blen_tc"};
char stream_suffix[20];
char index_name[256];
@ -696,7 +703,7 @@ static int index_rebuild_ffmpeg(struct anim * anim,
unsigned long long start_pts = 0;
double frame_rate;
double pts_time_base;
int frameno = 0;
int frameno = 0, frameno_gapless = 0;
int start_pts_set = FALSE;
AVFormatContext *iFormatCtx;
@ -858,13 +865,21 @@ static int index_rebuild_ffmpeg(struct anim * anim,
for (i = 0; i < num_indexers; i++) {
if (tcs_in_use & tc_types[i]) {
int tc_frameno = frameno;
if(tc_types[i] == IMB_TC_RECORD_RUN_NO_GAPS)
tc_frameno = frameno_gapless;
IMB_index_builder_proc_frame(
indexer[i],
next_packet.data,
next_packet.size,
frameno, s_pos, s_dts, pts);
tc_frameno,
s_pos, s_dts, pts);
}
}
frameno_gapless++;
}
av_free_packet(&next_packet);
}

View File

@ -309,7 +309,8 @@ typedef struct SpeedControlVars {
#define SEQ_PROXY_TC_RECORD_RUN 1
#define SEQ_PROXY_TC_FREE_RUN 2
#define SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN 4
#define SEQ_PROXY_TC_ALL 7
#define SEQ_PROXY_TC_RECORD_RUN_NO_GAPS 8
#define SEQ_PROXY_TC_ALL 15
/* seq->type WATCH IT: SEQ_EFFECT BIT is used to determine if this is an effect strip!!! */
#define SEQ_IMAGE 0

View File

@ -494,6 +494,7 @@ typedef struct ColorMapping {
#define MTEX_BUMP_OBJECTSPACE 1024
#define MTEX_BUMP_TEXTURESPACE 2048
/* #define MTEX_BUMP_FLIPPED 4096 */ /* UNUSED */
#define MTEX_BICUBIC_BUMP 8192
/* blendtype */
#define MTEX_BLEND 0

View File

@ -413,8 +413,10 @@ static void rna_def_material_mtex(BlenderRNA *brna)
static EnumPropertyItem prop_bump_method_items[] = {
{0, "BUMP_ORIGINAL", 0, "Original", ""},
{MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""},
{MTEX_3TAP_BUMP, "BUMP_DEFAULT", 0, "Default", ""},
{MTEX_5TAP_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", ""},
{MTEX_3TAP_BUMP, "BUMP_LOW_QUALITY", 0, "Low Quality", "Use 3 tap filtering"},
{MTEX_5TAP_BUMP, "BUMP_MEDIUM_QUALITY", 0, "Medium Quality", "Use 5 tap filtering"},
{MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering. Requires OpenGL 3.0+. "
"It will fall back on medium setting for other systems"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_bump_space_items[] = {

View File

@ -359,7 +359,7 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
}
Mesh *me = (Mesh*)ob->data;
int group_index = defgroup_find_index(ob, group);
int group_index = BLI_findlink(&ob->defbase, group);
if (group_index == -1) {
BKE_report(reports, RPT_ERROR, "No deform groups assigned to mesh");
return;

View File

@ -822,6 +822,9 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
{SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
"Interpolate a global timestamp using the "
"record date and time written by recording device"},
{SEQ_PROXY_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps",
"Record run, but ignore timecode, "
"changes in framerate or dropouts"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "SequenceProxy", NULL);

View File

@ -200,11 +200,11 @@ static void sphere_do(
* with or w/o a vgroup. With lots of if's in the code below,
* further optimizations are possible, if needed */
if (dvert) { /* with a vgroup */
MDeformVert *dv= dvert;
float fac_orig = fac;
for (i = 0; i < numVerts; i++) {
MDeformWeight *dw = NULL;
int j;
for (i = 0; i < numVerts; i++, dv++) {
float tmp_co[3];
float weight;
copy_v3_v3(tmp_co, vertexCos[i]);
if(ctrl_ob) {
@ -224,15 +224,10 @@ static void sphere_do(
if (len_v3(vec) > cmd->radius) continue;
}
for (j = 0; j < dvert[i].totweight; ++j) {
if(dvert[i].dw[j].def_nr == defgrp_index) {
dw = &dvert[i].dw[j];
break;
}
}
if (!dw) continue;
weight= defvert_find_weight(dv, defgrp_index);
if (weight <= 0.0f) continue;
fac = fac_orig * dw->weight;
fac = fac_orig * weight;
facm = 1.0f - fac;
normalize_v3(vec);

View File

@ -249,15 +249,25 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
HookModifierData *hmd = (HookModifierData*) md;
deformVerts_do(hmd, ob, derivedData, vertexCos, numVerts);
DerivedMesh *dm = derivedData;
/* We need a valid dm for meshes when a vgroup is set... */
if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
dm = get_dm(ob, NULL, dm, NULL, 0);
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
if(derivedData != dm)
dm->release(dm);
}
static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
HookModifierData *hmd = (HookModifierData*) md;
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
DerivedMesh *dm = derivedData;
/* We need a valid dm for meshes when a vgroup is set... */
if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
dm = get_dm(ob, editData, dm, NULL, 0);
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);

View File

@ -188,7 +188,6 @@ static void meshdeformModifier_do(
struct EditMesh *em = (me)? BKE_mesh_get_editmesh(me): NULL;
DerivedMesh *tmpdm, *cagedm;
MDeformVert *dvert = NULL;
MDeformWeight *dw;
MDefInfluence *influences;
int *offsets;
float imat[4][4], cagemat[4][4], iobmat[4][4], icagemat[3][3], cmat[4][4];
@ -293,21 +292,14 @@ static void meshdeformModifier_do(
continue;
if(dvert) {
for(dw=NULL, a=0; a<dvert[b].totweight; a++) {
if(dvert[b].dw[a].def_nr == defgrp_index) {
dw = &dvert[b].dw[a];
break;
}
fac= defvert_find_weight(&dvert[b], defgrp_index);
if (mmd->flag & MOD_MDEF_INVERT_VGROUP) {
fac= 1.0f - fac;
}
if(mmd->flag & MOD_MDEF_INVERT_VGROUP) {
if(!dw) fac= 1.0f;
else if(dw->weight == 1.0f) continue;
else fac=1.0f-dw->weight;
}
else {
if(!dw) continue;
else fac= dw->weight;
if (fac <= 0.0) {
continue;
}
}

View File

@ -154,24 +154,19 @@ static void smoothModifier_do(
}
if (dvert) {
for (i = 0; i < numVerts; i++) {
MDeformWeight *dw = NULL;
MDeformVert *dv= dvert;
for (i = 0; i < numVerts; i++, dv++) {
float f, fm, facw, *fp, *v;
int k;
short flag = smd->flag;
v = vertexCos[i];
fp = &ftmp[i*3];
for (k = 0; k < dvert[i].totweight; ++k) {
if(dvert[i].dw[k].def_nr == defgrp_index) {
dw = &dvert[i].dw[k];
break;
}
}
if (!dw) continue;
f = fac * dw->weight;
f= defvert_find_weight(dv, defgrp_index);
if (f <= 0.0f) continue;
f *= fac;
fm = 1.0f - f;
/* fp is the sum of uctmp[i] verts, so must be averaged */

View File

@ -2191,7 +2191,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP);
use_compat_bump= (mtex->texflag & MTEX_COMPAT_BUMP);
use_ntap_bump= ((mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP))!=0 || found_deriv_map!=0) ? 1 : 0;
use_ntap_bump= ((mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP))!=0 || found_deriv_map!=0) ? 1 : 0;
/* XXX texture node trees don't work for this yet */
if(tex->nodetree && tex->use_nodes) {

View File

@ -176,6 +176,7 @@ void WM_init(bContext *C, int argc, const char **argv)
GPU_extensions_init();
GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
GPU_set_anisotropic(U.anisotropic_filter);
GPU_code_generate_glsl_lib();
UI_init();
}

View File

@ -237,12 +237,12 @@ void BL_SkinDeformer::BGEDeformVerts()
}
}
MDeformVert *dv= dverts;
for (int i=0; i<m_bmesh->totvert; ++i)
for (int i=0; i<m_bmesh->totvert; ++i, dv++)
{
float contrib = 0.f, weight, max_weight=0.f;
bPoseChannel *pchan=NULL;
MDeformVert *dvert;
Eigen::Map<Eigen::Vector3f> norm(m_transnors[i]);
Eigen::Vector4f vec(0, 0, 0, 1);
Eigen::Matrix4f norm_chan_mat;
@ -251,18 +251,18 @@ void BL_SkinDeformer::BGEDeformVerts()
m_transverts[i][2],
1.f);
dvert = dverts+i;
if (!dvert->totweight)
if (!dv->totweight)
continue;
for (int j=0; j<dvert->totweight; ++j)
MDeformWeight *dw= dv->dw;
for (unsigned int j= dv->totweight; j != 0; j--, dw++)
{
int index = dvert->dw[j].def_nr;
const int index = dw->def_nr;
if (index < defbase_tot && (pchan=m_dfnrToPC[index]))
{
weight = dvert->dw[j].weight;
weight = dw->weight;
if (weight)
{

View File

@ -29,6 +29,7 @@ set(INC
../Ketsji
../SceneGraph
../../blender/makesdna
../../blender/blenkernel
../../../intern/container
../../../intern/guardedalloc
../../../intern/moto/include

View File

@ -43,6 +43,10 @@
#include <algorithm>
extern "C" {
# include "BKE_deform.h"
}
/* polygon sorting */
struct RAS_MeshObject::polygonSlot
@ -573,8 +577,8 @@ void RAS_MeshObject::CheckWeightCache(Object* obj)
{
KeyBlock *kb;
int kbindex, defindex;
MDeformVert *dvert= NULL;
int totvert, i, j;
MDeformVert *dv= NULL;
int totvert, i;
float *weights;
if (!m_mesh->key)
@ -598,19 +602,15 @@ void RAS_MeshObject::CheckWeightCache(Object* obj)
kb->weights = NULL;
}
dvert= m_mesh->dvert;
dv= m_mesh->dvert;
totvert= m_mesh->totvert;
weights= (float*)MEM_callocN(totvert*sizeof(float), "weights");
weights= (float*)MEM_mallocN(totvert*sizeof(float), "weights");
for (i=0; i < totvert; i++, dvert++) {
for(j=0; j<dvert->totweight; j++) {
if (dvert->dw[j].def_nr == defindex) {
weights[i]= dvert->dw[j].weight;
break;
}
}
for (i=0; i < totvert; i++, dv++) {
weights[i]= defvert_find_weight(dv, defindex);
}
kb->weights = weights;
m_cacheWeightIndex[kbindex] = defindex;
}