Merging r50374 through r50412 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 5 Sep 2012 11:42:20 +0000 (11:42 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 5 Sep 2012 11:42:20 +0000 (11:42 +0000)
92 files changed:
extern/bullet2/CMakeLists.txt
intern/cycles/app/cycles_test.cpp
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_particles.cpp
intern/cycles/blender/blender_session.h
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_sync.h
intern/cycles/blender/blender_util.h
intern/cycles/kernel/kernel_displace.h
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/osl/nodes/CMakeLists.txt
intern/cycles/kernel/osl/nodes/node_brick_texture.osl [new file with mode: 0644]
intern/cycles/kernel/osl/nodes/node_gradient_texture.osl
intern/cycles/kernel/osl/nodes/node_holdout.osl
intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl
intern/cycles/kernel/osl/nodes/node_noise_texture.osl
intern/cycles/kernel/osl/nodes/node_wave_texture.osl
intern/cycles/kernel/osl/osl_shader.cpp
intern/cycles/kernel/osl/osl_shader.h
intern/cycles/render/camera.cpp
intern/cycles/render/camera.h
intern/cycles/render/nodes.cpp
intern/cycles/render/osl.cpp
release/scripts/modules/addon_utils.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/templates/operator_modal.py
release/scripts/templates/operator_modal_draw.py
release/scripts/templates/operator_modal_timer.py
release/scripts/templates/operator_modal_view3d.py
source/blender/blenkernel/BKE_armature.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_deform.h
source/blender/blenkernel/BKE_object_deform.h [new file with mode: 0644]
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/object_deform.c [new file with mode: 0644]
source/blender/blenkernel/intern/seqmodifier.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenlib/CMakeLists.txt
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/compositor/COM_compositor.h
source/blender/compositor/intern/COM_Device.h
source/blender/compositor/intern/COM_Node.cpp
source/blender/compositor/intern/COM_Node.h
source/blender/compositor/intern/COM_NodeBase.h
source/blender/compositor/intern/COM_Socket.h
source/blender/compositor/intern/COM_WorkScheduler.cpp
source/blender/compositor/intern/COM_compositor.cpp
source/blender/compositor/nodes/COM_GroupNode.cpp
source/blender/compositor/nodes/COM_ImageNode.cpp
source/blender/compositor/operations/COM_CompositorOperation.h
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/io/io_collada.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_clip/clip_toolbar.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_buttons.c
source/blender/editors/space_node/node_templates.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/view3d_toolbar.c
source/blender/editors/util/CMakeLists.txt
source/blender/imbuf/intern/moviecache.c
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/rna_cleanup/rna_cleaner.py
source/blender/nodes/NOD_shader.h
source/blender/nodes/composite/node_composite_tree.c
source/blender/python/intern/bpy_interface.c
source/blender/render/intern/source/external_engine.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/render_result.c
source/blender/render/intern/source/render_texture.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_operators.c
source/tests/pep8.py

index 4bf26ab37940eaffd4be156b2b43d99a68309d83..c57474f99f27ba006c8ecacf31a9fcc96962d048 100644 (file)
@@ -314,6 +314,7 @@ set(SRC
        src/BulletDynamics/Character/btKinematicCharacterController.h
        
        src/BulletSoftBody/btSoftBody.h
+       src/BulletSoftBody/btSoftBodyInternals.h
        src/BulletSoftBody/btSoftBodyData.h
        src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h
        src/BulletSoftBody/btSoftBodyHelpers.h
@@ -355,6 +356,7 @@ set(SRC
        
        src/btBulletCollisionCommon.h
        src/btBulletDynamicsCommon.h
+       src/Bullet-C-Api.h
 )
 
 if(CMAKE_COMPILER_IS_GNUCXX)
index 75f76efc8e1c3f4e2583950ec6d48cf825638958..5ee351260c5070419d776e7e2abaa2c3611aa0e0 100644 (file)
@@ -66,12 +66,13 @@ static void session_print(const string& str)
 
 static void session_print_status()
 {
-       int sample;
+       int sample, tile;
        double total_time, sample_time;
        string status, substatus;
 
        /* get status */
-       options.session->progress.get_sample(sample, total_time, sample_time);
+       sample = options.session->progress.get_sample();
+       options.session->progress.get_tile(tile, total_time, sample_time);
        options.session->progress.get_status(status, substatus);
 
        if(substatus != "")
@@ -111,7 +112,7 @@ static void session_init()
 
 static void scene_init(int width, int height)
 {
-       options.scene = new Scene(options.scene_params);
+       options.scene = new Scene(options.scene_params, options.session_params.device);
        xml_read_file(options.scene, options.filepath.c_str());
        
        if (width == 0 || height == 0) {
@@ -147,11 +148,12 @@ static void display_info(Progress& progress)
        latency = (elapsed - last);
        last = elapsed;
 
-       int sample;
+       int sample, tile;
        double total_time, sample_time;
        string status, substatus;
 
-       progress.get_sample(sample, total_time, sample_time);
+       sample = progress.get_sample();
+       progress.get_tile(tile, total_time, sample_time);
        progress.get_status(status, substatus);
 
        if(substatus != "")
index c23f0196c2d60b288489460ca5490e71a3083608..7f3eca471e642161103e4aef70aabae95a56e244 100644 (file)
@@ -244,7 +244,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 
         cls.resolution_divider = IntProperty(
                 name="Resolution Divider",
-                description="Start viewport rendering with lower resolution which would be real resolution divided by two in power of this value",
+                description="For viewport render, the number of lower resolutions to render before the full resolution",
                 min=1, max=512,
                 default=4,
                 )
index 885b488a3ea56afd1873bb2076daa977d4185739..bf44a558b1ab5f2ebc8b77bf86d1c88d806900a1 100644 (file)
@@ -213,6 +213,8 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
         sub.prop(cscene, "debug_use_spatial_splits")
         sub.prop(cscene, "use_cache")
 
+        sub = col.column(align=True)
+        sub.label(text="Viewport:")
         sub.prop(cscene, "resolution_divider")
 
 
index fd9f836eec02a6202b300becbe84f63c6684b9f4..eb9deb0de2d9bb816a7418b5eb14920a96aac10f 100644 (file)
@@ -305,8 +305,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
        for(; b_sce && !cancel; b_sce = b_sce.background_set()) {
                for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end() && !cancel; ++b_ob) {
                        bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
-                       uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), object_is_light(*b_ob));
-                       CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, ob_layer);
+                       uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), render_layer.use_localview, object_is_light(*b_ob));
                        hide = hide || !(ob_layer & scene_layer);
 
                        if(!hide) {
index 177912cd8f09a432bb952046421698c037f23a32..f309960fc550e6d54a33e045299105c8c64d6c15 100644 (file)
@@ -199,8 +199,7 @@ void BlenderSync::sync_particle_systems()
        for(; b_sce; b_sce = b_sce.background_set()) {
                for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
                        bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
-                       uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), object_is_light(*b_ob));
-                       CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, ob_layer);
+                       uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), render_layer.use_localview, object_is_light(*b_ob));
                        hide = hide || !(ob_layer & scene_layer);
 
                        if(!hide) {
index 4666b5982e1162dae943caf7b705fb56d79b1963..d52e0103bbfe282c843aeb4579b4f0e8ff271e79 100644 (file)
@@ -53,8 +53,7 @@ public:
        void write_render_tile(RenderTile& rtile);
 
        /* update functions are used to update display buffer only after sample was rendered
-        * only needed for better visual feedback
-        */
+        * only needed for better visual feedback */
        void update_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile);
        void update_render_tile(RenderTile& rtile);
 
index cb83309cc0043a93fbff10a0d60c7a13ea4573db..907573cf07203d4be9142d14bde91f3eb4867f99 100644 (file)
@@ -231,8 +231,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
                }
                else {
                        render_layer.use_localview = (b_v3d.local_view() ? true : false);
-                       render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view());
-                       CYCLES_LOCAL_LAYER_HACK(render_layer.use_localview, render_layer.scene_layer);
+                       render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view(), render_layer.use_localview);
                        render_layer.layer = render_layer.scene_layer;
                        render_layer.holdout_layer = 0;
                        render_layer.material_override = PointerRNA_NULL;
@@ -354,8 +353,6 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
 
        /* tiles */
        if(params.device.type != DEVICE_CPU && !background) {
-               printf("%d\n", get_int(cscene, "debug_tile_size"));
-
                /* currently GPU could be much slower than CPU when using tiles,
                 * still need to be investigated, but meanwhile make it possible
                 * to work in viewport smoothly
index ac4cc37b74a20b75986d3d012717b86ee54bc9b3..27f6b6ee4ee8bbf7ec743900991bc48f33ca76f1 100644 (file)
@@ -137,20 +137,6 @@ private:
        Progress &progress;
 };
 
-/* we don't have spare bits for localview (normally 20-28)
- * because PATH_RAY_LAYER_SHIFT uses 20-32.
- * So - check if we have localview and if so, shift local
- * view bits down to 1-8, since this is done for the view
- * port only - it should be OK and not conflict with
- * render layers. - Campbell.
- *
- * ... as an alternative we could use uint64_t
- */
-#define CYCLES_LOCAL_LAYER_HACK(use_localview, layer)   \
-       if (use_localview) {                                \
-               layer >>= 20;                                   \
-       } (void)0
-
 CCL_NAMESPACE_END
 
 #endif /* __BLENDER_SYNC_H__ */
index b0febcc23d46182eb3f4d6aa1f8650f95866ed11..d0fca9a9fb94c516450483b9629a62d5b13820b1 100644 (file)
@@ -170,7 +170,7 @@ static inline uint get_layer(BL::Array<int, 20> array)
        return layer;
 }
 
-static inline uint get_layer(BL::Array<int, 20> array, BL::Array<int, 8> local_array, bool is_light = false)
+static inline uint get_layer(BL::Array<int, 20> array, BL::Array<int, 8> local_array, bool use_local, bool is_light = false)
 {
        uint layer = 0;
 
@@ -188,7 +188,14 @@ static inline uint get_layer(BL::Array<int, 20> array, BL::Array<int, 8> local_a
                        if(local_array[i])
                                layer |= (1 << (20+i));
        }
-       
+
+       /* we don't have spare bits for localview (normally 20-28) because
+        * PATH_RAY_LAYER_SHIFT uses 20-32. So - check if we have localview and if
+        * so, shift local view bits down to 1-8, since this is done for the view
+        * port only - it should be OK and not conflict with render layers. */
+       if(use_local)
+               layer >>= 20;
+
        return layer;
 }
 
index f4b33605f5be5b6b1475994f3030ee1e8eb8b833..6461a1eea389a1825d18ce77dbca81fac29ff97b 100644 (file)
@@ -63,6 +63,8 @@ __device void kernel_shader_evaluate(KernelGlobals *kg, uint4 *input, float4 *ou
                out = shader_eval_background(kg, &sd, flag);
        }
        
+       shader_release(kg, &sd);
+       
        /* write output */
        output[i] = make_float4(out.x, out.y, out.z, 0.0f);
 }
index 6c81fa4cfcad6d5e91be5b4baed2d1cf7c7f11be..d606c3d634a4268d853df68c324695149f441197 100644 (file)
@@ -209,6 +209,8 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra
                                if(ray->t != FLT_MAX)
                                        ray->D = normalize_len(Pend - ray->P, &ray->t);
 
+                               shader_release(kg, &sd);
+
                                bounce++;
                        }
                }
@@ -294,8 +296,10 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
                                L_transparent += average(holdout_weight*throughput);
                        }
 
-                       if(sd.flag & SD_HOLDOUT_MASK)
+                       if(sd.flag & SD_HOLDOUT_MASK) {
+                               shader_release(kg, &sd);
                                break;
+                       }
                }
 #endif
 
@@ -313,8 +317,10 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
                float probability = path_state_terminate_probability(kg, &state, throughput);
                float terminate = path_rng(kg, rng, sample, rng_offset + PRNG_TERMINATE);
 
-               if(terminate >= probability)
+               if(terminate >= probability) {
+                       shader_release(kg, &sd);
                        break;
+               }
 
                throughput /= probability;
 
@@ -380,8 +386,10 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
 #endif
 
                /* no BSDF? we can stop here */
-               if(!(sd.flag & SD_BSDF))
+               if(!(sd.flag & SD_BSDF)) {
+                       shader_release(kg, &sd);
                        break;
+               }
 
                /* sample BSDF */
                float bsdf_pdf;
@@ -486,8 +494,10 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
                float probability = path_state_terminate_probability(kg, &state, throughput);
                float terminate = path_rng(kg, rng, sample, rng_offset + PRNG_TERMINATE);
 
-               if(terminate >= probability)
+               if(terminate >= probability) {
+                       shader_release(kg, &sd);
                        break;
+               }
 
                throughput /= probability;
 
@@ -554,8 +564,10 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
 #endif
 
                /* no BSDF? we can stop here */
-               if(!(sd.flag & SD_BSDF))
+               if(!(sd.flag & SD_BSDF)) {
+                       shader_release(kg, &sd);
                        break;
+               }
 
                /* sample BSDF */
                float bsdf_pdf;
@@ -661,8 +673,10 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
                                L_transparent += average(holdout_weight*throughput);
                        }
 
-                       if(sd.flag & SD_HOLDOUT_MASK)
+                       if(sd.flag & SD_HOLDOUT_MASK) {
+                               shader_release(kg, &sd);
                                break;
+                       }
                }
 #endif
 
@@ -682,8 +696,10 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
                        float probability = path_state_terminate_probability(kg, &state, throughput);
                        float terminate = path_rng(kg, rng, sample, rng_offset + PRNG_TERMINATE);
 
-                       if(terminate >= probability)
+                       if(terminate >= probability) {
+                               shader_release(kg, &sd);
                                break;
+                       }
 
                        throughput /= probability;
                }
index 5ab3c2c25450718eab7835bedacca46efbe9d6a3..b57e27bc8ed7c5e9d6e69d52db82c7aed03c5e41 100644 (file)
@@ -46,6 +46,11 @@ CCL_NAMESPACE_BEGIN
 __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
        const Intersection *isect, const Ray *ray)
 {
+#ifdef __OSL__
+       if (kernel_osl_use(kg))
+               OSLShader::init(kg, sd);
+#endif
+
        /* fetch triangle data */
        int prim = kernel_tex_fetch(__prim_index, isect->prim);
        float4 Ns = kernel_tex_fetch(__tri_normal, prim);
@@ -129,6 +134,11 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
        const float3 P, const float3 Ng, const float3 I,
        int shader, int object, int prim, float u, float v, float t, float time)
 {
+#ifdef __OSL__
+       if (kernel_osl_use(kg))
+               OSLShader::init(kg, sd);
+#endif
+
        /* vectors */
        sd->P = P;
        sd->N = Ng;
@@ -233,6 +243,8 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
 __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
        int object, int prim, float u, float v)
 {
+       /* Note: no OSLShader::init call here, this is done in shader_setup_from_sample! */
+
        float3 P, Ng, I = make_float3(0.0f, 0.0f, 0.0f);
        int shader;
 
@@ -251,6 +263,11 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
 
 __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray)
 {
+#ifdef __OSL__
+       if (kernel_osl_use(kg))
+               OSLShader::init(kg, sd);
+#endif
+
        /* vectors */
        sd->P = ray->D;
        sd->N = -sd->P;
index 2d2b5b10ce68fa612a6bdca166c4151d9ef26061..08e9b9ee726f8131ab5c88f5d99fd26b536f99a8 100644 (file)
@@ -5,6 +5,7 @@ set(SRC_OSL
        node_add_closure.osl
        node_attribute.osl
        node_background.osl
+       node_brick_texture.osl
        node_bump.osl
        node_camera.osl
        node_checker_texture.osl
diff --git a/intern/cycles/kernel/osl/nodes/node_brick_texture.osl b/intern/cycles/kernel/osl/nodes/node_brick_texture.osl
new file mode 100644 (file)
index 0000000..4daceb4
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+#include "node_texture.h"
+
+/* Brick */
+
+float brick_noise(int n) /* fast integer noise */
+{
+       int nn;
+       n = (n >> 13) ^ n;
+       nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 2147483647;
+       return 0.5 * ((float)nn / 1073741824.0);
+}
+
+float brick(point p, float mortar_size, float bias,
+       float BrickWidth, float row_height, float offset_amount, int offset_frequency,
+       float squash_amount, int squash_frequency, float tint)
+{
+       int bricknum, rownum;
+       float offset = 0.0;
+       float brick_width = BrickWidth;
+       float x, y;
+
+       rownum = (int)floor(p[1] / row_height);
+       
+       if(offset_frequency && squash_frequency) {
+               brick_width *= ((int)(rownum) % squash_frequency ) ? 1.0 : squash_amount; /* squash */
+               offset = ((int)(rownum) % offset_frequency ) ? 0 : (brick_width*offset_amount); /* offset */
+       }
+
+       bricknum = (int)floor((p[0]+offset) / brick_width);
+
+       x = (p[0]+offset) - brick_width*bricknum;
+       y = p[1] - row_height*rownum;
+
+       tint = clamp((brick_noise((rownum << 16) + (bricknum & 65535)) + bias), 0.0, 1.0);
+
+       return (x < mortar_size || y < mortar_size ||
+               x > (brick_width - mortar_size) ||
+               y > (row_height - mortar_size)) ? 1.0 : 0.0;
+}
+
+shader node_brick_texture(
+       float Offset = 0.5,
+       int OffsetFrequency = 2,
+       float Squash = 1.0,
+       int SquashFrequency = 1,
+       point Vector = P,
+       color Color1 = color(0.2, 0.2, 0.2),
+       color Color2 = color(0.8, 0.8, 0.8),
+       color Mortar = color(0.0, 0.0, 0.0),
+       float Scale = 5.0,
+       float MortarSize = 0.02,
+       float Bias = 0.0,
+       float BrickWidth = 0.5,
+       float RowHeight = 0.25,
+       output float Fac = 0.0,
+       output color Color = color(0.2, 0.2, 0.2))
+{
+       float tint = 0.0;
+       color Col = Color1;
+       
+       Fac = brick(Vector*Scale, MortarSize, Bias, BrickWidth, RowHeight,
+               Offset, OffsetFrequency, Squash, SquashFrequency, tint);
+               
+       if(Fac != 1.0) {
+               float facm = 1.0 - tint;
+
+               Col[0] = facm * (Color1[0]) + tint * Color2[0];
+               Col[1] = facm * (Color1[1]) + tint * Color2[1];
+               Col[2] = facm * (Color1[2]) + tint * Color2[2];
+       }
+       
+       Color = (Fac == 1.0) ? Mortar: Col;
+
+}
+
index e6fa014324cb8cb0774a01a5f41b8d0a2fcef90d..a8dd65ae23bfc618d74adcee3b249768bf7f5e12 100644 (file)
 
 /* Gradient */
 
-float gradient(point p, string progression, string axis)
+float gradient(point p, string type)
 {
        float x, y;
-
-       if(axis == "Vertical") {
-               x= p[1];
-               y= p[0];
-       }
-       else {
-               x= p[0];
-               y= p[1];
-       }
+       
+       x = p[0];
+       y = p[1];
 
        float result = 0.0;
 
-       if(progression == "Linear") {
+       if(type == "Linear") {
                result = (1.0 + x)/2.0;
        }
-       else if(progression == "Quadratic") {
+       else if(type == "Quadratic") {
                float r = max((1.0 + x)/2.0, 0.0);
                result = r*r;
        }
-       else if(progression == "Easing") {
+       else if(type == "Easing") {
                float r = min(max((1.0 + x)/2.0, 0.0), 1.0);
                float t = r*r;
                
                result = (3.0*t - 2.0*t*r);
        }
-       else if(progression == "Diagonal") {
+       else if(type == "Diagonal") {
                result = (2.0 + x + y)/4.0;
        }
-       else if(progression == "Radial") {
+       else if(type == "Radial") {
                result = atan2(y, x)/(2*M_PI) + 0.5;
        }
        else {
                float r = max(1.0 - sqrt(x*x + y*y + p[2]*p[2]), 0.0);
 
-               if(progression == "Quadratic Sphere")
+               if(type == "Quadratic Sphere")
                        result = r*r;
-               else if(progression == "Spherical")
+               else if(type == "Spherical")
                        result = r;
        }
 
@@ -68,11 +62,12 @@ float gradient(point p, string progression, string axis)
 }
 
 shader node_gradient_texture(
-       string Progression = "Linear",
-       string Axis = "Horizontal",
+       string Type = "Linear",
        point Vector = P,
-       output float Fac = 0.0)
+       output float Fac = 0.0,
+       output color Color = color(0.0, 0.0, 0.0))
 {
-       Fac = gradient(Vector, Progression, Axis);
+       Fac = gradient(Vector, Type);
+       Color = color(Fac, Fac, Fac);
 }
 
index 69f8d85a82eee4f5016645abd189fbeb1601bcc8..aede50c7ca0dddf3b53912c72c0199c2b2b17506 100644 (file)
 
 #include "stdosl.h"
 
-shader node_background(
-       color Color = color(0.8, 0.8, 0.8),
-       float Strength = 1.0,
-       output closure color Background = background())
+shader node_holdout(
+       output closure color Holdout = holdout())
 {
-       Background = Color*Strength*background();
+
 }
 
index 3ab345279f1cc44c8a2a1b6282769d8599c74421..3e1a68626603c67252021517e89c13501622c89b 100644 (file)
@@ -186,32 +186,35 @@ float noise_musgrave_ridged_multi_fractal(point p, string basis, float H, float
 
 shader node_musgrave_texture(
        string Type = "fBM",
-       string Basis = "Perlin",
        float Dimension = 2.0,
        float Lacunarity = 1.0,
-       float Octaves = 2.0,
+       float Detail = 2.0,
        float Offset = 0.0,
-       float Intensity = 1.0,
        float Gain = 1.0,
        float Scale = 5.0,
        point Vector = P,
-       output float Fac = 0.0)
+       output float Fac = 0.0,
+       output color Color = color(0.0, 0.0, 0.0))
 {
-       float dimension = max(Dimension, 0.0);
-       float octaves = max(Octaves, 0.0);
+       float dimension = max(Dimension, 1e-5);
+       float octaves = clamp(Detail, 0.0, 16.0);
        float lacunarity = max(Lacunarity, 1e-5);
+       string Basis = "Perlin";
+       float intensity = 1.0;
 
        point p = Vector*Scale;
 
        if(Type == "Multifractal")
-               Fac = Intensity*noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
+               Fac = intensity*noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
        else if(Type == "fBM")
-               Fac = Intensity*noise_musgrave_fBm(p, Basis, dimension, lacunarity, octaves);
+               Fac = intensity*noise_musgrave_fBm(p, Basis, dimension, lacunarity, octaves);
        else if(Type == "Hybrid Multifractal")
-               Fac = Intensity*noise_musgrave_hybrid_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
+               Fac = intensity*noise_musgrave_hybrid_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
        else if(Type == "Ridged Multifractal")
-               Fac = Intensity*noise_musgrave_ridged_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
+               Fac = intensity*noise_musgrave_ridged_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
        else if(Type == "Hetero Terrain")
-               Fac = Intensity*noise_musgrave_hetero_terrain(p, Basis, dimension, lacunarity, octaves, Offset);
+               Fac = intensity*noise_musgrave_hetero_terrain(p, Basis, dimension, lacunarity, octaves, Offset);
+       
+       Color = color(Fac, Fac, Fac);
 }
 
index 7738902f52938123f1082203a33315bf9d578baf..1ddb4d8a08bf318ea60830ec159a62407d4f016c 100644 (file)
 
 /* Noise */
 
-float noise(point p, string basis, float distortion, float detail)
+float noise(point p, string basis, float distortion, float detail, float fac, color Color)
 {
        point r;
        int hard = 0;
-       float fac = 0.0;
        
        if(distortion != 0.0) {
                r[0] = noise_basis(p + point(13.5), basis) * distortion;
@@ -37,23 +36,21 @@ float noise(point p, string basis, float distortion, float detail)
 
        fac = noise_turbulence(p, basis, detail, hard);
        
+       Color = color(fac, noise_turbulence(point(p[1], p[0], p[2]), basis, detail, hard),
+               noise_turbulence(point(p[1], p[2], p[0]), basis, detail, hard));
+
        return fac;
-    
-       /*
-       Color[0] = Fac;
-       Color[1] = noise_turbulence(point(p[1], p[0], p[2]), basis, detail, hard);
-       Color[2] = noise_turbulence(point(p[1], p[2], p[0]), basis, detail, hard);
-       */
 }
 
 shader node_noise_texture(
-       string Basis = "Perlin",
        float Distortion = 0.0,
        float Scale = 5.0,
        float Detail = 2.0,
        point Vector = P,
-       output float Fac = 0.0)
+       output float Fac = 0.0,
+       output color Color = color(0.2, 0.2, 0.2))
 {
-       Fac = noise(Vector*Scale, Basis, Distortion, Detail);
+       string Basis = "Perlin";
+       Fac = noise(Vector*Scale, Basis, Distortion, Detail, Fac, Color);
 }
 
index 693f09ae24c6c036025643ef3e6bd27cb107beb1..db53faaf94bdc4591c04eaa63e1ab717b245f8e7 100644 (file)
@@ -48,12 +48,14 @@ float wave(point p, float scale, string type, float detail, float distortion, fl
 shader node_wave_texture(
        string Type = "Bands",
        float Scale = 5.0,
-       float distortion = 0.0,
-       float detail = 2.0,
-       float dscale = 1.0,
+       float Distortion = 0.0,
+       float Detail = 2.0,
+       float DetailScale = 1.0,
        point Vector = P,
-       output float Fac = 0.0)
+       output float Fac = 0.0,
+       output color Color = color (0.0, 0.0, 0.0))
 {
-       Fac = wave(Vector, Scale, Type, detail, distortion, dscale);
+       Fac = wave(Vector, Scale, Type, Detail, Distortion, DetailScale);
+       Color = color(Fac, Fac, Fac);
 }
 
index 345614c2868450e5ca9ffd7d93e677e8052140c5..98ede0e4f60b0486b4d72c8b0e5c57fa2f4ecd25 100644 (file)
@@ -204,10 +204,9 @@ void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int
        OSL::ShadingSystem *ss = kg->osl.ss;
        OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
        OSL::ShaderGlobals *globals = &tdata->globals;
-       OSL::ShadingContext *ctx = ss->get_context(tdata->thread_info);
+       OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
        /* setup shader globals from shader data */
-       sd->osl_ctx = ctx;
        shaderdata_to_shaderglobals(kg, sd, path_flag, globals);
 
        /* execute shader for this point */
@@ -262,10 +261,9 @@ float3 OSLShader::eval_background(KernelGlobals *kg, ShaderData *sd, int path_fl
        OSL::ShadingSystem *ss = kg->osl.ss;
        OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
        OSL::ShaderGlobals *globals = &tdata->globals;
-       OSL::ShadingContext *ctx = ss->get_context(tdata->thread_info);
+       OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
        /* setup shader globals from shader data */
-       sd->osl_ctx = ctx;
        shaderdata_to_shaderglobals(kg, sd, path_flag, globals);
 
        /* execute shader for this point */
@@ -339,10 +337,9 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int
        OSL::ShadingSystem *ss = kg->osl.ss;
        OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
        OSL::ShaderGlobals *globals = &tdata->globals;
-       OSL::ShadingContext *ctx = ss->get_context(tdata->thread_info);
+       OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
        /* setup shader globals from shader data */
-       sd->osl_ctx = ctx;
        shaderdata_to_shaderglobals(kg, sd, path_flag, globals);
 
        /* execute shader */
@@ -363,10 +360,9 @@ void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd)
        OSL::ShadingSystem *ss = kg->osl.ss;
        OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
        OSL::ShaderGlobals *globals = &tdata->globals;
-       OSL::ShadingContext *ctx = ss->get_context(tdata->thread_info);
+       OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
 
        /* setup shader globals from shader data */
-       sd->osl_ctx = ctx;
        shaderdata_to_shaderglobals(kg, sd, 0, globals);
 
        /* execute shader */
@@ -379,13 +375,19 @@ void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd)
        sd->P = TO_FLOAT3(globals->P);
 }
 
-void OSLShader::release(KernelGlobals *kg, const ShaderData *sd)
+void OSLShader::init(KernelGlobals *kg, ShaderData *sd)
 {
        OSL::ShadingSystem *ss = kg->osl.ss;
        OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data);
-       OSL::ShadingContext *ctx = ss->get_context(tdata->thread_info);
+       
+       sd->osl_ctx = ss->get_context(tdata->thread_info);
+}
 
-       ss->release_context(ctx);
+void OSLShader::release(KernelGlobals *kg, ShaderData *sd)
+{
+       OSL::ShadingSystem *ss = kg->osl.ss;
+       
+       ss->release_context((OSL::ShadingContext *)sd->osl_ctx);
 }
 
 /* BSDF Closure */
index 815557ed203a6d1d218b15547f18aca1334574c2..e55f98d4d02eb4addd15283d468f015032450098 100644 (file)
@@ -79,7 +79,8 @@ public:
                                        const float3 omega_in, const float3 omega_out);
 
        /* release */
-       static void release(KernelGlobals *kg, const ShaderData *sd);
+       static void init(KernelGlobals *kg, ShaderData *sd);
+       static void release(KernelGlobals *kg, ShaderData *sd);
 };
 
 CCL_NAMESPACE_END
index 272ddb89b0c3d50d77ab3b681183c5b9fb47fb8a..e44caa90f12e91bd52ff5d9a05ee2a46cc81123f 100644 (file)
@@ -75,7 +75,7 @@ Camera::Camera()
 
        need_update = true;
        need_device_update = true;
-       previous_motion = -1;
+       previous_need_motion = -1;
 }
 
 Camera::~Camera()
@@ -145,12 +145,10 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
 
        update();
 
-       if (previous_motion != need_motion) {
-               /* scene's motion model could have been changed since
-                * previous device camera update
-                * this could happen for example in case when one render
-                * layer has got motion pass and another not
-                */
+       if (previous_need_motion != need_motion) {
+               /* scene's motion model could have been changed since previous device
+                * camera update this could happen for example in case when one render
+                * layer has got motion pass and another not */
                need_device_update = true;
        }
 
@@ -237,7 +235,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
        kcam->cliplength = (farclip == FLT_MAX)? FLT_MAX: farclip - nearclip;
 
        need_device_update = false;
-       previous_motion = need_motion;
+       previous_need_motion = need_motion;
 }
 
 void Camera::device_free(Device *device, DeviceScene *dscene)
index a539510029f7d26ffbcbb1fc8e940b575ea54261..82852bde5e0d662aa0b8f0a76563ee3cb69931cd 100644 (file)
@@ -91,7 +91,7 @@ public:
        /* update */
        bool need_update;
        bool need_device_update;
-       int previous_motion;
+       int previous_need_motion;
 
        /* functions */
        Camera();
index da511b2d2f41c31d15b7fe4eb57313c21a07fa6f..1f03ab4e34792f94a9718b261f0919e6fbbd21c1 100644 (file)
@@ -984,9 +984,9 @@ void BrickTextureNode::compile(SVMCompiler& compiler)
 void BrickTextureNode::compile(OSLCompiler& compiler)
 {
        compiler.parameter("Offset", offset);
-       compiler.parameter("Offset Frequency", offset_frequency);
+       compiler.parameter("OffsetFrequency", offset_frequency);
        compiler.parameter("Squash", squash);
-       compiler.parameter("Squash Frequency", squash_frequency);
+       compiler.parameter("SquashFrequency", squash_frequency);
        compiler.add(this, "node_brick_texture");
 }
 
index d4c93c07e2ff061b48fc7f58a92b19e2ae23143e..dbd6b0ac9d946fc6245822b529e68d789464309a 100644 (file)
@@ -200,19 +200,19 @@ void OSLCompiler::add(ShaderNode *node, const char *name)
 
                        switch(input->type) {
                                case SHADER_SOCKET_COLOR:
-                                       parameter_color(input->name, input->value);
+                                       parameter_color(compatible_name(input->name).c_str(), input->value);
                                        break;
                                case SHADER_SOCKET_POINT:
-                                       parameter_point(input->name, input->value);
+                                       parameter_point(compatible_name(input->name).c_str(), input->value);
                                        break;
                                case SHADER_SOCKET_VECTOR:
-                                       parameter_vector(input->name, input->value);
+                                       parameter_vector(compatible_name(input->name).c_str(), input->value);
                                        break;
                                case SHADER_SOCKET_NORMAL:
-                                       parameter_normal(input->name, input->value);
+                                       parameter_normal(compatible_name(input->name).c_str(), input->value);
                                        break;
                                case SHADER_SOCKET_FLOAT:
-                                       parameter(input->name, input->value.x);
+                                       parameter(compatible_name(input->name).c_str(), input->value.x);
                                        break;
                                case SHADER_SOCKET_CLOSURE:
                                        break;
index 433d9024e0ac2996caff4387f7f646b2634903d9..485b4829b71c3e416ce0d7ba3fa1e411ffb2dd7d 100644 (file)
@@ -148,7 +148,7 @@ def modules(module_cache):
     for path in path_list:
 
         # force all contrib addons to be 'TESTING'
-        if path.endswith("addons_contrib") or path.endswith("addons_extern"):
+        if path.endswith(("addons_contrib", "addons_extern")):
             force_support = 'TESTING'
         else:
             force_support = None
index ed4d5dd55f57443300919f0106223f95238ea524..513277a209949acefe0dd81fd056f17e20f407c5 100644 (file)
@@ -735,7 +735,7 @@ class WM_OT_context_modal_mouse(Operator):
 
         if not self._values:
             self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" %
-                    (self.data_path_iter, self.data_path_item))
+                        (self.data_path_iter, self.data_path_item))
 
             return {'CANCELLED'}
         else:
index d92325a8b3da579ca977e83d65133cfdc9c8400a..2ab90301bdb15e49fc5e0b7ed1d82bed9f230522 100644 (file)
@@ -449,7 +449,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
         return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
-                              'MULTICAM', 'ADJUSTMENT'}
+                              'MULTICAM'}
 
     def draw(self, context):
         layout = self.layout
@@ -463,10 +463,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
             if strip.input_count > 1:
                 col.prop(strip, "input_2")
 
-        if strip.is_supports_mask:
-            col = layout.column()
-            col.prop_search(strip, "input_mask_strip", sequencer, "sequences", text="Mask")
-
         if strip.type == 'COLOR':
             layout.prop(strip, "color")
 
@@ -793,10 +789,6 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
         col.prop(strip, "use_premultiply")
         col.prop(strip, "use_float")
 
-        layout.prop(strip, "use_color_balance")
-        if strip.use_color_balance and strip.color_balance:  # TODO - need to add this somehow
-            draw_color_balance(layout, strip.color_balance)
-
 
 class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
     bl_label = "Proxy / Timecode"
index d8115bc95bfd86dbb7dc639a87f394f032dcaf75..88e5ee80590887150baacb23606362e3fcc5fb7b 100644 (file)
@@ -26,9 +26,10 @@ class ModalOperator(bpy.types.Operator):
 
     def invoke(self, context, event):
         if context.object:
-            context.window_manager.modal_handler_add(self)
             self.first_mouse_x = event.mouse_x
             self.first_value = context.object.location.x
+
+            context.window_manager.modal_handler_add(self)
             return {'RUNNING_MODAL'}
         else:
             self.report({'WARNING'}, "No active object, could not finish")
index f2d5ad8982b7a168a2605cf612afdc84b54435f5..f1c4e113b0ad0fa7f2482fd372763a1ad287fb7b 100644 (file)
@@ -53,14 +53,13 @@ class ModalDrawOperator(bpy.types.Operator):
 
     def invoke(self, context, event):
         if context.area.type == 'VIEW_3D':
-            context.window_manager.modal_handler_add(self)
-
             # Add the region OpenGL drawing callback
             # draw in view space with 'POST_VIEW' and 'PRE_VIEW'
             self._handle = context.region.callback_add(draw_callback_px, (self, context), 'POST_PIXEL')
 
             self.mouse_path = []
 
+            context.window_manager.modal_handler_add(self)
             return {'RUNNING_MODAL'}
         else:
             self.report({'WARNING'}, "View3D not found, cannot run operator")
index 6d2ec95aedb2f516ee17c64d7e93b95282e8e3bb..72c153df9d264abef7acf27889cd41f4e8ecdce7 100644 (file)
@@ -21,8 +21,8 @@ class ModalTimerOperator(bpy.types.Operator):
         return {'PASS_THROUGH'}
 
     def execute(self, context):
-        context.window_manager.modal_handler_add(self)
         self._timer = context.window_manager.event_timer_add(0.1, context.window)
+        context.window_manager.modal_handler_add(self)
         return {'RUNNING_MODAL'}
 
     def cancel(self, context):
index 0babf169610d4678d80079c6a19a661499318e68..c870bbffdcfabb6d61633074e051201a52d47dad 100644 (file)
@@ -45,14 +45,13 @@ class ViewOperator(bpy.types.Operator):
             v3d = context.space_data
             rv3d = v3d.region_3d
 
-            context.window_manager.modal_handler_add(self)
-
             if rv3d.view_perspective == 'CAMERA':
                 rv3d.view_perspective = 'PERSP'
 
             self._initial_mouse = Vector((event.mouse_x, event.mouse_y, 0.0))
             self._initial_location = rv3d.view_location.copy()
 
+            context.window_manager.modal_handler_add(self)
             return {'RUNNING_MODAL'}
         else:
             self.report({'WARNING'}, "Active space must be a View3d")
index 44e47e779e76cab9df04a03e6e2edd4f38c12d16..d750e88ac04af11589c346b3c776d47e013cecf8 100644 (file)
@@ -101,8 +101,6 @@ void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[][
 void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]);
 void mat3_to_vec_roll(float mat[][3], float *vec, float *roll);
 
-int get_selected_defgroups(struct Object *ob, char *defbase_sel, int defbase_len);
-
 /* Common Conversions Between Co-ordinate Spaces */
 void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]);
 void BKE_armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]);
index dec4d3cb8cbaf89656c7b939efe9eed791562379..0e7bdbbb4dd53ca33e9ef1cf445516cdb8232407 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         263
-#define BLENDER_SUBVERSION      17
+#define BLENDER_SUBVERSION      18
 
 /* 262 was the last editmesh release but its has compatibility code for bmesh data,
  * so set the minversion to 2.61 */
index 25677165fc2c6bdf6901ef6be8be13ebcb2b3286..52a143ddf55a96b65577f92010b18359dd684f15 100644 (file)
@@ -67,7 +67,8 @@ void defvert_remap(struct MDeformVert *dvert, int *map, const int map_len);
 void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
 void defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
 void defvert_normalize(struct MDeformVert *dvert);
-void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
+void defvert_normalize_lock_single(struct MDeformVert *dvert, const int def_nr_lock);
+void defvert_normalize_lock_map(struct MDeformVert *dvert, const char *lock_flags, const int defbase_tot);
 
 /* utility function, note that MAX_VGROUP_NAME chars is the maximum string length since its only
  * used with defgroups currently */
diff --git a/source/blender/blenkernel/BKE_object_deform.h b/source/blender/blenkernel/BKE_object_deform.h
new file mode 100644 (file)
index 0000000..35a4e19
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BKE_OBJECT_DEFORM_H__
+#define __BKE_OBJECT_DEFORM_H__
+
+/** \file BKE_object_vgroup.h
+ * \ingroup bke
+ * \brief Functions for dealing with objects and deform verts,
+ *        used by painting and tools.
+ */
+
+struct Object;
+
+char *BKE_objdef_lock_flags_get(struct Object *ob, const int defbase_tot);
+char *BKE_objdef_validmap_get(struct Object *ob, const int defbase_tot);
+char *BKE_objdef_selected_get(struct Object *ob, int defbase_tot, int *r_dg_flags_sel_tot);
+
+#endif  /* __BKE_OBJECT_DEFORM_H__ */
index 0468d3fad9c9f5210ec4bc37c7c446c3f9b25c1e..5bef0b2a7712ae4ec45bd3f040722c4549d1a501 100644 (file)
@@ -380,7 +380,7 @@ typedef struct SequenceModifierTypeInfo {
        void (*copy_data) (struct SequenceModifierData *smd, struct SequenceModifierData *target);
 
        /* apply modifier on a given image buffer */
-       struct ImBuf *(*apply) (struct SequenceModifierData *smd, struct ImBuf *ibuf, struct ImBuf *mask);
+       void (*apply) (struct SequenceModifierData *smd, struct ImBuf *ibuf, struct ImBuf *mask);
 } SequenceModifierTypeInfo;
 
 struct SequenceModifierTypeInfo *BKE_sequence_modifier_type_info_get(int type);
index afa3998fb49397baa6a28308a60e53152663fdea..576b79f899c0460b9cbb15d2d817daef7edf8632 100644 (file)
@@ -115,6 +115,7 @@ set(SRC
        intern/nla.c
        intern/node.c
        intern/object.c
+       intern/object_deform.c
        intern/ocean.c
        intern/packedFile.c
        intern/paint.c
@@ -203,6 +204,7 @@ set(SRC
        BKE_nla.h
        BKE_node.h
        BKE_object.h
+       BKE_object_deform.h
        BKE_ocean.h
        BKE_packedFile.h
        BKE_paint.h
index 1aa54307841e2c8bc971dd1a8f8b54a25f60b6ba..a7f8e1bb16182365aef9c1ab7b498512ecaf07c7 100644 (file)
@@ -59,6 +59,7 @@
 #include "BKE_modifier.h"
 #include "BKE_mesh.h"
 #include "BKE_object.h"
+#include "BKE_object_deform.h"
 #include "BKE_paint.h"
 #include "BKE_texture.h"
 #include "BKE_multires.h"
@@ -1015,14 +1016,14 @@ static void calc_weightpaint_vert_color(
         unsigned char r_col[4],
         MDeformVert *dv, ColorBand *coba,
         const int defbase_tot, const int defbase_act,
-        const char *dg_flags,
-        const int selected, const int draw_flag)
+        const char *defbase_sel, const int defbase_sel_tot,
+        const int draw_flag)
 {
        float input = 0.0f;
        
        int make_black = FALSE;
 
-       if ((selected > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
+       if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
                int was_a_nonzero = FALSE;
                unsigned int i;
 
@@ -1031,7 +1032,7 @@ static void calc_weightpaint_vert_color(
                        /* in multipaint, get the average if auto normalize is inactive
                         * get the sum if it is active */
                        if (dw->def_nr < defbase_tot) {
-                               if (dg_flags[dw->def_nr]) {
+                               if (defbase_sel[dw->def_nr]) {
                                        if (dw->weight) {
                                                input += dw->weight;
                                                was_a_nonzero = TRUE;
@@ -1045,7 +1046,7 @@ static void calc_weightpaint_vert_color(
                        make_black = TRUE;
                }
                else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
-                       input /= selected; /* get the average */
+                       input /= defbase_sel_tot; /* get the average */
                }
        }
        else {
@@ -1090,14 +1091,21 @@ static unsigned char *calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, i
                /* variables for multipaint */
                const int defbase_tot = BLI_countlist(&ob->defbase);
                const int defbase_act = ob->actdef - 1;
-               char *dg_flags = MEM_mallocN(defbase_tot * sizeof(char), __func__);
-               const int selected = get_selected_defgroups(ob, dg_flags, defbase_tot);
+
+               int defbase_sel_tot = 0;
+               char *defbase_sel = NULL;
+
+               if (draw_flag & CALC_WP_MULTIPAINT) {
+                       defbase_sel = BKE_objdef_selected_get(ob, defbase_tot, &defbase_sel_tot);
+               }
 
                for (i = numVerts; i != 0; i--, wc += 4, dv++) {
-                       calc_weightpaint_vert_color(wc, dv, coba, defbase_tot, defbase_act, dg_flags, selected, draw_flag);
+                       calc_weightpaint_vert_color(wc, dv, coba, defbase_tot, defbase_act, defbase_sel, defbase_sel_tot, draw_flag);
                }
 
-               MEM_freeN(dg_flags);
+               if (defbase_sel) {
+                       MEM_freeN(defbase_sel);
+               }
        }
        else {
                int col_i;
index aa834ff131b26a4734218133becfdd87250208dd..b87342f85fa8960442f5273b6ee6e19d9df07208 100644 (file)
@@ -2517,36 +2517,6 @@ void BKE_pose_where_is(Scene *scene, Object *ob)
        }
 }
 
-
-/* Returns total selected vgroups,
- * wpi.defbase_sel is assumed malloc'd, all values are set */
-int get_selected_defgroups(Object *ob, char *dg_selection, int defbase_tot)
-{
-       bDeformGroup *defgroup;
-       unsigned int i;
-       Object *armob = BKE_object_pose_armature_get(ob);
-       int dg_flags_sel_tot = 0;
-
-       if (armob) {
-               bPose *pose = armob->pose;
-               for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
-                       bPoseChannel *pchan = BKE_pose_channel_find_name(pose, defgroup->name);
-                       if (pchan && (pchan->bone->flag & BONE_SELECTED)) {
-                               dg_selection[i] = TRUE;
-                               dg_flags_sel_tot++;
-                       }
-                       else {
-                               dg_selection[i] = FALSE;
-                       }
-               }
-       }
-       else {
-               memset(dg_selection, FALSE, sizeof(char) * defbase_tot);
-       }
-
-       return dg_flags_sel_tot;
-}
-
 /************** Bounding box ********************/
 static int minmax_armature(Object *ob, float r_min[3], float r_max[3])
 {
index 547a64a70d416f382a18b4f86c940fcc82035c9a..4110d4565b2319936c994efdfd2c98ee167e468f 100644 (file)
@@ -33,6 +33,7 @@
 #include <string.h>
 #include <math.h>
 #include <ctype.h>
+#include <stdlib.h>
 
 #include "MEM_guardedalloc.h"
 
 
 #include "BKE_deform.h"
 
-#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
 #include "BLI_utildefines.h"
 
 
@@ -204,13 +208,15 @@ void defvert_normalize(MDeformVert *dvert)
        }
 }
 
-void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
+void defvert_normalize_lock_single(MDeformVert *dvert, const int def_nr_lock)
 {
        if (dvert->totweight <= 0) {
                /* nothing */
        }
        else if (dvert->totweight == 1) {
-               dvert->dw[0].weight = 1.0f;
+               if (def_nr_lock != 0) {
+                       dvert->dw[0].weight = 1.0f;
+               }
        }
        else {
                MDeformWeight *dw_lock = NULL;
@@ -246,6 +252,50 @@ void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
        }
 }
 
+void defvert_normalize_lock_map(MDeformVert *dvert, const char *lock_flags, const int defbase_tot)
+{
+       if (dvert->totweight <= 0) {
+               /* nothing */
+       }
+       else if (dvert->totweight == 1) {
+               if (LIKELY(defbase_tot >= 1) && lock_flags[0]) {
+                       dvert->dw[0].weight = 1.0f;
+               }
+       }
+       else {
+               MDeformWeight *dw;
+               unsigned int i;
+               float tot_weight = 0.0f;
+               float lock_iweight = 0.0f;
+
+               for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+                       if ((dw->def_nr < defbase_tot) && (lock_flags[dw->def_nr] == FALSE)) {
+                               tot_weight += dw->weight;
+                       }
+                       else {
+                               /* invert after */
+                               lock_iweight += dw->weight;
+                       }
+               }
+
+               lock_iweight = maxf(0.0f, 1.0f - lock_iweight);
+
+               if (tot_weight > 0.0f) {
+                       /* paranoid, should be 1.0 but in case of float error clamp anyway */
+
+                       float scalar = (1.0f / tot_weight) * lock_iweight;
+                       for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+                               if ((dw->def_nr < defbase_tot) && (lock_flags[dw->def_nr] == FALSE)) {
+                                       dw->weight *= scalar;
+
+                                       /* in case of division errors with very low weights */
+                                       CLAMP(dw->weight, 0.0f, 1.0f);
+                               }
+                       }
+               }
+       }
+}
+
 void defvert_flip(MDeformVert *dvert, const int *flip_map, const int flip_map_len)
 {
        MDeformWeight *dw;
index 987963273bb62c84648a5d38a584d16babf7a16b..a0839a502b7de43a6d0476f7702aed0162470058 100644 (file)
@@ -2548,7 +2548,9 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
        dither = iuser->scene->r.dither_intensity;
 
        /* combined layer gets added as first layer */
-       if (rres.have_combined && layer == 0) ;
+       if (rres.have_combined && layer == 0) {
+               /* pass */
+       }
        else if (rres.layers.first) {
                RenderLayer *rl = BLI_findlink(&rres.layers, layer - (rres.have_combined ? 1 : 0));
                if (rl) {
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
new file mode 100644 (file)
index 0000000..7f95782
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/object_deform.c
+ *  \ingroup bke
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+#include "BKE_action.h"
+#include "BKE_object_deform.h"  /* own include */
+#include "BKE_object.h"
+#include "BKE_modifier.h"
+
+#include "DNA_armature_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_object_types.h"
+
+/* --- functions for getting vgroup aligned maps --- */
+
+/**
+ * gets the status of "flag" for each bDeformGroup
+ * in ob->defbase and returns an array containing them
+ */
+char *BKE_objdef_lock_flags_get(Object *ob, const int defbase_tot)
+{
+       char is_locked = FALSE;
+       int i;
+       //int defbase_tot = BLI_countlist(&ob->defbase);
+       char *lock_flags = MEM_mallocN(defbase_tot * sizeof(char), "defflags");
+       bDeformGroup *defgroup;
+
+       for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
+               lock_flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
+               is_locked |= lock_flags[i];
+       }
+       if (is_locked) {
+               return lock_flags;
+       }
+
+       MEM_freeN(lock_flags);
+       return NULL;
+}
+
+char *BKE_objdef_validmap_get(Object *ob, const int defbase_tot)
+{
+       bDeformGroup *dg;
+       ModifierData *md;
+       char *vgroup_validmap;
+       GHash *gh;
+       int i, step1 = 1;
+       //int defbase_tot = BLI_countlist(&ob->defbase);
+
+       if (ob->defbase.first == NULL) {
+               return NULL;
+       }
+
+       gh = BLI_ghash_str_new("BKE_objdef_validmap_get gh");
+
+       /* add all names to a hash table */
+       for (dg = ob->defbase.first; dg; dg = dg->next) {
+               BLI_ghash_insert(gh, dg->name, NULL);
+       }
+
+       BLI_assert(BLI_ghash_size(gh) == defbase_tot);
+
+       /* now loop through the armature modifiers and identify deform bones */
+       for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob) : md->next) {
+               if (!(md->mode & (eModifierMode_Realtime | eModifierMode_Virtual)))
+                       continue;
+
+               if (md->type == eModifierType_Armature) {
+                       ArmatureModifierData *amd = (ArmatureModifierData *) md;
+
+                       if (amd->object && amd->object->pose) {
+                               bPose *pose = amd->object->pose;
+                               bPoseChannel *chan;
+
+                               for (chan = pose->chanbase.first; chan; chan = chan->next) {
+                                       if (chan->bone->flag & BONE_NO_DEFORM)
+                                               continue;
+
+                                       if (BLI_ghash_remove(gh, chan->name, NULL, NULL)) {
+                                               BLI_ghash_insert(gh, chan->name, SET_INT_IN_POINTER(1));
+                                       }
+                               }
+                       }
+               }
+       }
+
+       vgroup_validmap = MEM_mallocN(defbase_tot, "wpaint valid map");
+
+       /* add all names to a hash table */
+       for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
+               vgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);
+       }
+
+       BLI_assert(i == BLI_ghash_size(gh));
+
+       BLI_ghash_free(gh, NULL, NULL);
+
+       return vgroup_validmap;
+}
+
+/* Returns total selected vgroups,
+ * wpi.defbase_sel is assumed malloc'd, all values are set */
+char *BKE_objdef_selected_get(Object *ob, int defbase_tot, int *r_dg_flags_sel_tot)
+{
+       char *dg_selection = MEM_mallocN(defbase_tot * sizeof(char), __func__);
+       bDeformGroup *defgroup;
+       unsigned int i;
+       Object *armob = BKE_object_pose_armature_get(ob);
+       (*r_dg_flags_sel_tot) = 0;
+
+       if (armob) {
+               bPose *pose = armob->pose;
+               for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
+                       bPoseChannel *pchan = BKE_pose_channel_find_name(pose, defgroup->name);
+                       if (pchan && (pchan->bone->flag & BONE_SELECTED)) {
+                               dg_selection[i] = TRUE;
+                               (*r_dg_flags_sel_tot) += 1;
+                       }
+                       else {
+                               dg_selection[i] = FALSE;
+                       }
+               }
+       }
+       else {
+               memset(dg_selection, FALSE, sizeof(char) * defbase_tot);
+       }
+
+       return dg_selection;
+}
index 0a195210e38c17ac74e0eebf89700aa232b8603b..6028b40756dcebbe65a20e02b8b776a8a2808d22 100644 (file)
@@ -154,14 +154,11 @@ void colorBalance_init_data(SequenceModifierData *smd)
        }
 }
 
-ImBuf *colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
 {
        ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
-       ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
 
-       BKE_sequencer_color_balance_apply(&cbmd->color_balance, ibuf_new, cbmd->color_multiply, FALSE, mask);
-
-       return ibuf_new;
+       BKE_sequencer_color_balance_apply(&cbmd->color_balance, ibuf, cbmd->color_multiply, FALSE, mask);
 }
 
 static SequenceModifierTypeInfo seqModifier_ColorBalance = {
@@ -252,10 +249,9 @@ void curves_apply_threaded(int width, int height, unsigned char *rect, float *re
        }
 }
 
-ImBuf *curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
 {
        CurvesModifierData *cmd = (CurvesModifierData *) smd;
-       ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
 
        float black[3] = {0.0f, 0.0f, 0.0f};
        float white[3] = {1.0f, 1.0f, 1.0f};
@@ -265,11 +261,9 @@ ImBuf *curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
        curvemapping_premultiply(&cmd->curve_mapping, 0);
        curvemapping_set_black_white(&cmd->curve_mapping, black, white);
 
-       modifier_apply_threaded(ibuf_new, mask, curves_apply_threaded, &cmd->curve_mapping);
+       modifier_apply_threaded(ibuf, mask, curves_apply_threaded, &cmd->curve_mapping);
 
        curvemapping_premultiply(&cmd->curve_mapping, 1);
-
-       return ibuf_new;
 }
 
 static SequenceModifierTypeInfo seqModifier_Curves = {
@@ -371,16 +365,13 @@ void hue_correct_apply_threaded(int width, int height, unsigned char *rect, floa
        }
 }
 
-ImBuf *hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
 {
        HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
-       ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
 
        curvemapping_initialize(&hcmd->curve_mapping);
 
-       modifier_apply_threaded(ibuf_new, mask, hue_correct_apply_threaded, &hcmd->curve_mapping);
-
-       return ibuf_new;
+       modifier_apply_threaded(ibuf, mask, hue_correct_apply_threaded, &hcmd->curve_mapping);
 }
 
 static SequenceModifierTypeInfo seqModifier_HueCorrect = {
@@ -469,18 +460,15 @@ void brightcontrast_apply_threaded(int width, int height, unsigned char *rect, f
        }
 }
 
-ImBuf *brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
 {
        BrightContrastModifierData *bcmd = (BrightContrastModifierData *) smd;
        BrightContrastThreadData data;
-       ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
 
        data.bright = bcmd->bright;
        data.contrast = bcmd->contrast;
 
-       modifier_apply_threaded(ibuf_new, mask, brightcontrast_apply_threaded, &data);
-
-       return ibuf_new;
+       modifier_apply_threaded(ibuf, mask, brightcontrast_apply_threaded, &data);
 }
 
 static SequenceModifierTypeInfo seqModifier_BrightContrast = {
@@ -595,7 +583,6 @@ ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, I
 
        for (smd = seq->modifiers.first; smd; smd = smd->next) {
                SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
-               ImBuf *ibuf_new;
 
                /* could happen if modifier is being removed or not exists in current version of blender */
                if (!smti)
@@ -611,12 +598,7 @@ ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, I
                        if (processed_ibuf == ibuf)
                                processed_ibuf = IMB_dupImBuf(ibuf);
 
-                       ibuf_new = smti->apply(smd, processed_ibuf, mask);
-
-                       if (ibuf_new != processed_ibuf) {
-                               IMB_freeImBuf(processed_ibuf);
-                               processed_ibuf = ibuf_new;
-                       }
+                       smti->apply(smd, processed_ibuf, mask);
 
                        if (mask)
                                IMB_freeImBuf(mask);
index 9aaa9fd79e8a861534e3635ce021599978397160..0ac0db50fb5b5abac1220f3c369842c1576f0395 100644 (file)
@@ -166,9 +166,6 @@ static void seq_free_strip(Strip *strip)
        if (strip->transform) {
                MEM_freeN(strip->transform);
        }
-       if (strip->color_balance) {
-               MEM_freeN(strip->color_balance);
-       }
 
        MEM_freeN(strip);
 }
@@ -1671,26 +1668,6 @@ void BKE_sequencer_color_balance_apply(StripColorBalance *cb, ImBuf *ibuf, float
                imb_freerectImBuf(ibuf);
 }
 
-static void sequence_color_balance(SeqRenderData context, Sequence *seq, ImBuf *ibuf, float mul, int cfra)
-{
-       StripColorBalance *cb = seq->strip->color_balance;
-       ImBuf *mask_input = NULL;
-       short make_float = seq->flag & SEQ_MAKE_FLOAT;
-
-       if (seq->mask_sequence) {
-               if (seq->mask_sequence != seq && !BKE_sequence_check_depend(seq, seq->mask_sequence)) {
-                       int make_float = ibuf->rect_float != NULL;
-
-                       mask_input = BKE_sequencer_render_mask_input(context, SEQUENCE_MASK_INPUT_STRIP, seq->mask_sequence, NULL, cfra, make_float);
-               }
-       }
-
-       BKE_sequencer_color_balance_apply(cb, ibuf, mul, make_float, mask_input);
-
-       if (mask_input)
-               IMB_freeImBuf(mask_input);
-}
-
 /*
  *  input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE
  *
@@ -1713,9 +1690,7 @@ int BKE_sequencer_input_have_to_preprocess(SeqRenderData UNUSED(context), Sequen
 {
        float mul;
 
-       if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
-                        SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL | SEQ_MAKE_FLOAT))
-       {
+       if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_PREMUL | SEQ_MAKE_FLOAT)) {
                return TRUE;
        }
 
@@ -1834,11 +1809,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
                mul *= seq->blend_opacity / 100.0f;
        }
 
-       if (seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
-               sequence_color_balance(context, seq, ibuf, mul, cfra);
-               mul = 1.0;
-       }
-
        if (seq->flag & SEQ_MAKE_FLOAT) {
                if (!ibuf->rect_float) {
                        IMB_colormanagement_imbuf_to_sequencer_space(ibuf, TRUE);
@@ -4020,10 +3990,6 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
                seqn->strip->proxy->anim = NULL;
        }
 
-       if (seq->strip->color_balance) {
-               seqn->strip->color_balance = MEM_dupallocN(seq->strip->color_balance);
-       }
-
        if (seqn->modifiers.first) {
                seqn->modifiers.first = seqn->modifiers.last = NULL;
 
index fd755943e700ddaf9410b42fd5e59726cbf3dd24..2836174be73df1cba86185e1f15a9c744239794a 100644 (file)
@@ -147,6 +147,7 @@ set(SRC
        BLI_utildefines.h
        BLI_uvproject.h
        BLI_vfontdata.h
+       BLI_voronoi.h
        BLI_voxel.h
        BLI_winstuff.h
        PIL_time.h
index 1021d2a794dc9e432620afaec28ed11b83fcd17b..04c9d96ea0f61d8830190c7e74e592e34f827ba0 100644 (file)
@@ -4959,7 +4959,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                        seq->seq1= newdataadr(fd, seq->seq1);
                        seq->seq2= newdataadr(fd, seq->seq2);
                        seq->seq3= newdataadr(fd, seq->seq3);
-                       seq->mask_sequence= newdataadr(fd, seq->mask_sequence);
                        /* a patch: after introduction of effects with 3 input strips */
                        if (seq->seq3 == NULL) seq->seq3 = seq->seq2;
                        
@@ -5005,16 +5004,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                                else {
                                        seq->strip->proxy = NULL;
                                }
-                               if (seq->flag & SEQ_USE_COLOR_BALANCE) {
-                                       seq->strip->color_balance = newdataadr(
-                                               fd, seq->strip->color_balance);
-                               }
-                               else {
-                                       seq->strip->color_balance = NULL;
-                               }
-                               if (seq->strip->color_balance) {
-                                       // seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5?
-                               }
+
+                               /* need to load color balance to it could be converted to modifier */
+                               seq->strip->color_balance = newdataadr(fd, seq->strip->color_balance);
                        }
 
                        direct_link_sequence_modifiers(fd, &seq->modifiers);
@@ -7888,6 +7880,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        ntreetype->foreach_nodetree(main, NULL, do_version_ntree_mask_264);
        }
 
+       if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 18)) {
+               Scene *scene;
+
+               for (scene = main->scene.first; scene; scene = scene->id.next) {
+                       if (scene->ed) {
+                               Sequence *seq;
+
+                               SEQ_BEGIN (scene->ed, seq)
+                               {
+                                       Strip *strip = seq->strip;
+
+                                       if (strip && strip->color_balance) {
+                                               SequenceModifierData *smd;
+                                               ColorBalanceModifierData *cbmd;
+
+                                               smd = BKE_sequence_modifier_new(seq, NULL, seqModifierType_ColorBalance);
+                                               cbmd = (ColorBalanceModifierData *) smd;
+
+                                               cbmd->color_balance = *strip->color_balance;
+
+                                               /* multiplication with color balance used is handled differently,
+                                                * so we need to move multiplication to modifier so files would be
+                                                * compatible
+                                                */
+                                               cbmd->color_multiply = seq->mul;
+                                               seq->mul = 1.0f;
+
+                                               MEM_freeN(strip->color_balance);
+                                               strip->color_balance = NULL;
+                                       }
+                               }
+                               SEQ_END
+                       }
+               }
+       }
+
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
 
@@ -9443,9 +9471,9 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                                                cleanup_path(G.main->name, mainptr->curlib->filepath);
                                                                
                                                                fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
-                                                               fd->mainlist = mainlist;
-                                                               
+
                                                                if (fd) {
+                                                                       fd->mainlist = mainlist;
                                                                        printf("found: '%s', party on macuno!\n", mainptr->curlib->filepath);
                                                                }
                                                        }
index f8b3a548345585c65c43fbe55c192cfbd2bfd470..109a844352f56262bd3d68f8c483f2bb5e5b41f6 100644 (file)
@@ -2214,9 +2214,6 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
                                        if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
                                                writestruct(wd, DATA, "StripProxy", 1, strip->proxy);
                                        }
-                                       if (seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
-                                               writestruct(wd, DATA, "StripColorBalance", 1, strip->color_balance);
-                                       }
                                        if (seq->type==SEQ_TYPE_IMAGE)
                                                writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
                                        else if (seq->type==SEQ_TYPE_MOVIE || seq->type==SEQ_TYPE_SOUND_RAM || seq->type == SEQ_TYPE_SOUND_HD)
index d9cfae8edb9f3a067e03874330e9d633fae8c13a..e6efd77f8b2f8c69febcb971d78c9a5497e8ef21 100644 (file)
@@ -301,9 +301,16 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering);
 
 /**
  * @brief Deinitialize the compositor caches and allocated memory.
+ * Use COM_clearCaches to only free the caches.
  */
 void COM_deinitialize(void);
 
+/**
+ * @brief Clear all compositor caches. (Compositor system will still remain available). 
+ * To deinitialize the compositor use the COM_deinitialize method.
+ */
+void COM_clearCaches(void);
+
 /**
  * @brief Return a list of highlighted bnodes pointers.
  * @return 
index e33a2a4288fdde0969a0e9e803e2434726c2e757..dc39b2baca757dd0f40e9838bad4b0276fc985d1 100644 (file)
  * work are packaged as a WorkPackage instance.
  */
 class Device {
+
 public:
+       /**
+        * @brief Declaration of the virtual destructor 
+        * @note resolve warning gcc 4.7
+        */
+       virtual ~Device() {}
+       
        /**
         * @brief initialize the device
         */
index 320baacb6695f6826e236d95bf286009fc59ce1f..50393d14f3528fb03d4a9655a73c9180d57728e0 100644 (file)
@@ -137,6 +137,21 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke
        graph->addOperation(operation);
 }
 
+/* when a node has no valid data (missing image or group pointer) */
+void Node::convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context)
+{
+       /* this is a really bad situation - bring on the pink! - so artists know this is bad */
+       const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
+       int index;
+       vector<OutputSocket *> &outputsockets = this->getOutputSockets();
+       for (index = 0; index < outputsockets.size(); index++) {
+               SetColorOperation *operation = new SetColorOperation();
+               this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
+               operation->setChannels(warning_color);
+               graph->addOperation(operation);
+       }
+}
+
 bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
 {
        bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first;
index e19b1d774c9425aeec807968ca57c1cae99f5ac5..7ce40e3cb349a538568be099f58ab36c75036626 100644 (file)
@@ -99,6 +99,13 @@ public:
         */
        void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
        
+       /**
+        * when a node has no valid data (missing image or a group nodes ID pointer is NULL)
+        * call this function from #convertToOperations, this way the node sockets are converted
+        * into valid outputs, without this the compositor system gets confused and crashes, see [#32490]
+        */
+       void convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context);
+
        /**
         * Creates a new link between an outputSocket and inputSocket and registrates the link to the graph
         * @return the new created link
index 3c390f6bcdb4912797f6cc1eb0404e0b28d7b2f3..b55e444be8098cbc1882675cb18c658f6615fdd3 100644 (file)
@@ -71,13 +71,14 @@ protected:
        inline vector<OutputSocket *>& getOutputSockets() { return this->m_outputsockets; }
 
 
-public:
+protected:
        /**
         * @brief destructor
         * clean up memory related to this NodeBase.
         */
        virtual ~NodeBase();
        
+public:
        /**
         * @brief get the reference to the SDNA bNode struct
         */
index 2aebe2625943123169f62058d8396b51031a12cf..bad112d20c74d51d7c17501b7cc342bb2123ee71 100644 (file)
@@ -62,6 +62,14 @@ private:
        DataType m_datatype;
        
        bNodeSocket *m_editorSocket;
+
+protected:
+       /**
+        * @brief Declaration of the virtual destructor 
+        * @note resolve warning gcc 4.7
+        */
+       virtual ~Socket() {}
+       
 public:
        Socket(DataType datatype);
        
index f9af23faea8f7d4c7992045ee3492b7948adbe48..78e198ac9c2e0c3e2a67e3a03acc5c0963731ab9 100644 (file)
@@ -103,7 +103,13 @@ void **g_highlightedNodesRead;
 
 void COM_startReadHighlights()
 {
-       if (g_highlightedNodesRead) {
+       if (!g_highlightInitialized)
+       {
+               return;
+       }
+       
+       if (g_highlightedNodesRead) 
+       {
                MEM_freeN(g_highlightedNodesRead);
        }
        
@@ -114,11 +120,15 @@ void COM_startReadHighlights()
 
 int COM_isHighlightedbNode(bNode *bnode)
 {
+       if (!g_highlightInitialized) {
+               return false;
+       }
+       
        if (!g_highlightedNodesRead) {
                return false;
        }
 
-       for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
+       for (int i = 0; i < MAX_HIGHLIGHT; i++) {
                void *p = g_highlightedNodesRead[i];
                if (!p) return false;
                if (p == bnode) return true;
@@ -397,13 +407,16 @@ void WorkScheduler::deinitialize()
 
        /* deinitialize highlighting */
        if (g_highlightInitialized) {
-               if (g_highlightedNodes)
+               g_highlightInitialized = false;
+               if (g_highlightedNodes) {
                        MEM_freeN(g_highlightedNodes);
+                       g_highlightedNodes = NULL;
+               }
 
-               if (g_highlightedNodesRead)
+               if (g_highlightedNodesRead) {
                        MEM_freeN(g_highlightedNodesRead);
-
-               g_highlightInitialized = false;
+                       g_highlightedNodesRead = NULL;
+               }
        }
 }
 
index daf48d65cafefce3afda4453b98c2a29e706ad23..cb9166c929d149b98f60e00eadb43de72a06d57e 100644 (file)
@@ -37,6 +37,11 @@ extern "C" {
 static ThreadMutex s_compositorMutex;
 static char is_compositorMutex_init = FALSE;
 
+void intern_freeCompositorCaches() 
+{
+       deintializeDistortionCache();
+}
+
 void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
 {
        /* initialize mutex, TODO this mutex init is actually not thread safe and
@@ -63,7 +68,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
        /* set progress bar to 0% and status to init compositing */
        editingtree->progress(editingtree->prh, 0.0);
 
-       bool twopass = (editingtree->flag&NTREE_TWO_PASS) > 0 && !rendering;
+       bool twopass = (editingtree->flag & NTREE_TWO_PASS) > 0 && !rendering;
        /* initialize execution system */
        if (twopass) {
                ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass);
@@ -86,14 +91,21 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
        BLI_mutex_unlock(&s_compositorMutex);
 }
 
-void COM_deinitialize() 
+void COM_freeCaches() 
 {
        if (is_compositorMutex_init) {
                BLI_mutex_lock(&s_compositorMutex);
+               intern_freeCompositorCaches();
+               BLI_mutex_unlock(&s_compositorMutex);
+       }
+}
 
-               deintializeDistortionCache();
+void COM_deinitialize() 
+{
+       if (is_compositorMutex_init) {
+               BLI_mutex_lock(&s_compositorMutex);
+               intern_freeCompositorCaches();
                WorkScheduler::deinitialize();
-
                is_compositorMutex_init = FALSE;
                BLI_mutex_unlock(&s_compositorMutex);
                BLI_mutex_end(&s_compositorMutex);
index b1bc096668721b782049b41a3fcf2007f045883c..e10d7dbad2e0f8c1620c16f0dc2c2c9e41d1691c 100644 (file)
@@ -33,16 +33,7 @@ GroupNode::GroupNode(bNode *editorNode) : Node(editorNode)
 void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
 {
        if (this->getbNode()->id == NULL) {
-               /* this is a really bad situation - bring on the pink! - so artists know this is bad */
-               const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
-               int index;
-               vector<OutputSocket *> &outputsockets = this->getOutputSockets();
-               for (index = 0; index < outputsockets.size(); index++) {
-                       SetColorOperation *operation = new SetColorOperation();
-                       this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
-                       operation->setChannels(warning_color);
-                       graph->addOperation(operation);
-               }
+               convertToOperations_invalid(graph, context);
        }
 }
 
index addde140b9f7d3bb935f427402b7f7f4f0aaf15c..2d13ffb82b6ec48e24b6ffeda4d4badf233c9af7 100644 (file)
@@ -72,12 +72,16 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
 
        /* force a load, we assume iuser index will be set OK anyway */
        if (image && image->type == IMA_TYPE_MULTILAYER) {
+               bool is_multilayer_ok = false;
                BKE_image_get_ibuf(image, imageuser);
                if (image->rr) {
                        RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
                        if (rl) {
                                OutputSocket *socket;
                                int index;
+
+                               is_multilayer_ok = true;
+
                                for (index = 0; index < numberOfOutputs; index++) {
                                        socket = this->getOutputSocket(index);
                                        if (socket->isConnected() || index == 0) {
@@ -114,6 +118,11 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
                                }
                        }
                }
+
+               /* without this, multilayer that fail to load will crash blender [#32490] */
+               if (is_multilayer_ok == false) {
+                       convertToOperations_invalid(graph, context);
+               }
        }
        else {
                if (numberOfOutputs >  0) {
index ae94e974db038a0a1f964fe82878c17ada68fe63..c1d91c16a3cfa801848601886cd76eb4e410fcd1 100644 (file)
@@ -31,6 +31,9 @@
  */
 class CompositorOperation : public NodeOperation {
 private:
+       /**
+        * @brief Scene name, used for getting the render output, includes 'SC' prefix.
+        */
        char m_sceneName[MAX_ID_NAME];
 
        /**
index 2dbaa2998e3129a4605af42ad066203393fde81a..12ab4166bc84aced29860dfe6f2e6d12405420ee 100644 (file)
@@ -745,7 +745,9 @@ void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
 void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr);
 void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context);
 const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing
-void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag);
+void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op,
+                          int (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
+                          const char label_align, const short flag);
 struct MenuType *uiButGetMenuType(uiBut *but);
 
 void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
index ffce2b618a31dec929f9fc88977ceb3307e66c08..f97b9864539f2dc0d884157ac634d44c88effdec 100644 (file)
@@ -3722,8 +3722,14 @@ void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
 
                if (type == BUT_GET_LABEL) {
                        if (but->str) {
-                               /* Menu labels can have some complex formating stuff marked by pipes, we don't want those here! */
-                               char *tc = strchr(but->str, '|');
+                               /* Menu labels can have some complex formating stuff marked by pipes or %t, we don't want those here! */
+                               const char *tc;
+                               
+                               if (but->type == MENU)
+                                       tc = strstr(but->str, "%t");
+                               else
+                                       tc = strchr(but->str, '|');
+                               
                                if (tc)
                                        tmp = BLI_strdupn(but->str, tc - but->str);
                                else
index b68e14898d0396654bb6f568b780987503639679..803fd9280853721937b860c955a43532dcda10ff 100644 (file)
@@ -2837,7 +2837,9 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt,
 }
 
 /* this function does not initialize the layout, functions can be called on the layout before and after */
-void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag)
+void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,
+                          int (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
+                          const char label_align, const short flag)
 {
        if (!op->properties) {
                IDPropertyTemplate val = {0};
index 67c0d04a79f6e18a554c1fb7abafff986386aa5c..e8b8959fd43c3df537ca4a4f25aba4fd75c63cca 100644 (file)
@@ -908,19 +908,19 @@ static void UI_OT_editsource(wmOperatorType *ot)
 
 void edittranslation_find_po_file(const char *root, const char *uilng, char *path, const size_t maxlen)
 {
-       char t[32]; /* Should be more than enough! */
+       char tstr[32]; /* Should be more than enough! */
        /* First, full lang code. */
-       sprintf(t, "%s.po", uilng);
+       BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng);
        BLI_join_dirfile(path, maxlen, root, uilng);
-       BLI_join_dirfile(path, maxlen, path, t);
+       BLI_join_dirfile(path, maxlen, path, tstr);
        if (BLI_is_file(path))
                return;
        /* Now try without the second iso code part (_ES in es_ES). */
-       strncpy(t, uilng, 2);
-       strcpy(t + 2, uilng + 5); /* Because of some codes like sr_SR@latin... */
-       BLI_join_dirfile(path, maxlen, root, t);
-       sprintf(t, "%s.po", t);
-       BLI_join_dirfile(path, maxlen, path, t);
+       strncpy(tstr, uilng, 2);
+       BLI_strncpy(tstr + 2, uilng + 5, sizeof(tstr) - 2); /* Because of some codes like sr_SR@latin... */
+       BLI_join_dirfile(path, maxlen, root, tstr);
+       strcat(tstr, ".po");
+       BLI_join_dirfile(path, maxlen, path, tstr);
        if (BLI_is_file(path))
                return;
        path[0] = '\0';
index 9aaafe28377f76e4355772b829ba7ac1f9952400..543ac18801c0393b8d3baa6d061574e285b3b3f7 100644 (file)
@@ -1024,7 +1024,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
        uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco + 10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
 
        if (con->flag & CONSTRAINT_DISABLE)
-               uiLayoutSetRedAlert(row, 1);
+               uiLayoutSetRedAlert(row, TRUE);
        
        if (proxy_protected == 0) {
                uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
@@ -1032,7 +1032,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
        else
                uiItemL(row, con->name, ICON_NONE);
        
-       uiLayoutSetRedAlert(row, 0);
+       uiLayoutSetRedAlert(row, FALSE);
        
        /* proxy-protected constraints cannot be edited, so hide up/down + close buttons */
        if (proxy_protected) {
@@ -1200,7 +1200,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
        block = uiLayoutGetBlock(layout);
        row = uiLayoutRow(layout, FALSE);
        col = uiLayoutColumn(row, FALSE);
-       uiLayoutSetKeepAspect(col, 1);
+       uiLayoutSetKeepAspect(col, TRUE);
        
        /* add preview */
        uiDefBut(block, BUT_EXTRA, 0, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, pid, 0.0, 0.0, 0, 0, "");
@@ -1894,7 +1894,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
        }
 
        if (cmp) {
-               uiLayoutColumn(layout, TRUE);
+               uiLayoutRow(layout, TRUE);
                uiBlockSetNFunc(block, curvemap_buttons_update, NULL, cumap);
                uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, 0.0f, 1.0f, 1, 5, "");
                uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, 0.0f, 1.0f, 1, 5, "");
@@ -2205,7 +2205,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
                row = uiLayoutRow(split, TRUE);
                if (i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
                else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
-               uiItemR(row, itemptr, "mute", 0, "", 0);
+               uiItemR(row, itemptr, "mute", 0, "", ICON_NONE);
 
                if ((kb->flag & KEYBLOCK_MUTE) ||
                    (ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)))
@@ -2274,9 +2274,9 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
                uiBlockSetEmboss(block, UI_EMBOSSN);
                row = uiLayoutRow(split, TRUE);
                uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE);
-               uiItemR(row, itemptr, "hide", 0, "", 0);
-               uiItemR(row, itemptr, "hide_select", 0, "", 0);
-               uiItemR(row, itemptr, "hide_render", 0, "", 0);
+               uiItemR(row, itemptr, "hide", 0, "", ICON_NONE);
+               uiItemR(row, itemptr, "hide_select", 0, "", ICON_NONE);
+               uiItemR(row, itemptr, "hide_render", 0, "", ICON_NONE);
 
                uiBlockSetEmboss(block, UI_EMBOSS);
        }
@@ -2321,7 +2321,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
                                while (id < prop_names_end) {
                                        if ((id_next = strchr(id, ':'))) *id_next++ = '\0';
                                        else id_next = prop_names_end;
-                                       uiItemR(row, itemptr, id, 0, NULL, 0);
+                                       uiItemR(row, itemptr, id, 0, NULL, ICON_NONE);
                                        id = id_next;
                                }
                                MEM_freeN(prop_names);
index d0ce3f0caceec0d2e66669a5b03212ba7006e7d6..0e6b8f7752822ba862270fe1938ceeef0297f27f 100644 (file)
@@ -152,10 +152,10 @@ void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
 
        /* Export Options: */
        box = uiLayoutBox(layout);
-       row = uiLayoutRow(box, 0);
+       row = uiLayoutRow(box, FALSE);
        uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
 
-       row = uiLayoutRow(box, 0);
+       row = uiLayoutRow(box, FALSE);
        split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
        col   = uiLayoutColumn(split, FALSE);
        uiItemR(col, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
index 8f08c3afc365a5ed817ecaa57bf5303a0adbaca0..7ecfb712c18cae588e8c3cb4b57a056923f8e09b 100644 (file)
@@ -555,7 +555,7 @@ static int verge_linehit(const void *vlh1, const void *vlh2)
 }
 
 /* If there's a linehit connected (same face) as testi in range [firsti, lasti], return the first such, else -1.
 * If testi is out of range, look for connection to f instead, if f is non-NULL */
+ * If testi is out of range, look for connection to f instead, if f is non-NULL */
 static int find_connected_linehit(KnifeTool_OpData *kcd, int testi, BMFace *f, int firsti, int lasti)
 {
        int i;
@@ -563,9 +563,10 @@ static int find_connected_linehit(KnifeTool_OpData *kcd, int testi, BMFace *f, i
        for (i = firsti; i <= lasti; i++) {
                if (testi >= 0 && testi < kcd->totlinehit) {
                        if (knife_find_common_face(&kcd->linehits[testi].kfe->faces,
-                                                                          &kcd->linehits[i].kfe->faces))
+                                                  &kcd->linehits[i].kfe->faces))
                                return i;
-               } else if (f) {
+               }
+               else if (f) {
                        if (find_ref(&kcd->linehits[i].kfe->faces, f))
                                return i;
                }
@@ -582,9 +583,9 @@ static void knife_sort_linehits(KnifeTool_OpData *kcd)
 
        /* for ranges of equal "l", swap if neccesary to make predecessor and
         * successor faces connected to the linehits at either end of the range */
-       for (i = 0; i < kcd->totlinehit -1; i = nexti) {
+       for (i = 0; i < kcd->totlinehit - 1; i = nexti) {
                for (j = i + 1; j < kcd->totlinehit; j++) {
-                       if (fabsf(kcd->linehits[j].l - kcd->linehits[i].l) > 80*FLT_EPSILON)
+                       if (fabsf(kcd->linehits[j].l - kcd->linehits[i].l) > 80 * FLT_EPSILON)
                                break;
                }
                nexti = j;
index b13a299c4c79a2dfbcbb4fd13d2587cf4155d3b5..c8ba9240db37c9a044108ce8be25b69bce7b517e 100644 (file)
@@ -62,6 +62,7 @@
 #include "BKE_tessmesh.h"
 #include "BKE_report.h"
 #include "BKE_DerivedMesh.h"
+#include "BKE_object_deform.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -1136,7 +1137,6 @@ static void vgroup_levels(Object *ob, float offset, float gain)
        }
 }
 
-/* TODO - select between groups */
 static void vgroup_normalize_all(Object *ob, int lock_active)
 {
        MDeformVert *dv, **dvert_array = NULL;
@@ -1152,29 +1152,35 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
        ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
 
        if (dvert_array) {
-               if (lock_active) {
+               const int defbase_tot = BLI_countlist(&ob->defbase);
+               char *lock_flags = BKE_objdef_lock_flags_get(ob, defbase_tot);
 
-                       for (i = 0; i < dvert_tot; i++) {
-                               /* in case its not selected */
-                               if (!(dv = dvert_array[i])) {
-                                       continue;
-                               }
-
-                               defvert_normalize_lock(dv, def_nr);
-                       }
+               if ((lock_active == TRUE) &&
+                   (lock_flags != NULL) &&
+                   (def_nr < defbase_tot))
+               {
+                       lock_flags[def_nr] = TRUE;
                }
-               else {
-                       for (i = 0; i < dvert_tot; i++) {
 
-                               /* in case its not selected */
-                               if (!(dv = dvert_array[i])) {
-                                       continue;
+               for (i = 0; i < dvert_tot; i++) {
+                       /* in case its not selected */
+                       if ((dv = dvert_array[i])) {
+                               if (lock_flags) {
+                                       defvert_normalize_lock_map(dv, lock_flags, defbase_tot);
+                               }
+                               else if (lock_active) {
+                                       defvert_normalize_lock_single(dv, def_nr);
+                               }
+                               else {
+                                       defvert_normalize(dv);
                                }
-
-                               defvert_normalize(dv);
                        }
                }
 
+               if (lock_flags) {
+                       MEM_freeN(lock_flags);
+               }
+
                MEM_freeN(dvert_array);
        }
 }
index 3c389f97b340cec2ebcb9f7f14e1844f3818d6a1..bf948bf9dd809806bce519e070c0f99cbb527e9f 100644 (file)
@@ -72,6 +72,7 @@
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
+#include "BKE_object_deform.h"
 #include "BKE_paint.h"
 #include "BKE_report.h"
 
@@ -1308,29 +1309,6 @@ static char has_locked_group(MDeformVert *dvert, const int defbase_tot,
        }
        return FALSE;
 }
-/* 
- * gen_lck_flags gets the status of "flag" for each bDeformGroup
- * in ob->defbase and returns an array containing them
- */
-static char *gen_lock_flags(Object *ob, int defbase_tot)
-{
-       char is_locked = FALSE;
-       int i;
-       //int defbase_tot = BLI_countlist(&ob->defbase);
-       char *lock_flags = MEM_mallocN(defbase_tot * sizeof(char), "defflags");
-       bDeformGroup *defgroup;
-
-       for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
-               lock_flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
-               is_locked |= lock_flags[i];
-       }
-       if (is_locked) {
-               return lock_flags;
-       }
-
-       MEM_freeN(lock_flags);
-       return NULL;
-}
 
 static int has_locked_group_selected(int defbase_tot, const char *defbase_sel, const char *lock_flags)
 {
@@ -1722,10 +1700,6 @@ static int get_first_selected_nonzero_weight(MDeformVert *dvert, const int defba
        return -1;
 }
 
-
-static char *wpaint_make_validmap(Object *ob);
-
-
 static void do_weight_paint_vertex(
         /* vars which remain the same for every vert */
         VPaint *wp, Object *ob, const WeightPaintInfo *wpi,
@@ -2067,63 +2041,6 @@ struct WPaintData {
        int defbase_tot;
 };
 
-static char *wpaint_make_validmap(Object *ob)
-{
-       bDeformGroup *dg;
-       ModifierData *md;
-       char *vgroup_validmap;
-       GHash *gh;
-       int i, step1 = 1;
-
-       if (ob->defbase.first == NULL) {
-               return NULL;
-       }
-
-       gh = BLI_ghash_str_new("wpaint_make_validmap gh");
-
-       /* add all names to a hash table */
-       for (dg = ob->defbase.first; dg; dg = dg->next) {
-               BLI_ghash_insert(gh, dg->name, NULL);
-       }
-
-       /* now loop through the armature modifiers and identify deform bones */
-       for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob) : md->next) {
-               if (!(md->mode & (eModifierMode_Realtime | eModifierMode_Virtual)))
-                       continue;
-
-               if (md->type == eModifierType_Armature) {
-                       ArmatureModifierData *amd = (ArmatureModifierData *) md;
-
-                       if (amd->object && amd->object->pose) {
-                               bPose *pose = amd->object->pose;
-                               bPoseChannel *chan;
-                               
-                               for (chan = pose->chanbase.first; chan; chan = chan->next) {
-                                       if (chan->bone->flag & BONE_NO_DEFORM)
-                                               continue;
-
-                                       if (BLI_ghash_remove(gh, chan->name, NULL, NULL)) {
-                                               BLI_ghash_insert(gh, chan->name, SET_INT_IN_POINTER(1));
-                                       }
-                               }
-                       }
-               }
-       }
-
-       vgroup_validmap = MEM_mallocN(BLI_ghash_size(gh), "wpaint valid map");
-
-       /* add all names to a hash table */
-       for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
-               vgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);
-       }
-
-       BLI_assert(i == BLI_ghash_size(gh));
-
-       BLI_ghash_free(gh, NULL, NULL);
-
-       return vgroup_validmap;
-}
-
 static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNUSED(mouse[2]))
 {
        Scene *scene = CTX_data_scene(C);
@@ -2202,9 +2119,9 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNU
        /* set up auto-normalize, and generate map for detecting which
         * vgroups affect deform bones */
        wpd->defbase_tot = BLI_countlist(&ob->defbase);
-       wpd->lock_flags = gen_lock_flags(ob, wpd->defbase_tot);
+       wpd->lock_flags = BKE_objdef_lock_flags_get(ob, wpd->defbase_tot);
        if (ts->auto_normalize || ts->multipaint || wpd->lock_flags) {
-               wpd->vgroup_validmap = wpaint_make_validmap(ob);
+               wpd->vgroup_validmap = BKE_objdef_validmap_get(ob, wpd->defbase_tot);
        }
 
        /* painting on subsurfs should give correct points too, this returns me->totvert amount */
@@ -2243,7 +2160,6 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
        float alpha;
        float mval[2];
        int use_vert_sel;
-       char *defbase_sel;
 
        const float pressure = RNA_float_get(itemptr, "pressure");
        const float brush_size_pressure = BKE_brush_size_get(scene, brush) * (BKE_brush_use_size_pressure(scene, brush) ? pressure : 1.0f);
@@ -2277,12 +2193,13 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 
 
 
+
        /* *** setup WeightPaintInfo - pass onto do_weight_paint_vertex *** */
        wpi.defbase_tot =        wpd->defbase_tot;
-       defbase_sel =            MEM_mallocN(wpi.defbase_tot * sizeof(char), "wpi.defbase_sel");
-       wpi.defbase_tot_sel =    get_selected_defgroups(ob, defbase_sel, wpi.defbase_tot);
-       wpi.defbase_sel =        defbase_sel; /* so we can stay const */
-       if (wpi.defbase_tot_sel == 0 && ob->actdef > 0) wpi.defbase_tot_sel = 1;
+       wpi.defbase_sel = BKE_objdef_selected_get(ob, wpi.defbase_tot, &wpi.defbase_tot_sel);
+       if (wpi.defbase_tot_sel == 0 && ob->actdef > 0) {
+               wpi.defbase_tot_sel = 1;
+       }
 
        wpi.defbase_tot_unsel =  wpi.defbase_tot - wpi.defbase_tot_sel;
        wpi.vgroup_active =      wpd->vgroup_active;
index d8c7bf3f809c1ea6f2691541b7dbaf0ab1b6921f..1bdf5214192e71ee7a3626b9b3821807c8236782 100644 (file)
@@ -230,7 +230,7 @@ static void clip_panel_operator_redo(const bContext *C, Panel *pa)
        block = uiLayoutGetBlock(pa->layout);
 
        if (!WM_operator_check_ui_enabled(C, op->type->name))
-               uiLayoutSetEnabled(pa->layout, 0);
+               uiLayoutSetEnabled(pa->layout, FALSE);
 
        /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
        uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
index 08e0934e8ae7fb578cc88a1a02e6eee89f6a6853..12823de60d2c6dbc0927cf8e94028e328ed577cc 100644 (file)
@@ -4352,38 +4352,38 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
        uiLayout *row;
        uiLayout *col;
 
-       uiItemR(layout, ptr, "mode", 0, NULL, 0);
-       uiItemR(layout, ptr, "target", 0, NULL, 0);
-       uiItemR(layout, ptr, "navmesh", 0, NULL, 0);    
+       uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
+       uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE);
+       uiItemR(layout, ptr, "navmesh", 0, NULL, ICON_NONE);
 
        row = uiLayoutRow(layout, FALSE);
-       uiItemR(row, ptr, "distance", 0, NULL, 0);
-       uiItemR(row, ptr, "velocity", 0, NULL, 0);
+       uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
+       uiItemR(row, ptr, "velocity", 0, NULL, ICON_NONE);
        row = uiLayoutRow(layout, FALSE);
-       uiItemR(row, ptr, "acceleration", 0, NULL, 0);
-       uiItemR(row, ptr, "turn_speed", 0, NULL, 0);
+       uiItemR(row, ptr, "acceleration", 0, NULL, ICON_NONE);
+       uiItemR(row, ptr, "turn_speed", 0, NULL, ICON_NONE);
 
        row = uiLayoutRow(layout, FALSE);
        col = uiLayoutColumn(row, FALSE);
-       uiItemR(col, ptr, "facing", 0, NULL, 0);
+       uiItemR(col, ptr, "facing", 0, NULL, ICON_NONE);
        col = uiLayoutColumn(row, FALSE);
-       uiItemR(col, ptr, "facing_axis", 0, NULL, 0);
+       uiItemR(col, ptr, "facing_axis", 0, NULL, ICON_NONE);
        if (!RNA_boolean_get(ptr, "facing")) {
                uiLayoutSetActive(col, FALSE);
        }
        col = uiLayoutColumn(row, FALSE);
-       uiItemR(col, ptr, "normal_up", 0, NULL, 0);
+       uiItemR(col, ptr, "normal_up", 0, NULL, ICON_NONE);
        if (!RNA_pointer_get(ptr, "navmesh").data) {
                uiLayoutSetActive(col, FALSE);
        }
 
        row = uiLayoutRow(layout, FALSE);
-       uiItemR(row, ptr, "self_terminated", 0, NULL, 0);
+       uiItemR(row, ptr, "self_terminated", 0, NULL, ICON_NONE);
        if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) {
-               uiItemR(row, ptr, "update_period", 0, NULL, 0); 
+               uiItemR(row, ptr, "update_period", 0, NULL, ICON_NONE);
                row = uiLayoutRow(layout, FALSE);
        }
-       uiItemR(row, ptr, "show_visualization", 0, NULL, 0);    
+       uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE);
 }
 
 static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C)
index 1981d08558353352099cb7086037016323767b9c..3455e0b219c6ebaddc9c20d0ce46e76762fe85b8 100644 (file)
@@ -901,7 +901,7 @@ void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
 
 static void node_common_buts_whileloop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
-       uiItemR(layout, ptr, "max_iterations", 0, NULL, 0);
+       uiItemR(layout, ptr, "max_iterations", 0, NULL, ICON_NONE);
 }
 
 /* XXX Does a bounding box update by iterating over all children.
@@ -1555,9 +1555,9 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point
        uiItemR(col, ptr, "use_relative", 0, NULL, ICON_NONE);
        
        if (RNA_boolean_get(ptr, "use_relative")) {
-               uiItemL(col, IFACE_("Aspect Correction"), 0);
+               uiItemL(col, IFACE_("Aspect Correction"), ICON_NONE);
                row = uiLayoutRow(layout, TRUE);
-               uiItemR(row, ptr, "aspect_correction", UI_ITEM_R_EXPAND, NULL, 0);
+               uiItemR(row, ptr, "aspect_correction", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
                
                col = uiLayoutColumn(layout, TRUE);
                uiItemR(col, ptr, "factor_x", 0, IFACE_("X"), ICON_NONE);
@@ -1981,7 +1981,7 @@ static void node_draw_input_file_output(const bContext *C, uiBlock *block,
                NodeImageMultiFileSocket *input = sock->storage;
                RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotLayer, input, &inputptr);
                
-               uiItemL(row, input->layer, 0);
+               uiItemL(row, input->layer, ICON_NONE);
        }
        else {
                NodeImageMultiFileSocket *input = sock->storage;
@@ -1989,7 +1989,7 @@ static void node_draw_input_file_output(const bContext *C, uiBlock *block,
                const char *imtype_name;
                RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotFile, input, &inputptr);
                
-               uiItemL(row, input->path, 0);
+               uiItemL(row, input->path, ICON_NONE);
                
                if (!RNA_boolean_get(&inputptr, "use_node_format"))
                        imfptr = RNA_pointer_get(&inputptr, "format");
@@ -1998,7 +1998,7 @@ static void node_draw_input_file_output(const bContext *C, uiBlock *block,
                RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop,
                                       RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name);
                uiBlockSetEmboss(block, UI_EMBOSSP);
-               uiItemL(row, imtype_name, 0);
+               uiItemL(row, imtype_name, ICON_NONE);
                uiBlockSetEmboss(block, UI_EMBOSSN);
        }
        
@@ -2010,9 +2010,9 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C)
        int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER);
        
        if (multilayer)
-               uiItemL(layout, IFACE_("Path:"), 0);
+               uiItemL(layout, IFACE_("Path:"), ICON_NONE);
        else
-               uiItemL(layout, IFACE_("Base Path:"), 0);
+               uiItemL(layout, IFACE_("Base Path:"), ICON_NONE);
        uiItemR(layout, ptr, "base_path", 0, "", ICON_NONE);
 }
 static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -2058,9 +2058,9 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
                        uiLayout *row, *col;
                        col = uiLayoutColumn(layout, TRUE);
                        
-                       uiItemL(col, IFACE_("Layer:"), 0);
+                       uiItemL(col, IFACE_("Layer:"), ICON_NONE);
                        row = uiLayoutRow(col, FALSE);
-                       uiItemR(row, &active_input_ptr, "name", 0, "", 0);
+                       uiItemR(row, &active_input_ptr, "name", 0, "", ICON_NONE);
                        uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "",
                                    ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
                }
@@ -2068,9 +2068,9 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
                        uiLayout *row, *col;
                        col = uiLayoutColumn(layout, TRUE);
                        
-                       uiItemL(col, IFACE_("File Path:"), 0);
+                       uiItemL(col, IFACE_("File Path:"), ICON_NONE);
                        row = uiLayoutRow(col, FALSE);
-                       uiItemR(row, &active_input_ptr, "path", 0, "", 0);
+                       uiItemR(row, &active_input_ptr, "path", 0, "", ICON_NONE);
                        uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "",
                                    ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
                        
@@ -2078,8 +2078,8 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
                        imfptr = RNA_pointer_get(&active_input_ptr, "format");
                        
                        col = uiLayoutColumn(layout, TRUE);
-                       uiItemL(col, IFACE_("Format:"), 0);
-                       uiItemR(col, &active_input_ptr, "use_node_format", 0, NULL, 0);
+                       uiItemL(col, IFACE_("Format:"), ICON_NONE);
+                       uiItemR(col, &active_input_ptr, "use_node_format", 0, NULL, ICON_NONE);
                        
                        col = uiLayoutColumn(layout, FALSE);
                        uiLayoutSetActive(col, RNA_boolean_get(&active_input_ptr, "use_node_format") == FALSE);
@@ -2233,12 +2233,12 @@ static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, Pointe
        if (!node->id)
                return;
 
-       uiItemR(layout, ptr, "filter_type", 0, "", 0);
+       uiItemR(layout, ptr, "filter_type", 0, "", ICON_NONE);
 }
 
 static void node_composit_buts_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
-       uiItemR(layout, ptr, "filter_type", 0, "", 0);
+       uiItemR(layout, ptr, "filter_type", 0, "", ICON_NONE);
 }
 
 static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -2250,7 +2250,7 @@ static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, Po
        if (!node->id)
                return;
 
-       uiItemR(layout, ptr, "distortion_type", 0, "", 0);
+       uiItemR(layout, ptr, "distortion_type", 0, "", ICON_NONE);
 }
 
 static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -2263,15 +2263,15 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
        uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE);
 
        row = uiLayoutRow(layout, FALSE);
-       uiItemL(row, "", 0);
-       uiItemL(row, IFACE_("Saturation"), 0);
-       uiItemL(row, IFACE_("Contrast"), 0);
-       uiItemL(row, IFACE_("Gamma"), 0);
-       uiItemL(row, IFACE_("Gain"), 0);
-       uiItemL(row, IFACE_("Lift"), 0);
+       uiItemL(row, "", ICON_NONE);
+       uiItemL(row, IFACE_("Saturation"), ICON_NONE);
+       uiItemL(row, IFACE_("Contrast"), ICON_NONE);
+       uiItemL(row, IFACE_("Gamma"), ICON_NONE);
+       uiItemL(row, IFACE_("Gain"), ICON_NONE);
+       uiItemL(row, IFACE_("Lift"), ICON_NONE);
 
        row = uiLayoutRow(layout, FALSE);
-       uiItemL(row, IFACE_("Master"), 0);
+       uiItemL(row, IFACE_("Master"), ICON_NONE);
        uiItemR(row, ptr, "master_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "master_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "master_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2279,7 +2279,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
        uiItemR(row, ptr, "master_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
 
        row = uiLayoutRow(layout, FALSE);
-       uiItemL(row, IFACE_("Highlights"), 0);
+       uiItemL(row, IFACE_("Highlights"), ICON_NONE);
        uiItemR(row, ptr, "highlights_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "highlights_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "highlights_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2287,7 +2287,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
        uiItemR(row, ptr, "highlights_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
 
        row = uiLayoutRow(layout, FALSE);
-       uiItemL(row, IFACE_("Midtones"), 0);
+       uiItemL(row, IFACE_("Midtones"), ICON_NONE);
        uiItemR(row, ptr, "midtones_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "midtones_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "midtones_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2295,7 +2295,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
        uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
 
        row = uiLayoutRow(layout, FALSE);
-       uiItemL(row, IFACE_("Shadows"), 0);
+       uiItemL(row, IFACE_("Shadows"), ICON_NONE);
        uiItemR(row, ptr, "shadows_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "shadows_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
        uiItemR(row, ptr, "shadows_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2316,31 +2316,31 @@ static void node_composit_buts_colorcorrection_but(uiLayout *layout, bContext *U
        uiItemR(row, ptr, "green", 0, NULL, ICON_NONE);
        uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE);
        row = layout;
-       uiItemL(row, IFACE_("Saturation"), 0);
+       uiItemL(row, IFACE_("Saturation"), ICON_NONE);
        uiItemR(row, ptr, "master_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "highlights_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "midtones_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "shadows_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 
-       uiItemL(row, IFACE_("Contrast"), 0);
+       uiItemL(row, IFACE_("Contrast"), ICON_NONE);
        uiItemR(row, ptr, "master_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "highlights_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "midtones_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "shadows_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 
-       uiItemL(row, IFACE_("Gamma"), 0);
+       uiItemL(row, IFACE_("Gamma"), ICON_NONE);
        uiItemR(row, ptr, "master_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "highlights_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "midtones_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "shadows_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 
-       uiItemL(row, IFACE_("Gain"), 0);
+       uiItemL(row, IFACE_("Gain"), ICON_NONE);
        uiItemR(row, ptr, "master_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "highlights_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "midtones_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "shadows_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        
-       uiItemL(row, IFACE_("Lift"), 0);
+       uiItemL(row, IFACE_("Lift"), ICON_NONE);
        uiItemR(row, ptr, "master_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "highlights_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -2591,7 +2591,7 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN
 
                RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr);
 
-               col = uiLayoutColumn(layout, 0);
+               col = uiLayoutColumn(layout, FALSE);
                uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA);
 
                object = BKE_tracking_object_get_named(tracking, data->tracking_object);
index e50b1dc4ba6bb880d2f338354371314279fac784..da077d9364163c42f4c216c2cdcd114f533fbb6f 100644 (file)
@@ -110,8 +110,8 @@ static void active_node_panel(const bContext *C, Panel *pa)
        uiItemR(col, &ptr, "use_custom_color", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
        sub = uiLayoutRow(col, FALSE);
        if (!(node->flag & NODE_CUSTOM_COLOR))
-               uiLayoutSetEnabled(sub, 0);
-       uiItemR(sub, &ptr, "color", 0, "", 0);
+               uiLayoutSetEnabled(sub, FALSE);
+       uiItemR(sub, &ptr, "color", 0, "", ICON_NONE);
        
        col = uiLayoutColumn(row, TRUE);
        uiItemO(col, "", ICON_ZOOMIN, "node.node_color_preset_add");
index 989b3999018ec88937bc1aaa1522920901c7ed86..7881014ed54444bf4032413af03c647602775312 100644 (file)
@@ -627,11 +627,11 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
                                row = uiLayoutRow(split, FALSE);
                                col = uiLayoutColumn(row, FALSE);
 
-                               uiItemR(col, &inputptr, "default_value", 0, "", 0);
+                               uiItemR(col, &inputptr, "default_value", 0, "", ICON_NONE);
                        }
                        else {
                                row = uiLayoutRow(split, TRUE);
-                               uiItemR(row, &inputptr, "default_value", 0, "", 0);
+                               uiItemR(row, &inputptr, "default_value", 0, "", ICON_NONE);
                        }
                }
                else
index d2b3bcf682548871c1cee7e767a5f0824955afcd..da93e07748a08ad066da626710cfd18ff8f9ce39 100644 (file)
@@ -1030,7 +1030,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
        if (draw_flags & DRAW_FACE_SELECT)
                facemask = wpaint__setSolidDrawOptions_facemask;
 
-       if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
+       if (ob->mode & OB_MODE_WEIGHT_PAINT) {
 
                if (do_light) {
                        const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f};
index ee1ead76f7c98dcde2e663e140b6c44cb9c05ae3..b40e880591a06d285ab156f46b4e7b208559379a 100644 (file)
@@ -111,7 +111,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
        block = uiLayoutGetBlock(pa->layout);
        
        if (!WM_operator_check_ui_enabled(C, op->type->name))
-               uiLayoutSetEnabled(pa->layout, 0);
+               uiLayoutSetEnabled(pa->layout, FALSE);
 
        /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
        uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
index c13e6c16413a41e3601d15fa2b84ea33d30f78b8..e0991c48fa67eb1be14c6fba8743d6bbff8c60d2 100644 (file)
@@ -62,6 +62,7 @@ set(SRC
        ../include/ED_lattice.h
        ../include/ED_logic.h
        ../include/ED_markers.h
+       ../include/ED_mask.h
        ../include/ED_mball.h
        ../include/ED_mesh.h
        ../include/ED_node.h
index dd6ccbb1dab36cd2a6c3e1ce8e40b594b206bb8a..78a989ad48fda732dddf3487c611ce36a220b47b 100644 (file)
@@ -174,12 +174,13 @@ static int compare_int(const void *av, const void *bv)
 
 static void IMB_moviecache_destructor(void *p)
 {
-       MovieCacheItem *item = (MovieCacheItem *) p;
-       MovieCache *cache = item->cache_owner;
-
-       PRINT("%s: cache '%s' destroy item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
+       MovieCacheItem *item = (MovieCacheItem *)p;
 
        if (item && item->ibuf) {
+               MovieCache *cache = item->cache_owner;
+
+               PRINT("%s: cache '%s' destroy item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
+
                IMB_freeImBuf(item->ibuf);
 
                item->ibuf = NULL;
index c83bddbfc642365c8cff52c82807f323eba1a296..c34ff009405360bbd7a3affd60b0459d139254b7 100644 (file)
@@ -99,7 +99,7 @@ typedef struct Strip {
        StripProxy *proxy;
        StripCrop *crop;
        StripTransform *transform;
-       StripColorBalance *color_balance;
+       StripColorBalance *color_balance DNA_DEPRECATED;
 } Strip;
 
 /**
@@ -150,9 +150,6 @@ typedef struct Sequence {
        /* pointers for effects: */
        struct Sequence *seq1, *seq2, *seq3;
 
-       /* maks input for effects */
-       struct Sequence *mask_sequence;
-
        ListBase seqbase;       /* list of strips for metastrips */
 
        struct bSound *sound;   /* the linked "bSound" object */
@@ -315,7 +312,7 @@ typedef struct BrightContrastModifierData {
 #define SEQ_USE_PROXY               (1 << 15)
 #define SEQ_USE_TRANSFORM           (1 << 16)
 #define SEQ_USE_CROP                (1 << 17)
-#define SEQ_USE_COLOR_BALANCE       (1 << 18)
+/* #define SEQ_USE_COLOR_BALANCE       (1 << 18) */ /* DEPRECATED */
 #define SEQ_USE_PROXY_CUSTOM_DIR    (1 << 19)
 
 #define SEQ_USE_PROXY_CUSTOM_FILE   (1 << 21)
index a755e130bb79d6ddebe0345a8ae8987170eedd71..5a3efb645a5ef4fbebbfae7cc172ec4f67f54ed4 100644 (file)
@@ -317,7 +317,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
        RNA_def_property_flag(prop, PROP_REQUIRED);
        prop = RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX);
        RNA_def_property_flag(prop, PROP_REQUIRED);
-       prop = RNA_def_string(func, "layer", "", 0, "Layer", "Single layer to get render result for");
+       RNA_def_string(func, "layer", "", 0, "Layer", "Single layer to get render result for");  /* NULL ok here */
        prop = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
        RNA_def_function_return(func, prop);
 
index 88952e6cecac3a50803f4ae00ed121d5f3e6ae17..e3e467a9abbd3ca610058b2e99c0695c3d3ed5b7 100644 (file)
@@ -56,7 +56,6 @@ typedef struct EffectInfo {
        const char *ui_desc;
        void (*func)(StructRNA *);
        int inputs;
-       int supports_mask;
 } EffectInfo;
 
 EnumPropertyItem sequence_modifier_type_items[] = {
@@ -244,28 +243,6 @@ static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
        BKE_sequencer_sort(scene);
 }
 
-/* properties that need to allocate structs */
-static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value)
-{
-       Sequence *seq = (Sequence *)ptr->data;
-       int c;
-       
-       if (value) {
-               seq->flag |= SEQ_USE_COLOR_BALANCE;
-               if (seq->strip->color_balance == NULL) {
-                       seq->strip->color_balance = MEM_callocN(sizeof(struct StripColorBalance), "StripColorBalance");
-                       for (c = 0; c < 3; c++) {
-                               seq->strip->color_balance->lift[c] = 1.0f;
-                               seq->strip->color_balance->gamma[c] = 1.0f;
-                               seq->strip->color_balance->gain[c] = 1.0f;
-                       }
-               }
-       }
-       else {
-               seq->flag ^= SEQ_USE_COLOR_BALANCE;
-       }
-}
-
 static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
 {
        Sequence *seq = (Sequence *)ptr->data;
@@ -608,13 +585,6 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr)
        return BKE_sequence_effect_get_num_inputs(seq->type);
 }
 
-static int rna_Sequence_supports_mask_get(PointerRNA *ptr)
-{
-       Sequence *seq = (Sequence *)(ptr->data);
-
-       return BKE_sequence_effect_get_supports_mask(seq->type);
-}
-
 #if 0
 static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value)
 {
@@ -642,20 +612,6 @@ static void rna_Sequence_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point
        }
 }
 
-static int rna_Sequence_otherSequence_poll(PointerRNA *ptr, PointerRNA value)
-{
-       Sequence *seq = (Sequence *) ptr->data;
-       Sequence *cur = (Sequence *) value.data;
-
-       if (seq == cur)
-               return FALSE;
-
-       if (BKE_sequence_check_depend(seq, cur))
-               return FALSE;
-
-       return TRUE;
-}
-
 static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        Scene *scene = (Scene *) ptr->id.data;
@@ -1631,16 +1587,6 @@ static void rna_def_filter_video(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
        RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
 
-       prop = RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_COLOR_BALANCE);
-       RNA_def_property_ui_text(prop, "Use Color Balance", "(3-Way color correction) on input");
-       RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_color_balance_set");
-       RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
-       prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
-       RNA_def_property_pointer_sdna(prop, NULL, "strip->color_balance");
-       RNA_def_property_ui_text(prop, "Color Balance", "");
-
        prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
        RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");
@@ -1706,7 +1652,7 @@ static void rna_def_input(StructRNA *srna)
        RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
 }
 
-static void rna_def_effect_inputs(StructRNA *srna, int count, int supports_mask)
+static void rna_def_effect_inputs(StructRNA *srna, int count)
 {
        PropertyRNA *prop;
 
@@ -1714,10 +1660,6 @@ static void rna_def_effect_inputs(StructRNA *srna, int count, int supports_mask)
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
 
-       prop = RNA_def_property(srna, "is_supports_mask", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_int_funcs(prop, "rna_Sequence_supports_mask_get", NULL, NULL);
-
        if (count >= 1) {
                prop = RNA_def_property(srna, "input_1",  PROP_POINTER, PROP_NONE);
                RNA_def_property_pointer_sdna(prop, NULL, "seq1");
@@ -1740,15 +1682,6 @@ static void rna_def_effect_inputs(StructRNA *srna, int count, int supports_mask)
                RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
        }
        */
-
-       if (supports_mask) {
-               prop = RNA_def_property(srna, "input_mask_strip",  PROP_POINTER, PROP_NONE);
-               RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence");
-               RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Sequence_otherSequence_poll");
-               RNA_def_property_flag(prop, PROP_EDITABLE);
-               RNA_def_property_ui_text(prop, "Mask", "Mask input for the effect strip");
-               RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-       }
 }
 
 static void rna_def_image(BlenderRNA *brna)
@@ -2189,28 +2122,28 @@ static void rna_def_speed_control(StructRNA *srna)
 }
 
 static EffectInfo def_effects[] = {
-       {"AddSequence", "Add Sequence", "Add Sequence", NULL, 2, FALSE},
+       {"AddSequence", "Add Sequence", "Add Sequence", NULL, 2},
        {"AdjustmentSequence", "Adjustment Layer Sequence",
-        "Sequence strip to perform filter adjustments to layers below", rna_def_input, 0, TRUE},
-       {"AlphaOverSequence", "Alpha Over Sequence", "Alpha Over Sequence", NULL, 2, FALSE},
-       {"AlphaUnderSequence", "Alpha Under Sequence", "Alpha Under Sequence", NULL, 2, FALSE},
+        "Sequence strip to perform filter adjustments to layers below", rna_def_input, 0},
+       {"AlphaOverSequence", "Alpha Over Sequence", "Alpha Over Sequence", NULL, 2},
+       {"AlphaUnderSequence", "Alpha Under Sequence", "Alpha Under Sequence", NULL, 2},
        {"ColorSequence", "Color Sequence",
-        "Sequence strip creating an image filled with a single color", rna_def_solid_color, 0, FALSE},
-       {"CrossSequence", "Cross Sequence", "Cross Sequence", NULL, 2, FALSE},
-       {"GammaCrossSequence", "Gamma Cross Sequence", "Gamma Cross Sequence", NULL, 2, FALSE},
-       {"GlowSequence", "Glow Sequence", "Sequence strip creating a glow effect", rna_def_glow, 1, FALSE},
+        "Sequence strip creating an image filled with a single color", rna_def_solid_color, 0},
+       {"CrossSequence", "Cross Sequence", "Cross Sequence", NULL, 2},
+       {"GammaCrossSequence", "Gamma Cross Sequence", "Gamma Cross Sequence", NULL, 2},
+       {"GlowSequence", "Glow Sequence", "Sequence strip creating a glow effect", rna_def_glow, 1},
        {"MulticamSequence", "Multicam Select Sequence", "Sequence strip to perform multicam editing",
-        rna_def_multicam, 0, FALSE},
-       {"MultiplySequence", "Multiply Sequence", "Multiply Sequence", NULL, 2, FALSE},
-       {"OverDropSequence", "Over Drop Sequence", "Over Drop Sequence", NULL, 2, FALSE},
+        rna_def_multicam, 0},
+       {"MultiplySequence", "Multiply Sequence", "Multiply Sequence", NULL, 2},
+       {"OverDropSequence", "Over Drop Sequence", "Over Drop Sequence", NULL, 2},
        {"SpeedControlSequence", "SpeedControl Sequence",
-        "Sequence strip to control the speed of other strips", rna_def_speed_control, 1, FALSE},
-       {"SubtractSequence", "Subtract Sequence", "Subtract Sequence", NULL, 2, FALSE},
+        "Sequence strip to control the speed of other strips", rna_def_speed_control, 1},
+       {"SubtractSequence", "Subtract Sequence", "Subtract Sequence", NULL, 2},
        {"TransformSequence", "Transform Sequence",
-        "Sequence strip applying affine transformations to other strips", rna_def_transform, 1, FALSE},
+        "Sequence strip applying affine transformations to other strips", rna_def_transform, 1},
        {"WipeSequence", "Wipe Sequence", "Sequence strip creating a wipe transition",
-        rna_def_wipe, 1, FALSE},
-       {"", "", "", NULL, 0, FALSE}
+        rna_def_wipe, 1},
+       {"", "", "", NULL, 0}
 };
 
 static void rna_def_effects(BlenderRNA *brna)
@@ -2223,7 +2156,7 @@ static void rna_def_effects(BlenderRNA *brna)
                RNA_def_struct_ui_text(srna, effect->ui_name, effect->ui_desc);
                RNA_def_struct_sdna(srna, "Sequence");
 
-               rna_def_effect_inputs(srna, effect->inputs, effect->supports_mask);
+               rna_def_effect_inputs(srna, effect->inputs);
 
                if (effect->func)
                        effect->func(srna);
index b75d177d80989c0f0aead05c21db310e9a21398e..e3359fbae59bfcbbacc0ca234afab5bb6568d1a4 100755 (executable)
@@ -60,7 +60,7 @@ def check_commandline():
         usage()
     if sys.argv[1] == '-h':
         help()
-    elif not (sys.argv[1].endswith(".txt") or sys.argv[1].endswith(".py")):
+    elif not sys.argv[1].endswith((".txt", ".py")):
         print ('\nBad input file extension... exiting.')
         usage()
     else:
index 360b343daa92a2c8875bb827cacedf705fea383e..eae636d351017219fe2e07e90a549f8062e8327b 100644 (file)
@@ -69,6 +69,7 @@ void register_node_type_sh_invert(struct bNodeTreeType *ttype);
 void register_node_type_sh_seprgb(struct bNodeTreeType *ttype);
 void register_node_type_sh_combrgb(struct bNodeTreeType *ttype);
 void register_node_type_sh_hue_sat(struct bNodeTreeType *ttype);
+void register_node_type_sh_tex_brick(struct bNodeTreeType *ttype);
 
 void register_node_type_sh_attribute(struct bNodeTreeType *ttype);
 void register_node_type_sh_geometry(struct bNodeTreeType *ttype);
index 55750ca1bab395e10a26e0128a799480ff5230c0..07db1ce1a1871e2459d31c356ea10563c98946c2 100644 (file)
@@ -606,11 +606,9 @@ static void ntreeCompositExecTreeOld(bNodeTree *ntree, RenderData *rd, int do_pr
        bNode *node;
        ListBase threads;
        ThreadData thdata;
-       int totnode, curnode, rendering= 1, n;
-       bNodeTreeExec *exec= ntree->execdata;
-       
-       if (ntree == NULL) return;
-       
+       int totnode, curnode, rendering = TRUE, n;
+       bNodeTreeExec *exec = ntree->execdata;
+
        if (do_preview)
                ntreeInitPreview(ntree, 0, 0);
        
index aa9d81389da24d3b4c2c26a742eb110cd8c00b87..1c63ab512f254a058ee12864e0cb89dca3b8bf07 100644 (file)
@@ -254,6 +254,15 @@ void BPY_python_start(int argc, const char **argv)
 
        Py_Initialize();
 
+#ifdef WIN32
+       /* this is disappointing, its likely a bug in python?
+        * for some reason 'PYTHONIOENCODING' is ignored in windows
+        * see: [#31555] for details. */
+       PyRun_SimpleString("import sys, io\n"
+                          "sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='surrogateescape', line_buffering=True)\n"
+                          "sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='surrogateescape', line_buffering=True)\n");
+#endif  /* WIN32 */
+
        // PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
        /* sigh, why do python guys not have a (char **) version anymore? */
        {
index 57993874c7a5d08088044eb485c8915353d43950..636b3205b23befa3cba0363ba3c887a882adae37 100644 (file)
@@ -205,17 +205,19 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel
        Render *re = engine->re;
        RenderPart *pa;
 
-       if (!result)
+       if (!result) {
                return;
+       }
 
        /* merge. on break, don't merge in result for preview renders, looks nicer */
        if (!cancel) {
                /* for exr tile render, detect tiles that are done */
                for (pa = re->parts.first; pa; pa = pa->next) {
                        if (result->tilerect.xmin == pa->disprect.xmin &&
-                          result->tilerect.ymin == pa->disprect.ymin &&
-                          result->tilerect.xmax == pa->disprect.xmax &&
-                          result->tilerect.ymax == pa->disprect.ymax) {
+                           result->tilerect.ymin == pa->disprect.ymin &&
+                           result->tilerect.xmax == pa->disprect.xmax &&
+                           result->tilerect.ymax == pa->disprect.ymax)
+                       {
                                pa->ready = 1;
                        }
                }
index 984efdbb563f697d52786b000b2226cc1d7b8eb2..7b0629063a6613d7c02566dd9ac13f1e5098dde7 100644 (file)
@@ -195,14 +195,12 @@ float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype)
 
 RenderLayer *RE_GetRenderLayer(RenderResult *rr, const char *name)
 {
-       RenderLayer *rl;
-       
-       if (rr == NULL) return NULL;
-       
-       for (rl = rr->layers.first; rl; rl = rl->next)
-               if (strncmp(rl->name, name, RE_MAXNAME) == 0)
-                       return rl;
-       return NULL;
+       if (rr == NULL) {
+               return NULL;
+       }
+       else {
+               return BLI_findstring(&rr->layers, name, offsetof(RenderLayer, name));
+       }
 }
 
 RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty)
@@ -1109,7 +1107,10 @@ static void merge_renderresult_fields(RenderResult *rr, RenderResult *rr1, Rende
                /* passes are allocated in sync */
                rpass1 = rl1->passes.first;
                rpass2 = rl2->passes.first;
-               for (rpass = rl->passes.first; rpass && rpass1 && rpass2; rpass = rpass->next, rpass1 = rpass1->next, rpass2 = rpass2->next) {
+               for (rpass = rl->passes.first;
+                    rpass && rpass1 && rpass2;
+                    rpass = rpass->next, rpass1 = rpass1->next, rpass2 = rpass2->next)
+               {
                        interleave_rect(rr, rpass->rect, rpass1->rect, rpass2->rect, rpass->channels);
                }
        }
index 603e49766b1b9903a7591c4a49d215265ab63156..509266bdc33a5f9830c59ab197f455b3ea2f2117 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "MEM_guardedalloc.h"
@@ -554,8 +555,9 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
                        IMB_exr_add_channel(rl->exrhandle, rl->name, "Combined.B", 0, 0, NULL);
                        IMB_exr_add_channel(rl->exrhandle, rl->name, "Combined.A", 0, 0, NULL);
                }
-               else
+               else {
                        rl->rectf = MEM_mapallocN(rectx * recty * sizeof(float) * 4, "Combined rgba");
+               }
                
                /* note, this has to be in sync with scene.c */
                rl->lay = (1 << 20) - 1;
@@ -691,16 +693,18 @@ void render_result_merge(RenderResult *rr, RenderResult *rrpart)
        RenderPass *rpass, *rpassp;
        
        for (rl = rr->layers.first; rl; rl = rl->next) {
-               for (rlp = rrpart->layers.first; rlp; rlp = rlp->next) {
-                       if (strcmp(rlp->name, rl->name) == 0) {
-                               /* combined */
-                               if (rl->rectf && rlp->rectf)
-                                       do_merge_tile(rr, rrpart, rl->rectf, rlp->rectf, 4);
-                               
-                               /* passes are allocated in sync */
-                               for (rpass = rl->passes.first, rpassp = rlp->passes.first; rpass && rpassp; rpass = rpass->next, rpassp = rpassp->next) {
-                                       do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, rpass->channels);
-                               }
+               rlp = RE_GetRenderLayer(rrpart, rl->name);
+               if (rlp) {
+                       /* combined */
+                       if (rl->rectf && rlp->rectf)
+                               do_merge_tile(rr, rrpart, rl->rectf, rlp->rectf, 4);
+
+                       /* passes are allocated in sync */
+                       for (rpass = rl->passes.first, rpassp = rlp->passes.first;
+                            rpass && rpassp;
+                            rpass = rpass->next, rpassp = rpassp->next)
+                       {
+                               do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, rpass->channels);
                        }
                }
        }
@@ -746,21 +750,24 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
                /* combined */
                if (rl->rectf) {
                        int a, xstride = 4;
-                       for (a = 0; a < xstride; a++)
-                               IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(SCE_PASS_COMBINED, a), 
+                       for (a = 0; a < xstride; a++) {
+                               IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(SCE_PASS_COMBINED, a),
                                                    xstride, xstride * rr->rectx, rl->rectf + a);
+                       }
                }
                
                /* passes are allocated in sync */
                for (rpass = rl->passes.first; rpass; rpass = rpass->next) {
                        int a, xstride = rpass->channels;
                        for (a = 0; a < xstride; a++) {
-                               if (rpass->passtype)
-                                       IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(rpass->passtype, a), 
+                               if (rpass->passtype) {
+                                       IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(rpass->passtype, a),
                                                            xstride, xstride * rr->rectx, rpass->rect + a);
-                               else
-                                       IMB_exr_add_channel(exrhandle, rl->name, make_pass_name(rpass, a), 
+                               }
+                               else {
+                                       IMB_exr_add_channel(exrhandle, rl->name, make_pass_name(rpass, a),
                                                            xstride, xstride * rr->rectx, rpass->rect + a);
+                               }
                        }
                }
        }
@@ -818,8 +825,9 @@ void render_result_single_layer_end(Render *re)
                
                /* reconstruct render result layers */
                for (nr = 0, srl = re->scene->r.layers.first; srl; srl = srl->next, nr++) {
-                       if (nr == re->r.actlay)
+                       if (nr == re->r.actlay) {
                                BLI_addtail(&re->result->layers, rl);
+                       }
                        else {
                                rlpush = RE_GetRenderLayer(re->pushedresult, srl->name);
                                if (rlpush) {
@@ -845,10 +853,14 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart)
        BLI_lock_thread(LOCK_IMAGE);
        
        for (rlp = rrpart->layers.first; rlp; rlp = rlp->next) {
-               for (rl = rr->layers.first; rl; rl = rl->next)
-                       if (strcmp(rl->name, rlp->name) == 0)
-                               break;
-               
+               rl = RE_GetRenderLayer(rr, rlp->name);
+
+               /* should never happen but prevents crash if it does */
+               BLI_assert(rl);
+               if (UNLIKELY(rl == NULL)) {
+                       continue;
+               }
+
                if (rrpart->crop) { /* filters add pixel extra */
                        offs = (rrpart->crop + rrpart->crop * rrpart->rectx);
                }
@@ -859,17 +871,19 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart)
                /* combined */
                if (rlp->rectf) {
                        int a, xstride = 4;
-                       for (a = 0; a < xstride; a++)
+                       for (a = 0; a < xstride; a++) {
                                IMB_exr_set_channel(rl->exrhandle, rlp->name, get_pass_name(SCE_PASS_COMBINED, a), 
                                                    xstride, xstride * rrpart->rectx, rlp->rectf + a + xstride * offs);
+                       }
                }
                
                /* passes are allocated in sync */
                for (rpassp = rlp->passes.first; rpassp; rpassp = rpassp->next) {
                        int a, xstride = rpassp->channels;
-                       for (a = 0; a < xstride; a++)
+                       for (a = 0; a < xstride; a++) {
                                IMB_exr_set_channel(rl->exrhandle, rlp->name, get_pass_name(rpassp->passtype, a), 
                                                    xstride, xstride * rrpart->rectx, rpassp->rect + a + xstride * offs);
+                       }
                }
                
        }
@@ -878,10 +892,14 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart)
        partx = rrpart->tilerect.xmin + rrpart->crop;
 
        for (rlp = rrpart->layers.first; rlp; rlp = rlp->next) {
-               for (rl = rr->layers.first; rl; rl = rl->next)
-                       if (strcmp(rl->name, rlp->name) == 0)
-                               break;
-       
+               rl = RE_GetRenderLayer(rr, rlp->name);
+
+               /* should never happen but prevents crash if it does */
+               BLI_assert(rl);
+               if (UNLIKELY(rl == NULL)) {
+                       continue;
+               }
+
                IMB_exrtile_write_channels(rl->exrhandle, partx, party, 0);
        }
 
index 14c178c10f9e6ed9bedb9767c25b7ddb720c53c3..cbe8cc814513b812c5e14ae3646275599e1a614a 100644 (file)
@@ -93,13 +93,9 @@ extern struct Render R;
 
 static void init_render_texture(Render *re, Tex *tex)
 {
-       int cfra= re->scene->r.cfra;
-       
-       if (re) cfra= re->r.cfra;
-       
        /* imap test */
        if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
-               BKE_image_user_frame_calc(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0);
+               BKE_image_user_frame_calc(&tex->iuser, re->r.cfra, re?re->flag & R_SEC_FIELD:0);
        }
        
        else if (tex->type==TEX_ENVMAP) {
index 60c61dbe88c533c794c786269db9e0d475c1e990..dee9d036891ad0e9437cfa3057fd240aa2b530d5 100644 (file)
@@ -1444,14 +1444,15 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
                        
                }
                else {
-                       printf("%s: error - missing modal\n", __func__);
+                       printf("%s: error '%s' missing modal\n", __func__, op->idname);
                }
        }
        else {
                wmOperatorType *ot = WM_operatortype_find(event->keymap_idname, 0);
 
-               if (ot)
+               if (ot) {
                        retval = wm_operator_invoke(C, ot, event, properties, NULL, FALSE);
+               }
        }
        /* Finished and pass through flag as handled */
 
index 67cd202591d743aaddc79eb7eed306587cb40cac..0259146a9d3ca370735601fe4d7e37f55c78bbfa 100644 (file)
@@ -1002,7 +1002,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
        layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, style);
 
        if (!WM_operator_check_ui_enabled(C, op->type->name))
-               uiLayoutSetEnabled(layout, 0);
+               uiLayoutSetEnabled(layout, FALSE);
 
        if (op->type->flag & OPTYPE_MACRO) {
                for (op = op->macro.first; op; op = op->next) {
index d12397ea81d7e7018477670182156ec9d62b3a0d..ccaaeb7c0cdf7b6b60f31bf1c7203646a931ba3f 100644 (file)
@@ -43,7 +43,7 @@ FORCE_PEP8_ALL = False
 def file_list_py(path):
     for dirpath, dirnames, filenames in os.walk(path):
         for filename in filenames:
-            if filename.endswith(".py") or filename.endswith(".cfg"):
+            if filename.endswith((".py", ".cfg")):
                 yield os.path.join(dirpath, filename)