From 28299d98fb93e87b2322d0533395254e2792a86f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Jul 2013 08:28:28 +0000 Subject: svn merge ^/trunk/blender -c58374 -c58406 -c58422 -c58427 -c58436 -c58440 -c58441 -c58463 -c58504 -c58509 -c58512 -c58513 -c58514 -c58516 -c58520 -c58532 -c58534 --- intern/cycles/blender/blender_sync.cpp | 4 +- intern/cycles/render/session.cpp | 2 +- release/datafiles/splash.png | Bin 177989 -> 139754 bytes source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenkernel/intern/cloth.c | 1 - source/blender/blenkernel/intern/sequencer.c | 4 +- .../blender/compositor/intern/COM_SocketReader.h | 6 +- .../compositor/intern/COM_WorkScheduler.cpp | 2 + .../operations/COM_ConvertColorToBWOperation.cpp | 2 +- .../operations/COM_ConvertColorToValueProg.cpp | 2 +- .../operations/COM_MathBaseOperation.cpp | 72 ++++++++++----------- .../compositor/operations/COM_MixAddOperation.cpp | 1 - .../compositor/operations/COM_MixBurnOperation.cpp | 9 +-- .../operations/COM_MixColorOperation.cpp | 9 +-- .../operations/COM_MixDarkenOperation.cpp | 9 +-- .../operations/COM_MixDifferenceOperation.cpp | 11 ++-- .../operations/COM_MixDivideOperation.cpp | 11 ++-- .../operations/COM_MixDodgeOperation.cpp | 9 +-- .../compositor/operations/COM_MixHueOperation.cpp | 9 +-- .../operations/COM_MixLightenOperation.cpp | 11 ++-- .../operations/COM_MixLinearLightOperation.cpp | 13 ++-- .../operations/COM_MixOverlayOperation.cpp | 9 +-- .../operations/COM_MixSaturationOperation.cpp | 9 +-- .../operations/COM_MixScreenOperation.cpp | 10 +-- .../operations/COM_MixSoftLightOperation.cpp | 9 +-- .../operations/COM_MixSubtractOperation.cpp | 9 +-- .../operations/COM_MixValueOperation.cpp | 9 +-- source/blender/editors/mesh/mesh_data.c | 2 +- source/blender/editors/render/render_opengl.c | 3 + .../editors/sculpt_paint/paint_image_proj.c | 23 +++++-- source/blender/editors/sculpt_paint/sculpt.c | 15 +++-- source/blender/gpu/intern/gpu_material.c | 8 ++- source/blender/modifiers/intern/MOD_ocean.c | 9 ++- source/gameengine/Expressions/FloatValue.cpp | 9 ++- source/gameengine/Expressions/IntValue.cpp | 9 ++- source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 2 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 12 +++- .../Physics/Bullet/CcdPhysicsController.cpp | 30 +++++++++ 38 files changed, 228 insertions(+), 138 deletions(-) diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 72ed1b84915..e9e39e485f5 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -392,7 +392,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use else { params.samples = get_int(cscene, "preview_aa_samples"); if(params.samples == 0) - params.samples = INT_MAX; + params.samples = 65536; } } else { @@ -402,7 +402,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use else { params.samples = get_int(cscene, "preview_samples"); if(params.samples == 0) - params.samples = INT_MAX; + params.samples = 65536; } } diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index d13e86429d6..9ff2b91e25e 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -786,7 +786,7 @@ void Session::update_status_time(bool show_pause, bool show_done) substatus += string_printf(", Sample %d/%d", sample, num_samples); } } - else if(tile_manager.num_samples == INT_MAX) + else if(tile_manager.num_samples == 65536) substatus = string_printf("Path Tracing Sample %d", sample+1); else substatus = string_printf("Path Tracing Sample %d/%d", sample+1, tile_manager.num_samples); diff --git a/release/datafiles/splash.png b/release/datafiles/splash.png index 3c05ba86cd3..9551fad2fac 100644 Binary files a/release/datafiles/splash.png and b/release/datafiles/splash.png differ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index e73b30ab98a..cf677165f11 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -50,7 +50,7 @@ extern "C" { /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR +#define BLENDER_VERSION_CHAR a /* alpha/beta/rc/release, docs use this */ #define BLENDER_VERSION_CYCLE release diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index a7311d5efc7..05ffd4a6265 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -476,7 +476,6 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived BKE_ptcache_validate(cache, 0); cache->last_exact= 0; cache->flag &= ~PTCACHE_REDO_NEEDED; - return; } // unused in the moment, calculated separately in implicit.c diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index e81afc7efb6..b080cfcff2f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -179,8 +179,10 @@ static void BKE_sequence_free_ex(Scene *scene, Sequence *seq, const int do_cache if (seq->strip) seq_free_strip(seq->strip); - if (seq->anim) + if (seq->anim) { IMB_free_anim(seq->anim); + seq->anim = NULL; + } if (seq->type & SEQ_TYPE_EFFECT) { struct SeqEffectHandle sh = BKE_sequence_get_effect(seq); diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h index 88b018ef8ba..b7aae8b92f0 100644 --- a/source/blender/compositor/intern/COM_SocketReader.h +++ b/source/blender/compositor/intern/COM_SocketReader.h @@ -91,13 +91,13 @@ protected: virtual void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler) {} public: - inline void read(float *result, float x, float y, PixelSampler sampler) { + inline void read(float result[4], float x, float y, PixelSampler sampler) { executePixel(result, x, y, sampler); } - inline void read(float *result, int x, int y, void *chunkData) { + inline void read(float result[4], int x, int y, void *chunkData) { executePixel(result, x, y, chunkData); } - inline void read(float *result, float x, float y, float dx, float dy, PixelSampler sampler) { + inline void read(float result[4], float x, float y, float dx, float dy, PixelSampler sampler) { executePixel(result, x, y, dx, dy, sampler); } diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index e0ac767b628..1bac06fc4ab 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -81,6 +81,7 @@ int g_highlightIndex; void **g_highlightedNodes; void **g_highlightedNodesRead; +#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE #define HIGHLIGHT(wp) \ { \ ExecutionGroup *group = wp->getExecutionGroup(); \ @@ -103,6 +104,7 @@ void **g_highlightedNodesRead; } \ } \ } +#endif /* COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE */ void COM_startReadHighlights() { diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp index 9cff5e8eaa6..3b5aa8cd755 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp @@ -37,7 +37,7 @@ void ConvertColorToBWOperation::initExecution() void ConvertColorToBWOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) { float inputColor[4]; - this->m_inputOperation->read(&inputColor[0], x, y, sampler); + this->m_inputOperation->read(inputColor, x, y, sampler); output[0] = rgb_to_bw(inputColor); } diff --git a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp index 3a65519864a..44e751d1cae 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp @@ -37,7 +37,7 @@ void ConvertColorToValueProg::initExecution() void ConvertColorToValueProg::executePixel(float output[4], float x, float y, PixelSampler sampler) { float inputColor[4]; - this->m_inputOperation->read(&inputColor[0], x, y, sampler); + this->m_inputOperation->read(inputColor, x, y, sampler); output[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f; } diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index 3749bcf42d8..fa0c480eb70 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -77,8 +77,8 @@ void MathAddOperation::executePixel(float output[4], float x, float y, PixelSamp float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] + inputValue2[0]; @@ -90,8 +90,8 @@ void MathSubtractOperation::executePixel(float output[4], float x, float y, Pixe float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] - inputValue2[0]; @@ -103,8 +103,8 @@ void MathMultiplyOperation::executePixel(float output[4], float x, float y, Pixe float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] * inputValue2[0]; @@ -116,8 +116,8 @@ void MathDivideOperation::executePixel(float output[4], float x, float y, PixelS float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue2[0] == 0) /* We don't want to divide by zero. */ output[0] = 0.0; @@ -132,8 +132,8 @@ void MathSineOperation::executePixel(float output[4], float x, float y, PixelSam float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = sin(inputValue1[0]); @@ -145,8 +145,8 @@ void MathCosineOperation::executePixel(float output[4], float x, float y, PixelS float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = cos(inputValue1[0]); @@ -158,8 +158,8 @@ void MathTangentOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = tan(inputValue1[0]); @@ -171,8 +171,8 @@ void MathArcSineOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = asin(inputValue1[0]); @@ -187,8 +187,8 @@ void MathArcCosineOperation::executePixel(float output[4], float x, float y, Pix float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = acos(inputValue1[0]); @@ -203,8 +203,8 @@ void MathArcTangentOperation::executePixel(float output[4], float x, float y, Pi float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = atan(inputValue1[0]); @@ -216,8 +216,8 @@ void MathPowerOperation::executePixel(float output[4], float x, float y, PixelSa float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] >= 0) { output[0] = pow(inputValue1[0], inputValue2[0]); @@ -241,8 +241,8 @@ void MathLogarithmOperation::executePixel(float output[4], float x, float y, Pix float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] > 0 && inputValue2[0] > 0) output[0] = log(inputValue1[0]) / log(inputValue2[0]); @@ -257,8 +257,8 @@ void MathMinimumOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = min(inputValue1[0], inputValue2[0]); @@ -270,8 +270,8 @@ void MathMaximumOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = max(inputValue1[0], inputValue2[0]); @@ -283,8 +283,8 @@ void MathRoundOperation::executePixel(float output[4], float x, float y, PixelSa float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = round(inputValue1[0]); @@ -296,8 +296,8 @@ void MathLessThanOperation::executePixel(float output[4], float x, float y, Pixe float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f; @@ -309,8 +309,8 @@ void MathGreaterThanOperation::executePixel(float output[4], float x, float y, P float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f; @@ -322,8 +322,8 @@ void MathModuloOperation::executePixel(float output[4], float x, float y, PixelS float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue2[0] == 0) output[0] = 0.0; diff --git a/source/blender/compositor/operations/COM_MixAddOperation.cpp b/source/blender/compositor/operations/COM_MixAddOperation.cpp index be737f22280..4e0876439c0 100644 --- a/source/blender/compositor/operations/COM_MixAddOperation.cpp +++ b/source/blender/compositor/operations/COM_MixAddOperation.cpp @@ -37,7 +37,6 @@ void MixAddOperation::executePixel(float output[4], float x, float y, PixelSampl this->m_inputColor1Operation->read(inputColor1, x, y, sampler); this->m_inputColor2Operation->read(inputColor2, x, y, sampler); - float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.cpp b/source/blender/compositor/operations/COM_MixBurnOperation.cpp index 5cfe38766bc..d4422c6cc6a 100644 --- a/source/blender/compositor/operations/COM_MixBurnOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBurnOperation.cpp @@ -31,13 +31,14 @@ void MixBurnOperation::executePixel(float output[4], float x, float y, PixelSamp { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; float tmp; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp index 56aca27eaef..6919a636aeb 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.cpp +++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp @@ -35,12 +35,13 @@ void MixColorOperation::executePixel(float output[4], float x, float y, PixelSam { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp index 5b79f4c95ac..d56d9fdf122 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp @@ -31,12 +31,13 @@ void MixDarkenOperation::executePixel(float output[4], float x, float y, PixelSa { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp index d2c1e5e428f..13494401c60 100644 --- a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp @@ -32,12 +32,13 @@ void MixDifferenceOperation::executePixel(float output[4], float x, float y, Pix { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + float inputValue[4]; + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp index fdb1618b6e6..3e0eb66565c 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp @@ -31,12 +31,13 @@ void MixDivideOperation::executePixel(float output[4], float x, float y, PixelSa { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + float inputValue[4]; + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp index 87f60df8e1b..acb39f665ff 100644 --- a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp @@ -31,13 +31,14 @@ void MixDodgeOperation::executePixel(float output[4], float x, float y, PixelSam { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; float tmp; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp index 12cd16bb73b..64c88592b93 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp @@ -35,12 +35,13 @@ void MixHueOperation::executePixel(float output[4], float x, float y, PixelSampl { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp index 9eb45a783f8..a468fb39442 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp @@ -31,12 +31,13 @@ void MixLightenOperation::executePixel(float output[4], float x, float y, PixelS { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + float inputValue[4]; + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp index ee7dcc9fe28..e1b5e040f0f 100644 --- a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp @@ -31,12 +31,13 @@ void MixLinearLightOperation::executePixel(float output[4], float x, float y, Pi { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); - + float inputValue[4]; + + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp index 09a9d3cbc4f..d5e1c6d1167 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp @@ -31,12 +31,13 @@ void MixOverlayOperation::executePixel(float output[4], float x, float y, PixelS { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp index 3ab19748458..ca45a1c703a 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp @@ -35,12 +35,13 @@ void MixSaturationOperation::executePixel(float output[4], float x, float y, Pix { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.cpp b/source/blender/compositor/operations/COM_MixScreenOperation.cpp index 671ffd3303c..511768a49ad 100644 --- a/source/blender/compositor/operations/COM_MixScreenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixScreenOperation.cpp @@ -31,13 +31,13 @@ void MixScreenOperation::executePixel(float output[4], float x, float y, PixelSa { float inputColor1[4]; float inputColor2[4]; - float valuev[4]; + float inputValue[4]; - this->m_inputValueOperation->read(valuev, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); - float value = valuev[0]; + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp index 604881ae47f..71d83ce54ea 100644 --- a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp @@ -31,12 +31,13 @@ void MixSoftLightOperation::executePixel(float output[4], float x, float y, Pixe { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp index a446dfe4e54..e6efe0f62f3 100644 --- a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp @@ -31,12 +31,13 @@ void MixSubtractOperation::executePixel(float output[4], float x, float y, Pixel { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixValueOperation.cpp b/source/blender/compositor/operations/COM_MixValueOperation.cpp index caefdf024cc..553041e39bf 100644 --- a/source/blender/compositor/operations/COM_MixValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixValueOperation.cpp @@ -35,12 +35,13 @@ void MixValueOperation::executePixel(float output[4], float x, float y, PixelSam { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index b825de58678..4cbb5f303f0 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -138,7 +138,7 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer) BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n); } else { - CustomData_free_layer(data, type, tot, n); + CustomData_free_layer(data, type, tot, layer_index + n); BKE_mesh_update_customdata_pointers(me, true); } } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 93ae913cee0..6b55518552a 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -728,6 +728,9 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEven oglrender = op->customdata; render_view_open(C, event->x, event->y); + /* view may be changed above (R_OUTPUT_WINDOW) */ + oglrender->win = CTX_wm_window(C); + WM_event_add_modal_handler(C, op); oglrender->timer = WM_event_add_timer(oglrender->wm, oglrender->win, TIMER, 0.01f); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 017232d1856..db55dc271f1 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -2816,7 +2816,11 @@ static void project_paint_begin(ProjPaintState *ps) int a, i; /* generic looping vars */ int image_index = -1, face_index; - int *mpoly_origindex; + + /* double lookup */ + const int *index_mf_to_mpoly = NULL; + const int *index_mp_to_orig = NULL; + MVert *mv; MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */ @@ -2871,12 +2875,17 @@ static void project_paint_begin(ProjPaintState *ps) ps->dm_totface = ps->dm->getNumTessFaces(ps->dm); if (ps->do_face_sel) { - mpoly_orig = ((Mesh *)ps->ob->data)->mpoly; - mpoly_origindex = ps->dm->getPolyDataArray(ps->dm, CD_ORIGINDEX); + index_mf_to_mpoly = ps->dm->getTessFaceDataArray(ps->dm, CD_ORIGINDEX); + index_mp_to_orig = ps->dm->getPolyDataArray(ps->dm, CD_ORIGINDEX); + if (index_mf_to_mpoly == NULL) { + index_mp_to_orig = NULL; + } + else { + mpoly_orig = ((Mesh *)ps->ob->data)->mpoly; + } } else { mpoly_orig = NULL; - mpoly_origindex = NULL; } /* use clone mtface? */ @@ -3166,8 +3175,10 @@ static void project_paint_begin(ProjPaintState *ps) if (ps->do_face_sel) { int orig_index; - if (mpoly_origindex && ((orig_index = mpoly_origindex[face_index])) != ORIGINDEX_NONE) { - MPoly *mp = mpoly_orig + orig_index; + if (index_mp_to_orig && ((orig_index = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, + face_index))) != ORIGINDEX_NONE) + { + MPoly *mp = &mpoly_orig[orig_index]; is_face_sel = ((mp->flag & ME_FACE_SEL) != 0); } else { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c7f8161c7ed..f67cc0359a2 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4652,13 +4652,18 @@ void sculpt_dynamic_topology_disable(bContext *C, sculptsession_bm_to_me(ob, TRUE); } - BM_mesh_free(ss->bm); - /* Clear data */ me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY; - ss->bm = NULL; - BM_log_free(ss->bm_log); - ss->bm_log = NULL; + + /* typically valid but with global-undo they can be NULL, [#36234] */ + if (ss->bm) { + BM_mesh_free(ss->bm); + ss->bm = NULL; + } + if (ss->bm_log) { + BM_log_free(ss->bm_log); + ss->bm_log = NULL; + } /* Refresh */ sculpt_update_after_dynamic_topology_toggle(C); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 044b699a042..0ca929da65d 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -742,12 +742,16 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la } if (lamp->mode & LA_ONLYSHADOW) { + GPUNodeLink *rgb; GPU_link(mat, "shade_only_shadow", i, shadfac, GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), &shadfac); + + GPU_link(mat, "shade_mul", shi->rgb, GPU_uniform(lamp->shadow_color), &rgb); + GPU_link(mat, "mtex_rgb_invert", rgb, &rgb); if (!(lamp->mode & LA_NO_DIFF)) { - GPU_link(mat, "mix_mult", shadfac, shr->diff, - GPU_uniform(lamp->shadow_color), &shr->diff); + GPU_link(mat, "shade_only_shadow_diffuse", shadfac, rgb, + shr->diff, &shr->diff); } if (!(lamp->mode & LA_NO_SPEC)) diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 7c9a88622ed..5fdd17b5167 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -426,6 +426,11 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob, const float size_co_inv = 1.0f / (omd->size * omd->spatial_size); + /* can happen in when size is small, avoid bad array lookups later and quit now */ + if (!finite(size_co_inv)) { + return derivedData; + } + /* update modifier */ if (omd->refresh & MOD_OCEAN_REFRESH_ADD) omd->ocean = BKE_add_ocean(); @@ -531,7 +536,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob, } } - #undef OCEAN_CO +#undef OCEAN_CO return dm; } @@ -552,8 +557,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, { DerivedMesh *result; - CDDM_calc_normals(derivedData); - result = doOcean(md, ob, derivedData, 0); if (result != derivedData) diff --git a/source/gameengine/Expressions/FloatValue.cpp b/source/gameengine/Expressions/FloatValue.cpp index b7d7f528155..0f468e328ed 100644 --- a/source/gameengine/Expressions/FloatValue.cpp +++ b/source/gameengine/Expressions/FloatValue.cpp @@ -97,7 +97,7 @@ ret: a new object containing the result of applying operator op to this return new CFloatValue (-m_float); break; case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); + return new CBoolValue (m_float == 0.f); break; case VALUE_AND_OPERATOR: case VALUE_OR_OPERATOR: @@ -160,6 +160,9 @@ ret: a new object containing the result of applying operator op to val and case VALUE_LEQ_OPERATOR: ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_float); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_float == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; @@ -212,7 +215,9 @@ ret: a new object containing the result of applying operator op to val and case VALUE_POS_OPERATOR: ret = new CFloatValue (m_float); break; - + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_float == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp index 2cacea98467..fa4c9ad8ac9 100644 --- a/source/gameengine/Expressions/IntValue.cpp +++ b/source/gameengine/Expressions/IntValue.cpp @@ -96,7 +96,7 @@ object and val return new CIntValue (-m_int); break; case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); + return new CBoolValue (m_int == 0); break; case VALUE_AND_OPERATOR: case VALUE_OR_OPERATOR: @@ -170,7 +170,11 @@ CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *v case VALUE_POS_OPERATOR: ret = new CIntValue (m_int); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_int == 0); + break; default: + printf("Found op: %d\n", op); ret = new CErrorValue("illegal operator. please send a bug report."); break; } @@ -215,6 +219,9 @@ CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *v case VALUE_LEQ_OPERATOR: ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_int); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_int == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index c7e31f75306..3cae3bcf160 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -367,7 +367,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) { - PyErr_SetString(PyExc_TypeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); + PyErr_SetString(PyExc_AttributeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); return NULL; } diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 2c642d4bd04..f1edb71f4fe 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -1031,10 +1031,9 @@ int main(int argc, char** argv) * removal is needed else the system will free an already freed value */ system->removeEventConsumer(&app); - /* nodesystem relies on blendfile data, free it first */ - free_nodesystem(); - BLO_blendfiledata_free(bfd); + /* G.main == bfd->main, it gets referenced in free_nodesystem so we can't have a dangling pointer */ + G.main = NULL; if (python_main) MEM_freeN(python_main); } } while (exitcode == KX_EXIT_REQUEST_RESTART_GAME || exitcode == KX_EXIT_REQUEST_START_OTHER_GAME); @@ -1052,6 +1051,13 @@ int main(int argc, char** argv) } } + /* refer to WM_exit_ext() and free_blender(), + * these are not called in the player but we need to match some of there behavior here, + * if the order of function calls or blenders state isn't matching that of blender proper, + * we may get troubles later on */ + + free_nodesystem(); + // Cleanup RNA_exit(); BLF_exit(); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index b389347cdb0..0604157a420 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -1587,6 +1587,21 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, if (mf->v4 && vert_tag_array[mf->v4] == false) {vert_tag_array[mf->v4] = true; tot_bt_verts++;} } } + + /* Can happen with ngons */ + if (!tot_bt_verts) { + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + dm = NULL; + } + return false; + } m_vertexArray.resize(tot_bt_verts*3); @@ -1662,6 +1677,21 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, } } + /* Can happen with ngons */ + if (!tot_bt_verts) { + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + dm = NULL; + } + return false; + } + m_vertexArray.resize(tot_bt_verts*3); m_polygonIndexArray.resize(tot_bt_tris); m_triFaceArray.resize(tot_bt_tris*3); -- cgit v1.2.3