svn merge ^/trunk/blender -r55815:55840
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 6 Apr 2013 13:24:34 +0000 (13:24 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 6 Apr 2013 13:24:34 +0000 (13:24 +0000)
87 files changed:
intern/cycles/blender/blender_session.cpp
intern/cycles/kernel/kernel_camera.h
intern/cycles/kernel/shaders/node_color.h
intern/cycles/kernel/shaders/node_environment_texture.osl
intern/cycles/kernel/shaders/node_image_texture.osl
intern/cycles/kernel/svm/svm_image.h
intern/cycles/render/attribute.cpp
intern/cycles/render/session.cpp
intern/cycles/render/tile.h
intern/cycles/util/util_transform.cpp
intern/cycles/util/util_transform.h
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/intern/CCGSubSurf.c
source/blender/blenkernel/intern/collision.c
source/blender/blenloader/intern/runtime.c
source/blender/blenloader/intern/undofile.c
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/bmesh/intern/bmesh_operator_api.h
source/blender/bmesh/intern/bmesh_operators.c
source/blender/bmesh/intern/bmesh_operators.h
source/blender/bmesh/intern/bmesh_operators_private.h
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/intern/bmesh_polygon.h
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_join_triangles.c
source/blender/bmesh/operators/bmo_poke.c [new file with mode: 0644]
source/blender/compositor/intern/COM_WorkScheduler.cpp
source/blender/editors/armature/reeb.c
source/blender/editors/gpencil/gpencil_undo.c
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/mesh/editmesh_inset.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/render/render_preview.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/space_clip/clip_dopesheet_draw.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_graph_draw.c
source/blender/editors/space_file/file_panels.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_node/node_ops.c
source/blender/editors/transform/transform_constraints.c
source/blender/editors/util/undo.c
source/blender/makesrna/intern/rna_cloth.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_movieclip.c
source/blender/nodes/composite/nodes/node_composite_alphaOver.c
source/blender/nodes/composite/nodes/node_composite_blur.c
source/blender/nodes/composite/nodes/node_composite_colorSpill.c
source/blender/nodes/composite/nodes/node_composite_colorbalance.c
source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
source/blender/nodes/composite/nodes/node_composite_composite.c
source/blender/nodes/composite/nodes/node_composite_curves.c
source/blender/nodes/composite/nodes/node_composite_defocus.c
source/blender/nodes/composite/nodes/node_composite_despeckle.c
source/blender/nodes/composite/nodes/node_composite_dilate.c
source/blender/nodes/composite/nodes/node_composite_displace.c
source/blender/nodes/composite/nodes/node_composite_filter.c
source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
source/blender/nodes/composite/nodes/node_composite_huecorrect.c
source/blender/nodes/composite/nodes/node_composite_invert.c
source/blender/nodes/composite/nodes/node_composite_mixrgb.c
source/blender/nodes/composite/nodes/node_composite_pixelate.c
source/blender/nodes/composite/nodes/node_composite_scale.c
source/blender/nodes/composite/nodes/node_composite_valToRgb.c
source/blender/nodes/shader/nodes/node_shader_curves.c
source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
source/blender/nodes/shader/nodes/node_shader_invert.c
source/blender/nodes/shader/nodes/node_shader_material.c
source/blender/nodes/shader/nodes/node_shader_mixRgb.c
source/blender/nodes/shader/nodes/node_shader_mix_shader.c
source/blender/nodes/shader/nodes/node_shader_output.c
source/blender/nodes/shader/nodes/node_shader_script.c
source/blender/nodes/shader/nodes/node_shader_valToRgb.c
source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
source/blender/nodes/texture/nodes/node_texture_mixRgb.c
source/blender/nodes/texture/nodes/node_texture_valToRgb.c
source/blender/python/bmesh/bmesh_py_ops.c
source/blender/python/bmesh/bmesh_py_types.c
source/blender/python/intern/bpy_library.c
source/blender/windowmanager/intern/wm_draw.c

index acda90f0b8328ea88a4c134d5bbe22a954f55857..1f1bb8307716da7f15976b5854670a01de07c227 100644 (file)
@@ -549,7 +549,7 @@ void BlenderSession::get_progress(float& progress, double& total_time)
        session->progress.get_tile(tile, total_time, tile_time);
 
        sample = session->progress.get_sample();
-       samples_per_tile = session->params.samples;
+       samples_per_tile = session->tile_manager.num_samples;
 
        if(samples_per_tile && tile_total)
                progress = ((float)sample / (float)(tile_total * samples_per_tile));
index 800daf40887d5e5e34ddf84eeadc333a65dbe286..fe31419b11efef449a4cd6ad27b798397977b6ee 100644 (file)
@@ -100,7 +100,6 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
        Transform rastertocamera = kernel_data.cam.rastertocamera;
        float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
 
-       ray->P = Pcamera;
        ray->D = make_float3(0.0f, 0.0f, 1.0f);
 
        /* modify ray for depth of field */
@@ -116,11 +115,12 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 
                /* update ray for effect of lens */
                float3 lensuvw = make_float3(lensuv.x, lensuv.y, 0.0f);
-
-               ray->P += lensuvw;
+               ray->P = Pcamera + lensuvw;
                ray->D = normalize(Pfocus - lensuvw);
        }
-
+       else {
+               ray->P = Pcamera;
+       }
        /* transform ray from camera to world */
        Transform cameratoworld = kernel_data.cam.cameratoworld;
 
index 80786e4e36972d9b2c87908be262ef11c3c3d0e5..c6b5d740f6a08e58571ba86b14665e322a6608ad 100644 (file)
@@ -48,6 +48,14 @@ color color_scene_linear_to_srgb(color c)
                color_scene_linear_to_srgb(c[2]));
 }
 
+color color_unpremultiply(color c, float alpha)
+{
+       if(alpha != 1.0 && alpha != 0.0)
+               return c/alpha;
+
+       return c;
+}
+
 /* Color Operations */
 
 color rgb_to_hsv(color rgb)
index 33b30a27ee175e556d63fd3f208642809d7e19bf..36b2f755c20ba46ea673c7e9c218bc4ab0f0936b 100644 (file)
@@ -66,6 +66,9 @@ shader node_environment_texture(
        /* todo: use environment for better texture filtering of equirectangular */
        Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "alpha", Alpha);
 
+       if (isconnected(Alpha))
+               Color = color_unpremultiply(Color, Alpha);
+
        if (color_space == "sRGB")
                Color = color_srgb_to_scene_linear(Color);
 }
index c94a3f7e76ac5cbe16fbd05ecb18934bfbc84e0f..c7ec8726ae256a21c94a741216f6eed1ac73f961 100644 (file)
 #include "stdosl.h"
 #include "node_color.h"
 
-color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha)
+color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha, int use_alpha)
 {
        color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "alpha", Alpha);
 
+       if (use_alpha)
+               rgb = color_unpremultiply(rgb, Alpha);
+
        if (color_space == "sRGB")
                rgb = color_srgb_to_scene_linear(rgb);
 
@@ -44,9 +47,11 @@ shader node_image_texture(
 
        if (use_mapping)
                p = transform(mapping, p);
+       
+       int use_alpha = isconnected(Alpha);
 
        if (projection == "Flat") {
-               Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha);
+               Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha, use_alpha);
        }
        else if (projection == "Box") {
                /* object space normal */
@@ -111,15 +116,15 @@ shader node_image_texture(
                float tmp_alpha;
 
                if (weight[0] > 0.0) {
-                       Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha);
+                       Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha, use_alpha);
                        Alpha += weight[0] * tmp_alpha;
                }
                if (weight[1] > 0.0) {
-                       Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha);
+                       Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha, use_alpha);
                        Alpha += weight[1] * tmp_alpha;
                }
                if (weight[2] > 0.0) {
-                       Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha);
+                       Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha, use_alpha);
                        Alpha += weight[2] * tmp_alpha;
                }
        }
index 0894c9c8290fdc9373166af04e178cfe50e9013e..b2f203665739a68680042cefa5f03f2e1565b3f4 100644 (file)
@@ -50,7 +50,7 @@ __device_inline float svm_image_texture_frac(float x, int *ix)
        return x - (float)i;
 }
 
-__device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb)
+__device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb, uint use_alpha)
 {
        /* first slots are used by float textures, which are not supported here */
        if(id < TEX_NUM_FLOAT_IMAGES)
@@ -88,6 +88,13 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, u
        r += ty*(1.0f - tx)*svm_image_texture_read(kg, offset + ix + niy*width);
        r += ty*tx*svm_image_texture_read(kg, offset + nix + niy*width);
 
+       if(use_alpha && r.w != 1.0f && r.w != 0.0f) {
+               float invw = 1.0f/r.w;
+               r.x *= invw;
+               r.y *= invw;
+               r.z *= invw;
+       }
+
        if(srgb) {
                r.x = color_srgb_to_scene_linear(r.x);
                r.y = color_srgb_to_scene_linear(r.y);
@@ -99,7 +106,7 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, u
 
 #else
 
-__device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb)
+__device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb, uint use_alpha)
 {
        float4 r;
 
@@ -222,6 +229,13 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, u
        }
 #endif
 
+       if(use_alpha && r.w != 1.0f && r.w != 0.0f) {
+               float invw = 1.0f/r.w;
+               r.x *= invw;
+               r.y *= invw;
+               r.z *= invw;
+       }
+
        if(srgb) {
                r.x = color_srgb_to_scene_linear(r.x);
                r.y = color_srgb_to_scene_linear(r.y);
@@ -241,7 +255,8 @@ __device void svm_node_tex_image(KernelGlobals *kg, ShaderData *sd, float *stack
        decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &srgb);
 
        float3 co = stack_load_float3(stack, co_offset);
-       float4 f = svm_image_texture(kg, id, co.x, co.y, srgb);
+       uint use_alpha = stack_valid(alpha_offset);
+       float4 f = svm_image_texture(kg, id, co.x, co.y, srgb, use_alpha);
 
        if(stack_valid(out_offset))
                stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z));
@@ -322,13 +337,14 @@ __device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float *s
        uint id = node.y;
 
        float4 f = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+       uint use_alpha = stack_valid(alpha_offset);
 
        if(weight.x > 0.0f)
-               f += weight.x*svm_image_texture(kg, id, co.y, co.z, srgb);
+               f += weight.x*svm_image_texture(kg, id, co.y, co.z, srgb, use_alpha);
        if(weight.y > 0.0f)
-               f += weight.y*svm_image_texture(kg, id, co.x, co.z, srgb);
+               f += weight.y*svm_image_texture(kg, id, co.x, co.z, srgb, use_alpha);
        if(weight.z > 0.0f)
-               f += weight.z*svm_image_texture(kg, id, co.y, co.x, srgb);
+               f += weight.z*svm_image_texture(kg, id, co.y, co.x, srgb, use_alpha);
 
        if(stack_valid(out_offset))
                stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z));
@@ -355,7 +371,8 @@ __device void svm_node_tex_environment(KernelGlobals *kg, ShaderData *sd, float
        else
                uv = direction_to_mirrorball(co);
 
-       float4 f = svm_image_texture(kg, id, uv.x, uv.y, srgb);
+       uint use_alpha = stack_valid(alpha_offset);
+       float4 f = svm_image_texture(kg, id, uv.x, uv.y, srgb, use_alpha);
 
        if(stack_valid(out_offset))
                stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z));
index b6f6ba47fe84a8ec6d3cccc839364b7804bd4812..3137ea5327bcd1fdf8ceb297310554addc8d9605 100644 (file)
@@ -72,20 +72,33 @@ size_t Attribute::data_sizeof() const
 
 size_t Attribute::element_size(int numverts, int numtris, int numcurves, int numkeys) const
 {
-       if(element == ATTR_ELEMENT_VALUE)
-               return 1;
-       if(element == ATTR_ELEMENT_VERTEX)
-               return numverts;
-       else if(element == ATTR_ELEMENT_FACE)
-               return numtris;
-       else if(element == ATTR_ELEMENT_CORNER)
-               return numtris*3;
-       else if(element == ATTR_ELEMENT_CURVE)
-               return numcurves;
-       else if(element == ATTR_ELEMENT_CURVE_KEY)
-               return numkeys;
+       size_t size;
        
-       return 0;
+       switch(element) {
+               case ATTR_ELEMENT_VALUE:
+                       size = 1;
+                       break;
+               case ATTR_ELEMENT_VERTEX:
+                       size = numverts;
+                       break;
+               case ATTR_ELEMENT_FACE:
+                       size = numtris;
+                       break;
+               case ATTR_ELEMENT_CORNER:
+                       size = numtris*3;
+                       break;
+               case ATTR_ELEMENT_CURVE:
+                       size = numcurves;
+                       break;
+               case ATTR_ELEMENT_CURVE_KEY:
+                       size = numkeys;
+                       break;
+               default:
+                       size = 0;
+                       break;
+       }
+       
+       return size;
 }
 
 size_t Attribute::buffer_size(int numverts, int numtris, int numcurves, int numkeys) const
@@ -214,44 +227,66 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
                name = Attribute::standard_name(std);
 
        if(triangle_mesh) {
-               if(std == ATTR_STD_VERTEX_NORMAL)
-                       attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX);
-               else if(std == ATTR_STD_FACE_NORMAL)
-                       attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_FACE);
-               else if(std == ATTR_STD_UV)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
-               else if(std == ATTR_STD_UV_TANGENT)
-                       attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CORNER);
-               else if(std == ATTR_STD_UV_TANGENT_SIGN)
-                       attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CORNER);
-               else if(std == ATTR_STD_GENERATED)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
-               else if(std == ATTR_STD_POSITION_UNDEFORMED)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
-               else if(std == ATTR_STD_POSITION_UNDISPLACED)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
-               else if(std == ATTR_STD_MOTION_PRE)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
-               else if(std == ATTR_STD_MOTION_POST)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
-               else
-                       assert(0);
+               switch(std) {
+                       case ATTR_STD_VERTEX_NORMAL:
+                               attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX);
+                               break;
+                       case ATTR_STD_FACE_NORMAL:
+                               attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_FACE);
+                               break;
+                       case ATTR_STD_UV:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
+                               break;
+                       case ATTR_STD_UV_TANGENT:
+                               attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CORNER);
+                               break;
+                       case ATTR_STD_UV_TANGENT_SIGN:
+                               attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CORNER);
+                               break;
+                       case ATTR_STD_GENERATED:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
+                               break;
+                       case ATTR_STD_POSITION_UNDEFORMED:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
+                               break;
+                       case ATTR_STD_POSITION_UNDISPLACED:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
+                               break;
+                       case ATTR_STD_MOTION_PRE:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
+                               break;
+                       case ATTR_STD_MOTION_POST:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
+                               break;
+                       default:
+                               assert(0);
+                               break;
+               }
        }
        else if(curve_mesh) {
-               if(std == ATTR_STD_UV)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
-               else if(std == ATTR_STD_GENERATED)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
-               else if(std == ATTR_STD_MOTION_PRE)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY);
-               else if(std == ATTR_STD_MOTION_POST)
-                       attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY);
-               else if(std == ATTR_STD_CURVE_TANGENT)
-                       attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CURVE_KEY);
-               else if(std == ATTR_STD_CURVE_INTERCEPT)
-                       attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE_KEY);
-               else
-                       assert(0);
+               switch(std) {
+                       case ATTR_STD_UV:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
+                               break;
+                       case ATTR_STD_GENERATED:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
+                               break;
+                       case ATTR_STD_MOTION_PRE:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY);
+                               break;
+                       case ATTR_STD_MOTION_POST:
+                               attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY);
+                               break;
+                       case ATTR_STD_CURVE_TANGENT:
+                               attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CURVE_KEY);
+                               break;
+                       case ATTR_STD_CURVE_INTERCEPT:
+                               attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE_KEY);
+                               break;
+                       default:
+                               assert(0);
+                               break;
+               }
        }
 
        attr->std = std;
index 6ed14452c6b1c987a381e49eb93deeb02d4c4efc..075f5eb6bab7a6c1b3a0f0e44104193a6b55894f 100644 (file)
@@ -758,7 +758,7 @@ void Session::update_status_time(bool show_pause, bool show_done)
                         * also display the info on CPU, when using 1 tile only
                         */
 
-                       int sample = progress.get_sample(), num_samples = tile_manager.state.num_samples;
+                       int sample = progress.get_sample(), num_samples = tile_manager.num_samples;
 
                        if(tile > 1) {
                                /* sample counter is global for all tiles, subtract samples
@@ -771,10 +771,10 @@ void Session::update_status_time(bool show_pause, bool show_done)
                        substatus += string_printf(", Sample %d/%d", sample, num_samples);
                }
        }
-       else if(params.samples == INT_MAX)
+       else if(tile_manager.num_samples == INT_MAX)
                substatus = string_printf("Path Tracing Sample %d", sample+1);
        else
-               substatus = string_printf("Path Tracing Sample %d/%d", sample+1, params.samples);
+               substatus = string_printf("Path Tracing Sample %d/%d", sample+1, tile_manager.num_samples);
        
        if(show_pause)
                status = "Paused";
@@ -846,7 +846,7 @@ void Session::tonemap()
 bool Session::update_progressive_refine(bool cancel)
 {
        int sample = tile_manager.state.sample + 1;
-       bool write = sample == params.samples || cancel;
+       bool write = sample == tile_manager.num_samples || cancel;
 
        double current_time = time_dt();
 
index 99cffb49c08bace148859d8a1b1e7a42ec92468f..0e9e5a73a422bceb073cc1c8d4a0895da77edf67 100644 (file)
@@ -58,6 +58,8 @@ public:
                list<Tile> tiles;
        } state;
 
+       int num_samples;
+
        TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution,
                    bool preserve_tile_device, bool background, int tile_order, int num_devices = 1);
        ~TileManager();
@@ -82,7 +84,6 @@ protected:
        void set_tiles();
 
        bool progressive;
-       int num_samples;
        int2 tile_size;
        int tile_order;
        int start_resolution;
index ca19146e1252a3fe35045a8a140cb040e5fbf857..f5e0c8e803e5d37db0a564301c67dfa89f24fdb5 100644 (file)
@@ -155,7 +155,7 @@ Transform transform_inverse(const Transform& tfm)
 
 /* Motion Transform */
 
-static float4 transform_to_quat(const Transform& tfm)
+float4 transform_to_quat(const Transform& tfm)
 {
        double trace = tfm[0][0] + tfm[1][1] + tfm[2][2];
        float4 qt;
index 1f19f85f894686381a168bfc8af14db95936b08d..617ba43a5ed81bc1744173c35d87fceac48577ce 100644 (file)
@@ -454,6 +454,7 @@ __device_inline bool operator==(const MotionTransform& A, const MotionTransform&
        return (A.pre == B.pre && A.post == B.post);
 }
 
+float4 transform_to_quat(const Transform& tfm);
 void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTransform *motion, const Transform *mid);
 
 #endif
index f3d113c3ae4a51e58ff542d8021a5fd0f9f09a8c..be601d0b6a17736e83db0c070010dc789bf326af 100644 (file)
@@ -1641,6 +1641,12 @@ class VIEW3D_MT_pose_specials(Menu):
 
     def draw(self, context):
         layout = self.layout
+        
+        layout.operator("paint.weight_from_bones", text="Assign Automatic from Bones").type="AUTOMATIC"
+        layout.operator("paint.weight_from_bones", text="Assign from Bone Envelopes").type="ENVELOPES"
+        
+        layout.separator()
+        
         layout.operator("pose.select_constraint_target")
         layout.operator("pose.flip_names")
         layout.operator("pose.paths_calculate")
@@ -1958,6 +1964,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
 
         layout.separator()
 
+        layout.operator("mesh.poke")
         layout.operator("mesh.quads_convert_to_tris")
         layout.operator("mesh.tris_convert_to_quads")
 
index e58d484b0c0165d2cc60ce4fad316832d57510a9..292d74b03d71440263dd57a43e503943193de3c2 100644 (file)
@@ -7,15 +7,15 @@
 #include <string.h>
 #include <math.h>
 
-#include "BKE_ccg.h"
-#include "CCGSubSurf.h"
-#include "BKE_subsurf.h"
-
 #include "MEM_guardedalloc.h"
 #include "BLO_sys_types.h" // for intptr_t support
 
 #include "BLI_utildefines.h" /* for BLI_assert */
 
+#include "BKE_ccg.h"
+#include "CCGSubSurf.h"
+#include "BKE_subsurf.h"
+
 /* used for normalize_v3 in BLI_math_vector
  * float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */
 #define EPSILON (1.0e-35f)
index ed72a0fb37b59be6eeadaa0d0ef5b00102bcc1a1..4bfe3b1c0bd185d6d3b89044d43de03d60c4d4c3 100644 (file)
@@ -32,8 +32,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_cloth.h"
-
 #include "DNA_cloth_types.h"
 #include "DNA_group_types.h"
 #include "DNA_mesh_types.h"
 #include "BLI_rand.h"
 
 #include "BKE_DerivedMesh.h"
+#include "BKE_cloth.h"
 #include "BKE_global.h"
-#include "BKE_scene.h"
 #include "BKE_mesh.h"
-#include "BKE_object.h"
 #include "BKE_modifier.h"
+#include "BKE_object.h"
+#include "BKE_scene.h"
 
 #include "BKE_DerivedMesh.h"
 #ifdef WITH_BULLET
index cbbaf713e84f5ae4380eba054df04e3712933950..d6fd2f924439e9c74932a044b2db5eb4d4cc279f 100644 (file)
 #  include <unistd.h>       // read
 #endif
 
-#include "BLO_readfile.h"
-#include "BLO_runtime.h"
-
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
+#include "BLO_readfile.h"
+#include "BLO_runtime.h"
+
 #include "BKE_blender.h"
 #include "BKE_report.h"
 
index 38fd6e9d32d9b7f172cb395d5bb92a1d85c47496..2b63d13a9dd9bec5da2e34c28a9b4f7296c05ce2 100644 (file)
@@ -30,7 +30,6 @@
  *  \ingroup blenloader
  */
 
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 
 #include "DNA_listBase.h"
 
-
-#include "BLO_undofile.h"
-
 #include "BLI_blenlib.h"
 #include "BLI_linklist.h"
 
-
+#include "BLO_undofile.h"
 
 /* **************** support for memory-write, for undo buffers *************** */
 
index fcf804c8f4f5931cc78d93af0cc152a69812e3cc..472f7d2d8f02428188bd3b8f8e1876955b36b942 100644 (file)
@@ -54,6 +54,7 @@ set(SRC
        operators/bmo_join_triangles.c
        operators/bmo_mesh_conv.c
        operators/bmo_mirror.c
+       operators/bmo_poke.c
        operators/bmo_primitive.c
        operators/bmo_removedoubles.c
        operators/bmo_similar.c
index d0ab0ea5d602b9b7ba9eaf6a5fc71261173befb0..6edbae0831e84e2b833810d44c7c00cdcc803542 100644 (file)
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 
-#include "BKE_customdata.h"
-#include "BKE_multires.h"
-
 #include "BLI_array.h"
 #include "BLI_math.h"
 
+#include "BKE_customdata.h"
+#include "BKE_multires.h"
+
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
 
index 7583332c4db340bac6db872aba696bb644983082..a84958f682743470a1bab9d63933b478a38b2384 100644 (file)
@@ -1500,12 +1500,34 @@ static BMOpDefine bmo_solidify_def = {
 };
 
 /*
- * Face Inset.
+ * Face Inset (Individual).
  *
- * Inset or outset faces.
+ * Insets individual faces.
  */
-static BMOpDefine bmo_inset_def = {
-       "inset",
+static BMOpDefine bmo_inset_individual_def = {
+       "inset_individual",
+       /* slots_in */
+       {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
+        {"thickness", BMO_OP_SLOT_FLT},
+        {"depth", BMO_OP_SLOT_FLT},
+        {"use_even_offset", BMO_OP_SLOT_BOOL},
+        {{'\0'}},
+       },
+       /* slots_out */
+       {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
+        {{'\0'}},
+       },
+       bmo_inset_individual_exec,
+       0
+};
+
+/*
+ * Face Inset (Regions).
+ *
+ * Inset or outset face regions.
+ */
+static BMOpDefine bmo_inset_region_def = {
+       "inset_region",
        /* slots_in */
        {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},    /* input faces */
         {"use_boundary", BMO_OP_SLOT_BOOL},
@@ -1520,7 +1542,7 @@ static BMOpDefine bmo_inset_def = {
        {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
         {{'\0'}},
        },
-       bmo_inset_exec,
+       bmo_inset_region_exec,
        0
 };
 
@@ -1549,6 +1571,29 @@ static BMOpDefine bmo_wireframe_def = {
        0
 };
 
+/*
+ * Pokes a face.
+ *
+ * Splits a face into a triangle fan.
+ */
+static BMOpDefine bmo_poke_def = {
+       "poke",
+       /* slots_in */
+       {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},   /* input faces */
+        {"offset", BMO_OP_SLOT_FLT}, /* center vertex offset along normal */
+        {"center_mode", BMO_OP_SLOT_INT}, /* calculation mode for center vertex */
+        {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* apply offset */
+        {{'\0'}},
+       },
+       /* slots_out */
+       {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
+        {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
+        {{'\0'}},
+       },
+       bmo_poke_exec,
+       0
+};
+
 #ifdef WITH_BULLET
 /*
  * Convex Hull
@@ -1647,13 +1692,15 @@ const BMOpDefine *bmo_opdefines[] = {
        &bmo_extrude_face_region_def,
        &bmo_extrude_vert_indiv_def,
        &bmo_find_doubles_def,
-       &bmo_inset_def,
+       &bmo_inset_individual_def,
+       &bmo_inset_region_def,
        &bmo_join_triangles_def,
        &bmo_mesh_to_bmesh_def,
        &bmo_mirror_def,
        &bmo_object_load_bmesh_def,
        &bmo_pointmerge_def,
        &bmo_pointmerge_facedata_def,
+       &bmo_poke_def,
        &bmo_recalc_face_normals_def,
        &bmo_region_extend_def,
        &bmo_remove_doubles_def,
index 180bc53c2e3916c2012bd020221bca287a5184da..c72accbc605e935a855a7afe7611db454d1a60c2 100644 (file)
@@ -482,6 +482,8 @@ typedef struct BMOElemMapping {
 
 extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES];
 
+int BMO_opcode_from_opname(const char *opname);
+
 #ifdef __cplusplus
 }
 #endif
index a358623834f12d37371164ee28d65f17d6ac8f0f..1d20f94c51ccd7110c07612c212a73b0d6225807 100644 (file)
@@ -47,7 +47,6 @@ static void bmo_flag_layer_free(BMesh *bm);
 static void bmo_flag_layer_clear(BMesh *bm);
 static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
 static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
-static int bmo_opname_to_opcode(const char *opname);
 
 static const char *bmo_error_messages[] = {
        NULL,
@@ -145,7 +144,7 @@ static void bmo_op_slots_init(const BMOSlotType *slot_types, BMOpSlot *slot_args
  */
 void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
 {
-       int opcode = bmo_opname_to_opcode(opname);
+       int opcode = BMO_opcode_from_opname(opname);
 
 #ifdef DEBUG
        BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname);
@@ -1522,20 +1521,27 @@ static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], cons
        return i;
 }
 
-static int bmo_opname_to_opcode(const char *opname)
+int BMO_opcode_from_opname(const char *opname)
 {
-       int i;
 
-       for (i = 0; i < bmo_opdefines_total; i++) {
-               if (STREQ(opname, bmo_opdefines[i]->opname)) {
+       const unsigned int tot = bmo_opdefines_total;
+       unsigned int i;
+       for (i = 0; i < tot; i++) {
+               if (STREQ(bmo_opdefines[i]->opname, opname)) {
                        return i;
                }
        }
-
-       fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
        return -1;
 }
 
+static int BMO_opcode_from_opname_check(const char *opname)
+{
+       int i = BMO_opcode_from_opname(opname);
+       if (i == -1)
+               fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
+       return i;
+}
+
 /**
  * \brief Format Strings for #BMOperator Initialization.
  *
@@ -1628,10 +1634,11 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
 
        fmt += i + (noslot ? 0 : 1);
        
-       i = bmo_opname_to_opcode(opname);
+       i = BMO_opcode_from_opname_check(opname);
 
        if (i == -1) {
                MEM_freeN(ofmt);
+               BLI_assert(0);
                return false;
        }
 
index 16b38c340fff46fdb4651c96799f1aa844087814..ff0fc285dc341acaffca0a18413deaa247022010 100644 (file)
@@ -95,6 +95,13 @@ enum {
        VPATH_SELECT_TOPOLOGICAL
 };
 
+/* Poke face center calculation */
+enum {
+       BMOP_POKE_MEAN_WEIGHTED = 0,
+       BMOP_POKE_MEAN,
+       BMOP_POKE_BOUNDS
+};
+
 extern const BMOpDefine *bmo_opdefines[];
 extern const int         bmo_opdefines_total;
 
index 79e688bd5ffaf8e786b26d4216e1c5729ca185d2..2a67407b261003513ad896073e0786e495ad15c7 100644 (file)
@@ -65,7 +65,8 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op);
 void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op);
 void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op);
 void bmo_find_doubles_exec(BMesh *bm, BMOperator *op);
-void bmo_inset_exec(BMesh *bm, BMOperator *op);
+void bmo_inset_individual_exec(BMesh *bm, BMOperator *op);
+void bmo_inset_region_exec(BMesh *bm, BMOperator *op);
 void bmo_join_triangles_exec(BMesh *bm, BMOperator *op);
 void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op);
 void bmo_mirror_exec(BMesh *bm, BMOperator *op);
@@ -73,6 +74,7 @@ void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op);
 void bmo_pointmerge_exec(BMesh *bm, BMOperator *op);
 void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op);
 void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op);
+void bmo_poke_exec(BMesh *bm, BMOperator *op);
 void bmo_region_extend_exec(BMesh *bm, BMOperator *op);
 void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op);
 void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op);
index d235aaaa622a930897acb98115daa7611e65fde0..525dd5b1f9c543b71a6b2b21c230ca7c057be692 100644 (file)
@@ -336,6 +336,34 @@ void BM_face_calc_center_mean(BMFace *f, float r_cent[3])
                mul_v3_fl(r_cent, 1.0f / (float) f->len);
 }
 
+/**
+ * computes the center of a face, using the mean average
+ * weighted by edge length
+ */
+void BM_face_calc_center_mean_weighted(BMFace *f, float r_cent[3])
+{
+       BMLoop *l_iter;
+       BMLoop *l_first;
+       float totw = 0.0f;
+       float w_prev;
+
+       zero_v3(r_cent);
+
+
+       l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+       w_prev = BM_edge_calc_length(l_iter->prev->e);
+       do {
+               const float w_curr = BM_edge_calc_length(l_iter->e);
+               const float w = (w_curr + w_prev);
+               madd_v3_v3fl(r_cent, l_iter->v->co, w);
+               totw += w;
+               w_prev = w_curr;
+       } while ((l_iter = l_iter->next) != l_first);
+
+       if (totw != 0.0f)
+               mul_v3_fl(r_cent, 1.0f / (float) totw);
+}
+
 /**
  * COMPUTE POLY PLANE
  *
index c439a41f6720b0150c879dba012016cc798aad8e..d857ba77fe7c35c9a45779074ac523d1e0835167 100644 (file)
@@ -37,6 +37,7 @@ float BM_face_calc_area(BMFace *f);
 float BM_face_calc_perimeter(BMFace *f);
 void  BM_face_calc_center_bounds(BMFace *f, float center[3]);
 void  BM_face_calc_center_mean(BMFace *f, float center[3]);
+void  BM_face_calc_center_mean_weighted(BMFace *f, float center[3]);
 
 void  BM_face_normal_update(BMFace *f);
 void  BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],
index a3656ce5b745e714d4cce1b3a23942e017d64233..d8ed511bc9483c8643c7f5f1a1176cf41157daae 100644 (file)
  *  \ingroup bmesh
  *
  * Inset face regions.
+ * Inset individual faces.
  *
- * TODO
- * - Inset indervidual faces.
  */
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_math.h"
+#include "BLI_array.h"
 
 #include "bmesh.h"
 
 
 #define ELE_NEW                1
 
+
+
+/* -------------------------------------------------------------------- */
+/* Inset Individual */
+
+
+/* Holds Per-Face Inset Edge Data */
+typedef struct EdgeInsetInfo {
+       float no[3];
+       BMEdge *e_old;
+       BMEdge *e_new;
+} EdgeInsetInfo;
+
+/**
+ * Individual Face Inset.
+ * Find all tagged faces (f), duplicate edges around faces, inset verts of
+ * created edges, create new faces between old and new edges, fill face
+ * between connected new edges, kill old face (f).
+ */
+void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
+{
+       BMEdge **f_edges = NULL;
+       BMVert **f_verts = NULL;
+       BMFace *f;
+
+       BMOIter oiter;
+       EdgeInsetInfo *eiinfo_arr = NULL;
+
+       BLI_array_declare(eiinfo_arr);
+       BLI_array_declare(f_edges);
+       BLI_array_declare(f_verts);
+
+       const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
+       const float depth = BMO_slot_float_get(op->slots_in, "depth");
+       const bool use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
+
+       /* Only tag faces in slot */
+       BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false);
+
+       BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
+
+       BMO_ITER(f, &oiter, op->slots_in, "faces", BM_FACE) {
+               BMLoop *l_iter, *l_first;
+               BMLoop *l_iter_inner = NULL;
+               int i;
+
+               BLI_array_empty(f_verts);
+               BLI_array_empty(f_edges);
+               BLI_array_empty(eiinfo_arr);
+               BLI_array_grow_items(f_verts, f->len);
+               BLI_array_grow_items(f_edges, f->len);
+               BLI_array_grow_items(eiinfo_arr, f->len);
+
+               /* create verts */
+               i = 0;
+               l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+               do {
+                       f_verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v, 0);
+                       i++;
+               } while ((l_iter = l_iter->next) != l_first);
+
+               /* make edges */
+               i = 0;
+               l_iter = l_first;
+               do {
+                       f_edges[i] = BM_edge_create(bm, f_verts[i], f_verts[(i + 1) % f->len], l_iter->e, 0);
+
+                       eiinfo_arr[i].e_new = f_edges[i];
+                       eiinfo_arr[i].e_old = l_iter->e;
+                       BM_edge_calc_face_tangent(l_iter->e, l_iter, eiinfo_arr[i].no);
+
+                       /* Tagging (old elements) required when iterating over edges
+                        * connected to verts for translation vector calculation */
+                       BM_elem_flag_enable(l_iter->e, BM_ELEM_TAG);
+                       BM_elem_index_set(l_iter->e, i);  /* set_dirty! */
+                       i++;
+               } while ((l_iter = l_iter->next) != l_first);
+               /* done with edges */
+
+               bm->elem_index_dirty |= BM_EDGE;
+
+               /* Calculate translation vector for new  */
+               l_iter = l_first;
+               do {
+                       EdgeInsetInfo *ei_prev = &eiinfo_arr[BM_elem_index_get(l_iter->prev->e)];
+                       EdgeInsetInfo *ei_next = &eiinfo_arr[BM_elem_index_get(l_iter->e)];
+                       float tvec[3];
+                       float v_new_co[3];
+                       int index = 0;
+
+                       add_v3_v3v3(tvec, ei_prev->no, ei_next->no);
+                       normalize_v3(tvec);
+
+                       /* l->e is traversed in order */
+                       index = BM_elem_index_get(l_iter->e);
+
+                       copy_v3_v3(v_new_co, eiinfo_arr[index].e_new->v1->co);
+
+                       if (use_even_offset) {
+                               mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(ei_prev->no,  ei_next->no) / 2.0f));
+                       }
+
+                       /* Modify vertices and their normals */
+                       madd_v3_v3fl(v_new_co, tvec, thickness);
+
+                       /* Set normal, add depth and write new vertex position*/
+                       copy_v3_v3(eiinfo_arr[index].e_new->v1->no, f->no);
+
+                       madd_v3_v3fl(v_new_co, f->no, depth);
+
+                       copy_v3_v3(eiinfo_arr[index].e_new->v1->co, v_new_co);
+               } while ((l_iter = l_iter->next) != l_first);
+
+               {
+                       BMFace *f_new_inner;
+                       /* Create New Inset Faces */
+                       f_new_inner = BM_face_create(bm, f_verts, f_edges, f->len, 0);
+                       if (UNLIKELY(f_new_inner == NULL)) {
+                               BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Inset failed: could not create inner face.");
+                               BLI_array_free(f_edges);
+                               BLI_array_free(f_verts);
+                               BLI_array_free(eiinfo_arr);
+                               return;
+                       }
+
+                       /* Copy Face Data */
+                       BM_elem_attrs_copy(bm, bm, f, f_new_inner);
+                       // Don't tag, gives more useful inner/outer select option
+                       // BMO_elem_flag_enable(bm, f_new_inner, ELE_NEW);
+
+                       l_iter_inner = BM_FACE_FIRST_LOOP(f_new_inner);
+               }
+
+               l_iter = l_first;
+               do {
+                       BMFace *f_new_outer;
+
+                       BMLoop *l_iter_sub;
+                       BMLoop *l_a = NULL;
+                       BMLoop *l_b = NULL;
+                       BMLoop *l_a_other = NULL;
+                       BMLoop *l_b_other = NULL;
+                       BMLoop *l_shared = NULL;
+
+                       BM_elem_attrs_copy(bm, bm, l_iter, l_iter_inner);
+
+                       f_new_outer = BM_face_create_quad_tri(bm,
+                                                             l_iter->v,
+                                                             l_iter->next->v,
+                                                             l_iter_inner->next->v,
+                                                             l_iter_inner->v,
+                                                             f, false);
+
+                       if (UNLIKELY(f_new_outer == NULL)) {
+                               BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Inset failed: could not create an outer face.");
+                               BLI_array_free(f_edges);
+                               BLI_array_free(f_verts);
+                               BLI_array_free(eiinfo_arr);
+                               return;
+                       }
+
+                       BM_elem_attrs_copy(bm, bm, f, f_new_outer);
+                       BMO_elem_flag_enable(bm, f_new_outer, ELE_NEW);
+                       BM_elem_flag_enable(f_new_outer, BM_ELEM_TAG);
+
+                       /* Copy Loop Data */
+                       l_a = BM_FACE_FIRST_LOOP(f_new_outer);
+                       l_b = l_a->next;
+
+                       l_iter_sub = l_iter;
+
+                       /* Skip old face f and new inset face.
+                        * If loop if found we are a boundary. This
+                        * is required as opposed to BM_edge_is_boundary()
+                        * Because f_new_outer shares an edge with f */
+                       do {
+                               if (l_iter_sub->f != f && l_iter_sub->f != f_new_outer) {
+                                       l_shared = l_iter_sub;
+                                       break;
+                               }
+                       } while ((l_iter_sub = l_iter_sub->radial_next) != l_iter);
+
+                       if (l_shared) {
+                               BM_elem_attrs_copy(bm, bm, l_shared, l_a->next);
+                               BM_elem_attrs_copy(bm, bm, l_shared->next, l_a);
+                       }
+                       else {
+                               l_a_other = BM_edge_other_loop(l_a->e, l_a);
+                               l_b_other = l_a_other->next;
+                               BM_elem_attrs_copy(bm, bm, l_a_other, l_a);
+                               BM_elem_attrs_copy(bm, bm, l_b_other, l_b);
+                       }
+
+                       /* Move to the last two loops in new face */
+                       l_a = l_b->next;
+                       l_b = l_a->next;
+
+                       /* This loop should always have >1 radials
+                        * (associated edge connects new and old face) */
+                       BM_elem_attrs_copy(bm, bm, l_iter, l_b);
+                       BM_elem_attrs_copy(bm, bm, l_iter->next, l_a);
+
+               } while ((l_iter_inner = l_iter_inner->next),
+                        (l_iter = l_iter->next) != l_first);
+
+               BM_face_kill(bm, f);
+       }
+
+       /* we could flag new edges/verts too, is it useful? */
+       BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW);
+
+       BLI_array_free(f_verts);
+       BLI_array_free(f_edges);
+       BLI_array_free(eiinfo_arr);
+}
+
+
+
+/* -------------------------------------------------------------------- */
+/* Inset Region */
+
 typedef struct SplitEdgeInfo {
        float   no[3];
        float   length;
@@ -95,7 +316,7 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
  * - inset the new edges into their faces.
  */
 
-void bmo_inset_exec(BMesh *bm, BMOperator *op)
+void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
 {
        const bool use_outset          = BMO_slot_bool_get(op->slots_in, "use_outset");
        const bool use_boundary        = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == false);
index 5e4fa29d9539b931c7713dbdb43e490ab9957435..edbb19afc629d85971fec7aa6534656b1df24b97 100644 (file)
 
 #include "DNA_meshdata_types.h"
 
-#include "BKE_customdata.h"
-
 #include "BLI_math.h"
 #include "BLI_array.h"
 
+#include "BKE_customdata.h"
+
 #include "bmesh.h"
 
 #include "intern/bmesh_operators_private.h" /* own include */
diff --git a/source/blender/bmesh/operators/bmo_poke.c b/source/blender/bmesh/operators/bmo_poke.c
new file mode 100644 (file)
index 0000000..7105210
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * ***** 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): Francisco De La Cruz
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_poke.c
+ *  \ingroup bmesh
+ *
+ * Pokes a face.
+ *
+ * Splits a face into a triangle fan.
+ */
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define ELE_NEW 1
+
+/**
+ * Pokes a face
+ *
+ * Splits a face into a triangle fan.
+ * Iterate over all selected faces, create a new center vertex and
+ * create triangles between original face edges and new center vertex.
+ */
+void bmo_poke_exec(BMesh *bm, BMOperator *op)
+{
+       BMOIter oiter;
+       BMFace *f;
+
+       const float offset = BMO_slot_float_get(op->slots_in, "offset");
+       const bool use_relative_offset = BMO_slot_bool_get(op->slots_in,  "use_relative_offset");
+       const int center_mode = BMO_slot_int_get(op->slots_in, "center_mode");
+       void (*bm_face_calc_center_fn)(BMFace *f, float r_cent[3]);
+
+       switch (center_mode) {
+               case BMOP_POKE_MEAN_WEIGHTED:
+                       bm_face_calc_center_fn = BM_face_calc_center_mean_weighted;
+                       break;
+               case BMOP_POKE_BOUNDS:
+                       bm_face_calc_center_fn = BM_face_calc_center_bounds;
+                       break;
+               case BMOP_POKE_MEAN:
+                       bm_face_calc_center_fn = BM_face_calc_center_mean;
+                       break;
+               default:
+                       BLI_assert(0);
+                       break;
+       }
+
+       BMO_ITER(f, &oiter, op->slots_in, "faces", BM_FACE) {
+               BMFace *f_new;
+               float f_center[3];
+               BMVert *v_center = NULL;
+               BMLoop *l_iter, *l_first;
+               /* only interpolate the centeral loop from the face once,
+                * then copy to all others in the fan */
+               BMLoop *l_center_example;
+
+               /* 1.0 or the average length from the center to the face verts */
+               float offset_fac;
+
+               int i;
+
+               bm_face_calc_center_fn(f, f_center);
+               v_center = BM_vert_create(bm, f_center, NULL, 0);
+               BMO_elem_flag_enable(bm, v_center, ELE_NEW);
+
+               /* handled by BM_loop_interp_from_face */
+               // BM_vert_interp_from_face(bm, v_center, f);
+
+               if (use_relative_offset) {
+                       offset_fac = 0.0f;
+               }
+               else {
+                       offset_fac = 1.0f;
+               }
+
+               i = 0;
+               l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+               do {
+                       BMLoop *l_new;
+
+                       f_new = BM_face_create_quad_tri(bm, l_iter->v, l_iter->next->v, v_center, NULL, f, false);
+                       l_new = BM_FACE_FIRST_LOOP(f_new);
+
+                       if (i == 0) {
+                               l_center_example = l_new->prev;
+                               BM_loop_interp_from_face(bm, l_center_example, f, true, true);
+                       }
+                       else {
+                               BM_elem_attrs_copy(bm, bm, l_center_example, l_new->prev);
+                       }
+
+                       /* Copy Loop Data */
+                       BM_elem_attrs_copy(bm, bm, l_iter, l_new);
+                       BM_elem_attrs_copy(bm, bm, l_iter->next, l_new->next);
+
+                       BMO_elem_flag_enable(bm, f_new, ELE_NEW);
+
+                       if (use_relative_offset) {
+                               offset_fac += len_v3v3(f_center, l_iter->v->co);
+                       }
+
+               } while (i++, (l_iter = l_iter->next) != l_first);
+
+               if (use_relative_offset) {
+                       offset_fac /= (float)f->len;
+               }
+               /* else remain at 1.0 */
+
+               copy_v3_v3(v_center->no, f->no);
+               madd_v3_v3fl(v_center->co, v_center->no, offset * offset_fac);
+
+               /* Kill Face */
+               BM_face_kill(bm, f);
+       }
+
+       BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, ELE_NEW);
+       BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW);
+}
index 724abb59bcf83c87b6a5023efcf98e56cea92b91..402fa28e210c856a1eced34cd09a1cae322dae74 100644 (file)
@@ -23,8 +23,6 @@
 #include <list>
 #include <stdio.h>
 
-#include "BKE_global.h"
-
 #include "COM_compositor.h"
 #include "COM_WorkScheduler.h"
 #include "COM_CPUDevice.h"
@@ -38,6 +36,8 @@
 #include "PIL_time.h"
 #include "BLI_threads.h"
 
+#include "BKE_global.h"
+
 #if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
 #  ifndef DEBUG  /* test this so we dont get warnings in debug builds */
 #    warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only for debugging.
index 649ef90f7baed2f453cd1f818b70ea21b1258241..665c5f628d9178599f1e73c1e82d57073ce05d0a 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_context.h"
-
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
 #include "BLI_ghash.h"
 
+#include "BKE_context.h"
+
 #include "reeb.h"
 
 #if 0 /* UNUSED 2.5 */
index 3d2cd260fb99e0e4e636a2c3f1fabf9509355a57..7edf723022ff43f1240e18af69863de56b1a9365 100644 (file)
 #include "DNA_listBase.h"
 #include "DNA_windowmanager_types.h"
 
+#include "BLI_listbase.h"
+
 #include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_gpencil.h"
 
-#include "BLI_listbase.h"
-
 #include "ED_gpencil.h"
 
 #include "WM_api.h"
index 63741ee08ba15b2ba213f28c0f0c01b3961a1492..3d04675348f555e716bb49efb425bac41dafb277 100644 (file)
@@ -311,4 +311,4 @@ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, i
 
 void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
 
-#endif /*  UI_RESOURCES_H */
+#endif  /* __UI_RESOURCES_H__ */
index c40d91378b1ecf660d24609728397e13c89474d9..16f3cb9c7c234814527e1cafbf372c87f5301067 100644 (file)
@@ -2233,6 +2233,17 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
                                retval = WM_UI_HANDLER_BREAK;
                                break;
                                
+                       case AKEY:
+                               /* Ctrl + A: Select all */
+                               if (event->ctrl && !(event->alt || event->shift || event->oskey)) {
+                                       ui_textedit_move(but, data, STRCUR_DIR_PREV,
+                                                        false, STRCUR_JUMP_ALL);
+                                       ui_textedit_move(but, data, STRCUR_DIR_NEXT,
+                                                        true, STRCUR_JUMP_ALL);
+                                       retval = WM_UI_HANDLER_BREAK;
+                               }
+                               break;
+
                        case TABKEY:
                                /* there is a key conflict here, we can't tab with autocomplete */
                                if (but->autocomplete_func || data->searchbox) {
index e5f9e48c3b023078eb967f2e19743544580911ec..905c914352f1a8b6730da7eef5087b2960fa83e1 100644 (file)
@@ -2506,8 +2506,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
        
        /* make the progress bar a proportion of the original height */
        /* hardcoded 4px high for now */
-       rect_prog.ymax = rect_prog.ymin + 4;
-       rect_bar.ymax = rect_bar.ymin + 4;
+       rect_prog.ymax = rect_prog.ymin + 4 * UI_DPI_FAC;
+       rect_bar.ymax = rect_bar.ymin + 4 * UI_DPI_FAC;
        
        w = value * BLI_rcti_size_x(&rect_prog);
        
@@ -2520,8 +2520,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
        uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE);
        
        /* raise text a bit */
-       rect->ymin += 6;
-       rect->xmin -= 6;
+       rect->ymin += 6 * UI_DPI_FAC;
+       rect->xmin -= 6 * UI_DPI_FAC;
 }
 
 static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
index f7cf32a074f0d28104226c1f2b48963edc26536f..a9093824a9dc3c928234f429749cc445d679d88d 100644 (file)
@@ -80,7 +80,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
        InsetData *opdata = op->customdata;
 
        const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, "
-                                "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)");
+                                "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): (%s)");
 
        char msg[HEADER_LENGTH];
        ScrArea *sa = CTX_wm_area(C);
@@ -98,7 +98,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
                             flts_str + NUM_STR_REP_LEN,
                             opdata->modify_depth ? IFACE_("On") : IFACE_("Off"),
                             RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"),
-                            RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off")
+                            RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off"),
+                            RNA_boolean_get(op->ptr, "individual") ? IFACE_("On") : IFACE_("Off")
                            );
 
                ED_area_headerprint(sa, msg);
@@ -191,6 +192,7 @@ static int edbm_inset_calc(wmOperator *op)
        const float depth              = RNA_float_get(op->ptr,   "depth");
        const bool use_outset          = RNA_boolean_get(op->ptr, "use_outset");
        const bool use_select_inset    = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */
+       const bool individual          = RNA_boolean_get(op->ptr, "individual");
 
        opdata = op->customdata;
        em = opdata->em;
@@ -199,12 +201,18 @@ static int edbm_inset_calc(wmOperator *op)
                EDBM_redo_state_restore(opdata->mesh_backup, em, false);
        }
 
-       EDBM_op_init(em, &bmop, op,
-                    "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b "
-                    "thickness=%f depth=%f use_outset=%b",
-                    BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset,
-                    thickness, depth, use_outset);
-
+       if (individual) {
+               EDBM_op_init(em, &bmop, op,
+                            "inset_individual faces=%hf thickness=%f depth=%f use_even_offset=%b",
+                            BM_ELEM_SELECT, thickness, depth, use_even_offset);
+       }
+       else {
+               EDBM_op_init(em, &bmop, op,
+                            "inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b "
+                            "thickness=%f depth=%f use_outset=%b",
+                            BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset,
+                            thickness, depth, use_outset);
+       }
        BMO_op_exec(em->bm, &bmop);
 
        if (use_select_inset) {
@@ -410,6 +418,20 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                }
                        }
                        break;
+               case IKEY:
+                       if (event->val == KM_PRESS) {
+                               int individual = RNA_boolean_get(op->ptr, "individual");
+                               RNA_boolean_set(op->ptr, "individual", !individual);
+                               if (edbm_inset_calc(op)) {
+                                       edbm_inset_update_header(op, C);
+                               }
+                               else {
+                                       edbm_inset_cancel(C, op);
+                                       return OPERATOR_CANCELLED;
+                               }
+                       }
+                       break;
+
        }
 
        return OPERATOR_RUNNING_MODAL;
@@ -448,4 +470,5 @@ void MESH_OT_inset(wmOperatorType *ot)
 
        RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset");
        RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces");
+       RNA_def_boolean(ot->srna, "individual", false, "Individual", "Individual Face Inset");
 }
index 0e4161d232de1848d47d5a9a5999618e7d8479e4..4f691efe95068cfce77e95ea9580c6885cae3903 100644 (file)
@@ -2632,6 +2632,67 @@ void MESH_OT_beautify_fill(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
+
+/********************** Poke Face **********************/
+
+static int edbm_poke_face_exec(bContext *C, wmOperator *op)
+{
+       Object *obedit = CTX_data_edit_object(C);
+       BMEditMesh *em = BMEdit_FromObject(obedit);
+       BMOperator bmop;
+
+       const float offset = RNA_float_get(op->ptr, "offset");
+       const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+       const int center_mode = RNA_enum_get(op->ptr, "center_mode");
+
+       EDBM_op_init(em, &bmop, op, "poke faces=%hf offset=%f use_relative_offset=%b center_mode=%i",
+                    BM_ELEM_SELECT, offset, use_relative_offset, center_mode);
+       BMO_op_exec(em->bm, &bmop);
+
+       EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
+       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true);
+       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
+
+       if (!EDBM_op_finish(em, &bmop, op, true)) {
+               return OPERATOR_CANCELLED;
+       }
+
+       EDBM_mesh_normals_update(em);
+
+       EDBM_update_generic(em, true, true);
+
+       return OPERATOR_FINISHED;
+
+}
+
+void MESH_OT_poke(wmOperatorType *ot)
+{
+
+       static EnumPropertyItem poke_center_modes[] = {
+               {BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED", 0, "Weighted Mean", "Weighted Mean Face Center"},
+               {BMOP_POKE_MEAN, "MEAN", 0, "Mean", "Mean Face Center"},
+               {BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face Bounds Center"},
+               {0, NULL, 0, NULL, NULL}};
+
+
+       /* identifiers */
+       ot->name = "Poke Faces";
+       ot->idname = "MESH_OT_poke";
+       ot->description = "Splits a face into a fan";
+
+       /* api callbacks */
+       ot->exec = edbm_poke_face_exec;
+       ot->poll = ED_operator_editmesh;
+
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+       RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Poke Offset", "Poke Offset", -1.0f, 1.0f);
+       RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry");
+       RNA_def_enum(ot->srna, "center_mode", poke_center_modes, BMOP_POKE_MEAN_WEIGHTED, "Poke Center", "Poke Face Center Calculation");
+}
+
 /********************** Quad/Tri Operators *************************/
 
 static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
@@ -2660,6 +2721,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
+
 void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
 {
        /* identifiers */
index 4a0bbbb8dbf9629907a4794d42b1afe3895a00ae..5b447bf254f5d4f3977839cffc28928ef5ff0ab2 100644 (file)
@@ -202,6 +202,7 @@ void MESH_OT_edge_face_add(struct wmOperatorType *ot);
 void MESH_OT_duplicate(struct wmOperatorType *ot);
 void MESH_OT_merge(struct wmOperatorType *ot);
 void MESH_OT_remove_doubles(struct wmOperatorType *ot);
+void MESH_OT_poke(struct wmOperatorType *ot);
 
 #ifdef WITH_FREESTYLE
 void MESH_OT_mark_freestyle_edge(struct wmOperatorType *ot);
index a17b0f5551b06b0cbe936a6ee40f0cc7c8fe07c7..06f920ef16c89cd38ccb903ad365d92dd4879d40 100644 (file)
@@ -158,6 +158,7 @@ void ED_operatortypes_mesh(void)
 
        WM_operatortype_append(MESH_OT_bridge_edge_loops);
        WM_operatortype_append(MESH_OT_inset);
+       WM_operatortype_append(MESH_OT_poke);
        WM_operatortype_append(MESH_OT_wireframe);
        WM_operatortype_append(MESH_OT_edge_split);
 
@@ -266,7 +267,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0);        
        WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0);
-
+       WM_keymap_add_item(keymap, "MESH_OT_poke", PKEY, KM_PRESS, KM_ALT, 0);
        kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0);
        RNA_boolean_set(kmi->ptr, "vertex_only", false);
        kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
index b851dc3be9439c75baa81f268e6c358a805bf434..08349e2e0bb45fa14c07e61cdf0f29dcbb25716f 100644 (file)
 #endif   
 #include "MEM_guardedalloc.h"
 
-#include "BLO_readfile.h" 
-
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
+#include "BLO_readfile.h"
+
 #include "DNA_world_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_material_types.h"
index 796bb99ebaf2b4fe269a3f46f6a8cc4d1ee36dea..f480725277e27905cb56d99cdb6f75701ebd08b8 100644 (file)
@@ -993,8 +993,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", VKEY, KM_PRESS, 0, 0); /* vert mask toggle */
        RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask_vertex");
 
-       WM_keymap_verify_item(keymap, "PAINT_OT_weight_from_bones", WKEY, KM_PRESS, 0, 0);
-
        kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0);
        RNA_string_set(kmi->ptr, "data_path", "tool_settings.weight_paint.brush.use_smooth_stroke");
 
index b1be92178193b2f9b2b701d221d39b299f5853e7..382b0b75c5e9448c2be03a2815d152a9043cc9d7 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_context.h"
-#include "BKE_movieclip.h"
-#include "BKE_tracking.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_string.h"
 #include "BLI_math.h"
 #include "BLI_rect.h"
 
+#include "BKE_context.h"
+#include "BKE_movieclip.h"
+#include "BKE_tracking.h"
+
 #include "ED_screen.h"
 #include "ED_clip.h"
 
index 1000aced3a931aa279c0ee1f627411deb007ea3d..1d2ea8d7305b54be2a394338ae4d28ee3bf98716 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_context.h"
-#include "BKE_movieclip.h"
-#include "BKE_tracking.h"
-#include "BKE_mask.h"
-
 #include "IMB_colormanagement.h"
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
 #include "BLI_rect.h"
 #include "BLI_math_base.h"
 
+#include "BKE_context.h"
+#include "BKE_movieclip.h"
+#include "BKE_tracking.h"
+#include "BKE_mask.h"
+
 #include "ED_screen.h"
 #include "ED_clip.h"
 #include "ED_mask.h"
index 7b070fde6bad24e83a7bab9c969d199f4fc50469..973200dc340afc96b2f567d10fd14a2487f5369b 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_context.h"
-#include "BKE_movieclip.h"
-#include "BKE_tracking.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_string.h"
 
+#include "BKE_context.h"
+#include "BKE_movieclip.h"
+#include "BKE_tracking.h"
+
 #include "ED_screen.h"
 #include "ED_clip.h"
 
index 35179511563c85bdb2bcbeaa56e843a133c29832..d6f644ab330c9009e261a470ea0addb81c27dde0 100644 (file)
  *  \ingroup spfile
  */
 
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
 
 #include "BKE_context.h"
 #include "BKE_screen.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-
 #include "BLF_translation.h"
 
 #include "DNA_screen_types.h"
index 698c355fad30d5feb1098f950410d66832ff9b00..d2624c7fa972a8b7214c6be1651d2ba16fbfa082 100644 (file)
 
 #include "BIF_gl.h"
 
-#include "BLO_readfile.h"
-
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 #include "BLI_fileops_types.h"
 
+#include "BLO_readfile.h"
+
 #include "BKE_context.h"
 #include "BKE_screen.h"
 #include "BKE_global.h"
index 1b4ff44bb6b1201deac06788fef932102b0351e1..9bc23ca17c2b61c8aac08064fbedd74461611094 100644 (file)
@@ -438,7 +438,6 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
                case NC_WINDOW:
                        /* notifier comes from editing color space */
                        image_scopes_tag_refresh(sa);
-                       ED_area_tag_refresh(sa);
                        ED_area_tag_redraw(sa);
                        break;
                case NC_SCENE:
index 513bde4375cc15a2b40fe8086ed98e21bd27d3a0..0155750fbf83e09af74b4ffa19fc1ce0ae75365c 100644 (file)
 
 #include "DNA_node_types.h"
 
-#include "BKE_context.h"
-
 #include "BLI_utildefines.h"
 
+#include "BKE_context.h"
+
 #include "ED_node.h"  /* own include */
 #include "ED_screen.h"
 #include "ED_transform.h"
index 7678051fd386815f978007b306d6b32ebafaf819..2752d76fbf00842e20ef1ace84b1f868a686564e 100644 (file)
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
-#include "BKE_context.h"
-
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
 
+#include "BKE_context.h"
+
 #include "ED_image.h"
 #include "ED_view3d.h"
 
index fc603f7a593d1ae8fc9b777e6a409bc6d641e633..e1451ee43e67fd516d97339b479a4e8047ef05cf 100644 (file)
@@ -186,6 +186,11 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
                        //#ifdef WITH_PYTHON
                        // XXX          BPY_scripts_clear_pyobjects();
                        //#endif
+                       
+                       /* for global undo/redo we should just clear the editmode stack */
+                       /* for example, texface stores image pointers */
+                       undo_editmode_clear();
+                       
                        if (undoname)
                                BKE_undo_name(C, undoname);
                        else
index 1bf15fd0838f976f367ccce6daf28d480aacfbff..74b0f69c9b8f7df8834807424a71fcdf64f01d95 100644 (file)
@@ -27,9 +27,6 @@
 #include <stdlib.h>
 #include <limits.h>
 
-#include "BKE_cloth.h"
-#include "BKE_modifier.h"
-
 #include "DNA_cloth_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -38,6 +35,9 @@
 
 #include "rna_internal.h"
 
+#include "BKE_cloth.h"
+#include "BKE_modifier.h"
+
 #include "WM_api.h"
 #include "WM_types.h"
 
index 09ea82e5ec706d1589421b10b80f258b0acd3e13..e7a8311656fb629694bff19c27eca5ab6c5fa927 100644 (file)
 #ifndef __RNA_INTERNAL_H__
 #define __RNA_INTERNAL_H__
 
-#include "UI_resources.h"
-
 #include "BLI_utildefines.h"
 
 #include "rna_internal_types.h"
 
+#include "UI_resources.h"
+
 #define RNA_MAGIC ((int)~0)
 
 struct ColorBand;
index 9b2bcab460448bbc950bf98c31e71ee183357b18..bb5ff172672d6826e277f97fab423254e26e61cc 100644 (file)
@@ -30,9 +30,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_movieclip.h"
-#include "BKE_tracking.h"
-
 #include "DNA_movieclip_types.h"
 #include "DNA_scene_types.h"
 
@@ -40,6 +37,9 @@
 
 #include "rna_internal.h"
 
+#include "BKE_movieclip.h"
+#include "BKE_tracking.h"
+
 #include "WM_types.h"
 
 #include "IMB_imbuf_types.h"
index cdfcf045e35cbaad7f42f9b48419ea30dedfe215..b1732a3b184775dcb1fa63242977a828827865cc 100644 (file)
@@ -33,7 +33,7 @@
 
 /* **************** ALPHAOVER ******************** */
 static bNodeSocketTemplate cmp_node_alphaover_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       -1, 0, ""       }
index e544ec7d9d84969861dd22bbf2a53b3f384f1ae7..8dcad031e01b0dae6739364cecbcb0d3417c7cdc 100644 (file)
@@ -36,7 +36,7 @@
 /* **************** BLUR ******************** */
 static bNodeSocketTemplate cmp_node_blur_in[] = {
        {   SOCK_RGBA, 1, N_("Image"),          1.0f, 1.0f, 1.0f, 1.0f},
-       {   SOCK_FLOAT, 1, N_("Size"),          1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {   SOCK_FLOAT, 1, N_("Size"),          1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {   -1, 0, ""   }
 };
 static bNodeSocketTemplate cmp_node_blur_out[] = {
index 60cfd7c90f3ea39d6a5b77a07fd735167dbd1083..5cdb7b016cd8fb681300ed4f0a0bd05a55a8267f 100644 (file)
@@ -34,7 +34,7 @@
 /* ******************* Color Spill Supression ********************************* */
 static bNodeSocketTemplate cmp_node_color_spill_in[] = {
        {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
-       {SOCK_FLOAT, 1, N_("Fac"),      1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {SOCK_FLOAT, 1, N_("Fac"),      1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {-1, 0, ""}
 };
 
index 693680f58a8a1052ffc8341adb83db5552f48ef8..0ab819d6683ccf2f7e2d0ca00a4dc47999a389b3 100644 (file)
@@ -36,7 +36,7 @@
 
 /* ******************* Color Balance ********************************* */
 static bNodeSocketTemplate cmp_node_colorbalance_in[] = {
-       {SOCK_FLOAT, 1, N_("Fac"),      1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {SOCK_FLOAT, 1, N_("Fac"),      1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
        {-1, 0, ""}
 };
index 9b09462ed0fe5b2dbf7b6b05c8512bc9923e9cea..e122bd51ec68c267a9939efa5af2a139388ec80a 100644 (file)
@@ -38,7 +38,7 @@
 /* ******************* Color Balance ********************************* */
 static bNodeSocketTemplate cmp_node_colorcorrection_in[] = {
        {       SOCK_RGBA,1,N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Mask"),      1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Mask"),      1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1,0,""}
 };
 
index 7fa7a5048ab38e974608a476e3337258175d292b..83ca9128ce4127b50a87409b5f8b03738202a252 100644 (file)
@@ -34,8 +34,8 @@
 /* **************** COMPOSITE ******************** */
 static bNodeSocketTemplate cmp_node_composite_in[] = {
        {       SOCK_RGBA, 1, N_("Image"),              0.0f, 0.0f, 0.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Alpha"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
-       {       SOCK_FLOAT, 1, N_("Z"),                 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Alpha"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
+       {       SOCK_FLOAT, 1, N_("Z"),                 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 
index 2bf901491bf3331871f620f2c9d006bc64f29a96..483965f4adfdb1fdde9215c5e7f1ddbc9f9e4364 100644 (file)
@@ -95,7 +95,7 @@ void register_node_type_cmp_curve_vec(void)
 
 /* **************** CURVE RGB  ******************** */
 static bNodeSocketTemplate cmp_node_curve_rgb_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Image"),      1.0f, 1.0f, 1.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Black Level"),        0.0f, 0.0f, 0.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("White Level"),        1.0f, 1.0f, 1.0f, 1.0f},
index 9581ef981cb8282d5c4be27b8b86e043b99a4f88..a4c34ea523fe9116bce20971fa1e734b446042a0 100644 (file)
@@ -36,7 +36,7 @@
 /* ************ qdn: Defocus node ****************** */
 static bNodeSocketTemplate cmp_node_defocus_in[] = {
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Z"),                 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Z"),                 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 static bNodeSocketTemplate cmp_node_defocus_out[] = {
index 486c69caba0d7bb0286c9856e069854171bcdc76..35539082556acb19edb5db40c01917854b8896c3 100644 (file)
@@ -33,7 +33,7 @@
 
 /* **************** FILTER  ******************** */
 static bNodeSocketTemplate cmp_node_despeckle_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       -1, 0, ""       }
 };
index d9caff0d495294589dd459c3a56a89d4d945b33c..a77fc004ce7a5b8ccab7a5826161bd16a5555fd0 100644 (file)
@@ -36,7 +36,7 @@
 /* **************** Dilate/Erode ******************** */
 
 static bNodeSocketTemplate cmp_node_dilateerode_in[] = {
-       {   SOCK_FLOAT, 1, N_("Mask"),      0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {   SOCK_FLOAT, 1, N_("Mask"),      0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {   -1, 0, ""   }
 };
 static bNodeSocketTemplate cmp_node_dilateerode_out[] = {
index 33f82355629c916e6f28651b664c6391de10074d..5794b5a7cb8d0b0950a0645a7e2cec65fd3f2170 100644 (file)
@@ -38,8 +38,8 @@
 static bNodeSocketTemplate cmp_node_displace_in[] = {
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       SOCK_VECTOR, 1, N_("Vector"),                   1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION},
-       {       SOCK_FLOAT, 1, N_("X Scale"),                           0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR},
-       {       SOCK_FLOAT, 1, N_("Y Scale"),                           0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("X Scale"),                           0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE},
+       {       SOCK_FLOAT, 1, N_("Y Scale"),                           0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 static bNodeSocketTemplate cmp_node_displace_out[] = {
index 408c2ff8d7357ba5dfabd32a9ae5caedcc6adddf..16adbc8d53c72036794a71be2723594e609c2d45 100644 (file)
@@ -34,7 +34,7 @@
 
 /* **************** FILTER  ******************** */
 static bNodeSocketTemplate cmp_node_filter_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       -1, 0, ""       }
 };
index 01c6f639cbb9620880116565599c09e2691acb22..f499dec12241f8286d29268ef16ec9b8c27f61c4 100644 (file)
@@ -35,7 +35,7 @@
 
 /* **************** Hue Saturation ******************** */
 static bNodeSocketTemplate cmp_node_hue_sat_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       -1, 0, ""       }
 };
index 71e4df04911bf5a6b7d04c0d87a95d33b9bf2885..91e5a2d865a15a7bba40ce21bcc38be1b336b1e2 100644 (file)
@@ -33,7 +33,7 @@
 #include "node_composite_util.h"
 
 static bNodeSocketTemplate cmp_node_huecorrect_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Image"),      1.0f, 1.0f, 1.0f, 1.0f},
        {       -1, 0, ""       }
 };
index 6a3da2c854b00699e0112be35d62a96e74dc7ab5..415cb641548267a26cbbd70d4abdf15252b04f72 100644 (file)
@@ -33,7 +33,7 @@
 
 /* **************** INVERT ******************** */
 static bNodeSocketTemplate cmp_node_invert_in[] = {
-       { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f},
        { -1, 0, "" }
 };
index a3415761bf806c3617f9c4786906aafb2e2828ec..e9c3e4fd6e060fa0b32cc6b1df37f56c83221dbb 100644 (file)
@@ -33,7 +33,7 @@
 
 /* **************** MIX RGB ******************** */
 static bNodeSocketTemplate cmp_node_mix_rgb_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Image"),                      1.0f, 1.0f, 1.0f, 1.0f},
        {       -1, 0, ""       }
index d12c09cb25e89eae7fccdeb3d78d648dbde931c6..95640e2bd9bd8bab80535e1bbae29e85467ce441 100644 (file)
@@ -37,7 +37,7 @@
 /* **************** Pixelate ******************** */
 
 static bNodeSocketTemplate cmp_node_pixelate_in[] = {
-       {   SOCK_RGBA, 1, N_("Color"),      0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {   SOCK_RGBA, 1, N_("Color"),      0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {   -1, 0, ""   }
 };
 static bNodeSocketTemplate cmp_node_pixelate_out[] = {
index 0d8763bf321f33103e6dff4d6d6b2d02470b132c..9b1cb3a34b00f5cef944e4600e01bfeea2739e85 100644 (file)
@@ -36,8 +36,8 @@
 
 static bNodeSocketTemplate cmp_node_scale_in[] = {
        {   SOCK_RGBA, 1, N_("Image"),          1.0f, 1.0f, 1.0f, 1.0f},
-       {   SOCK_FLOAT, 1, N_("X"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR},
-       {   SOCK_FLOAT, 1, N_("Y"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR},
+       {   SOCK_FLOAT, 1, N_("X"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE},
+       {   SOCK_FLOAT, 1, N_("Y"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE},
        {   -1, 0, ""   }
 };
 static bNodeSocketTemplate cmp_node_scale_out[] = {
index a1d51bdf1718e7bf56d850221f6067f5a13f7e82..45192cc6252d4e1ca828a84cf68545fbeecce2b8 100644 (file)
@@ -35,7 +35,7 @@
 
 /* **************** VALTORGB ******************** */
 static bNodeSocketTemplate cmp_node_valtorgb_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 static bNodeSocketTemplate cmp_node_valtorgb_out[] = {
index b293b02cfe6f9978efe0508e9d0093ee208745d9..f36f1476bbe3d0e3a003971e4196cbf34569b7ad 100644 (file)
@@ -35,7 +35,7 @@
 
 /* **************** CURVE VEC  ******************** */
 static bNodeSocketTemplate sh_node_curve_vec_in[] = {
-       {       SOCK_FLOAT, 0, N_("Fac"),       1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 0, N_("Fac"),       1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_VECTOR, 1, N_("Vector"),   0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
@@ -88,7 +88,7 @@ void register_node_type_sh_curve_vec(void)
 
 /* **************** CURVE RGB  ******************** */
 static bNodeSocketTemplate sh_node_curve_rgb_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Color"),      0.0f, 0.0f, 0.0f, 1.0f},
        {       -1, 0, ""       }
 };
index 559d9289fb7b5952cd59886faa0e0d22d8d3681b..0d6f0c6ca107e2b5a9a3276d296adb12880c9cc1 100644 (file)
@@ -36,9 +36,9 @@
 /* **************** Hue Saturation ******************** */
 static bNodeSocketTemplate sh_node_hue_sat_in[] = {
        {       SOCK_FLOAT, 1, N_("Hue"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
-       {       SOCK_FLOAT, 1, N_("Saturation"),                1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
-       {       SOCK_FLOAT, 1, N_("Value"),                     1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
-       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Saturation"),                1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE},
+       {       SOCK_FLOAT, 1, N_("Value"),                     1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Color"),                      0.8f, 0.8f, 0.8f, 1.0f},
        {       -1, 0, ""       }
 };
index 193ea93f54a1b0853739b48ee471a371ba542920..9dbd2a340cedf57695ff75bc2d333421e2bf7088 100644 (file)
@@ -36,7 +36,7 @@
 
 /* **************** INVERT ******************** */ 
 static bNodeSocketTemplate sh_node_invert_in[] = {
-       { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
        { -1, 0, "" }
 };
index aee280760bafd9645f1325c093342d3820ae4313..a4cdfdc6f418157718e41944072a8ce5b5932070 100644 (file)
@@ -36,7 +36,7 @@
 static bNodeSocketTemplate sh_node_material_in[] = {
        {       SOCK_RGBA, 1, N_("Color"),              0.0f, 0.0f, 0.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Spec"),               0.0f, 0.0f, 0.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Refl"),              0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Refl"),              0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_VECTOR, 1, N_("Normal"),   0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
        {       -1, 0, ""       }
 };
@@ -53,15 +53,15 @@ static bNodeSocketTemplate sh_node_material_out[] = {
 static bNodeSocketTemplate sh_node_material_ext_in[] = {
        {       SOCK_RGBA, 1, N_("Color"),              0.0f, 0.0f, 0.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Spec"),               0.0f, 0.0f, 0.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Refl"),              0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Refl"),              0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_VECTOR, 1, N_("Normal"),   0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
        {       SOCK_RGBA, 1, N_("Mirror"),             0.0f, 0.0f, 0.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Ambient"),   0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Ambient"),   0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_FLOAT, 1, N_("Emit"),              0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
-       {       SOCK_FLOAT, 1, N_("SpecTra"),   0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
-       {       SOCK_FLOAT, 1, N_("Ray Mirror"),        0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("SpecTra"),   0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+       {       SOCK_FLOAT, 1, N_("Ray Mirror"),        0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_FLOAT, 1, N_("Alpha"),             0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
-       {       SOCK_FLOAT, 1, N_("Translucency"),      0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Translucency"),      0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 
index 982eaa228d1b11fbb045654a62acc4dfa8ee6683..2d4f93fc75792e98db8cf9bd743a72ef152c37af 100644 (file)
@@ -34,7 +34,7 @@
 
 /* **************** MIX RGB ******************** */
 static bNodeSocketTemplate sh_node_mix_rgb_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_RGBA, 1, N_("Color1"),                     0.5f, 0.5f, 0.5f, 1.0f},
        {       SOCK_RGBA, 1, N_("Color2"),                     0.5f, 0.5f, 0.5f, 1.0f},
        {       -1, 0, ""       }
index f1415dcac1b2fa620e8683f6b7d589cea75de04d..4dc484545a24a4064a97238a3028f71074f27ece 100644 (file)
@@ -30,7 +30,7 @@
 /* **************** OUTPUT ******************** */
 
 static bNodeSocketTemplate sh_node_mix_shader_in[] = {
-       {       SOCK_FLOAT,  1, N_("Fac"),              0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT,  1, N_("Fac"),              0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       SOCK_SHADER, 1, N_("Shader")},
        {       SOCK_SHADER, 1, N_("Shader")},
        {       -1, 0, ""       }
index c317fe0f58a2a5dc21bbdd61cbb8e182b35bc181..128e31b83522feda1bb5d4c79ca4afefee6bb8de 100644 (file)
@@ -35,7 +35,7 @@
 /* **************** OUTPUT ******************** */
 static bNodeSocketTemplate sh_node_output_in[] = {
        {       SOCK_RGBA, 1, N_("Color"),              0.0f, 0.0f, 0.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Alpha"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Alpha"),             1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 
index 6666197770f60f92e32e7ccd89d046e4a6536040..c0d62f98d4721d6655731bd116cd723c3fee177f 100644 (file)
  *  \ingroup shdnodes
  */
 
-#include "BKE_idprop.h"
-
 #include "node_shader_util.h"
 
+#include "BKE_idprop.h"
+
 /* **************** Script ******************** */
 
 static void init(bNodeTree *UNUSED(ntree), bNode *node)
index d5f0bf30966bf311881c032c02753407fb99e0d5..0905b45505e078f06385caa70f89b29389608a7c 100644 (file)
@@ -34,7 +34,7 @@
 
 /* **************** VALTORGB ******************** */
 static bNodeSocketTemplate sh_node_valtorgb_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 static bNodeSocketTemplate sh_node_valtorgb_out[] = {
index 56da4ad24c06e6a756c7f821691493be09d31803..2c9521c78e3c3760ab1c691c8101ed11aec4592e 100644 (file)
@@ -36,9 +36,9 @@
 
 static bNodeSocketTemplate inputs[] = {
        { SOCK_FLOAT, 1, N_("Hue"),        0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f, PROP_NONE },
-       { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 2.0f, PROP_FACTOR },
-       { SOCK_FLOAT, 1, N_("Value"),      1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 2.0f, PROP_FACTOR },
-       { SOCK_FLOAT, 1, N_("Factor"),     1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 1.0f, PROP_FACTOR },
+       { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 2.0f, PROP_NONE },
+       { SOCK_FLOAT, 1, N_("Value"),      1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 2.0f, PROP_NONE },
+       { SOCK_FLOAT, 1, N_("Factor"),     1.0f, 0.0f, 0.0f, 0.0f,  0.0f, 1.0f, PROP_NONE },
        { SOCK_RGBA,  1, N_("Color"),      0.8f, 0.8f, 0.8f, 1.0f },
        { -1, 0, "" }
 };
index 12ac27f26b76fc1ccfb3198fd466be29714ff487..b482a76ae8e6c223941220cc6fdf4ea78871f57a 100644 (file)
@@ -35,7 +35,7 @@
 
 /* **************** MIX RGB ******************** */
 static bNodeSocketTemplate inputs[] = {
-       { SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
+       { SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE },
        { SOCK_RGBA,  1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f },
        { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f },
        { -1, 0, "" }
index 871cdab384ebbf75cf1dcfeaa3d918597025e429..4977b443de5e3abadf42f0ab25b6268fc92366d1 100644 (file)
@@ -35,7 +35,7 @@
 
 /* **************** VALTORGB ******************** */
 static bNodeSocketTemplate valtorgb_in[] = {
-       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+       {       SOCK_FLOAT, 1, N_("Fac"),                       0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
        {       -1, 0, ""       }
 };
 static bNodeSocketTemplate valtorgb_out[] = {
index cc87d34d7690fee57fe9bf8003285713b56984e7..234dd1e5fecc736b2dab2f5900217b83ab3421e5 100644 (file)
@@ -33,6 +33,7 @@
 #include <Python.h>
 
 #include "BLI_utildefines.h"
+#include "BLI_dynstr.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -68,6 +69,76 @@ static PyObject *bpy_bmesh_op_repr(BPy_BMeshOpFunc *self)
 }
 
 
+/* methods
+ * ======= */
+
+
+/* __doc__
+ * ------- */
+
+static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], const bool is_out)
+{
+       DynStr *dyn_str = BLI_dynstr_new();
+       char *ret;
+
+       int i = 0;
+
+       while (*slot_types[i].name) {
+               /* cut off '.out' by using a string size arg */
+               const int name_len = is_out ?
+                       (strchr(slot_types[i].name, '.') - slot_types[i].name) :
+                       sizeof(slot_types[i].name);
+               const char *value = "<Unknown>";
+               switch (slot_types[i].type) {
+                       case BMO_OP_SLOT_BOOL:          value = "False"; break;
+                       case BMO_OP_SLOT_INT:           value = "0"; break;
+                       case BMO_OP_SLOT_FLT:           value = "0.0"; break;
+                       case BMO_OP_SLOT_PTR:           value = "None"; break;
+                       case BMO_OP_SLOT_MAT:           value = "Matrix()"; break;
+                       case BMO_OP_SLOT_VEC:           value = "Vector()"; break;
+                       case BMO_OP_SLOT_ELEMENT_BUF:   value =
+                            (slot_types[i].subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) ? "None" : "[]"; break;
+                       case BMO_OP_SLOT_MAPPING:       value = "{}"; break;
+               }
+               BLI_dynstr_appendf(dyn_str, i ? ", %.*s=%s" : "%.*s=%s", name_len, slot_types[i].name, value);
+               i++;
+       };
+
+       ret = BLI_dynstr_get_cstring(dyn_str);
+       BLI_dynstr_free(dyn_str);
+       return ret;
+}
+
+static PyObject *bpy_bmesh_op_doc_get(BPy_BMeshOpFunc *self, void *UNUSED(closure))
+{
+       PyObject *ret;
+       char *slot_in;
+       char *slot_out;
+       int i;
+
+       i = BMO_opcode_from_opname(self->opname);
+
+       slot_in  = bmp_slots_as_args(bmo_opdefines[i]->slot_types_in, false);
+       slot_out = bmp_slots_as_args(bmo_opdefines[i]->slot_types_out, true);
+
+       ret = PyUnicode_FromFormat("%.200s bmesh.ops.%.200s(bmesh, %s)\n  -> dict(%s)",
+                                  Py_TYPE(self)->tp_name,
+                                  self->opname, slot_in, slot_out);
+
+       MEM_freeN(slot_in);
+       MEM_freeN(slot_out);
+
+       return ret;
+}
+
+static PyGetSetDef bpy_bmesh_op_getseters[] = {
+       {(char *)"__doc__", (getter)bpy_bmesh_op_doc_get, (setter)NULL, NULL, NULL},
+       {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+
+/* Types
+ * ===== */
 
 PyTypeObject bmesh_op_Type = {
        PyVarObject_HEAD_INIT(NULL, 0)
@@ -126,7 +197,7 @@ PyTypeObject bmesh_op_Type = {
        /*** Attribute descriptor and subclassing stuff ***/
        NULL,                       /* struct PyMethodDef *tp_methods; */
        NULL,                       /* struct PyMemberDef *tp_members; */
-       NULL,                       /* struct PyGetSetDef *tp_getset; */
+       bpy_bmesh_op_getseters,     /* struct PyGetSetDef *tp_getset; */
        NULL,                       /* struct _typeobject *tp_base; */
        NULL,                       /* PyObject *tp_dict; */
        NULL,                       /* descrgetfunc tp_descr_get; */
@@ -154,20 +225,17 @@ PyTypeObject bmesh_op_Type = {
 
 static PyObject *bpy_bmesh_ops_fakemod_getattro(PyObject *UNUSED(self), PyObject *pyname)
 {
-       const unsigned int tot = bmo_opdefines_total;
-       unsigned int i;
        const char *opname = _PyUnicode_AsString(pyname);
 
-       for (i = 0; i < tot; i++) {
-               if (STREQ(bmo_opdefines[i]->opname, opname)) {
-                       return bpy_bmesh_op_CreatePyObject(opname);
-               }
+       if (BMO_opcode_from_opname(opname) != -1) {
+               return bpy_bmesh_op_CreatePyObject(opname);
+       }
+       else {
+               PyErr_Format(PyExc_AttributeError,
+                            "BMeshOpsModule: operator \"%.200s\" doesn't exist",
+                            opname);
+               return NULL;
        }
-
-       PyErr_Format(PyExc_AttributeError,
-                    "BMeshOpsModule: operator \"%.200s\" doesn't exist",
-                    opname);
-       return NULL;
 }
 
 static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self))
index 6aaa58f0ed486b877f63f0fec11d998ea692670d..f49018d6e18761adf2f6eed00db9af95dfb7c011 100644 (file)
@@ -1718,6 +1718,22 @@ static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self)
        return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
 }
 
+PyDoc_STRVAR(bpy_bmface_calc_center_mean_weighted_doc,
+".. method:: calc_center_median_weighted()\n"
+"\n"
+"   Return median center of the face weighted by edge lengths.\n"
+"\n"
+"   :return: a 3D vector.\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmface_calc_center_mean_weighted(BPy_BMFace *self)
+{
+       float cent[3];
+
+       BPY_BM_CHECK_OBJ(self);
+       BM_face_calc_center_mean_weighted(self->f, cent);
+       return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
+}
 
 PyDoc_STRVAR(bpy_bmface_calc_center_bounds_doc,
 ".. method:: calc_center_bounds()\n"
@@ -2573,6 +2589,7 @@ static struct PyMethodDef bpy_bmface_methods[] = {
        {"calc_area",          (PyCFunction)bpy_bmface_calc_area,          METH_NOARGS, bpy_bmface_calc_area_doc},
        {"calc_perimeter",     (PyCFunction)bpy_bmface_calc_perimeter,     METH_NOARGS, bpy_bmface_calc_perimeter_doc},
        {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean,   METH_NOARGS, bpy_bmface_calc_center_mean_doc},
+       {"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_mean_weighted, METH_NOARGS, bpy_bmface_calc_center_mean_weighted_doc},
        {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc},
 
        {"normal_update",  (PyCFunction)bpy_bmface_normal_update,  METH_NOARGS,  bpy_bmface_normal_update_doc},
index 623d45dfd90025757f63af0bacdfeede6c95b446..0ab8543c4ac5063fc1b3fa5e3bdb00128d49f15a 100644 (file)
  * a context manager.
  */
 
-/* nifty feature. swap out strings for RNA data */
-#define USE_RNA_DATABLOCKS
-
 #include <Python.h>
 #include <stddef.h>
 
-#include "BLO_readfile.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
 #include "BLI_linklist.h"
 #include "BLI_path_util.h"
 #include "BLI_listbase.h"
 
+#include "BLO_readfile.h"
+
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_library.h"
@@ -57,6 +54,9 @@
 #include "bpy_util.h"
 #include "bpy_library.h"
 
+/* nifty feature. swap out strings for RNA data */
+#define USE_RNA_DATABLOCKS
+
 #ifdef USE_RNA_DATABLOCKS
 #  include "bpy_rna.h"
 #  include "RNA_access.h"
index 1e3c2479e66b3e89caf65a59cfb5bd5da1df1834..444f8cc57c8a02186f999ac7b5801c4ca1080e4e 100644 (file)
@@ -628,6 +628,26 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
                wm_triple_copy_textures(win, triple);
        }
 
+       if (paintcursor && wm->paintcursors.first) {
+               for (sa = screen->areabase.first; sa; sa = sa->next) {
+                       for (ar = sa->regionbase.first; ar; ar = ar->next) {
+                               if (ar->swinid && ar->swinid == screen->subwinactive) {
+                                       CTX_wm_area_set(C, sa);
+                                       CTX_wm_region_set(C, ar);
+
+                                       /* make region ready for draw, scissor, pixelspace */
+                                       ED_region_set(C, ar);
+                                       wm_paintcursor_draw(C, ar);
+
+                                       CTX_wm_region_set(C, NULL);
+                                       CTX_wm_area_set(C, NULL);
+                               }
+                       }
+               }
+
+               wmSubWindowSet(win, screen->mainwin);
+       }
+
        /* draw overlapping area regions (always like popups) */
        for (sa = screen->areabase.first; sa; sa = sa->next) {
                CTX_wm_area_set(C, sa);
@@ -662,26 +682,6 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
        /* always draw, not only when screen tagged */
        if (win->gesture.first)
                wm_gesture_draw(win);
-
-       if (paintcursor && wm->paintcursors.first) {
-               for (sa = screen->areabase.first; sa; sa = sa->next) {
-                       for (ar = sa->regionbase.first; ar; ar = ar->next) {
-                               if (ar->swinid && ar->swinid == screen->subwinactive) {
-                                       CTX_wm_area_set(C, sa);
-                                       CTX_wm_region_set(C, ar);
-
-                                       /* make region ready for draw, scissor, pixelspace */
-                                       ED_region_set(C, ar);
-                                       wm_paintcursor_draw(C, ar);
-
-                                       CTX_wm_region_set(C, NULL);
-                                       CTX_wm_area_set(C, NULL);
-                               }
-                       }
-               }
-
-               wmSubWindowSet(win, screen->mainwin);
-       }
        
        /* needs pixel coords in screen */
        if (wm->drags.first) {