Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Sun, 2 Oct 2016 16:53:01 +0000 (18:53 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Sun, 2 Oct 2016 16:53:01 +0000 (18:53 +0200)
42 files changed:
build_files/cmake/platform/platform_win32_msvc.cmake
build_files/utils/build_tgz.sh
extern/cuew/README
extern/cuew/README.blender
intern/cycles/device/device_cuda.cpp
intern/cycles/device/device_opencl.cpp
intern/cycles/kernel/bvh/bvh.h
intern/cycles/kernel/bvh/bvh_types.h
intern/cycles/kernel/bvh/qbvh_nodes.h
intern/cycles/kernel/bvh/qbvh_shadow_all.h
intern/cycles/kernel/bvh/qbvh_subsurface.h
intern/cycles/kernel/bvh/qbvh_traversal.h
intern/cycles/kernel/bvh/qbvh_volume.h
intern/cycles/kernel/bvh/qbvh_volume_all.h
intern/cycles/kernel/geom/geom.h
intern/cycles/kernel/geom/geom_motion_triangle.h
intern/cycles/kernel/geom/geom_triangle.h
intern/cycles/kernel/svm/svm_math_util.h
intern/cycles/render/constant_fold.cpp
intern/cycles/render/constant_fold.h
intern/cycles/render/mesh_subdivision.cpp
intern/cycles/render/nodes.cpp
intern/cycles/test/render_graph_finalize_test.cpp
intern/cycles/util/util_path.cpp
intern/cycles/util/util_path.h
intern/elbeem/intern/solver_class.h
intern/elbeem/intern/solver_main.cpp
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_SystemWin32.h
make.bat
release/scripts/startup/bl_operators/add_mesh_torus.py
source/blender/blenkernel/intern/library_query.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenloader/intern/readfile.c
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/editors/space_file/fsmenu.c
source/blender/editors/transform/transform_snap_object.c
source/blender/gpu/intern/gpu_material.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/modifiers/intern/MOD_normal_edit.c
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp

index 961cada037e41e128b0c26be0d571d7d2de5709c..5efda52b2c58d3ce8a403fd5bab4095161d36f20 100644 (file)
@@ -414,7 +414,7 @@ if(WITH_OPENCOLORIO)
 endif()
 
 if(WITH_OPENVDB)
-       set(BLOSC_LIBRARIES ${LIBDIR}/blosc/lib/libblosc.lib )
+       set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
        set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
        set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
        set(OPENVDB ${LIBDIR}/openvdb)
index 3c921081c292a4c0400bfca97f25811dc3f87728..865df2776053135d275af641856ca3c1cc790208 100755 (executable)
@@ -6,10 +6,10 @@
 BASE_DIR="$PWD"
 
 blender_srcdir=$(dirname -- $0)/../..
-blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
-blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
-blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
-blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
+blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
+blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
+blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
+blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
 
 if [ "$blender_version_cycle" = "release" ] ; then
        VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char
index 3c43b7278d91fd79a305956ff75196c98b85efc8..2fab76015e6127bcbb5aa829da16089ffbe795c3 100644 (file)
@@ -4,7 +4,7 @@ for determining which CUDA functions and extensions extensions are supported
 on the target platform.
 
 CUDA core and extension functionality is exposed in a single header file.
-GUEW has been tested on a variety of operating systems, including Windows,
+CUEW has been tested on a variety of operating systems, including Windows,
 Linux, Mac OS X.
 
 LICENSE
index 7e0523eda28a5cd8fd5744f5cfb06a8b5814effb..7b77935d75096b7a7b6b1446eb2458720b94c2de 100644 (file)
@@ -1,5 +1,5 @@
 Project: Cuda Wrangler
 URL: https://github.com/CudaWrangler/cuew
 License: Apache 2.0
-Upstream version: e2e0315
+Upstream version: 63d2a0f
 Local modifications: None
index 147e21d798a59bf52abce0c59071e4e46390ff2f..7f8a0bf2f43882d638f25e3a9459a7f56677af26 100644 (file)
@@ -993,7 +993,7 @@ public:
                                cuda_assert(cuCtxSynchronize());
 
                                if(task.get_cancel()) {
-                                       canceled = false;
+                                       canceled = true;
                                        break;
                                }
                        }
index c43a387800997cc750f05887a8997a7b87508bae..830e4d056b58a17b33add587c2e0c8da5b6c64bd 100644 (file)
@@ -2346,7 +2346,9 @@ public:
                }
        }
 
-       void path_trace(SplitRenderTile& rtile, int2 max_render_feasible_tile_size)
+       void path_trace(DeviceTask *task,
+                       SplitRenderTile& rtile,
+                       int2 max_render_feasible_tile_size)
        {
                /* cast arguments to cl types */
                cl_mem d_data = CL_MEM_PTR(const_mem_map["__data"]->device_pointer);
@@ -2739,6 +2741,7 @@ public:
                /* Record number of time host intervention has been made */
                unsigned int numHostIntervention = 0;
                unsigned int numNextPathIterTimes = PathIteration_times;
+               bool canceled = false;
                while(activeRaysAvailable) {
                        /* Twice the global work size of other kernels for
                         * ckPathTraceKernel_shadow_blocked_direct_lighting. */
@@ -2757,6 +2760,10 @@ public:
                                ENQUEUE_SPLIT_KERNEL(direct_lighting, global_size, local_size);
                                ENQUEUE_SPLIT_KERNEL(shadow_blocked, global_size_shadow_blocked, local_size);
                                ENQUEUE_SPLIT_KERNEL(next_iteration_setup, global_size, local_size);
+                               if(task->get_cancel()) {
+                                       canceled = true;
+                                       break;
+                               }
                        }
 
                        /* Read ray-state into Host memory to decide if we should exit
@@ -2794,22 +2801,28 @@ public:
                                 */
                                numNextPathIterTimes += PATH_ITER_INC_FACTOR;
                        }
+                       if(task->get_cancel()) {
+                               canceled = true;
+                               break;
+                       }
                }
 
                /* Execute SumALLRadiance kernel to accumulate radiance calculated in
                 * per_sample_output_buffers into RenderTile's output buffer.
                 */
-               size_t sum_all_radiance_local_size[2] = {16, 16};
-               size_t sum_all_radiance_global_size[2];
-               sum_all_radiance_global_size[0] =
-                       (((d_w - 1) / sum_all_radiance_local_size[0]) + 1) *
-                       sum_all_radiance_local_size[0];
-               sum_all_radiance_global_size[1] =
-                       (((d_h - 1) / sum_all_radiance_local_size[1]) + 1) *
-                       sum_all_radiance_local_size[1];
-               ENQUEUE_SPLIT_KERNEL(sum_all_radiance,
-                                    sum_all_radiance_global_size,
-                                    sum_all_radiance_local_size);
+               if (!canceled) {
+                       size_t sum_all_radiance_local_size[2] = {16, 16};
+                       size_t sum_all_radiance_global_size[2];
+                       sum_all_radiance_global_size[0] =
+                               (((d_w - 1) / sum_all_radiance_local_size[0]) + 1) *
+                               sum_all_radiance_local_size[0];
+                       sum_all_radiance_global_size[1] =
+                               (((d_h - 1) / sum_all_radiance_local_size[1]) + 1) *
+                               sum_all_radiance_local_size[1];
+                       ENQUEUE_SPLIT_KERNEL(sum_all_radiance,
+                                            sum_all_radiance_global_size,
+                                            sum_all_radiance_local_size);
+               }
 
 #undef ENQUEUE_SPLIT_KERNEL
 #undef GLUE
@@ -3182,7 +3195,8 @@ public:
                                            tile_iter < to_path_trace_render_tiles.size();
                                            ++tile_iter)
                                        {
-                                               path_trace(to_path_trace_render_tiles[tile_iter],
+                                               path_trace(task,
+                                                          to_path_trace_render_tiles[tile_iter],
                                                           max_render_feasible_tile_size);
                                        }
                                }
@@ -3198,7 +3212,7 @@ public:
                                        /* buffer_rng_state_stride is stride itself. */
                                        SplitRenderTile split_tile(tile);
                                        split_tile.buffer_rng_state_stride = tile.stride;
-                                       path_trace(split_tile, max_render_feasible_tile_size);
+                                       path_trace(task, split_tile, max_render_feasible_tile_size);
                                }
                                tile.sample = tile.start_sample + tile.num_samples;
 
index 85bfd931e6eed0419eefbf8377818390e080614e..7cecee793c1263595732e9df678744eabe9eff9f 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index bcba6e65fe51e2b2a708cf76485ba3071b7bd544..27729046f8d099c85ca33b0dd4e8388ff288946c 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 4d8695bedec6f74327c86aabf2f01805b8747304..2ee2a393e80716a56ae0a30219b027a5b275b222 100644 (file)
@@ -12,6 +12,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Aligned nodes intersection SSE code is adopted from Embree,
  */
 
 struct QBVHStackItem {
index 3136c495b38d5ce931d42b4fbfec8a4d9a754138..ae7aec2082f52f5450598529ea824b20e2ef1f03 100644 (file)
@@ -1,8 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation,
- * and code copyright 2009-2012 Intel Corporation
- *
- * Modifications Copyright 2011-2014, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 03794e3a8820ce5f9f9efa3945041d5666cfbe2c..24aca96a298f2d6f859e57f06a61b366795de7f4 100644 (file)
@@ -1,8 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation,
- * and code copyright 2009-2012 Intel Corporation
- *
- * Modifications Copyright 2011-2014, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index f82ff6614956a5073d23111a03c7b6aa69e8418e..a1e154d6dcf5b4a507ecccc19248544f3ddbf6bd 100644 (file)
@@ -1,8 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation,
- * and code copyright 2009-2012 Intel Corporation
- *
- * Modifications Copyright 2011-2014, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index aff9f559ab8faba8a05d0d566e3589f080679a24..db9779351d22a848a4f0b9b18019f44cb4f876c5 100644 (file)
@@ -1,8 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation,
- * and code copyright 2009-2012 Intel Corporation
- *
- * Modifications Copyright 2011-2014, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 5d9b2edb4bad0a5f283c68d9a7ce638bc258ecd3..88f1f764e4c1ac30f55b3494ad874b5e54df3f48 100644 (file)
@@ -1,8 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation,
- * and code copyright 2009-2012 Intel Corporation
- *
- * Modifications Copyright 2011-2014, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 3605394f18217c1542742293b8f515f7d37adbe4..24ced934c8bece1324e70fcaf8a9ef503cb21346 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index dabba3fb1f078a3bc55fb301d0a80bdc4db76daf..3cbe59aaecef4870f9b142d01342530e4eae4865 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 8bd01e1008d7631c95c6023bb37fb48a2106f19f..17538872ead285d0fdc2ee2ce9b29f195fed5c77 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
+ * Copyright 2011-2013 Blender Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 6d13a0d8e0291ca86087b513207ceafe3802f5bb..01547b60014f08b1080b250c462226ad77df6b4c 100644 (file)
@@ -164,6 +164,9 @@ ccl_device float3 svm_math_blackbody_color(float t) {
 
 ccl_device_inline float3 svm_math_gamma_color(float3 color, float gamma)
 {
+       if(gamma == 0.0f)
+               return make_float3(1.0f, 1.0f, 1.0f);
+
        if(color.x > 0.0f)
                color.x = powf(color.x, gamma);
        if(color.y > 0.0f)
index 200a4c497cdc037f1aeb37d44eb780a6cb4488e1..b7f25663bc3c0a02444e2cbb7ccab4293735d446 100644 (file)
@@ -89,6 +89,19 @@ void ConstantFolder::make_zero() const
        }
 }
 
+void ConstantFolder::make_one() const
+{
+       if(output->type() == SocketType::FLOAT) {
+               make_constant(1.0f);
+       }
+       else if(SocketType::is_float3(output->type())) {
+               make_constant(make_float3(1.0f, 1.0f, 1.0f));
+       }
+       else {
+               assert(0);
+       }
+}
+
 void ConstantFolder::bypass(ShaderOutput *new_output) const
 {
        assert(new_output);
@@ -321,6 +334,15 @@ void ConstantFolder::fold_math(NodeMath type, bool clamp) const
                                make_zero();
                        }
                        break;
+               case NODE_MATH_POWER:
+                       /* 1 ^ X == X ^ 0 == 1 */
+                       if(is_one(value1_in) || is_zero(value2_in)) {
+                               make_one();
+                       }
+                       /* X ^ 1 == X */
+                       else if(is_one(value2_in)) {
+                               try_bypass_or_make_constant(value1_in, clamp);
+                       }
                default:
                        break;
        }
index 2b31c2a5887fe49b7f208953ecb781a92f4a06e3..7962698319f0887e970e811da318a6bd3d3bccf5 100644 (file)
@@ -43,6 +43,7 @@ public:
        void make_constant_clamp(float value, bool clamp) const;
        void make_constant_clamp(float3 value, bool clamp) const;
        void make_zero() const;
+       void make_one() const;
 
        /* Bypass node, relinking to another output socket. */
        void bypass(ShaderOutput *output) const;
index 0ae5ff742c22db2b8a3ce729ff672555b7d458db..813b23ed91eb01c851873fd181ca22b4c3d1af7c 100644 (file)
@@ -109,7 +109,7 @@ namespace Far {
 
        template<>
        void TopologyRefinerFactory<ccl::Mesh>::reportInvalidTopology(TopologyError /*err_code*/,
-               char const */*msg*/, ccl::Mesh const& /*mesh*/)
+               char const * /*msg*/, ccl::Mesh const& /*mesh*/)
        {
        }
 } /* namespace Far */
index df43863ea7a5d1a9a1e3b32b79fe190fb8f4db1c..7ea52b28b9cf6035ff9eeb71438222fc5b5c3d4b 100644 (file)
@@ -3896,6 +3896,19 @@ void GammaNode::constant_fold(const ConstantFolder& folder)
        if(folder.all_inputs_constant()) {
                folder.make_constant(svm_math_gamma_color(color, gamma));
        }
+       else {
+               ShaderInput *color_in = input("Color");
+               ShaderInput *gamma_in = input("Gamma");
+
+               /* 1 ^ X == X ^ 0 == 1 */
+               if(folder.is_one(color_in) || folder.is_zero(gamma_in)) {
+                       folder.make_one();
+               }
+               /* X ^ 1 == X */
+               else if(folder.is_one(gamma_in)) {
+                       folder.try_bypass_or_make_constant(color_in, false);
+               }
+       }
 }
 
 void GammaNode::compile(SVMCompiler& compiler)
index 60e41be16aa3cdd1d1bb584320ce2a544b680539..6f1c0b88b51c67e5527a42e577d9377f679da39b 100644 (file)
@@ -930,6 +930,72 @@ TEST(render_graph, constant_fold_gamma)
        graph.finalize(&scene);
 }
 
+/*
+ * Tests: Gamma with one constant 0 input.
+ */
+TEST(render_graph, constant_fold_gamma_part_0)
+{
+       DEFINE_COMMON_VARIABLES(builder, log);
+
+       EXPECT_ANY_MESSAGE(log);
+       INVALID_INFO_MESSAGE(log, "Folding Gamma_Cx::");
+       CORRECT_INFO_MESSAGE(log, "Folding Gamma_xC::Color to constant (1, 1, 1).");
+
+       builder
+               .add_attribute("Attribute")
+               /* constant on the left */
+               .add_node(ShaderNodeBuilder<GammaNode>("Gamma_Cx")
+                         .set("Color", make_float3(0.0f, 0.0f, 0.0f)))
+               .add_connection("Attribute::Fac", "Gamma_Cx::Gamma")
+               /* constant on the right */
+               .add_node(ShaderNodeBuilder<GammaNode>("Gamma_xC")
+                         .set("Gamma", 0.0f))
+               .add_connection("Attribute::Color", "Gamma_xC::Color")
+               /* output sum */
+               .add_node(ShaderNodeBuilder<MixNode>("Out")
+                         .set(&MixNode::type, NODE_MIX_ADD)
+                         .set(&MixNode::use_clamp, true)
+                         .set("Fac", 1.0f))
+               .add_connection("Gamma_Cx::Color", "Out::Color1")
+               .add_connection("Gamma_xC::Color", "Out::Color2")
+               .output_color("Out::Color");
+
+       graph.finalize(&scene);
+}
+
+/*
+ * Tests: Gamma with one constant 1 input.
+ */
+TEST(render_graph, constant_fold_gamma_part_1)
+{
+       DEFINE_COMMON_VARIABLES(builder, log);
+
+       EXPECT_ANY_MESSAGE(log);
+       CORRECT_INFO_MESSAGE(log, "Folding Gamma_Cx::Color to constant (1, 1, 1).");
+       CORRECT_INFO_MESSAGE(log, "Folding Gamma_xC::Color to socket Attribute::Color.");
+
+       builder
+               .add_attribute("Attribute")
+               /* constant on the left */
+               .add_node(ShaderNodeBuilder<GammaNode>("Gamma_Cx")
+                         .set("Color", make_float3(1.0f, 1.0f, 1.0f)))
+               .add_connection("Attribute::Fac", "Gamma_Cx::Gamma")
+               /* constant on the right */
+               .add_node(ShaderNodeBuilder<GammaNode>("Gamma_xC")
+                         .set("Gamma", 1.0f))
+               .add_connection("Attribute::Color", "Gamma_xC::Color")
+               /* output sum */
+               .add_node(ShaderNodeBuilder<MixNode>("Out")
+                         .set(&MixNode::type, NODE_MIX_ADD)
+                         .set(&MixNode::use_clamp, true)
+                         .set("Fac", 1.0f))
+               .add_connection("Gamma_Cx::Color", "Out::Color1")
+               .add_connection("Gamma_xC::Color", "Out::Color2")
+               .output_color("Out::Color");
+
+       graph.finalize(&scene);
+}
+
 /*
  * Tests: BrightnessContrast with all constant inputs.
  */
@@ -1142,6 +1208,40 @@ TEST(render_graph, constant_fold_part_math_div_0)
        graph.finalize(&scene);
 }
 
+/*
+ * Tests: partial folding for Math Power with known 0.
+ */
+TEST(render_graph, constant_fold_part_math_pow_0)
+{
+       DEFINE_COMMON_VARIABLES(builder, log);
+
+       EXPECT_ANY_MESSAGE(log);
+       /* X ^ 0 == 1 */
+       INVALID_INFO_MESSAGE(log, "Folding Math_Cx::");
+       CORRECT_INFO_MESSAGE(log, "Folding Math_xC::Value to constant (1).");
+       INVALID_INFO_MESSAGE(log, "Folding Out::");
+
+       build_math_partial_test_graph(builder, NODE_MATH_POWER, 0.0f);
+       graph.finalize(&scene);
+}
+
+/*
+ * Tests: partial folding for Math Power with known 1.
+ */
+TEST(render_graph, constant_fold_part_math_pow_1)
+{
+       DEFINE_COMMON_VARIABLES(builder, log);
+
+       EXPECT_ANY_MESSAGE(log);
+       /* 1 ^ X == 1; X ^ 1 == X */
+       CORRECT_INFO_MESSAGE(log, "Folding Math_Cx::Value to constant (1)");
+       CORRECT_INFO_MESSAGE(log, "Folding Math_xC::Value to socket Attribute::Fac.");
+       INVALID_INFO_MESSAGE(log, "Folding Out::");
+
+       build_math_partial_test_graph(builder, NODE_MATH_POWER, 1.0f);
+       graph.finalize(&scene);
+}
+
 /*
  * Tests: Vector Math with all constant inputs.
  */
index 9ec67cb0330dbad7eb6ead9a5d269bb4a3f2f679..62ef8fc0b483ffebda357224d7ae13d3af19be18 100644 (file)
@@ -778,7 +778,9 @@ static string line_directive(const string& path, int line)
 }
 
 
-string path_source_replace_includes(const string& source, const string& path)
+string path_source_replace_includes(const string& source,
+                                    const string& path,
+                                    const string& source_filename)
 {
        /* Our own little c preprocessor that replaces #includes with the file
         * contents, to work around issue of opencl drivers not supporting
@@ -807,12 +809,12 @@ string path_source_replace_includes(const string& source, const string& path)
                                                 * and avoids having list of include directories.x
                                                 */
                                                text = path_source_replace_includes(
-                                                       text, path_dirname(filepath));
-                                               text = path_source_replace_includes(text, path);
+                                                       text, path_dirname(filepath), filename);
+                                               text = path_source_replace_includes(text, path, filename);
                                                /* Use line directives for better error messages. */
                                                line = line_directive(filepath, 1)
                                                     + token.replace(0, n_end + 1, "\n" + text + "\n")
-                                                    + line_directive(path, i);
+                                                    + line_directive(path_join(path, source_filename), i);
                                        }
                                }
                        }
index 4a89d87cbc6896c5344f60230aa3f051137a5918..70dbb5ae40309e7ee63f61f98fda5626a303f4b5 100644 (file)
@@ -66,7 +66,9 @@ bool path_read_text(const string& path, string& text);
 bool path_remove(const string& path);
 
 /* source code utility */
-string path_source_replace_includes(const string& source, const string& path);
+string path_source_replace_includes(const string& source,
+                                    const string& path,
+                                    const string& source_filename="");
 
 /* cache utility */
 void path_cache_clear_except(const string& name, const set<string>& except);
index 593fea1b998b657db28d44accc6741b714e8573f..2b2e214458da8479d677f870d941fd8d836e20ee 100644 (file)
@@ -332,7 +332,7 @@ class LbmFsgrSolver :
                void debugMarkCellCall(int level, int vi,int vj,int vk);
                
                // loop over grid, stream&collide update
-               void mainLoop(int lev);
+               void mainLoop(const int lev);
                // change time step size
                void adaptTimestep();
                //! init mObjectSpeeds for current parametrization
index 55a8d3eb4aadb267ebfc269f92190c7c0c87dbb6..a338bb77b4c076c74562223418bcf7de6d181c89 100644 (file)
@@ -355,7 +355,7 @@ void LbmFsgrSolver::fineAdvance()
 //! fine step function
 /*****************************************************************************/
 void 
-LbmFsgrSolver::mainLoop(int lev)
+LbmFsgrSolver::mainLoop(const int lev)
 {
        // loops over _only inner_ cells  -----------------------------------------------------------------------------------
        
@@ -376,13 +376,16 @@ LbmFsgrSolver::mainLoop(int lev)
   // main loop region
        const bool doReduce = true;
        const int gridLoopBound=1;
+       const int gDebugLevel = ::gDebugLevel;
+       int calcNumInvIfCells = 0;
+       LbmFloat calcInitialMass = 0;
        GRID_REGION_INIT();
 #if PARALLEL==1
-#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \
+#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
   reduction(+: \
          calcCurrentMass,calcCurrentVolume, \
                calcCellsFilled,calcCellsEmptied, \
-               calcNumUsedCells )
+               calcNumUsedCells,calcNumInvIfCells,calcInitialMass)
        GRID_REGION_START();
 #else // PARALLEL==1
        GRID_REGION_START();
@@ -468,7 +471,7 @@ LbmFsgrSolver::mainLoop(int lev)
                                calcCurrentMass += iniRho; 
                                calcCurrentVolume += 1.0; 
                                calcNumUsedCells++;
-                               mInitialMass += iniRho;
+                               calcInitialMass += iniRho;
                                // dont treat cell until next step
                                continue;
                        } 
@@ -479,7 +482,7 @@ LbmFsgrSolver::mainLoop(int lev)
                        if(isnotValid) {
                                // remove fluid cells, shouldnt be here anyway
                                LbmFloat fluidRho = m[0]; FORDF1 { fluidRho += m[l]; }
-                               mInitialMass -= fluidRho;
+                               calcInitialMass -= fluidRho;
                                const LbmFloat iniRho = 0.0;
                                RAC(tcel, dMass) = RAC(tcel, dFfrac) = iniRho;
                                RAC(tcel, dFlux) = FLUX_INIT;
@@ -608,8 +611,8 @@ LbmFsgrSolver::mainLoop(int lev)
                // read distribution funtions of adjacent cells = stream step
                DEFAULT_STREAM;
 
-               if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; mNumInvIfCells++; }
-               if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; mNumInvIfCells++; }
+               if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; calcNumInvIfCells++; }
+               if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; calcNumInvIfCells++; }
 
                // calculate mass exchange for interface cells 
                LbmFloat myfrac = RAC(ccel,dFfrac);
@@ -809,7 +812,7 @@ LbmFsgrSolver::mainLoop(int lev)
                        // fill if cells in inflow region
                        if(myfrac<0.5) { 
                                mass += 0.25; 
-                               mInitialMass += 0.25;
+                               calcInitialMass += 0.25;
                        }
                        const int OId = oldFlag>>24;
                        const LbmVec vel(mObjectSpeeds[OId]);
@@ -1013,7 +1016,7 @@ LbmFsgrSolver::mainLoop(int lev)
                if( (mass) <= (rho * (   -FSGR_MAGICNR)) ) { ifemptied = 1; }
 
                if(oldFlag & (CFMbndOutflow)) {
-                       mInitialMass -= mass;
+                       calcInitialMass -= mass;
                        mass = myfrac = 0.0;
                        iffilled = 0; ifemptied = 1;
                }
@@ -1105,6 +1108,8 @@ LbmFsgrSolver::mainLoop(int lev)
        mNumFilledCells  = calcCellsFilled;
        mNumEmptiedCells = calcCellsEmptied;
        mNumUsedCells = calcNumUsedCells;
+       mNumInvIfCells += calcNumInvIfCells;
+       mInitialMass += calcInitialMass;
 }
 
 
@@ -1115,13 +1120,14 @@ LbmFsgrSolver::preinitGrids()
        const int lev = mMaxRefine;
        const bool doReduce = false;
        const int gridLoopBound=0;
+       const int gDebugLevel = ::gDebugLevel;
 
        // preinit both grids
        for(int s=0; s<2; s++) {
        
                GRID_REGION_INIT();
 #if PARALLEL==1
-#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \
+#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
   reduction(+: \
          calcCurrentMass,calcCurrentVolume, \
                calcCellsFilled,calcCellsEmptied, \
@@ -1155,10 +1161,11 @@ LbmFsgrSolver::standingFluidPreinit()
        const int lev = mMaxRefine;
        const bool doReduce = false;
        const int gridLoopBound=1;
+       const int gDebugLevel = ::gDebugLevel;
 
        GRID_REGION_INIT();
 #if PARALLEL==1
-#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \
+#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
   reduction(+: \
          calcCurrentMass,calcCurrentVolume, \
                calcCellsFilled,calcCellsEmptied, \
index 60e7815ccbbd9ace7b7bcc506ae7ecbb0e553bf2..e43634508b7fbe8768154406ca07da131191f81a 100644 (file)
@@ -712,18 +712,26 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
 }
 
 
-GHOST_EventWheel *GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
+void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
 {
-       // short fwKeys = LOWORD(wParam);                       // key flags
-       int zDelta = (short) HIWORD(wParam);    // wheel rotation
-       
-       // zDelta /= WHEEL_DELTA;
-       // temporary fix below: microsoft now has added more precision, making the above division not work
-       zDelta = (zDelta <= 0) ? -1 : 1;
+       GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
 
-       // short xPos = (short) LOWORD(lParam); // horizontal position of pointer
-       // short yPos = (short) HIWORD(lParam); // vertical position of pointer
-       return new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, zDelta);
+       int acc = system->m_wheelDeltaAccum;
+       int delta = GET_WHEEL_DELTA_WPARAM(wParam);
+       
+       if (acc * delta < 0) {
+               // scroll direction reversed.
+               acc = 0;
+       }
+       acc += delta;
+       int direction = (acc >= 0) ? 1 : -1;
+       acc = abs(acc);
+       
+       while (acc >= WHEEL_DELTA) {
+               system->pushEvent(new GHOST_EventWheel(system->getMilliSeconds(), window, direction));
+               acc -= WHEEL_DELTA;
+       }
+       system->m_wheelDeltaAccum = acc * direction;
 }
 
 
@@ -1137,14 +1145,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                                        POINT mouse_pos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
                                        HWND mouse_hwnd = ChildWindowFromPoint(HWND_DESKTOP, mouse_pos);
                                        GHOST_WindowWin32 *mouse_window = (GHOST_WindowWin32 *)::GetWindowLongPtr(mouse_hwnd, GWLP_USERDATA);
-                                       if (mouse_window != NULL) {
-                                               event = processWheelEvent(mouse_window, wParam, lParam);
-                                       }
-                                       else {
-                                               /* Happens when mouse is not over any of blender's windows. */
-                                               event = processWheelEvent(window, wParam, lParam);
-                                       }
-
+                                       
+                                       processWheelEvent(mouse_window ? mouse_window : window , wParam, lParam);
+                                       eventHandled = true;
 #ifdef BROKEN_PEEK_TOUCHPAD
                                        PostMessage(hwnd, WM_USER, 0, 0);
 #endif
@@ -1203,6 +1206,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                                        GHOST_ModifierKeys modifiers;
                                        modifiers.clear();
                                        system->storeModifierKeys(modifiers);
+                                       system->m_wheelDeltaAccum = 0;
                                        event = processWindowEvent(LOWORD(wParam) ? GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate, window);
                                        /* WARNING: Let DefWindowProc handle WM_ACTIVATE, otherwise WM_MOUSEWHEEL
                                         * will not be dispatched to OUR active window if we minimize one of OUR windows. */
index 3085fde610b1580d4df934abea7192c7d049f6e2..d534a300b35c195930410102a4f71263c3c3c566 100644 (file)
@@ -264,12 +264,12 @@ protected:
        static GHOST_EventCursor *processCursorEvent(GHOST_TEventType type, GHOST_WindowWin32 *window);
 
        /**
-        * Creates a mouse wheel event.
+        * Handles a mouse wheel event.
         * \param window        The window receiving the event (the active window).
         * \param wParam        The wParam from the wndproc
         * \param lParam        The lParam from the wndproc
         */
-       static GHOST_EventWheel *processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam);
+       static void processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam);
 
        /**
         * Creates a key event and updates the key data stored locally (m_modifierKeys).
@@ -376,6 +376,9 @@ protected:
 
        /** Console status */
        int m_consoleStatus;
+
+       /** Wheel delta accumulator **/
+       int m_wheelDeltaAccum;
 };
 
 inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const
index 4f911c3582fa38b0d22b356473ea4f93be948a6b..022075805e454f585d2014cab0ff4f14962981a4 100644 (file)
--- a/make.bat
+++ b/make.bat
@@ -6,7 +6,17 @@ setlocal ENABLEEXTENSIONS
 set BLENDER_DIR=%~dp0
 set BUILD_DIR=%BLENDER_DIR%..\build_windows
 set BUILD_TYPE=Release
+rem reset all variables so they do not get accidentally get carried over from previous builds
 set BUILD_CMAKE_ARGS=
+set BUILD_ARCH=
+set BUILD_VS_VER=
+set BUILD_VS_YEAR=
+set KEY_NAME=
+set MSBUILD_PLATFORM=
+set MUST_CLEAN=
+set NOBUILD=
+set TARGET=
+set WINDOWS_ARCH=
 
 :argv_loop
 if NOT "%1" == "" (
@@ -18,54 +28,34 @@ if NOT "%1" == "" (
 
        REM Build Types
        if "%1" == "debug" (
-               set BUILD_DIR=%BUILD_DIR%_debug
                set BUILD_TYPE=Debug
-
        REM Build Configurations
        ) else if "%1" == "full" (
-               set TARGET_SET=1
-               set BUILD_DIR=%BUILD_DIR%_full
+               set TARGET=Full
                set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
                    -C"%BLENDER_DIR%\build_files\cmake\config\blender_full.cmake"
        ) else if "%1" == "lite" (
-               set TARGET_SET=1
-               set BUILD_DIR=%BUILD_DIR%_lite
+               set TARGET=Lite
                set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
                    -C"%BLENDER_DIR%\build_files\cmake\config\blender_lite.cmake"
        ) else if "%1" == "cycles" (
-               set TARGET_SET=1
-               set BUILD_DIR=%BUILD_DIR%_cycles
+               set TARGET=Cycles
                set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
                    -C"%BLENDER_DIR%\build_files\cmake\config\cycles_standalone.cmake"
        ) else if "%1" == "headless" (
-               set TARGET_SET=1
-               set BUILD_DIR=%BUILD_DIR%_headless
+               set TARGET=Headless
                set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
                    -C"%BLENDER_DIR%\build_files\cmake\config\blender_headless.cmake"
        ) else if "%1" == "bpy" (
-               set TARGET_SET=1
-               set BUILD_DIR=%BUILD_DIR%_bpy
+               set TARGET=Bpy
                set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
                    -C"%BLENDER_DIR%\build_files\cmake\config\bpy_module.cmake"
        ) else if "%1" == "release" (
-               set TARGET_SET=1
-               if "%CUDA_PATH_V7_5%"=="" (
-                       echo Cuda 7.5 Not found, aborting!
-                       goto EOF
-               )
-               if "%CUDA_PATH_V8_0%"=="" (
-                       echo Cuda 8.0 Not found, aborting!
-                       goto EOF
-               )
-               set BUILD_DIR=%BUILD_DIR%_Release
-               set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-                   -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V7_5%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe  
+               set TARGET=Release
        )       else if "%1" == "x86" (
                set BUILD_ARCH=x86
-               set BUILD_DIR=%BUILD_DIR%_x86
        )       else if "%1" == "x64" (
                set BUILD_ARCH=x64
-               set BUILD_DIR=%BUILD_DIR%_x64
        )       else if "%1" == "2015" (
        set BUILD_VS_VER=14
        set BUILD_VS_YEAR=2015
@@ -105,10 +95,13 @@ if NOT "%1" == "" (
 if "%BUILD_ARCH%"=="" (
        if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
                set WINDOWS_ARCH= Win64
+               set BUILD_ARCH=x64
        ) else if "%PROCESSOR_ARCHITEW6432%" == "AMD64" (
                set WINDOWS_ARCH= Win64
+               set BUILD_ARCH=x64
        ) else (
                set WINDOWS_ARCH=
+               set BUILD_ARCH=x86
        )
 ) else if "%BUILD_ARCH%"=="x64" (
                set WINDOWS_ARCH= Win64
@@ -121,8 +114,39 @@ if "%BUILD_VS_VER%"=="" (
        set BUILD_VS_YEAR=2013
 )
 
-set BUILD_DIR=%BUILD_DIR%_vc%BUILD_VS_VER%
+if "%BUILD_ARCH%"=="x64" (
+       set MSBUILD_PLATFORM=x64
+       ) else if "%BUILD_ARCH%"=="x86" (
+               set MSBUILD_PLATFORM=win32
+)
+
 
+set BUILD_DIR=%BUILD_DIR%_%TARGET%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
+
+
+if "%target%"=="Release" (
+               rem for vc12 check for both cuda 7.5 and 8 
+               if "%BUILD_VS_VER%"=="12" (
+                       if "%CUDA_PATH_V7_5%"=="" (
+                               echo Cuda 7.5 Not found, aborting!
+                               goto EOF
+                       )
+               )
+               if "%CUDA_PATH_V8_0%"=="" (
+                       echo Cuda 8.0 Not found, aborting!
+                       goto EOF
+               )
+               if "%BUILD_VS_VER%"=="12" (
+                                       set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
+                                       -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V7_5%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe  
+               )               
+               if "%BUILD_VS_VER%"=="14" (
+                                       set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
+                                       -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe  
+               )
+)
+
+:DetectMSVC
 REM Detect MSVC Installation
 if DEFINED VisualStudioVersion goto msvc_detect_finally
 set VALUE_NAME=ProductDir
@@ -140,10 +164,18 @@ if DEFINED MSVC_VC_DIR call "%MSVC_VC_DIR%\vcvarsall.bat"
 REM Sanity Checks
 where /Q msbuild
 if %ERRORLEVEL% NEQ 0 (
-       echo Error: "MSBuild" command not in the PATH.
-       echo You must have MSVC installed and run this from the "Developer Command Prompt"
-       echo ^(available from Visual Studio's Start menu entry^), aborting!
-       goto EOF
+       if "%BUILD_VS_VER%"=="12" (
+               rem vs12 not found, try vs14
+               echo Visual Studio 2012 not found, trying Visual Studio 2015.
+               set BUILD_VS_VER=14
+               set BUILD_VS_YEAR=2015
+               goto DetectMSVC
+       )       else    (
+               echo Error: "MSBuild" command not in the PATH.
+               echo You must have MSVC installed and run this from the "Developer Command Prompt"
+               echo ^(available from Visual Studio's Start menu entry^), aborting!
+               goto EOF
+       )
 )
 where /Q cmake
 if %ERRORLEVEL% NEQ 0 (
@@ -156,7 +188,7 @@ if NOT EXIST %BLENDER_DIR%..\lib\nul (
        echo This is needed for building, aborting!
        goto EOF
 )
-if NOT "%TARGET_SET%"=="1" (
+if "%TARGET%"=="" (
        echo Error: Convenience target not set
        echo This is required for building, aborting!
        echo . 
@@ -173,7 +205,9 @@ if "%MUST_CLEAN%"=="1" (
                        %BUILD_DIR%\Blender.sln ^
                        /target:clean ^
                        /property:Configuration=%BUILD_TYPE% ^
-                       /verbosity:minimal
+                       /verbosity:minimal ^
+                       /p:platform=%MSBUILD_PLATFORM%
+
                if %ERRORLEVEL% NEQ 0 (
                        echo Cleaned "%BUILD_DIR%"
                )
@@ -202,7 +236,8 @@ msbuild ^
        /target:build ^
        /property:Configuration=%BUILD_TYPE% ^
        /maxcpucount ^
-       /verbosity:minimal
+       /verbosity:minimal ^
+       /p:platform=%MSBUILD_PLATFORM%
 
 if %ERRORLEVEL% NEQ 0 (
        echo "Build Failed"
@@ -212,7 +247,8 @@ if %ERRORLEVEL% NEQ 0 (
 msbuild ^
        %BUILD_DIR%\INSTALL.vcxproj ^
        /property:Configuration=%BUILD_TYPE% ^
-       /verbosity:minimal
+       /verbosity:minimal ^
+       /p:platform=%MSBUILD_PLATFORM%
 
 echo.
 echo At any point you can optionally modify your build configuration by editing:
@@ -224,10 +260,9 @@ goto EOF
 :HELP
                echo.
                echo Convenience targets
-               echo - release 
-               echo - debug
-               echo - full
-               echo - lite
+               echo - release ^(identical to the offical blender.org builds^)
+               echo - full ^(same as release minus the cuda kernels^)
+               echo - lite 
                echo - headless
                echo - cycles
                echo - bpy
@@ -239,6 +274,7 @@ goto EOF
                echo - showhash ^(Show git hashes of source tree^)
                echo.
                echo Configuration options
+               echo - debug ^(Build an unoptimized debuggable build^)
                echo - packagename [newname] ^(override default cpack package name^)
                echo - x86 ^(override host autodetect and build 32 bit code^)
                echo - x64 ^(override host autodetect and build 64 bit code^)
index 82014c87be98eb6c8cf7299813cba954b50d9759..303a8b01192e9a611dbd8278c8951ef8c91e6c00 100644 (file)
@@ -23,6 +23,7 @@ from bpy.types import Operator
 from bpy.props import (
         FloatProperty,
         IntProperty,
+        BoolProperty,
         )
 from bpy.app.translations import pgettext_data as data_
 
@@ -81,6 +82,33 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg):
     return verts, faces
 
 
+def add_uvs(mesh, minor_seg, major_seg):
+    mesh.uv_textures.new()
+    uv_layer = mesh.uv_layers.active
+    u_step = 1.0/major_seg
+    v_step = 1.0/minor_seg
+    vertex_index = 0
+
+    u = 0.5
+    for major_index in range(major_seg):
+        v = 0.5
+        for minor_index in range(minor_seg):
+            loops = mesh.polygons[vertex_index].loop_indices
+            if minor_index == minor_seg-1 and major_index == 0:
+                uv_layer.data[loops[1]].uv = (u, v)
+                uv_layer.data[loops[2]].uv = (u + u_step, v)
+                uv_layer.data[loops[0]].uv = (u, v + v_step)
+                uv_layer.data[loops[3]].uv = (u + u_step, v + v_step)
+            else:
+                uv_layer.data[loops[0]].uv = (u, v)
+                uv_layer.data[loops[1]].uv = (u + u_step, v)
+                uv_layer.data[loops[3]].uv = (u, v + v_step)
+                uv_layer.data[loops[2]].uv = (u + u_step, v + v_step)
+            v = (v + v_step) % 1.0
+            vertex_index += 1
+        u = (u + u_step) % 1.0
+
+
 class AddTorus(Operator, object_utils.AddObjectHelper):
     """Add a torus mesh"""
     bl_idname = "mesh.primitive_torus_add"
@@ -145,10 +173,18 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
             subtype='DISTANCE',
             unit='LENGTH',
             )
+    generate_uvs = BoolProperty(
+            name="Generate UVs",
+            description="Generate a default UV map",
+            default=False,
+            )
 
     def draw(self, context):
         layout = self.layout
+
         col = layout.column(align=True)
+        col.prop(self, 'generate_uvs')
+        col.separator()
         col.prop(self, 'view_align')
 
         col = layout.column(align=True)
@@ -217,6 +253,10 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
         mesh.polygons.foreach_set("loop_start", range(0, nbr_loops, 4))
         mesh.polygons.foreach_set("loop_total", (4,) * nbr_polys)
         mesh.loops.foreach_set("vertex_index", faces)
+
+        if self.generate_uvs:
+            add_uvs(mesh, self.minor_segments, self.major_segments)
+
         mesh.update()
 
         object_utils.object_data_add(context, mesh, operator=self)
index 772ba2d9c807d0f3ba3a6019896308db40629b70..66aa8e3f498a9020f28f03427c4ad289cd79a1b3 100644 (file)
@@ -368,6 +368,10 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
                                        CALLBACK_INVOKE(base->object, IDWALK_USER);
                                }
 
+                               for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) {
+                                       CALLBACK_INVOKE(marker->camera, IDWALK_NOP);
+                               }
+
                                if (toolsett) {
                                        CALLBACK_INVOKE(toolsett->skgen_template, IDWALK_NOP);
 
@@ -776,6 +780,15 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
                                }
                                break;
                        }
+                       case ID_AC:
+                       {
+                               bAction *act = (bAction *) id;
+
+                               for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
+                                       CALLBACK_INVOKE(marker->camera, IDWALK_NOP);
+                               }
+                               break;
+                       }
 
                        /* Nothing needed for those... */
                        case ID_IM:
@@ -783,7 +796,6 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
                        case ID_TXT:
                        case ID_SO:
                        case ID_AR:
-                       case ID_AC:
                        case ID_GD:
                        case ID_WM:
                        case ID_PAL:
index c240aa273433bad75f5cf6cee60497a8891115c4..65d751a8a72c7b23a812f2b8b9ac7862567b0b04 100644 (file)
@@ -3447,7 +3447,13 @@ static ImBuf *do_render_strip_uncached(
                                        state->scene_parents = &scene_parent;
                                        /* end check */
 
-                                       ibuf = do_render_strip_seqbase(context, state, seq, nr, use_preprocess);
+                                       /* Use the Scene Seq's scene for the context when rendering the scene's sequences
+                                        * (necessary for Multicam Selector among others).
+                                        */
+                                       SeqRenderData local_context = *context;
+                                       local_context.scene = seq->scene;
+
+                                       ibuf = do_render_strip_seqbase(&local_context, state, seq, nr, use_preprocess);
 
                                        /* step back in the list */
                                        state->scene_parents = state->scene_parents->next;
index a476b18eaace3314fc3c6a9049b797cdc8ac095e..4e1eb41c7cf325d410639304116af2e278cfbe17 100644 (file)
@@ -2509,6 +2509,12 @@ static void lib_link_action(FileData *fd, Main *main)
 // >>> XXX deprecated - old animation system
                        
                        lib_link_fcurves(fd, &act->id, &act->curves);
+
+                       for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
+                               if (marker->camera) {
+                                       marker->camera = newlibadr(fd, act->id.lib, marker->camera);
+                               }
+                       }
                }
        }
 }
@@ -5226,7 +5232,6 @@ static void lib_link_scene(FileData *fd, Main *main)
        Base *base, *next;
        Sequence *seq;
        SceneRenderLayer *srl;
-       TimeMarker *marker;
        FreestyleModuleConfig *fmc;
        FreestyleLineSet *fls;
 
@@ -5325,15 +5330,11 @@ static void lib_link_scene(FileData *fd, Main *main)
                        }
                        SEQ_END
 
-#ifdef DURIAN_CAMERA_SWITCH
-                       for (marker = sce->markers.first; marker; marker = marker->next) {
+                       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
                                if (marker->camera) {
                                        marker->camera = newlibadr(fd, sce->id.lib, marker->camera);
                                }
                        }
-#else
-                       (void)marker;
-#endif
                        
                        BKE_sequencer_update_muting(sce->ed);
                        BKE_sequencer_update_sound_bounds_all(sce);
@@ -8461,6 +8462,12 @@ static void expand_action(FileData *fd, Main *mainvar, bAction *act)
        
        /* F-Curves in Action */
        expand_fcurves(fd, mainvar, &act->curves);
+
+       for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
+               if (marker->camera) {
+                       expand_doit(fd, mainvar, marker->camera);
+               }
+       }
 }
 
 static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list)
@@ -9035,17 +9042,11 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
                expand_doit(fd, mainvar, sce->rigidbody_world->constraints);
        }
 
-#ifdef DURIAN_CAMERA_SWITCH
-       {
-               TimeMarker *marker;
-               
-               for (marker = sce->markers.first; marker; marker = marker->next) {
-                       if (marker->camera) {
-                               expand_doit(fd, mainvar, marker->camera);
-                       }
+       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
+               if (marker->camera) {
+                       expand_doit(fd, mainvar, marker->camera);
                }
        }
-#endif
 
        expand_doit(fd, mainvar, sce->clip);
 }
index 7874dc052f02db50f1552dbcda07eecb7f15ef7d..ac6e6f8f09536c7c3e7c6bc41c17ac18e76288d4 100644 (file)
@@ -370,10 +370,12 @@ void DepsgraphRelationBuilder::add_node_handle_relation(
        }
        else {
                if (!op_from) {
-                       /* XXX TODO handle as error or report if needed */
+                       fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_from (%s)\n",
+                               type, description, key_from.identifier().c_str());
                }
                if (!op_to) {
-                       /* XXX TODO handle as error or report if needed */
+                       fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_to (%s)\n",
+                               type, description, key_from.identifier().c_str());
                }
        }
 }
index e71c05d19c5b7e0476ee54154d249ba9f7f4971d..72034b4f828f7f53c6b048e7a321333167e4560d 100644 (file)
@@ -559,6 +559,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
                                if (pathString == NULL || !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingUTF8))
                                        continue;
 
+                               /* Add end slash for consistency with other platforms */
+                               BLI_add_slash(line);
+
                                /* Exclude "all my files" as it makes no sense in blender fileselector */
                                /* Exclude "airdrop" if wlan not active as it would show "" ) */
                                if (!strstr(line, "myDocuments.cannedSearch") && (*line != '\0')) {
index 1b0f5862a44a5a19423f07da827467207de60642..c8ccb3772c586a0bbe6f7d2995e9291fa523192d 100644 (file)
@@ -294,7 +294,7 @@ static void copy_vert_no(const BVHTreeFromMeshType *meshdata, const int index, f
                case SNAP_MESH:
                {
                        BVHTreeFromMesh *data = meshdata->userdata;
-                       const MVert *vert = data->vert;
+                       const MVert *vert = data->vert + index;
                        normal_short_to_float_v3(r_no, vert->no);
                        break;
                }
@@ -1302,6 +1302,7 @@ static bool snapDerivedMesh(
                                }
                        }
                }
+               /* SCE_SNAP_MODE_VERTEX or SCE_SNAP_MODE_EDGE */
                else {
                        const ARegion *ar = sctx->v3d_data.ar;
 
index 440cfc0c814ab4ea25dd17961603b0e3a1b8e14d..3e8f0baf7b03fbc020fdf5adb0e5d860044cfcab 100644 (file)
@@ -779,7 +779,7 @@ static void shade_light_textures(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **
        for (int i = 0; i < MAX_MTEX; ++i) {
                MTex *mtex = lamp->la->mtex[i];
 
-               if (mtex && mtex->tex->type & TEX_IMAGE && mtex->tex->ima) {
+               if (mtex && mtex->tex && (mtex->tex->type & TEX_IMAGE) && mtex->tex->ima) {
                        mat->dynproperty |= DYN_LAMP_PERSMAT;
 
                        float one = 1.0f;
index 119bfb61fec7bdeccda4a5341c705419eb363919..67da8201f66348cd1b7f9345d1a7b14ed9d2f795 100644 (file)
@@ -2705,7 +2705,7 @@ void node_geometry(
 
        parametric = vec3(0.0);
        backfacing = (gl_FrontFacing) ? 0.0 : 1.0;
-       pointiness = 0.0;
+       pointiness = 0.5;
 }
 
 void node_tex_coord(
index ceb7dc0269930f15e1ffba470422728bd51d5678..454c97451a8afe82c3a5ffeb8037acb1945a9f10 100644 (file)
@@ -188,7 +188,7 @@ static bool polygons_check_flip(
 }
 
 static void normalEditModifier_do_radial(
-        NormalEditModifierData *smd, Object *ob, DerivedMesh *dm,
+        NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm,
         short (*clnors)[2], float (*loopnors)[3], float (*polynors)[3],
         const short mix_mode, const float mix_factor, const float mix_limit,
         MDeformVert *dvert, const int defgrp_index, const bool use_invert_vgroup,
@@ -203,7 +203,7 @@ static void normalEditModifier_do_radial(
 
        BLI_bitmap *done_verts = BLI_BITMAP_NEW((size_t)num_verts, __func__);
 
-       generate_vert_coordinates(dm, ob, smd->target, smd->offset, num_verts, cos, size);
+       generate_vert_coordinates(dm, ob, enmd->target, enmd->offset, num_verts, cos, size);
 
        /**
         * size gives us our spheroid coefficients ``(A, B, C)``.
@@ -287,14 +287,14 @@ static void normalEditModifier_do_radial(
 }
 
 static void normalEditModifier_do_directional(
-        NormalEditModifierData *smd, Object *ob, DerivedMesh *dm,
+        NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm,
         short (*clnors)[2], float (*loopnors)[3], float (*polynors)[3],
         const short mix_mode, const float mix_factor, const float mix_limit,
         MDeformVert *dvert, const int defgrp_index, const bool use_invert_vgroup,
         MVert *mvert, const int num_verts, MEdge *medge, const int num_edges,
         MLoop *mloop, const int num_loops, MPoly *mpoly, const int num_polys)
 {
-       const bool use_parallel_normals = (smd->flag & MOD_NORMALEDIT_USE_DIRECTION_PARALLEL) != 0;
+       const bool use_parallel_normals = (enmd->flag & MOD_NORMALEDIT_USE_DIRECTION_PARALLEL) != 0;
 
        float (*cos)[3] = MEM_mallocN(sizeof(*cos) * num_verts, __func__);
        float (*nos)[3] = MEM_mallocN(sizeof(*nos) * num_loops, __func__);
@@ -309,14 +309,14 @@ static void normalEditModifier_do_directional(
                float mat[4][4];
 
                invert_m4_m4(mat, ob->obmat);
-               mul_m4_m4m4(mat, mat, smd->target->obmat);
+               mul_m4_m4m4(mat, mat, enmd->target->obmat);
                copy_v3_v3(target_co, mat[3]);
        }
 
        if (use_parallel_normals) {
                float no[3];
 
-               sub_v3_v3v3(no, target_co, smd->offset);
+               sub_v3_v3v3(no, target_co, enmd->offset);
                normalize_v3(no);
 
                for (i = num_loops; i--; ) {
@@ -362,19 +362,19 @@ static void normalEditModifier_do_directional(
        MEM_freeN(nos);
 }
 
-static bool is_valid_target(NormalEditModifierData *smd)
+static bool is_valid_target(NormalEditModifierData *enmd)
 {
-       if (smd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
+       if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
                return true;
        }
-       else if ((smd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && smd->target) {
+       else if ((enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && enmd->target) {
                return true;
        }
-       modifier_setError((ModifierData *)smd, "Invalid target settings");
+       modifier_setError((ModifierData *)enmd, "Invalid target settings");
        return false;
 }
 
-static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *ob, DerivedMesh *dm)
+static DerivedMesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm)
 {
        Mesh *me = ob->data;
 
@@ -387,11 +387,11 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
        MLoop *mloop;
        MPoly *mpoly;
 
-       const bool use_invert_vgroup = ((smd->flag & MOD_NORMALEDIT_INVERT_VGROUP) != 0);
-       const bool use_current_clnors = !((smd->mix_mode == MOD_NORMALEDIT_MIX_COPY) &&
-                                         (smd->mix_factor == 1.0f) &&
-                                         (smd->defgrp_name[0] == '\0') &&
-                                         (smd->mix_limit == (float)M_PI));
+       const bool use_invert_vgroup = ((enmd->flag & MOD_NORMALEDIT_INVERT_VGROUP) != 0);
+       const bool use_current_clnors = !((enmd->mix_mode == MOD_NORMALEDIT_MIX_COPY) &&
+                                         (enmd->mix_factor == 1.0f) &&
+                                         (enmd->defgrp_name[0] == '\0') &&
+                                         (enmd->mix_limit == (float)M_PI));
 
        int defgrp_index;
        MDeformVert *dvert;
@@ -403,12 +403,12 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
        bool free_polynors = false;
 
        /* Do not run that modifier at all if autosmooth is disabled! */
-       if (!is_valid_target(smd) || !num_loops) {
+       if (!is_valid_target(enmd) || !num_loops) {
                return dm;
        }
 
        if (!(me->flag & ME_AUTOSMOOTH)) {
-               modifier_setError((ModifierData *)smd, "Enable 'Auto Smooth' option in mesh settings");
+               modifier_setError((ModifierData *)enmd, "Enable 'Auto Smooth' option in mesh settings");
                return dm;
        }
 
@@ -441,18 +441,18 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
                free_polynors = true;
        }
 
-       modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
+       modifier_get_vgroup(ob, dm, enmd->defgrp_name, &dvert, &defgrp_index);
 
-       if (smd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
+       if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
                normalEditModifier_do_radial(
-                           smd, ob, dm, clnors, loopnors, polynors,
-                           smd->mix_mode, smd->mix_factor, smd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
+                           enmd, ob, dm, clnors, loopnors, polynors,
+                           enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
                            mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys);
        }
-       else if (smd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) {
+       else if (enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) {
                normalEditModifier_do_directional(
-                           smd, ob, dm, clnors, loopnors, polynors,
-                           smd->mix_mode, smd->mix_factor, smd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
+                           enmd, ob, dm, clnors, loopnors, polynors,
+                           enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
                            mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys);
        }
 
@@ -465,13 +465,13 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
 
 static void initData(ModifierData *md)
 {
-       NormalEditModifierData *smd = (NormalEditModifierData *)md;
+       NormalEditModifierData *enmd = (NormalEditModifierData *)md;
 
-       smd->mode = MOD_NORMALEDIT_MODE_RADIAL;
+       enmd->mode = MOD_NORMALEDIT_MODE_RADIAL;
 
-       smd->mix_mode = MOD_NORMALEDIT_MIX_COPY;
-       smd->mix_factor = 1.0f;
-       smd->mix_limit = M_PI;
+       enmd->mix_mode = MOD_NORMALEDIT_MIX_COPY;
+       enmd->mix_factor = 1.0f;
+       enmd->mix_limit = M_PI;
 }
 
 static void copyData(ModifierData *md, ModifierData *target)
@@ -481,11 +481,11 @@ static void copyData(ModifierData *md, ModifierData *target)
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 {
-       NormalEditModifierData *smd = (NormalEditModifierData *)md;
+       NormalEditModifierData *enmd = (NormalEditModifierData *)md;
        CustomDataMask dataMask = CD_CUSTOMLOOPNORMAL;
 
        /* Ask for vertexgroups if we need them. */
-       if (smd->defgrp_name[0]) {
+       if (enmd->defgrp_name[0]) {
                dataMask |= (CD_MASK_MDEFORMVERT);
        }
 
@@ -499,16 +499,16 @@ static bool dependsOnNormals(ModifierData *UNUSED(md))
 
 static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData)
 {
-       NormalEditModifierData *smd = (NormalEditModifierData *) md;
+       NormalEditModifierData *enmd = (NormalEditModifierData *) md;
 
-       walk(userData, ob, &smd->target, IDWALK_NOP);
+       walk(userData, ob, &enmd->target, IDWALK_NOP);
 }
 
 static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
 {
-       NormalEditModifierData *smd = (NormalEditModifierData *)md;
+       NormalEditModifierData *enmd = (NormalEditModifierData *)md;
 
-       return !is_valid_target(smd);
+       return !is_valid_target(enmd);
 }
 
 static void updateDepgraph(ModifierData *md, DagForest *forest,
@@ -516,10 +516,10 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
                            struct Scene *UNUSED(scene),
                            Object *UNUSED(ob), DagNode *obNode)
 {
-       NormalEditModifierData *smd = (NormalEditModifierData *) md;
+       NormalEditModifierData *enmd = (NormalEditModifierData *) md;
 
-       if (smd->target) {
-               DagNode *Node = dag_get_node(forest, smd->target);
+       if (enmd->target) {
+               DagNode *Node = dag_get_node(forest, enmd->target);
 
                dag_add_relation(forest, Node, obNode, DAG_RL_OB_DATA, "NormalEdit Modifier");
        }
@@ -531,9 +531,9 @@ static void updateDepsgraph(ModifierData *md,
                             Object *UNUSED(ob),
                             struct DepsNodeHandle *node)
 {
-       NormalEditModifierData *smd = (NormalEditModifierData *) md;
-       if (smd->target) {
-               DEG_add_object_relation(node, smd->target, DEG_OB_COMP_GEOMETRY, "NormalEdit Modifier");
+       NormalEditModifierData *enmd = (NormalEditModifierData *) md;
+       if (enmd->target) {
+               DEG_add_object_relation(node, enmd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier");
        }
 }
 
index cf77ebfbeb9c579d4835c701251d88d8b70b30cf..316871e602506887ac29b512a935efeea4b25985 100644 (file)
@@ -171,7 +171,7 @@ void RAS_StorageVA::TexCoordPtr(const RAS_TexVert *tv)
                                        glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getTangent());
                                        break;
                                case RAS_IRasterizer::RAS_TEXCO_VCOL:
-                                       glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(RAS_TexVert), tv->getRGBA());
+                                       glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(RAS_TexVert), tv->getRGBA());
                                        break;
                                default:
                                        break;
index cad5b5a508e8c154906f70ce7bc96635765328fa..114defb60a50ea201ed9b770630f0cdd36a79e6d 100644 (file)
@@ -149,6 +149,9 @@ void VBO::Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num,
                                        glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, this->stride, this->tangent_offset);
                                        glEnableVertexAttribArrayARB(unit);
                                        break;
+                               case RAS_IRasterizer::RAS_TEXCO_VCOL:
+                                       glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_TRUE, this->stride, this->color_offset);
+                                       glEnableVertexAttribArrayARB(unit);
                                default:
                                        break;
                        }