svn merge ^/trunk/blender -r46463:HEAD

This commit is contained in:
Ove Murberg Henriksen 2012-05-11 19:26:43 +00:00
commit 736c0ca6e0
166 changed files with 7883 additions and 5275 deletions

@ -195,7 +195,6 @@ option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering"
# Audio/Video format support
option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
unset(PLATFORM_DEFAULT)
option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
if(APPLE OR (WIN32 AND NOT UNIX))
@ -372,7 +371,7 @@ if(MINGW)
"line if youre a developer who wants to add support.")
endif()
if((WITH_MINGW64) AND (WITH_OPENCOLLADA OR WITH_CODEC_FFMPEG))
if((WITH_MINGW64) AND (WITH_OPENCOLLADA))
message(FATAL_ERROR "MINGW64 still doesn't support: WITH_OPENCOLLADA/WITH_CODEC_FFMPEG")
endif()
endif()
@ -1089,7 +1088,11 @@ elseif(WIN32)
if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg)
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include)
set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
if(WITH_MINGW64)
set(FFMPEG_LIBRARIES avcodec.dll avformat.dll avdevice.dll avutil.dll swscale.dll swresample.dll)
else()
set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
endif()
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()

@ -16,11 +16,11 @@ BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_FFMPEG = False # TODO: FFmpeg gives linking errors, need to compile with MinGW-w64?
BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2'
WITH_BF_FFMPEG = True
BF_FFMPEG_LIB = 'avformat.dll avcodec.dll avdevice.dll avutil.dll swscale.dll swresample.dll'
BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll ${BF_FFMPEG_LIBPATH}/xvidcore.dll'
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
@ -137,14 +137,14 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
WITH_BF_COLLADA = False # TODO: Compile Collada with MinGW-w64
WITH_BF_COLLADA = True
BF_COLLADA = '#source/blender/collada'
BF_COLLADA_INC = '${BF_COLLADA}'
BF_COLLADA_LIB = 'bf_collada'
BF_OPENCOLLADA = LIBDIR + '/opencollada'
BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa xml'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
#Cycles

@ -35,115 +35,115 @@ set(INC_SYS
)
set(SRC
lib/intersection.cpp
lib/intersect.cpp
lib/triangulator.cpp
lib/aabb.cpp
lib/carve.cpp
lib/convex_hull.cpp
lib/csg_collector.cpp
lib/csg.cpp
lib/edge.cpp
lib/face.cpp
lib/geom2d.cpp
lib/geom3d.cpp
lib/intersect_classify_edge.cpp
lib/intersect_classify_group.cpp
lib/intersect.cpp
lib/intersect_debug.cpp
lib/intersect_face_division.cpp
lib/intersect_group.cpp
lib/intersect_half_classify_group.cpp
lib/intersection.cpp
lib/math.cpp
lib/mesh.cpp
lib/octree.cpp
lib/pointset.cpp
lib/polyhedron.cpp
lib/polyline.cpp
lib/pointset.cpp
lib/geom2d.cpp
lib/math.cpp
lib/intersect_half_classify_group.cpp
lib/intersect_face_division.cpp
lib/tag.cpp
lib/aabb.cpp
lib/intersect_classify_group.cpp
lib/mesh.cpp
lib/timing.cpp
lib/geom3d.cpp
lib/intersect_group.cpp
lib/carve.cpp
lib/intersect_classify_edge.cpp
lib/csg.cpp
lib/face.cpp
lib/csg_collector.cpp
lib/intersect_debug.cpp
lib/edge.cpp
lib/octree.cpp
lib/triangulator.cpp
lib/intersect_debug.hpp
lib/csg_collector.hpp
lib/csg_data.hpp
lib/intersect_classify_common.hpp
lib/intersect_common.hpp
lib/csg_detail.hpp
lib/intersect_classify_common.hpp
lib/intersect_classify_common_impl.hpp
lib/intersect_common.hpp
lib/intersect_debug.hpp
include/carve/vertex_impl.hpp
include/carve/aabb_impl.hpp
include/carve/csg.hpp
include/carve/pointset_iter.hpp
include/carve/debug_hooks.hpp
include/carve/mesh.hpp
include/carve/triangulator_impl.hpp
include/carve/edge_decl.hpp
include/carve/collection/unordered.hpp
include/carve/collection/unordered/tr1_impl.hpp
include/carve/collection/unordered/fallback_impl.hpp
include/carve/collection/unordered/std_impl.hpp
include/carve/collection/unordered/vcpp_impl.hpp
include/carve/collection/unordered/libstdcpp_impl.hpp
include/carve/collection/unordered/boost_impl.hpp
include/carve/convex_hull.hpp
include/carve/geom.hpp
include/carve/collection_types.hpp
include/carve/cbrt.h
include/carve/util.hpp
include/carve/iobj.hpp
include/carve/polyline_decl.hpp
include/carve/polyline_impl.hpp
include/carve/win32.h
include/carve/edge_impl.hpp
include/carve/carve.hpp
include/carve/polyline.hpp
include/carve/face_decl.hpp
include/carve/matrix.hpp
include/carve/classification.hpp
include/carve/geom_impl.hpp
include/carve/faceloop.hpp
include/carve/mesh_ops.hpp
include/carve/tree.hpp
include/carve/geom2d.hpp
include/carve/face_impl.hpp
include/carve/polyhedron_decl.hpp
include/carve/interpolator.hpp
include/carve/poly_decl.hpp
include/carve/mesh_impl.hpp
include/carve/gnu_cxx.h
include/carve/mesh_simplify.hpp
include/carve/triangulator.hpp
include/carve/pointset_impl.hpp
include/carve/rtree.hpp
include/carve/math_constants.hpp
include/carve/vector.hpp
include/carve/octree_impl.hpp
include/carve/pointset.hpp
include/carve/math.hpp
include/carve/intersection.hpp
include/carve/colour.hpp
include/carve/kd_node.hpp
include/carve/input.hpp
include/carve/geom3d.hpp
include/carve/exact.hpp
include/carve/rescale.hpp
include/carve/polyhedron_base.hpp
include/carve/heap.hpp
include/carve/spacetree.hpp
include/carve/polyhedron_impl.hpp
include/carve/vcpp_config.h
include/carve/aabb.hpp
include/carve/polyline_iter.hpp
include/carve/djset.hpp
include/carve/vertex_decl.hpp
include/carve/csg_triangulator.hpp
include/carve/poly.hpp
include/carve/timing.hpp
include/carve/octree_decl.hpp
include/carve/pointset_decl.hpp
include/carve/tag.hpp
include/carve/aabb_impl.hpp
include/carve/carve.hpp
include/carve/cbrt.h
include/carve/classification.hpp
include/carve/collection.hpp
include/carve/collection_types.hpp
include/carve/collection/unordered/boost_impl.hpp
include/carve/collection/unordered/fallback_impl.hpp
include/carve/collection/unordered.hpp
include/carve/collection/unordered/libstdcpp_impl.hpp
include/carve/collection/unordered/std_impl.hpp
include/carve/collection/unordered/tr1_impl.hpp
include/carve/collection/unordered/vcpp_impl.hpp
include/carve/colour.hpp
include/carve/convex_hull.hpp
include/carve/csg.hpp
include/carve/csg_triangulator.hpp
include/carve/debug_hooks.hpp
include/carve/djset.hpp
include/carve/edge_decl.hpp
include/carve/edge_impl.hpp
include/carve/exact.hpp
include/carve/face_decl.hpp
include/carve/face_impl.hpp
include/carve/faceloop.hpp
include/carve/geom2d.hpp
include/carve/geom3d.hpp
include/carve/geom.hpp
include/carve/geom_impl.hpp
include/carve/gnu_cxx.h
include/carve/heap.hpp
include/carve/input.hpp
include/carve/interpolator.hpp
include/carve/intersection.hpp
include/carve/iobj.hpp
include/carve/kd_node.hpp
include/carve/math_constants.hpp
include/carve/math.hpp
include/carve/matrix.hpp
include/carve/mesh.hpp
include/carve/mesh_impl.hpp
include/carve/mesh_ops.hpp
include/carve/mesh_simplify.hpp
include/carve/octree_decl.hpp
include/carve/octree_impl.hpp
include/carve/pointset_decl.hpp
include/carve/pointset.hpp
include/carve/pointset_impl.hpp
include/carve/pointset_iter.hpp
include/carve/poly_decl.hpp
include/carve/polyhedron_base.hpp
include/carve/polyhedron_decl.hpp
include/carve/polyhedron_impl.hpp
include/carve/poly.hpp
include/carve/poly_impl.hpp
include/carve/polyline_decl.hpp
include/carve/polyline.hpp
include/carve/polyline_impl.hpp
include/carve/polyline_iter.hpp
include/carve/rescale.hpp
include/carve/rtree.hpp
include/carve/spacetree.hpp
include/carve/tag.hpp
include/carve/timing.hpp
include/carve/tree.hpp
include/carve/triangulator.hpp
include/carve/triangulator_impl.hpp
include/carve/util.hpp
include/carve/vcpp_config.h
include/carve/vector.hpp
include/carve/vertex_decl.hpp
include/carve/vertex_impl.hpp
include/carve/win32.h
)
if(WITH_BOOST)

@ -1,7 +1,9 @@
#!/bin/sh
if [ -d ./.svn ]; then
echo "This script is supposed to work only when using git-svn"
if [ "x$1" = "x--i-really-know-what-im-doing" ] ; then
echo Proceeding as requested by command line ...
else
echo "*** Please run again with --i-really-know-what-im-doing ..."
exit 1
fi
@ -14,8 +16,8 @@ for p in `cat ./patches/series`; do
cat ./patches/$p | patch -d $tmp/carve -p1
done
rm -rf include
rm -rf lib
find include -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
find lib -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
cat "files.txt" | while read f; do
mkdir -p `dirname $f`
@ -24,9 +26,9 @@ done
rm -rf $tmp
sources=`find ./lib -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/'`
headers=`find ./lib -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/'`
includes=`find ./include -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/'`
sources=`find ./lib -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
headers=`find ./lib -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/' | sort -d`
includes=`find ./include -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/' | sort -d`
mkdir -p include/carve/external/boost
cp patches/files/random.hpp include/carve/external/boost/random.hpp

@ -647,12 +647,9 @@ void carve::csg::CSG::_generateVertexEdgeIntersections(carve::mesh::MeshSet<3>::
return;
}
if (std::min(eb->v1()->v.x, eb->v2()->v.x) - carve::EPSILON > va->v.x ||
std::max(eb->v1()->v.x, eb->v2()->v.x) + carve::EPSILON < va->v.x ||
std::min(eb->v1()->v.y, eb->v2()->v.y) - carve::EPSILON > va->v.y ||
std::max(eb->v1()->v.y, eb->v2()->v.y) + carve::EPSILON < va->v.y ||
std::min(eb->v1()->v.z, eb->v2()->v.z) - carve::EPSILON > va->v.z ||
std::max(eb->v1()->v.z, eb->v2()->v.z) + carve::EPSILON < va->v.z) {
carve::geom::aabb<3> eb_aabb;
eb_aabb.fit(eb->v1()->v, eb->v2()->v);
if (eb_aabb.maxAxisSeparation(va->v) > carve::EPSILON) {
return;
}

@ -1,3 +1,54 @@
commit b813dbe3f46bbbc7e73ac791d4665622e4fc7ba5
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed May 9 19:01:10 2012 +0600
Modal solver: Detect rigid transformation between initial frame and current
instead of detecting it between two neighbour frames.
This prevents accumulation of error and seems to be working better in footages i've tested.
commit 9254621c76daaf239ec1f535e197ca792eea97b6
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed May 9 18:57:00 2012 +0600
Backport changes made by Keir in Blender:
- Enhance logging in libmv's trackers.
- Cleanups in brute_region_tracker.cc.
commit d9c56b9d3c63f886d83129ca0ebed1e76d9c93d7
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Fri Apr 27 16:20:41 2012 +0600
Fixes for MinGW64 support by Caleb Joseph with slight modifications by Antony Riakiotakis
- Functions snprintf and sincos shouldn't be redefined for MinGW64
- Type pid_t shouldn't be re-defined for MinGW64
commit e1902b6938676011607ac99986b8b140bdbf090e
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Fri Apr 27 16:04:19 2012 +0600
Fixes for Qt calibration tool
- Passing directory with images via command line argument now isn't
required -- it there's no such directory specified standard open
dialog might be used for this (before application used to abort
due to accessing to non-existing list element).
- Conversion of source images to grayscale now happens correct.
It was needed to build grayscale palette for 8bit indexed buffer.
commit 05f1a0a78ad8ff6646d1e8da97e6f7575b891536
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Sat Apr 14 17:21:29 2012 +0600
Make QtTracker compilable again porting it to recent API change and code cleanup:
- It was using SAD tracker with own API, now it's using standard RegionTracker API
which should make it easier to switch between different trackers.
- Restored LaplaceFilter from old SAD module which convolves images with the
discrete laplacian operator.
commit a44312a7beb2963b8e3bf8015c516d2eff40cc3d
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Apr 12 13:56:02 2012 +0600
@ -503,33 +554,3 @@ Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Fri Aug 19 18:37:48 2011 +0200
Fix CMake build.
commit 2ac7281ff6b9545b425dd84fb03bf9c5c98b4de2
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Fri Aug 19 17:34:45 2011 +0200
Avoid symbol shadowing.
commit 2a7c3de4acc60e0433b4952f69e30528dbafe0d2
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Fri Aug 19 17:22:47 2011 +0200
Better dragging behavior when hitting borders.
commit a14eb3953c9521b2e08ff9ddd45b33ff1f8aeafb
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Fri Aug 19 17:12:12 2011 +0200
Update marker preview to new affine tracking.
commit 5299ea67043459eda147950e589c2d327a8fbced
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Fri Aug 19 16:05:54 2011 +0200
sqrt takes double precision.
commit 9f9221ce151d788c49b48f6f293ab2e2f8813978
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Fri Aug 19 16:04:37 2011 +0200
MSVC compatibility: heap allocate pattern, explicit float cast.

@ -1,14 +1,16 @@
#!/bin/sh
if [ "x$1" = "x--i-really-know-what-im-doing" ] ; then
echo Proceeding as requested by command line ...
else
echo "*** Please run again with --i-really-know-what-im-doing ..."
exit 1
fi
#BRANCH="keir"
#BRANCH="Matthias-Fauconneau"
BRANCH="Nazg-Gul"
if [ -d ./.svn ]; then
echo "This script is supposed to work only when using git-svn"
exit 1
fi
repo="git://github.com/${BRANCH}/libmv.git"
tmp=`mktemp -d`
@ -22,8 +24,8 @@ for p in `cat ./patches/series`; do
cat ./patches/$p | patch -d $tmp/libmv -p1
done
rm -rf libmv
rm -rf third_party
find libmv -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
find third_party -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
cat "files.txt" | while read f; do
mkdir -p `dirname $f`

@ -302,4 +302,18 @@ void BoxFilter(const Array3Df &in,
BoxFilterVertical(tmp, box_width, out);
}
void LaplaceFilter(unsigned char* src, unsigned char* dst, int width, int height, int strength) {
for(int y=1; y<height-1; y++) for(int x=1; x<width-1; x++) {
const unsigned char* s = &src[y*width+x];
int l = 128 +
s[-width-1] + s[-width] + s[-width+1] +
s[1] - 8*s[0] + s[1] +
s[ width-1] + s[ width] + s[ width+1] ;
int d = ((256-strength)*s[0] + strength*l) / 256;
if(d < 0) d=0;
if(d > 255) d=255;
dst[y*width+x] = d;
}
}
} // namespace libmv

@ -87,6 +87,16 @@ void BoxFilter(const FloatImage &in,
int box_width,
FloatImage *out);
/*!
Convolve \a src into \a dst with the discrete laplacian operator.
\a src and \a dst should be \a width x \a height images.
\a strength is an interpolation coefficient (0-256) between original image and the laplacian.
\note Make sure the search region is filtered with the same strength as the pattern.
*/
void LaplaceFilter(unsigned char* src, unsigned char* dst, int width, int height, int strength);
} // namespace libmv
#endif // LIBMV_IMAGE_CONVOLVE_H_

@ -60,19 +60,13 @@ static bool is_float_image(const string& filename)
if(in->open(filename, spec)) {
/* check the main format, and channel formats;
if any are non-integer, we'll need a float texture slot */
if(spec.format == TypeDesc::HALF ||
spec.format == TypeDesc::FLOAT ||
spec.format == TypeDesc::DOUBLE) {
if any take up more than one byte, we'll need a float texture slot */
if(spec.format.basesize() > 1)
is_float = true;
}
for(size_t channel = 0; channel < spec.channelformats.size(); channel++) {
if(spec.channelformats[channel] == TypeDesc::HALF ||
spec.channelformats[channel] == TypeDesc::FLOAT ||
spec.channelformats[channel] == TypeDesc::DOUBLE) {
if(spec.channelformats[channel].basesize() > 1)
is_float = true;
}
}
in->close();

@ -28,8 +28,6 @@ CCL_NAMESPACE_BEGIN
TaskPool::TaskPool()
{
num = 0;
num_done = 0;
do_cancel = false;
}
@ -55,9 +53,11 @@ void TaskPool::push(const TaskRunFunction& run, bool front)
void TaskPool::wait_work()
{
thread_scoped_lock done_lock(done_mutex);
thread_scoped_lock num_lock(num_mutex);
while(num != 0) {
num_lock.unlock();
while(num_done != num) {
thread_scoped_lock queue_lock(TaskScheduler::queue_mutex);
/* find task from this pool. if we get a task from another pool,
@ -81,8 +81,6 @@ void TaskPool::wait_work()
/* if found task, do it, otherwise wait until other tasks are done */
if(found_entry) {
done_lock.unlock();
/* run task */
work_entry.task->run();
@ -90,26 +88,31 @@ void TaskPool::wait_work()
delete work_entry.task;
/* notify pool task was done */
done_increase(1);
done_lock.lock();
num_decrease(1);
}
else
done_cond.wait(done_lock);
num_lock.lock();
if(num == 0)
break;
if(!found_entry)
num_cond.wait(num_lock);
}
}
void TaskPool::cancel()
{
TaskScheduler::clear(this);
do_cancel = true;
{
thread_scoped_lock lock(done_mutex);
while(num_done != num)
done_cond.wait(lock);
TaskScheduler::clear(this);
{
thread_scoped_lock num_lock(num_mutex);
while(num)
num_cond.wait(num_lock);
}
do_cancel = false;
}
@ -117,7 +120,7 @@ void TaskPool::stop()
{
TaskScheduler::clear(this);
assert(num_done == num);
assert(num == 0);
}
bool TaskPool::cancelled()
@ -125,14 +128,23 @@ bool TaskPool::cancelled()
return do_cancel;
}
void TaskPool::done_increase(int done)
void TaskPool::num_decrease(int done)
{
done_mutex.lock();
num_done += done;
done_mutex.unlock();
num_mutex.lock();
num -= done;
assert(num_done <= num);
done_cond.notify_all();
assert(num >= 0);
if(num == 0)
num_cond.notify_all();
num_mutex.unlock();
}
void TaskPool::num_increase()
{
thread_scoped_lock num_lock(num_mutex);
num++;
num_cond.notify_all();
}
/* Task Scheduler */
@ -196,10 +208,10 @@ void TaskScheduler::exit()
bool TaskScheduler::thread_wait_pop(Entry& entry)
{
thread_scoped_lock lock(queue_mutex);
thread_scoped_lock queue_lock(queue_mutex);
while(queue.empty() && !do_exit)
queue_cond.wait(lock);
queue_cond.wait(queue_lock);
if(queue.empty()) {
assert(do_exit);
@ -227,27 +239,28 @@ void TaskScheduler::thread_run(int thread_id)
delete entry.task;
/* notify pool task was done */
entry.pool->done_increase(1);
entry.pool->num_decrease(1);
}
}
void TaskScheduler::push(Entry& entry, bool front)
{
entry.pool->num_increase();
/* add entry to queue */
TaskScheduler::queue_mutex.lock();
if(front)
TaskScheduler::queue.push_front(entry);
else
TaskScheduler::queue.push_back(entry);
entry.pool->num++;
TaskScheduler::queue_mutex.unlock();
TaskScheduler::queue_cond.notify_one();
TaskScheduler::queue_mutex.unlock();
}
void TaskScheduler::clear(TaskPool *pool)
{
thread_scoped_lock lock(queue_mutex);
thread_scoped_lock queue_lock(TaskScheduler::queue_mutex);
/* erase all tasks from this pool from the queue */
list<Entry>::iterator it = queue.begin();
@ -266,8 +279,10 @@ void TaskScheduler::clear(TaskPool *pool)
it++;
}
queue_lock.unlock();
/* notify done */
pool->done_increase(done);
pool->num_decrease(done);
}
CCL_NAMESPACE_END

@ -73,12 +73,13 @@ public:
protected:
friend class TaskScheduler;
void done_increase(int done);
void num_decrease(int done);
void num_increase();
thread_mutex done_mutex;
thread_condition_variable done_cond;
thread_mutex num_mutex;
thread_condition_variable num_cond;
volatile int num, num_done;
volatile int num;
volatile bool do_cancel;
};

@ -71,3 +71,308 @@ const int facemap[6][4] = {
{0, 2, 4, 6},
{1, 3, 5, 7}
};
/**
* Method to perform cross-product
*/
static void crossProduct(int64_t res[3], const int64_t a[3], const int64_t b[3])
{
res[0] = a[1] * b[2] - a[2] * b[1];
res[1] = a[2] * b[0] - a[0] * b[2];
res[2] = a[0] * b[1] - a[1] * b[0];
}
static void crossProduct(double res[3], const double a[3], const double b[3])
{
res[0] = a[1] * b[2] - a[2] * b[1];
res[1] = a[2] * b[0] - a[0] * b[2];
res[2] = a[0] * b[1] - a[1] * b[0];
}
/**
* Method to perform dot product
*/
int64_t dotProduct(const int64_t a[3], const int64_t b[3])
{
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
void normalize(double a[3])
{
double mag = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
if (mag > 0) {
mag = sqrt(mag);
a[0] /= mag;
a[1] /= mag;
a[2] /= mag;
}
}
/* Create projection axes for cube+triangle intersection testing.
* 0, 1, 2: cube face normals
*
* 3: triangle normal
*
* 4, 5, 6,
* 7, 8, 9,
* 10, 11, 12: cross of each triangle edge vector with each cube
* face normal
*/
static void create_projection_axes(int64_t axes[NUM_AXES][3], const int64_t tri[3][3])
{
/* Cube face normals */
axes[0][0] = 1;
axes[0][1] = 0;
axes[0][2] = 0;
axes[1][0] = 0;
axes[1][1] = 1;
axes[1][2] = 0;
axes[2][0] = 0;
axes[2][1] = 0;
axes[2][2] = 1;
/* Get triangle edge vectors */
int64_t tri_edges[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++)
tri_edges[i][j] = tri[(i + 1) % 3][j] - tri[i][j];
}
/* Triangle normal */
crossProduct(axes[3], tri_edges[0], tri_edges[1]);
// Face edges and triangle edges
int ct = 4;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
crossProduct(axes[ct], axes[j], tri_edges[i]);
ct++;
}
}
}
/**
* Construction from a cube (axes aligned) and triangle
*/
CubeTriangleIsect::CubeTriangleIsect(int64_t cube[2][3], int64_t tri[3][3], int64_t error, int triind)
{
int i;
inherit = new TriangleProjection;
inherit->index = triind;
int64_t axes[NUM_AXES][3];
create_projection_axes(axes, tri);
/* Normalize face normal and store */
double dedge1[] = {(double)tri[1][0] - (double)tri[0][0],
(double)tri[1][1] - (double)tri[0][1],
(double)tri[1][2] - (double)tri[0][2]};
double dedge2[] = {(double)tri[2][0] - (double)tri[1][0],
(double)tri[2][1] - (double)tri[1][1],
(double)tri[2][2] - (double)tri[1][2]};
crossProduct(inherit->norm, dedge1, dedge2);
normalize(inherit->norm);
int64_t cubeedge[3][3];
for (i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
cubeedge[i][j] = 0;
}
cubeedge[i][i] = cube[1][i] - cube[0][i];
}
/* Project the cube on to each axis */
for (int axis = 0; axis < NUM_AXES; axis++) {
CubeProjection &cube_proj = cubeProj[axis];
/* Origin */
cube_proj.origin = dotProduct(axes[axis], cube[0]);
/* 3 direction vectors */
for (i = 0; i < 3; i++)
cube_proj.edges[i] = dotProduct(axes[axis], cubeedge[i]);
/* Offsets of 2 ends of cube projection */
int64_t max = 0;
int64_t min = 0;
for (i = 1; i < 8; i++) {
int64_t proj = (vertmap[i][0] * cube_proj.edges[0] +
vertmap[i][1] * cube_proj.edges[1] +
vertmap[i][2] * cube_proj.edges[2]);
if (proj > max) {
max = proj;
}
if (proj < min) {
min = proj;
}
}
cube_proj.min = min;
cube_proj.max = max;
}
/* Project the triangle on to each axis */
for (int axis = 0; axis < NUM_AXES; axis++) {
const int64_t vts[3] = {dotProduct(axes[axis], tri[0]),
dotProduct(axes[axis], tri[1]),
dotProduct(axes[axis], tri[2])};
// Triangle
inherit->tri_proj[axis][0] = vts[0];
inherit->tri_proj[axis][1] = vts[0];
for (i = 1; i < 3; i++) {
if (vts[i] < inherit->tri_proj[axis][0])
inherit->tri_proj[axis][0] = vts[i];
if (vts[i] > inherit->tri_proj[axis][1])
inherit->tri_proj[axis][1] = vts[i];
}
}
}
/**
* Construction
* from a parent CubeTriangleIsect object and the index of the children
*/
CubeTriangleIsect::CubeTriangleIsect(CubeTriangleIsect *parent)
{
// Copy inheritable projections
this->inherit = parent->inherit;
// Shrink cube projections
for (int i = 0; i < NUM_AXES; i++) {
cubeProj[i].origin = parent->cubeProj[i].origin;
for (int j = 0; j < 3; j++)
cubeProj[i].edges[j] = parent->cubeProj[i].edges[j] >> 1;
cubeProj[i].min = parent->cubeProj[i].min >> 1;
cubeProj[i].max = parent->cubeProj[i].max >> 1;
}
}
unsigned char CubeTriangleIsect::getBoxMask( )
{
int i, j, k;
int bmask[3][2] = {{0, 0}, {0, 0}, {0, 0}};
unsigned char boxmask = 0;
int64_t child_len = cubeProj[0].edges[0] >> 1;
for (i = 0; i < 3; i++) {
int64_t mid = cubeProj[i].origin + child_len;
// Check bounding box
if (mid >= inherit->tri_proj[i][0]) {
bmask[i][0] = 1;
}
if (mid < inherit->tri_proj[i][1]) {
bmask[i][1] = 1;
}
}
// Fill in masks
int ct = 0;
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
boxmask |= ( (bmask[0][i] & bmask[1][j] & bmask[2][k]) << ct);
ct++;
}
}
}
// Return bounding box masks
return boxmask;
}
/**
* Shifting a cube to a new origin
*/
void CubeTriangleIsect::shift(int off[3])
{
for (int i = 0; i < NUM_AXES; i++) {
cubeProj[i].origin += (off[0] * cubeProj[i].edges[0] +
off[1] * cubeProj[i].edges[1] +
off[2] * cubeProj[i].edges[2]);
}
}
/**
* Method to test intersection of the triangle and the cube
*/
int CubeTriangleIsect::isIntersecting() const
{
for (int i = 0; i < NUM_AXES; i++) {
/*
int64_t proj0 = cubeProj[i][0] +
vertmap[inherit->cubeEnds[i][0]][0] * cubeProj[i][1] +
vertmap[inherit->cubeEnds[i][0]][1] * cubeProj[i][2] +
vertmap[inherit->cubeEnds[i][0]][2] * cubeProj[i][3] ;
int64_t proj1 = cubeProj[i][0] +
vertmap[inherit->cubeEnds[i][1]][0] * cubeProj[i][1] +
vertmap[inherit->cubeEnds[i][1]][1] * cubeProj[i][2] +
vertmap[inherit->cubeEnds[i][1]][2] * cubeProj[i][3] ;
*/
int64_t proj0 = cubeProj[i].origin + cubeProj[i].min;
int64_t proj1 = cubeProj[i].origin + cubeProj[i].max;
if (proj0 > inherit->tri_proj[i][1] ||
proj1 < inherit->tri_proj[i][0]) {
return 0;
}
}
return 1;
}
int CubeTriangleIsect::isIntersectingPrimary(int edgeInd) const
{
for (int i = 0; i < NUM_AXES; i++) {
int64_t proj0 = cubeProj[i].origin;
int64_t proj1 = cubeProj[i].origin + cubeProj[i].edges[edgeInd];
if (proj0 < proj1) {
if (proj0 > inherit->tri_proj[i][1] ||
proj1 < inherit->tri_proj[i][0]) {
return 0;
}
}
else {
if (proj1 > inherit->tri_proj[i][1] ||
proj0 < inherit->tri_proj[i][0]) {
return 0;
}
}
}
// printf( "Intersecting: %d %d\n", edgemap[edgeInd][0], edgemap[edgeInd][1] ) ;
return 1;
}
float CubeTriangleIsect::getIntersectionPrimary(int edgeInd) const
{
int i = 3;
int64_t proj0 = cubeProj[i].origin;
int64_t proj1 = cubeProj[i].origin + cubeProj[i].edges[edgeInd];
int64_t proj2 = inherit->tri_proj[i][1];
int64_t d = proj1 - proj0;
double alpha;
if (d == 0)
alpha = 0.5;
else {
alpha = (double)((proj2 - proj0)) / (double)d;
if (alpha < 0 || alpha > 1)
alpha = 0.5;
}
return (float)alpha;
}

@ -32,808 +32,99 @@
#if defined(_WIN32) && !defined(__MINGW32__)
#define isnan(n) _isnan(n)
#define LONG __int64
#define int64_t __int64
#else
#include <stdint.h>
#define LONG int64_t
#endif
#define UCHAR unsigned char
/**
* Structures and classes for computing projections of triangles
* onto separating axes during scan conversion
*
* @author Tao Ju
*/
* Structures and classes for computing projections of triangles onto
* separating axes during scan conversion
*
* @author Tao Ju
*/
extern const int vertmap[8][3];
extern const int centmap[3][3][3][2];
extern const int edgemap[12][2];
extern const int facemap[6][4];
/* Axes:
* 0, 1, 2: cube face normals
*
* 3: triangle normal
*
* 4, 5, 6,
* 7, 8, 9,
* 10, 11, 12: cross of each triangle edge vector with each cube
* face normal
*/
#define NUM_AXES 13
/**
* Structure for the projections inheritable from parent
*/
struct InheritableProjections {
/// Projections of triangle
LONG trigProj[13][2];
/// Projections of triangle vertices on primary axes
LONG trigVertProj[13][3];
/// Projections of triangle edges
LONG trigEdgeProj[13][3][2];
struct TriangleProjection {
/// Projections of triangle (min and max)
int64_t tri_proj[NUM_AXES][2];
/// Normal of the triangle
double norm[3];
double normA, normB;
/// End points along each axis
//int cubeEnds[13][2] ;
/// Error range on each axis
/// LONG errorProj[13];
#ifdef CONTAINS_INDEX
/// Index of polygon
int index;
#endif
};
/* This is a projection for the cube against a single projection
axis, see CubeTriangleIsect.cubeProj */
struct CubeProjection {
int64_t origin;
int64_t edges[3];
int64_t min, max;
};
/**
* Class for projections of cube / triangle vertices on the separating axes
*/
class Projections
class CubeTriangleIsect
{
public:
/// Inheritable portion
InheritableProjections *inherit;
/// Inheritable portion
TriangleProjection *inherit;
/// Projections of the cube vertices
LONG cubeProj[13][6];
/// Projections of the cube vertices
CubeProjection cubeProj[NUM_AXES];
public:
CubeTriangleIsect() {}
Projections( )
{
}
/**
* Construction
* from a cube (axes aligned) and triangle
*/
Projections(LONG cube[2][3], LONG trig[3][3], LONG error, int triind)
{
int i, j;
inherit = new InheritableProjections;
#ifdef CONTAINS_INDEX
inherit->index = triind;
#endif
/// Create axes
LONG axes[13][3];
// Cube faces
axes[0][0] = 1;
axes[0][1] = 0;
axes[0][2] = 0;
axes[1][0] = 0;
axes[1][1] = 1;
axes[1][2] = 0;
axes[2][0] = 0;
axes[2][1] = 0;
axes[2][2] = 1;
// Triangle face
LONG trigedge[3][3];
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
trigedge[i][j] = trig[(i + 1) % 3][j] - trig[i][j];
}
}
crossProduct(trigedge[0], trigedge[1], axes[3]);
/// Normalize face normal and store
double dedge1[] = { (double) trig[1][0] - (double) trig[0][0],
(double) trig[1][1] - (double) trig[0][1],
(double) trig[1][2] - (double) trig[0][2] };
double dedge2[] = { (double) trig[2][0] - (double) trig[1][0],
(double) trig[2][1] - (double) trig[1][1],
(double) trig[2][2] - (double) trig[1][2] };
crossProduct(dedge1, dedge2, inherit->norm);
normalize(inherit->norm);
// inherit->normA = norm[ 0 ] ;
// inherit->normB = norm[ 2 ] > 0 ? norm[ 1 ] : 2 + norm[ 1 ] ;
// Face edges and triangle edges
int ct = 4;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
{
crossProduct(axes[j], trigedge[i], axes[ct]);
ct++;
}
/// Generate projections
LONG cubeedge[3][3];
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
cubeedge[i][j] = 0;
}
cubeedge[i][i] = cube[1][i] - cube[0][i];
}
for (j = 0; j < 13; j++)
{
// Origin
cubeProj[j][0] = dotProduct(axes[j], cube[0]);
// 3 direction vectors
for (i = 1; i < 4; i++)
{
cubeProj[j][i] = dotProduct(axes[j], cubeedge[i - 1]);
}
// Offsets of 2 ends of cube projection
LONG max = 0;
LONG min = 0;
for (i = 1; i < 8; i++)
{
LONG proj = vertmap[i][0] * cubeProj[j][1] + vertmap[i][1] * cubeProj[j][2] + vertmap[i][2] * cubeProj[j][3];
if (proj > max)
{
max = proj;
}
if (proj < min)
{
min = proj;
}
}
cubeProj[j][4] = min;
cubeProj[j][5] = max;
}
for (j = 0; j < 13; j++)
{
LONG vts[3] = { dotProduct(axes[j], trig[0]),
dotProduct(axes[j], trig[1]),
dotProduct(axes[j], trig[2]) };
// Vertex
inherit->trigVertProj[j][0] = vts[0];
inherit->trigVertProj[j][1] = vts[1];
inherit->trigVertProj[j][2] = vts[2];
// Edge
for (i = 0; i < 3; i++)
{
if (vts[i] < vts[(i + 1) % 3])
{
inherit->trigEdgeProj[j][i][0] = vts[i];
inherit->trigEdgeProj[j][i][1] = vts[(i + 1) % 3];
}
else {
inherit->trigEdgeProj[j][i][1] = vts[i];
inherit->trigEdgeProj[j][i][0] = vts[(i + 1) % 3];
}
}
// Triangle
inherit->trigProj[j][0] = vts[0];
inherit->trigProj[j][1] = vts[0];
for (i = 1; i < 3; i++)
{
if (vts[i] < inherit->trigProj[j][0])
{
inherit->trigProj[j][0] = vts[i];
}
if (vts[i] > inherit->trigProj[j][1])
{
inherit->trigProj[j][1] = vts[i];
}
}
}
}
/**
* Construction
* from a parent Projections object and the index of the children
*/
Projections (Projections *parent)
{
// Copy inheritable projections
this->inherit = parent->inherit;
// Shrink cube projections
for (int i = 0; i < 13; i++)
{
cubeProj[i][0] = parent->cubeProj[i][0];
for (int j = 1; j < 6; j++)
{
cubeProj[i][j] = parent->cubeProj[i][j] >> 1;
}
}
};
Projections (Projections *parent, int box[3], int depth)
{
int mask = (1 << depth) - 1;
int nbox[3] = { box[0] & mask, box[1] & mask, box[2] & mask };
// Copy inheritable projections
this->inherit = parent->inherit;
// Shrink cube projections
for (int i = 0; i < 13; i++)
{
for (int j = 1; j < 6; j++)
{
cubeProj[i][j] = parent->cubeProj[i][j] >> depth;
}
cubeProj[i][0] = parent->cubeProj[i][0] + nbox[0] * cubeProj[i][1] + nbox[1] * cubeProj[i][2] + nbox[2] * cubeProj[i][3];
}
};
/**
* Testing intersection based on vertex/edge masks
*/
int getIntersectionMasks(UCHAR cedgemask, UCHAR& edgemask)
{
int i, j;
edgemask = cedgemask;
// Pre-processing
/*
if ( cvertmask & 1 )
{
edgemask |= 5 ;
}
if ( cvertmask & 2 )
{
edgemask |= 3 ;
}
if ( cvertmask & 4 )
{
edgemask |= 6 ;
}
/**
* Construction from a cube (axes aligned) and triangle
*/
// Test axes for edge intersection
UCHAR bit = 1;
for (j = 0; j < 3; j++)
{
if (edgemask & bit)
{
for (i = 0; i < 13; i++)
{
LONG proj0 = cubeProj[i][0] + cubeProj[i][4];
LONG proj1 = cubeProj[i][0] + cubeProj[i][5];
if (proj0 > inherit->trigEdgeProj[i][j][1] ||
proj1 < inherit->trigEdgeProj[i][j][0])
{
edgemask &= (~bit);
break;
}
}
}
bit <<= 1;
}
/*
if ( edgemask != 0 )
{
printf("%d %d\n", cedgemask, edgemask) ;
}
CubeTriangleIsect(int64_t cube[2][3], int64_t trig[3][3], int64_t error, int triind);
/**
* Construction from a parent CubeTriangleIsect object and the index of
* the children
*/
CubeTriangleIsect(CubeTriangleIsect *parent);
unsigned char getBoxMask( );
// Test axes for triangle intersection
if (edgemask)
{
return 1;
}
for (i = 3; i < 13; i++)
{
LONG proj0 = cubeProj[i][0] + cubeProj[i][4];
LONG proj1 = cubeProj[i][0] + cubeProj[i][5];
if (proj0 > inherit->trigProj[i][1] ||
proj1 < inherit->trigProj[i][0])
{
return 0;
}
}
return 1;
}
/**
* Retrieving children masks using PRIMARY AXES
*/
UCHAR getChildrenMasks(UCHAR cvertmask, UCHAR vertmask[8])
{
int i, j, k;
int bmask[3][2] = {{0, 0}, {0, 0}, {0, 0}};
int vmask[3][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
UCHAR boxmask = 0;
LONG len = cubeProj[0][1] >> 1;
for (i = 0; i < 3; i++)
{
LONG mid = cubeProj[i][0] + len;
// Check bounding box
if (mid >= inherit->trigProj[i][0])
{
bmask[i][0] = 1;
}
if (mid <= inherit->trigProj[i][1])
{
bmask[i][1] = 1;
}
// Check vertex mask
if (cvertmask)
{
for (j = 0; j < 3; j++)
{
if (cvertmask & (1 << j) )
{
// Only check if it's contained this node
if (mid >= inherit->trigVertProj[i][j])
{
vmask[i][j][0] = 1;
}
if (mid <= inherit->trigVertProj[i][j])
{
vmask[i][j][1] = 1;
}
}
}
}
/*
// Check edge mask
if ( cedgemask )
{
for ( j = 0 ; j < 3 ; j ++ )
{
if ( cedgemask & ( 1 << j ) )
{
// Only check if it's contained this node
if ( mid >= inherit->trigEdgeProj[i][j][0] )
{
emask[i][j][0] = 1 ;
}
if ( mid <= inherit->trigEdgeProj[i][j][1] )
{
emask[i][j][1] = 1 ;
}
}
}
}
*/
}
// Fill in masks
int ct = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
for (k = 0; k < 2; k++)
{
boxmask |= ( (bmask[0][i] & bmask[1][j] & bmask[2][k]) << ct);
vertmask[ct] = ((vmask[0][0][i] & vmask[1][0][j] & vmask[2][0][k]) |
((vmask[0][1][i] & vmask[1][1][j] & vmask[2][1][k]) << 1) |
((vmask[0][2][i] & vmask[1][2][j] & vmask[2][2][k]) << 2) );
/*
edgemask[ct] = (( emask[0][0][i] & emask[1][0][j] & emask[2][0][k] ) |
(( emask[0][1][i] & emask[1][1][j] & emask[2][1][k] ) << 1 ) |
(( emask[0][2][i] & emask[1][2][j] & emask[2][2][k] ) << 2 ) ) ;
edgemask[ct] = cedgemask ;
*/
ct++;
}
// Return bounding box masks
return boxmask;
}
UCHAR getBoxMask( )
{
int i, j, k;
int bmask[3][2] = {{0, 0}, {0, 0}, {0, 0}};
UCHAR boxmask = 0;
LONG len = cubeProj[0][1] >> 1;
for (i = 0; i < 3; i++)
{
LONG mid = cubeProj[i][0] + len;
// Check bounding box
if (mid >= inherit->trigProj[i][0])
{
bmask[i][0] = 1;
}
if (mid <= inherit->trigProj[i][1])
{
bmask[i][1] = 1;
}
}
// Fill in masks
int ct = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
for (k = 0; k < 2; k++)
{
boxmask |= ( (bmask[0][i] & bmask[1][j] & bmask[2][k]) << ct);
ct++;
}
// Return bounding box masks
return boxmask;
}
/**
* Get projections for sub-cubes (simple axes)
*/
void getSubProjectionsSimple(Projections *p[8])
{
// Process the axes cooresponding to the triangle's normal
int ind = 3;
LONG len = cubeProj[0][1] >> 1;
LONG trigproj[3] = { cubeProj[ind][1] >> 1, cubeProj[ind][2] >> 1, cubeProj[ind][3] >> 1 };
int ct = 0;
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
for (int k = 0; k < 2; k++)
{
p[ct] = new Projections( );
p[ct]->inherit = inherit;
p[ct]->cubeProj[0][0] = cubeProj[0][0] + i * len;
p[ct]->cubeProj[1][0] = cubeProj[1][0] + j * len;
p[ct]->cubeProj[2][0] = cubeProj[2][0] + k * len;
p[ct]->cubeProj[0][1] = len;
for (int m = 1; m < 4; m++)
{
p[ct]->cubeProj[ind][m] = trigproj[m - 1];
}
p[ct]->cubeProj[ind][0] = cubeProj[ind][0] + i * trigproj[0] + j * trigproj[1] + k * trigproj[2];
ct++;
}
}
/**
* Shifting a cube to a new origin
*/
void shift(int off[3])
{
for (int i = 0; i < 13; i++)
{
cubeProj[i][0] += off[0] * cubeProj[i][1] + off[1] * cubeProj[i][2] + off[2] * cubeProj[i][3];
}
}
void shiftNoPrimary(int off[3])
{
for (int i = 3; i < 13; i++)
{
cubeProj[i][0] += off[0] * cubeProj[i][1] + off[1] * cubeProj[i][2] + off[2] * cubeProj[i][3];
}
}
/**
* Method to test intersection of the triangle and the cube
*/
int isIntersecting( )
{
for (int i = 0; i < 13; i++)
{
/*
LONG proj0 = cubeProj[i][0] +
vertmap[inherit->cubeEnds[i][0]][0] * cubeProj[i][1] +
vertmap[inherit->cubeEnds[i][0]][1] * cubeProj[i][2] +
vertmap[inherit->cubeEnds[i][0]][2] * cubeProj[i][3] ;
LONG proj1 = cubeProj[i][0] +
vertmap[inherit->cubeEnds[i][1]][0] * cubeProj[i][1] +
vertmap[inherit->cubeEnds[i][1]][1] * cubeProj[i][2] +
vertmap[inherit->cubeEnds[i][1]][2] * cubeProj[i][3] ;
*/
LONG proj0 = cubeProj[i][0] + cubeProj[i][4];
LONG proj1 = cubeProj[i][0] + cubeProj[i][5];
if (proj0 > inherit->trigProj[i][1] ||
proj1 < inherit->trigProj[i][0])
{
return 0;
}
}
return 1;
};
int isIntersectingNoPrimary( )
{
for (int i = 3; i < 13; i++)
{
/*
LONG proj0 = cubeProj[i][0] +
vertmap[inherit->cubeEnds[i][0]][0] * cubeProj[i][1] +
vertmap[inherit->cubeEnds[i][0]][1] * cubeProj[i][2] +
vertmap[inherit->cubeEnds[i][0]][2] * cubeProj[i][3] ;
LONG proj1 = cubeProj[i][0] +
vertmap[inherit->cubeEnds[i][1]][0] * cubeProj[i][1] +
vertmap[inherit->cubeEnds[i][1]][1] * cubeProj[i][2] +
vertmap[inherit->cubeEnds[i][1]][2] * cubeProj[i][3] ;
*/
LONG proj0 = cubeProj[i][0] + cubeProj[i][4];
LONG proj1 = cubeProj[i][0] + cubeProj[i][5];
if (proj0 > inherit->trigProj[i][1] ||
proj1 < inherit->trigProj[i][0])
{
return 0;
}
}
return 1;
};
/**
* Method to test intersection of the triangle and one edge
*/
int isIntersecting(int edgeInd)
{
for (int i = 0; i < 13; i++)
{
LONG proj0 = cubeProj[i][0] +
vertmap[edgemap[edgeInd][0]][0] * cubeProj[i][1] +
vertmap[edgemap[edgeInd][0]][1] * cubeProj[i][2] +
vertmap[edgemap[edgeInd][0]][2] * cubeProj[i][3];
LONG proj1 = cubeProj[i][0] +
vertmap[edgemap[edgeInd][1]][0] * cubeProj[i][1] +
vertmap[edgemap[edgeInd][1]][1] * cubeProj[i][2] +
vertmap[edgemap[edgeInd][1]][2] * cubeProj[i][3];
if (proj0 < proj1)
{
if (proj0 > inherit->trigProj[i][1] ||
proj1 < inherit->trigProj[i][0])
{
return 0;
}
}
else {
if (proj1 > inherit->trigProj[i][1] ||
proj0 < inherit->trigProj[i][0])
{
return 0;
}
}
}
// printf( "Intersecting: %d %d\n", edgemap[edgeInd][0], edgemap[edgeInd][1] ) ;
return 1;
};
/**
* Method to test intersection of one triangle edge and one cube face
*/
int isIntersecting(int edgeInd, int faceInd)
{
for (int i = 0; i < 13; i++)
{
LONG trigproj0 = inherit->trigVertProj[i][edgeInd];
LONG trigproj1 = inherit->trigVertProj[i][(edgeInd + 1) % 3];
if (trigproj0 < trigproj1)
{
int t1 = 1, t2 = 1;
for (int j = 0; j < 4; j++)
{
LONG proj = cubeProj[i][0] +
vertmap[facemap[faceInd][j]][0] * cubeProj[i][1] +
vertmap[facemap[faceInd][j]][1] * cubeProj[i][2] +
vertmap[facemap[faceInd][j]][2] * cubeProj[i][3];
if (proj >= trigproj0)
{
t1 = 0;
}
if (proj <= trigproj1)
{
t2 = 0;
}
}
if (t1 || t2)
{
return 0;
}
}
else {
int t1 = 1, t2 = 1;
for (int j = 0; j < 4; j++)
{
LONG proj = cubeProj[i][0] +
vertmap[facemap[faceInd][j]][0] * cubeProj[i][1] +
vertmap[facemap[faceInd][j]][1] * cubeProj[i][2] +
vertmap[facemap[faceInd][j]][2] * cubeProj[i][3];
if (proj >= trigproj1)
{
t1 = 0;
}
if (proj <= trigproj0)
{
t2 = 0;
}
}
if (t1 || t2)
{
return 0;
}
}
}
return 1;
};
int isIntersectingPrimary(int edgeInd)
{
for (int i = 0; i < 13; i++)
{
LONG proj0 = cubeProj[i][0];
LONG proj1 = cubeProj[i][0] + cubeProj[i][edgeInd + 1];
if (proj0 < proj1)
{
if (proj0 > inherit->trigProj[i][1] ||
proj1 < inherit->trigProj[i][0])
{
return 0;
}
}
else {
if (proj1 > inherit->trigProj[i][1] ||
proj0 < inherit->trigProj[i][0])
{
return 0;
}
}
}
// printf( "Intersecting: %d %d\n", edgemap[edgeInd][0], edgemap[edgeInd][1] ) ;
return 1;
};
double getIntersection(int edgeInd)
{
int i = 3;
LONG proj0 = cubeProj[i][0] +
vertmap[edgemap[edgeInd][0]][0] * cubeProj[i][1] +
vertmap[edgemap[edgeInd][0]][1] * cubeProj[i][2] +
vertmap[edgemap[edgeInd][0]][2] * cubeProj[i][3];
LONG proj1 = cubeProj[i][0] +
vertmap[edgemap[edgeInd][1]][0] * cubeProj[i][1] +
vertmap[edgemap[edgeInd][1]][1] * cubeProj[i][2] +
vertmap[edgemap[edgeInd][1]][2] * cubeProj[i][3];
LONG proj2 = inherit->trigProj[i][1];
/*
if ( proj0 < proj1 )
{
if ( proj2 < proj0 || proj2 > proj1 )
{
return -1 ;
}
}
else
{
if ( proj2 < proj1 || proj2 > proj0 )
{
return -1 ;
}
}
/**
* Shifting a cube to a new origin
*/
void shift(int off[3]);
double alpha = (double)(proj2 - proj0) / (double)(proj1 - proj0);
/*
if ( alpha < 0 )
{
alpha = 0.5 ;
}
else if ( alpha > 1 )
{
alpha = 0.5 ;
}
/**
* Method to test intersection of the triangle and the cube
*/
int isIntersecting() const;
return alpha;
};
float getIntersectionPrimary(int edgeInd)
{
int i = 3;
LONG proj0 = cubeProj[i][0];
LONG proj1 = cubeProj[i][0] + cubeProj[i][edgeInd + 1];
LONG proj2 = inherit->trigProj[i][1];
LONG d = proj1 - proj0;
double alpha;
if (d == 0)
alpha = 0.5;
else {
alpha = (double)((proj2 - proj0)) / (double)d;
if (alpha < 0 || alpha > 1)
alpha = 0.5;
}
return (float)alpha;
};
/**
* Method to perform cross-product
*/
void crossProduct(LONG a[3], LONG b[3], LONG res[3])
{
res[0] = a[1] * b[2] - a[2] * b[1];
res[1] = a[2] * b[0] - a[0] * b[2];
res[2] = a[0] * b[1] - a[1] * b[0];
}
void crossProduct(double a[3], double b[3], double res[3])
{
res[0] = a[1] * b[2] - a[2] * b[1];
res[1] = a[2] * b[0] - a[0] * b[2];
res[2] = a[0] * b[1] - a[1] * b[0];
}
/**
* Method to perform dot product
*/
LONG dotProduct(LONG a[3], LONG b[3])
{
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
void normalize(double a[3])
{
double mag = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
if (mag > 0)
{
mag = sqrt(mag);
a[0] /= mag;
a[1] /= mag;
a[2] /= mag;
}
}
int isIntersectingPrimary(int edgeInd) const;
float getIntersectionPrimary(int edgeInd) const;
};
#endif

@ -113,7 +113,7 @@ void Octree::scanConvert()
start = clock();
#endif
addTrian();
addAllTriangles();
resetMinimalEdges();
preparePrimalEdgesMask(&root->internal);
@ -257,7 +257,7 @@ void Octree::resetMinimalEdges()
cellProcParity(root, 0, maxDepth);
}
void Octree::addTrian()
void Octree::addAllTriangles()
{
Triangle *trian;
int count = 0;
@ -273,7 +273,7 @@ void Octree::addTrian()
while ((trian = reader->getNextTriangle()) != NULL) {
// Drop triangles
{
addTrian(trian, count);
addTriangle(trian, count);
}
delete trian;
@ -316,48 +316,60 @@ void Octree::addTrian()
putchar(13);
}
void Octree::addTrian(Triangle *trian, int triind)
/* Prepare a triangle for insertion into the octree; call the other
addTriangle() to (recursively) build the octree */
void Octree::addTriangle(Triangle *trian, int triind)
{
int i, j;
// Blowing up the triangle to the grid
float mid[3] = {0, 0, 0};
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++) {
/* Project the triangle's coordinates into the grid */
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++)
trian->vt[i][j] = dimen * (trian->vt[i][j] - origin[j]) / range;
mid[j] += trian->vt[i][j] / 3;
}
}
// Generate projections
LONG cube[2][3] = {{0, 0, 0}, {dimen, dimen, dimen}};
LONG trig[3][3];
/* Generate projections */
int64_t cube[2][3] = {{0, 0, 0}, {dimen, dimen, dimen}};
int64_t trig[3][3];
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++)
trig[i][j] = (int64_t)(trian->vt[i][j]);
}
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++) {
trig[i][j] = (LONG)(trian->vt[i][j]);
// Perturb end points, if set so
}
// Add to the octree
// int start[3] = {0, 0, 0};
LONG errorvec = (LONG)(0);
Projections *proj = new Projections(cube, trig, errorvec, triind);
root = (Node *)addTrian(&root->internal, proj, maxDepth);
/* Add triangle to the octree */
int64_t errorvec = (int64_t)(0);
CubeTriangleIsect *proj = new CubeTriangleIsect(cube, trig, errorvec, triind);
root = (Node *)addTriangle(&root->internal, proj, maxDepth);
delete proj->inherit;
delete proj;
}
void print_depth(int height, int maxDepth)
{
for (int i = 0; i < maxDepth - height; i++)
printf(" ");
}
InternalNode *Octree::addTrian(InternalNode *node, Projections *p, int height)
InternalNode *Octree::addTriangle(InternalNode *node, CubeTriangleIsect *p, int height)
{
int i;
int vertdiff[8][3] = {{0, 0, 0}, {0, 0, 1}, {0, 1, -1}, {0, 0, 1}, {1, -1, -1}, {0, 0, 1}, {0, 1, -1}, {0, 0, 1}};
UCHAR boxmask = p->getBoxMask();
Projections *subp = new Projections(p);
const int vertdiff[8][3] = {
{0, 0, 0},
{0, 0, 1},
{0, 1, -1},
{0, 0, 1},
{1, -1, -1},
{0, 0, 1},
{0, 1, -1},
{0, 0, 1}};
unsigned char boxmask = p->getBoxMask();
CubeTriangleIsect *subp = new CubeTriangleIsect(p);
int count = 0;
int tempdiff[3] = {0, 0, 0};
/* Check triangle against each of the input node's children */
for (i = 0; i < 8; i++) {
tempdiff[0] += vertdiff[i][0];
tempdiff[1] += vertdiff[i][1];
@ -370,30 +382,23 @@ InternalNode *Octree::addTrian(InternalNode *node, Projections *p, int height)
/* Pruning using intersection test */
if (subp->isIntersecting()) {
// if(subp->getIntersectionMasks(cedgemask, edgemask))
if (!hasChild(node, i)) {
if (height == 1) {
if (height == 1)
node = addLeafChild(node, i, count, createLeaf(0));
}
else {
else
node = addInternalChild(node, i, count, createInternal(0));
}
}
Node *chd = getChild(node, count);
if (!isLeaf(node, i)) {
// setChild(node, count, addTrian(chd, subp, height - 1, vertmask[i], edgemask));
setChild(node, count, (Node *)addTrian(&chd->internal, subp, height - 1));
}
else {
if (node->is_child_leaf(i))
setChild(node, count, (Node *)updateCell(&chd->leaf, subp));
}
else
setChild(node, count, (Node *)addTriangle(&chd->internal, subp, height - 1));
}
}
if (hasChild(node, i)) {
if (hasChild(node, i))
count++;
}
}
delete subp;
@ -401,7 +406,7 @@ InternalNode *Octree::addTrian(InternalNode *node, Projections *p, int height)
return node;
}
LeafNode *Octree::updateCell(LeafNode *node, Projections *p)
LeafNode *Octree::updateCell(LeafNode *node, CubeTriangleIsect *p)
{
int i;
@ -426,13 +431,6 @@ LeafNode *Octree::updateCell(LeafNode *node, Projections *p)
else {
offs[newc] = getEdgeOffsetNormal(node, oldc, a[newc], b[newc], c[newc]);
// if(p->isIntersectingPrimary(i))
{
// dc_printf("Multiple intersections!\n");
// setPatchEdge(node, i);
}
oldc++;
newc++;
}
@ -451,7 +449,7 @@ void Octree::preparePrimalEdgesMask(InternalNode *node)
int count = 0;
for (int i = 0; i < 8; i++) {
if (hasChild(node, i)) {
if (isLeaf(node, i))
if (node->is_child_leaf(i))
createPrimalEdgesMask(&getChild(node, count)->leaf);
else
preparePrimalEdgesMask(&getChild(node, count)->internal);
@ -495,7 +493,7 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *& path
nst[i][j] = st[j] + len * vertmap[i][j];
}
if (chd[i] == NULL || isLeaf(&newnode->internal, i)) {
if (chd[i] == NULL || newnode->internal.is_child_leaf(i)) {
chdpaths[i] = NULL;
}
else {
@ -1411,7 +1409,7 @@ Node *Octree::locateCell(InternalNode *node, int st[3], int len, int ori[3], int
if (hasChild(node, ind)) {
int count = getChildCount(node, ind);
Node *chd = getChild(node, count);
if (isLeaf(node, ind)) {
if (node->is_child_leaf(ind)) {
rleaf = chd;
rlen = len;
}
@ -2367,7 +2365,7 @@ void Octree::edgeProcContour(Node *node[4], int leaf[4], int depth[4], int maxde
de[j] = depth[j];
}
else {
le[j] = isLeaf(&node[j]->internal, c[j]);
le[j] = node[j]->internal.is_child_leaf(c[j]);
ne[j] = chd[j][c[j]];
de[j] = depth[j] - 1;
}
@ -2410,7 +2408,7 @@ void Octree::faceProcContour(Node *node[2], int leaf[2], int depth[2], int maxde
df[j] = depth[j];
}
else {
lf[j] = isLeaf(&node[j]->internal, c[j]);
lf[j] = node[j]->internal.is_child_leaf(c[j]);
nf[j] = chd[j][c[j]];
df[j] = depth[j] - 1;
}
@ -2436,7 +2434,7 @@ void Octree::faceProcContour(Node *node[2], int leaf[2], int depth[2], int maxde
de[j] = depth[order[j]];
}
else {
le[j] = isLeaf(&node[order[j]]->internal, c[j]);
le[j] = node[order[j]]->internal.is_child_leaf(c[j]);
ne[j] = chd[order[j]][c[j]];
de[j] = depth[order[j]] - 1;
}
@ -2467,7 +2465,7 @@ void Octree::cellProcContour(Node *node, int leaf, int depth)
// 8 Cell calls
for (i = 0; i < 8; i++) {
cellProcContour(chd[i], isLeaf(&node->internal, i), depth - 1);
cellProcContour(chd[i], node->internal.is_child_leaf(i), depth - 1);
}
// 12 face calls
@ -2477,8 +2475,8 @@ void Octree::cellProcContour(Node *node, int leaf, int depth)
for (i = 0; i < 12; i++) {
int c[2] = {cellProcFaceMask[i][0], cellProcFaceMask[i][1]};
lf[0] = isLeaf(&node->internal, c[0]);
lf[1] = isLeaf(&node->internal, c[1]);
lf[0] = node->internal.is_child_leaf(c[0]);
lf[1] = node->internal.is_child_leaf(c[1]);
nf[0] = chd[c[0]];
nf[1] = chd[c[1]];
@ -2494,7 +2492,7 @@ void Octree::cellProcContour(Node *node, int leaf, int depth)
int c[4] = {cellProcEdgeMask[i][0], cellProcEdgeMask[i][1], cellProcEdgeMask[i][2], cellProcEdgeMask[i][3]};
for (int j = 0; j < 4; j++) {
le[j] = isLeaf(&node->internal, c[j]);
le[j] = node->internal.is_child_leaf(c[j]);
ne[j] = chd[c[j]];
}
@ -2563,7 +2561,7 @@ void Octree::edgeProcParity(Node *node[4], int leaf[4], int depth[4], int maxdep
de[j] = depth[j];
}
else {
le[j] = isLeaf(&node[j]->internal, c[j]);
le[j] = node[j]->internal.is_child_leaf(c[j]);
ne[j] = chd[j][c[j]];
de[j] = depth[j] - 1;
@ -2608,7 +2606,7 @@ void Octree::faceProcParity(Node *node[2], int leaf[2], int depth[2], int maxdep
df[j] = depth[j];
}
else {
lf[j] = isLeaf(&node[j]->internal, c[j]);
lf[j] = node[j]->internal.is_child_leaf(c[j]);
nf[j] = chd[j][c[j]];
df[j] = depth[j] - 1;
}
@ -2634,7 +2632,7 @@ void Octree::faceProcParity(Node *node[2], int leaf[2], int depth[2], int maxdep
de[j] = depth[order[j]];
}
else {
le[j] = isLeaf((InternalNode *)(node[order[j]]), c[j]);
le[j] = node[order[j]]->internal.is_child_leaf(c[j]);
ne[j] = chd[order[j]][c[j]];
de[j] = depth[order[j]] - 1;
}
@ -2665,7 +2663,7 @@ void Octree::cellProcParity(Node *node, int leaf, int depth)
// 8 Cell calls
for (i = 0; i < 8; i++) {
cellProcParity(chd[i], isLeaf((InternalNode *)node, i), depth - 1);
cellProcParity(chd[i], node->internal.is_child_leaf(i), depth - 1);
}
// 12 face calls
@ -2675,8 +2673,8 @@ void Octree::cellProcParity(Node *node, int leaf, int depth)
for (i = 0; i < 12; i++) {
int c[2] = {cellProcFaceMask[i][0], cellProcFaceMask[i][1]};
lf[0] = isLeaf((InternalNode *)node, c[0]);
lf[1] = isLeaf((InternalNode *)node, c[1]);
lf[0] = node->internal.is_child_leaf(c[0]);
lf[1] = node->internal.is_child_leaf(c[1]);
nf[0] = chd[c[0]];
nf[1] = chd[c[1]];
@ -2692,7 +2690,7 @@ void Octree::cellProcParity(Node *node, int leaf, int depth)
int c[4] = {cellProcEdgeMask[i][0], cellProcEdgeMask[i][1], cellProcEdgeMask[i][2], cellProcEdgeMask[i][3]};
for (int j = 0; j < 4; j++) {
le[j] = isLeaf((InternalNode *)node, c[j]);
le[j] = node->internal.is_child_leaf(c[j]);
ne[j] = chd[c[j]];
}

File diff suppressed because it is too large Load Diff

@ -165,9 +165,11 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL)
)
endif()
list(APPEND INC_SYS
${SDL_INCLUDE_DIR}
)
if(NOT WITH_HEADLESS)
list(APPEND INC_SYS
${SDL_INCLUDE_DIR}
)
endif()
elseif(APPLE)
if(WITH_COCOA)

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -304,7 +304,7 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
Align this bone to another by moving its tail and settings its roll
the length of the other bone is not used.
"""
vec = other.vector.normalize() * self.length
vec = other.vector.normalized() * self.length
self.tail = self.head + vec
self.roll = other.roll

@ -42,6 +42,7 @@ class CONSOLE_MT_console(Menu):
layout = self.layout
layout.operator("console.clear")
layout.operator("console.clear_line")
layout.operator("console.copy")
layout.operator("console.paste")
layout.menu("CONSOLE_MT_language")

@ -654,7 +654,7 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
row.prop(sound, "use_memory_cache")
layout.prop(strip, "waveform")
layout.prop(strip, "show_waveform")
layout.prop(strip, "volume")
layout.prop(strip, "pitch")
layout.prop(strip, "pan")

@ -55,7 +55,7 @@ class VIEW3D_HT_header(Header):
if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
sub.menu("VIEW3D_MT_brush")
if mode_string == 'SCULPT':
sub.menu("VIEW3D_MT_hide")
sub.menu("VIEW3D_MT_hide_mask")
else:
sub.menu("VIEW3D_MT_object")
@ -1269,8 +1269,8 @@ class VIEW3D_MT_sculpt(Menu):
layout.prop(sculpt, "use_deform_only")
class VIEW3D_MT_hide(Menu):
bl_label = "Hide"
class VIEW3D_MT_hide_mask(Menu):
bl_label = "Hide/Mask"
def draw(self, context):
layout = self.layout
@ -1286,6 +1286,23 @@ class VIEW3D_MT_hide(Menu):
op = layout.operator("paint.hide_show", text="Show Bounding Box")
op.action = 'SHOW'
op.area = 'INSIDE'
op = layout.operator("paint.hide_show", text="Hide Masked")
op.area = 'MASKED'
op.action = 'HIDE'
layout.separator()
op = layout.operator("paint.mask_flood_fill", text="Invert Mask")
op.mode = 'INVERT'
op = layout.operator("paint.mask_flood_fill", text="Fill Mask")
op.mode = 'VALUE'
op.value = 1
op = layout.operator("paint.mask_flood_fill", text="Clear Mask")
op.mode = 'VALUE'
op.value = 0
# ********** Particle menu **********

@ -575,6 +575,9 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
row.prop(brush, "sculpt_plane", text="")
if brush.sculpt_tool == 'MASK':
col.prop(brush, "mask_tool", text="")
# plane_offset, use_offset_pressure, use_plane_trim, plane_trim
if capabilities.has_plane_offset:
row = col.row(align=True)

@ -174,12 +174,12 @@ char **BLF_dir_get(int *ndir);
void BLF_dir_free(char **dirs, int count);
/* font->flags. */
#define BLF_ROTATION (1<<0)
#define BLF_CLIPPING (1<<1)
#define BLF_SHADOW (1<<2)
#define BLF_KERNING_DEFAULT (1<<3)
#define BLF_MATRIX (1<<4)
#define BLF_ASPECT (1<<5)
#define BLF_ROTATION (1 << 0)
#define BLF_CLIPPING (1 << 1)
#define BLF_SHADOW (1 << 2)
#define BLF_KERNING_DEFAULT (1 << 3)
#define BLF_MATRIX (1 << 4)
#define BLF_ASPECT (1 << 5)
#define BLF_DRAW_STR_DUMMY_MAX 1024

@ -163,10 +163,10 @@ int blf_dir_split(const char *str, char *file, int *size)
file[i] = str[i];
file[i] = '.';
file[i+1] = 't';
file[i+2] = 't';
file[i+3] = 'f';
file[i+4] = '\0';
file[i + 1] = 't';
file[i + 2] = 't';
file[i + 3] = 'f';
file[i + 4] = '\0';
s++;
*size = atoi(s);
return 1;

@ -45,7 +45,7 @@
#include "BLI_blenlib.h"
#include "BLI_linklist.h" /* linknode */
#include "BLI_linklist.h" /* linknode */
#include "BLI_math.h"
#include "BIF_gl.h"
@ -103,7 +103,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
if (glyph_ascii_table['0'] == NULL) {
GlyphBLF *g;
unsigned int i;
for (i = 0; i<256; i++) {
for (i = 0; i < 256; i++) {
g = blf_glyph_search(font->glyph_cache, i);
if (!g) {
FT_UInt glyph_index = FT_Get_Char_Index(font->face, i);
@ -263,7 +263,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
/* don't draw beyond the buffer bounds */
int width_clip = g->width;
int height_clip = g->height;
int yb_start = g->pitch < 0 ? 0 : g->height-1;
int yb_start = g->pitch < 0 ? 0 : g->height - 1;
if (width_clip + chx > font->bw)
width_clip -= chx + width_clip - font->bw;
@ -285,7 +285,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
if (a > 0.0f) {
float alphatest;
fbuf = font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
fbuf = font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y) * font->bw));
if (a >= 1.0f) {
fbuf[0] = font->b_col[0];
fbuf[1] = font->b_col[1];
@ -293,10 +293,10 @@ void blf_font_buffer(FontBLF *font, const char *str)
fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
}
else {
fbuf[0] = (font->b_col[0]*a) + (fbuf[0] * (1-a));
fbuf[1] = (font->b_col[1]*a) + (fbuf[1] * (1-a));
fbuf[2] = (font->b_col[2]*a) + (fbuf[2] * (1-a));
fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
fbuf[0] = (font->b_col[0] * a) + (fbuf[0] * (1 - a));
fbuf[1] = (font->b_col[1] * a) + (fbuf[1] * (1 - a));
fbuf[2] = (font->b_col[2] * a) + (fbuf[2] * (1 - a));
fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3] * a))) < 1.0f ? alphatest : 1.0f;
}
}
}
@ -316,7 +316,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
if (a > 0.0f) {
int alphatest;
cbuf = font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
cbuf = font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y) * font->bw));
if (a >= 1.0f) {
cbuf[0] = b_col_char[0];
cbuf[1] = b_col_char[1];
@ -324,10 +324,10 @@ void blf_font_buffer(FontBLF *font, const char *str)
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
}
else {
cbuf[0] = (b_col_char[0]*a) + (cbuf[0] * (1-a));
cbuf[1] = (b_col_char[1]*a) + (cbuf[1] * (1-a));
cbuf[2] = (b_col_char[2]*a) + (cbuf[2] * (1-a));
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) <
cbuf[0] = (b_col_char[0] * a) + (cbuf[0] * (1 - a));
cbuf[1] = (b_col_char[1] * a) + (cbuf[1] * (1 - a));
cbuf[2] = (b_col_char[2] * a) + (cbuf[2] * (1 - a));
cbuf[3] = (alphatest = ((int)cbuf[3] + (int)((font->b_col[3] * a) * 255.0f))) <
255 ? alphatest : 255;
}
}

@ -82,7 +82,7 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
memset(gc->bucket, 0, sizeof(gc->bucket));
gc->textures = (GLuint *)malloc(sizeof(GLuint)*256);
gc->textures = (GLuint *)malloc(sizeof(GLuint) * 256);
gc->ntex = 256;
gc->cur_tex = -1;
gc->x_offs = 0;
@ -147,8 +147,8 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc)
}
}
if (gc->cur_tex+1 > 0)
glDeleteTextures(gc->cur_tex+1, gc->textures);
if (gc->cur_tex + 1 > 0)
glDeleteTextures(gc->cur_tex + 1, gc->textures);
free((void *)gc->textures);
MEM_freeN(gc);
}
@ -163,7 +163,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
if (gc->cur_tex >= gc->ntex) {
gc->ntex *= 2;
gc->textures = (GLuint *)realloc((void *)gc->textures, sizeof(GLuint)*gc->ntex);
gc->textures = (GLuint *)realloc((void *)gc->textures, sizeof(GLuint) * gc->ntex);
}
gc->p2_width = blf_next_p2((gc->rem_glyphs * gc->max_glyph_width) + (gc->pad * 2));
@ -223,7 +223,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
if (sharp)
err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_MONO);
else
err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); /* Sure about NO_* flags? */
err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); /* Sure about NO_* flags? */
if (err)
return NULL;
@ -314,11 +314,11 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa
static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
float soft[25] = {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
float soft[25] = {1 / 60.0f, 1 / 60.0f, 2 / 60.0f, 1 / 60.0f, 1 / 60.0f,
1 / 60.0f, 3 / 60.0f, 5 / 60.0f, 3 / 60.0f, 1 / 60.0f,
2 / 60.0f, 5 / 60.0f, 8 / 60.0f, 5 / 60.0f, 2 / 60.0f,
1 / 60.0f, 3 / 60.0f, 5 / 60.0f, 3 / 60.0f, 1 / 60.0f,
1 / 60.0f, 1 / 60.0f, 2 / 60.0f, 1 / 60.0f, 1 / 60.0f};
float color[4], *fp = soft;
int dx, dy;
@ -331,7 +331,7 @@ static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x
for (dy = -2; dy < 3; dy++, fp++) {
color[3] = *(fp) * shadow_col[3];
glColor4fv(color);
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
blf_texture_draw(uv, x1 + dx, y1 + dy, x2 + dx, y2 + dy);
}
}
@ -340,9 +340,9 @@ static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x
static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
float soft[9] = {1/16.0f, 2/16.0f, 1/16.0f,
2/16.0f, 4/16.0f, 2/16.0f,
1/16.0f, 2/16.0f, 1/16.0f};
float soft[9] = {1 / 16.0f, 2 / 16.0f, 1 / 16.0f,
2 / 16.0f, 4 / 16.0f, 2 / 16.0f,
1 / 16.0f, 2 / 16.0f, 1 / 16.0f};
float color[4], *fp = soft;
int dx, dy;
@ -355,7 +355,7 @@ static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x
for (dy = -1; dy < 2; dy++, fp++) {
color[3] = *(fp) * shadow_col[3];
glColor4fv(color);
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
blf_texture_draw(uv, x1 + dx, y1 + dy, x2 + dx, y2 + dy);
}
}

@ -42,7 +42,7 @@
#include <locale.h>
#if defined (_WIN32)
#if defined(_WIN32)
#include <windows.h>
#endif
@ -83,7 +83,7 @@ static const char *locales[] = {
"catalan", "ca_AD",
"czech", "cs_CZ",
"ptb", "pt",
#if defined (_WIN32) && !defined(FREE_WINDOWS)
#if defined(_WIN32) && !defined(FREE_WINDOWS)
"Chinese (Simplified)_China.1252", "zh_CN",
"Chinese (Traditional)_China.1252", "zh_TW",
#else
@ -170,19 +170,19 @@ void BLF_lang_set(const char *str)
int ok = 1;
const char *long_locale = locales[2 * U.language];
if ((U.transopts&USER_DOTRANSLATE) == 0)
if ((U.transopts & USER_DOTRANSLATE) == 0)
return;
if (str)
short_locale = str;
else
short_locale = locales[ 2 * U.language + 1];
short_locale = locales[2 * U.language + 1];
#if defined (_WIN32) && !defined(FREE_WINDOWS)
#if defined(_WIN32) && !defined(FREE_WINDOWS)
if (short_locale) {
char *envStr;
if (U.language == 0)/* use system setting */
if (U.language == 0) /* use system setting */
envStr = BLI_sprintfN("LANG=%s", getenv("LANG"));
else
envStr = BLI_sprintfN("LANG=%s", short_locale);
@ -201,8 +201,8 @@ void BLF_lang_set(const char *str)
}
#else
{
static char default_lang[64] ="\0";
static char default_language[64] ="\0";
static char default_lang[64] = "\0";
static char default_language[64] = "\0";
if (default_lang[0] == 0)
get_language_variable("LANG", default_lang, sizeof(default_lang));

@ -39,7 +39,7 @@
/* needed for windows version of gettext */
#ifndef LC_MESSAGES
# define LC_MESSAGES 1729
# define LC_MESSAGES 1729
#endif
#endif
@ -57,7 +57,7 @@
#include "DNA_userdef_types.h" /* For user settings. */
#ifdef WITH_INTERNATIONAL
static const char unifont_filename[] ="droidsans.ttf.gz";
static const char unifont_filename[] = "droidsans.ttf.gz";
static unsigned char *unifont_ttf = NULL;
static int unifont_size = 0;
@ -70,7 +70,7 @@ unsigned char *BLF_get_unifont(int *unifont_size_r)
BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
unifont_ttf = (unsigned char*)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
unifont_ttf = (unsigned char *)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
}
else {
printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
@ -90,7 +90,7 @@ void BLF_free_unifont(void)
#endif
const char* BLF_gettext(const char *msgid)
const char *BLF_gettext(const char *msgid)
{
#ifdef WITH_INTERNATIONAL
if (msgid && msgid[0])
@ -124,7 +124,7 @@ const char *BLF_pgettext(const char *context, const char *message)
sprintf(msg_ctxt_id, "%s%s%s", context, GETTEXT_CONTEXT_GLUE, message);
translation = (char*)dcgettext(TEXT_DOMAIN_NAME, msg_ctxt_id, LC_MESSAGES);
translation = (char *)dcgettext(TEXT_DOMAIN_NAME, msg_ctxt_id, LC_MESSAGES);
if (dynamic_msg_ctxt_id)
free(dynamic_msg_ctxt_id);

@ -74,6 +74,8 @@
#include "BKE_customdata.h"
#include "BKE_bvhutils.h"
struct CCGElem;
struct CCGKey;
struct MVert;
struct MEdge;
struct MFace;
@ -102,11 +104,6 @@ struct PBVH;
* Also, the mface origindex layer indexes mpolys, not mfaces.
*/
typedef struct DMGridData {
float co[3];
float no[3];
} DMGridData;
typedef struct DMGridAdjacency {
int index[4];
int rotation[4];
@ -250,9 +247,10 @@ struct DerivedMesh {
/* optional grid access for subsurf */
int (*getNumGrids)(DerivedMesh *dm);
int (*getGridSize)(DerivedMesh *dm);
DMGridData **(*getGridData)(DerivedMesh *dm);
struct CCGElem **(*getGridData)(DerivedMesh *dm);
DMGridAdjacency *(*getGridAdjacency)(DerivedMesh *dm);
int *(*getGridOffset)(DerivedMesh *dm);
void (*getGridKey)(DerivedMesh *dm, struct CCGKey *key);
DMFlagMat *(*getGridFlagMats)(DerivedMesh *dm);
unsigned int **(*getGridHidden)(DerivedMesh *dm);

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
#define BLENDER_SUBVERSION 4
#define BLENDER_SUBVERSION 5
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0

@ -0,0 +1,168 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2012 by Nicholas Bishop.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CCG_H__
#define __BKE_CCG_H__
/* defines BLI_INLINE */
#include "BLI_utildefines.h"
/* declares fprintf() and abort(), needed for BLI_assert */
#include <stdio.h>
#include <stdlib.h>
struct CCGSubSurf;
/* Each CCGElem is CCGSubSurf's representation of a subdivided
vertex. All CCGElems in a particular CCGSubSurf have the same
layout, but the layout can vary from one CCGSubSurf to another. For
this reason, CCGElem is presented as an opaque pointer, and
elements should always be accompanied by a CCGKey, which provides
the necessary offsets to access components of a CCGElem.
*/
typedef struct CCGElem CCGElem;
typedef struct CCGKey {
int level;
/* number of bytes in each element (one float per layer, plus
three floats for normals if enabled) */
int elem_size;
/* number of elements along each side of grid */
int grid_size;
/* number of elements in the grid (grid size squared) */
int grid_area;
/* number of bytes in each grid (grid_area * elem_size) */
int grid_bytes;
/* currently always the last three floats, unless normals are
disabled */
int normal_offset;
/* offset in bytes of mask value; only valid if 'has_mask' is
true */
int mask_offset;
int num_layers;
int has_normals;
int has_mask;
} CCGKey;
/* initialize 'key' at the specified level */
void CCG_key(CCGKey *key, const struct CCGSubSurf *ss, int level);
void CCG_key_top_level(CCGKey *key, const struct CCGSubSurf *ss);
/* get a pointer to the coordinate, normal, or mask components */
BLI_INLINE float *CCG_elem_co(const CCGKey *key, CCGElem *elem);
BLI_INLINE float *CCG_elem_no(const CCGKey *key, CCGElem *elem);
BLI_INLINE float *CCG_elem_mask(const CCGKey *key, CCGElem *elem);
/* get the element at 'offset' in an array */
BLI_INLINE CCGElem *CCG_elem_offset(const CCGKey *key, CCGElem *elem, int offset);
/* get the element at coordinate (x,y) in a face-grid array */
BLI_INLINE CCGElem *CCG_grid_elem(const CCGKey *key, CCGElem *elem, int x, int y);
/* combinations of above functions */
BLI_INLINE float *CCG_grid_elem_co(const CCGKey *key, CCGElem *elem, int x, int y);
BLI_INLINE float *CCG_grid_elem_no(const CCGKey *key, CCGElem *elem, int x, int y);
BLI_INLINE float *CCG_grid_elem_mask(const CCGKey *key, CCGElem *elem, int x, int y);
BLI_INLINE float *CCG_elem_offset_co(const CCGKey *key, CCGElem *elem, int offset);
BLI_INLINE float *CCG_elem_offset_no(const CCGKey *key, CCGElem *elem, int offset);
BLI_INLINE float *CCG_elem_offset_mask(const CCGKey *key, CCGElem *elem, int offset);
/* for iteration, get a pointer to the next element in an array */
BLI_INLINE CCGElem *CCG_elem_next(const CCGKey *key, CCGElem *elem);
/* inline definitions follow */
BLI_INLINE float *CCG_elem_co(const CCGKey *UNUSED(key), CCGElem *elem)
{
return (float*)elem;
}
BLI_INLINE float *CCG_elem_no(const CCGKey *key, CCGElem *elem)
{
BLI_assert(key->has_normals);
return (float*)((char*)elem + key->normal_offset);
}
BLI_INLINE float *CCG_elem_mask(const CCGKey *key, CCGElem *elem)
{
BLI_assert(key->has_mask);
return (float*)((char*)elem + (key->mask_offset));
}
BLI_INLINE CCGElem *CCG_elem_offset(const CCGKey *key, CCGElem *elem, int offset)
{
return (CCGElem*)(((char*)elem) + key->elem_size * offset);
}
BLI_INLINE CCGElem *CCG_grid_elem(const CCGKey *key, CCGElem *elem, int x, int y)
{
BLI_assert(x < key->grid_size && y < key->grid_size);
return CCG_elem_offset(key, elem, (y * key->grid_size + x));
}
BLI_INLINE float *CCG_grid_elem_co(const CCGKey *key, CCGElem *elem, int x, int y)
{
return CCG_elem_co(key, CCG_grid_elem(key, elem, x, y));
}
BLI_INLINE float *CCG_grid_elem_no(const CCGKey *key, CCGElem *elem, int x, int y)
{
return CCG_elem_no(key, CCG_grid_elem(key, elem, x, y));
}
BLI_INLINE float *CCG_grid_elem_mask(const CCGKey *key, CCGElem *elem, int x, int y)
{
return CCG_elem_mask(key, CCG_grid_elem(key, elem, x, y));
}
BLI_INLINE float *CCG_elem_offset_co(const CCGKey *key, CCGElem *elem, int offset)
{
return CCG_elem_co(key, CCG_elem_offset(key, elem, offset));
}
BLI_INLINE float *CCG_elem_offset_no(const CCGKey *key, CCGElem *elem, int offset)
{
return CCG_elem_no(key, CCG_elem_offset(key, elem, offset));
}
BLI_INLINE float *CCG_elem_offset_mask(const CCGKey *key, CCGElem *elem, int offset)
{
return CCG_elem_mask(key, CCG_elem_offset(key, elem, offset));
}
BLI_INLINE CCGElem *CCG_elem_next(const CCGKey *key, CCGElem *elem)
{
return CCG_elem_offset(key, elem, 1);
}
#endif

@ -109,6 +109,12 @@ typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object
typedef void (*IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin);
typedef void (*TexWalkFunc)(void *userData, struct Object *ob, struct ModifierData *md, const char *propname);
typedef enum ModifierApplyFlag {
MOD_APPLY_RENDER = 1 << 0, /* Render time. */
MOD_APPLY_USECACHE = 1 << 1, /* Last modifier in stack. */
} ModifierApplyFlag;
typedef struct ModifierTypeInfo {
/* The user visible name for this modifier */
char name[32];
@ -142,7 +148,7 @@ typedef struct ModifierTypeInfo {
void (*deformVerts)(struct ModifierData *md, struct Object *ob,
struct DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts,
int useRenderParams, int isFinalCalc);
ModifierApplyFlag flag);
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
void (*deformMatrices)(
@ -187,7 +193,7 @@ typedef struct ModifierTypeInfo {
struct DerivedMesh *(*applyModifier)(
struct ModifierData *md, struct Object *ob,
struct DerivedMesh *derivedData,
int useRenderParams, int isFinalCalc);
ModifierApplyFlag flag);
/* Like applyModifier but called during editmode (for supporting
* modifiers).

@ -44,7 +44,7 @@ struct MultiresModifierData;
struct Object;
struct Scene;
/* Delete mesh mdisps */
/* Delete mesh mdisps and grid paint masks */
void multires_customdata_delete(struct Mesh *me);
void multires_mark_as_modified(struct Object *ob, enum MultiresModifiedFlags flags);
@ -59,24 +59,32 @@ void multires_modifier_update_hidden(struct DerivedMesh *dm);
void multiresModifier_set_levels_from_disps(struct MultiresModifierData *mmd, struct Object *ob);
struct DerivedMesh *multires_dm_create_from_derived(struct MultiresModifierData*,
int local_mmd, struct DerivedMesh*, struct Object *, int);
typedef enum {
MULTIRES_USE_LOCAL_MMD = 1,
MULTIRES_USE_RENDER_PARAMS = 2,
MULTIRES_ALLOC_PAINT_MASK = 4
} MultiresFlags;
struct DerivedMesh *multires_make_derived_from_derived(struct DerivedMesh *dm,
struct MultiresModifierData *mmd,
struct Object *ob,
MultiresFlags flags);
struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene,
struct ModifierData *lastmd);
struct ModifierData *lastmd);
struct MultiresModifierData *get_multires_modifier(struct Scene *scene, struct Object *ob, int use_first);
struct DerivedMesh *get_multires_dm(struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *ob);
struct Object *ob);
void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction);
void multiresModifier_base_apply(struct MultiresModifierData *mmd, struct Object *ob);
void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Object *ob,
int updateblock, int simple);
int updateblock, int simple);
int multiresModifier_reshape(struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *dst, struct Object *src);
struct Object *dst, struct Object *src);
int multiresModifier_reshapeFromDM(struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *ob, struct DerivedMesh *srcdm);
struct Object *ob, struct DerivedMesh *srcdm);
int multiresModifier_reshapeFromDeformMod(struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *ob, struct ModifierData *md);
struct Object *ob, struct ModifierData *md);
void multires_stitch_grids(struct Object *);

@ -684,6 +684,11 @@ void ntreeCompositClearTags(struct bNodeTree *ntree);
struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, struct bNode *node,
const char *name, struct ImageFormatData *im_format);
int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node);
void ntreeCompositOutputFileSetPath(struct bNode *node, struct bNodeSocket *sock, const char *name);
void ntreeCompositOutputFileSetLayer(struct bNode *node, struct bNodeSocket *sock, const char *name);
/* needed in do_versions */
void ntreeCompositOutputFileUniquePath(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim);
void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim);
/* ************** TEXTURE NODES *************** */

@ -35,6 +35,7 @@
struct Brush;
struct MDisps;
struct MeshElemMap;
struct GridPaintMask;
struct MFace;
struct MultireModifierData;
struct MVert;
@ -66,7 +67,11 @@ int paint_vertsel_test(struct Object *ob);
/* partial visibility */
int paint_is_face_hidden(const struct MFace *f, const struct MVert *mvert);
int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
int gridsize, int x, int y);
int gridsize, int x, int y);
/* paint masks */
float paint_grid_paint_mask(const struct GridPaintMask *gpm, unsigned level,
unsigned x, unsigned y);
/* Session data (mode-specific) */
@ -79,6 +84,7 @@ typedef struct SculptSession {
int totvert, totpoly;
float *face_normals;
struct KeyBlock *kb;
float *vmask;
/* Mesh connectivity */
const struct MeshElemMap *pmap;

@ -170,6 +170,22 @@ struct ImBuf *give_ibuf_seq_direct(SeqRenderData context, float cfra, struct Seq
struct ImBuf *give_ibuf_seqbase(SeqRenderData context, float cfra, int chan_shown, struct ListBase *seqbasep);
void give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chan_shown);
/* **********************************************************************
* sequencer scene functions
* ********************************************************************** */
struct Editing *BKE_sequencer_editing_get(struct Scene *scene, int alloc);
struct Editing *BKE_sequencer_editing_ensure(struct Scene *scene);
void BKE_sequencer_editing_free(struct Scene *scene);
void BKE_sequencer_sort(struct Scene *scene);
struct Sequence *BKE_sequencer_active_get(struct Scene *scene);
int BKE_sequencer_active_get_pair(struct Scene *scene,
struct Sequence **seq_act, struct Sequence **seq_other);
void BKE_sequencer_active_set(struct Scene *scene, struct Sequence *seq);
/* apply functions recursively */
int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg);
@ -179,14 +195,12 @@ int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence
void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq);
void seq_free_strip(struct Strip *strip);
void seq_free_editing(struct Scene *scene);
void seq_free_clipboard(void);
struct Editing *seq_give_editing(struct Scene *scene, int alloc);
const char *give_seqname(struct Sequence *seq);
void calc_sequence(struct Scene *scene, struct Sequence *seq);
void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);
void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range);
void sort_seq(struct Scene *scene);
void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq,
int (*test_func)(struct Sequence * seq));
int evaluate_seq_frame(struct Scene *scene, int cfra);
@ -296,10 +310,6 @@ void clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce);
struct Sequence *get_seq_by_name(struct ListBase *seqbase, const char *name, int recursive);
struct Sequence *seq_active_get(struct Scene *scene);
void seq_active_set(struct Scene *scene, struct Sequence *seq);
int seq_active_pair_get(struct Scene *scene, struct Sequence **seq_act, struct Sequence **seq_other);
/* api for adding new sequence strips */
typedef struct SeqLoadInfo {
int start_frame;

@ -41,8 +41,7 @@ struct ListBase;
struct Main;
struct Sequence;
typedef struct SoundWaveform
{
typedef struct SoundWaveform {
int length;
float *data;
} SoundWaveform;
@ -58,29 +57,29 @@ void sound_exit(void);
void sound_force_device(int device);
int sound_define_from_str(const char *str);
struct bSound* sound_new_file(struct Main *main, const char *filename);
struct bSound *sound_new_file(struct Main *main, const char *filename);
// XXX unused currently
#if 0
struct bSound* sound_new_buffer(struct Main *bmain, struct bSound *source);
struct bSound *sound_new_buffer(struct Main *bmain, struct bSound *source);
struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, float start, float end);
struct bSound *sound_new_limiter(struct Main *bmain, struct bSound *source, float start, float end);
#endif
void sound_delete(struct Main *bmain, struct bSound* sound);
void sound_delete(struct Main *bmain, struct bSound *sound);
void sound_cache(struct bSound* sound);
void sound_cache(struct bSound *sound);
void sound_cache_notifying(struct Main* main, struct bSound* sound);
void sound_cache_notifying(struct Main *main, struct bSound *sound);
void sound_delete_cache(struct bSound* sound);
void sound_delete_cache(struct bSound *sound);
void sound_load(struct Main *main, struct bSound* sound);
void sound_load(struct Main *main, struct bSound *sound);
void BKE_sound_free(struct bSound* sound);
void BKE_sound_free(struct bSound *sound);
#ifdef __AUD_C_API_H__
AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
AUD_Device *sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
#endif
void sound_create_scene(struct Scene *scene);
@ -93,32 +92,32 @@ void sound_update_fps(struct Scene *scene);
void sound_update_scene_listener(struct Scene *scene);
void* sound_scene_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip);
void* sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence* sequence);
void *sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
void *sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip);
void* sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence* sequence);
void *sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
void *sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void sound_remove_scene_sound(struct Scene *scene, void* handle);
void sound_remove_scene_sound(struct Scene *scene, void *handle);
void sound_mute_scene_sound(void* handle, char mute);
void sound_mute_scene_sound(void *handle, char mute);
void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, int endframe, int frameskip);
void sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip);
void sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void sound_update_scene_sound(void* handle, struct bSound* sound);
void sound_update_scene_sound(void *handle, struct bSound *sound);
void sound_set_cfra(int cfra);
void sound_set_scene_volume(struct Scene *scene, float volume);
void sound_set_scene_sound_volume(void* handle, float volume, char animated);
void sound_set_scene_sound_volume(void *handle, float volume, char animated);
void sound_set_scene_sound_pitch(void* handle, float pitch, char animated);
void sound_set_scene_sound_pitch(void *handle, float pitch, char animated);
void sound_set_scene_sound_pan(void* handle, float pan, char animated);
void sound_set_scene_sound_pan(void *handle, float pan, char animated);
void sound_update_sequencer(struct Main* main, struct bSound* sound);
void sound_update_sequencer(struct Main *main, struct bSound *sound);
void sound_play_scene(struct Scene *scene);
@ -130,12 +129,14 @@ float sound_sync_scene(struct Scene *scene);
int sound_scene_playing(struct Scene *scene);
void sound_free_waveform(struct bSound* sound);
void sound_free_waveform(struct bSound *sound);
void sound_read_waveform(struct bSound* sound);
void sound_read_waveform(struct bSound *sound);
void sound_update_scene(struct Scene* scene);
void sound_update_scene(struct Scene *scene);
void* sound_get_factory(void* sound);
void *sound_get_factory(void *sound);
float sound_get_length(struct bSound *sound);
#endif

@ -34,9 +34,9 @@
/* struct DerivedMesh is used directly */
#include "BKE_DerivedMesh.h"
struct CCGElem;
struct DMFlagMat;
struct DMGridAdjacency;
struct DMGridData;
struct DerivedMesh;
struct MeshElemMap;
struct Mesh;
@ -51,16 +51,23 @@ struct CCGSubsurf;
struct CCGVert;
struct EdgeHash;
struct PBVH;
struct DMGridData;
struct DMGridAdjacency;
/**************************** External *****************************/
typedef enum {
SUBSURF_USE_RENDER_PARAMS = 1,
SUBSURF_IS_FINAL_CALC = 2,
SUBSURF_FOR_EDIT_MODE = 4,
SUBSURF_IN_EDIT_MODE = 8,
SUBSURF_ALLOC_PAINT_MASK = 16
} SubsurfFlags;
struct DerivedMesh *subsurf_make_derived_from_derived(
struct DerivedMesh *dm,
struct SubsurfModifierData *smd,
int useRenderParams, float (*vertCos)[3],
int isFinalCalc, int forEditMode, int inEditMode);
struct DerivedMesh *dm,
struct SubsurfModifierData *smd,
float (*vertCos)[3],
SubsurfFlags flags);
void subsurf_calculate_limit_positions(struct Mesh *me, float (*positions_r)[3]);
@ -72,9 +79,13 @@ int ccg_gridsize(int level);
int ccg_factor(int low_level, int high_level);
void subsurf_copy_grid_hidden(struct DerivedMesh *dm,
const struct MPoly *mpoly,
struct MVert *mvert,
const struct MDisps *mdisps);
const struct MPoly *mpoly,
struct MVert *mvert,
const struct MDisps *mdisps);
void subsurf_copy_grid_paint_mask(struct DerivedMesh *dm,
const struct MPoly *mpoly, float *paint_mask,
const struct GridPaintMask *grid_paint_mask);
typedef enum MultiresModifiedFlags {
/* indicates the grids have been sculpted on, so MDisps
@ -93,10 +104,10 @@ typedef struct CCGDerivedMesh {
int freeSS;
int drawInteriorEdges, useSubsurfUv;
struct {int startVert; struct CCGVert *vert;} *vertMap;
struct {int startVert; int startEdge; struct CCGEdge *edge;} *edgeMap;
struct {int startVert; struct CCGVert *vert; } *vertMap;
struct {int startVert; int startEdge; struct CCGEdge *edge; } *edgeMap;
struct {int startVert; int startEdge;
int startFace; struct CCGFace *face;} *faceMap;
int startFace; struct CCGFace *face; } *faceMap;
short *edgeFlags;
struct DMFlagMat *faceFlags;
@ -108,7 +119,7 @@ typedef struct CCGDerivedMesh {
struct MeshElemMap *pmap;
int *pmap_mem;
struct DMGridData **gridData;
struct CCGElem **gridData;
struct DMGridAdjacency *gridAdjacency;
int *gridOffset;
struct CCGFace **gridFaces;

@ -7,6 +7,7 @@
#include <string.h>
#include <math.h>
#include "BKE_ccg.h"
#include "CCGSubSurf.h"
#include "BKE_subsurf.h"
@ -274,22 +275,6 @@ static int ccg_edgebase(int level)
/***/
static int VertDataEqual(const float *a, const float *b)
{
return a[0] == b[0] && a[1] == b[1] && a[2] == b[2];
}
#define VertDataZero(av) { float *_a = (float *)av; _a[0] = _a[1] = _a[2] = 0.0f; }
#define VertDataCopy(av, bv) { float *_a = (float *)av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; }
#define VertDataAdd(av, bv) { float *_a = (float *)av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
#define VertDataSub(av, bv) { float *_a = (float *)av, *_b = (float *) bv; _a[0] -= _b[0]; _a[1] -= _b[1]; _a[2] -= _b[2]; }
#define VertDataMulN(av, n) { float *_a = (float *)av; float _n = n; _a[0] *= _n; _a[1] *= _n; _a[2] *= _n; }
#define VertDataAvg4(tv, av, bv, cv, dv) \
{ \
float *_t = (float *) tv, *_a = (float *) av, *_b = (float *) bv, *_c = (float *) cv, *_d = (float *) dv; \
_t[0] = (_a[0] + _b[0] + _c[0] + _d[0]) * 0.25f; \
_t[1] = (_a[1] + _b[1] + _c[1] + _d[1]) * 0.25f; \
_t[2] = (_a[2] + _b[2] + _c[2] + _d[2]) * 0.25f; \
}
#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; }
#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; }
#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
@ -402,6 +387,10 @@ struct CCGSubSurf {
int calcVertNormals;
int normalDataOffset;
/* data for paint masks */
int allocMask;
int maskDataOffset;
/* data for age'ing (to debug sync) */
int currentAge;
int useAgeCounts;
@ -424,6 +413,61 @@ struct CCGSubSurf {
/***/
static int VertDataEqual(const float a[], const float b[], const CCGSubSurf *ss)
{
int i;
for(i = 0; i < ss->meshIFC.numLayers; i++) {
if(a[i] != b[i])
return 0;
}
return 1;
}
static void VertDataZero(float v[], const CCGSubSurf *ss)
{
memset(v, 0, sizeof(float) * ss->meshIFC.numLayers);
}
static void VertDataCopy(float dst[], const float src[], const CCGSubSurf *ss)
{
int i;
for(i = 0; i < ss->meshIFC.numLayers; i++)
dst[i] = src[i];
}
static void VertDataAdd(float a[], const float b[], const CCGSubSurf *ss)
{
int i;
for(i = 0; i < ss->meshIFC.numLayers; i++)
a[i] += b[i];
}
static void VertDataSub(float a[], const float b[], const CCGSubSurf *ss)
{
int i;
for(i = 0; i < ss->meshIFC.numLayers; i++)
a[i] -= b[i];
}
static void VertDataMulN(float v[], float f, const CCGSubSurf *ss)
{
int i;
for(i = 0; i < ss->meshIFC.numLayers; i++)
v[i] *= f;
}
static void VertDataAvg4(float v[],
const float a[], const float b[],
const float c[], const float d[],
const CCGSubSurf *ss)
{
int i;
for(i = 0; i < ss->meshIFC.numLayers; i++)
v[i] = (a[i] + b[i] + c[i] + d[i]) * 0.25f;
}
/***/
static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss)
{
int num_vert_data = ss->subdivLevels + 1;
@ -812,6 +856,8 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a
ss->calcVertNormals = 0;
ss->normalDataOffset = 0;
ss->allocMask = 0;
ss->q = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
ss->r = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
@ -956,6 +1002,17 @@ CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int
return eCCGError_None;
}
void ccgSubSurf_setAllocMask(CCGSubSurf *ss, int allocMask, int maskOffset)
{
ss->allocMask = allocMask;
ss->maskDataOffset = maskOffset;
}
void ccgSubSurf_setNumLayers(CCGSubSurf *ss, int numLayers)
{
ss->meshIFC.numLayers = numLayers;
}
/***/
CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss)
@ -1071,14 +1128,15 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
v = _ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
if (!v) {
v = _vert_new(vHDL, ss);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData, ss);
_ehash_insert(ss->vMap, (EHEntry *) v);
v->flags = Vert_eEffected | seamflag;
}
else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize), ss) ||
((v->flags & Vert_eSeam) != seamflag)) {
int i, j;
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData, ss);
v->flags = Vert_eEffected | seamflag;
for (i = 0; i < v->numEdges; i++) {
@ -1102,14 +1160,15 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
v = _ehash_lookupWithPrev(ss->oldVMap, vHDL, &prevp);
if (!v) {
v = _vert_new(vHDL, ss);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData, ss);
_ehash_insert(ss->vMap, (EHEntry *) v);
v->flags = Vert_eEffected | seamflag;
}
else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize), ss) ||
((v->flags & Vert_eSeam) != seamflag)) {
*prevp = v->next;
_ehash_insert(ss->vMap, (EHEntry *) v);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData, ss);
v->flags = Vert_eEffected | Vert_eChanged | seamflag;
}
else {
@ -1516,7 +1575,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
}
VertDataCopy((float *)((byte *)FACE_getCenterData(f) + normalDataOffset),
FACE_getIFNo(f, lvl, S, 0, 0));
FACE_getIFNo(f, lvl, S, 0, 0), ss);
for (x = 1; x < gridSize - 1; x++)
NormCopy(FACE_getIENo(f, lvl, S, x),
@ -1587,7 +1646,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
void *co3 = FACE_getIFCo(f, curLvl, S, x + 0, y + 1);
void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
VertDataAvg4(co, co0, co1, co2, co3);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
}
}
@ -1605,7 +1664,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
void *co3 = FACE_getIFCo(f, nextLvl, S, fx, 1);
void *co = FACE_getIECo(f, nextLvl, S, fx);
VertDataAvg4(co, co0, co1, co2, co3);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
/* interior face interior edge midpoints
@ -1624,7 +1683,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
void *co3 = FACE_getIFCo(f, nextLvl, S, fx + 1, fy);
void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
VertDataAvg4(co, co0, co1, co2, co3);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
}
@ -1639,7 +1698,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
void *co3 = FACE_getIFCo(f, nextLvl, S, fx, fy + 1);
void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
VertDataAvg4(co, co0, co1, co2, co3);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
}
}
@ -1661,9 +1720,9 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
void *co1 = EDGE_getCo(e, curLvl, x + 1);
void *co = EDGE_getCo(e, nextLvl, fx);
VertDataCopy(co, co0);
VertDataAdd(co, co1);
VertDataMulN(co, 0.5f);
VertDataCopy(co, co0, ss);
VertDataAdd(co, co1, ss);
VertDataMulN(co, 0.5f, ss);
}
}
else {
@ -1674,26 +1733,26 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
void *co = EDGE_getCo(e, nextLvl, fx);
int numFaces = 0;
VertDataCopy(q, co0);
VertDataAdd(q, co1);
VertDataCopy(q, co0, ss);
VertDataAdd(q, co1, ss);
for (j = 0; j < e->numFaces; j++) {
CCGFace *f = e->faces[j];
const int f_ed_idx = _face_getEdgeIndex(f, e);
VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx, 1, subdivLevels, vertDataSize));
VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx, 1, subdivLevels, vertDataSize), ss);
numFaces++;
}
VertDataMulN(q, 1.0f / (2.0f + numFaces));
VertDataMulN(q, 1.0f / (2.0f + numFaces), ss);
VertDataCopy(r, co0);
VertDataAdd(r, co1);
VertDataMulN(r, 0.5f);
VertDataCopy(r, co0, ss);
VertDataAdd(r, co1, ss);
VertDataMulN(r, 0.5f, ss);
VertDataCopy(co, q);
VertDataSub(r, q);
VertDataMulN(r, sharpness);
VertDataAdd(co, r);
VertDataCopy(co, q, ss);
VertDataSub(r, q, ss);
VertDataMulN(r, sharpness, ss);
VertDataAdd(co, r, ss);
}
}
}
@ -1738,53 +1797,53 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
seam = 0;
if (!v->numEdges) {
VertDataCopy(nCo, co);
VertDataCopy(nCo, co, ss);
}
else if (_vert_isBoundary(v)) {
int numBoundary = 0;
VertDataZero(r);
VertDataZero(r, ss);
for (j = 0; j < v->numEdges; j++) {
CCGEdge *e = v->edges[j];
if (_edge_isBoundary(e)) {
VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize), ss);
numBoundary++;
}
}
VertDataCopy(nCo, co);
VertDataMulN(nCo, 0.75f);
VertDataMulN(r, 0.25f / numBoundary);
VertDataAdd(nCo, r);
VertDataCopy(nCo, co, ss);
VertDataMulN(nCo, 0.75f, ss);
VertDataMulN(r, 0.25f / numBoundary, ss);
VertDataAdd(nCo, r, ss);
}
else {
int cornerIdx = (1 + (1 << (curLvl))) - 2;
int numEdges = 0, numFaces = 0;
VertDataZero(q);
VertDataZero(q, ss);
for (j = 0; j < v->numFaces; j++) {
CCGFace *f = v->faces[j];
VertDataAdd(q, FACE_getIFCo(f, nextLvl, _face_getVertIndex(f, v), cornerIdx, cornerIdx));
VertDataAdd(q, FACE_getIFCo(f, nextLvl, _face_getVertIndex(f, v), cornerIdx, cornerIdx), ss);
numFaces++;
}
VertDataMulN(q, 1.0f / numFaces);
VertDataZero(r);
VertDataMulN(q, 1.0f / numFaces, ss);
VertDataZero(r, ss);
for (j = 0; j < v->numEdges; j++) {
CCGEdge *e = v->edges[j];
VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize), ss);
numEdges++;
}
VertDataMulN(r, 1.0f / numEdges);
VertDataMulN(r, 1.0f / numEdges, ss);
VertDataCopy(nCo, co);
VertDataMulN(nCo, numEdges - 2.0f);
VertDataAdd(nCo, q);
VertDataAdd(nCo, r);
VertDataMulN(nCo, 1.0f / numEdges);
VertDataCopy(nCo, co, ss);
VertDataMulN(nCo, numEdges - 2.0f, ss);
VertDataAdd(nCo, q, ss);
VertDataAdd(nCo, r, ss);
VertDataMulN(nCo, 1.0f / numEdges, ss);
}
if ((sharpCount > 1 && v->numFaces) || seam) {
VertDataZero(q);
VertDataZero(q, ss);
if (seam) {
avgSharpness = 1.0f;
@ -1798,33 +1857,33 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
if (seam) {
if (_edge_isBoundary(e))
VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize), ss);
}
else if (sharpness != 0.0f) {
VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize), ss);
}
}
VertDataMulN(q, (float) 1 / sharpCount);
VertDataMulN(q, (float) 1 / sharpCount, ss);
if (sharpCount != 2 || allSharp) {
/* q = q + (co - q) * avgSharpness */
VertDataCopy(r, co);
VertDataSub(r, q);
VertDataMulN(r, avgSharpness);
VertDataAdd(q, r);
VertDataCopy(r, co, ss);
VertDataSub(r, q, ss);
VertDataMulN(r, avgSharpness, ss);
VertDataAdd(q, r, ss);
}
/* r = co * 0.75 + q * 0.25 */
VertDataCopy(r, co);
VertDataMulN(r, .75f);
VertDataMulN(q, .25f);
VertDataAdd(r, q);
VertDataCopy(r, co, ss);
VertDataMulN(r, .75f, ss);
VertDataMulN(q, .25f, ss);
VertDataAdd(r, q, ss);
/* nCo = nCo + (r - nCo) * avgSharpness */
VertDataSub(r, nCo);
VertDataMulN(r, avgSharpness);
VertDataAdd(nCo, r);
VertDataSub(r, nCo, ss);
VertDataMulN(r, avgSharpness, ss);
VertDataAdd(nCo, r, ss);
}
}
@ -1858,13 +1917,13 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
int fx = x * 2;
void *co = EDGE_getCo(e, curLvl, x);
void *nCo = EDGE_getCo(e, nextLvl, fx);
VertDataCopy(r, EDGE_getCo(e, curLvl, x - 1));
VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1));
VertDataMulN(r, 0.5f);
VertDataCopy(nCo, co);
VertDataMulN(nCo, 0.75f);
VertDataMulN(r, 0.25f);
VertDataAdd(nCo, r);
VertDataCopy(r, EDGE_getCo(e, curLvl, x - 1), ss);
VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1), ss);
VertDataMulN(r, 0.5f, ss);
VertDataCopy(nCo, co, ss);
VertDataMulN(nCo, 0.75f, ss);
VertDataMulN(r, 0.25f, ss);
VertDataAdd(nCo, r, ss);
}
}
else {
@ -1874,38 +1933,38 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
void *nCo = EDGE_getCo(e, nextLvl, fx);
int numFaces = 0;
VertDataZero(q);
VertDataZero(r);
VertDataAdd(r, EDGE_getCo(e, curLvl, x - 1));
VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1));
VertDataZero(q, ss);
VertDataZero(r, ss);
VertDataAdd(r, EDGE_getCo(e, curLvl, x - 1), ss);
VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1), ss);
for (j = 0; j < e->numFaces; j++) {
CCGFace *f = e->faces[j];
int f_ed_idx = _face_getEdgeIndex(f, e);
VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx - 1, 1, subdivLevels, vertDataSize));
VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx + 1, 1, subdivLevels, vertDataSize));
VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx - 1, 1, subdivLevels, vertDataSize), ss);
VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx + 1, 1, subdivLevels, vertDataSize), ss);
VertDataAdd(r, _face_getIFCoEdge(f, e, f_ed_idx, curLvl, x, 1, subdivLevels, vertDataSize));
VertDataAdd(r, _face_getIFCoEdge(f, e, f_ed_idx, curLvl, x, 1, subdivLevels, vertDataSize), ss);
numFaces++;
}
VertDataMulN(q, 1.0f / (numFaces * 2.0f));
VertDataMulN(r, 1.0f / (2.0f + numFaces));
VertDataMulN(q, 1.0f / (numFaces * 2.0f), ss);
VertDataMulN(r, 1.0f / (2.0f + numFaces), ss);
VertDataCopy(nCo, co);
VertDataMulN(nCo, (float) numFaces);
VertDataAdd(nCo, q);
VertDataAdd(nCo, r);
VertDataMulN(nCo, 1.0f / (2 + numFaces));
VertDataCopy(nCo, co, ss);
VertDataMulN(nCo, (float) numFaces, ss);
VertDataAdd(nCo, q, ss);
VertDataAdd(nCo, r, ss);
VertDataMulN(nCo, 1.0f / (2 + numFaces), ss);
if (sharpCount == 2) {
VertDataCopy(q, co);
VertDataMulN(q, 6.0f);
VertDataAdd(q, EDGE_getCo(e, curLvl, x - 1));
VertDataAdd(q, EDGE_getCo(e, curLvl, x + 1));
VertDataMulN(q, 1 / 8.0f);
VertDataCopy(q, co, ss);
VertDataMulN(q, 6.0f, ss);
VertDataAdd(q, EDGE_getCo(e, curLvl, x - 1), ss);
VertDataAdd(q, EDGE_getCo(e, curLvl, x + 1), ss);
VertDataMulN(q, 1 / 8.0f, ss);
VertDataSub(q, nCo);
VertDataMulN(q, avgSharpness);
VertDataAdd(nCo, q);
VertDataSub(q, nCo, ss);
VertDataMulN(q, avgSharpness, ss);
VertDataAdd(nCo, q, ss);
}
}
}
@ -1931,21 +1990,21 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
* - old interior edge points
* - new interior face midpoints
*/
VertDataZero(q);
VertDataZero(q, ss);
for (S = 0; S < f->numVerts; S++) {
VertDataAdd(q, FACE_getIFCo(f, nextLvl, S, 1, 1));
VertDataAdd(q, FACE_getIFCo(f, nextLvl, S, 1, 1), ss);
}
VertDataMulN(q, 1.0f / f->numVerts);
VertDataZero(r);
VertDataMulN(q, 1.0f / f->numVerts, ss);
VertDataZero(r, ss);
for (S = 0; S < f->numVerts; S++) {
VertDataAdd(r, FACE_getIECo(f, curLvl, S, 1));
VertDataAdd(r, FACE_getIECo(f, curLvl, S, 1), ss);
}
VertDataMulN(r, 1.0f / f->numVerts);
VertDataMulN(r, 1.0f / f->numVerts, ss);
VertDataMulN(FACE_getCenterData(f), f->numVerts - 2.0f);
VertDataAdd(FACE_getCenterData(f), q);
VertDataAdd(FACE_getCenterData(f), r);
VertDataMulN(FACE_getCenterData(f), 1.0f / f->numVerts);
VertDataMulN((float*)FACE_getCenterData(f), f->numVerts - 2.0f, ss);
VertDataAdd((float*)FACE_getCenterData(f), q, ss);
VertDataAdd((float*)FACE_getCenterData(f), r, ss);
VertDataMulN((float*)FACE_getCenterData(f), 1.0f / f->numVerts, ss);
for (S = 0; S < f->numVerts; S++) {
/* interior face shift
@ -1964,18 +2023,20 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
FACE_getIFCo(f, nextLvl, S, fx - 1, fy - 1),
FACE_getIFCo(f, nextLvl, S, fx + 1, fy - 1),
FACE_getIFCo(f, nextLvl, S, fx + 1, fy + 1),
FACE_getIFCo(f, nextLvl, S, fx - 1, fy + 1));
FACE_getIFCo(f, nextLvl, S, fx - 1, fy + 1),
ss);
VertDataAvg4(r,
FACE_getIFCo(f, nextLvl, S, fx - 1, fy + 0),
FACE_getIFCo(f, nextLvl, S, fx + 1, fy + 0),
FACE_getIFCo(f, nextLvl, S, fx + 0, fy - 1),
FACE_getIFCo(f, nextLvl, S, fx + 0, fy + 1));
FACE_getIFCo(f, nextLvl, S, fx + 0, fy + 1),
ss);
VertDataCopy(nCo, co);
VertDataSub(nCo, q);
VertDataMulN(nCo, 0.25f);
VertDataAdd(nCo, r);
VertDataCopy(nCo, co, ss);
VertDataSub(nCo, q, ss);
VertDataMulN(nCo, 0.25f, ss);
VertDataAdd(nCo, r, ss);
}
}
@ -1993,18 +2054,19 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx - 1),
FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx + 1),
FACE_getIFCo(f, nextLvl, S, fx + 1, +1),
FACE_getIFCo(f, nextLvl, S, fx - 1, +1));
FACE_getIFCo(f, nextLvl, S, fx - 1, +1), ss);
VertDataAvg4(r,
FACE_getIECo(f, nextLvl, S, fx - 1),
FACE_getIECo(f, nextLvl, S, fx + 1),
FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx),
FACE_getIFCo(f, nextLvl, S, fx, 1));
FACE_getIFCo(f, nextLvl, S, fx, 1),
ss);
VertDataCopy(nCo, co);
VertDataSub(nCo, q);
VertDataMulN(nCo, 0.25f);
VertDataAdd(nCo, r);
VertDataCopy(nCo, co, ss);
VertDataSub(nCo, q, ss);
VertDataMulN(nCo, 0.25f, ss);
VertDataAdd(nCo, r, ss);
}
}
}
@ -2024,8 +2086,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
#pragma omp parallel for private(i) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
for (i = 0; i < numEffectedE; i++) {
CCGEdge *e = effectedE[i];
VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl));
VertDataCopy(EDGE_getCo(e, nextLvl, edgeSize - 1), VERT_getCo(e->v1, nextLvl));
VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl), ss);
VertDataCopy(EDGE_getCo(e, nextLvl, edgeSize - 1), VERT_getCo(e->v1, nextLvl), ss);
}
#pragma omp parallel for private(i) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
@ -2037,19 +2099,19 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
CCGEdge *e = FACE_getEdges(f)[S];
CCGEdge *prevE = FACE_getEdges(f)[(S + f->numVerts - 1) % f->numVerts];
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), FACE_getCenterData(f));
VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), FACE_getCenterData(f));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], nextLvl));
VertDataCopy(FACE_getIECo(f, nextLvl, S, cornerIdx), EDGE_getCo(FACE_getEdges(f)[S], nextLvl, cornerIdx));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), (float*)FACE_getCenterData(f), ss);
VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), (float*)FACE_getCenterData(f), ss);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], nextLvl), ss);
VertDataCopy(FACE_getIECo(f, nextLvl, S, cornerIdx), EDGE_getCo(FACE_getEdges(f)[S], nextLvl, cornerIdx), ss);
for (x = 1; x < gridSize - 1; x++) {
void *co = FACE_getIECo(f, nextLvl, S, x);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, 0), co);
VertDataCopy(FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 0, x), co);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, 0), co, ss);
VertDataCopy(FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 0, x), co, ss);
}
for (x = 0; x < gridSize - 1; x++) {
int eI = gridSize - 1 - x;
VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize), ss);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize), ss);
}
}
}
@ -2103,11 +2165,11 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
CCGFace *f = effectedF[ptrIdx];
void *co = FACE_getCenterData(f);
VertDataZero(co);
VertDataZero(co, ss);
for (i = 0; i < f->numVerts; i++) {
VertDataAdd(co, VERT_getCo(FACE_getVerts(f)[i], curLvl));
VertDataAdd(co, VERT_getCo(FACE_getVerts(f)[i], curLvl), ss);
}
VertDataMulN(co, 1.0f / f->numVerts);
VertDataMulN(co, 1.0f / f->numVerts, ss);
f->flags = 0;
}
@ -2117,29 +2179,29 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
float sharpness = EDGE_getSharpness(e, curLvl);
if (_edge_isBoundary(e) || sharpness >= 1.0f) {
VertDataCopy(co, VERT_getCo(e->v0, curLvl));
VertDataAdd(co, VERT_getCo(e->v1, curLvl));
VertDataMulN(co, 0.5f);
VertDataCopy(co, VERT_getCo(e->v0, curLvl), ss);
VertDataAdd(co, VERT_getCo(e->v1, curLvl), ss);
VertDataMulN(co, 0.5f, ss);
}
else {
int numFaces = 0;
VertDataCopy(q, VERT_getCo(e->v0, curLvl));
VertDataAdd(q, VERT_getCo(e->v1, curLvl));
VertDataCopy(q, VERT_getCo(e->v0, curLvl), ss);
VertDataAdd(q, VERT_getCo(e->v1, curLvl), ss);
for (i = 0; i < e->numFaces; i++) {
CCGFace *f = e->faces[i];
VertDataAdd(q, FACE_getCenterData(f));
VertDataAdd(q, (float*)FACE_getCenterData(f), ss);
numFaces++;
}
VertDataMulN(q, 1.0f / (2.0f + numFaces));
VertDataMulN(q, 1.0f / (2.0f + numFaces), ss);
VertDataCopy(r, VERT_getCo(e->v0, curLvl));
VertDataAdd(r, VERT_getCo(e->v1, curLvl));
VertDataMulN(r, 0.5f);
VertDataCopy(r, VERT_getCo(e->v0, curLvl), ss);
VertDataAdd(r, VERT_getCo(e->v1, curLvl), ss);
VertDataMulN(r, 0.5f, ss);
VertDataCopy(co, q);
VertDataSub(r, q);
VertDataMulN(r, sharpness);
VertDataAdd(co, r);
VertDataCopy(co, q, ss);
VertDataSub(r, q, ss);
VertDataMulN(r, sharpness, ss);
VertDataAdd(co, r, ss);
}
// edge flags cleared later
@ -2179,51 +2241,51 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
seam = 0;
if (!v->numEdges) {
VertDataCopy(nCo, co);
VertDataCopy(nCo, co, ss);
}
else if (_vert_isBoundary(v)) {
int numBoundary = 0;
VertDataZero(r);
VertDataZero(r, ss);
for (i = 0; i < v->numEdges; i++) {
CCGEdge *e = v->edges[i];
if (_edge_isBoundary(e)) {
VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl));
VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl), ss);
numBoundary++;
}
}
VertDataCopy(nCo, co);
VertDataMulN(nCo, 0.75f);
VertDataMulN(r, 0.25f / numBoundary);
VertDataAdd(nCo, r);
VertDataCopy(nCo, co, ss);
VertDataMulN(nCo, 0.75f, ss);
VertDataMulN(r, 0.25f / numBoundary, ss);
VertDataAdd(nCo, r, ss);
}
else {
int numEdges = 0, numFaces = 0;
VertDataZero(q);
VertDataZero(q, ss);
for (i = 0; i < v->numFaces; i++) {
CCGFace *f = v->faces[i];
VertDataAdd(q, FACE_getCenterData(f));
VertDataAdd(q, (float*)FACE_getCenterData(f), ss);
numFaces++;
}
VertDataMulN(q, 1.0f / numFaces);
VertDataZero(r);
VertDataMulN(q, 1.0f / numFaces, ss);
VertDataZero(r, ss);
for (i = 0; i < v->numEdges; i++) {
CCGEdge *e = v->edges[i];
VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl));
VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl), ss);
numEdges++;
}
VertDataMulN(r, 1.0f / numEdges);
VertDataMulN(r, 1.0f / numEdges, ss);
VertDataCopy(nCo, co);
VertDataMulN(nCo, numEdges - 2.0f);
VertDataAdd(nCo, q);
VertDataAdd(nCo, r);
VertDataMulN(nCo, 1.0f / numEdges);
VertDataCopy(nCo, co, ss);
VertDataMulN(nCo, numEdges - 2.0f, ss);
VertDataAdd(nCo, q, ss);
VertDataAdd(nCo, r, ss);
VertDataMulN(nCo, 1.0f / numEdges, ss);
}
if (sharpCount > 1 || seam) {
VertDataZero(q);
VertDataZero(q, ss);
if (seam) {
avgSharpness = 1.0f;
@ -2238,35 +2300,35 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
if (seam) {
if (_edge_isBoundary(e)) {
CCGVert *oV = _edge_getOtherVert(e, v);
VertDataAdd(q, VERT_getCo(oV, curLvl));
VertDataAdd(q, VERT_getCo(oV, curLvl), ss);
}
}
else if (sharpness != 0.0f) {
CCGVert *oV = _edge_getOtherVert(e, v);
VertDataAdd(q, VERT_getCo(oV, curLvl));
VertDataAdd(q, VERT_getCo(oV, curLvl), ss);
}
}
VertDataMulN(q, (float) 1 / sharpCount);
VertDataMulN(q, (float) 1 / sharpCount, ss);
if (sharpCount != 2 || allSharp) {
/* q = q + (co - q) * avgSharpness */
VertDataCopy(r, co);
VertDataSub(r, q);
VertDataMulN(r, avgSharpness);
VertDataAdd(q, r);
VertDataCopy(r, co, ss);
VertDataSub(r, q, ss);
VertDataMulN(r, avgSharpness, ss);
VertDataAdd(q, r, ss);
}
/* r = co * 0.75 + q * 0.25 */
VertDataCopy(r, co);
VertDataMulN(r, 0.75f);
VertDataMulN(q, 0.25f);
VertDataAdd(r, q);
VertDataCopy(r, co, ss);
VertDataMulN(r, 0.75f, ss);
VertDataMulN(q, 0.25f, ss);
VertDataAdd(r, q, ss);
/* nCo = nCo + (r - nCo) * avgSharpness */
VertDataSub(r, nCo);
VertDataMulN(r, avgSharpness);
VertDataAdd(nCo, r);
VertDataSub(r, nCo, ss);
VertDataMulN(r, avgSharpness, ss);
VertDataAdd(nCo, r, ss);
}
// vert flags cleared later
@ -2294,8 +2356,8 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
for (i = 0; i < numEffectedE; i++) {
CCGEdge *e = effectedE[i];
VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl));
VertDataCopy(EDGE_getCo(e, nextLvl, 2), VERT_getCo(e->v1, nextLvl));
VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl), ss);
VertDataCopy(EDGE_getCo(e, nextLvl, 2), VERT_getCo(e->v1, nextLvl), ss);
}
for (i = 0; i < numEffectedF; i++) {
CCGFace *f = effectedF[i];
@ -2303,13 +2365,13 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
CCGEdge *e = FACE_getEdges(f)[S];
CCGEdge *prevE = FACE_getEdges(f)[(S + f->numVerts - 1) % f->numVerts];
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), FACE_getCenterData(f));
VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), FACE_getCenterData(f));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 1, 1), VERT_getCo(FACE_getVerts(f)[S], nextLvl));
VertDataCopy(FACE_getIECo(f, nextLvl, S, 1), EDGE_getCo(FACE_getEdges(f)[S], nextLvl, 1));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), (float*)FACE_getCenterData(f), ss);
VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), (float*)FACE_getCenterData(f), ss);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 1, 1), VERT_getCo(FACE_getVerts(f)[S], nextLvl), ss);
VertDataCopy(FACE_getIECo(f, nextLvl, S, 1), EDGE_getCo(FACE_getEdges(f)[S], nextLvl, 1), ss);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 1, 0), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, 1, vertDataSize));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 1), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, 1, vertDataSize));
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 1, 0), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, 1, vertDataSize), ss);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 1), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, 1, vertDataSize), ss);
}
}
@ -2433,16 +2495,16 @@ CCGError ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF
CCGEdge *e = FACE_getEdges(f)[S];
CCGEdge *prevE = FACE_getEdges(f)[(S + f->numVerts - 1) % f->numVerts];
VertDataCopy(FACE_getCenterData(f), FACE_getIFCo(f, lvl, S, 0, 0));
VertDataCopy(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx));
VertDataCopy((float*)FACE_getCenterData(f), FACE_getIFCo(f, lvl, S, 0, 0), ss);
VertDataCopy(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx), ss);
for (x = 0; x < gridSize; x++)
VertDataCopy(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0));
VertDataCopy(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0), ss);
for (x = 0; x < gridSize; x++) {
int eI = gridSize - 1 - x;
VertDataCopy(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
VertDataCopy(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
VertDataCopy(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x), ss);
VertDataCopy(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx), ss);
}
}
}
@ -2475,17 +2537,17 @@ CCGError ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF,
for (x = 0; x < gridSize; x++) {
int eI = gridSize - 1 - x;
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), ss);
VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), ss);
}
for (x = 1; x < gridSize - 1; x++) {
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, x), FACE_getIECo(f, lvl, prevS, x));
VertDataCopy(FACE_getIFCo(f, lvl, S, x, 0), FACE_getIECo(f, lvl, S, x));
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, x), FACE_getIECo(f, lvl, prevS, x), ss);
VertDataCopy(FACE_getIFCo(f, lvl, S, x, 0), FACE_getIECo(f, lvl, S, x), ss);
}
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, 0), FACE_getCenterData(f));
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], lvl));
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, 0), (float*)FACE_getCenterData(f), ss);
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], lvl), ss);
}
}
@ -2518,7 +2580,7 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
for (i = 0; i < numEffectedV; i++) {
CCGVert *v = effectedV[i];
if (v->numFaces)
VertDataZero(VERT_getCo(v, lvl));
VertDataZero(VERT_getCo(v, lvl), ss);
}
for (i = 0; i < numEffectedE; i++) {
@ -2526,40 +2588,40 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
if (e->numFaces)
for (x = 0; x < edgeSize; x++)
VertDataZero(EDGE_getCo(e, lvl, x));
VertDataZero(EDGE_getCo(e, lvl, x), ss);
}
/* add */
for (i = 0; i < numEffectedF; i++) {
CCGFace *f = effectedF[i];
VertDataZero(FACE_getCenterData(f));
VertDataZero((float*)FACE_getCenterData(f), ss);
for (S = 0; S < f->numVerts; S++)
for (x = 0; x < gridSize; x++)
VertDataZero(FACE_getIECo(f, lvl, S, x));
VertDataZero(FACE_getIECo(f, lvl, S, x), ss);
for (S = 0; S < f->numVerts; S++) {
int prevS = (S + f->numVerts - 1) % f->numVerts;
CCGEdge *e = FACE_getEdges(f)[S];
CCGEdge *prevE = FACE_getEdges(f)[prevS];
VertDataAdd(FACE_getCenterData(f), FACE_getIFCo(f, lvl, S, 0, 0));
VertDataAdd((float*)FACE_getCenterData(f), FACE_getIFCo(f, lvl, S, 0, 0), ss);
if (FACE_getVerts(f)[S]->flags & Vert_eEffected)
VertDataAdd(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx));
VertDataAdd(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx), ss);
for (x = 1; x < gridSize - 1; x++) {
VertDataAdd(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0));
VertDataAdd(FACE_getIECo(f, lvl, prevS, x), FACE_getIFCo(f, lvl, S, 0, x));
VertDataAdd(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0), ss);
VertDataAdd(FACE_getIECo(f, lvl, prevS, x), FACE_getIFCo(f, lvl, S, 0, x), ss);
}
for (x = 0; x < gridSize - 1; x++) {
int eI = gridSize - 1 - x;
if (FACE_getEdges(f)[S]->flags & Edge_eEffected)
VertDataAdd(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
VertDataAdd(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x), ss);
if (FACE_getEdges(f)[prevS]->flags & Edge_eEffected)
if (x != 0)
VertDataAdd(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
VertDataAdd(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx), ss);
}
}
}
@ -2568,51 +2630,52 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
for (i = 0; i < numEffectedV; i++) {
CCGVert *v = effectedV[i];
if (v->numFaces)
VertDataMulN(VERT_getCo(v, lvl), 1.0f / v->numFaces);
VertDataMulN(VERT_getCo(v, lvl), 1.0f / v->numFaces, ss);
}
for (i = 0; i < numEffectedE; i++) {
CCGEdge *e = effectedE[i];
VertDataCopy(EDGE_getCo(e, lvl, 0), VERT_getCo(e->v0, lvl));
VertDataCopy(EDGE_getCo(e, lvl, edgeSize - 1), VERT_getCo(e->v1, lvl));
VertDataCopy(EDGE_getCo(e, lvl, 0), VERT_getCo(e->v0, lvl), ss);
VertDataCopy(EDGE_getCo(e, lvl, edgeSize - 1), VERT_getCo(e->v1, lvl), ss);
if (e->numFaces)
for (x = 1; x < edgeSize - 1; x++)
VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f / e->numFaces);
VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f / e->numFaces, ss);
}
/* copy */
for (i = 0; i < numEffectedF; i++) {
CCGFace *f = effectedF[i];
VertDataMulN(FACE_getCenterData(f), 1.0f / f->numVerts);
VertDataMulN((float*)FACE_getCenterData(f), 1.0f / f->numVerts, ss);
for (S = 0; S < f->numVerts; S++)
for (x = 1; x < gridSize - 1; x++)
VertDataMulN(FACE_getIECo(f, lvl, S, x), 0.5f);
VertDataMulN(FACE_getIECo(f, lvl, S, x), 0.5f, ss);
for (S = 0; S < f->numVerts; S++) {
int prevS = (S + f->numVerts - 1) % f->numVerts;
CCGEdge *e = FACE_getEdges(f)[S];
CCGEdge *prevE = FACE_getEdges(f)[prevS];
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, 0), FACE_getCenterData(f));
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], lvl));
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, 0), (float*)FACE_getCenterData(f), ss);
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], lvl), ss);
for (x = 1; x < gridSize - 1; x++) {
VertDataCopy(FACE_getIFCo(f, lvl, S, x, 0), FACE_getIECo(f, lvl, S, x));
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, x), FACE_getIECo(f, lvl, prevS, x));
VertDataCopy(FACE_getIFCo(f, lvl, S, x, 0), FACE_getIECo(f, lvl, S, x), ss);
VertDataCopy(FACE_getIFCo(f, lvl, S, 0, x), FACE_getIECo(f, lvl, prevS, x), ss);
}
for (x = 0; x < gridSize - 1; x++) {
int eI = gridSize - 1 - x;
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), ss);
VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), ss);
}
VertDataCopy(FACE_getIECo(f, lvl, S, 0), FACE_getCenterData(f));
VertDataCopy(FACE_getIECo(f, lvl, S, gridSize - 1), FACE_getIFCo(f, lvl, S, gridSize - 1, 0));
VertDataCopy(FACE_getIECo(f, lvl, S, 0), (float*)FACE_getCenterData(f), ss);
VertDataCopy(FACE_getIECo(f, lvl, S, gridSize - 1), FACE_getIFCo(f, lvl, S, gridSize - 1, 0), ss);
}
}
@ -3051,3 +3114,36 @@ int ccgSubSurf_getNumFinalFaces(const CCGSubSurf *ss)
int numFinalFaces = ss->numGrids * ((gridSize - 1) * (gridSize - 1));
return numFinalFaces;
}
/***/
void CCG_key(CCGKey *key, const CCGSubSurf *ss, int level)
{
key->level = level;
key->elem_size = ss->meshIFC.vertDataSize;
key->has_normals = ss->calcVertNormals;
key->num_layers = ss->meshIFC.numLayers;
/* if normals are present, always the last three floats of an
element */
if (key->has_normals)
key->normal_offset = key->elem_size - sizeof(float) * 3;
else
key->normal_offset = -1;
key->grid_size = ccgSubSurf_getGridLevelSize(ss, level);
key->grid_area = key->grid_size * key->grid_size;
key->grid_bytes = key->elem_size * key->grid_area;
key->has_mask = ss->allocMask;
if (key->has_mask)
key->mask_offset = ss->maskDataOffset;
else
key->mask_offset = -1;
}
void CCG_key_top_level(CCGKey *key, const CCGSubSurf *ss)
{
CCG_key(key, ss, ccgSubSurf_getSubdivisionLevels(ss));
}

@ -15,7 +15,7 @@ typedef struct CCGFace CCGFace;
typedef struct CCGMeshIFC {
int vertUserSize, edgeUserSize, faceUserSize;
int numLayers;
int vertDataSize;
} CCGMeshIFC;
@ -76,6 +76,9 @@ void ccgSubSurf_getUseAgeCounts (CCGSubSurf *ss, int *useAgeCounts_r, int *ve
CCGError ccgSubSurf_setUseAgeCounts (CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset);
CCGError ccgSubSurf_setCalcVertexNormals (CCGSubSurf *ss, int useVertNormals, int normalDataOffset);
void ccgSubSurf_setAllocMask (CCGSubSurf *ss, int allocMask, int maskOffset);
void ccgSubSurf_setNumLayers (CCGSubSurf *ss, int numLayers);
/***/

@ -814,7 +814,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
int numVerts;
float (*deformedVerts)[3] = mesh_getVertexCos(me, &numVerts);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0, 0);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0);
dm = mesh_create_derived(me, ob, deformedVerts);
if (build_shapekey_layers)
@ -828,7 +828,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
if (build_shapekey_layers)
add_shapekey_layers(tdm, me, ob);
dm = mti->applyModifier(md, ob, tdm, 0, 0);
dm = mti->applyModifier(md, ob, tdm, 0);
if (tdm != dm) tdm->release(tdm);
}
@ -1383,6 +1383,13 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
/* XXX Same as above... For now, only weights preview in WPaint mode. */
const int do_mod_wmcol = do_init_wmcol;
ModifierApplyFlag app_flags = useRenderParams ? MOD_APPLY_RENDER : 0;
ModifierApplyFlag deform_app_flags = app_flags;
if (useCache)
app_flags |= MOD_APPLY_USECACHE;
if (useDeform)
deform_app_flags |= MOD_APPLY_USECACHE;
if (mmd && !mmd->sculptlvl)
has_multires = 0;
@ -1434,7 +1441,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
if (!deformedVerts)
deformedVerts = mesh_getVertexCos(me, &numVerts);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, useRenderParams, useDeform);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, deform_app_flags);
}
else {
break;
@ -1547,7 +1554,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
}
}
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, useRenderParams, useDeform);
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, deform_app_flags);
}
else {
DerivedMesh *ndm;
@ -1622,7 +1629,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
}
}
ndm = mti->applyModifier(md, ob, dm, useRenderParams, useCache);
ndm = mti->applyModifier(md, ob, dm, app_flags);
if (ndm) {
/* if the modifier returned a new dm, release the old one */
@ -1645,7 +1652,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
nextmask &= ~CD_MASK_ORCO;
DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX);
ndm = mti->applyModifier(md, ob, orcodm, useRenderParams, 0);
ndm = mti->applyModifier(md, ob, orcodm, app_flags & ~MOD_APPLY_USECACHE);
if (ndm) {
/* if the modifier returned a new dm, release the old one */
@ -1661,7 +1668,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
nextmask &= ~CD_MASK_CLOTH_ORCO;
DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX);
ndm = mti->applyModifier(md, ob, clothorcodm, useRenderParams, 0);
ndm = mti->applyModifier(md, ob, clothorcodm, app_flags & ~MOD_APPLY_USECACHE);
if (ndm) {
/* if the modifier returned a new dm, release the old one */
@ -1928,7 +1935,8 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
if (mti->deformVertsEM)
mti->deformVertsEM(md, ob, em, dm, deformedVerts, numVerts);
else mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0, 0);
else
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0);
}
else {
DerivedMesh *ndm;
@ -1971,7 +1979,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
if (mti->applyModifierEM)
ndm = mti->applyModifierEM(md, ob, em, orcodm);
else
ndm = mti->applyModifier(md, ob, orcodm, 0, 0);
ndm = mti->applyModifier(md, ob, orcodm, 0);
if (ndm) {
/* if the modifier returned a new dm, release the old one */
@ -1995,7 +2003,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
if (mti->applyModifierEM)
ndm = mti->applyModifierEM(md, ob, em, dm);
else
ndm = mti->applyModifier(md, ob, dm, 0, 0);
ndm = mti->applyModifier(md, ob, dm, 0);
if (ndm) {
if (dm && dm != ndm)

@ -245,7 +245,7 @@ static int can_pbvh_draw(Object *ob, DerivedMesh *dm)
return cddm->mvert == me->mvert || ob->sculpt->kb;
}
static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
{
CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
@ -276,7 +276,7 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
BKE_mesh_tessface_ensure(me);
BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
me->totface, me->totvert);
me->totface, me->totvert, &me->vdata);
deformed = ss->modifiers_active || me->key;

@ -565,6 +565,38 @@ static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), void *data, int count
return size;
}
static void layerCopy_grid_paint_mask(const void *source, void *dest, int count)
{
int i;
const GridPaintMask *s = source;
GridPaintMask *d = dest;
for(i = 0; i < count; ++i) {
if(s[i].data) {
d[i].data = MEM_dupallocN(s[i].data);
d[i].level = s[i].level;
}
else {
d[i].data = NULL;
d[i].level = 0;
}
}
}
static void layerFree_grid_paint_mask(void *data, int count, int UNUSED(size))
{
int i;
GridPaintMask *gpm = data;
for(i = 0; i < count; ++i) {
if(gpm[i].data)
MEM_freeN(gpm[i].data);
gpm[i].data = NULL;
gpm[i].level = 0;
}
}
/* --------- */
static void layerCopyValue_mloopcol(void *source, void *dest)
{
@ -1059,7 +1091,11 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* END BMESH ONLY */
/* 34: CD_PAINT_MASK */
{sizeof(float), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 35: CD_GRID_PAINT_MASK */
{sizeof(GridPaintMask), "GridPaintMask", 1, NULL, layerCopy_grid_paint_mask,
layerFree_grid_paint_mask, NULL, NULL, NULL}
};
/* note, numbers are from trunk and need updating for bmesh */
@ -1073,7 +1109,9 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
/* BMESH ONLY */
/* 25-29 */ "CDMPoly", "CDMLoop", "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight",
/* 30-32 */ "CDSubSurfCrease", "CDOrigSpaceLoop", "CDPreviewLoopCol"
/* 30-34 */ "CDSubSurfCrease", "CDOrigSpaceLoop", "CDPreviewLoopCol", "CDBMElemPyPtr", "CDPaintMask",
/* 35 */ "CDGridPaintMask"
/* END BMESH ONLY */
};
@ -1086,12 +1124,14 @@ const CustomDataMask CD_MASK_MESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE | CD_MASK_MCOL |
CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS |
CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MPOLY | CD_MASK_MLOOP |
CD_MASK_MTEXPOLY | CD_MASK_NORMAL | CD_MASK_RECAST;
CD_MASK_MTEXPOLY | CD_MASK_NORMAL | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
CD_MASK_GRID_PAINT_MASK;
const CustomDataMask CD_MASK_EDITMESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE | CD_MASK_MLOOPUV |
CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_SHAPE_KEYINDEX |
CD_MASK_MCOL|CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR |
CD_MASK_MDISPS | CD_MASK_SHAPEKEY | CD_MASK_RECAST;
CD_MASK_MDISPS | CD_MASK_SHAPEKEY | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
CD_MASK_GRID_PAINT_MASK;
const CustomDataMask CD_MASK_DERIVEDMESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
CD_MASK_MCOL | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
@ -1101,7 +1141,9 @@ const CustomDataMask CD_MASK_DERIVEDMESH =
CD_MASK_ORIGINDEX | CD_MASK_POLYINDEX;
const CustomDataMask CD_MASK_BMESH = CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY |
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT |
CD_MASK_PROP_STR | CD_MASK_SHAPEKEY | CD_MASK_SHAPE_KEYINDEX | CD_MASK_MDISPS | CD_MASK_CREASE | CD_MASK_BWEIGHT | CD_MASK_RECAST;
CD_MASK_PROP_STR | CD_MASK_SHAPEKEY | CD_MASK_SHAPE_KEYINDEX | CD_MASK_MDISPS |
CD_MASK_CREASE | CD_MASK_BWEIGHT | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
CD_MASK_GRID_PAINT_MASK;
const CustomDataMask CD_MASK_FACECORNERS =
CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_MTEXPOLY | CD_MASK_MLOOPUV |
CD_MASK_MLOOPCOL;

@ -752,14 +752,19 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
Curve *cu = ob->data;
ListBase *nurb = BKE_curve_nurbs_get(cu);
int numVerts = 0;
int editmode = (!forRender && cu->editnurb);
const int editmode = (!forRender && cu->editnurb);
ModifierApplyFlag app_flag = 0;
float (*originalVerts)[3] = NULL;
float (*deformedVerts)[3] = NULL;
float *keyVerts = NULL;
int required_mode;
if (forRender)
if (editmode)
app_flag |= MOD_APPLY_USECACHE;
if (forRender) {
app_flag |= MOD_APPLY_RENDER;
required_mode = eModifierMode_Render;
}
else
required_mode = eModifierMode_Realtime;
@ -778,7 +783,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
* shape key modifier yet. */
deformedVerts = BKE_curve_keyVertexCos_get(cu, nurb, keyVerts);
originalVerts = MEM_dupallocN(deformedVerts);
numVerts = BKE_nurbList_verts_count_without_handles(nurb);
numVerts = BKE_nurbList_verts_count(nurb);
}
}
@ -800,7 +805,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
originalVerts = MEM_dupallocN(deformedVerts);
}
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, forRender, editmode);
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, app_flag);
if (md == pretessellatePoint)
break;
@ -866,9 +871,12 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
DerivedMesh *dm = NULL, *ndm;
float (*vertCos)[3] = NULL;
int useCache = !forRender;
ModifierApplyFlag app_flag = 0;
if (forRender)
if (forRender) {
app_flag |= MOD_APPLY_RENDER;
required_mode = eModifierMode_Render;
}
else
required_mode = eModifierMode_Realtime;
@ -887,6 +895,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
for (; md; md = md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
ModifierApplyFlag appf = app_flag;
md->scene = scene;
@ -897,6 +906,8 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
if (mti->type == eModifierTypeType_OnlyDeform ||
(mti->type == eModifierTypeType_DeformOrConstruct && !dm)) {
if (editmode)
appf |= MOD_APPLY_USECACHE;
if (dm) {
if (!vertCos) {
totvert = dm->getNumVerts(dm);
@ -904,14 +915,14 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
dm->getVertCos(dm, vertCos);
}
mti->deformVerts(md, ob, dm, vertCos, totvert, forRender, editmode);
mti->deformVerts(md, ob, dm, vertCos, totvert, appf);
}
else {
if (!vertCos) {
vertCos = displist_get_allverts(dispbase, &totvert);
}
mti->deformVerts(md, ob, NULL, vertCos, totvert, forRender, editmode);
mti->deformVerts(md, ob, NULL, vertCos, totvert, appf);
}
}
else {
@ -953,7 +964,9 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
vertCos = NULL;
}
ndm = mti->applyModifier(md, ob, dm, forRender, useCache);
if (useCache)
appf |= MOD_APPLY_USECACHE;
ndm = mti->applyModifier(md, ob, dm, appf);
if (ndm) {
/* Modifier returned a new derived mesh */
@ -1084,6 +1097,7 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
int required_mode;
int editmode = (!forRender && cu->editnurb);
DerivedMesh *ndm, *orcodm = NULL;
const ModifierApplyFlag app_flag = forRender ? MOD_APPLY_RENDER : 0;
if (forRender)
required_mode = eModifierMode_Render;
@ -1114,7 +1128,7 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
if (!orcodm)
orcodm = create_orco_dm(scene, ob);
ndm = mti->applyModifier(md, ob, orcodm, forRender, 0);
ndm = mti->applyModifier(md, ob, orcodm, app_flag);
if (ndm) {
/* if the modifier returned a new dm, release the old one */

@ -976,7 +976,7 @@ void BKE_lattice_modifiers_calc(Scene *scene, Object *ob)
if (mti->type != eModifierTypeType_OnlyDeform) continue;
if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob, &numVerts);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0);
}
/* always displist to make this work like derivedmesh */

@ -46,6 +46,7 @@
#include "BLI_pbvh.h"
#include "BLI_utildefines.h"
#include "BKE_ccg.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@ -75,7 +76,7 @@ typedef enum {
} DispOp;
static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert);
static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, DMGridData **oldGridData, int totlvl);
static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, CCGElem **oldGridData, int totlvl);
/** Customdata **/
@ -89,12 +90,17 @@ void multires_customdata_delete(Mesh *me)
CustomData_external_remove(&em->bm->ldata, &me->id,
CD_MDISPS, 0);
BM_data_layer_free(em->bm, &em->bm->ldata, CD_MDISPS);
BM_data_layer_free(em->bm, &em->bm->ldata, CD_GRID_PAINT_MASK);
}
else {
CustomData_external_remove(&me->ldata, &me->id,
CD_MDISPS, me->totloop);
CustomData_free_layer_active(&me->ldata, CD_MDISPS,
me->totloop);
CustomData_free_layer_active(&me->ldata, CD_GRID_PAINT_MASK,
me->totloop);
}
}
@ -102,7 +108,7 @@ void multires_customdata_delete(Mesh *me)
static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden,
int lo_level,
int hi_level,
/* assumed to be at hi_level (or
* null) */
BLI_bitmap prev_hidden)
@ -279,7 +285,7 @@ DerivedMesh *get_multires_dm(Scene *scene, MultiresModifierData *mmd, Object *ob
DerivedMesh *tdm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
DerivedMesh *dm;
dm = mti->applyModifier(md, ob, tdm, 0, 1);
dm = mti->applyModifier(md, ob, tdm, MOD_APPLY_USECACHE);
if (dm == tdm) {
dm = CDDM_copy(tdm);
}
@ -438,7 +444,7 @@ int multiresModifier_reshapeFromDeformMod(Scene *scene, MultiresModifierData *mm
deformedVerts = MEM_callocN(sizeof(float) * numVerts * 3, "multiresReshape_deformVerts");
dm->getVertCos(dm, deformedVerts);
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0, 0);
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0);
ndm = CDDM_copy(dm);
CDDM_apply_vert_coords(ndm, deformedVerts);
@ -569,23 +575,50 @@ static void multires_copy_grid(float (*gridA)[3], float (*gridB)[3], int sizeA,
}
}
static void multires_copy_dm_grid(DMGridData *gridA, DMGridData *gridB, int sizeA, int sizeB)
static void multires_copy_dm_grid(CCGElem *gridA, CCGElem *gridB, CCGKey *keyA, CCGKey *keyB)
{
int x, y, j, skip;
if (sizeA > sizeB) {
skip = (sizeA - 1) / (sizeB - 1);
if (keyA->grid_size > keyB->grid_size) {
skip = (keyA->grid_size - 1) / (keyB->grid_size - 1);
for (j = 0, y = 0; y < sizeB; y++)
for (x = 0; x < sizeB; x++, j++)
copy_v3_v3(gridA[y * skip * sizeA + x * skip].co, gridB[j].co);
for (j = 0, y = 0; y < keyB->grid_size; y++)
for (x = 0; x < keyB->grid_size; x++, j++)
memcpy(CCG_elem_offset_co(keyA, gridA, y * skip * keyA->grid_size + x * skip),
CCG_elem_offset_co(keyB, gridB, j),
sizeof(float) * keyA->num_layers);
}
else {
skip = (sizeB - 1) / (sizeA - 1);
skip = (keyB->grid_size - 1) / (keyA->grid_size - 1);
for (j = 0, y = 0; y < sizeA; y++)
for (x = 0; x < sizeA; x++, j++)
copy_v3_v3(gridA[j].co, gridB[y * skip * sizeB + x * skip].co);
for (j = 0, y = 0; y < keyA->grid_size; y++)
for (x = 0; x < keyA->grid_size; x++, j++)
memcpy(CCG_elem_offset_co(keyA, gridA, j),
CCG_elem_offset_co(keyB, gridB, y * skip * keyB->grid_size + x * skip),
sizeof(float) * keyA->num_layers);
}
}
/* Reallocate gpm->data at a lower resolution and copy values over
from the original high-resolution data */
static void multires_grid_paint_mask_downsample(GridPaintMask *gpm, int level)
{
if (level < gpm->level) {
int gridsize = ccg_gridsize(level);
float *data = MEM_callocN(sizeof(float) * gridsize * gridsize,
"multires_grid_paint_mask_downsample");
int x, y;
for (y = 0; y < gridsize; y++) {
for (x = 0; x < gridsize; x++) {
data[y * gridsize + x] =
paint_grid_paint_mask(gpm, level, x, y);
}
}
MEM_freeN(gpm->data);
gpm->data = data;
gpm->level = level;
}
}
@ -594,10 +627,12 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
Mesh *me = (Mesh *)ob->data;
int levels = mmd->totlvl - lvl;
MDisps *mdisps;
GridPaintMask *gpm;
multires_set_tot_mdisps(me, mmd->totlvl);
CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop);
mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
gpm = CustomData_get_layer(&me->ldata, CD_GRID_PAINT_MASK);
multires_force_update(ob);
@ -610,7 +645,8 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
for (i = 0; i < me->totpoly; ++i) {
for (j = 0; j < me->mpoly[i].totloop; j++) {
MDisps *mdisp = &mdisps[me->mpoly[i].loopstart + j];
int g = me->mpoly[i].loopstart + j;
MDisps *mdisp = &mdisps[g];
float (*disps)[3], (*ndisps)[3], (*hdisps)[3];
int totdisp = multires_grid_tot[lvl];
@ -636,6 +672,8 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
mdisp->disps = disps;
mdisp->totdisp = totdisp;
mdisp->level = lvl;
multires_grid_paint_mask_downsample(&gpm[g], lvl);
}
}
}
@ -668,9 +706,10 @@ void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int dire
multires_set_tot_level(ob, mmd, lvl);
}
static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int totlvl, int simple)
static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int totlvl, int simple, int alloc_paint_mask)
{
MultiresModifierData mmd = {{NULL}};
MultiresFlags flags = MULTIRES_USE_LOCAL_MMD;
mmd.lvl = lvl;
mmd.sculptlvl = lvl;
@ -678,12 +717,16 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv
mmd.totlvl = totlvl;
mmd.simple = simple;
return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0);
if (alloc_paint_mask)
flags |= MULTIRES_ALLOC_PAINT_MASK;
return multires_make_derived_from_derived(dm, &mmd, ob, flags);
}
static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal, int plain_uv)
static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal, int plain_uv, int alloc_paint_mask)
{
SubsurfModifierData smd = {{NULL}};
SubsurfFlags flags = 0;
smd.levels = smd.renderLevels = lvl;
if (!plain_uv)
@ -693,7 +736,13 @@ static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl
if (optimal)
smd.flags |= eSubsurfModifierFlag_ControlEdges;
return subsurf_make_derived_from_derived(dm, &smd, 0, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
if (ob->mode & OB_MODE_EDIT)
flags |= SUBSURF_IN_EDIT_MODE;
if (alloc_paint_mask)
flags |= SUBSURF_ALLOC_PAINT_MASK;
return subsurf_make_derived_from_derived(dm, &smd, NULL, flags);
}
@ -729,7 +778,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
/* generate highest level with displacements */
cddm = CDDM_from_mesh(me, NULL);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
dispdm = multires_dm_create_local(ob, cddm, totlvl, totlvl, 0);
dispdm = multires_dm_create_local(ob, cddm, totlvl, totlvl, 0, 0);
cddm->release(cddm);
/* copy the new locations of the base verts into the mesh */
@ -819,7 +868,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
/* subdivide the mesh to highest level without displacements */
cddm = CDDM_from_mesh(me, NULL);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
origdm = subsurf_dm_create_local(ob, cddm, totlvl, 0, 0, mmd->flags & eMultiresModifierFlag_PlainUv);
origdm = subsurf_dm_create_local(ob, cddm, totlvl, 0, 0, mmd->flags & eMultiresModifierFlag_PlainUv, 0);
cddm->release(cddm);
/* calc disps */
@ -847,42 +896,44 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
if (mdisps->disps && !updateblock && totlvl > 1) {
/* upsample */
DerivedMesh *lowdm, *cddm, *highdm;
DMGridData **highGridData, **lowGridData, **subGridData;
CCGElem **highGridData, **lowGridData, **subGridData;
CCGKey highGridKey, lowGridKey;
CCGSubSurf *ss;
int i, numGrids, highGridSize, lowGridSize;
int i, numGrids, highGridSize;
/* create subsurf DM from original mesh at high level */
cddm = CDDM_from_mesh(me, NULL);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
highdm = subsurf_dm_create_local(ob, cddm, totlvl, simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv);
highdm = subsurf_dm_create_local(ob, cddm, totlvl, simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, TRUE);
ss = ((CCGDerivedMesh *)highdm)->ss;
/* create multires DM from original mesh at low level */
lowdm = multires_dm_create_local(ob, cddm, lvl, lvl, simple);
lowdm = multires_dm_create_local(ob, cddm, lvl, lvl, simple, TRUE);
cddm->release(cddm);
/* copy subsurf grids and replace them with low displaced grids */
numGrids = highdm->getNumGrids(highdm);
highGridSize = highdm->getGridSize(highdm);
highGridData = highdm->getGridData(highdm);
lowGridSize = lowdm->getGridSize(lowdm);
highdm->getGridKey(highdm, &highGridKey);
lowGridData = lowdm->getGridData(lowdm);
lowdm->getGridKey(lowdm, &lowGridKey);
subGridData = MEM_callocN(sizeof(float *) * numGrids, "subGridData*");
for (i = 0; i < numGrids; ++i) {
/* backup subsurf grids */
subGridData[i] = MEM_callocN(sizeof(DMGridData) * highGridSize * highGridSize, "subGridData");
memcpy(subGridData[i], highGridData[i], sizeof(DMGridData) * highGridSize * highGridSize);
subGridData[i] = MEM_callocN(highGridKey.elem_size * highGridSize * highGridSize, "subGridData");
memcpy(subGridData[i], highGridData[i], highGridKey.elem_size * highGridSize * highGridSize);
/* overwrite with current displaced grids */
multires_copy_dm_grid(highGridData[i], lowGridData[i], highGridSize, lowGridSize);
multires_copy_dm_grid(highGridData[i], lowGridData[i], &highGridKey, &lowGridKey);
}
/* low lower level dm no longer needed at this point */
lowdm->release(lowdm);
/* subsurf higher levels again with displaced data */
ss = ((CCGDerivedMesh *)highdm)->ss;
ccgSubSurf_updateFromFaces(ss, lvl, NULL, 0);
ccgSubSurf_updateLevels(ss, lvl, NULL, 0);
@ -911,36 +962,38 @@ void multiresModifier_subdivide(MultiresModifierData *mmd, Object *ob, int updat
multires_subdivide(mmd, ob, mmd->totlvl + 1, updateblock, simple);
}
void grid_tangent(int gridSize, int index, int x, int y, int axis, DMGridData **gridData, float t[3])
void grid_tangent(const CCGKey *key, int x, int y, int axis, CCGElem *grid, float t[3])
{
if (axis == 0) {
if (x == gridSize - 1) {
if (y == gridSize - 1)
sub_v3_v3v3(t, gridData[index][x + gridSize * (y - 1)].co, gridData[index][x - 1 + gridSize * (y - 1)].co);
if (x == key->grid_size - 1) {
if (y == key->grid_size - 1)
sub_v3_v3v3(t, CCG_grid_elem_co(key, grid, x, y - 1), CCG_grid_elem_co(key, grid, x - 1, y - 1));
else
sub_v3_v3v3(t, gridData[index][x + gridSize * y].co, gridData[index][x - 1 + gridSize * y].co);
sub_v3_v3v3(t, CCG_grid_elem_co(key, grid, x, y), CCG_grid_elem_co(key, grid, x - 1, y));
}
else
sub_v3_v3v3(t, gridData[index][x + 1 + gridSize * y].co, gridData[index][x + gridSize * y].co);
sub_v3_v3v3(t, CCG_grid_elem_co(key, grid, x + 1, y), CCG_grid_elem_co(key, grid, x, y));
}
else if (axis == 1) {
if (y == gridSize - 1) {
if (x == gridSize - 1)
sub_v3_v3v3(t, gridData[index][x - 1 + gridSize * y].co, gridData[index][x - 1 + gridSize * (y - 1)].co);
if (y == key->grid_size - 1) {
if (x == key->grid_size - 1)
sub_v3_v3v3(t, CCG_grid_elem_co(key, grid, x - 1, y), CCG_grid_elem_co(key, grid, x - 1, (y - 1)));
else
sub_v3_v3v3(t, gridData[index][x + gridSize * y].co, gridData[index][x + gridSize * (y - 1)].co);
sub_v3_v3v3(t, CCG_grid_elem_co(key, grid, x, y), CCG_grid_elem_co(key, grid, x, (y - 1)));
}
else
sub_v3_v3v3(t, gridData[index][x + gridSize * (y + 1)].co, gridData[index][x + gridSize * y].co);
sub_v3_v3v3(t, CCG_grid_elem_co(key, grid, x, (y + 1)), CCG_grid_elem_co(key, grid, x, y));
}
}
static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, DMGridData **oldGridData, int totlvl)
static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, CCGElem **oldGridData, int totlvl)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
DMGridData **gridData, **subGridData;
CCGElem **gridData, **subGridData;
CCGKey key;
MPoly *mpoly = me->mpoly;
MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
GridPaintMask *grid_paint_mask = NULL;
int *gridOffset;
int i, k, /*numGrids, */ gridSize, dGridSize, dSkip;
int totloop, totpoly;
@ -968,11 +1021,16 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
gridSize = dm->getGridSize(dm);
gridData = dm->getGridData(dm);
gridOffset = dm->getGridOffset(dm);
dm->getGridKey(dm, &key);
subGridData = (oldGridData) ? oldGridData : gridData;
dGridSize = multires_side_tot[totlvl];
dSkip = (dGridSize - 1) / (gridSize - 1);
/* multires paint masks */
if (key.has_mask)
grid_paint_mask = CustomData_get_layer(&me->ldata, CD_GRID_PAINT_MASK);
k = 0; /*current loop/mdisp index within the mloop array*/
#pragma omp parallel for private(i) if (totloop*gridSize*gridSize >= CCG_OMP_LIMIT)
@ -982,9 +1040,10 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
int S, x, y, gIndex = gridOffset[i];
for (S = 0; S < numVerts; ++S, ++gIndex, ++k) {
GridPaintMask *gpm = grid_paint_mask ? &grid_paint_mask[gIndex] : NULL;
MDisps *mdisp = &mdisps[mpoly[i].loopstart + S];
DMGridData *grid = gridData[gIndex];
DMGridData *subgrid = subGridData[gIndex];
CCGElem *grid = gridData[gIndex];
CCGElem *subgrid = subGridData[gIndex];
float (*dispgrid)[3] = NULL;
/* when adding new faces in edit mode, need to allocate disps */
@ -996,19 +1055,28 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
dispgrid = mdisp->disps;
/* if needed, reallocate multires paint mask */
if (gpm && op == CALC_DISPLACEMENTS) {
if (gpm->level < key.level) {
gpm->level = key.level;
MEM_freeN(gpm->data);
gpm->data = MEM_callocN(sizeof(float) * key.grid_area, "gpm.data");
}
}
for (y = 0; y < gridSize; y++) {
for (x = 0; x < gridSize; x++) {
float *co = grid[x + y * gridSize].co;
float *sco = subgrid[x + y * gridSize].co;
float *no = subgrid[x + y * gridSize].no;
float *co = CCG_grid_elem_co(&key, grid, x, y);
float *sco = CCG_grid_elem_co(&key, subgrid, x, y);
float *no = CCG_grid_elem_no(&key, subgrid, x, y);
float *data = dispgrid[dGridSize * y * dSkip + x * dSkip];
float mat[3][3], tx[3], ty[3], disp[3], d[3];
float mat[3][3], tx[3], ty[3], disp[3], d[3], mask;
/* construct tangent space matrix */
grid_tangent(gridSize, gIndex, x, y, 0, subGridData, tx);
grid_tangent(&key, x, y, 0, subGridData[gIndex], tx);
normalize_v3(tx);
grid_tangent(gridSize, gIndex, x, y, 1, subGridData, ty);
grid_tangent(&key, x, y, 1, subGridData[gIndex], ty);
normalize_v3(ty);
//mul_v3_fl(tx, 1.0f/(gridSize-1));
@ -1039,11 +1107,31 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
add_v3_v3(data, d);
break;
}
if (gpm) {
switch (op) {
case APPLY_DISPLACEMENTS:
/* Copy mask from gpm to DM */
*CCG_grid_elem_mask(&key, grid, x, y) =
paint_grid_paint_mask(gpm, key.level, x, y);
break;
case CALC_DISPLACEMENTS:
/* Copy mask from DM to gpm */
mask = *CCG_grid_elem_mask(&key, grid, x, y);
gpm->data[y * gridSize + x] = CLAMPIS(mask, 0, 1);
break;
case ADD_DISPLACEMENTS:
/* Add mask displacement to gpm */
gpm->data[y * gridSize + x] +=
*CCG_grid_elem_mask(&key, grid, x, y);
break;
}
}
}
}
}
}
if (op == APPLY_DISPLACEMENTS) {
ccgSubSurf_stitchFaces(ccgdm->ss, 0, NULL, 0);
ccgSubSurf_updateNormals(ccgdm->ss, NULL, 0);
@ -1072,7 +1160,8 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
if (lvl < totlvl) {
Mesh *me = ob->data;
DerivedMesh *lowdm, *cddm, *highdm;
DMGridData **highGridData, **lowGridData, **subGridData, **gridData, *diffGrid;
CCGElem **highGridData, **lowGridData, **subGridData, **gridData, *diffGrid;
CCGKey highGridKey, lowGridKey;
CCGSubSurf *ss;
int i, j, numGrids, highGridSize, lowGridSize;
@ -1081,33 +1170,41 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
else cddm = CDDM_from_mesh(me, NULL);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
highdm = subsurf_dm_create_local(ob, cddm, totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv);
highdm = subsurf_dm_create_local(ob, cddm, totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, TRUE);
ss = ((CCGDerivedMesh *)highdm)->ss;
/* create multires DM from original mesh and displacements */
lowdm = multires_dm_create_local(ob, cddm, lvl, totlvl, mmd->simple);
lowdm = multires_dm_create_local(ob, cddm, lvl, totlvl, mmd->simple, TRUE);
cddm->release(cddm);
/* gather grid data */
numGrids = highdm->getNumGrids(highdm);
highGridSize = highdm->getGridSize(highdm);
highGridData = highdm->getGridData(highdm);
highdm->getGridKey(highdm, &highGridKey);
lowGridSize = lowdm->getGridSize(lowdm);
lowGridData = lowdm->getGridData(lowdm);
lowdm->getGridKey(lowdm, &lowGridKey);
gridData = dm->getGridData(dm);
subGridData = MEM_callocN(sizeof(DMGridData *) * numGrids, "subGridData*");
diffGrid = MEM_callocN(sizeof(DMGridData) * lowGridSize * lowGridSize, "diff");
BLI_assert(highGridKey.elem_size == lowGridKey.elem_size);
subGridData = MEM_callocN(sizeof(CCGElem *) * numGrids, "subGridData*");
diffGrid = MEM_callocN(lowGridKey.elem_size * lowGridSize * lowGridSize, "diff");
for (i = 0; i < numGrids; ++i) {
/* backup subsurf grids */
subGridData[i] = MEM_callocN(sizeof(DMGridData) * highGridSize * highGridSize, "subGridData");
memcpy(subGridData[i], highGridData[i], sizeof(DMGridData) * highGridSize * highGridSize);
subGridData[i] = MEM_callocN(highGridKey.elem_size * highGridSize * highGridSize, "subGridData");
memcpy(subGridData[i], highGridData[i], highGridKey.elem_size * highGridSize * highGridSize);
/* write difference of subsurf and displaced low level into high subsurf */
for (j = 0; j < lowGridSize * lowGridSize; ++j)
sub_v3_v3v3(diffGrid[j].co, gridData[i][j].co, lowGridData[i][j].co);
for (j = 0; j < lowGridSize * lowGridSize; ++j) {
sub_v4_v4v4(CCG_elem_offset_co(&lowGridKey, diffGrid, j),
CCG_elem_offset_co(&lowGridKey, gridData[i], j),
CCG_elem_offset_co(&lowGridKey, lowGridData[i], j));
}
multires_copy_dm_grid(highGridData[i], diffGrid, highGridSize, lowGridSize);
multires_copy_dm_grid(highGridData[i], diffGrid, &highGridKey, &lowGridKey);
}
/* lower level dm no longer needed at this point */
@ -1115,7 +1212,6 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
lowdm->release(lowdm);
/* subsurf higher levels again with difference of coordinates */
ss = ((CCGDerivedMesh *)highdm)->ss;
ccgSubSurf_updateFromFaces(ss, lvl, NULL, 0);
ccgSubSurf_updateLevels(ss, lvl, NULL, 0);
@ -1135,7 +1231,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
else cddm = CDDM_from_mesh(me, NULL);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
subdm = subsurf_dm_create_local(ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv);
subdm = subsurf_dm_create_local(ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, TRUE);
cddm->release(cddm);
multiresModifier_disp_run(dm, me, NULL, CALC_DISPLACEMENTS, subdm->getGridData(subdm), mmd->totlvl);
@ -1180,7 +1276,8 @@ void multires_modifier_update_hidden(DerivedMesh *dm)
void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
{
DerivedMesh *ccgdm = NULL, *subsurf = NULL;
DMGridData **gridData, **subGridData = NULL;
CCGElem **gridData, **subGridData = NULL;
CCGKey key;
MPoly *mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
MDisps *mdisps;
MultiresModifierData *mmd = get_multires_modifier(NULL, ob, 1);
@ -1197,20 +1294,21 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
}
totlvl = mmd->totlvl;
ccgdm = multires_dm_create_local(ob, dm, totlvl, totlvl, mmd->simple);
ccgdm = multires_dm_create_local(ob, dm, totlvl, totlvl, mmd->simple, FALSE);
subsurf = subsurf_dm_create_local(ob, dm, totlvl,
mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges, mmd->flags & eMultiresModifierFlag_PlainUv);
mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges, mmd->flags & eMultiresModifierFlag_PlainUv, 0);
numGrids = subsurf->getNumGrids(subsurf);
gridSize = subsurf->getGridSize(subsurf);
gridData = subsurf->getGridData(subsurf);
subsurf->getGridKey(subsurf, &key);
subGridData = MEM_callocN(sizeof(DMGridData *) * numGrids, "subGridData*");
subGridData = MEM_callocN(sizeof(CCGElem *) * numGrids, "subGridData*");
for (i = 0; i < numGrids; i++) {
subGridData[i] = MEM_callocN(sizeof(DMGridData) * gridSize * gridSize, "subGridData");
memcpy(subGridData[i], gridData[i], sizeof(DMGridData) * gridSize * gridSize);
subGridData[i] = MEM_callocN(key.elem_size * gridSize * gridSize, "subGridData");
memcpy(subGridData[i], gridData[i], key.elem_size * gridSize * gridSize);
}
/*numGrids = ccgdm->dm->getNumGrids((DerivedMesh*)ccgdm);*/ /*UNUSED*/
@ -1231,8 +1329,8 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
for (S = 0; S < numVerts; ++S, ++gIndex, ++k) {
MDisps *mdisp = &mdisps[mpoly[i].loopstart + S];
/* DMGridData *grid = gridData[gIndex]; */ /* UNUSED */
DMGridData *subgrid = subGridData[gIndex];
/* CCGElem *grid = gridData[gIndex]; */ /* UNUSED */
CCGElem *subgrid = subGridData[gIndex];
float (*dispgrid)[3] = NULL;
/* when adding new faces in edit mode, need to allocate disps */
@ -1247,15 +1345,15 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
for (y = 0; y < gridSize; y++) {
for (x = 0; x < gridSize; x++) {
float *data = dispgrid[dGridSize * y * dSkip + x * dSkip];
float *no = subgrid[x + y * gridSize].no;
float *co = subgrid[x + y * gridSize].co;
float *no = CCG_grid_elem_no(&key, subgrid, x, y);
float *co = CCG_grid_elem_co(&key, subgrid, x, y);
float mat[3][3], tx[3], ty[3], dco[3];
/* construct tangent space matrix */
grid_tangent(gridSize, gIndex, x, y, 0, subGridData, tx);
grid_tangent(&key, x, y, 0, subGridData[gIndex], tx);
normalize_v3(tx);
grid_tangent(gridSize, gIndex, x, y, 1, subGridData, ty);
grid_tangent(&key, x, y, 1, subGridData[gIndex], ty);
normalize_v3(ty);
column_vectors_to_mat3(mat, tx, ty, no);
@ -1323,15 +1421,17 @@ void multires_stitch_grids(Object *ob)
}
}
DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd,
int local_mmd, DerivedMesh *dm,
Object *ob, int useRenderParams)
DerivedMesh *multires_make_derived_from_derived(DerivedMesh *dm,
MultiresModifierData *mmd,
Object *ob,
MultiresFlags flags)
{
Mesh *me = ob->data;
DerivedMesh *result;
CCGDerivedMesh *ccgdm = NULL;
DMGridData **gridData, **subGridData;
int lvl = multires_get_level(ob, mmd, useRenderParams);
CCGElem **gridData, **subGridData;
CCGKey key;
int lvl = multires_get_level(ob, mmd, (flags & MULTIRES_USE_RENDER_PARAMS));
int i, gridSize, numGrids;
if (lvl == 0)
@ -1339,14 +1439,15 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd,
result = subsurf_dm_create_local(ob, dm, lvl,
mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges,
mmd->flags & eMultiresModifierFlag_PlainUv);
mmd->flags & eMultiresModifierFlag_PlainUv,
flags & MULTIRES_ALLOC_PAINT_MASK);
if (!local_mmd) {
if (!(flags & MULTIRES_USE_LOCAL_MMD)) {
ccgdm = (CCGDerivedMesh *)result;
ccgdm->multires.ob = ob;
ccgdm->multires.mmd = mmd;
ccgdm->multires.local_mmd = local_mmd;
ccgdm->multires.local_mmd = 0;
ccgdm->multires.lvl = lvl;
ccgdm->multires.totlvl = mmd->totlvl;
ccgdm->multires.modified_flags = 0;
@ -1355,12 +1456,13 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd,
numGrids = result->getNumGrids(result);
gridSize = result->getGridSize(result);
gridData = result->getGridData(result);
result->getGridKey(result, &key);
subGridData = MEM_callocN(sizeof(DMGridData *) * numGrids, "subGridData*");
subGridData = MEM_callocN(sizeof(CCGElem *) * numGrids, "subGridData*");
for (i = 0; i < numGrids; i++) {
subGridData[i] = MEM_callocN(sizeof(DMGridData) * gridSize * gridSize, "subGridData");
memcpy(subGridData[i], gridData[i], sizeof(DMGridData) * gridSize * gridSize);
subGridData[i] = MEM_callocN(key.elem_size * gridSize * gridSize, "subGridData");
memcpy(subGridData[i], gridData[i], key.elem_size * gridSize * gridSize);
}
multires_set_tot_mdisps(me, mmd->totlvl);
@ -1381,7 +1483,7 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd,
}
/**** Old Multires code ****
***************************/
***************************/
/* Adapted from sculptmode.c */
void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v)
@ -1675,26 +1777,29 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
CCGSubSurf *ss = ccgdm->ss;
DMGridData *vd;
CCGElem *vd;
CCGKey key;
int index;
int totvert, totedge, totface;
int gridSize = ccgSubSurf_getGridSize(ss);
int edgeSize = ccgSubSurf_getEdgeSize(ss);
int i = 0;
dm->getGridKey(dm, &key);
totface = ccgSubSurf_getNumFaces(ss);
for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
vd = ccgSubSurf_getFaceCenterData(f);
copy_v3_v3(vd->co, mvert[i].co);
copy_v3_v3(CCG_elem_co(&key, vd), mvert[i].co);
i++;
for (S = 0; S < numVerts; S++) {
for (x = 1; x < gridSize - 1; x++, i++) {
vd = ccgSubSurf_getFaceGridEdgeData(ss, f, S, x);
copy_v3_v3(vd->co, mvert[i].co);
copy_v3_v3(CCG_elem_co(&key, vd), mvert[i].co);
}
}
@ -1702,7 +1807,7 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
for (y = 1; y < gridSize - 1; y++) {
for (x = 1; x < gridSize - 1; x++, i++) {
vd = ccgSubSurf_getFaceGridData(ss, f, S, x, y);
copy_v3_v3(vd->co, mvert[i].co);
copy_v3_v3(CCG_elem_co(&key, vd), mvert[i].co);
}
}
}
@ -1715,7 +1820,7 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
for (x = 1; x < edgeSize - 1; x++, i++) {
vd = ccgSubSurf_getEdgeData(ss, e, x);
copy_v3_v3(vd->co, mvert[i].co);
copy_v3_v3(CCG_elem_co(&key, vd), mvert[i].co);
}
}
@ -1724,7 +1829,7 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
CCGVert *v = ccgdm->vertMap[index].vert;
vd = ccgSubSurf_getVertData(ss, v);
copy_v3_v3(vd->co, mvert[i].co);
copy_v3_v3(CCG_elem_co(&key, vd), mvert[i].co);
i++;
}
@ -1990,7 +2095,7 @@ void multires_load_old(Object *ob, Mesh *me)
mmd->lvl = mmd->totlvl;
orig = CDDM_from_mesh(me, NULL);
dm = multires_dm_create_from_derived(mmd, 0, orig, ob, 0);
dm = multires_make_derived_from_derived(orig, mmd, ob, 0);
multires_load_old_dm(dm, me, mmd->totlvl + 1);
@ -2037,7 +2142,8 @@ static void multires_sync_levels(Scene *scene, Object *ob, Object *to_ob)
static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
{
DerivedMesh *dm = NULL, *cddm = NULL, *subdm = NULL;
DMGridData **gridData, **subGridData;
CCGElem **gridData, **subGridData;
CCGKey key;
Mesh *me = (Mesh *)ob->data;
MPoly *mpoly = me->mpoly;
/* MLoop *mloop = me->mloop; */ /* UNUSED */
@ -2072,13 +2178,14 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
MEM_freeN(vertCos);
/* scaled ccgDM for tangent space of object with applied scale */
dm = subsurf_dm_create_local(ob, cddm, high_mmd.totlvl, high_mmd.simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv);
dm = subsurf_dm_create_local(ob, cddm, high_mmd.totlvl, high_mmd.simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, 0);
cddm->release(cddm);
/*numGrids= dm->getNumGrids(dm);*/ /*UNUSED*/
/*numGrids = dm->getNumGrids(dm);*/ /*UNUSED*/
gridSize = dm->getGridSize(dm);
gridData = dm->getGridData(dm);
gridOffset = dm->getGridOffset(dm);
dm->getGridKey(dm, &key);
subGridData = subdm->getGridData(subdm);
dGridSize = multires_side_tot[high_mmd.totlvl];
@ -2091,23 +2198,23 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
int S, x, y, gIndex = gridOffset[i];
for (S = 0; S < numVerts; ++S, ++gIndex, mdisp++) {
DMGridData *grid = gridData[gIndex];
DMGridData *subgrid = subGridData[gIndex];
CCGElem *grid = gridData[gIndex];
CCGElem *subgrid = subGridData[gIndex];
float (*dispgrid)[3] = mdisp->disps;
for (y = 0; y < gridSize; y++) {
for (x = 0; x < gridSize; x++) {
float *co = grid[x + y * gridSize].co;
float *sco = subgrid[x + y * gridSize].co;
float *no = grid[x + y * gridSize].no;
float *co = CCG_grid_elem_co(&key, grid, x, y);
float *sco = CCG_grid_elem_co(&key, subgrid, x, y);
float *no = CCG_grid_elem_no(&key, grid, x, y);
float *data = dispgrid[dGridSize * y * dSkip + x * dSkip];
float mat[3][3], tx[3], ty[3], disp[3];
/* construct tangent space matrix */
grid_tangent(gridSize, gIndex, x, y, 0, gridData, tx);
grid_tangent(&key, x, y, 0, gridData[gIndex], tx);
normalize_v3(tx);
grid_tangent(gridSize, gIndex, x, y, 1, gridData, ty);
grid_tangent(&key, x, y, 1, gridData[gIndex], ty);
normalize_v3(ty);
column_vectors_to_mat3(mat, tx, ty, no);

@ -60,19 +60,19 @@ Paint *paint_get_active(Scene *sce)
if (sce->basact && sce->basact->object) {
switch (sce->basact->object->mode) {
case OB_MODE_SCULPT:
return &ts->sculpt->paint;
case OB_MODE_VERTEX_PAINT:
return &ts->vpaint->paint;
case OB_MODE_WEIGHT_PAINT:
return &ts->wpaint->paint;
case OB_MODE_TEXTURE_PAINT:
return &ts->imapaint.paint;
case OB_MODE_EDIT:
if (ts->use_uv_sculpt)
return &ts->uvsculpt->paint;
else
case OB_MODE_SCULPT:
return &ts->sculpt->paint;
case OB_MODE_VERTEX_PAINT:
return &ts->vpaint->paint;
case OB_MODE_WEIGHT_PAINT:
return &ts->wpaint->paint;
case OB_MODE_TEXTURE_PAINT:
return &ts->imapaint.paint;
case OB_MODE_EDIT:
if (ts->use_uv_sculpt)
return &ts->uvsculpt->paint;
else
return &ts->imapaint.paint;
}
}
@ -93,7 +93,7 @@ void paint_brush_set(Paint *p, Brush *br)
if (p) {
id_us_min((ID *)p->brush);
id_us_plus((ID *)br);
p->brush= br;
p->brush = br;
}
}
@ -104,7 +104,7 @@ int paint_facesel_test(Object *ob)
(ob->type == OB_MESH) &&
(ob->data != NULL) &&
(((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_MASK) &&
(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))
(ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))
);
}
@ -126,7 +126,7 @@ void paint_init(Paint *p, const char col[3])
/* If there's no brush, create one */
brush = paint_brush(p);
if (brush == NULL)
brush= BKE_brush_add("Brush");
brush = BKE_brush_add("Brush");
paint_brush_set(p, brush);
memcpy(p->paint_cursor_col, col, 3);
@ -146,7 +146,7 @@ void free_paint(Paint *paint)
* with paint_brush_set() */
void copy_paint(Paint *src, Paint *tar)
{
tar->brush= src->brush;
tar->brush = src->brush;
id_us_plus((ID *)tar->brush);
}
@ -155,20 +155,29 @@ void copy_paint(Paint *src, Paint *tar)
int paint_is_face_hidden(const MFace *f, const MVert *mvert)
{
return ((mvert[f->v1].flag & ME_HIDE) ||
(mvert[f->v2].flag & ME_HIDE) ||
(mvert[f->v3].flag & ME_HIDE) ||
(f->v4 && (mvert[f->v4].flag & ME_HIDE)));
(mvert[f->v2].flag & ME_HIDE) ||
(mvert[f->v3].flag & ME_HIDE) ||
(f->v4 && (mvert[f->v4].flag & ME_HIDE)));
}
/* returns non-zero if any of the corners of the grid
* face whose inner corner is at (x,y) are hidden,
* zero otherwise */
int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
int gridsize, int x, int y)
int gridsize, int x, int y)
{
/* skip face if any of its corners are hidden */
return (BLI_BITMAP_GET(grid_hidden, y * gridsize + x) ||
BLI_BITMAP_GET(grid_hidden, y * gridsize + x+1) ||
BLI_BITMAP_GET(grid_hidden, (y+1) * gridsize + x+1) ||
BLI_BITMAP_GET(grid_hidden, (y+1) * gridsize + x));
BLI_BITMAP_GET(grid_hidden, y * gridsize + x + 1) ||
BLI_BITMAP_GET(grid_hidden, (y + 1) * gridsize + x + 1) ||
BLI_BITMAP_GET(grid_hidden, (y + 1) * gridsize + x));
}
float paint_grid_paint_mask(const GridPaintMask *gpm, unsigned level,
unsigned x, unsigned y)
{
int factor = ccg_factor(level, gpm->level);
int gridsize = ccg_gridsize(gpm->level);
return gpm->data[(y * factor) * gridsize + (x * factor)];
}

@ -266,7 +266,7 @@ void BKE_scene_free(Scene *sce)
}
BLI_freelistN(&sce->base);
seq_free_editing(sce);
BKE_sequencer_editing_free(sce);
BKE_free_animdata((ID *)sce);
BKE_keyingsets_free(&sce->keyingsets);

@ -216,13 +216,10 @@ void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
}
Editing *seq_give_editing(Scene *scene, int alloc)
Editing *BKE_sequencer_editing_get(Scene *scene, int alloc)
{
if (scene->ed == NULL && alloc) {
Editing *ed;
ed = scene->ed = MEM_callocN(sizeof(Editing), "addseq");
ed->seqbasep = &ed->seqbase;
if (alloc) {
BKE_sequencer_editing_ensure(scene);
}
return scene->ed;
}
@ -250,7 +247,19 @@ void seq_free_clipboard(void)
seqbase_clipboard.first = seqbase_clipboard.last = NULL;
}
void seq_free_editing(Scene *scene)
Editing *BKE_sequencer_editing_ensure(Scene *scene)
{
if (scene->ed == NULL) {
Editing *ed;
ed = scene->ed = MEM_callocN(sizeof(Editing), "addseq");
ed->seqbasep = &ed->seqbase;
}
return scene->ed;
}
void BKE_sequencer_editing_free(Scene *scene)
{
Editing *ed = scene->ed;
MetaStack *ms;
@ -271,6 +280,8 @@ void seq_free_editing(Scene *scene)
}
MEM_freeN(ed);
scene->ed = NULL;
}
/* **********************************************************************
@ -754,11 +765,11 @@ void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range)
calc_sequence(scene, seq);
}
void sort_seq(Scene *scene)
void BKE_sequencer_sort(Scene *scene)
{
/* all strips together per kind, and in order of y location ("machine") */
ListBase seqbase, effbase;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *seqt;
@ -1075,7 +1086,7 @@ static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfr
int evaluate_seq_frame(Scene *scene, int cfra)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq_arr[MAXSEQ + 1];
if (ed == NULL) return 0;
@ -2530,7 +2541,7 @@ static ImBuf *seq_render_strip_stack(
ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown)
{
Editing *ed = seq_give_editing(context.scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(context.scene, FALSE);
int count;
ListBase *seqbasep;
@ -3007,7 +3018,7 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
if (ed == NULL) return;
@ -3254,7 +3265,7 @@ void seq_sound_init(Scene *scene, Sequence *seq)
Sequence *seq_foreground_frame_get(Scene *scene, int frame)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *best_seq = NULL;
int best_machine = -1;
@ -3660,26 +3671,26 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
}
Sequence *seq_active_get(Scene *scene)
Sequence *BKE_sequencer_active_get(Scene *scene)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed == NULL) return NULL;
return ed->act_seq;
}
void seq_active_set(Scene *scene, Sequence *seq)
void BKE_sequencer_active_set(Scene *scene, Sequence *seq)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed == NULL) return;
ed->act_seq = seq;
}
int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
int BKE_sequencer_active_get_pair(Scene *scene, Sequence **seq_act, Sequence **seq_other)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
*seq_act = seq_active_get(scene);
*seq_act = BKE_sequencer_active_get(scene);
if (*seq_act == NULL) {
return 0;
@ -3718,7 +3729,7 @@ void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
if (seq_load->flag & SEQ_LOAD_REPLACE_SEL) {
seq_load->flag |= SELECT;
seq_active_set(scene, seq);
BKE_sequencer_active_set(scene, seq);
}
if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
@ -3785,7 +3796,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C); /* only for sound */
Editing *ed = seq_give_editing(scene, TRUE);
Editing *ed = BKE_sequencer_editing_get(scene, TRUE);
bSound *sound;
Sequence *seq; /* generic strip vars */
@ -4015,7 +4026,7 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase,
{
Sequence *seq;
Sequence *seqn = NULL;
Sequence *last_seq = seq_active_get(scene);
Sequence *last_seq = BKE_sequencer_active_get(scene);
for (seq = seqbase->first; seq; seq = seq->next) {
seq->tmp = NULL;
@ -4033,7 +4044,7 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase,
if (dupe_flag & SEQ_DUPE_CONTEXT) {
if (seq == last_seq) {
seq_active_set(scene, seqn);
BKE_sequencer_active_set(scene, seqn);
}
}
}

@ -57,7 +57,7 @@
#include "BKE_tessmesh.h"
/* Util macros */
#define OUT_OF_MEMORY() ((void)printf("Shrinkwrap: Out of memory\n"))
#define OUT_OF_MEMORY() ((void)printf("Shrinkwrap: Out of memory\n"))
/* Benchmark macros */
#if !defined(_WIN32) && 0
@ -79,17 +79,17 @@
#else
#define BENCH(a) (a)
#define BENCH(a) (a)
#endif
typedef void ( *Shrinkwrap_ForeachVertexCallback) (DerivedMesh *target, float *co, float *normal);
typedef void (*Shrinkwrap_ForeachVertexCallback)(DerivedMesh *target, float *co, float *normal);
/* get derived mesh */
//TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not?
DerivedMesh *object_get_derived_final(Object *ob)
{
Mesh *me= ob->data;
Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
if (em) {
@ -111,12 +111,12 @@ void space_transform_from_matrixs(SpaceTransform *data, float local[4][4], float
void space_transform_apply(const SpaceTransform *data, float *co)
{
mul_v3_m4v3(co, ((SpaceTransform*)data)->local2target, co);
mul_v3_m4v3(co, ((SpaceTransform *)data)->local2target, co);
}
void space_transform_invert(const SpaceTransform *data, float *co)
{
mul_v3_m4v3(co, ((SpaceTransform*)data)->target2local, co);
mul_v3_m4v3(co, ((SpaceTransform *)data)->target2local, co);
}
static void space_transform_apply_normal(const SpaceTransform *data, float *no)
@ -127,7 +127,7 @@ static void space_transform_apply_normal(const SpaceTransform *data, float *no)
static void space_transform_invert_normal(const SpaceTransform *data, float *no)
{
mul_mat3_m4_v3(((SpaceTransform*)data)->target2local, no);
mul_mat3_m4_v3(((SpaceTransform *)data)->target2local, no);
normalize_v3(no); // TODO: could we just determine de scale value from the matrix?
}
@ -142,7 +142,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
int i;
BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
BVHTreeNearest nearest = NULL_BVHTreeNearest;
BVHTreeNearest nearest = NULL_BVHTreeNearest;
BENCH(bvhtree_from_mesh_verts(&treeData, calc->target, 0.0, 2, 6));
@ -157,7 +157,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
#ifndef __APPLE__
#pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(treeData,calc) schedule(static)
#endif
for (i = 0; i<calc->numVerts; ++i) {
for (i = 0; i < calc->numVerts; ++i) {
float *co = calc->vertexCos[i];
float tmp_co[3];
float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
@ -190,13 +190,13 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
if (nearest.index != -1) {
//Adjusting the vertex weight, so that after interpolating it keeps a certain distance from the nearest position
float dist = sasqrt(nearest.dist);
if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist)/dist;
if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist) / dist;
//Convert the coordinates back to mesh coordinates
copy_v3_v3(tmp_co, nearest.co);
space_transform_invert(&calc->local2target, tmp_co);
interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation
interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation
}
}
@ -230,7 +230,7 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
space_transform_apply_normal(transf, tmp_no);
no = tmp_no;
hit_tmp.dist *= mat4_to_scale(((SpaceTransform*)transf)->local2target);
hit_tmp.dist *= mat4_to_scale(((SpaceTransform *)transf)->local2target);
}
else {
co = vert;
@ -247,12 +247,12 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
space_transform_invert_normal(transf, hit_tmp.no);
}
if (options & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) {
if (options & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) {
/* apply backface */
const float dot= dot_v3v3(dir, hit_tmp.no);
if ( ((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE) && dot >= 0.0f)
) {
const float dot = dot_v3v3(dir, hit_tmp.no);
if (((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE) && dot >= 0.0f))
{
return FALSE; /* Ignore hit */
}
}
@ -275,16 +275,16 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
int i;
//Options about projection direction
const char use_normal = calc->smd->shrinkOpts;
float proj_axis[3] = {0.0f, 0.0f, 0.0f};
const char use_normal = calc->smd->shrinkOpts;
float proj_axis[3] = {0.0f, 0.0f, 0.0f};
//Raycast and tree stuff
BVHTreeRayHit hit;
BVHTreeFromMesh treeData= NULL_BVHTreeFromMesh;
BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
//auxiliary target
DerivedMesh *auxMesh = NULL;
BVHTreeFromMesh auxData = NULL_BVHTreeFromMesh;
DerivedMesh *auxMesh = NULL;
BVHTreeFromMesh auxData = NULL_BVHTreeFromMesh;
SpaceTransform local2aux;
//If the user doesn't allows to project in any direction of projection axis
@ -326,7 +326,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
#ifndef __APPLE__
#pragma omp parallel for private(i,hit) schedule(static)
#endif
for (i = 0; i<calc->numVerts; ++i) {
for (i = 0; i < calc->numVerts; ++i) {
float *co = calc->vertexCos[i];
float tmp_co[3], tmp_no[3];
float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
@ -399,10 +399,10 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
int i;
BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
BVHTreeNearest nearest = NULL_BVHTreeNearest;
BVHTreeNearest nearest = NULL_BVHTreeNearest;
//Create a bvh-tree of the given target
BENCH(bvhtree_from_mesh_faces( &treeData, calc->target, 0.0, 2, 6));
BENCH(bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 2, 6));
if (treeData.tree == NULL) {
OUT_OF_MEMORY();
return;
@ -417,7 +417,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
#ifndef __APPLE__
#pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(calc,treeData) schedule(static)
#endif
for (i = 0; i<calc->numVerts; ++i) {
for (i = 0; i < calc->numVerts; ++i) {
float *co = calc->vertexCos[i];
float tmp_co[3];
float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
@ -452,16 +452,16 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
}
else {
//Adjusting the vertex weight, so that after interpolating it keeps a certain distance from the nearest position
float dist = sasqrt( nearest.dist );
float dist = sasqrt(nearest.dist);
if (dist > FLT_EPSILON)
interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist)/dist); //linear interpolation
interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist) / dist); //linear interpolation
else
copy_v3_v3(tmp_co, nearest.co);
}
//Convert the coordinates back to mesh coordinates
space_transform_invert(&calc->local2target, tmp_co);
interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation
interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation
}
}
@ -472,7 +472,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *ss_mesh = NULL;
DerivedMesh *ss_mesh = NULL;
ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData;
//remove loop dependencies on derived meshs (TODO should this be done elsewhere?)
@ -519,11 +519,11 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
//Using vertexs positions/normals as if a subsurface was applied
if (smd->subsurfLevels) {
SubsurfModifierData ssmd= {{NULL}};
ssmd.subdivType = ME_CC_SUBSURF; //catmull clark
ssmd.levels = smd->subsurfLevels; //levels
SubsurfModifierData ssmd = {{NULL}};
ssmd.subdivType = ME_CC_SUBSURF; //catmull clark
ssmd.levels = smd->subsurfLevels; //levels
ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, FALSE, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, NULL, (ob->mode & OB_MODE_EDIT) ? SUBSURF_IN_EDIT_MODE : 0);
if (ss_mesh) {
calc.vert = ss_mesh->getVertDataArray(ss_mesh, CD_MVERT);
@ -545,15 +545,15 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
switch (smd->shrinkType) {
case MOD_SHRINKWRAP_NEAREST_SURFACE:
BENCH(shrinkwrap_calc_nearest_surface_point(&calc));
break;
break;
case MOD_SHRINKWRAP_PROJECT:
BENCH(shrinkwrap_calc_normal_projection(&calc));
break;
break;
case MOD_SHRINKWRAP_NEAREST_VERTEX:
BENCH(shrinkwrap_calc_nearest_vertex(&calc));
break;
break;
}
}

@ -70,7 +70,7 @@ static const int NAN_INT = 0x7FC00000;
static int sound_cfra;
#endif
struct bSound *sound_new_file(struct Main *bmain, const char *filename)
bSound *sound_new_file(struct Main *bmain, const char *filename)
{
bSound *sound = NULL;
@ -103,7 +103,7 @@ struct bSound *sound_new_file(struct Main *bmain, const char *filename)
return sound;
}
void BKE_sound_free(struct bSound *sound)
void BKE_sound_free(bSound *sound)
{
if (sound->packedfile) {
freePackedFile(sound->packedfile);
@ -223,7 +223,7 @@ void sound_exit(void)
// XXX unused currently
#if 0
struct bSound *sound_new_buffer(struct Main *bmain, struct bSound *source)
bSound *sound_new_buffer(struct Main *bmain, bSound *source)
{
bSound *sound = NULL;
@ -247,7 +247,7 @@ struct bSound *sound_new_buffer(struct Main *bmain, struct bSound *source)
return sound;
}
struct bSound *sound_new_limiter(struct Main *bmain, struct bSound *source, float start, float end)
bSound *sound_new_limiter(struct Main *bmain, bSound *source, float start, float end)
{
bSound *sound = NULL;
@ -274,7 +274,7 @@ struct bSound *sound_new_limiter(struct Main *bmain, struct bSound *source, floa
}
#endif
void sound_delete(struct Main *bmain, struct bSound *sound)
void sound_delete(struct Main *bmain, bSound *sound)
{
if (sound) {
BKE_sound_free(sound);
@ -283,7 +283,7 @@ void sound_delete(struct Main *bmain, struct bSound *sound)
}
}
void sound_cache(struct bSound *sound)
void sound_cache(bSound *sound)
{
sound->flags |= SOUND_FLAGS_CACHING;
if (sound->cache)
@ -296,13 +296,13 @@ void sound_cache(struct bSound *sound)
sound->playback_handle = sound->handle;
}
void sound_cache_notifying(struct Main *main, struct bSound *sound)
void sound_cache_notifying(struct Main *main, bSound *sound)
{
sound_cache(sound);
sound_update_sequencer(main, sound);
}
void sound_delete_cache(struct bSound *sound)
void sound_delete_cache(bSound *sound)
{
sound->flags &= ~SOUND_FLAGS_CACHING;
if (sound->cache) {
@ -312,7 +312,7 @@ void sound_delete_cache(struct bSound *sound)
}
}
void sound_load(struct Main *bmain, struct bSound *sound)
void sound_load(struct Main *bmain, bSound *sound)
{
if (sound) {
if (sound->cache) {
@ -353,17 +353,17 @@ void sound_load(struct Main *bmain, struct bSound *sound)
}
// XXX unused currently
#if 0
break;
}
case SOUND_TYPE_BUFFER:
if (sound->child_sound && sound->child_sound->handle)
sound->handle = AUD_bufferSound(sound->child_sound->handle);
break;
case SOUND_TYPE_LIMITER:
if (sound->child_sound && sound->child_sound->handle)
sound->handle = AUD_limitSound(sound->child_sound, sound->start, sound->end);
break;
}
break;
}
case SOUND_TYPE_BUFFER:
if (sound->child_sound && sound->child_sound->handle)
sound->handle = AUD_bufferSound(sound->child_sound->handle);
break;
case SOUND_TYPE_LIMITER:
if (sound->child_sound && sound->child_sound->handle)
sound->handle = AUD_limitSound(sound->child_sound, sound->start, sound->end);
break;
}
#endif
if (sound->flags & SOUND_FLAGS_MONO) {
void *handle = AUD_monoSound(sound->handle);
@ -391,6 +391,10 @@ AUD_Device *sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start,
void sound_create_scene(struct Scene *scene)
{
/* should be done in version patch, but this gets called before */
if (scene->r.frs_sec_base == 0)
scene->r.frs_sec_base = 1;
scene->sound_scene = AUD_createSequencer(FPS, scene->audio.flag & AUDIO_MUTE);
AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound,
scene->audio.doppler_factor, scene->audio.distance_model);
@ -484,7 +488,7 @@ void sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *seque
}
}
void sound_update_scene_sound(void *handle, struct bSound *sound)
void sound_update_scene_sound(void *handle, bSound *sound)
{
AUD_updateSequenceSound(handle, sound->playback_handle);
}
@ -514,7 +518,7 @@ void sound_set_scene_sound_pan(void *handle, float pan, char animated)
AUD_setSequenceAnimData(handle, AUD_AP_PANNING, sound_cfra, &pan, animated);
}
void sound_update_sequencer(struct Main *main, struct bSound *sound)
void sound_update_sequencer(struct Main *main, bSound *sound)
{
struct Scene *scene;
@ -645,7 +649,7 @@ int sound_scene_playing(struct Scene *scene)
return -1;
}
void sound_free_waveform(struct bSound *sound)
void sound_free_waveform(bSound *sound)
{
if (sound->waveform) {
MEM_freeN(((SoundWaveform *)sound->waveform)->data);
@ -655,7 +659,7 @@ void sound_free_waveform(struct bSound *sound)
sound->waveform = NULL;
}
void sound_read_waveform(struct bSound *sound)
void sound_read_waveform(bSound *sound)
{
AUD_SoundInfo info;
@ -749,7 +753,15 @@ void sound_update_scene(struct Scene *scene)
void *sound_get_factory(void *sound)
{
return ((struct bSound *) sound)->playback_handle;
return ((bSound *) sound)->playback_handle;
}
/* stupid wrapper because AUD_C-API.h includes Python.h which makesrna doesn't like */
float sound_get_length(bSound *sound)
{
AUD_SoundInfo info = AUD_getInfo(sound->playback_handle);
return info.length;
}
#else // WITH_AUDASPACE
@ -793,5 +805,5 @@ void sound_set_scene_sound_volume(void* handle, float volume, char animated) { (
void sound_set_scene_sound_pan(void* handle, float pan, char animated) { (void)handle; (void)pan; (void)animated; }
void sound_set_scene_volume(struct Scene *scene, float volume) { (void)scene; (void)volume; }
void sound_set_scene_sound_pitch(void* handle, float pitch, char animated) { (void)handle; (void)pitch; (void)animated; }
float sound_get_length(struct bSound* sound) { (void)sound; return 0; }
#endif // WITH_AUDASPACE

File diff suppressed because it is too large Load Diff

@ -1198,6 +1198,8 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
else
tmpibuf = IMB_allocImBuf(w + margin * 2, h + margin * 2, 32, IB_rect);
tmpibuf->profile = ibuf->profile;
IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1 - margin, y1 - margin, w + margin * 2, h + margin * 2);
if (pos != NULL) {

@ -28,9 +28,11 @@
#include "BLI_bitmap.h"
struct CCGElem;
struct CCGKey;
struct CustomData;
struct DMFlagMat;
struct DMGridAdjacency;
struct DMGridData;
struct ListBase;
struct MFace;
struct MVert;
@ -50,17 +52,17 @@ typedef struct {
typedef int (*BLI_pbvh_SearchCallback)(PBVHNode *node, void *data);
typedef void (*BLI_pbvh_HitCallback)(PBVHNode *node, void *data);
typedef void (*BLI_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float* tmin);
typedef void (*BLI_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin);
/* Building */
PBVH *BLI_pbvh_new(void);
void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
int totface, int totvert);
void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids,
struct DMGridAdjacency *gridadj, int totgrid,
int gridsize, void **gridfaces, struct DMFlagMat *flagmats,
unsigned int **grid_hidden);
int totface, int totvert, struct CustomData *vdata);
void BLI_pbvh_build_grids(PBVH *bvh, struct CCGElem **grid_elems,
struct DMGridAdjacency *gridadj, int totgrid,
struct CCGKey *key, void **gridfaces, struct DMFlagMat *flagmats,
unsigned int **grid_hidden);
void BLI_pbvh_free(PBVH *bvh);
/* Hierarchical Search in the BVH, two methods:
@ -68,28 +70,28 @@ void BLI_pbvh_free(PBVH *bvh);
* - gather nodes in an array (easy to multithread) */
void BLI_pbvh_search_callback(PBVH *bvh,
BLI_pbvh_SearchCallback scb, void *search_data,
BLI_pbvh_HitCallback hcb, void *hit_data);
BLI_pbvh_SearchCallback scb, void *search_data,
BLI_pbvh_HitCallback hcb, void *hit_data);
void BLI_pbvh_search_gather(PBVH *bvh,
BLI_pbvh_SearchCallback scb, void *search_data,
PBVHNode ***array, int *tot);
BLI_pbvh_SearchCallback scb, void *search_data,
PBVHNode ***array, int *tot);
/* Raycast
* the hit callback is called for all leaf nodes intersecting the ray;
* it's up to the callback to find the primitive within the leaves that is
* hit first */
void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data,
void BLI_pbvh_raycast(PBVH * bvh, BLI_pbvh_HitOccludedCallback cb, void *data,
float ray_start[3], float ray_normal[3], int original);
int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
float ray_start[3], float ray_normal[3], float *dist);
int BLI_pbvh_node_raycast(PBVH * bvh, PBVHNode * node, float (*origco)[3],
float ray_start[3], float ray_normal[3], float *dist);
/* Drawing */
void BLI_pbvh_node_draw(PBVHNode *node, void *data);
void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
int (*setMaterial)(int, void *attribs));
int (*setMaterial)(int, void *attribs));
/* PBVH Access */
typedef enum {
@ -102,6 +104,9 @@ PBVHType BLI_pbvh_type(const PBVH *bvh);
/* multires hidden data, only valid for type == PBVH_GRIDS */
unsigned int **BLI_pbvh_grid_hidden(const PBVH *bvh);
/* multires level, only valid for type == PBVH_GRIDS */
void BLI_pbvh_get_grid_key(const PBVH *pbvh, struct CCGKey *key);
/* Node Access */
typedef enum {
@ -122,17 +127,17 @@ void BLI_pbvh_node_mark_rebuild_draw(PBVHNode *node);
void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node,
int **grid_indices, int *totgrid, int *maxgrid, int *gridsize,
struct DMGridData ***griddata, struct DMGridAdjacency **gridadj);
int **grid_indices, int *totgrid, int *maxgrid, int *gridsize,
struct CCGElem ***grid_elems, struct DMGridAdjacency **gridadj);
void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node,
int *uniquevert, int *totvert);
int *uniquevert, int *totvert);
void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node,
int **vert_indices, struct MVert **verts);
int **vert_indices, struct MVert **verts);
void BLI_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
void BLI_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
void BLI_pbvh_node_get_BB(PBVHNode * node, float bb_min[3], float bb_max[3]);
void BLI_pbvh_node_get_original_BB(PBVHNode * node, float bb_min[3], float bb_max[3]);
float BLI_pbvh_node_get_tmin(PBVHNode* node);
float BLI_pbvh_node_get_tmin(PBVHNode *node);
/* test if AABB is at least partially inside the planes' volume */
int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
@ -142,10 +147,10 @@ int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data);
/* Update Normals/Bounding Box/Draw Buffers/Redraw and clear flags */
void BLI_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]);
void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3]);
void BLI_pbvh_redraw_BB(PBVH * bvh, float bb_min[3], float bb_max[3]);
void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface);
void BLI_pbvh_grids_update(PBVH *bvh, struct DMGridData **grids,
struct DMGridAdjacency *gridadj, void **gridfaces);
void BLI_pbvh_grids_update(PBVH *bvh, struct CCGElem **grid_elems,
struct DMGridAdjacency *gridadj, void **gridfaces);
/* vertex deformer */
float (*BLI_pbvh_get_vertCos(struct PBVH *pbvh))[3];
@ -161,8 +166,8 @@ int BLI_pbvh_isDeformed(struct PBVH *pbvh);
/* note: PBVH_ITER_ALL does not skip hidden vertices,
* PBVH_ITER_UNIQUE does */
#define PBVH_ITER_ALL 0
#define PBVH_ITER_UNIQUE 1
#define PBVH_ITER_ALL 0
#define PBVH_ITER_UNIQUE 1
typedef struct PBVHVertexIter {
/* iteration */
@ -174,8 +179,9 @@ typedef struct PBVHVertexIter {
int i;
/* grid */
struct DMGridData **grids;
struct DMGridData *grid;
struct CCGElem **grids;
struct CCGElem *grid;
struct CCGKey *key;
BLI_bitmap *grid_hidden, gh;
int *grid_indices;
int totgrid;
@ -185,6 +191,7 @@ typedef struct PBVHVertexIter {
struct MVert *mverts;
int totvert;
int *vert_indices;
float *vmask;
/* result: these are all computed in the macro, but we assume
* that compiler optimization's will skip the ones we don't use */
@ -192,6 +199,7 @@ typedef struct PBVHVertexIter {
float *co;
short *no;
float *fno;
float *mask;
} PBVHVertexIter;
#ifdef _MSC_VER
@ -199,41 +207,44 @@ typedef struct PBVHVertexIter {
#endif
void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
PBVHVertexIter *vi, int mode);
PBVHVertexIter *vi, int mode);
#define BLI_pbvh_vertex_iter_begin(bvh, node, vi, mode) \
pbvh_vertex_iter_init(bvh, node, &vi, mode); \
\
for(vi.i=0, vi.g=0; vi.g<vi.totgrid; vi.g++) { \
if(vi.grids) { \
vi.width= vi.gridsize; \
vi.height= vi.gridsize; \
vi.grid= vi.grids[vi.grid_indices[vi.g]]; \
if(mode == PBVH_ITER_UNIQUE) \
vi.gh= vi.grid_hidden[vi.grid_indices[vi.g]]; \
for (vi.i = 0, vi.g = 0; vi.g < vi.totgrid; vi.g++) { \
if (vi.grids) { \
vi.width = vi.gridsize; \
vi.height = vi.gridsize; \
vi.grid = vi.grids[vi.grid_indices[vi.g]]; \
if (mode == PBVH_ITER_UNIQUE) \
vi.gh = vi.grid_hidden[vi.grid_indices[vi.g]]; \
} \
else { \
vi.width= vi.totvert; \
vi.height= 1; \
vi.width = vi.totvert; \
vi.height = 1; \
} \
\
for(vi.gy=0; vi.gy<vi.height; vi.gy++) { \
for(vi.gx=0; vi.gx<vi.width; vi.gx++, vi.i++) { \
if(vi.grid) { \
vi.co= vi.grid->co; \
vi.fno= vi.grid->no; \
vi.grid++; \
if(vi.gh) { \
if(BLI_BITMAP_GET(vi.gh, vi.gy * vi.gridsize + vi.gx)) \
for (vi.gy = 0; vi.gy < vi.height; vi.gy++) { \
for (vi.gx = 0; vi.gx < vi.width; vi.gx++, vi.i++) { \
if (vi.grid) { \
vi.co = CCG_elem_co(vi.key, vi.grid); \
vi.fno = CCG_elem_no(vi.key, vi.grid); \
vi.mask = CCG_elem_mask(vi.key, vi.grid); \
vi.grid = CCG_elem_next(vi.key, vi.grid); \
if (vi.gh) { \
if (BLI_BITMAP_GET(vi.gh, vi.gy * vi.gridsize + vi.gx)) \
continue; \
} \
} \
else { \
vi.mvert= &vi.mverts[vi.vert_indices[vi.gx]]; \
if(mode == PBVH_ITER_UNIQUE && vi.mvert->flag & ME_HIDE) \
vi.mvert = &vi.mverts[vi.vert_indices[vi.gx]]; \
if (mode == PBVH_ITER_UNIQUE && vi.mvert->flag & ME_HIDE) \
continue; \
vi.co= vi.mvert->co; \
vi.no= vi.mvert->no; \
vi.co = vi.mvert->co; \
vi.no = vi.mvert->no; \
if (vi.vmask) \
vi.mask = &vi.vmask[vi.vert_indices[vi.gx]]; \
} \
#define BLI_pbvh_vertex_iter_end \
@ -241,10 +252,10 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
} \
}
void BLI_pbvh_node_get_proxies(PBVHNode* node, PBVHProxyNode** proxies, int* proxy_count);
void BLI_pbvh_node_free_proxies(PBVHNode* node);
PBVHProxyNode* BLI_pbvh_node_add_proxy(PBVH* bvh, PBVHNode* node);
void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** nodes, int* totnode);
void BLI_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count);
void BLI_pbvh_node_free_proxies(PBVHNode *node);
PBVHProxyNode *BLI_pbvh_node_add_proxy(PBVH *bvh, PBVHNode *node);
void BLI_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***nodes, int *totnode);
//void BLI_pbvh_node_BB_reset(PBVHNode* node);
//void BLI_pbvh_node_BB_expand(PBVHNode* node, float co[3]);

File diff suppressed because it is too large Load Diff

@ -3828,6 +3828,19 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte
}
}
static void direct_link_grid_paint_mask(FileData *fd, int count, GridPaintMask *grid_paint_mask)
{
if(grid_paint_mask) {
int i;
for(i = 0; i < count; ++i) {
GridPaintMask *gpm = &grid_paint_mask[i];
if(gpm->data)
gpm->data = newdataadr(fd, gpm->data);
}
}
}
/*this isn't really a public api function, so prototyped here*/
static void direct_link_customdata(FileData *fd, CustomData *data, int count)
{
@ -3854,6 +3867,8 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
layer->data = newdataadr(fd, layer->data);
if (layer->type == CD_MDISPS)
direct_link_mdisps(fd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL);
else if(layer->type == CD_GRID_PAINT_MASK)
direct_link_grid_paint_mask(fd, count, layer->data);
i++;
}
}
@ -6825,6 +6840,52 @@ static void do_versions_nodetree_multi_file_output_path_2_64_0(bNodeTree *ntree)
}
}
static void do_versions_nodetree_file_output_layers_2_64_5(bNodeTree *ntree)
{
bNode *node;
for (node=ntree->nodes.first; node; node=node->next) {
if (node->type==CMP_NODE_OUTPUT_FILE) {
bNodeSocket *sock;
for (sock=node->inputs.first; sock; sock=sock->next) {
NodeImageMultiFileSocket *input = sock->storage;
/* multilayer names are stored as separate strings now,
* used the path string before, so copy it over.
*/
BLI_strncpy(input->layer, input->path, sizeof(input->layer));
/* paths/layer names also have to be unique now, initial check */
ntreeCompositOutputFileUniquePath(&node->inputs, sock, input->path, '_');
ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, input->layer, '_');
}
}
}
}
static void do_versions_nodetree_image_layer_2_64_5(bNodeTree *ntree)
{
bNode *node;
for (node=ntree->nodes.first; node; node=node->next) {
if (node->type==CMP_NODE_IMAGE) {
ImageUser *iuser= (ImageUser *)node->storage;
bNodeSocket *sock;
for (sock=node->outputs.first; sock; sock=sock->next) {
NodeImageLayer *output = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
/* take layer index from image user (this is ignored from now on) */
output->layer_index = iuser->layer;
/* take pass index both from current storage ptr (actually an int) */
output->pass_index = GET_INT_FROM_POINTER(sock->storage);
/* replace socket data pointer */
sock->storage = output;
}
}
}
}
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@ -7441,6 +7502,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 5))
{
{
/* file output node paths are now stored in the file info struct instead socket name */
Scene *sce;
bNodeTree *ntree;
for (sce = main->scene.first; sce; sce=sce->id.next) {
if (sce->nodetree) {
do_versions_nodetree_file_output_layers_2_64_5(sce->nodetree);
do_versions_nodetree_image_layer_2_64_5(sce->nodetree);
}
}
for (ntree = main->nodetree.first; ntree; ntree=ntree->id.next) {
do_versions_nodetree_file_output_layers_2_64_5(ntree);
do_versions_nodetree_image_layer_2_64_5(ntree);
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */

@ -152,6 +152,7 @@ Any case: direct data is ALWAYS after the lib block
#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_sequencer.h"
#include "BKE_subsurf.h"
#include "BKE_utildefines.h"
#include "BKE_modifier.h"
#include "BKE_fcurve.h"
@ -733,6 +734,11 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
for (sock=node->inputs.first; sock; sock=sock->next)
writestruct(wd, DATA, "NodeImageMultiFileSocket", 1, sock->storage);
}
if (node->type==CMP_NODE_IMAGE) {
/* write extra socket info */
for (sock=node->outputs.first; sock; sock=sock->next)
writestruct(wd, DATA, "NodeImageLayer", 1, sock->storage);
}
}
for (link= ntree->links.first; link; link= link->next)
@ -1654,6 +1660,24 @@ static void write_mdisps(WriteData *wd, int count, MDisps *mdlist, int external)
}
}
static void write_grid_paint_mask(WriteData *wd, int count, GridPaintMask *grid_paint_mask)
{
if(grid_paint_mask) {
int i;
writestruct(wd, DATA, "GridPaintMask", count, grid_paint_mask);
for(i = 0; i < count; ++i) {
GridPaintMask *gpm = &grid_paint_mask[i];
if(gpm->data) {
const int gridsize = ccg_gridsize(gpm->level);
writedata(wd, DATA,
sizeof(*gpm->data) * gridsize * gridsize,
gpm->data);
}
}
}
}
static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data, int partial_type, int partial_count)
{
int i;
@ -1676,6 +1700,13 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
else if (layer->type == CD_MDISPS) {
write_mdisps(wd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL);
}
else if (layer->type == CD_PAINT_MASK) {
float *layer_data = layer->data;
writedata(wd, DATA, sizeof(*layer_data) * count, layer_data);
}
else if (layer->type == CD_GRID_PAINT_MASK) {
write_grid_paint_mask(wd, count, layer->data);
}
else {
CustomData_file_write_info(layer->type, &structname, &structnum);
if (structnum) {

@ -70,7 +70,7 @@ void MaterialsExporter::operator()(Material *ma, Object *ob)
{
std::string name(id_name(ma));
openMaterial(get_material_id(ma), name);
openMaterial(get_material_id(ma), get_material_id(ma));
std::string efid = translate_id(name) + "-effect";
addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid));

@ -196,7 +196,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
/* only affect if F-Curve involves sequence_editor.sequences */
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
char *seq_name;

@ -882,7 +882,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
/* only consider if F-Curve involves sequence_editor.sequences */
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
char *seq_name;

@ -64,6 +64,7 @@ if(WITH_BLENDER)
inflate.png.c
layer.png.c
lighten.png.c
mask.png.c
mix.png.c
multiply.png.c
nudge.png.c

@ -0,0 +1,400 @@
/* DataToC output of file <mask_png> */
int datatoc_mask_png_size= 12593;
char datatoc_mask_png[]= {
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0,
0, 0, 96, 0, 0, 0, 96, 8, 2, 0, 0, 0,109,250,224,111, 0, 0, 0, 1,115, 82, 71, 66, 0,174,206, 28,233, 0, 0, 0,
6, 98, 75, 71, 68, 0,255, 0,255, 0,255,160,189,167,147, 0, 0, 0, 9,112, 72, 89,115, 0, 0, 11, 19, 0, 0, 11, 19, 1,
0,154,156, 24, 0, 0, 0, 7,116, 73, 77, 69, 7,220, 3, 25, 18, 46, 48,241,229, 90,175, 0, 0, 32, 0, 73, 68, 65, 84,120,
218,237,189, 89,172,101,217,113, 37, 22, 17,123,159,115,231,225, 13,249,114,100,101, 85,102,205, 44, 22,103, 82,148,186, 53,160,
219,114, 55,220,238, 54, 96,160, 1, 15,253, 39,209,128, 13,201, 18,108,195, 48,208,147, 97,255,248,195,250, 51, 12,248,211, 31,
254, 50, 96, 3, 22, 4, 75,178,196,110, 81, 18, 41,137, 44,146, 53,207, 89, 85, 57,231, 27,239,124,206,217, 59, 34,252, 17,123,
159,251,146,173,238, 22, 69,181,236, 6, 58,137,202,122,204,151,239,189,123,227,196,142, 88,177,214,138, 93, 0,255,230,215,191,
249,245,231,254, 69, 0,254, 47,246, 59, 94, 57,216,255,155, 63,247, 83, 63,245,197,207, 58, 71,239,124,240,241,111,125,243,143,
190,243,218,155,255,250, 6,168, 68,196, 31,255,187,116, 59,229,115, 55,174,255,221,127,231,223,250, 15,255,189,191,113,176,191,
171, 12, 77,108,132, 5,145, 8,225,206,131,195, 63,252,238, 15,254,239,223,251,214, 43,175,191, 61, 91, 44,215,155,170, 9,225,
95,139,232, 56, 4, 5,248,113, 3,244,210,179, 55,255,135,255,230,151,127,250,203,159, 39,162,170,170, 69, 21, 16, 16, 0, 17,
68, 85, 4, 64, 21, 16, 68,228,240,228,236,225,209,241, 15,222,122,239,221, 15, 63,126,227,189, 91,175,190,253,238, 98,185, 38,
68, 81,253,255,103,128, 60, 66,212, 31,251,136,125,238,211,207,254,252, 95,249,234,186,170, 81,165, 44, 10, 86, 81, 85, 85, 5,
0, 79, 32, 4,202,202, 42, 34, 58, 30,244,203,194, 95,218,223,251,185,175,126,113, 85,109,142, 79,231,179,229,242,209,225,113,
217, 41,189, 35, 22, 93, 44, 86, 15, 14,143,155, 16,126,240,214,123, 39,103,179, 15, 62,185, 43, 34,255, 31, 6, 8, 1, 17,244,
199,205,160, 95,251,251,191,250,111,255,204,215, 28,225,160, 55, 24,244, 58,190,240,222, 57, 21,101, 21, 21, 5, 85, 1, 80, 80,
142, 28,133, 67, 19,171,186, 14, 33, 70,230, 58,132, 16, 34,139,212, 77,216,108,170,251,135,135,227,225,176,137, 81,132,189, 47,
8,177,105,194,163,211,179,183,223,251,240,253,143,238,188,255,241,237,249,114, 85,213, 53,243, 95, 94,200, 10,196,168,250,227,
102,144,130, 30,159,206,155, 80, 75,228, 94,175, 51, 28,244,167,163,209,112, 56,232, 20, 37, 17, 1, 0,168,138, 48, 18, 57, 0,
245,208, 1,116, 46,132, 24,137,200,145,107, 66, 32,194,126,183, 51,157,142,234,186, 9, 33,206,150,203,208,196,154,163, 34, 93,
220,221,185,244,147, 95,250,217,175,125,105,189,169, 30, 30,157,124,248,201,157,143,238,220,127,255,163,219,247, 30, 30,254, 37,
4, 72, 65,127,220, 26, 84,120,255,255,252,111,255, 51, 33,174,215,235, 38, 4, 21, 65, 66, 36, 44,156,159,142, 71, 7,251,123,
163,193,192, 17, 17, 33, 34, 54,129, 3, 71, 17,101, 97,142, 28, 66, 12, 49,134, 16,152, 37, 8,139,168,136, 48, 51,179,136, 74,
93, 55,103,139,165,136, 32,145,138,198,200,145,153,133,171,186, 89,173, 54,143,142,143,191,247,230, 59,175,188,246,206,114,189,
254, 87, 91,164,245,207, 21,160,126,175,251,196,149, 75,255,217,223,251,187, 63,255,211, 63, 1, 42,145,229,232,248,100,181, 89,
51,139,168,130, 10, 32,136,168,170, 14, 7,253,253,221,157,157,201,100,216,239,119,202, 82, 68,154, 16,154,200,194, 18,153,153,
99,136, 49,178,216, 97, 99, 17, 97, 86, 80, 17,101, 22,102,110, 98, 92,172,214, 42, 28, 35, 43, 40,179,178, 8,139,196, 16, 99,
140,171,205,230,187,175,189,253,135,175,188,122,116,122, 22, 66,252, 87,115,202,126,196, 0,245, 58,157,191,243,243, 63,243,183,
255,250, 79,127,233, 51, 47, 14,135,253,162, 40,188,115,170, 50, 95,172, 14,143,142,207,206,102,117,180,108, 0, 5, 5, 80,102,
142, 28,157,243,163, 65,127,111,103,186,191,179, 51, 29,143, 89, 53, 70,110, 66,104, 66, 96, 22, 97, 14,145, 67, 12, 44, 18, 34,
3, 64,136, 49,215,122, 21,213, 24, 67, 85, 55, 44, 50, 95, 44, 3, 51,179, 16, 33,139,138,112, 12,188, 90,111,222,185,245,241,
235,111,127,240,254,199,183, 23,171,191,224,132,242, 63,210, 17,251,143,255,206,223,252, 79,254,163,127,255,226,133,221,162,240,
222, 57,231, 92,225,189, 35, 42,138,162, 44,156,170,206, 22,171, 7, 15, 31, 29,159,158,213,117, 19, 56, 10,139,128, 10,139,168,
138,176, 34, 56,162,209, 96,112,237,242,229,131,253, 93, 71,142,133,215,155,166,174,235,200, 28, 35, 71,142,129, 69, 85,153, 57,
198, 40, 98,136, 1, 1, 0, 9, 17, 32, 50, 87,117,243,201,221,251, 31,220,190, 55, 25, 15, 7,189, 94,233, 41, 68,174,235,176,
92,173, 14,143, 79, 95,125,251,189, 63,121,245, 45,254, 11,237,125,238,207, 82,104,254,234,151, 63,247,191,254,218,127,251, 31,
252,237,191, 49, 28,244, 58,101,217, 43, 59,157,178, 44, 75,239,156, 35, 34, 80, 21, 81, 64, 28,244,187, 23, 47,236, 95,184,176,
215,235,118, 61, 17, 2,168,193, 34, 68, 4, 36, 0, 17, 93, 87,155,251,143, 30, 61, 60, 60,226, 40,157, 78,217,239,118,187,221,
210,130, 34, 42,106, 85, 93, 65, 21,136,208,226,131, 8,133,247,138, 72,136,101, 81, 92,185,120,240,189, 55,222,123,243,131,187,
203,229,154,136,122,221, 78, 81,250,194, 23,253, 94,247,242,193,222, 51, 79,125,234,108,190, 88,174, 55, 34,250,151, 17,160,159,
252,194,203,127,255,151,126,225, 31,252,242, 47,236, 77, 39, 44,210, 41,203, 94,183,219, 41, 11,239,124,225,157,119,228,200, 57,
34,116,132, 0,204,202, 44,142,220,100, 52,220,223,219,221,157, 76, 7,131,129, 67,140, 81,132, 89, 84, 9,145, 16, 17,176, 9,
225,232,228,244,209,209,241,106,179, 70,194,241,104, 56, 26,244,189,243,160, 26, 89, 84, 5, 16,136, 44, 62, 10, 0, 68,148,122,
34, 0,139,120, 71,127,252,131,183,215, 13,156, 45, 86, 77, 19,250,101,209,235,117, 11,239,188,247,253,110,231,169,171,151,167,
227,225,166,170,255, 66, 78,220,191, 40, 64,255,248, 87,191,254,223,255, 87,255,233,139,207,222, 96, 22,116,212,237,116,122,157,
162,244,222,121,231,136,156, 35, 76, 15, 25, 17,192,158, 87,219,140,132,197,123, 63, 26, 14, 47,238,239,237,239,239, 2,226,102,
179, 9, 33, 32, 17,145, 35, 0,203,154,229,106,125,116,122,122,120,116,196, 34,211,241,100, 52, 26,140,122, 3, 34,140,204, 25,
147,131,115,132,136,136,132,132,150,100,139,229,250,251,111,190,227,203,126, 8, 50, 91,110,230,171,181, 39, 28, 13,123,190, 40,
156, 67, 95,248,201,104,112,241,194,206,160,223,187,247,232, 72,127, 60,164,238,254,212,113,236,197,103,158,250, 63,255,151,255,
241,223,253,235, 63,163,160, 8,232,189,235,149,101, 89,122,239, 28,165,255, 33, 0, 64,142,140, 77, 20,246, 82, 84, 5, 0, 20,
193, 58,142,136,118,139,242, 96,127,111,127,119, 39,196,184,217,108,212,106, 4, 17,139, 48,115, 8,177,106,234,163,227,211, 7,
135,143, 98,148,178, 44, 38,163,225,100, 60,244, 68,145,197,219,147, 0, 34,239, 64, 84, 85, 64,245,116,190,248,254, 91,239,249,
162, 71,100,199, 54,158, 45,215,132, 48, 25,116,189,243, 68, 72,132,165, 47, 38,195,193,181,203, 23,142, 78,102,235,170,254,243,
7,232,215,254,225,127,113,253,137,107, 79, 94,187,226, 9,143, 78,206,188,119,255,229,215,255,222,255,244,223,253,215, 87, 46,
29,196,200, 4,232,156, 43,156, 47, 82,218,144, 35, 71,132, 86,221,109,168, 72,205,198, 42, 17,168, 69, 7, 84, 21, 17, 1, 4,
145, 35,139,106,183,211, 61,216,223,223,155, 78, 17,161, 14, 33,132, 64,136,142, 40,229, 29,115,213, 52, 39,167,167, 71,199, 39,
179,197, 66, 68,119,166,227,221,233,164, 44, 11, 68, 68, 4, 67,230,162, 10, 10, 15,143, 79, 94,123,251,195,178,219,107, 39,129,
16,101,185,169, 75,143,147, 97,151, 28, 2, 32, 32, 16,162,247,238,234,193,133,194,187,163,211,217,159,111,232, 67,253,232, 59,
77,136,204, 92,133,112,120, 54,155,205, 22,220,196,253,233,100,127,111,167, 91,250, 38,114,100, 86, 21, 68, 44,138,162,244,222,
59,135, 4,170, 32, 6,122, 84, 69, 68,196, 94,186,168,130,162,170, 42,138,178, 77,162, 8, 42,160,168,168,160, 8, 4,132,168,
85, 93, 29, 30, 30,223,185,119,255,108,177, 4, 0, 68, 20, 73,200,200, 57, 71,228,188,247,189,178,188,124,233,226,181, 43,151,
139,162,136,145, 87,171,213,201,124,217, 52, 13, 34,126,227, 91,127,242,141,111,191,218, 29,140, 69, 84, 68,115, 89,135,241,160,
243,194,147, 23, 15,118, 71,145,185,105,194,166,106,150,235,213,114,181,158, 47, 86,199,179,197,239,127,231,213,170,254,145,137,
4,247,143,255,243, 95, 36, 66,239, 92,233,253,238,120,120,237,224,194,181, 43, 23, 59,157,114,190, 88,204, 87, 27,239,208, 59,
135,136,162,192,145,155, 24, 34, 11, 88,166, 67,206, 29, 59, 94,246,112, 1, 44, 68, 66,136,144, 43, 19, 2,170,253, 63,101,225,
200,140,232,198,227,241,254,222,238,100, 60,138, 49,134, 24, 1,208, 17,121,231, 17, 73, 69, 16, 49,114, 60,155,205, 30, 28, 30,
198, 24,250,189, 94,127,208,159, 14,250, 68, 24, 99,252,245,223,253,102,132, 18,209, 65,198, 41, 10, 10,170,117,224, 16,227,184,
223,233, 90,222,217,184,160, 64,132,158,232,210,133,189,179,197,234, 71, 61,110,238, 31,253,202,215, 49,195, 13,123, 63,162,236,
200,141,134,131, 94,167,136, 44,136,168, 2,136, 72,206, 17,162,136,132, 40,204, 81, 1, 16,208,158,161,106, 62, 93, 0, 32,170,
132, 0,160,162,168, 10, 22,169,246,219,171, 42,128,136,196, 16, 85,180, 44,203,233,100, 50, 26, 14,156,163, 24,153, 69,156, 53,
44, 4,102, 97,225, 58,132,147,179,217,225,209, 73, 85, 53,174,240, 23,118,119,231,203,213,111,252,147,111,117,186, 35, 5,177,
16,164,111,141, 8, 10,117, 19, 17, 97, 58,234, 23,158, 0, 65, 85, 81,237,147, 74, 72,211,209,128,153,103,139,213,143, 18,160,
95,253, 58, 2, 40, 32, 40, 16, 18, 37,150, 8, 69,212, 57, 87, 22, 69, 89,248,162,240, 10,200,145, 53, 63, 22, 80, 96,102, 11,
138,170, 68, 81,102, 86,145, 92, 19, 16, 64, 17, 84, 9, 1,183,121,148, 2,164, 96,167, 81, 88, 89,152, 69,200,185, 94,183, 59,
25,141, 60,185,170,174, 68,132,136,114,121, 18,142,177, 9, 97, 54,155, 61, 60, 58, 90, 46, 87,223,252,147,239, 31, 45,106, 69,
159,242, 21, 83,169, 64, 64, 4, 16,149, 38, 72,191,231,199,253,126,226,165, 64, 21, 64, 24, 0,212, 17,142, 6, 61, 66, 60,153,
45,254,204, 71,236, 87,190,174,130,144,135, 3,201,111,144,136, 88, 4, 17, 16, 81, 21,188,195,162,112, 32, 18, 36,218,160,160,
104, 71,199, 90,151, 48, 75, 84, 54,244, 12,170, 8,104,121,100,245, 90, 45, 76,185, 78, 10,231, 83,169, 54,237, 91, 41,131,110,
167, 59, 29,143, 17,145, 99, 20, 21, 0,116,206, 57,231,197,176, 67,228, 15, 62,185,253,221, 55,222,163, 98,160, 10, 10, 98, 49,
71,235, 25,168,136, 0, 64, 10,136,174, 24,247,138,110,199,111, 19, 95, 5, 80,173, 41,247,186, 69,100,158, 45,254, 76, 40,201,
171,164,145, 21, 17, 65, 21, 53,189,103, 5, 1, 85, 64, 4, 0, 81, 81, 81, 34,232,148,157, 78,217,169, 67, 88,173,214, 85, 85,
7, 23, 74,239,189, 47, 12,166, 32,163,168,130,168,160, 58,114, 4,132,136,160,160,136,160,106, 72, 32, 85, 5,220, 6, 75,211,
59, 68, 34,136,172, 10, 56,158, 76,167,147, 73, 93,215,203,213,106,190, 92,104,132, 78,167,195, 28, 79, 78,103,111,127,120, 7,
253, 0, 0, 9, 65,137, 4, 0, 65, 64,132, 0, 21, 64, 64, 17,129, 57, 10,116,119, 46, 92,190,121,101,119, 60, 24,140,199,163,
77, 85,253,246, 55,255,240,222,195,135,221, 78,135, 89, 68,251, 79, 63,113, 89, 68,239, 60, 56,250,151,103,208, 63,252,229,175,
35, 42,171, 88,111, 20, 20, 64, 0,123, 71,160,136, 8,136,204, 18, 57,178,218, 35,130,210,251,110,167,116,206,213,117, 8, 28,
153, 25,144,108, 60,179, 20, 68, 36, 1, 5, 67,122, 68,233,123,105,142,142,164,118,151, 32, 66,250, 64, 82, 14,131,138,104, 20,
1,128,110,183,187, 55,157,122,143,171,213,230,248,116,254,198,251,159,172, 2, 81,209, 71, 32, 53,174,230, 49, 12,135,136,136,
138,136, 80,215,245, 19, 79, 60,245,181,207, 62,255,252,211, 79,142,135,131, 65,183,123,229,226,193,157, 7, 15, 23,203, 37, 33,
8, 40, 42,244,123, 37, 0,252, 75,243,200,253,163, 95,249, 5, 80,112, 68,169, 25,229, 39,110, 96,198,248,101, 3,124, 4,168,
138, 77,140,222,185, 16,195,173,247,223,186,117,235,221,201,100,119, 83, 55, 77, 19, 12, 79,251,194, 39,248, 75,132, 72,138, 96,
236, 7,110,115,242,241,246,151,161,148,228,194,148,195,136,170, 26, 88, 86,235,245,253,135, 15, 23,155,230, 7,239,126,188,137,
206,151, 67,109,171, 28,218,247, 86, 64, 68, 36,235,150, 96, 79, 52, 70,162,226,230,245, 43,251, 59, 35, 66,138, 49,246,187,221,
213,122, 29, 35,175, 18, 82, 85, 80, 44,189, 99,150,197,186,250, 23,102,208, 47,253, 98, 10,141, 42, 40,160, 34, 42,168,181,132,
116,184,149, 69, 85,149,144,236, 51,143, 30,220,249,157,223,249,141,223,255,131,127,250,250, 59,239,124,239,141,183, 30, 29, 29,
158,204,102, 49, 74,183,215, 85,171,244,132,169, 58,180,228, 28,128, 64, 30, 69, 19, 21,171,118,236, 84, 18,148,201, 88, 1,236,
3,102, 94,173,215, 15,142, 78,222,189,253,232,253, 59,199, 88, 12,193,119, 53,149,101,235, 76,154, 19, 7,242, 56, 96,179, 15,
32,185,200,124, 97,239,194,147,151,118, 59,133, 51,114, 10, 17, 15, 79,142, 39,195, 97, 19,226,122,179,177,147,221, 41,125, 19,
194,186,106,254,185, 1,250, 7,191,244,139,144,169, 51, 67, 43,219,188, 85,171,208,202, 34, 8, 64,132,170,240,222, 59,175,255,
95,191,254,191,223,190,123,103,190,137,117,132, 16,195,201,201,201,189,123,247, 94,121,245, 7,155,170,222,155,238,218,240, 14,
128, 41, 49, 0, 16, 49, 1, 36, 27, 70,164,205,155,116,214, 64, 64, 64, 85, 84, 84, 67,140,155, 77,117,124, 58,191,251,224,240,
131, 59, 15, 62,186,127, 54,223,168,186,142, 0,165, 18,150,184,208,156, 47, 96, 49, 1, 66, 11, 89,250, 19,102, 30, 12, 39, 55,
175,237, 79, 70,125, 80,136,204,206,209,221,251, 15, 68,101, 50,234,139,192,114,181, 68, 84,102,233,150,197,186,170,235, 38,254,
243,142,216, 47,146, 29,102,205, 71,218, 78, 68,234,232,168,168, 42,106,104,230,173,183, 95,253,141,223,248, 63, 22,171,205,217,
38,134,104,233, 5,145, 35,115,172,155,205, 27,111,189,245,224,240,112, 58, 25,151,101,199,158,171,136, 72,238,249,169,176,137,
138,170,128,178,176,209,105, 54,139,173,214,155,179,249,226,225,209,201,237,251,135, 31,220,126,120,235,222,209,189,227,213,108,
45, 81,157,228,142,158,128, 58,100,228,131,104, 51, 15, 34, 34, 80,122,197,246, 15,130,136, 32,186,167,175, 95,189,180, 59, 34,
162, 24,153, 16, 31, 29,159,204, 23, 11, 64, 24, 15,135, 72,116,114, 58, 35, 68, 22,233,117,203,249,114, 29,255, 52, 69,192,163,
162,216, 19, 4,104,219, 22,166, 15, 17, 64,129,129, 28, 34,224,107,175,126,231, 55,127,235,215,231,235,106, 89, 9,171, 2,160,
67, 66,194,200, 12, 0,157,162, 51, 30,234,155,111,191,246,232,232,225,207,124,237,175,124,249, 11, 95,212, 94, 79, 85,137, 80,
156, 71, 66,102,174,234,176,169,170,170,110,154, 38,212, 77,168,154, 80,213,205,166,110, 54, 85,179,174,194,166, 14, 85, 19,155,
168, 81,144,161, 16, 42, 20, 20, 68, 16, 69,137,128, 21, 9, 81, 72, 81, 17, 41,209, 75, 10, 68,168, 32,130,130, 72, 32,224, 64,
144,196,224,237,108,177,184,123, 56,251,204,141, 75,221,110,137,136,206,185,241,104,120,231,129,101,159, 94,187,120,224, 29,189,
243,193,199, 77,136,145,195,213,131,157, 91,119,143,254,217,121,205, 91,134,219,121, 86,177, 49, 43, 33,107,205, 40,149,128,222,
125,247,181,223,249,221,223,156,175,235, 69,165, 34,138,136,228, 8,145, 16,212, 38, 53, 68,236,117,251,136,184,152,159,125,235,
79,190, 85,150,238,211,207,191,216,233,244, 68,117,185, 62, 59,157, 45,207,150,171,229,186,217,212, 49,176, 6, 22,102,136, 34,
42,192,150, 83,130,162, 5,171, 87, 50, 81,156, 65, 88, 80, 21, 9,193,224, 24,161, 42,162, 32, 17,169,168,245, 71, 0, 16, 5,
68, 2, 4, 82, 1, 84, 1, 4, 32, 82, 6, 93,173,151, 15, 79, 22,139, 77,211,237,150,142,136,153,119, 38,227, 68, 49, 33,176,
240,238,100,252,252,205, 39, 95,127,231,195, 16,155,241,160,119,121,111,124,247,104,246,207, 4, 72,117, 59, 37,144, 10, 32,106,
130, 38, 22, 53,116,238,238,157,143,190,241, 79,126,251,116,190,152,109,216,162,131, 8, 42,194,194,228,200,123,175, 98, 24, 27,
250,189, 62, 2,108,214,171, 87,223,120,141, 89,118,247, 14, 78, 23,155,227, 89, 85, 51, 50, 56, 1,175, 90, 88, 30, 39, 60,141,
162,100, 69, 73, 0, 5, 84,129, 5,208, 42, 19, 90, 63, 69, 80,131,171,152,187,148, 69, 68, 82, 15, 17, 16, 1, 36, 18, 1, 66,
1, 2, 1, 4, 38, 4,142,124,124,182, 60, 91, 86,123,211,129,247,174, 9, 97,103, 50,113,206,133, 16,140,132, 67,196, 97,191,
251,185, 79, 63,253, 71,223,123,189, 14,113,111, 50,156,175,171,197,250,177, 97,141,196, 90,170, 0, 38,188,168,153,202, 0, 69,
112,228,142, 15,239,255,246,111,253,250,221, 7, 15,102,107, 22, 27, 54, 82, 43, 6, 52, 38,203,200, 44, 66, 36,116,206,247,122,
3,239,203,135,143, 78,222,249,240,246, 91,183, 30,220, 61,174,215,220,139, 52, 84, 26,130,235, 40, 21, 72, 78,193, 41, 32, 0,
129,149,222,196,181, 98,254,225,248,152, 60,149,123, 84,170,201, 96,188, 36,145, 1, 31,227, 51, 17,173,121,230,151,100, 51,142,
156,206, 23,199,243,141,205, 46,136, 56,232,247,247,119,118, 34,139,170,138, 48, 17, 25,193,245,153,231,158,222, 25,143,201,193,
165,189, 81,233,233,113,131, 7,218,147,178,246, 10, 54, 57,128, 2,145, 18,210, 98, 53,251,221,111,252,230,199,119,110, 47, 42,
97,201,120, 15, 1,200,130,226,136,200, 57,135, 8, 72,142,136, 68,121,179,169,231,171, 64,229,180, 59,249, 20, 23, 83,245, 35,
112, 93, 64,159,200,181, 68,240,181, 40, 72,218, 97, 83,236,243,162, 86,211, 13,221, 67, 26, 35,172,232, 3, 2, 18, 32, 26,150,
160, 54, 26, 54, 68,218,169, 67, 36, 50, 16,143,132,243,249,252,209,201,178, 9,146,120, 91,196, 27,215,159, 16,137, 34,169,232,
18, 82, 81,184,178,244,207, 92,191, 54, 26, 14, 75,239,119, 70,253,199, 2,148, 49, 33,138,162, 72, 26,203, 5, 84, 20,153,229,
123,223,253,163,247, 63,252, 96,182,225, 38,170,136, 1, 61,123, 31,144,232, 46,251,152,188,170, 10,235,201,233,106,213,224,149,
167, 94,124,250,165,159, 40, 6,123, 64, 29,116, 30, 0,182, 19,125,251, 68, 0,108, 56,202, 29, 95,114,159,202,236, 69, 27, 25,
72, 37, 40,145, 96,246,108, 16, 16, 93,138, 17, 16,218,168, 66,214,210,210, 41, 36,164,229,106,113,182, 14,243,213,198,178, 6,
16,246,119,119,203,162,100, 97,251,177,228, 8, 1, 10,231, 58,101,241,252,205,235,101, 89, 78, 6,157,110,185,101,162, 73, 5,
243,120,169,138, 96,152, 13, 81, 29,209,131,251,119, 94,249,222,119,102,171,170, 10,146, 30,188,253,120,178, 17, 34,209,181,162,
138, 8, 49,198,227,211,121,209,155,188,248,217,159,186,246,212,103, 92,103,128,232, 0, 16, 68,129, 82, 76, 53, 5, 55, 13, 97,
154,138, 29,182, 4, 0,160, 98, 14, 25,180,163, 90, 14, 48, 16, 81,154, 73, 91,134,198,114,200,190, 77, 26,233, 18, 96, 65, 4,
36, 85, 57, 91, 86,103,203,106, 83,109, 66, 12, 10, 64, 8,189,110, 23, 84, 89, 88, 84,237, 75,139,194, 59, 79,157,162,120,225,
230,245, 78,183,115,176, 51, 56, 39,141, 33, 96, 70,247,249,177, 42, 40, 53,161,249,214, 31,126,227,232,228,116, 85,177, 61, 88,
103, 47,133,128,192,164,118,200,209,193,166, 14,103,139,245, 96,122,241,233, 23,190,212, 29,236, 8,230,153,194, 10,172,102,106,
84,209, 10,112, 62,104,231, 70, 48, 1, 61,231,171,104, 99, 9, 9,186, 42, 25,242, 68, 74, 99,139, 53, 19, 76,104,150, 0, 24,
17,136, 64, 4,128, 0, 25, 21,136, 32,132,250,116,190,120,112,124, 54,238,193,199,119,238,188,254,198,155,235,170,218,153,238,
150,101,167,170,107,145, 8,228, 16,144, 8, 11,239,188,119,189,110,241,228,213, 75,111,190,255,225,238,176,115,178,172, 83, 23,
203, 61, 69,236,172, 41,128, 3,122,231,173,239,189,253,222, 59,235, 70, 76,195, 68, 74,133, 16,115,102, 3,128,138, 16, 98, 8,
97,190,170,250,227,131,231, 62,253,149,162, 55, 81, 36, 4, 32, 84,117,100,143,168,213, 21,176, 29, 47,242, 56,140,128,134,162,
21,100, 11,145, 21, 53,227,202,156,110,152, 38,103,181, 79,167,176,137,161, 53,235,172, 9, 94, 43, 18,102,214, 6, 84,228,244,
228,240,149, 31,156,125,251,247,238,220,250,228,147,186,105, 16,113,119,103,122,227,198,211, 69,225, 66, 35,145,163, 35, 23, 57,
58,242,142,160,240,126, 50, 26, 60,113,229, 82, 8,119, 23, 85, 19,162,146, 81,202,170, 10,138,204, 42, 34, 8, 48,159, 29,127,
231,187,223,174,234,176,174, 35,171,154,104,151, 11,159,133, 7, 65, 0, 0, 69,120,179,105, 38,187, 23,159,255,204, 87,202,193,
14, 32, 97,126,234, 9, 63,232,214, 44,145,206,151, 90, 45, 78, 84,127,166,137,180,157,114,236, 11, 19,243, 14,231, 40,183,182,
106, 19,110, 11, 26,108,203, 78, 26,204,206,215, 60,132,179,211,135, 77, 61,103,137,227,241,168, 40, 60,128, 30,159,156,190,247,
222,187, 32,210,233,116, 16,144,133,173, 24, 19,146, 47, 60, 33,236, 78, 70, 87, 46,236, 14,187, 37, 0, 16, 11, 88,241,117,142,
76,204, 9,129,223,126,231,245, 7, 15, 31, 44,106,177, 49,213, 89,197, 3, 32, 68,231,236,152,171,253,190, 90, 87, 69,111,114,
227,217,207,119,250, 83,176, 46,123,174, 61,195,246,253,106, 30, 51,108,114,149, 31, 98, 59,172, 8,230, 65, 43, 59, 79,172,222,
65, 59,151,230,225, 52, 75,102, 89,148, 75,177,200, 31,183, 51, 7, 0,128,196, 64, 0, 23,246,247,171,122,227,189,183,220, 63,
155,205,222,122,251, 45,142, 77,175,215, 67, 36,208,164, 77,122, 34,239,136,136, 38,147,225,213,139, 83, 71, 72,153,171,227, 24,
25,146,152, 55,123,247,157, 55, 23,171,122, 83,179,149, 24,218, 2,142,246,116, 41,168,174, 55,155,168,197,213, 39, 95,232, 12,
246,144, 60, 42,130,149,193,148, 65,210,118, 37, 61, 31, 39,115, 85,101,181, 72, 68, 64,243, 63,170, 91, 60,152,248, 0, 36,200,
47,193, 10, 78,206, 20, 74,163, 88, 74,151, 54, 78,143,177, 68, 10,136, 16, 66, 64, 87, 76, 70,163,205,122, 9, 32,246,101,171,
245,250,181, 55,222,168, 54,235, 78, 89, 58, 71,128, 88,118, 74, 66,240,206,121,194,194,185, 75,251,211,189,201,128, 68, 88, 85,
140,132,110, 66, 0,132,143, 62,124,239,254,131,251,139, 42,170, 10, 32, 58,139, 13,128,115,206, 25,103,157, 11,243,170,138,151,
175,221,188,112,233, 41, 36,223,102, 76,139, 4,242, 75,180,122, 43,128, 2, 91, 38, 46, 27,245,180, 21, 28, 33,171, 94, 54, 40,
111, 99,164, 91,105, 51,255,249, 54, 85, 8,206,253, 9,230, 67,217,178,226,144, 80,129, 46, 87,155,203,151,175, 93,189,114,181,
174,106, 81,182,191,221, 52,245, 91,239,188,181, 92,206,187,221,174, 61,254,162, 44,157,119, 68,228, 29,129,226,205,107,123,148,
135, 82, 8, 49, 40,226,114,181,124,255,189, 55, 79, 23,171, 16,197,140,194,228, 8, 17, 28,145, 35, 66, 75, 18, 85, 85,157,175,
235,201,238,149,235, 55, 63, 67,190, 67,153,126,222,106, 35,144,186, 49, 32, 42, 40,182, 52,143, 49,134, 40,106,172, 62, 40,160,
90,182,165,225,194,206, 26, 88, 37,126,252, 36,217, 55, 76,228, 3,225, 99,132, 71, 27, 83,204,173, 47,149, 63, 34, 35,238,181,
110,194,165,203, 87, 94,120,254,185,170,174, 57, 70, 80, 97,142,139,229,226,141, 55,223,184,127,255, 30,106,162,206, 13,153,123,
231,136,192,123, 67,151, 68, 65, 25, 16, 8,240,147,143,222,189,123,255, 94, 21, 68,218,218,156, 74,143, 81,167, 42,160, 72,184,
88,109,168,232,223,120,238,101,215, 29,166, 44,223, 82, 15, 70,125,146,230,198,101,129,201,186,177, 40,136,242, 86,144, 77,111,
3, 83, 85, 23, 52, 54, 17, 21, 91,247,139,106,134, 60,233, 41, 24, 32,180, 63, 49,204,152, 19, 24,183,124, 49, 24, 14,232,120,
34, 66,211, 55,235, 42, 76,199,187,159,123,233, 37, 5,105,154, 42,114,108, 98, 88,174, 22, 31,220,122,255,193,195,251,161,169,
69, 4, 53,149, 90,231, 28, 1,146,130,134, 24, 81, 1, 17,103,243,179,219,183, 63, 58,157,205,155, 8,162,169, 95, 16,128, 79,
199, 61,113, 45,155,170, 94,172,195,229, 79, 61, 51,154, 94, 74, 13, 85,206, 29, 42, 4,123,159,208,146,100,118,156, 12,167,139,
182,230,168, 45,107,159,186,214, 22, 25,106,202,132,124,220, 0, 64,145,218,115,148, 19, 42,231,145,185,107,218, 47,215, 86,129,
43, 28,141,122,142,208,100, 38, 21,213,117, 85,119,123,195,231,158,121,166,219,233,198, 24, 29, 0,139,172, 55,155,187,247,239,
158,156, 28, 54,205,198,202,158,185, 73,144,144, 68, 1, 8,152,185, 14,225,225,195,187,247,239,223, 91, 53, 34, 34,154,136, 40,
176,137, 46,177,130,128,194,114,114,182, 30, 78, 15, 46, 63,241, 28,144,183, 34, 35,231,102,204,115,125, 41,199, 67,212,212,197,
196,182,110, 57, 23,221,150,239, 68, 45,131, 97,115, 72,180,180,133,202, 10, 77,150,120,182,236, 94,155, 81,127,138,162,174,170,
128, 56,234, 22,147,190, 7, 5, 81,105, 31, 78,221, 52,131,222,240,169, 39,175,239, 76,198,166, 42,199, 24, 23,203,229,221,251,
15,142,143,143, 29, 1, 2, 58, 66,231,200, 33,250,200,204,204, 10,202, 49, 62,186,127,247,248,228,180, 9,233, 29, 16,168, 67,
114,137,221, 72, 63,114,185,170, 3,184,235, 55, 62, 93,118, 71,204, 2, 96,102,141,220,162, 50,182,177,174,174,208,198, 70, 90,
193, 48, 71, 49, 79,118,144, 38, 84,216, 10, 21, 63,252,150, 17, 77,219, 7,204,198,243, 45,173,215, 14, 34, 8, 38,181,230, 7,
132,221, 14, 29, 76,138,194, 17, 11,139, 50,108,231, 23,168, 26, 25, 12, 70, 87, 46, 95, 22,145,147,179, 51, 80, 97,209,245,102,
85, 55, 53,130,150,157, 30,128, 85, 34, 36,243,153,170,232,106,181,120,240,224,238,124, 93,219, 3, 37, 85, 27,153,157, 51,201,
9, 0,129,163,156, 45, 55, 7, 87,110, 78, 15,158,136, 44, 34,202, 54,200,137,136,114,238,219,233, 48,217, 99,147, 86, 78,133,
45,239,164, 45, 25,151, 16, 16,180,172, 56,180,157, 27,243, 95,196, 76,205, 3, 2, 40,181,125, 92,173,139,164, 26,165, 0,128,
98, 18,177,130,150,142, 46, 78,186,227,126,161, 41,119, 44,147,173, 28,138,136,108,170,166,215, 27, 28, 92, 60, 48,235,132, 57,
71,155,208,220,127,244,104,181, 90, 58, 76,250, 21,153,227, 18,144,238,223,253,228,228,244,100,211, 8,156, 47,204,212, 22, 61,
69,192,179,229, 26,252,224,218, 83, 47, 40,146,228,159,165,156,206, 15, 75,155, 44,108,137,147, 95,151,108, 43, 67,254, 23,158,
3,216,208,146,201,122,142, 16,210,164,202, 65,102,207, 18,174,209,243, 98,137,180, 85, 39,155, 37, 68, 85, 61,193,254,164,220,
159,116, 8,204,133, 34, 54, 49,137,176,136,249,105, 69, 68,154, 16,135,253,225,179, 55,111,118,202, 78,182,240,104, 8,225,225,
225,163,249, 98, 1, 18, 8,109,246, 35,136,161, 62,122,112,123, 85, 5, 77, 16, 30,208, 33,102, 25,197,134,167,117, 21,142,103,
155,253, 75,215,203,254, 36,154,143, 87, 88,148, 89,133,133,217,204, 82, 49,114, 50, 51,216,107, 74, 98, 23,106,139,143,255, 84,
211, 63, 0, 8,228,214,127, 78,220, 85, 80, 65, 64, 76,250,175,158,195,232,249, 27,166,239,189, 85,221, 8, 97,103,212,185,188,
211, 43, 29, 90,233, 17,102, 17,142,230,124, 99, 97, 17, 78,175,152,235, 58,118,187,253,103,159,185, 57,232,247, 9, 49,187,121,
100, 54,159,113, 12,189, 14,145, 67, 71, 68, 71,143, 30,156, 45, 22,155,134,205, 33,133, 68,118,190,146, 89, 30, 80, 85, 79,102,
75,245,189,253,203, 55, 84,192,126,100, 50, 32,112,122, 34, 42, 44,233, 92, 73,155, 63,146,243, 63, 77,168,143,161, 72, 61,247,
111,204,191,101, 63, 70, 43,252,139,158,155, 90,245,220, 25,109, 37,114, 67,230, 2, 42, 8,186, 51, 44,174,237, 14,122,165, 75,
73,156, 82, 72,149, 37, 55,208, 54,251, 69, 65,234, 16,189, 47,175, 93,185, 82,148,133, 21, 52,123, 3,171,205, 38, 52, 53,173,
215,107, 66,124,244,232,193, 39,247, 30,174,234, 16, 35, 3,180,240, 62, 81,128,136, 80,213,113,190,110,118, 15, 62,213, 31,237,
112,202, 84,145,200, 34, 81,211, 83,145,200,194,194,105,250, 21,205,239, 44, 87,210, 54, 3,126, 40, 68,104,178,129, 34,230,118,
118,254,244,181, 26, 90, 30,199,180, 21,128, 65, 19,181,151,148, 89, 17,145,241,176,247,196,197,201,120,216, 69, 34, 48, 79,186,
136,136,176, 50,171,178, 50,107, 84, 21, 81,182,210,100,131, 78,100,118, 69,121,229,210,165,178,240,109,150,199, 24,151,235,141,
171,170,249, 27,239,188,247,234,155,111, 30,157,205,153, 53,187,235,208, 81,242,199,217,139, 62, 91,172,151, 1,158,121,225,203,
157,238, 32,137,161, 34, 2, 57, 87,204,154,170,201, 44,148,251,217, 99,188,114,219,228, 17,160,253,164, 10,180,189,199,254, 14,
226, 57, 0,144,254, 76, 16,219,113, 85,179, 43, 42,185,213, 69,185,197, 90, 59,211,233,151, 95,122,230, 11, 47,222,232,117, 59,
243,197,122,211, 52, 77, 29,146,165,180, 69, 97,230,161,148,172,116,131, 40, 40,139,198,192,162,226,157,159, 47, 87,185,105,171,
2,248,143, 62,186,245,250, 91,111,151,158, 58,101, 57,238,119,198,195,158,115, 70,232,144, 34,130, 10, 0,178,200, 98, 93,239,
29, 60, 49, 28,237, 49, 51,104,130,112,105, 40, 79,125, 74,218, 78,189, 69, 35,109,254,180,188,252,182, 88,107,219,119, 53, 55,
184, 52,199,164,218,171,173,225,209,136,159,115, 25,245, 67,230, 72, 70,160,103,110, 62,247,179, 63,241,185, 23,159, 24, 21, 78,
99,228,221,157,157,111,252,254,183,231,235,181, 71,195, 6,231,127, 4,234,150, 32,215,212, 90, 16, 68,128,156,247, 69, 55,134,
141,167, 20, 67,119,243,218,133,178,240,206, 57, 81,219, 4,208,174,243,100,253, 43,179,172,213, 38, 44, 42,121,242,185, 47,116,
186, 3, 59,216,121,176,218, 30,105,248,161, 42, 1,184,237,197,150, 54,169,149,107,219,229,181, 13, 43,232,185,221, 26, 60, 55,
195,234,227, 4,108, 59,224,178,213, 29, 91,239,240,190,120,249,229, 47,252,244,151, 62,243,242,205, 93, 2,102, 17, 79,238, 96,
111,103,103, 58,125,229,181, 55,207,230,115,181,249, 14, 19, 74,205,179,158, 81, 81,162,106, 37, 53,181, 26, 80, 88,174, 27, 36,
112,164, 0,224,110, 94,187,128,105,190,113, 10, 26, 3, 40,112,225, 8, 50, 65, 6, 0,243,229,166, 51,218,187,112,229,102,130,
168, 34,208,186, 55,173,103,229, 14,159, 94,128,149, 31,132,140, 74,210,251,222, 10, 70,143,141,250, 45, 66,122,220,247,145,186,
126,251, 5,250,195,104, 84, 69, 65,119,119,246,191,242,229,175,252,228, 75, 55, 94,120, 98,236,137, 61,145, 3,231,157,115,142,
46, 31,236,221,188,254,196, 31,127,239,213,163,211, 83, 97,241,142,172,244, 43, 0,110,171,117, 66,252,204,202,137,167, 22, 81,
174, 54,209, 17, 16,161,187,118, 48, 53,193, 0, 49, 53,144,192,162, 34, 14, 83, 27,139, 33,174,170,184,123,233, 70,111,184,155,
72, 47,200,137, 41, 86,119,210,252,189, 53,196,101,207,133,197, 4, 91, 35, 92,203,108,108, 81,245,150,157,182,118,221, 82,214,
104,159,183,211,161, 91,130,205,190,148, 37,146,163,167,111, 62,243,179, 95,251,210, 87, 95,184,122,237, 66,215,161, 24,215,208,
50,179,160,184, 55,157,124,234,242,165,219,247,238,223,123,240,176,105, 66,225, 61, 57,196,109, 43,205, 22, 55,211,201, 68, 36,
74,148,168, 10, 49, 4,102, 44, 28,120,116,190, 9,145, 80,188, 39,163,212, 89, 96,190, 86, 17,157, 18, 34, 64, 19,162,146, 31,
141,247, 84, 20,128,211, 97, 70,176, 9, 3,178, 55, 35,243, 51,106, 40, 10,204,190,169, 91,151,138,129, 57,220,106, 26,153,156,
199,124,154, 32,255, 46,134,189,116, 11,193, 83, 97,106, 31, 77,220,223,221,255,234, 23, 62,251,185,231,174, 95,154,118, 29, 70,
51,245, 37, 71,177, 17, 23,154,252,109,215,174, 92,190,121,253,202,209,209,163,217,124,121,124,122,182,183, 51,237, 20,222,200,
218,182,155,180,182, 8,160, 52,129,250,210,111,214,117,100,244, 23, 47,236,110,214,155,117, 85,109,170,198, 17, 16, 57, 17,102,
66,168, 21,136,118,134, 20, 34,247,250, 83, 87,116, 68,248,156,146,177,109, 38,237,243, 64, 36, 16, 52,239, 37, 2,129,181,159,
92, 94,209,242,179,141, 4,110, 53,111,205,154, 88, 22,198, 18, 63,155,198,180,115,135, 1, 17,134,131,222, 75,207, 63,247,181,
207,191,240,228,149,105,137,218,212,213,150,181, 4,101,102,211, 88,205,201, 93, 55,245, 59, 31,188,127,114,122,178,183, 51,142,
33,108,234,230,228,236,108,111, 58, 41,202, 2, 77,224, 63,103,225,202,112,196,100, 18,244, 30,234,168,126,111, 58,137,195, 97,
136,177,170, 67, 85,215, 33,132,186,169, 99,100, 22, 88, 85,193, 19, 21,222,239,236, 95,142, 12,201,118,171,186,173, 13,233,205,
97, 70,183, 2, 64,170, 2, 64, 0, 2,232, 18, 99,145,109, 52,217,149,219,170,143,146, 42, 64,130, 76,219,153, 36,157,182, 92,
201,153, 89, 85,166,227,241,115, 55,159,250,202,103,159,191,113,237, 66,191, 68, 14,161,137,161,237, 3, 22, 90,231,140, 1,165,
245,102,115,235,147,143,127,240,198,235, 31,124,116, 75, 84, 71,131, 97,220,229, 71,135, 71, 77,148,163,211,179,157,201,184,219,
241,231,220,239, 89, 95,104,203, 1,161,115,142, 37,250,201,104,104,242,164, 2,196,200, 85, 19, 86,155,106,179,217, 84,213,198,
182,184,202, 78,191,211, 29,137,176,125,117, 58, 13,231,138, 74, 82,102, 17,173, 46,171, 38,119, 90,170,215,152,181,177, 45,175,
209,110, 49,164,179,149, 89,145, 54, 60,210, 54, 97, 27, 89, 70,163,225,231, 94,120,254,243, 47,222,120,242,202,126,191, 67,220,
84, 77,197,230,235,104,201, 19,123, 23, 70, 31,190,253,193,251,255,244, 15,254,224,228,236, 84, 84,201,249,166,106,152,155,126,
191, 55, 26, 15,103,243,133,178,158,158,158, 77, 39,163,178, 83,166, 12, 18,209,196,125, 66,162,105, 1,136,200, 59,240,189,110,
199, 57, 95,250,194, 57, 2, 34, 21,169, 3,111,170, 42, 52,141,115, 84,173, 22,141,150, 12,148,156,226,153,248,200, 50, 84,110,
191, 8, 10, 98, 49, 50, 35, 88, 98,182, 84, 53, 57,105, 52, 89,140,207,131,152,243, 92, 90, 42,206,169,206,216,134, 1, 17,237,
142,198, 47, 60,247,244, 87, 62,243,252,245, 75,147,110, 65, 28,234,102, 19,146,200,137,100,101, 77,179, 19,174,110,234,135, 71,
135,223,249,254,247,223,253,240, 3, 68,138, 44, 57,133, 85, 20, 28, 97,191,223, 19,142,203,213, 58, 4, 57, 60, 57,155,140, 70,
189,110,153, 43,169, 36,101,101,219,102,136,200,123,239,124, 81, 20,101, 89,122,239,189,115, 68,168, 2,145,135,129, 99,225, 60,
208,149, 59, 15,231,203,192,232, 57, 65, 27,139,120,203,224, 65,106,126,152,172, 25,106,123, 97,170, 0,192, 86,185,165,181, 21,
38,240, 43,217,182, 96, 15,143, 85, 36,103,146,253,226,126,127,112,245,210,193,179, 79,125,234,165,231,158,186,186, 63, 46, 29,
112,108,234, 77,180,124,105, 55,148,236, 95, 68,168,170, 31,221,190,253,221, 87,127,240,209,237,219, 77,104, 0, 72, 53,198,200,
42,172, 0,102,130, 12, 77, 84,133,178,211, 25, 33, 45,151,203,186,110,206,102,179, 38,244, 6,189,142, 35, 58,223, 80, 91, 27,
155,115,206,147,115,222, 57,135,228,189,243,206,118, 85,200,164, 34,239,105,185,105, 66, 76,104,122,235,164, 3, 0,101,104,137,
180,246, 37, 39, 1,192,170, 95, 18, 25,182, 88, 89,183,240, 79,179, 81, 51,129,255, 84, 67, 4, 65, 15, 46,236,189,248,244,141,
231,111, 94,251,212,197,221,241,168, 71,192, 92,215, 77,224, 31, 10, 77,171, 74, 34,226,124,185,252,254,235,175,191,250,198, 91,
179,229, 92, 68, 89,162,216, 80, 8,140,130,198, 80,165,164, 20, 16,129,210,187,209,104, 4,184,168,170,122,185, 90,133,166, 25,
12,250,222,187,180,202,133,217,183,143, 2,136,190,244,190, 40,138,162, 40,188, 43,188, 39,239,189, 39,219, 72,117,206,185,158,
151, 72,166, 0, 0, 16,165, 73, 68, 65, 84,213, 38, 68, 85, 17, 32,180,113,241,220,242, 28,170,249,166,140,207, 18, 85, 52,127,
154,149,106,155,119,240,156, 7, 97,187, 77,150,200, 34,201,151, 15,148,158,134,253,254,213, 75,123, 95,252,244,243, 55,158,184,
60, 25,117,137, 72, 56,114,181,110,132, 91,185, 71,219,202, 37, 10, 0,204,188,174,214, 31,220,250,248,143,190,255,202,201,233,
220,134,229,200, 44,108,251,174,166,165,107, 59,234, 8, 72,238,171, 84,120, 26, 13,134,136,180, 92, 46,171,166,142,204,131, 65,
183,116,222,176, 4, 38,211, 62, 34,160,159, 76,166,133,109,131, 57,231, 8, 41,101,147,119,142, 20, 40,176, 4,123, 8, 40, 9,
6,106,134,163, 98,246, 9,200,200,140, 82,109,202,114,130,154, 89, 3,207, 19,101, 70,209, 26, 10,103, 2,217,157, 12,111, 92,
187,244,220,141,107, 79, 92, 61, 56,184,176, 79, 30, 32,114,108,234, 24, 66, 46,156,233, 88, 99,162,111, 69, 84,154,166, 57, 58,
57,190,117,251,206,237,123,247,110,223,189,107, 43,251, 45,213,147, 64, 77,122, 90,168, 32,182, 11, 41, 0, 42,140, 42,138,137,
234,239,245,122,132, 48,155,175, 66,140,203,197,186,219, 45,189,247, 89,220, 4, 82, 66, 82, 63,157,238, 56, 34,114, 73, 69, 49,
10,209,116, 76, 22, 89, 87,117,140,162, 36, 40, 64,136, 98, 2, 79, 59, 75,129,152, 21, 14, 21, 8, 84, 17, 69,149,160, 45,220,
231,135,213,116, 22, 69, 68, 69,202,194, 93,189,122,241, 43,159,121,246,153,235, 23,167,147,161,239,148,168,194, 77, 21,214,193,
22, 55,178,119, 21, 84, 85,152, 99,228,192,177,137,113,185, 92,221,121,112,255,214, 71, 31, 61, 60, 62,218, 84, 85,228, 24,109,
95,154,163,173,197, 38, 14, 13, 16,148,179,113, 55,137, 6,168,102, 27, 20, 4, 16, 84, 17, 64,229,178, 83, 14, 6, 50,155, 45,
213,137, 86,224, 92,116,158,146, 88,137, 0,138,190, 44, 10,115,250,180,171, 39,136,102, 52, 65,102,222,212,129, 85, 65,192,172,
166,164, 98, 62, 74,204, 99,118,234, 34,132,121, 32, 5, 54,241, 89, 64,208, 12,153,201, 35,170,170,206,209,116, 60,186,241,196,
213, 47,190,116,243,230,213,253,110,215, 1,162,196, 24,151,115,137, 81,183,251, 4,160, 2, 81,184, 9, 77, 85, 55,155,170, 90,
111,214,143, 14, 15, 63,190,115,247,209,241,225,114,181, 50, 50,211,102,192, 40,204, 49,166, 81, 16,196,214,104,210,189, 36, 72,
12, 2, 2, 34, 10, 32,137, 25, 22, 64,100, 2, 66,132, 40,132, 32,221,110,209, 52,101,211,132, 24,131,170, 99,110,117, 1, 4,
167, 62,109,159,152,235, 11, 19,242,135,220,106, 91,203, 25, 33, 90,156, 80, 85, 73,200,172,255,154, 11, 83, 2,234,105,107, 75,
50,209, 46, 25,248,216,138,229,167,159,189,241,242,179, 79, 92,191, 56,237,149, 40,194, 97, 83, 75,140,246,183,179, 13, 10, 69,
164,106,154,229,114,121, 54, 95,156,206,102,199,167, 39,199, 39, 39,167,179,179,197,106, 21, 99, 72, 83,183, 38, 26,147,141, 11,
59, 55,118, 34, 42, 8, 42,136,113, 53,104,102,225,116, 52, 19, 34, 4, 54, 73, 73, 33,211, 87,253,126, 7, 17, 67,224,200, 33,
165, 65,110, 50, 94, 68,204,120,156,153,243,115,194, 93,218,116, 18, 37, 1, 48,229, 5,237,102, 32, 33, 32,164,243, 64,173, 53,
27,108, 71, 44,149,214, 28,244,244,147,215,126,246, 43, 47, 63,125,109,175, 32,209,184,217,172,132,146,173, 7,144,176, 61,125,
71,199, 39, 31,223,187,247,232,240,240,108,190, 88, 85,155,205,102, 93, 85, 85,176,219, 28,192,110,246, 96, 53,115, 88, 76,146,
74,110,131,201,167, 0,146,132, 35, 67, 96, 98,127,153,165, 5,180, 9,242,183,241, 82,230, 40,190, 40,134, 3, 90,174, 43, 12,
16, 66,216,106,186,136,158, 85, 29, 0,176, 10, 34,210,121,155, 73,166, 53, 68, 68,197,184, 15, 77, 46, 56, 32, 86,113, 66, 64,
233,248,144,102,237,217,146, 42, 45,212, 9, 96,167,240, 47,191,240,204, 95,251,234, 75,151,119,251,177,174, 56, 68, 1, 32, 68,
51,123, 91, 92,234,166,249,228,238,253,119, 63,252,240,225,209,113, 85,175, 99,100,230, 24,154, 38,112,228, 92,116, 19,241,173,
194, 28,173, 7,202, 57,187,131,182, 32, 29,197,252, 87,132,160,154,181, 4, 81, 49, 25,174, 93,186, 72, 40, 86, 44, 79,204, 6,
219,237,148, 27,173, 1,124,140, 17, 24,148,128, 20,188,205, 66,212, 46, 81,226,227, 6,220, 68, 41,169, 40, 32, 41,146,130, 16,
17, 9, 10, 9, 9, 10, 33,165, 83, 15,170, 9,212,106,203,140, 77, 71,195,159,251,137,207,127,249,165, 27,131, 18,234,205, 42,
117,122,209, 8, 54,107, 67,136,241,195, 79,110,191,253,254,135,143,142,143, 66, 8, 33, 52, 33, 6,102, 14, 33,164, 64, 36,243,
155, 88, 96,140,175,177,192,100,161,176,221,180,198,214,238,103,112, 63,154,124,145,165,204, 45,142, 7, 68, 73,116,191, 57,126,
152,217, 78,119, 89,250, 0, 0,160, 17, 80, 68, 20,213,139, 8, 32,130,160,105, 96,250,184, 64,110,170, 54, 67, 36, 34, 18,155,
211, 5, 69,145,156, 36, 15,149, 32, 56, 64,123, 24,138,173, 61, 6,116,119, 60,252, 91, 63,247,165,207,191,120,131,148,171,213,
74, 85, 9, 33,154,229, 92, 69,145, 78,230,243, 87, 94,123,227,238,253, 7, 85, 83, 53, 77,211,132, 38, 70, 86,230,192,193, 78,
69,203,137, 70, 97,230,216,170,182,219,133,129, 45, 67,135,121, 47, 19, 64,213, 54,242, 37, 45, 54,110, 49,124,139, 88, 69, 21,
12, 17,112,218,216, 70, 68, 81, 33,197, 78, 89,136,136,247, 24,130,128,130, 23, 81, 36, 67,154,217,250,180,101,199, 5, 1,197,
150,125, 84,128,148, 4,193, 81, 36, 36, 1, 66,167,170,202,102,191, 53,143, 37, 42,171, 81,145, 59,227,193, 79,190,124,243,233,
107,251,205,122, 37,161, 49, 35, 22, 3,196, 24, 89,216,145,187,243,224,193,171,111,190,125, 54,155, 53,193, 54, 55, 66,150,214,
82,135,202,116, 51,199, 92,137, 33,141,149,233, 29, 99,106,121, 8,173,163, 15,147,204, 99,223,234, 49, 3,146,205,209, 25,182,
26,189,202,170,104, 80, 21,128, 0,109, 74, 18,150,210,251, 16, 99, 68, 20, 81, 47,170,168, 64, 10, 64, 34, 91,115, 77, 42,241,
73, 36,210, 8,226, 84, 65,157, 35, 22, 84, 18, 18, 32, 32,177,205, 98,225,196, 52, 37, 82,124, 52, 40, 95,184,190, 63, 40,225,
155,223,254,227,170,170, 46,238,237,140,135,253,157,233,216,121, 31,154,112, 58, 95,220,189,255,224,240,228,100,179,217,212, 77,
101,137,195,182,244,154, 77,122, 73,238,203, 21,228,156,187, 81,211,146,121,182, 39,158, 95, 77, 79,154,147, 69,231,113,246,178,
221, 60,177, 80, 70,110,251, 90,235,130,204,243, 15, 58, 91, 35,143,142,154, 24,188,136,152,129,221, 44,169,231, 23,173, 85,149,
16,193,180,101, 2, 34, 2,142, 74, 68,170, 36, 78, 84,192, 1, 2, 34, 19,162, 8, 37, 11, 83,175,244, 79, 92, 24, 13, 10,248,
248,238,189, 59,247,238,127,239,181,215,231,139,179, 43, 7, 23, 62,253,220,211,207,220,120,170,105,194,195,227, 19, 83, 22, 66,
12, 33, 90,161,201,206,139, 76,145,217,166,148, 36, 87,158, 49,225,153,137,176,199,141, 0,128,172,220,234, 6,169,237,171, 72,
171, 32,156, 59, 91,152,104, 57, 81,212,104,144, 27, 36, 89,187,140, 0, 76, 70,113,178,251, 83, 68,217, 59,116, 68, 94,132, 17,
72, 81, 5,145, 30, 91,166, 51,175, 20,168, 70, 97,187,107, 33,109, 29,130,170,146, 18, 58, 80, 69,103,203, 90, 8,130,138,232,
157, 59,152,116,247,198,157,200, 97,189, 94, 45, 55,107, 34,220,108,170,247,110,221,186,115,239,238,239,252,222, 31,244,251,189,
39, 63,245,169,157,157, 73,167,236, 24,250,223, 58, 97, 13, 64,164, 3,149, 81, 49,180,117, 55, 23, 0, 74,181, 39,165, 64,146,
116,165,229,220, 91, 25, 73, 91,238,106,235,188, 1, 97,181,107,249,172,117,183, 70, 1,132,164,201,165,171, 34, 20, 16,160, 83,
160, 55,143, 62,153,204,131,136,143,153,118,149,192, 54, 14, 89, 1, 5,217,129,221,219, 66,182, 33, 10,228,136, 65,137,129, 8,
129, 16,116,212,239, 94,217, 27,150,158,236, 36,247,202, 98,111,103,167,110,170,217,236,172,106, 26,144,122,185, 94,205, 23,203,
107, 87, 46, 93,190,120,177,219,235,166,185, 53, 87,147,150,193, 69, 68,231, 72,240, 60,177, 38, 91,135, 95, 66,126, 41,154, 86,
183, 84, 88, 91, 86, 55,147, 85,104,149,197,156, 56,220,222, 49,194,231,242, 74,207,217,134, 45,130, 98,215, 23,169, 48, 34,185,
191,245,215,254,234,246, 22, 23, 67, 22,154, 87,147, 5, 54, 85,117,239,240,172, 10,143, 57,158,243, 74, 98,114,129, 97,134,134,
165,119,215, 47,142, 15,118, 7,201,182, 76,128, 0, 33, 4, 5, 17,145,208, 68,219, 44, 11, 33,206,230,243,197,114,229, 8,243,
221, 37, 54, 9,170,137, 83, 96,196,127, 91,130,177,181,163,109,213, 66, 43, 33,173, 79,195,138, 78,166,245, 83,233, 49,216,159,
40, 93, 22,101,213,243, 78,227, 22,218, 42,230,123, 52,242, 5, 26,109,170,168,248, 24, 35, 56,167,128, 36, 32, 6,135,218,149,
89,181,165, 42, 85, 97, 1, 82,178, 60, 37, 85, 80,167,206,168, 91, 2, 48, 7, 53,105,191,235,247, 70,221, 84, 49, 0, 28,185,
97,191,191, 59, 29,213,245, 38, 6,174,155, 48,155, 55,168,201, 29,112, 58,155,213, 77,115,241,194,254,254,222, 78,175,219,119,
132, 42, 91,106, 24, 20,137, 64, 5, 36,205, 64,152, 24,108,209, 86,129,203,228, 90,178,255,192, 57, 75,127,162,162, 36,159, 44,
78,146,136,110,151, 93, 33,149,251,188,129,145,132, 56,123, 30,108,118, 13, 96, 85, 31,153, 85,213, 41, 18, 18, 26,246, 79,171,
0, 22, 72, 69, 0,150,136,224, 73, 17, 72,149,212, 73, 58,182,100,127,201,129, 10,120,132, 73,191,236,118,252, 22,113, 0,122,
239,135,131,193,116, 60, 78,151,148, 49,159,205,102, 0,226,201,145, 66,181,169,238, 63,124, 52, 95, 44,167,147,241,100, 60, 44,
203, 82,207,175, 59,230,214,181,245,185,234,150, 25, 48, 66,236,252, 50, 96,170, 89,152, 27,141,108,239,137,107, 63,108, 13,104,
105,139, 60, 91, 63, 91, 23, 23, 36, 59, 59, 64,150, 16,124, 72,144,193,145, 83,218,174, 88,167, 51, 73, 72,142,144, 69, 73, 25,
136, 64,137, 84,196, 89, 73, 6, 5, 5, 2,100, 85,212,178,112,163, 65, 73, 68,137,181,151,228,128, 42,203,114, 48,232, 87,117,
197, 34, 14,177,240,197,201,217, 89, 29,106, 34, 50, 13, 59,196, 88, 85,245, 98,185,220,153, 76,198,163, 1,218, 54,106,230, 99,
211,131, 70,243,190, 38,195,175,164,103,189, 69,140,173, 89,130, 82,227,207, 89,198, 91,230,251, 28,229,166,231,214,139,210,138,
74, 27, 30, 75, 10, 84, 49,157,202, 51, 51, 16, 1, 40, 9, 58,243, 20, 35, 32, 80,246, 97, 67,233,201, 86,136, 21, 4, 8, 84,
72,129,129, 40,213,111, 16, 66, 34,148,194,209,160, 83,164,113, 72,160,165, 98,189, 47, 6,189,126, 61,168,155, 38,196,126,216,
211,177,247,110,182, 88,172, 55, 27,187,156,200, 59, 39, 44, 33,132,170,105, 54,117, 53, 25, 14,124,225,179,144,111,175, 71, 25,
4, 34,146,195,220,193, 53,235, 15,153,154, 72,173, 20,219, 3, 8, 57, 58,143,221,172,185,157, 57,208, 12, 87,218,114, 27,219,
41, 9,192, 74, 33, 0,160,250,116,181,136,154,227, 85, 40,237, 90, 11,106,178,214, 22,133, 19, 21, 80, 34, 0, 6, 33, 2, 84,
226,116,219,148,146,217, 0,200,117, 10,234,148,190,245,176,182,207,159, 16,139,178, 24, 14,134, 33,196, 24, 66, 44,227,168,223,
117, 4,221,178, 88,215, 85, 93, 55, 77,140, 70, 6, 6,230,186, 14,203,229,102, 50, 25, 78,134, 3,231,201,142,191, 71, 7,136,
224, 84,132, 20, 37, 13,238,182, 38,212,198, 8,225,188,156,156,101, 36,105,243,203,238, 63, 75,165,138, 20, 24,179,143,182,109,
80, 8,237, 56,171,105,155,157, 0,188,180, 59, 37,105, 81,140, 76, 54, 37, 68, 96, 0, 0,239, 93,162,116,149,200, 54,200, 1,
137, 32,155, 88,211,162, 84,183,227, 11,243, 67,156, 99,230,243,149, 7,212,233,148,227,241, 48,114,140, 9,170,128,119,174, 83,
20, 43, 95,173, 55, 85,211, 52, 28, 27, 95, 8, 51, 55, 77,179, 92,175,231,195,254,206,100,210,235,149, 8, 26, 57, 66,186, 61,
69, 91, 79, 98,222, 88, 0, 72,251,122,182, 43,223,230,142,232, 57,123,141,149, 47,201, 78, 18,100, 84,201,148, 16,108, 73,144,
12,107,210, 13,131, 86,251,188,205, 19,108,201,102, 67, 39,217, 99, 65,163,124, 58,222, 35,164,251,201,140,125, 22, 16, 80, 27,
52,136,145, 69,137,156,235, 21, 5, 18,164,135,214, 10, 21,185,233, 32, 82, 81,148,163,225, 48,166, 91,181, 4,146, 57,194, 57,
231,214, 27,170,154, 38,132, 32, 34,196, 92, 55,205, 98,181,186,123,255,112, 58, 30, 94,185,180,223,239,117,243, 77, 14,208,218,
181,179,213, 21,133,132,192,229,169, 65,193, 48, 81, 59,117,181, 87, 13,102, 5,193,116,123,160,115, 90,106,206, 30, 68,108,103,
189, 68,137, 40,250, 45, 91,156, 82, 87, 89,208, 17, 0, 40, 10, 42, 81,217,241, 68,164, 81,237, 62, 50,180, 73,140, 18, 33, 71,
152,210,190, 83, 58, 56,223,108,181,181,184,165, 95, 8, 88, 22,197,168,223, 87, 22, 64, 34,221, 4, 80, 66, 37,215, 45, 28, 20,
27, 87,213,117, 8, 77, 20, 99,116, 49, 70,126,116,116,122, 58, 95, 94,188,176,123,113,127, 90, 22, 37, 36, 77, 24,193,185,244,
152, 17, 32, 2, 3, 27,115, 40, 42,102,240, 1, 60,151, 59, 9,216,100, 43,146,213, 94,187, 86, 45, 15, 14, 89,128, 84, 99,170,
183,200, 17,213, 99,186,132, 13,208, 80, 6, 2, 81,226,250,204, 30,209, 45, 59,101,225, 54,117, 0, 17, 33, 68, 65, 64, 37, 16,
86, 34, 66, 69, 35,218,168, 44, 40,111, 58,109, 85, 83,201,179, 99,146, 28, 0,188, 43, 6,253, 65,250, 97,154,252,252,132,228,
188, 47,189,219,212, 84, 53,129, 89, 16,212, 19, 70,213,166,105,238,220,125,120,122, 54,191,122,249,194,116, 52,116,132,228, 60,
144,237, 78,137, 68, 17, 20, 36,148,104, 70,100,109,133,166,188,234,130, 34,130,130, 66,146, 47, 50,210,243,152, 55, 91,225, 48,
185,185, 18,179,142,104,131, 7, 98,186, 79, 26, 5,212,105,242,100,107,187, 1, 4,170,216,235,150,131,110, 57, 91,134, 52,141,
1,176, 93,226, 70, 2,233,146, 1,114, 14, 11, 71,153, 97,200,138,233,185, 8,113,154, 8,172,202, 97,183,236,240,128, 5, 84,
171, 13, 40, 20, 5, 56,236,120, 36,239,169, 40,154, 77, 85, 55, 49, 34,131,163,180,215,184,169,234, 91,159,220, 59,216,223,189,
176, 59,233,118, 74, 2, 71,164, 42, 32, 36, 16,179, 97, 76, 4, 72,137, 73, 41,221,185, 7,237,204, 65,219,237,141,212,240,183,
34, 67, 91, 54, 5, 84,242, 5, 68,146, 45,172,232,147,202,165,166, 16,163,160,221,113,165,153,214,149,210,251,157, 81,239,254,
241, 42,219,157, 16, 77,177, 16, 96, 51,225, 32,148,158,188, 67,179, 47,202, 54, 66,146, 39,201,116,143,116,180, 88,169, 32, 82,
89,118,250,172,160, 90,105,165,141, 32, 33,148,158, 72,237,218,198,186,105,234, 38,132, 24, 85,129, 85,148,129,153,239, 61, 56,
92, 46,215, 23,246,167,211,241,208,123,167,233, 70, 6, 72,218,169,105,224, 78,172,183,156,219,238, 76, 3, 84,158,240,179, 87,
39,195,234,188,165,165,148,175,217, 49,178,192, 68, 12,159,177,125, 86, 5, 8, 5,157, 57,214,109, 9, 1,137,166,227,126, 89,
224,186, 86, 67,133,206,248, 94, 2, 4, 96, 69, 34, 45, 29, 34,130, 93, 96,166,219,246,149,102, 43, 21,149, 68, 49,100,171,187,
42, 34, 22,133,239,105,207,212,154,134, 3, 41, 0,185, 78, 73,222, 81,167, 40, 67, 39,212, 77, 88,215, 85,213,196,100,139, 17,
153,205, 23,139,213,106,208,239, 29,236,239, 76,199, 3, 66, 50,147, 96,222, 23, 82, 66, 84, 7,105, 79, 56, 45,112,180,150,189,
92,152, 90, 53,113,219,114,165,149, 44,204, 70,101, 53, 7, 17,253, 57,163,133,169, 2, 32, 32,230,176, 79, 89,136, 58, 26,244,
70,189,114, 83, 87,102, 14,138,130,136, 72,108,115,170, 32, 18, 57, 84,149, 40, 81, 90, 47, 82,114,145, 39,151,112, 76,150,119,
43, 70,246,161, 0, 18, 57,234,116,186,170,160,149,134,168,130,138,170,206, 57, 34,245, 5, 21,133, 47, 59,126,189,105, 54, 85,
29, 56,253, 7, 5, 36,242,108,190, 90, 44,214,163,209,224,194,238,104,208,233,166, 94, 96, 34,138, 49,120,102, 18,182,228, 17,
77,172,106,203,153,217,118,190,245,197,212,157, 41,183, 71, 56,191,198, 7, 8, 94,183,130, 26,160, 2,181,215, 58, 17,129, 0,
16,144, 72,183, 44,118,198,189,195,179, 74,210,162, 91, 54,196,153, 53, 51,203,151, 12,231,230,159, 20, 31,219,218, 72,106,150,
93, 10, 44, 45, 75, 33,138,128, 68, 84, 20, 5,100, 27,149,180, 67, 19,162,115,212,193,130, 16, 11, 79,235, 77, 93, 55, 33,138,
182,166,189,217,108, 62, 95,172, 6,189,206,116, 52,232,117, 93,186,167, 96, 91,121, 64, 32,211,139,146,111, 6, 75,109, 13, 91,
247, 81,126, 3, 89, 56, 34,108,123,159, 29, 51,223,132,144, 61,147, 10, 0,146,168,230,188,232,167,168, 68,136,176, 59, 30,148,
229,217,122,147, 38, 21,204,214, 94, 69,171, 73,204,202, 42,152,140, 44,105, 93, 35, 45,178,180, 84, 95,203,135,110, 57, 10, 51,
117, 16, 58,239, 59,170, 0,208, 64, 45,145, 53,111,141, 33,162,119,142, 58,232,136, 10,239,214,117, 19, 35, 39,149, 5, 80, 68,
230,171,205,186,218, 76,134,131,241,160, 99, 23,184,217, 45,135,246, 92, 98,140,178, 93,122,197,180, 26,154,111, 8,201, 55,121,
231,141,189, 45, 26,202,252, 49,170,175,155,166, 5, 83,182,141, 40, 14, 29, 57, 99,209, 0, 72, 20, 28,194,100,212,155,244, 59,
235,205, 90, 5,243,253,118,173, 8,162,145, 69, 34, 43, 98,123,193,171,230, 45, 58, 57, 15,135,140, 53, 78,240,145, 83,134,137,
128, 8, 0,146,163,162,112,170, 37,104, 19, 99, 20,144,150, 6, 2, 4,239,169,171,158, 8, 54, 85,186, 0,223, 84,118, 80,136,
17,142,103,203,245,166, 30, 13, 58,221,210, 59, 71,166,136, 69,142, 44,146,198, 57, 0, 32,115,123,156,187, 6,156, 32,223, 84,
144, 45, 24, 9,128,102,230, 27,209,125,233,229, 23,146, 83,223,238,210,148,173, 28, 0,237,242,132,130,119, 20, 66, 56,154,173,
34, 75,134, 87, 6,251, 5, 1,166,163,238,254,164,111,216,134, 69, 52, 49,124,146, 9,188,214,103,203,109,107, 19, 86,201,174,
228,156, 74,249, 78, 6,108, 23,207, 31,139,112,123,143,155,141, 67,152, 61,108, 10,160,138, 33,114, 19, 34, 0, 18,161,154,217,
197,240,117,118,232,192,118,155, 38, 45,163,160,182,123,140,152, 87,168, 83,245, 33, 77, 30, 33,247,185,231,159,177, 87,202, 38,
184, 36, 57, 36,187, 1, 32,253,151, 67, 0,176,112,116,182, 88, 47, 54,141, 42, 60,118,193,159,234,176, 87,236, 79,250,105, 12,
78,215,143, 51, 39,202,207, 8,245,237,209,226,150, 11,212,148, 70,146,229,207,124, 7, 68,234,169, 9, 28,199,196,232,216,237,
248,198,246,184,124, 61, 78,126, 79,182,210, 39,117, 19,171, 38, 42,128, 67, 32,135,137, 24, 58,199,111,152,216,151,210, 37, 25,
54, 48,211,221,237,182,121,187,193,135,255, 47,141, 49,219,167,190,145,191,220, 0, 0, 0, 0, 73, 69, 78, 68,174, 66, 96,130,
0};

@ -102,6 +102,9 @@ extern char datatoc_layer_png[];
extern int datatoc_lighten_png_size;
extern char datatoc_lighten_png[];
extern int datatoc_mask_png_size;
extern char datatoc_mask_png[];
extern int datatoc_mix_png_size;
extern char datatoc_mix_png[];

@ -32,6 +32,7 @@
struct ARegion;
struct bContext;
struct MultiresModifierData;
struct Object;
struct RegionView3D;
struct wmKeyConfig;
@ -44,14 +45,16 @@ void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar,
void ED_sculpt_force_update(struct bContext *C);
float *ED_sculpt_get_last_stroke(struct Object *ob);
int ED_sculpt_minmax(struct bContext *C, float *min, float *max);
void ED_sculpt_mask_layers_ensure(struct Object *ob,
struct MultiresModifierData *mmd);
/* paint_ops.c */
void ED_operatortypes_paint(void);
void ED_keymap_paint(struct wmKeyConfig *keyconf);
/* paint_undo.c */
#define UNDO_PAINT_IMAGE 0
#define UNDO_PAINT_MESH 1
#define UNDO_PAINT_IMAGE 0
#define UNDO_PAINT_MESH 1
int ED_undo_paint_step(struct bContext *C, int type, int step, const char *name);
void ED_undo_paint_free(void);

@ -974,6 +974,7 @@ DEF_ICON(BRUSH_GRAB)
DEF_ICON(BRUSH_INFLATE)
DEF_ICON(BRUSH_LAYER)
DEF_ICON(BRUSH_LIGHTEN)
DEF_ICON(BRUSH_MASK)
DEF_ICON(BRUSH_MIX)
DEF_ICON(BRUSH_MULTIPLY)
DEF_ICON(BRUSH_NUDGE)

@ -4557,7 +4557,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
RNA_string_set(&ptr_props, "doc_id", buf);
uiItemFullO(layout, "WM_OT_doc_view", "View Docs", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0);
uiItemFullO(layout, "WM_OT_doc_view", "Python Documentation", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0);
/* XXX inactive option, not for public! */
#if 0
@ -4573,7 +4573,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
RNA_string_set(&ptr_props, "doc_id", buf);
uiItemFullO(layout, "WM_OT_doc_view", "View Docs", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0);
uiItemFullO(layout, "WM_OT_doc_view", "Python Documentation", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0);
WM_operator_properties_create(&ptr_props, "WM_OT_doc_edit");

@ -491,6 +491,7 @@ static void init_brush_icons(void)
INIT_BRUSH_ICON(ICON_BRUSH_INFLATE, inflate);
INIT_BRUSH_ICON(ICON_BRUSH_LAYER, layer);
INIT_BRUSH_ICON(ICON_BRUSH_LIGHTEN, lighten);
INIT_BRUSH_ICON(ICON_BRUSH_MASK, mask);
INIT_BRUSH_ICON(ICON_BRUSH_MIX, mix);
INIT_BRUSH_ICON(ICON_BRUSH_MULTIPLY, multiply);
INIT_BRUSH_ICON(ICON_BRUSH_NUDGE, nudge);

@ -1776,12 +1776,12 @@ static void ui_litem_layout_row(uiLayout *litem)
/* align right/center */
offset = 0;
if (litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
if (freew > 0 && freew < w - fixedw)
offset = (w - fixedw) - freew;
if (freew + fixedw > 0 && freew + fixedw < w)
offset = w - (fixedw + freew);
}
else if (litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
if (freew > 0 && freew < w - fixedw)
offset = ((w - fixedw) - freew) / 2;
if (freew + fixedw > 0 && freew + fixedw < w)
offset = (w - (fixedw + freew)) / 2;
}
/* position item */

@ -234,12 +234,32 @@ static void UI_OT_reset_default_theme(wmOperatorType *ot)
/* Copy Data Path Operator ------------------------ */
static int copy_data_path_button_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
char *path;
int index;
uiContextActiveProperty(C, &ptr, &prop, &index);
if (ptr.id.data && ptr.data && prop) {
path = RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
MEM_freeN(path);
return 1;
}
}
return 0;
}
static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr;
PropertyRNA *prop;
char *path;
int success = 0;
int index;
/* try to create driver using property retrieved from UI */
@ -251,11 +271,11 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
if (path) {
WM_clipboard_text_set(path, FALSE);
MEM_freeN(path);
return OPERATOR_FINISHED;
}
}
/* since we're just copying, we don't really need to do anything else...*/
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
return OPERATOR_CANCELLED;
}
static void UI_OT_copy_data_path_button(wmOperatorType *ot)
@ -267,7 +287,7 @@ static void UI_OT_copy_data_path_button(wmOperatorType *ot)
/* callbacks */
ot->exec = copy_data_path_button_exec;
//op->poll= ??? // TODO: need to have some valid property before this can be done
ot->poll = copy_data_path_button_poll;
/* flags */
ot->flag = OPTYPE_REGISTER;

@ -492,7 +492,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_RELEASE)
break;
cuts = MAX2(cuts - 1, 1);
cuts = MAX2(cuts - 1, 0);
RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
show_cuts = TRUE;
@ -519,12 +519,15 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
/* using the keyboard to input the number of cuts */
if (event->val == KM_PRESS) {
float value;
/* init as zero so backspace clears */
float value = 0.0f;
if (handleNumInput(&lcd->num, event)) {
applyNumInput(&lcd->num, &value);
cuts = CLAMPIS(value, 1, 130);
/* allow zero so you can backspace and type in a value
* otherwise 1 as minimum would make more sense */
cuts = CLAMPIS(value, 0, 130);
RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);

@ -49,6 +49,7 @@
#include "BLI_math_geom.h"
#include "BKE_blender.h"
#include "BKE_ccg.h"
#include "BKE_screen.h"
#include "BKE_context.h"
#include "BKE_global.h"
@ -475,32 +476,32 @@ static void interp_barycentric_tri_data(float data[3][3], float u, float v, floa
/* mode = 0: interpolate normals,
* mode = 1: interpolate coord */
static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, float crn_y, int mode, float res[3])
static void interp_bilinear_grid(CCGKey *key, CCGElem *grid, float crn_x, float crn_y, int mode, float res[3])
{
int x0, x1, y0, y1;
float u, v;
float data[4][3];
x0 = (int) crn_x;
x1 = x0 >= (grid_size - 1) ? (grid_size - 1) : (x0 + 1);
x1 = x0 >= (key->grid_size - 1) ? (key->grid_size - 1) : (x0 + 1);
y0 = (int) crn_y;
y1 = y0 >= (grid_size - 1) ? (grid_size - 1) : (y0 + 1);
y1 = y0 >= (key->grid_size - 1) ? (key->grid_size - 1) : (y0 + 1);
u = crn_x - x0;
v = crn_y - y0;
if (mode == 0) {
copy_v3_v3(data[0], grid[y0 * grid_size + x0].no);
copy_v3_v3(data[1], grid[y0 * grid_size + x1].no);
copy_v3_v3(data[2], grid[y1 * grid_size + x1].no);
copy_v3_v3(data[3], grid[y1 * grid_size + x0].no);
copy_v3_v3(data[0], CCG_grid_elem_no(key, grid, x0, y0));
copy_v3_v3(data[1], CCG_grid_elem_no(key, grid, x1, y0));
copy_v3_v3(data[2], CCG_grid_elem_no(key, grid, x1, y1));
copy_v3_v3(data[3], CCG_grid_elem_no(key, grid, x0, y1));
}
else {
copy_v3_v3(data[0], grid[y0 * grid_size + x0].co);
copy_v3_v3(data[1], grid[y0 * grid_size + x1].co);
copy_v3_v3(data[2], grid[y1 * grid_size + x1].co);
copy_v3_v3(data[3], grid[y1 * grid_size + x0].co);
copy_v3_v3(data[0], CCG_grid_elem_co(key, grid, x0, y0));
copy_v3_v3(data[1], CCG_grid_elem_co(key, grid, x1, y0));
copy_v3_v3(data[2], CCG_grid_elem_co(key, grid, x1, y1));
copy_v3_v3(data[3], CCG_grid_elem_co(key, grid, x0, y1));
}
interp_bilinear_quad_data(data, u, v, res);
@ -509,7 +510,8 @@ static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, f
static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *origindex, const int lvl, const int face_index, const float u, const float v, float co[3], float n[3])
{
MFace mface;
DMGridData **grid_data;
CCGElem **grid_data;
CCGKey key;
float crn_x, crn_y;
int grid_size, S, face_side;
int *grid_offset, g_index;
@ -519,6 +521,7 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
grid_size = hidm->getGridSize(hidm);
grid_data = hidm->getGridData(hidm);
grid_offset = hidm->getGridOffset(hidm);
hidm->getGridKey(hidm, &key);
face_side = (grid_size << 1) - 1;
@ -546,10 +549,10 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
CLAMP(crn_y, 0.0f, grid_size);
if (n != NULL)
interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 0, n);
interp_bilinear_grid(&key, grid_data[g_index + S], crn_x, crn_y, 0, n);
if (co != NULL)
interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 1, co);
interp_bilinear_grid(&key, grid_data[g_index + S], crn_x, crn_y, 1, co);
}
/* mode = 0: interpolate normals,
@ -619,7 +622,7 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
if (bkr->simple)
smd.subdivType = ME_SIMPLE_SUBSURF;
height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
}
height_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
@ -1020,7 +1023,8 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
tmp_mmd.lvl = *lvl;
tmp_mmd.sculptlvl = *lvl;
dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob,
MULTIRES_USE_LOCAL_MMD);
cddm->release(cddm);
}
@ -1040,7 +1044,8 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
tmp_mmd.lvl = mmd->totlvl;
tmp_mmd.sculptlvl = mmd->totlvl;
dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob,
MULTIRES_USE_LOCAL_MMD);
cddm->release(cddm);
return dm;

@ -76,6 +76,7 @@
#include "ED_armature.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_mesh.h"
#include "WM_api.h"
@ -147,9 +148,13 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
}
else if (type == eModifierType_Surface)
DAG_scene_sort(bmain, scene);
else if (type == eModifierType_Multires)
else if (type == eModifierType_Multires) {
/* set totlvl from existing MDISPS layer if object already had it */
multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob);
/* ensure that grid paint mask layer is created */
ED_sculpt_mask_layers_ensure(ob, (MultiresModifierData *)new_md);
}
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@ -545,7 +550,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
vertexCos = BKE_curve_vertexCos_get(cu, &cu->nurb, &numVerts);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0);
BK_curve_vertexCos_apply(cu, &cu->nurb, vertexCos);
MEM_freeN(vertexCos);
@ -610,6 +615,9 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
BLI_remlink(&ob->modifiers, md);
modifier_free(md);
/* ensure mesh paint mask layer remains after applying */
ED_sculpt_mask_layers_ensure(ob, NULL);
return 1;
}
@ -918,7 +926,8 @@ static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
static EnumPropertyItem modifier_apply_as_items[] = {
{MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"},
{MODIFIER_APPLY_SHAPE, "SHAPE", 0, "New Shape", "Apply deform-only modifier to a new shape on this object"},
{0, NULL, 0, NULL, NULL}};
{0, NULL, 0, NULL, NULL}
};
void OBJECT_OT_modifier_apply(wmOperatorType *ot)
{

@ -501,7 +501,7 @@ int ED_vgroup_copy_by_nearest_face_single(Object *ob_dst, Object *ob_src)
MVert *mv_dst;
MFace *mface_src;
Mesh *me_dst, *me_src;
BVHTreeFromMesh tree_mesh_faces_src;
BVHTreeFromMesh tree_mesh_faces_src = {NULL};
BVHTreeNearest nearest;
DerivedMesh *dmesh_src;
int dv_tot_src, dv_tot_dst, i, index_dst, index_src;
@ -519,7 +519,7 @@ int ED_vgroup_copy_by_nearest_face_single(Object *ob_dst, Object *ob_src)
/*get meshes*/
me_dst= ob_dst->data;
me_src= ob_src->data;
me_src= ob_src->data; /*mfaces does not exist*/
dmesh_src= ob_src->derivedDeform; /*sergey- : this might easily be null?? (using ob_src.deriveddeform*/
/*make node tree*/
@ -549,12 +549,15 @@ int ED_vgroup_copy_by_nearest_face_single(Object *ob_dst, Object *ob_src)
BLI_bvhtree_find_nearest(tree_mesh_faces_src.tree, mv_dst->co, &nearest, tree_mesh_faces_src.nearest_callback, &tree_mesh_faces_src);
/*get weight*/
printf("test %d %d \n", me_src->mface->v1, (*me_src->mface).v1);
mface_src= me_src->mface + nearest.index;
/*tot_dist= ()+()+(); use a comparable distance
if(mface_src->v4){
tot_dist+= ();
}*/
dw_src= defvert_verify_index(dv_array_src[mface_src->v1], index_src);
printf("test %d \n", (*mface_src).v1);
dv_array_src+= mface_src->v1;
dw_src= defvert_verify_index(*dv_array_src, index_src);
weight= dw_src->weight;
dw_src= defvert_verify_index(dv_array_src[mface_src->v2], index_src);
weight+= dw_src->weight;

@ -208,7 +208,7 @@ void OBJECT_OT_material_slot_assign(wmOperatorType *ot)
/* identifiers */
ot->name = "Assign Material Slot";
ot->idname = "OBJECT_OT_material_slot_assign";
ot->description = "Assign the material in the selected material slot to the selected vertices";
ot->description = "Assign active material slot to selection";
/* api callbacks */
ot->exec = material_slot_assign_exec;
@ -292,7 +292,7 @@ void OBJECT_OT_material_slot_select(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Material Slot";
ot->idname = "OBJECT_OT_material_slot_select";
ot->description = "Select vertices assigned to the selected material slot";
ot->description = "Select by active material slot";
/* api callbacks */
ot->exec = material_slot_select_exec;
@ -311,7 +311,7 @@ void OBJECT_OT_material_slot_deselect(wmOperatorType *ot)
/* identifiers */
ot->name = "Deselect Material Slot";
ot->idname = "OBJECT_OT_material_slot_deselect";
ot->description = "Deselect vertices assigned to the selected material slot";
ot->description = "Deselect by active material slot";
/* api callbacks */
ot->exec = material_slot_deselect_exec;

@ -357,7 +357,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "sequences")) {
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed) {
Sequence *seq;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@ -368,7 +368,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "selected_sequences")) {
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed) {
Sequence *seq;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@ -381,7 +381,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "selected_editable_sequences")) {
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed) {
Sequence *seq;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {

@ -42,6 +42,7 @@ set(SRC
paint_cursor.c
paint_hide.c
paint_image.c
paint_mask.c
paint_ops.c
paint_stroke.c
paint_undo.c

@ -45,6 +45,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
@ -83,10 +84,14 @@ static int planes_contain_v3(float (*planes)[4], int totplane, const float p[3])
/* return true if the element should be hidden/shown */
static int is_effected(PartialVisArea area,
float planes[4][4],
const float co[3])
const float co[3],
const float mask)
{
if (area == PARTIALVIS_ALL)
return 1;
else if (area == PARTIALVIS_MASKED) {
return mask > 0.5;
}
else {
int inside = planes_contain_v3(planes, 4, co);
return ((inside && area == PARTIALVIS_INSIDE) ||
@ -101,20 +106,24 @@ static void partialvis_update_mesh(Object *ob,
PartialVisArea area,
float planes[4][4])
{
Mesh *me = ob->data;
MVert *mvert;
float *paint_mask;
int *vert_indices;
int any_changed = 0, any_visible = 0, totvert, i;
BLI_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
BLI_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
for (i = 0; i < totvert; i++) {
MVert *v = &mvert[vert_indices[i]];
float vmask = paint_mask ? paint_mask[vert_indices[i]] : 0;
/* hide vertex if in the hide volume */
if (is_effected(area, planes, v->co)) {
if (is_effected(area, planes, v->co, vmask)) {
if (action == PARTIALVIS_HIDE)
v->flag |= ME_HIDE;
else
@ -141,16 +150,18 @@ static void partialvis_update_grids(Object *ob,
PartialVisArea area,
float planes[4][4])
{
DMGridData **grids;
CCGElem **grids;
CCGKey key;
BLI_bitmap *grid_hidden;
int any_visible = 0;
int *grid_indices, gridsize, totgrid, any_changed, i;
int *grid_indices, totgrid, any_changed, i;
/* get PBVH data */
BLI_pbvh_node_get_grids(pbvh, node,
&grid_indices, &totgrid, NULL, &gridsize,
&grid_indices, &totgrid, NULL, NULL,
&grids, NULL);
grid_hidden = BLI_pbvh_grid_hidden(pbvh);
BLI_pbvh_get_grid_key(pbvh, &key);
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
@ -164,7 +175,7 @@ static void partialvis_update_grids(Object *ob,
switch (action) {
case PARTIALVIS_HIDE:
/* create grid flags data */
gh = grid_hidden[g] = BLI_BITMAP_NEW(gridsize * gridsize,
gh = grid_hidden[g] = BLI_BITMAP_NEW(key.grid_area,
"partialvis_update_grids");
break;
case PARTIALVIS_SHOW:
@ -182,21 +193,23 @@ static void partialvis_update_grids(Object *ob,
continue;
}
for (y = 0; y < gridsize; y++) {
for (x = 0; x < gridsize; x++) {
const float *co = grids[g][y * gridsize + x].co;
for (y = 0; y < key.grid_size; y++) {
for (x = 0; x < key.grid_size; x++) {
CCGElem *elem = CCG_grid_elem(&key, grids[g], x, y);
const float *co = CCG_elem_co(&key, elem);
float mask = *CCG_elem_mask(&key, elem);
/* skip grid element if not in the effected area */
if (is_effected(area, planes, co)) {
if (is_effected(area, planes, co, mask)) {
/* set or clear the hide flag */
BLI_BITMAP_MODIFY(gh, y * gridsize + x,
BLI_BITMAP_MODIFY(gh, y * key.grid_size + x,
action == PARTIALVIS_HIDE);
any_changed = 1;
}
/* keep track of whether any elements are still hidden */
if (BLI_BITMAP_GET(gh, y * gridsize + x))
if (BLI_BITMAP_GET(gh, y * key.grid_size + x))
any_hidden = 1;
else
any_visible = 1;
@ -263,7 +276,9 @@ static void get_pbvh_nodes(PBVH *pbvh,
cb = BLI_pbvh_node_planes_exclude_AABB;
break;
case PARTIALVIS_ALL:
case PARTIALVIS_MASKED:
cb = NULL;
break;
}
BLI_pbvh_search_gather(pbvh, cb, clip_planes, nodes, totnode);
@ -342,7 +357,7 @@ static int hide_show_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
PartialVisArea area = RNA_enum_get(op->ptr, "area");
if (area != PARTIALVIS_ALL)
if (!ELEM(area, PARTIALVIS_ALL, PARTIALVIS_MASKED))
return WM_border_select_invoke(C, op, event);
else
return op->type->exec(C, op);
@ -353,13 +368,16 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot)
static EnumPropertyItem action_items[] = {
{PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"},
{PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"},
{0, NULL, 0, NULL, NULL}};
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem area_items[] = {
{PARTIALVIS_OUTSIDE, "OUTSIDE", 0, "Outside", "Hide or show vertices outside the selection"},
{PARTIALVIS_INSIDE, "INSIDE", 0, "Inside", "Hide or show vertices inside the selection"},
{PARTIALVIS_ALL, "ALL", 0, "All", "Hide or show all vertices"},
{0, NULL, 0, NULL, NULL}};
{PARTIALVIS_MASKED, "MASKED", 0, "Masked", "Hide or show vertices that are masked (minimum mask value of 0.5)"},
{0, NULL, 0, NULL, NULL}
};
/* identifiers */
ot->name = "Hide/Show";

@ -43,6 +43,7 @@ struct PaintStroke;
struct PointerRNA;
struct rcti;
struct Scene;
struct RegionView3D;
struct VPaint;
struct ViewContext;
struct wmEvent;
@ -56,8 +57,8 @@ typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke,
typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke);
struct PaintStroke *paint_stroke_new(struct bContext *C,
StrokeGetLocation get_location, StrokeTestStart test_start,
StrokeUpdateStep update_step, StrokeDone done, int event_type);
StrokeGetLocation get_location, StrokeTestStart test_start,
StrokeUpdateStep update_step, StrokeDone done, int event_type);
void paint_stroke_data_free(struct wmOperator *op);
int paint_space_stroke_enabled(struct Brush *br);
@ -115,24 +116,24 @@ void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
* its minimum and maximum corners) into a screen-space rectangle,
* returns zero if the result is empty */
int paint_convert_bb_to_rect(struct rcti *rect,
const float bb_min[3],
const float bb_max[3],
const struct ARegion *ar,
struct RegionView3D *rv3d,
struct Object *ob);
const float bb_min[3],
const float bb_max[3],
const struct ARegion *ar,
struct RegionView3D *rv3d,
struct Object *ob);
/* Get four planes in object-space that describe the projection of
* screen_rect from screen into object-space (essentially converting a
* 2D screens-space bounding box into four 3D planes) */
void paint_calc_redraw_planes(float planes[4][4],
const struct ARegion *ar,
struct RegionView3D *rv3d,
struct Object *ob,
const struct rcti *screen_rect);
const struct ARegion *ar,
struct RegionView3D *rv3d,
struct Object *ob,
const struct rcti *screen_rect);
void projectf(struct bglMats *mats, const float v[3], float p[2]);
float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
float paint_get_tex_pixel(struct Brush* br, float u, float v);
float paint_get_tex_pixel(struct Brush *br, float u, float v);
int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface);
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
@ -179,9 +180,19 @@ typedef enum {
typedef enum {
PARTIALVIS_INSIDE,
PARTIALVIS_OUTSIDE,
PARTIALVIS_ALL
PARTIALVIS_ALL,
PARTIALVIS_MASKED
} PartialVisArea;
void PAINT_OT_hide_show(struct wmOperatorType *ot);
/* paint_mask.c */
typedef enum {
PAINT_MASK_FLOOD_VALUE,
PAINT_MASK_INVERT
} PaintMaskFloodMode;
void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot);
#endif /* __PAINT_INTERN_H__ */

@ -0,0 +1,143 @@
/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2012 by Nicholas Bishop
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s):
*
* ***** END GPL LICENSE BLOCK *****
*
*/
/** \file blender/editors/sculpt_paint/paint_mask.c
* \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "BLI_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
#include "BKE_DerivedMesh.h"
#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_subsurf.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "paint_intern.h"
#include "sculpt_intern.h" /* for undo push */
#include <stdlib.h>
static void mask_flood_fill_set_elem(float *elem,
PaintMaskFloodMode mode,
float value)
{
switch(mode) {
case PAINT_MASK_FLOOD_VALUE:
(*elem) = value;
break;
case PAINT_MASK_INVERT:
(*elem) = 1.0f - (*elem);
break;
}
}
static int mask_flood_fill_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
PaintMaskFloodMode mode;
float value;
DerivedMesh *dm;
PBVH *pbvh;
PBVHNode **nodes;
int totnode, i;
mode = RNA_enum_get(op->ptr, "mode");
value = RNA_float_get(op->ptr, "value");
dm = mesh_get_derived_final(CTX_data_scene(C), ob, CD_MASK_BAREMESH);
pbvh = dm->getPBVH(ob, dm);
ob->sculpt->pbvh = pbvh;
BLI_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
sculpt_undo_push_begin("Mask flood fill");
for(i = 0; i < totnode; i++) {
PBVHVertexIter vi;
sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
BLI_pbvh_vertex_iter_begin(pbvh, nodes[i], vi, PBVH_ITER_UNIQUE) {
mask_flood_fill_set_elem(vi.mask, mode, value);
} BLI_pbvh_vertex_iter_end;
BLI_pbvh_node_mark_update(nodes[i]);
if(BLI_pbvh_type(pbvh) == PBVH_GRIDS)
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
}
sculpt_undo_push_end();
if(nodes)
MEM_freeN(nodes);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot)
{
static EnumPropertyItem mode_items[] = {
{PAINT_MASK_FLOOD_VALUE, "VALUE", 0, "Value", "Set mask to the level specified by the \"value\" property"},
{PAINT_MASK_INVERT, "INVERT", 0, "Invert", "Invert the mask"},
{0}};
/* identifiers */
ot->name = "Mask Flood Fill";
ot->idname = "PAINT_OT_mask_flood_fill";
/* api callbacks */
ot->exec = mask_flood_fill_exec;
ot->poll = sculpt_mode_poll;
ot->flag = OPTYPE_REGISTER;
/* rna */
RNA_def_enum(ot->srna, "mode", mode_items, PAINT_MASK_FLOOD_VALUE, "Mode", NULL);
RNA_def_float(ot->srna, "value", 0, 0, 1, "Value", "Mask level to use when mode is \"Value\"; zero means no masking and one is fully masked", 0, 1);
}

@ -25,6 +25,7 @@
#include "MEM_guardedalloc.h"
#include <stdlib.h>
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@ -204,6 +205,11 @@ static int brush_tool(const Brush *brush, size_t tool_offset)
return *(((char *)brush) + tool_offset);
}
static void brush_tool_set(const Brush *brush, size_t tool_offset, int tool)
{
*(((char *)brush) + tool_offset) = tool;
}
/* generic functions for setting the active brush based on the tool */
static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, const size_t tool_offset, const int ob_mode)
{
@ -227,11 +233,49 @@ static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, c
return NULL;
}
static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, const size_t tool_offset, const int ob_mode)
static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool, const size_t tool_offset, const int ob_mode)
{
if (!brush_orig || brush_tool(brush_orig, tool_offset) != tool) {
Brush *br;
/* if the current brush is not using the desired tool, look
for one that is */
br = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
/* store the previously-selected brush */
if (br)
br->toggle_brush = brush_orig;
return br;
}
else if (brush_orig->toggle_brush &&
BLI_findindex(bmain->brush.first, brush_orig->toggle_brush) != -1)
{
/* if current brush is using the desired tool, try to toggle
back to the previously selected brush (if it was set, and
if it still exists) */
return brush_orig->toggle_brush;
}
else
return NULL;
}
static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
const size_t tool_offset, const int ob_mode,
const char *tool_name, int create_missing,
int toggle)
{
struct Brush *brush, *brush_orig = paint_brush(paint);
brush = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
if (toggle)
brush = brush_tool_toggle(bmain, brush_orig, tool, tool_offset, ob_mode);
else
brush = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
if (!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) {
brush = BKE_brush_add(tool_name);
brush_tool_set(brush, tool_offset, tool);
brush->ob_mode = ob_mode;
brush->toggle_brush = brush_orig;
}
if (brush) {
paint_brush_set(paint, brush);
@ -252,6 +296,9 @@ static int brush_select_exec(bContext *C, wmOperator *op)
ToolSettings *toolsettings = CTX_data_tool_settings(C);
Paint *paint = NULL;
int tool, paint_mode = RNA_enum_get(op->ptr, "paint_mode");
int create_missing = RNA_boolean_get(op->ptr, "create_missing");
int toggle = RNA_boolean_get(op->ptr, "toggle");
const char *tool_name = "Brush";
size_t tool_offset;
if (paint_mode == OB_MODE_ACTIVE) {
@ -274,29 +321,35 @@ static int brush_select_exec(bContext *C, wmOperator *op)
paint = &toolsettings->sculpt->paint;
tool_offset = offsetof(Brush, sculpt_tool);
tool = RNA_enum_get(op->ptr, "sculpt_tool");
RNA_enum_name_from_value(brush_sculpt_tool_items, tool, &tool_name);
break;
case OB_MODE_VERTEX_PAINT:
paint = &toolsettings->vpaint->paint;
tool_offset = offsetof(Brush, vertexpaint_tool);
tool = RNA_enum_get(op->ptr, "vertex_paint_tool");
RNA_enum_name_from_value(brush_vertex_tool_items, tool, &tool_name);
break;
case OB_MODE_WEIGHT_PAINT:
paint = &toolsettings->wpaint->paint;
/* vertexpaint_tool is used for weight paint mode */
tool_offset = offsetof(Brush, vertexpaint_tool);
tool = RNA_enum_get(op->ptr, "weight_paint_tool");
RNA_enum_name_from_value(brush_vertex_tool_items, tool, &tool_name);
break;
case OB_MODE_TEXTURE_PAINT:
paint = &toolsettings->imapaint.paint;
tool_offset = offsetof(Brush, imagepaint_tool);
tool = RNA_enum_get(op->ptr, "texture_paint_tool");
RNA_enum_name_from_value(brush_image_tool_items, tool, &tool_name);
break;
default:
/* invalid paint mode */
return OPERATOR_CANCELLED;
}
return brush_generic_tool_set(bmain, paint, tool, tool_offset, paint_mode);
return brush_generic_tool_set(bmain, paint, tool, tool_offset,
paint_mode, tool_name, create_missing,
toggle);
}
static void PAINT_OT_brush_select(wmOperatorType *ot)
@ -327,6 +380,9 @@ static void PAINT_OT_brush_select(wmOperatorType *ot)
RNA_def_enum(ot->srna, "vertex_paint_tool", brush_vertex_tool_items, 0, "Vertex Paint Tool", "");
RNA_def_enum(ot->srna, "weight_paint_tool", brush_vertex_tool_items, 0, "Weight Paint Tool", "");
RNA_def_enum(ot->srna, "texture_paint_tool", brush_image_tool_items, 0, "Texture Paint Tool", "");
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "Toggle between two brushes rather than cycling");
RNA_def_boolean(ot->srna, "create_missing", 0, "Create Missing", "If the requested brush type does not exist, create a new brush");
}
static wmKeyMapItem *keymap_brush_select(wmKeyMap *keymap, int paint_mode,
@ -443,6 +499,9 @@ void ED_operatortypes_paint(void)
/* partial visibility */
WM_operatortype_append(PAINT_OT_hide_show);
/* paint masking */
WM_operatortype_append(PAINT_OT_mask_flood_fill);
}
@ -576,6 +635,15 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
for (i = 0; i <= 5; i++)
RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
/* Clear mask */
kmi = WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", MKEY, KM_PRESS, KM_ALT, 0);
RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_FLOOD_VALUE);
RNA_float_set(kmi->ptr, "value", 0);
/* Invert mask */
kmi = WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_INVERT);
/* multires switch */
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEUPKEY, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "level", 1);
@ -598,6 +666,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CREASE, CKEY, KM_SHIFT);
kmi = keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_MASK, MKEY, 0);
RNA_boolean_set(kmi->ptr, "toggle", 1);
RNA_boolean_set(kmi->ptr, "create_missing", 1);
/* */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", AKEY, KM_PRESS, 0, 0);

@ -52,6 +52,7 @@
#include "DNA_brush_types.h"
#include "BKE_brush.h"
#include "BKE_ccg.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@ -123,7 +124,7 @@ int ED_sculpt_minmax(bContext *C, float *min, float *max)
/* Sculpt mode handles multires differently from regular meshes, but only if
* it's the last modifier on the stack and it is not on the first level */
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
{
Mesh *me = (Mesh *)ob->data;
ModifierData *md;
@ -257,6 +258,7 @@ typedef struct StrokeCache {
float vertex_rotation;
char saved_active_brush_name[MAX_ID_NAME];
char saved_mask_brush_tool;
int alt_smooth;
float plane_trim_squared;
@ -289,11 +291,16 @@ static void paint_mesh_restore_co(Sculpt *sd, SculptSession *ss)
if (unode) {
PBVHVertexIter vd;
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
copy_v3_v3(vd.co, unode->co[vd.i]);
if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (unode->type == SCULPT_UNDO_COORDS) {
copy_v3_v3(vd.co, unode->co[vd.i]);
if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
}
else if (unode->type == SCULPT_UNDO_MASK) {
*vd.mask = unode->mask[vd.i];
}
if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
BLI_pbvh_vertex_iter_end;
@ -639,6 +646,15 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
case SCULPT_TOOL_DRAW:
case SCULPT_TOOL_LAYER:
return alpha * flip * pressure * overlap * feather;
case SCULPT_TOOL_MASK:
overlap = (1 + overlap) / 2;
switch ((BrushMaskTool)brush->mask_tool) {
case BRUSH_MASK_DRAW:
return alpha * flip * pressure * overlap * feather;
case BRUSH_MASK_SMOOTH:
return alpha * pressure * feather;
}
case SCULPT_TOOL_CREASE:
case SCULPT_TOOL_BLOB:
@ -701,7 +717,8 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
const float len,
const float sculpt_normal[3],
const short vno[3],
const float fno[3])
const float fno[3],
const float mask)
{
MTex *mtex = &br->mtex;
float avg = 1;
@ -796,6 +813,9 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
avg *= frontface(br, sculpt_normal, vno, fno);
/* Paint mask */
avg *= 1.0f - mask;
return avg;
}
@ -882,7 +902,8 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
sculpt_brush_test_init(ss, &test);
if (ss->cache->original) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
float fno[3];
@ -893,7 +914,8 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
BLI_pbvh_vertex_iter_end;
}
else {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_fast(&test, vd.co)) {
if (vd.no) {
float fno[3];
@ -1014,7 +1036,36 @@ static void neighbor_average(SculptSession *ss, float avg[3], unsigned vert)
copy_v3_v3(avg, deform_co ? deform_co[vert] : mvert[vert].co);
}
static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node, float bstrength)
/* Similar to neighbor_average(), but returns an averaged mask value
instead of coordinate. Also does not restrict based on border or
corner vertices. */
static float neighbor_average_mask(SculptSession *ss, unsigned vert)
{
const float *vmask = ss->vmask;
float avg = 0;
int i, total = 0;
for (i = 0; i < ss->pmap[vert].count; i++) {
const MPoly *p = &ss->mpoly[ss->pmap[vert].indices[i]];
unsigned f_adj_v[3];
if (poly_get_adj_loops_from_vert(f_adj_v, p, ss->mloop, vert) != -1) {
int j;
for (j = 0; j < 3; j++) {
avg += vmask[f_adj_v[j]];
total++;
}
}
}
if (total > 0)
return avg / (float)total;
else
return vmask[vert];
}
static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node, float bstrength, int smooth_mask)
{
Brush *brush = paint_brush(&sd->paint);
PBVHVertexIter vd;
@ -1024,19 +1075,29 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
ss->cache->view_normal, vd.no, vd.fno);
float avg[3], val[3];
ss->cache->view_normal, vd.no, vd.fno,
smooth_mask ? 0 : *vd.mask);
if (smooth_mask) {
float val = neighbor_average_mask(ss, vd.vert_indices[vd.i]) - *vd.mask;
val *= fade * bstrength;
*vd.mask += val;
CLAMP(*vd.mask, 0, 1);
}
else {
float avg[3], val[3];
neighbor_average(ss, avg, vd.vert_indices[vd.i]);
sub_v3_v3v3(val, avg, vd.co);
mul_v3_fl(val, fade);
neighbor_average(ss, avg, vd.vert_indices[vd.i]);
sub_v3_v3v3(val, avg, vd.co);
mul_v3_fl(val, fade);
add_v3_v3(val, vd.co);
add_v3_v3(val, vd.co);
sculpt_clip(sd, ss, vd.co, val);
sculpt_clip(sd, ss, vd.co, val);
}
if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
@ -1045,13 +1106,16 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
BLI_pbvh_vertex_iter_end;
}
static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node, float bstrength)
static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
float bstrength, int smooth_mask)
{
Brush *brush = paint_brush(&sd->paint);
SculptBrushTest test;
DMGridData **griddata, *data;
CCGElem **griddata, *data;
CCGKey key;
DMGridAdjacency *gridadj, *adj;
float (*tmpgrid)[3], (*tmprow)[3];
float (*tmpgrid_co)[3], (*tmprow_co)[3];
float *tmpgrid_mask, *tmprow_mask;
int v1, v2, v3, v4;
int *grid_indices, totgrid, gridsize, i, x, y;
@ -1061,24 +1125,40 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
BLI_pbvh_node_get_grids(ss->pbvh, node, &grid_indices, &totgrid,
NULL, &gridsize, &griddata, &gridadj);
BLI_pbvh_get_grid_key(ss->pbvh, &key);
#pragma omp critical
{
tmpgrid = MEM_mallocN(sizeof(float) * 3 * gridsize * gridsize, "tmpgrid");
tmprow = MEM_mallocN(sizeof(float) * 3 * gridsize, "tmprow");
if (smooth_mask) {
tmpgrid_mask = MEM_mallocN(sizeof(float) * gridsize * gridsize, "tmpgrid_mask");
tmprow_mask = MEM_mallocN(sizeof(float) * gridsize, "tmprow_mask");
}
else {
tmpgrid_co = MEM_mallocN(sizeof(float) * 3 * gridsize * gridsize, "tmpgrid_co");
tmprow_co = MEM_mallocN(sizeof(float) * 3 * gridsize, "tmprow_co");
}
}
for (i = 0; i < totgrid; ++i) {
data = griddata[grid_indices[i]];
adj = &gridadj[grid_indices[i]];
memset(tmpgrid, 0, sizeof(float) * 3 * gridsize * gridsize);
if (smooth_mask)
memset(tmpgrid_mask, 0, sizeof(float) * gridsize * gridsize);
else
memset(tmpgrid_co, 0, sizeof(float) * 3 * gridsize * gridsize);
for (y = 0; y < gridsize - 1; y++) {
float tmp[3];
v1 = y * gridsize;
add_v3_v3v3(tmprow[0], data[v1].co, data[v1 + gridsize].co);
if (smooth_mask) {
tmprow_mask[0] = (*CCG_elem_offset_mask(&key, data, v1) +
*CCG_elem_offset_mask(&key, data, v1 + gridsize));
}
else {
add_v3_v3v3(tmprow_co[0],
CCG_elem_offset_co(&key, data, v1),
CCG_elem_offset_co(&key, data, v1 + gridsize));
}
for (x = 0; x < gridsize - 1; x++) {
v1 = x + y * gridsize;
@ -1086,13 +1166,31 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
v3 = v1 + gridsize;
v4 = v3 + 1;
add_v3_v3v3(tmprow[x + 1], data[v2].co, data[v4].co);
add_v3_v3v3(tmp, tmprow[x + 1], tmprow[x]);
if (smooth_mask) {
float tmp;
add_v3_v3(tmpgrid[v1], tmp);
add_v3_v3(tmpgrid[v2], tmp);
add_v3_v3(tmpgrid[v3], tmp);
add_v3_v3(tmpgrid[v4], tmp);
tmprow_mask[x + 1] = (*CCG_elem_offset_mask(&key, data, v2) +
*CCG_elem_offset_mask(&key, data, v4));
tmp = tmprow_mask[x + 1] + tmprow_mask[x];
tmpgrid_mask[v1] += tmp;
tmpgrid_mask[v2] += tmp;
tmpgrid_mask[v3] += tmp;
tmpgrid_mask[v4] += tmp;
}
else {
float tmp[3];
add_v3_v3v3(tmprow_co[x + 1],
CCG_elem_offset_co(&key, data, v2),
CCG_elem_offset_co(&key, data, v4));
add_v3_v3v3(tmp, tmprow_co[x + 1], tmprow_co[x]);
add_v3_v3(tmpgrid_co[v1], tmp);
add_v3_v3(tmpgrid_co[v2], tmp);
add_v3_v3(tmpgrid_co[v3], tmp);
add_v3_v3(tmpgrid_co[v4], tmp);
}
}
}
@ -1101,6 +1199,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
for (x = 0; x < gridsize; ++x) {
float *co;
float *fno;
float *mask;
int index;
if (x == 0 && adj->index[0] == -1)
@ -1116,33 +1215,40 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
continue;
index = x + y * gridsize;
co = data[index].co;
fno = data[index].no;
co = CCG_elem_offset_co(&key, data, index);
fno = CCG_elem_offset_no(&key, data, index);
mask = CCG_elem_offset_mask(&key, data, index);
if (sculpt_brush_test(&test, co)) {
const float strength_mask = (smooth_mask ? 0 : *mask);
const float fade = bstrength * tex_strength(ss, brush, co, test.dist,
ss->cache->view_normal, NULL, fno);
float *avg, val[3];
float n;
avg = tmpgrid[x + y * gridsize];
n = 1 / 16.0f;
ss->cache->view_normal,
NULL, fno, strength_mask);
float n = 1.0f / 16.0f;
if (x == 0 || x == gridsize - 1)
n *= 2;
if (y == 0 || y == gridsize - 1)
n *= 2;
if (smooth_mask) {
*mask += ((tmpgrid_mask[x + y * gridsize] * n) - *mask) * fade;
}
else {
float *avg, val[3];
mul_v3_fl(avg, n);
avg = tmpgrid_co[x + y * gridsize];
sub_v3_v3v3(val, avg, co);
mul_v3_fl(val, fade);
mul_v3_fl(avg, n);
add_v3_v3(val, co);
sub_v3_v3v3(val, avg, co);
mul_v3_fl(val, fade);
sculpt_clip(sd, ss, co, val);
add_v3_v3(val, co);
sculpt_clip(sd, ss, co, val);
}
}
}
}
@ -1150,12 +1256,19 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
#pragma omp critical
{
MEM_freeN(tmpgrid);
MEM_freeN(tmprow);
if (smooth_mask) {
MEM_freeN(tmpgrid_mask);
MEM_freeN(tmprow_mask);
}
else {
MEM_freeN(tmpgrid_co);
MEM_freeN(tmprow_co);
}
}
}
static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength)
static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode,
float bstrength, int smooth_mask)
{
SculptSession *ss = ob->sculpt;
const int max_iterations = 4;
@ -1172,10 +1285,13 @@ static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
for (n = 0; n < totnode; n++) {
if (ss->multires) {
do_multires_smooth_brush(sd, ss, nodes[n], iteration != count ? 1.0f : last);
do_multires_smooth_brush(sd, ss, nodes[n],
iteration != count ? 1.0f : last, smooth_mask);
}
else if (ss->pmap) {
do_mesh_smooth_brush(sd, ss, nodes[n],
iteration != count ? 1.0f : last, smooth_mask);
}
else if (ss->pmap)
do_mesh_smooth_brush(sd, ss, nodes[n], iteration != count ? 1.0f : last);
}
if (ss->multires)
@ -1186,7 +1302,54 @@ static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float
static void do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
SculptSession *ss = ob->sculpt;
smooth(sd, ob, nodes, totnode, ss->cache->bstrength);
smooth(sd, ob, nodes, totnode, ss->cache->bstrength, FALSE);
}
static void do_mask_brush_draw(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
SculptSession *ss = ob->sculpt;
Brush *brush = paint_brush(&sd->paint);
float bstrength = ss->cache->bstrength;
int n;
/* threaded loop over nodes */
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
for (n = 0; n < totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
float fade = tex_strength(ss, brush, vd.co, test.dist,
ss->cache->view_normal, vd.no, vd.fno, 0);
(*vd.mask) += fade * bstrength;
CLAMP(*vd.mask, 0, 1);
if (vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
BLI_pbvh_vertex_iter_end;
}
}
}
static void do_mask_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
SculptSession *ss = ob->sculpt;
Brush *brush = paint_brush(&sd->paint);
switch ((BrushMaskTool)brush->mask_tool) {
case BRUSH_MASK_DRAW:
do_mask_brush_draw(sd, ob, nodes, totnode);
break;
case BRUSH_MASK_SMOOTH:
smooth(sd, ob, nodes, totnode, ss->cache->bstrength, TRUE);
break;
}
}
static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
@ -1215,11 +1378,12 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
/* offset vertex */
float fade = tex_strength(ss, brush, vd.co, test.dist,
area_normal, vd.no, vd.fno);
area_normal, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], offset, fade);
@ -1271,11 +1435,12 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
/* offset vertex */
const float fade = tex_strength(ss, brush, vd.co, test.dist,
area_normal, vd.no, vd.fno);
area_normal, vd.no, vd.fno, *vd.mask);
float val1[3];
float val2[3];
@ -1313,10 +1478,12 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
ss->cache->view_normal, vd.no, vd.fno);
ss->cache->view_normal, vd.no,
vd.fno, *vd.mask);
float val[3];
sub_v3_v3v3(val, test.location, vd.co);
@ -1378,7 +1545,7 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
an, origno[vd.i], NULL);
an, origno[vd.i], NULL, *vd.mask);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
@ -1417,10 +1584,11 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
an, vd.no, vd.fno);
an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], cono, fade);
@ -1467,10 +1635,11 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
an, vd.no, vd.fno);
an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
@ -1516,10 +1685,11 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
an, origno[vd.i], NULL);
an, origno[vd.i], NULL, *vd.mask);
mul_v3_v3fl(proxy[vd.i], cono, fade);
@ -1570,10 +1740,11 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
an, origno[vd.i], NULL);
an, origno[vd.i], NULL, *vd.mask);
mul_v3_m4v3(proxy[vd.i], m, origco[vd.i]);
sub_v3_v3(proxy[vd.i], origco[vd.i]);
@ -1610,7 +1781,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
SculptUndoNode *unode;
float (*origco)[3], *layer_disp;
/* XXX: layer brush needs conversion to proxy but its more complicated */
/* proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; */
/* proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; */
unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
origco = unode->co;
@ -1623,10 +1794,11 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, origco[vd.i])) {
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
area_normal, vd.no, vd.fno);
area_normal, vd.no, vd.fno, *vd.mask);
float *disp = &layer_disp[vd.i];
float val[3];
@ -1675,10 +1847,11 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test(&test, vd.co)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
ss->cache->view_normal, vd.no, vd.fno);
ss->cache->view_normal, vd.no, vd.fno, *vd.mask);
float val[3];
if (vd.fno) copy_v3_v3(val, vd.fno);
@ -1718,7 +1891,8 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
sculpt_brush_test_init(ss, &test);
if (ss->cache->original) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
add_v3_v3(private_fc, unode->co[vd.i]);
private_count++;
@ -1727,7 +1901,8 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
BLI_pbvh_vertex_iter_end;
}
else {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_fast(&test, vd.co)) {
add_v3_v3(private_fc, vd.co);
private_count++;
@ -1783,7 +1958,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
sculpt_brush_test_init(ss, &test);
if (ss->cache->original) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
/* for area normal */
float fno[3];
@ -1799,7 +1975,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
BLI_pbvh_vertex_iter_end;
}
else {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_fast(&test, vd.co)) {
/* for area normal */
if (vd.no) {
@ -1929,7 +2106,7 @@ static void point_plane_project(float intr[3], float co[3], float plane_normal[3
static int plane_trim(StrokeCache *cache, Brush *brush, float val[3])
{
return (!(brush->flag & BRUSH_PLANE_TRIM) ||
((dot_v3v3(val, val) <= cache->radius_squared * cache->plane_trim_squared)));
((dot_v3v3(val, val) <= cache->radius_squared * cache->plane_trim_squared)));
}
static int plane_point_side_flip(float co[3], float plane_normal[3], float plane_center[3], int flip)
@ -2003,7 +2180,8 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_sq(&test, vd.co)) {
float intr[3];
float val[3];
@ -2014,7 +2192,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
if (plane_trim(ss->cache, brush, val)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist),
an, vd.no, vd.fno);
an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@ -2074,7 +2252,8 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_sq(&test, vd.co)) {
if (plane_point_side_flip(vd.co, an, fc, flip)) {
float intr[3];
@ -2087,7 +2266,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
if (plane_trim(ss->cache, brush, val)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co,
sqrt(test.dist),
an, vd.no, vd.fno);
an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@ -2175,7 +2354,8 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_cube(&test, vd.co, mat)) {
if (plane_point_side_flip(vd.co, sn, fc, flip)) {
float intr[3];
@ -2188,7 +2368,7 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
if (plane_trim(ss->cache, brush, val)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co,
ss->cache->radius * test.dist,
an, vd.no, vd.fno);
an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@ -2238,7 +2418,8 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_sq(&test, vd.co)) {
if (plane_point_side(vd.co, an, fc)) {
float intr[3];
@ -2251,7 +2432,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
if (plane_trim(ss->cache, brush, val)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co,
sqrt(test.dist),
an, vd.no, vd.fno);
an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@ -2301,7 +2482,8 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (sculpt_brush_test_sq(&test, vd.co)) {
if (!plane_point_side(vd.co, an, fc)) {
float intr[3];
@ -2314,7 +2496,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
if (plane_trim(ss->cache, brush, val)) {
const float fade = bstrength * tex_strength(ss, brush, vd.co,
sqrt(test.dist),
an, vd.no, vd.fno);
an, vd.no, vd.fno, *vd.mask);
mul_v3_v3fl(proxy[vd.i], val, fade);
@ -2373,8 +2555,8 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
copy_v3_v3(mvert->co, vertCos[a]);
BKE_mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop,
me->mpoly, me->totloop, me->totpoly,
NULL, NULL, 0, NULL, NULL);
me->mpoly, me->totloop, me->totpoly,
NULL, NULL, 0, NULL, NULL);
}
/* apply new coords on active key block */
@ -2393,17 +2575,19 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
data.sd = sd;
data.radius_squared = ss->cache->radius_squared;
data.original = ELEM4(brush->sculpt_tool,
SCULPT_TOOL_GRAB,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_THUMB,
SCULPT_TOOL_LAYER);
SCULPT_TOOL_GRAB,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_THUMB,
SCULPT_TOOL_LAYER);
BLI_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
/* Only act if some verts are inside the brush area */
if (totnode) {
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
for (n = 0; n < totnode; n++) {
sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
sculpt_undo_push_node(ob, nodes[n],
brush->sculpt_tool == SCULPT_TOOL_MASK ?
SCULPT_UNDO_MASK : SCULPT_UNDO_COORDS);
BLI_pbvh_node_mark_update(nodes[n]);
}
@ -2460,14 +2644,18 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
case SCULPT_TOOL_SCRAPE:
do_scrape_brush(sd, ob, nodes, totnode);
break;
case SCULPT_TOOL_MASK:
do_mask_brush(sd, ob, nodes, totnode);
break;
}
if (brush->sculpt_tool != SCULPT_TOOL_SMOOTH && brush->autosmooth_factor > 0) {
if (!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_MASK) &&
brush->autosmooth_factor > 0) {
if (brush->flag & BRUSH_INVERSE_SMOOTH_PRESSURE) {
smooth(sd, ob, nodes, totnode, brush->autosmooth_factor * (1 - ss->cache->pressure));
smooth(sd, ob, nodes, totnode, brush->autosmooth_factor * (1 - ss->cache->pressure), FALSE);
}
else {
smooth(sd, ob, nodes, totnode, brush->autosmooth_factor);
smooth(sd, ob, nodes, totnode, brush->autosmooth_factor, FALSE);
}
}
@ -2520,7 +2708,8 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
BLI_pbvh_node_get_proxies(nodes[n], &proxies, &proxy_count);
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
float val[3];
int p;
@ -2590,7 +2779,8 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
for (n = 0; n < totnode; n++) {
PBVHVertexIter vd;
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
{
sculpt_flush_pbvhvert_deform(ob, &vd);
if (vertCos) {
@ -2634,8 +2824,8 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
* XXX However, a different approach appears to be needed */
#if 0
if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
float frac = 1.0f/max_overlap_count(sd);
float reduce = (feather-frac)/(1-frac);
float frac = 1.0f / max_overlap_count(sd);
float reduce = (feather - frac) / (1 - frac);
printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
@ -2771,6 +2961,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
ss->mloop = me->mloop;
ss->face_normals = NULL;
ss->multires = NULL;
ss->vmask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
}
/* BMESH ONLY --- at some point we should move sculpt code to use polygons only - but for now it needs tessfaces */
@ -2894,7 +3085,7 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
ss->cache->clip_tolerance[i])
{
ss->cache->clip_tolerance[i] =
mmd->tolerance;
mmd->tolerance;
}
}
}
@ -2947,15 +3138,22 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
/* Alt-Smooth */
if (ss->cache->alt_smooth) {
Paint *p = &sd->paint;
Brush *br;
if (brush->sculpt_tool == SCULPT_TOOL_MASK) {
cache->saved_mask_brush_tool = brush->mask_tool;
brush->mask_tool = BRUSH_MASK_SMOOTH;
}
else {
Paint *p = &sd->paint;
Brush *br;
BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name));
BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2,
sizeof(cache->saved_active_brush_name));
br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth");
if (br) {
paint_brush_set(p, br);
brush = br;
br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth");
if (br) {
paint_brush_set(p, br);
brush = br;
}
}
}
@ -3142,8 +3340,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
if (cache->first_time) {
if (!BKE_brush_use_locked_size(scene, brush)) {
cache->initial_radius = paint_calc_object_space_radius(cache->vc,
cache->true_location,
BKE_brush_size_get(scene, brush));
cache->true_location,
BKE_brush_size_get(scene, brush));
BKE_brush_unprojected_radius_set(scene, brush, cache->initial_radius);
}
else {
@ -3370,6 +3568,8 @@ static int sculpt_brush_stroke_init(bContext *C, wmOperator *op)
is_smooth |= mode == BRUSH_STROKE_SMOOTH;
is_smooth |= brush->sculpt_tool == SCULPT_TOOL_SMOOTH;
is_smooth |= ((brush->sculpt_tool == SCULPT_TOOL_MASK) &&
(brush->mask_tool == BRUSH_MASK_SMOOTH));
sculpt_update_mesh_elements(scene, sd, ob, is_smooth);
@ -3516,10 +3716,15 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
/* Alt-Smooth */
if (ss->cache->alt_smooth) {
Paint *p = &sd->paint;
brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name);
if (brush) {
paint_brush_set(p, brush);
if (brush->sculpt_tool == SCULPT_TOOL_MASK) {
brush->mask_tool = ss->cache->saved_mask_brush_tool;
}
else {
Paint *p = &sd->paint;
brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name);
if (brush) {
paint_brush_set(p, brush);
}
}
}
@ -3696,6 +3901,71 @@ static void sculpt_init_session(Scene *scene, Object *ob)
sculpt_update_mesh_elements(scene, scene->toolsettings->sculpt, ob, 0);
}
void ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
{
float *paint_mask;
Mesh *me = ob->data;
paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
/* if multires is active, create a grid paint mask layer if there
isn't one already */
if (mmd && !CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) {
GridPaintMask *gmask;
int level = MAX2(1, mmd->sculptlvl);
int gridsize = ccg_gridsize(level);
int gridarea = gridsize * gridsize;
int i, j;
gmask = CustomData_add_layer(&me->ldata, CD_GRID_PAINT_MASK,
CD_CALLOC, NULL, me->totloop);
for (i = 0; i < me->totloop; i++) {
GridPaintMask *gpm = &gmask[i];
gpm->level = level;
gpm->data = MEM_callocN(sizeof(float) * gridarea,
"GridPaintMask.data");
}
/* if vertices already have mask, copy into multires data */
if (paint_mask) {
for (i = 0; i < me->totpoly; i++) {
const MPoly *p = &me->mpoly[i];
float avg = 0;
/* mask center */
for (j = 0; j < p->totloop; j++) {
const MLoop *l = &me->mloop[p->loopstart + j];
avg += paint_mask[l->v];
}
avg /= (float)p->totloop;
/* fill in multires mask corner */
for (j = 0; j < p->totloop; j++) {
GridPaintMask *gpm = &gmask[p->loopstart + j];
const MLoop *l = &me->mloop[p->loopstart + j];
const MLoop *prev = ME_POLY_LOOP_PREV(me->mloop, p, j);
const MLoop *next = ME_POLY_LOOP_NEXT(me->mloop, p, j);
gpm->data[0] = avg;
gpm->data[1] = (paint_mask[l->v] +
paint_mask[next->v]) * 0.5f;
gpm->data[2] = (paint_mask[l->v] +
paint_mask[prev->v]) * 0.5f;
gpm->data[3] = paint_mask[l->v];
}
}
}
}
/* create vertex paint mask layer if there isn't one already */
if (!paint_mask) {
CustomData_add_layer(&me->vdata, CD_PAINT_MASK,
CD_CALLOC, NULL, me->totvert);
}
}
static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
@ -3742,6 +4012,9 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
sculpt_init_session(scene, ob);
/* Mask layer is required */
ED_sculpt_mask_layers_ensure(ob, mmd);
paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT);
paint_cursor_start(C, sculpt_poll);

@ -53,7 +53,7 @@ struct SculptStroke;
/* Interface */
struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct Object *ob);
void sculpt(Sculpt *sd);
void sculpt(struct Sculpt *sd);
int sculpt_mode_poll(struct bContext *C);
int sculpt_poll(struct bContext *C);
@ -69,7 +69,8 @@ int sculpt_stroke_get_location(bContext *C, float out[3], float mouse[2]);
typedef enum {
SCULPT_UNDO_COORDS,
SCULPT_UNDO_HIDDEN
SCULPT_UNDO_HIDDEN,
SCULPT_UNDO_MASK
} SculptUndoType;
typedef struct SculptUndoNode {
@ -77,24 +78,25 @@ typedef struct SculptUndoNode {
SculptUndoType type;
char idname[MAX_ID_NAME]; /* name instead of pointer*/
void *node; /* only during push, not valid afterwards! */
char idname[MAX_ID_NAME]; /* name instead of pointer*/
void *node; /* only during push, not valid afterwards! */
float (*co)[3];
float (*orig_co)[3];
short (*no)[3];
float *mask;
int totvert;
/* non-multires */
int maxvert; /* to verify if totvert it still the same */
int *index; /* to restore into right location */
int maxvert; /* to verify if totvert it still the same */
int *index; /* to restore into right location */
BLI_bitmap vert_hidden;
/* multires */
int maxgrid; /* same for grid */
int gridsize; /* same for grid */
int totgrid; /* to restore into right location */
int *grids; /* to restore into right location */
int maxgrid; /* same for grid */
int gridsize; /* same for grid */
int totgrid; /* to restore into right location */
int *grids; /* to restore into right location */
BLI_bitmap *grid_hidden;
/* layer brush */

@ -47,6 +47,7 @@
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
#include "BKE_ccg.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@ -77,9 +78,9 @@ static void update_cb(PBVHNode *node, void *rebuild)
}
static void sculpt_undo_restore_deformed(const SculptSession *ss,
SculptUndoNode *unode,
int uindex, int oindex,
float coord[3])
SculptUndoNode *unode,
int uindex, int oindex,
float coord[3])
{
if (unode->orig_co) {
swap_v3_v3(coord, unode->orig_co[uindex]);
@ -157,19 +158,21 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
}
else if (unode->maxgrid && dm->getGridData) {
/* multires restore */
DMGridData **grids, *grid;
CCGElem **grids, *grid;
CCGKey key;
float (*co)[3];
int gridsize;
grids = dm->getGridData(dm);
gridsize = dm->getGridSize(dm);
dm->getGridKey(dm, &key);
co = unode->co;
for (j = 0; j < unode->totgrid; j++) {
grid = grids[unode->grids[j]];
for (i = 0; i < gridsize * gridsize; i++, co++)
swap_v3_v3(grid[i].co, co[0]);
swap_v3_v3(CCG_elem_offset_co(&key, grid, i), co[0]);
}
}
@ -214,6 +217,49 @@ static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm,
return 1;
}
static int sculpt_undo_restore_mask(bContext *C, DerivedMesh *dm, SculptUndoNode *unode)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
MVert *mvert;
float *vmask;
int *index, i, j;
if (unode->maxvert) {
/* regular mesh restore */
index = unode->index;
mvert = ss->mvert;
vmask = ss->vmask;
for (i = 0; i < unode->totvert; i++) {
SWAP(float, vmask[index[i]], unode->mask[i]);
mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
}
}
else if (unode->maxgrid && dm->getGridData) {
/* multires restore */
CCGElem **grids, *grid;
CCGKey key;
float *mask;
int gridsize;
grids = dm->getGridData(dm);
gridsize = dm->getGridSize(dm);
dm->getGridKey(dm, &key);
mask = unode->mask;
for (j = 0; j < unode->totgrid; j++) {
grid = grids[unode->grids[j]];
for (i = 0; i < gridsize * gridsize; i++, mask++)
SWAP(float, *CCG_elem_offset_mask(&key, grid, i), *mask);
}
}
return 1;
}
static void sculpt_undo_restore(bContext *C, ListBase *lb)
{
Scene *scene = CTX_data_scene(C);
@ -257,6 +303,10 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
if (sculpt_undo_restore_hidden(C, dm, unode))
rebuild = 1;
break;
case SCULPT_UNDO_MASK:
if (sculpt_undo_restore_mask(C, dm, unode))
update = 1;
break;
}
}
@ -321,6 +371,8 @@ static void sculpt_undo_free(ListBase *lb)
}
MEM_freeN(unode->grid_hidden);
}
if (unode->mask)
MEM_freeN(unode->mask);
}
}
@ -389,9 +441,9 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
unode->co = MEM_mapallocN(sizeof(float) * 3 * allvert, "SculptUndoNode.co");
unode->no = MEM_mapallocN(sizeof(short) * 3 * allvert, "SculptUndoNode.no");
undo_paint_push_count_alloc(UNDO_PAINT_MESH,
(sizeof(float) * 3 +
sizeof(short) * 3 +
sizeof(int)) * allvert);
(sizeof(float) * 3 +
sizeof(short) * 3 +
sizeof(int)) * allvert);
break;
case SCULPT_UNDO_HIDDEN:
if (maxgrid)
@ -400,6 +452,10 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
unode->vert_hidden = BLI_BITMAP_NEW(allvert, "SculptUndoNode.vert_hidden");
break;
case SCULPT_UNDO_MASK:
unode->mask = MEM_mapallocN(sizeof(float) * allvert, "SculptUndoNode.mask");
undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float) * sizeof(int)) * allvert);
break;
}
BLI_addtail(lb, unode);
@ -428,7 +484,8 @@ static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL) {
BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
{
copy_v3_v3(unode->co[vd.i], vd.co);
if (vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
else normal_float_to_short_v3(unode->no[vd.i], vd.fno);
@ -461,6 +518,18 @@ static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
}
}
static void sculpt_undo_store_mask(Object *ob, SculptUndoNode *unode)
{
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
{
unode->mask[vd.i] = *vd.mask;
}
BLI_pbvh_vertex_iter_end;
}
SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
SculptUndoType type)
{
@ -501,6 +570,9 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
case SCULPT_UNDO_HIDDEN:
sculpt_undo_store_hidden(ob, unode);
break;
case SCULPT_UNDO_MASK:
sculpt_undo_store_mask(ob, unode);
break;
}
/* store active shape key */

@ -456,16 +456,11 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf)
if (need_rebind) {
int width = ibuf->x, height = ibuf->y;
float *frect = NULL, *fscalerect = NULL;
unsigned int *rect = NULL, *scalerect = NULL;
int need_recreate = 0;
if (width > GL_MAX_TEXTURE_SIZE || height > GL_MAX_TEXTURE_SIZE)
return 0;
rect = ibuf->rect;
frect = ibuf->rect_float;
/* if image resolution changed (e.g. switched to proxy display) texture need to be recreated */
need_recreate = context->image_width != ibuf->x || context->image_height != ibuf->y;
@ -498,10 +493,13 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf)
glBindTexture(GL_TEXTURE_2D, context->texture);
}
if (frect)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, width, height, 0, GL_RGBA, GL_FLOAT, frect);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
if (ibuf->rect_float) {
if (ibuf->rect == NULL)
IMB_rect_from_float(ibuf);
}
if (ibuf->rect)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
/* store settings */
context->texture_allocated = 1;
@ -509,11 +507,6 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf)
context->image_width = ibuf->x;
context->image_height = ibuf->y;
context->framenr = sc->user.framenr;
if (fscalerect)
MEM_freeN(fscalerect);
if (scalerect)
MEM_freeN(scalerect);
}
else {
/* displaying exactly the same image which was loaded t oa texture,

@ -58,6 +58,7 @@ void CONSOLE_OT_history_append(struct wmOperatorType *ot);
void CONSOLE_OT_scrollback_append(struct wmOperatorType *ot);
void CONSOLE_OT_clear(struct wmOperatorType *ot);
void CONSOLE_OT_clear_line(struct wmOperatorType *ot);
void CONSOLE_OT_history_cycle(struct wmOperatorType *ot);
void CONSOLE_OT_copy(struct wmOperatorType *ot);
void CONSOLE_OT_paste(struct wmOperatorType *ot);

@ -519,6 +519,39 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", console_delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
}
static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
ARegion *ar = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
if (ci->len == 0) {
return OPERATOR_CANCELLED;
}
console_history_add(C, ci);
console_history_add(C, NULL);
console_textview_update_rect(sc, ar);
ED_area_tag_redraw(CTX_wm_area(C));
console_scroll_bottom(ar);
return OPERATOR_FINISHED;
}
void CONSOLE_OT_clear_line(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Line";
ot->description = "Clear the line and store in history";
ot->idname = "CONSOLE_OT_clear_line";
/* api callbacks */
ot->exec = console_clear_line_exec;
ot->poll = ED_operator_console_active;
}
/* the python exec operator uses this */
static int console_clear_exec(bContext *C, wmOperator *op)
@ -571,7 +604,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
SpaceConsole *sc = CTX_wm_space_console(C);
ARegion *ar = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevernts crashes when no command line */
ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevents crashes when no command line */
short reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
int prev_len = ci->len;
@ -584,7 +617,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
console_history_free(sc, ci_prev);
}
if (reverse) { /* last item in mistory */
if (reverse) { /* last item in history */
ci = sc->history.last;
BLI_remlink(&sc->history, ci);
BLI_addhead(&sc->history, ci);

@ -250,8 +250,9 @@ static void console_operatortypes(void)
/* for use by python only */
WM_operatortype_append(CONSOLE_OT_history_append);
WM_operatortype_append(CONSOLE_OT_scrollback_append);
WM_operatortype_append(CONSOLE_OT_clear);
WM_operatortype_append(CONSOLE_OT_clear);
WM_operatortype_append(CONSOLE_OT_clear_line);
WM_operatortype_append(CONSOLE_OT_history_cycle);
WM_operatortype_append(CONSOLE_OT_copy);
WM_operatortype_append(CONSOLE_OT_paste);
@ -312,6 +313,8 @@ static void console_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD);
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_PREV_WORD);
WM_keymap_add_item(keymap, "CONSOLE_OT_clear_line", RETKEY, KM_PRESS, KM_SHIFT, 0);
#ifdef WITH_PYTHON
WM_keymap_add_item(keymap, "CONSOLE_OT_execute", RETKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
WM_keymap_add_item(keymap, "CONSOLE_OT_execute", PADENTER, KM_PRESS, 0, 0);

@ -277,11 +277,17 @@ void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename)
}
else {
int len = strlen(line);
if (len>0) {
if (line[len-1] == '\n') {
line[len-1] = '\0';
if (len > 0) {
if (line[len - 1] == '\n') {
line[len - 1] = '\0';
}
if (BLI_exists(line)) {
/* don't do this because it can be slow on network drives,
* having a bookmark from a drive thats ejected or so isn't
* all _that_ bad */
#if 0
if (BLI_exists(line))
#endif
{
fsmenu_insert_entry(fsmenu, category, line, 0, 1);
}
}

@ -1262,9 +1262,6 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
}
col= uiLayoutColumn(layout, 0);
if (RNA_enum_get(&imaptr, "type")== IMA_TYPE_MULTILAYER)
uiItemR(col, ptr, "layer", 0, NULL, ICON_NONE);
}
static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr)
@ -1709,25 +1706,30 @@ static void node_draw_input_file_output(const bContext *C, uiBlock *block,
bNodeTree *ntree, bNode *node, bNodeSocket *sock,
const char *UNUSED(name), int x, int y, int width)
{
NodeImageMultiFileSocket *input = sock->storage;
uiLayout *layout, *row;
PointerRNA nodeptr, inputptr, imfptr;
int imtype;
int rx, ry;
RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr);
RNA_pointer_create(&ntree->id, &RNA_NodeImageFileSocket, input, &inputptr);
layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y+NODE_DY, width, 20, UI_GetStyle());
row = uiLayoutRow(layout, 0);
uiItemL(row, input->path, 0);
row = uiLayoutRow(layout, 0);
imfptr = RNA_pointer_get(&nodeptr, "format");
imtype = RNA_enum_get(&imfptr, "file_format");
/* in multilayer format all socket format details are ignored */
if (imtype != R_IMF_IMTYPE_MULTILAYER) {
if (imtype == R_IMF_IMTYPE_MULTILAYER) {
NodeImageMultiFileSocket *input = sock->storage;
RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotLayer, input, &inputptr);
uiItemL(row, input->layer, 0);
}
else {
NodeImageMultiFileSocket *input = sock->storage;
PropertyRNA *imtype_prop;
const char *imtype_name;
RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotFile, input, &inputptr);
uiItemL(row, input->path, 0);
if (!RNA_boolean_get(&inputptr, "use_node_format"))
imfptr = RNA_pointer_get(&inputptr, "format");
@ -1767,10 +1769,18 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
uiItemO(layout, "Add Input", ICON_ZOOMIN, "NODE_OT_output_file_add_socket");
uiTemplateList(layout, C, ptr, "file_inputs", ptr, "active_input_index", NULL, 0, 0, 0);
active_index = RNA_int_get(ptr, "active_input_index");
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_inputs"), active_index, &active_input_ptr);
/* using different collection properties if multilayer format is enabled */
if (multilayer) {
uiTemplateList(layout, C, ptr, "layer_slots", ptr, "active_input_index", NULL, 0, 0, 0);
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"), active_index, &active_input_ptr);
}
else {
uiTemplateList(layout, C, ptr, "file_slots", ptr, "active_input_index", NULL, 0, 0, 0);
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"), active_index, &active_input_ptr);
}
/* XXX collection lookup does not return the ID part of the pointer, setting this manually here */
active_input_ptr.id.data = ptr->id.data;
row = uiLayoutRow(layout, 1);
op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
@ -1779,19 +1789,25 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
RNA_enum_set(&op_ptr, "direction", 2);
if (active_input_ptr.data) {
uiLayout *row, *col;
col = uiLayoutColumn(layout, 1);
if (multilayer)
uiItemL(col, "Layer Name:", 0);
else
if (multilayer) {
uiLayout *row, *col;
col = uiLayoutColumn(layout, 1);
uiItemL(col, "Layer:", 0);
row = uiLayoutRow(col, 0);
uiItemR(row, &active_input_ptr, "name", 0, "", 0);
uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
}
else {
uiLayout *row, *col;
col = uiLayoutColumn(layout, 1);
uiItemL(col, "File Path:", 0);
row = uiLayoutRow(col, 0);
uiItemR(row, &active_input_ptr, "path", 0, "", 0);
uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
/* in multilayer format all socket format details are ignored */
if (!multilayer) {
row = uiLayoutRow(col, 0);
uiItemR(row, &active_input_ptr, "path", 0, "", 0);
uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
/* format details for individual files */
imfptr = RNA_pointer_get(&active_input_ptr, "format");
col = uiLayoutColumn(layout, 1);

@ -585,7 +585,7 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(t
static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
Sequence *seq, *p;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
seq = (Sequence *)te->directdata;
if (set == 0) {

@ -1508,7 +1508,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
}
else if (soops->outlinevis == SO_SEQUENCE) {
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
int op;
if (ed == NULL)

@ -106,7 +106,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
{
if (RNA_struct_find_property(op->ptr, identifier)) {
Scene *scene = CTX_data_scene(C);
Sequence *last_seq = seq_active_get(scene);
Sequence *last_seq = BKE_sequencer_active_get(scene);
if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
char path[sizeof(last_seq->strip->dir)];
BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
@ -203,7 +203,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE);
Editing *ed = BKE_sequencer_editing_get(scene, TRUE);
Scene *sce_seq;
@ -239,11 +239,11 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0);
calc_sequence_disp(scene, seq);
sort_seq(scene);
BKE_sequencer_sort(scene);
if (RNA_boolean_get(op->ptr, "replace_sel")) {
deselect_all_seq(scene);
seq_active_set(scene, seq);
BKE_sequencer_active_set(scene, seq);
seq->flag |= SELECT;
}
@ -302,7 +302,7 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE);
Editing *ed = BKE_sequencer_editing_get(scene, TRUE);
MovieClip *clip;
@ -338,11 +338,11 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
seqbase_unique_name_recursive(&ed->seqbase, seq);
calc_sequence_disp(scene, seq);
sort_seq(scene);
BKE_sequencer_sort(scene);
if (RNA_boolean_get(op->ptr, "replace_sel")) {
deselect_all_seq(scene);
seq_active_set(scene, seq);
BKE_sequencer_active_set(scene, seq);
seq->flag |= SELECT;
}
@ -401,7 +401,7 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
{
Scene *scene = CTX_data_scene(C); /* only for sound */
Editing *ed = seq_give_editing(scene, TRUE);
Editing *ed = BKE_sequencer_editing_get(scene, TRUE);
SeqLoadInfo seq_load;
Sequence *seq;
int tot_files;
@ -453,7 +453,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
return OPERATOR_CANCELLED;
}
sort_seq(scene);
BKE_sequencer_sort(scene);
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@ -575,7 +575,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
/* cant use the generic function for this */
Scene *scene = CTX_data_scene(C); /* only for sound */
Editing *ed = seq_give_editing(scene, TRUE);
Editing *ed = BKE_sequencer_editing_get(scene, TRUE);
SeqLoadInfo seq_load;
Sequence *seq;
@ -616,7 +616,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
calc_sequence_disp(scene, seq);
sort_seq(scene);
BKE_sequencer_sort(scene);
/* last active name */
strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1);
@ -678,7 +678,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE);
Editing *ed = BKE_sequencer_editing_get(scene, TRUE);
Sequence *seq; /* generic strip vars */
Strip *strip;
@ -779,11 +779,11 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
/* not sure if this is needed with update_changed_seq_and_deps.
* it was NOT called in blender 2.4x, but wont hurt */
sort_seq(scene);
BKE_sequencer_sort(scene);
if (RNA_boolean_get(op->ptr, "replace_sel")) {
deselect_all_seq(scene);
seq_active_set(scene, seq);
BKE_sequencer_active_set(scene, seq);
seq->flag |= SELECT;
}

@ -1062,7 +1062,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
{
Scene *scene = CTX_data_scene(C);
View2D *v2d = &ar->v2d;
Sequence *last_seq = seq_active_get(scene);
Sequence *last_seq = BKE_sequencer_active_get(scene);
int sel = 0, j;
float pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
@ -1122,7 +1122,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
void draw_timeline_seq(const bContext *C, ARegion *ar)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
SpaceSeq *sseq = CTX_wm_space_seq(C);
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;

@ -163,7 +163,7 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
static void proxy_endjob(void *pjv)
{
ProxyJob *pj = pjv;
Editing *ed = seq_give_editing(pj->scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(pj->scene, FALSE);
LinkData *link;
for (link = pj->queue.first; link; link = link->next) {
@ -180,7 +180,7 @@ static void seq_proxy_build_job(const bContext *C)
wmJob *steve;
ProxyJob *pj;
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
ScrArea *sa = CTX_wm_area(C);
struct SeqIndexBuildContext *context;
LinkData *link;
@ -233,9 +233,9 @@ void seq_rectf(Sequence *seq, rctf *rectf)
static void UNUSED_FUNCTION(change_plugin_seq) (Scene * scene, char *str) /* called from fileselect */
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
struct SeqEffectHandle sh;
Sequence *last_seq = seq_active_get(scene);
Sequence *last_seq = BKE_sequencer_active_get(scene);
if (last_seq == NULL || last_seq->type != SEQ_PLUGIN) return;
@ -255,7 +255,7 @@ static void UNUSED_FUNCTION(change_plugin_seq) (Scene * scene, char *str) /* cal
void boundbox_seq(Scene *scene, rctf *rect)
{
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
float min[2], max[2];
@ -302,7 +302,7 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
{
/* sel - 0==unselected, 1==selected, -1==done care*/
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed == NULL) return NULL;
@ -334,7 +334,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
{
/* sel - 0==unselected, 1==selected, -1==done care*/
Sequence *seq, *best_seq = NULL;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
int dist, best_dist;
best_dist = MAXFRAME * 2;
@ -382,7 +382,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2])
{
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
float x, y;
float pixelx;
float handsize;
@ -457,7 +457,7 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq)
void deselect_all_seq(Scene *scene)
{
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed == NULL) return;
@ -489,13 +489,13 @@ void recurs_sel_seq(Sequence *seqm)
int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, const char **error_str)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq1 = NULL, *seq2 = NULL, *seq3 = NULL, *seq;
*error_str = NULL;
if (!activeseq)
seq2 = seq_active_get(scene);
seq2 = BKE_sequencer_active_get(scene);
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
@ -597,14 +597,14 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short deleteall)
{
Sequence *seq, *seqn;
Sequence *last_seq = seq_active_get(scene);
Sequence *last_seq = BKE_sequencer_active_get(scene);
seq = lb->first;
while (seq) {
seqn = seq->next;
if ((seq->flag & flag) || deleteall) {
BLI_remlink(lb, seq);
if (seq == last_seq) seq_active_set(scene, NULL);
if (seq == last_seq) BKE_sequencer_active_set(scene, NULL);
if (seq->type == SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
seq_free_sequence(scene, seq);
}
@ -839,7 +839,7 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe
static int insert_gap(Scene *scene, int gap, int cfra)
{
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
int done = 0;
/* all strips >= cfra are shifted */
@ -862,7 +862,7 @@ static int insert_gap(Scene *scene, int gap, int cfra)
static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene)
{
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
char str[256];
/* touch all strips with movies */
@ -894,7 +894,7 @@ static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene)
static void set_filter_seq(Scene *scene)
{
Sequence *seq;
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed == NULL) return;
@ -918,8 +918,8 @@ static void set_filter_seq(Scene *scene)
static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene)
{
Sequence *seq, *last_seq = seq_active_get(scene);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *last_seq = BKE_sequencer_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX];
@ -960,7 +960,7 @@ static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene)
static void UNUSED_FUNCTION(no_gaps) (Scene * scene)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
int cfra, first = 0, done;
@ -1001,14 +1001,14 @@ static int seq_get_snaplimit(View2D *v2d)
/* Operator functions */
int sequencer_edit_poll(bContext *C)
{
return (seq_give_editing(CTX_data_scene(C), FALSE) != NULL);
return (BKE_sequencer_editing_get(CTX_data_scene(C), FALSE) != NULL);
}
#if 0 /* UNUSED */
int sequencer_strip_poll(bContext *C)
{
Editing *ed;
return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL));
return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL));
}
#endif
@ -1016,13 +1016,13 @@ int sequencer_strip_has_path_poll(bContext *C)
{
Editing *ed;
Sequence *seq;
return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), FALSE)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
}
int sequencer_view_poll(bContext *C)
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
Editing *ed = seq_give_editing(CTX_data_scene(C), FALSE);
Editing *ed = BKE_sequencer_editing_get(CTX_data_scene(C), FALSE);
if (ed && sseq && (sseq->mainb == SEQ_DRAW_IMG_IMBUF))
return 1;
@ -1034,7 +1034,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
int snap_frame;
@ -1084,7 +1084,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
}
/* as last: */
sort_seq(scene);
BKE_sequencer_sort(scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@ -1125,7 +1125,7 @@ void SEQUENCER_OT_snap(struct wmOperatorType *ot)
static int sequencer_mute_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
int selected;
@ -1172,7 +1172,7 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
static int sequencer_unmute_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
int selected;
@ -1219,7 +1219,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@ -1252,7 +1252,7 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot)
static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@ -1285,7 +1285,7 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
static int sequencer_reload_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
int adjust_length = RNA_boolean_get(op->ptr, "adjust_length");
@ -1331,7 +1331,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot)
static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
@ -1355,7 +1355,7 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene);
Sequence *seq1, *seq2, *seq3, *last_seq = BKE_sequencer_active_get(scene);
const char *error_msg;
if (!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
@ -1385,10 +1385,10 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
static int sequencer_effect_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed) {
Sequence *last_seq = seq_active_get(scene);
Sequence *last_seq = BKE_sequencer_active_get(scene);
if (last_seq && (last_seq->type & SEQ_EFFECT)) {
return 1;
}
@ -1416,7 +1416,7 @@ void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot)
static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Sequence *seq, *last_seq = seq_active_get(scene);
Sequence *seq, *last_seq = BKE_sequencer_active_get(scene);
if (last_seq->seq1 == NULL || last_seq->seq2 == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");
@ -1459,7 +1459,7 @@ static EnumPropertyItem prop_cut_types[] = {
static int sequencer_cut_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
int cut_side, cut_hard, cut_frame;
ListBase newlist;
@ -1499,7 +1499,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
SEQ_END;
}
/* as last: */
sort_seq(scene);
BKE_sequencer_sort(scene);
}
if (changed) {
@ -1567,7 +1567,7 @@ static int apply_unique_name_cb(Sequence *seq, void *arg_pt)
static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
ListBase nseqbase = {NULL, NULL};
@ -1624,12 +1624,12 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
MetaStack *ms;
int nothingSelected = TRUE;
seq = seq_active_get(scene);
seq = BKE_sequencer_active_get(scene);
if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */
nothingSelected = FALSE;
}
@ -1695,7 +1695,7 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
/* for effects, try to find a replacement input */
@ -1747,7 +1747,7 @@ void SEQUENCER_OT_offset_clear(wmOperatorType *ot)
static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *seq_new;
Strip *strip_new;
@ -1811,7 +1811,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
}
/* as last: */
sort_seq(scene);
BKE_sequencer_sort(scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@ -1843,8 +1843,8 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *last_seq = seq_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *last_seq = BKE_sequencer_active_get(scene);
MetaStack *ms;
if (last_seq && last_seq->type == SEQ_META && last_seq->flag & SELECT) {
@ -1856,7 +1856,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
ed->seqbasep = &last_seq->seqbase;
seq_active_set(scene, NULL);
BKE_sequencer_active_set(scene, NULL);
}
else {
@ -1876,7 +1876,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
for (seq = ed->seqbasep->first; seq; seq = seq->next)
calc_sequence(scene, seq);
seq_active_set(scene, ms->parseq);
BKE_sequencer_active_set(scene, ms->parseq);
ms->parseq->flag |= SELECT;
recurs_sel_seq(ms->parseq);
@ -1911,9 +1911,9 @@ void SEQUENCER_OT_meta_toggle(wmOperatorType *ot)
static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *seqm, *next, *last_seq = seq_active_get(scene);
Sequence *seq, *seqm, *next, *last_seq = BKE_sequencer_active_get(scene);
int channel_max = 1;
if (seqbase_isolated_sel_check(ed->seqbasep) == FALSE) {
@ -1944,7 +1944,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
seqm->strip = MEM_callocN(sizeof(Strip), "metastrip");
seqm->strip->us = 1;
seq_active_set(scene, seqm);
BKE_sequencer_active_set(scene, seqm);
if (seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
@ -1987,9 +1987,9 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm)
static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *last_seq = seq_active_get(scene); /* last_seq checks ed==NULL */
Sequence *seq, *last_seq = BKE_sequencer_active_get(scene); /* last_seq checks ed==NULL */
if (last_seq == NULL || last_seq->type != SEQ_META)
return OPERATOR_CANCELLED;
@ -2020,7 +2020,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
}
}
sort_seq(scene);
BKE_sequencer_sort(scene);
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@ -2225,7 +2225,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
View2D *v2d = UI_view2d_fromcontext(C);
ScrArea *area = CTX_wm_area(C);
bScreen *sc = CTX_wm_screen(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
int xmin = MAXFRAME * 2;
@ -2300,7 +2300,7 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot)
static int find_next_prev_edit(Scene *scene, int cfra, int side)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *best_seq = NULL, *frame_seq = NULL;
int dist, best_dist;
@ -2427,7 +2427,7 @@ static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
#if 0
static Sequence *sequence_find_parent(Scene *scene, Sequence *child)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *parent = NULL;
Sequence *seq;
@ -2447,8 +2447,8 @@ static Sequence *sequence_find_parent(Scene *scene, Sequence *child)
static int sequencer_swap_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *active_seq = seq_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *active_seq = BKE_sequencer_active_get(scene);
Sequence *seq, *iseq;
int side = RNA_enum_get(op->ptr, "side");
@ -2492,7 +2492,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
sort_seq(scene);
BKE_sequencer_sort(scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@ -2524,7 +2524,7 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
{
int retval = OPERATOR_CANCELLED;
Scene *scene = CTX_data_scene(C);
Sequence *active_seq = seq_active_get(scene);
Sequence *active_seq = BKE_sequencer_active_get(scene);
StripElem *se = NULL;
if (active_seq == NULL)
@ -2596,7 +2596,7 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq)
static int sequencer_copy_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
ListBase nseqbase = {NULL, NULL};
@ -2660,7 +2660,7 @@ void SEQUENCER_OT_copy(wmOperatorType *ot)
static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE); /* create if needed */
Editing *ed = BKE_sequencer_editing_get(scene, TRUE); /* create if needed */
ListBase nseqbase = {NULL, NULL};
int ofs;
Sequence *iseq;
@ -2716,7 +2716,7 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
Sequence *seq_other;
const char *error_msg;
if (seq_active_pair_get(scene, &seq_act, &seq_other) == 0) {
if (BKE_sequencer_active_get_pair(scene, &seq_act, &seq_other) == 0) {
BKE_report(op->reports, RPT_ERROR, "Must select 2 strips");
return OPERATOR_CANCELLED;
}
@ -2764,7 +2764,7 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot)
static int view_ghost_border_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
View2D *v2d = UI_view2d_fromcontext(C);
rctf rect;
@ -2856,8 +2856,8 @@ static EnumPropertyItem prop_change_effect_input_types[] = {
static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq = seq_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq = BKE_sequencer_active_get(scene);
Sequence **seq_1, **seq_2;
@ -2914,8 +2914,8 @@ void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot)
static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq = seq_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq = BKE_sequencer_active_get(scene);
const int new_type = RNA_enum_get(op->ptr, "type");
/* free previous effect and init new effect */
@ -2975,8 +2975,8 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq = seq_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq = BKE_sequencer_active_get(scene);
const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
if (seq->type == SEQ_IMAGE) {
@ -3044,7 +3044,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
Sequence *seq = seq_active_get(scene);
Sequence *seq = BKE_sequencer_active_get(scene);
RNA_string_set(op->ptr, "directory", seq->strip->dir);

@ -164,11 +164,11 @@ void select_surround_from_last(Scene *scene)
static void UNUSED_FUNCTION(select_single_seq) (Scene * scene, Sequence * seq, int deselect_all) /* BRING BACK */
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (deselect_all)
deselect_all_seq(scene);
seq_active_set(scene, seq);
BKE_sequencer_active_set(scene, seq);
if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
if (seq->strip)
@ -185,7 +185,7 @@ static void UNUSED_FUNCTION(select_single_seq) (Scene * scene, Sequence * seq, i
#if 0
static void select_neighbor_from_last(Scene *scene, int lr)
{
Sequence *seq = seq_active_get(scene);
Sequence *seq = BKE_sequencer_active_get(scene);
Sequence *neighbor;
int change = 0;
if (seq) {
@ -220,7 +220,7 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
int action = RNA_enum_get(op->ptr, "action");
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
if (action == SEL_TOGGLE) {
@ -281,7 +281,7 @@ void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@ -318,7 +318,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
View2D *v2d = UI_view2d_fromcontext(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
short extend = RNA_boolean_get(op->ptr, "extend");
short linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
short left_right = RNA_boolean_get(op->ptr, "left_right");
@ -406,7 +406,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
deselect_all_seq(scene);
if (seq) {
seq_active_set(scene, seq);
BKE_sequencer_active_set(scene, seq);
if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
if (seq->strip) {
@ -557,7 +557,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
/* run recursively to select linked */
static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
{
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *neighbor;
int change = 0;
int isel;
@ -758,7 +758,7 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, 0);
Editing *ed = BKE_sequencer_editing_get(scene, 0);
Sequence *seq;
int sel_side = RNA_enum_get(op->ptr, "side");
@ -808,8 +808,8 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot)
static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, 0);
Sequence *seq_act = seq_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, 0);
Sequence *seq_act = BKE_sequencer_active_get(scene);
if (ed == NULL || seq_act == NULL)
return OPERATOR_CANCELLED;
@ -846,7 +846,7 @@ void SEQUENCER_OT_select_active_side(wmOperatorType *ot)
static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
View2D *v2d = UI_view2d_fromcontext(C);
Sequence *seq;
@ -1150,8 +1150,8 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, 0);
Sequence *seq, *actseq = seq_active_get(scene);
Editing *ed = BKE_sequencer_editing_get(scene, 0);
Sequence *seq, *actseq = BKE_sequencer_active_get(scene);
int type = RNA_enum_get(op->ptr, "type");
short changed = 0, extend;

@ -926,14 +926,14 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
}
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, const int draw_flags)
{
if ((!BKE_scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) {
draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags);
return;
}
else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
draw_mesh_paint(rv3d, ob, dm, draw_flags);
draw_mesh_paint(v3d, rv3d, ob, dm, draw_flags);
return;
}
@ -1002,37 +1002,43 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
/* Vertex Paint and Weight Paint */
void draw_mesh_paint(RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
{
DMSetDrawOptions facemask = NULL;
Mesh *me = ob->data;
const short do_light = (v3d->drawtype >= OB_SOLID);
/* hide faces in face select mode */
if (draw_flags & DRAW_FACE_SELECT)
facemask = wpaint__setSolidDrawOptions_facemask;
if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* enforce default material settings */
GPU_enable_material(0, NULL);
/* but set default spec */
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
glColor3ub(120, 120, 120);
glDisable(GL_COLOR_MATERIAL);
/* diffuse */
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
if (do_light) {
/* enforce default material settings */
GPU_enable_material(0, NULL);
/* but set default spec */
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
glColor3ub(120, 120, 120);
glDisable(GL_COLOR_MATERIAL);
/* diffuse */
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
}
dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
if (do_light) {
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
GPU_disable_material();
GPU_disable_material();
}
}
else if (ob->mode & OB_MODE_VERTEX_PAINT) {
if (me->mloopcol) {
@ -1047,7 +1053,28 @@ void draw_mesh_paint(RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_f
}
/* draw face selection on top */
if (draw_flags & DRAW_FACE_SELECT)
if (draw_flags & DRAW_FACE_SELECT) {
draw_mesh_face_select(rv3d, me, dm);
}
else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) {
/* weight paint in solid mode, special case. focus on making the weights clear
* rather than the shading, this is also forced in wire view */
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
glEnable(GL_BLEND);
glColor4ub(255, 255, 255, 96);
glEnable(GL_LINE_STIPPLE);
glLineStipple(1, 0xAAAA);
dm->drawEdges(dm, 1, 1);
bglPolygonOffset(rv3d->dist, 0.0);
glDepthMask(1);
glDisable(GL_LINE_STIPPLE);
glDisable(GL_BLEND);
}
}

@ -2955,35 +2955,45 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
for (efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
efa; efa = BM_iter_step(&iter))
{
BMIter liter;
BMLoop *loop;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
const int is_face_sel = BM_elem_flag_test(efa, BM_ELEM_SELECT);
BM_face_calc_center_bounds(efa, vmid);
if (is_face_sel || do_moving) {
BMIter liter;
BMLoop *loop;
int cent_ok = FALSE;
for (loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
loop; loop = BM_iter_step(&liter))
{
float v1[3], v2[3], v3[3];
BM_ITER_ELEM(loop, &liter, efa, BM_LOOPS_OF_FACE) {
if (is_face_sel || (do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT))) {
/* yes, we should avoid triple matrix multiply every vertex for 'global' */
float angle;
copy_v3_v3(v1, loop->prev->v->co);
copy_v3_v3(v2, loop->v->co);
copy_v3_v3(v3, loop->next->v->co);
/* lazy init center calc */
if (cent_ok == FALSE) {
BM_face_calc_center_bounds(efa, vmid);
cent_ok = TRUE;
}
if (do_global) {
mul_mat3_m4_v3(ob->obmat, v1);
mul_mat3_m4_v3(ob->obmat, v2);
mul_mat3_m4_v3(ob->obmat, v3);
}
if (do_global) {
copy_v3_v3(v1, loop->prev->v->co);
copy_v3_v3(v2, loop->v->co);
copy_v3_v3(v3, loop->next->v->co);
if ( (BM_elem_flag_test(efa, BM_ELEM_SELECT)) ||
(do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT)))
{
BLI_snprintf(numstr, sizeof(numstr), "%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
interp_v3_v3v3(fvec, vmid, v2, 0.8f);
view3d_cached_text_draw_add(fvec, numstr, 0, txt_flag, col);
mul_mat3_m4_v3(ob->obmat, v1);
mul_mat3_m4_v3(ob->obmat, v2);
mul_mat3_m4_v3(ob->obmat, v3);
angle = angle_v3v3v3(v1, v2, v3);
interp_v3_v3v3(fvec, vmid, v2, 0.8f);
}
else {
angle = angle_v3v3v3(loop->prev->v->co, loop->v->co, loop->v->co);
interp_v3_v3v3(fvec, vmid, loop->v->co, 0.8f);
}
BLI_snprintf(numstr, sizeof(numstr), "%.3f", RAD2DEGF(angle));
view3d_cached_text_draw_add(fvec, numstr, 0, txt_flag, col);
}
}
}
}
@ -3357,34 +3367,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
else if (dt == OB_SOLID) {
if (is_obact && ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
/* weight paint in solid mode, special case. focus on making the weights clear
* rather than the shading, this is also forced in wire view */
GPU_enable_material(0, NULL);
dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, me->mpoly,
DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
glEnable(GL_BLEND);
glColor4ub(255, 255, 255, 96);
glEnable(GL_LINE_STIPPLE);
glLineStipple(1, 0xAAAA);
dm->drawEdges(dm, 1, 1);
bglPolygonOffset(rv3d->dist, 0.0);
glDepthMask(1);
glDisable(GL_LINE_STIPPLE);
glDisable(GL_BLEND);
GPU_disable_material();
/* since we already draw wire as wp guide, don't draw over the top */
draw_wire = OBDRAW_WIRE_OFF;
}
else if (draw_flags & DRAW_MODIFIERS_PREVIEW) {
if (draw_flags & DRAW_MODIFIERS_PREVIEW) {
/* for object selection draws no shade */
if (flag & (DRAW_PICKING | DRAW_CONSTCOLOR)) {
dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
@ -3475,7 +3458,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
else if (dt == OB_PAINT) {
draw_mesh_paint(rv3d, ob, dm, draw_flags);
draw_mesh_paint(v3d, rv3d, ob, dm, draw_flags);
/* since we already draw wire as wp guide, don't draw over the top */
draw_wire = OBDRAW_WIRE_OFF;
}
/* set default draw color back for wire or for draw-extra later on */

@ -131,8 +131,10 @@ void view3d_cached_text_draw_end(View3D * v3d, ARegion * ar, int depth_write, fl
int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline);
/* drawmesh.c */
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
void draw_mesh_paint(RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
struct Object *ob, struct DerivedMesh *dm, const int draw_flags);
void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
struct Object *ob, struct DerivedMesh *dm, const int draw_flags);
/* view3d_draw.c */
void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);

@ -2181,7 +2181,7 @@ void flushTransNodes(TransInfo *t)
void flushTransSeq(TransInfo *t)
{
ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check already done */
ListBase *seqbasep= BKE_sequencer_editing_get(t->scene, FALSE)->seqbasep; /* Editing null check already done */
int a, new_frame, old_start;
TransData *td= NULL;
TransData2D *td2d= NULL;
@ -3980,7 +3980,7 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData *
static void freeSeqData(TransInfo *t)
{
Editing *ed= seq_give_editing(t->scene, FALSE);
Editing *ed= BKE_sequencer_editing_get(t->scene, FALSE);
if (ed != NULL) {
ListBase *seqbasep= ed->seqbasep;
@ -4086,7 +4086,7 @@ static void freeSeqData(TransInfo *t)
}
}
sort_seq(t->scene);
BKE_sequencer_sort(t->scene);
}
else {
/* Cancelled, need to update the strips display */
@ -4116,7 +4116,7 @@ static void createTransSeqData(bContext *C, TransInfo *t)
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene= t->scene;
Editing *ed= seq_give_editing(t->scene, FALSE);
Editing *ed= BKE_sequencer_editing_get(t->scene, FALSE);
TransData *td = NULL;
TransData2D *td2d= NULL;
TransDataSeq *tdsq= NULL;

Some files were not shown because too many files have changed in this diff Show More