svn merge ^/trunk/blender -r49601:49620
authorCampbell Barton <ideasman42@gmail.com>
Mon, 6 Aug 2012 14:02:03 +0000 (14:02 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 6 Aug 2012 14:02:03 +0000 (14:02 +0000)
16 files changed:
intern/string/STR_HashedString.h
release/scripts/startup/bl_ui/space_image.py
source/blender/blenkernel/BKE_mask.h
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/mask_rasterize.c
source/blender/blenlib/intern/stack.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_group.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/makesrna/intern/rna_space.c

index f56e365bdb3e034ae77315e81dea00f58d311cab..8bfbde65895ba59ecc1ef4b0ba1cc3a820e8a120 100644 (file)
 
 /** \file string/STR_HashedString.h
  *  \ingroup string
- */
-
-
-/**
-
+ *
  * Copyright (C) 2001 NaN Technologies B.V.
  * This file was formerly known as: GEN_StdString.cpp.
- * @date       November, 14, 2001
+ * \date       November, 14, 2001
  */
 
 #ifndef __STR_HASHEDSTRING_H__
 //
 static inline void STR_gHashMix(dword& a, dword& b, dword& c)
 {
-       a -= b; a -= c; a ^= (c>>13);
-       b -= c; b -= a; b ^= (a<<8);
-       c -= a; c -= b; c ^= (b>>13);
-       a -= b; a -= c; a ^= (c>>12);
-       b -= c; b -= a; b ^= (a<<16);
-       c -= a; c -= b; c ^= (b>>5);
-       a -= b; a -= c; a ^= (c>>3);
-       b -= c; b -= a; b ^= (a<<10);
-       c -= a; c -= b; c ^= (b>>15);
+       a -= b; a -= c; a ^= (c >> 13);
+       b -= c; b -= a; b ^= (a << 8);
+       c -= a; c -= b; c ^= (b >> 13);
+       a -= b; a -= c; a ^= (c >> 12);
+       b -= c; b -= a; b ^= (a << 16);
+       c -= a; c -= b; c ^= (b >> 5);
+       a -= b; a -= c; a ^= (c >> 3);
+       b -= c; b -= a; b ^= (a << 10);
+       c -= a; c -= b; c ^= (b >> 15);
 }
 
 //
 // Fast Hashable<int32> functionality
 // http://www.concentric.net/~Ttwang/tech/inthash.htm
 //
-static inline dword                    STR_gHash(dword inDWord)
+static inline dword         STR_gHash(dword inDWord)
 {
        dword key = inDWord;
        key += ~(key << 16);
@@ -80,43 +76,43 @@ static inline dword                 STR_gHash(dword inDWord)
        return key;
 }
 
-enum { GOLDEN_RATIO = 0x9e3779b9 }; // arbitrary value to initialize hash funtion, well not so arbitrary
-                                                                       // as this value is taken from the pigs library (Orange Games/Lost Boys)
+enum { GOLDEN_RATIO = 0x9e3779b9 }; /* arbitrary value to initialize hash funtion, well not so arbitrary
+                                     * as this value is taken from the pigs library (Orange Games/Lost Boys) */
 
 
 
-static dword STR_gHash(const voidin, int len, dword init_val)
+static dword STR_gHash(const void *in, int len, dword init_val)
 {
-       unsigned int  length = len;
+       unsigned int length = len;
        dword a = (dword)GOLDEN_RATIO;
        dword b = (dword)GOLDEN_RATIO;
-       dword c = init_val;                                                                                                                     // the previous hash value
+       dword c = init_val;  /* the previous hash value */
        byte  *p_in = (byte *)in;
 
        // Do the largest part of the key
        while (length >= 12)
        {
-               a += (p_in[0] + ((dword)p_in[1]<<8) + ((dword)p_in[2] <<16) + ((dword)p_in[3] <<24));
-               b += (p_in[4] + ((dword)p_in[5]<<8) + ((dword)p_in[6] <<16) + ((dword)p_in[7] <<24));
-               c += (p_in[8] + ((dword)p_in[9]<<8) + ((dword)p_in[10]<<16) + ((dword)p_in[11]<<24));
+               a += (p_in[0] + ((dword)p_in[1] << 8) + ((dword)p_in[2]  << 16) + ((dword)p_in[3]  << 24));
+               b += (p_in[4] + ((dword)p_in[5] << 8) + ((dword)p_in[6]  << 16) + ((dword)p_in[7]  << 24));
+               c += (p_in[8] + ((dword)p_in[9] << 8) + ((dword)p_in[10] << 16) + ((dword)p_in[11] << 24));
                STR_gHashMix(a, b, c);
                p_in += 12; length -= 12;
        }
 
        // Handle the last 11 bytes
        c += len;
-       switch(length) {
-       case 11: c+=((dword)p_in[10]<<24);
-       case 10: c+=((dword)p_in[9]<<16);
-       case 9 : c+=((dword)p_in[8]<<8);                                                                                        // the first byte of c is reserved for the length
-       case 8 : b+=((dword)p_in[7]<<24);
-       case 7 : b+=((dword)p_in[6]<<16);
-       case 6 : b+=((dword)p_in[5]<<8);
-       case 5 : b+=p_in[4];
-       case 4 : a+=((dword)p_in[3]<<24);
-       case 3 : a+=((dword)p_in[2]<<16);
-       case 2 : a+=((dword)p_in[1]<<8);
-       case 1 : a+=p_in[0];
+       switch (length) {
+               case 11: c += ((dword)p_in[10] << 24);
+               case 10: c += ((dword)p_in[9]  << 16);
+               case  9: c += ((dword)p_in[8]  << 8);  /* the first byte of c is reserved for the length */
+               case  8: b += ((dword)p_in[7]  << 24);
+               case  7: b += ((dword)p_in[6]  << 16);
+               case  6: b += ((dword)p_in[5]  << 8);
+               case  5: b += p_in[4];
+               case  4: a += ((dword)p_in[3]  << 24);
+               case  3: a += ((dword)p_in[2]  << 16);
+               case  2: a += ((dword)p_in[1]  << 8);
+               case  1: a += p_in[0];
        }
        STR_gHashMix(a, b, c);
 
@@ -129,18 +125,18 @@ static dword STR_gHash(const void* in, int len, dword init_val)
 class STR_HashedString : public STR_String
 {
 public:
-       STR_HashedString()      : STR_String(),m_Hashed(false) {}
-       STR_HashedString(const char* str)       : STR_String(str),m_Hashed(false) {}
-       STR_HashedString(const STR_String& str) : STR_String(str),m_Hashed(false) {}
+       STR_HashedString() : STR_String(), m_Hashed(false) {}
+       STR_HashedString(const char *str) : STR_String(str), m_Hashed(false) {}
+       STR_HashedString(const STR_String &str) : STR_String(str), m_Hashed(false) {}
 
-       inline dword hash(dword init=0) const
+       inline dword hash(dword init = 0) const
        { 
                if (!m_Hashed) 
                {
-                       const charstr = *this;
+                       const char *str = *this;
                        int length = this->Length();
-                       m_CachedHash = STR_gHash(str,length,init);
-                       m_Hashed=true;
+                       m_CachedHash = STR_gHash(str, length, init);
+                       m_Hashed = true;
                } 
                return m_CachedHash;
        }
index d7b676e38e88d5d480c7e4f147574dae13551b3e..0138ddc0ac0734e6f694205cfdaf3fcb3c2598ea 100644 (file)
@@ -383,11 +383,17 @@ class IMAGE_HT_header(Header):
 
         layout.prop(sima, "mode", text="")
 
+        if show_maskedit:
+            row = layout.row()
+            row.template_ID(sima, "mask", new="mask.new")
+
+        if show_uvedit or show_maskedit:
+            layout.prop(sima, "pivot_point", text="", icon_only=True)
+
         # uv editing
         if show_uvedit:
             uvedit = sima.uv_editor
 
-            layout.prop(uvedit, "pivot_point", text="", icon_only=True)
             layout.prop(toolsettings, "use_uv_select_sync", text="")
 
             if toolsettings.use_uv_select_sync:
@@ -408,14 +414,6 @@ class IMAGE_HT_header(Header):
             mesh = context.edit_object.data
             layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="")
 
-        if show_maskedit:
-            row = layout.row()
-            row.template_ID(sima, "mask", new="mask.new")
-
-            # reused for mask
-            uvedit = sima.uv_editor
-            layout.prop(uvedit, "pivot_point", text="", icon_only=True)
-
         if ima:
             # layers
             layout.template_image_layers(ima, iuser)
@@ -629,6 +627,7 @@ class IMAGE_PT_view_properties(Panel):
         sima = context.space_data
         ima = sima.image
         show_uvedit = sima.show_uvedit
+        show_maskedit = sima.show_maskedit
         uvedit = sima.uv_editor
 
         split = layout.split()
@@ -647,12 +646,12 @@ class IMAGE_PT_view_properties(Panel):
             col.label(text="Coordinates:")
             col.prop(uvedit, "show_normalized_coords", text="Normalized")
 
-        if show_uvedit:
-
+        if show_uvedit or show_maskedit:
             col = layout.column()
             col.label("Cursor Location:")
-            col.row().prop(uvedit, "cursor_location", text="")
+            col.row().prop(sima, "cursor_location", text="")
 
+        if show_uvedit:
             col.separator()
 
             col.label(text="UVs:")
index a1a306c1b2c336d2ad099d8e2594c9034530c9a0..1836a88555be639080f85b076e3ef90bcac4bdaa 100644 (file)
@@ -76,7 +76,7 @@ float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spli
                                                          const unsigned int resol))[2];
 float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2];
 float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, int *tot_feather_point,
-                                                                         const unsigned int resol, const int do_collapse))[2];
+                                                                         const unsigned int resol))[2];
 float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_feather_point))[2];
 
 float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2];
index f41d8feef0b3c2d849559695cad5cb7d297dd771..3208862cef64378565367248a0e6d30173a124f7 100644 (file)
@@ -481,14 +481,29 @@ static void feather_bucket_check_intersect(float (*feather_points)[2], int tot_f
                        continue;
 
                if (isect_seg_seg_v2(v1, v2, v3, v4)) {
-                       int k, len;
+                       int k;
                        float p[2];
+                       float min_a[2], max_a[2];
+                       float min_b[2], max_b[2];
 
                        isect_seg_seg_v2_point(v1, v2, v3, v4, p);
 
-                       /* TODO: for now simply choose the shortest loop, could be made smarter in some way */
-                       len = cur_a - check_b;
-                       if (len < tot_feather_point - len) {
+                       INIT_MINMAX2(min_a, max_a);
+                       INIT_MINMAX2(min_b, max_b);
+
+                       /* collapse loop with smaller AABB */
+                       for (k = 0; k < tot_feather_point; k++) {
+                               if (k >= check_b && k <= cur_a) {
+                                       DO_MINMAX2(feather_points[k], min_a, max_a);
+                               }
+                               else {
+                                       DO_MINMAX2(feather_points[k], min_b, max_b);
+                               }
+                       }
+
+                       if (max_a[0] - min_a[0] < max_b[0] - min_b[0] ||
+                           max_a[1] - min_a[1] < max_b[1] - min_b[1])
+                       {
                                for (k = check_b; k <= cur_a; k++) {
                                        copy_v2_v2(feather_points[k], p);
                                }
@@ -702,8 +717,7 @@ static void spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feat
  */
 float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpline *spline,
                                                                          int *tot_feather_point,
-                                                                         const unsigned int resol,
-                                                                         const int do_collapse
+                                                                         const unsigned int resol
                                                                          ))[2]
 {
        MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
@@ -765,10 +779,7 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpl
 
        *tot_feather_point = tot;
 
-       /* this is slow! - don't do on draw */
-       if (do_collapse) {
-               spline_feather_collapse_inner_loops(spline, feather, tot);
-       }
+       spline_feather_collapse_inner_loops(spline, feather, tot);
 
        return feather;
 }
@@ -778,7 +789,7 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline
 {
        unsigned int resol = BKE_mask_spline_feather_resolution(spline, width, height);
 
-       return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, tot_feather_point, resol, FALSE);
+       return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, tot_feather_point, resol);
 }
 
 float (*BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, int *tot_feather_point))[2]
@@ -1484,7 +1495,9 @@ MaskLayerShape *BKE_mask_layer_shape_alloc(MaskLayer *masklay, const int frame)
 
 void BKE_mask_layer_shape_free(MaskLayerShape *masklay_shape)
 {
-       MEM_freeN(masklay_shape->data);
+       if (masklay_shape->data) {
+               MEM_freeN(masklay_shape->data);
+       }
 
        MEM_freeN(masklay_shape);
 }
index 9e1f4e2cfb29b163fe2e6457f51342034299a1e2..1fde1168999f38c6a2837c83b28c8081c1644a43 100644 (file)
@@ -586,7 +586,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
 
                        if (do_feather) {
                                diff_feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution_ex(
-                                                         spline, &tot_diff_feather_points, resol, TRUE);
+                                                         spline, &tot_diff_feather_points, resol);
                                BLI_assert(diff_feather_points);
                        }
                        else {
index 1d5bdbfdab6e18d3ef056cc6fec166560b7c3127..5be2ed941a7f067aef74c930930029605f386efb 100644 (file)
 #include "BLI_utildefines.h"
 #include "MEM_guardedalloc.h"
 
-typedef struct BLI_Stack {
+struct BLI_Stack {
        void *data;
 
        int totelem;
        int maxelem;
 
        int elem_size;
-} BLI_Stack;
+};
 
 BLI_Stack *BLI_stack_new(int elem_size, const char *description)
 {
index e1095d25b1da20929bdc2df3ad6b41ce012c8d2b..73494d118d4e141bebb1614343de40bd14b707d8 100644 (file)
@@ -4399,6 +4399,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                                smd->flow = NULL;
                                smd->domain = NULL;
                                smd->coll = newdataadr(fd, smd->coll);
+                               smd->coll->smd = smd;
                                if (smd->coll) {
                                        smd->coll->points = NULL;
                                        smd->coll->numpoints = 0;
index 8a3cf87e96a19e89c23434b93e772743b438efba..4d636e64430257d12cd73dcf3bccd059cb3edf51 100644 (file)
@@ -1092,9 +1092,9 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
        BLI_array_declare(edges);
        BVHTreeOverlap *results, *result;
        BMLoop **ls;
-       float cos[9], uv[3], lambda;
+       float cos[9], lambda;
        unsigned int tot = 0;
-       int i, j;
+       int i;
 
        /* for comparing distances, error of intersection depends on triangle scale.
         * need to scale down before squaring for accurate comparison */
@@ -1112,105 +1112,107 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
 
        for (i = 0; i < tot; i++, result++) {
                float p[3];
+               BMLoop *l1;
+               BMFace *hitf;
+               ListBase *lst;
+               Ref *ref;
 
                ls = (BMLoop **)kcd->em->looptris[result->indexA];
 
-               for (j = 0; j < 3; j++) {
-                       BMLoop *l1 = ls[j];
-                       BMFace *hitf;
-                       ListBase *lst = knife_get_face_kedges(kcd, l1->f);
-                       Ref *ref;
+               l1 = ls[0];
+               lst = knife_get_face_kedges(kcd, l1->f);
 
-                       for (ref = lst->first; ref; ref = ref->next) {
-                               KnifeEdge *kfe = ref->ref;
+               for (ref = lst->first; ref; ref = ref->next) {
+                       KnifeEdge *kfe = ref->ref;
 
-                               //if (kfe == kcd->cur.edge || kfe == kcd->prev.edge)
-                               //      continue;
+                       if (BLI_smallhash_haskey(ehash, (intptr_t)kfe)) {
+                               continue;  // We already found a hit on this knife edge
+                       }
 
-                               if (isect_line_tri_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3, &lambda, uv)) {
-                                       float no[3], view[3], sp[3];
+                       if (isect_line_tri_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3, &lambda, NULL)) {
+                               float no[3], view[3], sp[3];
 
-                                       interp_v3_v3v3(p, kfe->v1->cageco, kfe->v2->cageco, lambda);
+                               interp_v3_v3v3(p, kfe->v1->cageco, kfe->v2->cageco, lambda);
 
-                                       if (kcd->cur.vert && len_squared_v3v3(kcd->cur.vert->cageco, p) < depsilon_squared)
-                                               continue;
-                                       if (kcd->prev.vert && len_squared_v3v3(kcd->prev.vert->cageco, p) < depsilon_squared)
-                                               continue;
-                                       if (len_squared_v3v3(kcd->prev.cage, p) < depsilon_squared ||
-                                           len_squared_v3v3(kcd->cur.cage, p) < depsilon_squared)
-                                       {
-                                               continue;
+                               if (kcd->cur.vert && len_squared_v3v3(kcd->cur.vert->cageco, p) < depsilon_squared)
+                                       continue;
+                               if (kcd->prev.vert && len_squared_v3v3(kcd->prev.vert->cageco, p) < depsilon_squared)
+                                       continue;
+                               if (len_squared_v3v3(kcd->prev.cage, p) < depsilon_squared ||
+                                          len_squared_v3v3(kcd->cur.cage, p) < depsilon_squared)
+                                       continue;
+
+                               knife_project_v3(kcd, p, sp);
+                               view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
+                               mul_m4_v3(kcd->ob->imat, view);
+
+                               if (kcd->cut_through) {
+                                       hitf = FALSE;
+                               } else {
+                                       /* check if this point is visible in the viewport */
+                                       float p1[3], lambda1;
+
+                                       /* if face isn't planer, p may be behind the current tesselated tri,
+                                          so move it onto that and then a little towards eye */
+                                       if (isect_line_tri_v3(p, view, ls[0]->v->co, ls[1]->v->co, ls[2]->v->co, &lambda1, NULL)) {
+                                               interp_v3_v3v3(p1, p, view, lambda1);
+                                       } else {
+                                               copy_v3_v3(p1, p);
                                        }
+                                       sub_v3_v3(view, p1);
+                                       normalize_v3(view);
 
-                                       knife_project_v3(kcd, p, sp);
-                                       view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
-                                       mul_m4_v3(kcd->ob->imat, view);
+                                       copy_v3_v3(no, view);
+                                       mul_v3_fl(no, 0.003);
 
-                                       if (kcd->cut_through) {
-                                               hitf = FALSE;
-                                       }
-                                       else {
-                                               /* check if this point is visible in the viewport */
-                                               sub_v3_v3(view, p);
-                                               normalize_v3(view);
+                                       /* go towards view a bit */
+                                       add_v3_v3(p1, no);
+                                               
+                                       /* ray cast */
+                                       hitf = BMBVH_RayCast(bmtree, p1, no, NULL, NULL);
+                               }
+
+                               /* ok, if visible add the new point */
+                               if (!hitf && !BLI_smallhash_haskey(ehash, (intptr_t)kfe)) {
+                                       BMEdgeHit hit;
+       
+                                       if (len_squared_v3v3(p, kcd->cur.co) < depsilon_squared ||
+                                           len_squared_v3v3(p, kcd->prev.co) < depsilon_squared)
+                                               continue;
 
-                                               copy_v3_v3(no, view);
-                                               mul_v3_fl(no, 0.003);
+                                       hit.kfe = kfe;
+                                       hit.v = NULL;
 
-                                               /* go towards view a bit */
-                                               add_v3_v3(p, no);
+                                       knife_find_basef(kfe);
+                                       hit.f = kfe->basef;
+                                       hit.perc = len_v3v3(p, kfe->v1->cageco) / len_v3v3(kfe->v1->cageco, kfe->v2->cageco);
+                                       copy_v3_v3(hit.cagehit, p);
 
-                                               /* ray cast */
-                                               hitf = BMBVH_RayCast(bmtree, p, no, NULL, NULL);
-                                       }
+                                       interp_v3_v3v3(p, kfe->v1->co, kfe->v2->co, hit.perc);
+                                       copy_v3_v3(hit.realhit, p);
 
-                                       /* ok, if visible add the new point */
-                                       if (!hitf && !BLI_smallhash_haskey(ehash, (intptr_t)kfe)) {
-                                               BMEdgeHit hit;
-                                               
-                                               if (len_squared_v3v3(p, kcd->cur.co) < depsilon_squared ||
-                                                   len_squared_v3v3(p, kcd->prev.co) < depsilon_squared)
-                                               {
-                                                       continue;
-                                               }
+                                       /* BMESH_TODO: should also snap to vertices */
+                                       if (kcd->snap_midpoints) {
+                                               float perc = hit.perc;
 
-                                               hit.kfe = kfe;
-                                               hit.v = NULL;
-
-                                               knife_find_basef(kfe);
-                                               hit.f = kfe->basef;
-                                               hit.perc = len_v3v3(p, kfe->v1->cageco) / len_v3v3(kfe->v1->cageco, kfe->v2->cageco);
-                                               copy_v3_v3(hit.cagehit, p);
-
-                                               interp_v3_v3v3(p, kfe->v1->co, kfe->v2->co, hit.perc);
-                                               copy_v3_v3(hit.realhit, p);
-
-                                               /* BMESH_TODO: should also snap to vertices */
-                                               if (kcd->snap_midpoints) {
-                                                       float perc = hit.perc;
-
-                                                       /* select the closest from the edge endpoints or the midpoint */
-                                                       if (perc < 0.25f) {
-                                                               perc = 0.0f;
-                                                       }
-                                                       else if (perc < 0.75f) {
-                                                               perc = 0.5f;
-                                                       }
-                                                       else {
-                                                               perc = 1.0f;
-                                                       }
-
-                                                       interp_v3_v3v3(hit.hit, kfe->v1->co, kfe->v2->co, perc);
-                                                       interp_v3_v3v3(hit.cagehit, kfe->v1->cageco, kfe->v2->cageco, perc);
-                                               }
-                                               else {
-                                                       copy_v3_v3(hit.hit, p);
+                                               /* select the closest from the edge endpoints or the midpoint */
+                                               if (perc < 0.25f) {
+                                                       perc = 0.0f;
+                                               } else if (perc < 0.75f) {
+                                                       perc = 0.5f;
+                                               } else {
+                                                       perc = 1.0f;
                                                }
-                                               knife_project_v3(kcd, hit.cagehit, hit.schit);
 
-                                               BLI_array_append(edges, hit);
-                                               BLI_smallhash_insert(ehash, (intptr_t)kfe, NULL);
+                                               interp_v3_v3v3(hit.hit, kfe->v1->co, kfe->v2->co, perc);
+                                               interp_v3_v3v3(hit.cagehit, kfe->v1->cageco, kfe->v2->cageco, perc);
+                                       } else {
+                                               copy_v3_v3(hit.hit, p);
                                        }
+                                       knife_project_v3(kcd, hit.cagehit, hit.schit);
+
+                                       BLI_array_append(edges, hit);
+                                       BLI_smallhash_insert(ehash, (intptr_t)kfe, NULL);
                                }
                        }
                }
index 4058eb375c18d692b27d6df9a4b636a1a657051c..86048a704668a4f917baecf90dd7e6851df78405 100644 (file)
@@ -323,6 +323,19 @@ static void image_keymap(struct wmKeyConfig *keyconf)
                RNA_string_set(kmi->ptr, "data_path", "space_data.image.render_slot");
                RNA_int_set(kmi->ptr, "value", i);
        }
+
+       /* pivot */
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
+       RNA_string_set(kmi->ptr, "value", "CENTER");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
+       RNA_string_set(kmi->ptr, "value", "MEDIAN");
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
+       RNA_string_set(kmi->ptr, "value", "CURSOR");
 }
 
 /* dropboxes */
@@ -366,9 +379,11 @@ static void image_refresh(const bContext *C, ScrArea *sa)
        /* check if we have to set the image from the editmesh */
        if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) {
                if (sima->lock) {
-                       Mask *mask = ED_space_image_get_mask(sima);
-                       if (mask) {
-                               ED_node_composite_job(C, scene->nodetree, scene);
+                       if (scene->nodetree) {
+                               Mask *mask = ED_space_image_get_mask(sima);
+                               if (mask) {
+                                       ED_node_composite_job(C, scene->nodetree, scene);
+                               }
                        }
                }
        }
index 68806a802acc4c9adb3544c31ebcf1d4c074461b..6db3efd3694665a415e4308fa3363dae41448e1e 100644 (file)
@@ -176,6 +176,11 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
        wmJob *steve;
        CompoJob *cj;
 
+       /* to fix bug: [#32272] */
+       if (G.rendering) {
+               return;
+       }
+
        steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS);
        cj = MEM_callocN(sizeof(CompoJob), "compo job");
 
index 7d3c9ce6b5bd506ee6e0d01b540588e970dd0f70..efd2378bf31c8ddd67362e8fc442dae3bcfa8219 100644 (file)
@@ -631,45 +631,50 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
        /* add selected nodes into the ntree */
        for (node = ngroup->nodes.first; node; node = node_next) {
                node_next = node->next;
-               if (!(node->flag & NODE_SELECT))
-                       continue;
-
-               if (make_copy) {
-                       /* make a copy */
-                       newnode = nodeCopyNode(ngroup, node);
+               if (node->flag & NODE_SELECT) {
+                       
+                       if (make_copy) {
+                               /* make a copy */
+                               newnode = nodeCopyNode(ngroup, node);
+                       }
+                       else {
+                               /* use the existing node */
+                               newnode = node;
+                       }
+                       
+                       /* keep track of this node's RNA "base" path (the part of the path identifying the node)
+                        * if the old nodetree has animation data which potentially covers this node
+                        */
+                       if (ngroup->adt) {
+                               PointerRNA ptr;
+                               char *path;
+                               
+                               RNA_pointer_create(&ngroup->id, &RNA_Node, newnode, &ptr);
+                               path = RNA_path_from_ID_to_struct(&ptr);
+                               
+                               if (path)
+                                       BLI_addtail(&anim_basepaths, BLI_genericNodeN(path));
+                       }
+                       
+                       /* ensure valid parent pointers, detach if parent stays inside the group */
+                       if (newnode->parent && !(newnode->parent->flag & NODE_SELECT))
+                               nodeDetachNode(newnode);
+                       
+                       /* migrate node */
+                       BLI_remlink(&ngroup->nodes, newnode);
+                       BLI_addtail(&ntree->nodes, newnode);
+                       
+                       /* ensure unique node name in the node tree */
+                       nodeUniqueName(ntree, newnode);
+                       
+                       newnode->locx += gnode->locx;
+                       newnode->locy += gnode->locy;
                }
                else {
-                       /* use the existing node */
-                       newnode = node;
-               }
-
-               /* keep track of this node's RNA "base" path (the part of the path identifying the node)
-                * if the old nodetree has animation data which potentially covers this node
-                */
-               if (ngroup->adt) {
-                       PointerRNA ptr;
-                       char *path;
-
-                       RNA_pointer_create(&ngroup->id, &RNA_Node, newnode, &ptr);
-                       path = RNA_path_from_ID_to_struct(&ptr);
-
-                       if (path)
-                               BLI_addtail(&anim_basepaths, BLI_genericNodeN(path));
+                       /* ensure valid parent pointers, detach if child stays inside the group */
+                       if (node->parent && (node->parent->flag & NODE_SELECT))
+                               nodeDetachNode(node);
                }
-
-               /* ensure valid parent pointers, detach if parent stays inside the group */
-               if (newnode->parent && !(newnode->parent->flag & NODE_SELECT))
-                       nodeDetachNode(newnode);
-
-               /* migrate node */
-               BLI_remlink(&ngroup->nodes, newnode);
-               BLI_addtail(&ntree->nodes, newnode);
-
-               /* ensure unique node name in the node tree */
-               nodeUniqueName(ntree, newnode);
-
-               newnode->locx += gnode->locx;
-               newnode->locy += gnode->locy;
        }
 
        /* add internal links to the ntree */
@@ -913,6 +918,11 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
                        node->locx -= 0.5f * (min[0] + max[0]);
                        node->locy -= 0.5f * (min[1] + max[1]);
                }
+               else {
+                       /* if the parent is to be inserted but not the child, detach properly */
+                       if (node->parent && (node->parent->flag & NODE_SELECT))
+                               nodeDetachNode(node);
+               }
        }
 
        /* move animation data over */
index acda6c3d399ec9b84bbe0a3a7f7210548c0f644b..0b23b65f2509c81b319236fc935cc024c66a9a0d 100644 (file)
@@ -2932,6 +2932,14 @@ int Resize(TransInfo *t, const int mval[2])
                
                for (i = 0, td = t->data; i < t->total; i++, td++)
                        ElementResize(t, td, mat);
+
+               /* In proportional edit it can happen that */
+               /* vertices in the radius of the brush end */
+               /* outside the clipping area               */
+               /* XXX HACK - dg */
+               if(t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
+                       clipUVData(t);
+               }
        }
        
        recalcData(t);
@@ -3787,9 +3795,18 @@ int Translation(TransInfo *t, const int UNUSED(mval[2]))
        applyTranslation(t, t->values);
 
        /* evil hack - redo translation if clipping needed */
-       if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 0))
+       if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 0)) {
                applyTranslation(t, t->values);
 
+               /* In proportional edit it can happen that */
+               /* vertices in the radius of the brush end */
+               /* outside the clipping area               */
+               /* XXX HACK - dg */
+               if(t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
+                       clipUVData(t);
+               }
+       }
+
        recalcData(t);
 
        ED_area_headerprint(t->sa, str);
index 1585fb1ad6b07f8926ba62c84959b5fc1b9a375e..8a7148aad9553ff641069a94d49d16b9c7b29844 100644 (file)
@@ -562,6 +562,7 @@ void remake_graph_transdata(TransInfo *t, struct ListBase *anim_data);
 void flushTransUVs(TransInfo *t);
 void flushTransParticles(TransInfo *t);
 int clipUVTransform(TransInfo *t, float *vec, int resize);
+void clipUVData(TransInfo *t);
 void flushTransNodes(TransInfo *t);
 void flushTransSeq(TransInfo *t);
 void flushTransTracking(TransInfo *t);
index 0fdd873624853b811575cb71e675a47a093ad2a4..f5d9612e8327e67dd2b03196b74bf0cb3bd47488 100644 (file)
@@ -2494,6 +2494,26 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
        return (clipx || clipy);
 }
 
+void clipUVData(TransInfo *t)
+{
+       TransData *td = NULL;
+       int a;
+       float aspx, aspy;
+
+       ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
+
+       for (a = 0, td = t->data; a < t->total; a++, td++) {
+               if (td->flag & TD_NOACTION)
+                       break;
+
+               if ((td->flag & TD_SKIP) || (!td->loc))
+                       continue;
+
+               td->loc[0] = MIN2(MAX2(0.0f, td->loc[0]), aspx);
+               td->loc[1] = MIN2(MAX2(0.0f, td->loc[1]), aspy);
+       }
+}
+
 /* ********************* ANIMATION EDITORS (GENERAL) ************************* */
 
 /* This function tests if a point is on the "mouse" side of the cursor/frame-marking */
index 67e06b1c33ce788818f25a31ffd4f6f0cc1440d9..4154e363292445d5f95dbb0d6266120a9802f942 100644 (file)
@@ -3788,19 +3788,6 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
        WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
 
-       /* pivot */
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "space_data.uv_editor.pivot_point");
-       RNA_string_set(kmi->ptr, "value", "CENTER");
-
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_string_set(kmi->ptr, "data_path", "space_data.uv_editor.pivot_point");
-       RNA_string_set(kmi->ptr, "value", "MEDIAN");
-
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
-       RNA_string_set(kmi->ptr, "data_path", "space_data.uv_editor.pivot_point");
-       RNA_string_set(kmi->ptr, "value", "CURSOR");
-
        ED_keymap_proportional_cycle(keyconf, keymap);
        ED_keymap_proportional_editmode(keyconf, keymap, FALSE);
 
index f0395a4623179bfeea4263c97e833047a398691a..1db3e9678a4efebdc50167e10913ba9fceea3e39 100644 (file)
@@ -1166,13 +1166,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem pivot_items[] = {
-               {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
-               {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
-               {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-
        srna = RNA_def_struct(brna, "SpaceUVEditor", NULL);
        RNA_def_struct_sdna(srna, "SpaceImage");
        RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
@@ -1232,13 +1225,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Draw Faces", "Draw faces over the image");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
 
-       prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
-       RNA_def_property_array(prop, 2);
-       RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
-                                    "rna_SpaceImageEditor_cursor_location_set", NULL);
-       RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
        /* todo: move edge and face drawing options here from G.f */
 
        prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
@@ -1257,12 +1243,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Live Unwrap",
                                 "Continuously unwrap the selected UV island while transforming pinned vertices");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
-       prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "around");
-       RNA_def_property_enum_items(prop, pivot_items);
-       RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
 }
 
 static void rna_def_space_outliner(BlenderRNA *brna)
@@ -1978,6 +1958,13 @@ static void rna_def_space_image(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
+       static EnumPropertyItem pivot_items[] = {
+               {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
+               {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
+               {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
+               {0, NULL, 0, NULL, NULL}
+       };
+
        StructRNA *srna;
        PropertyRNA *prop;
 
@@ -2054,6 +2041,20 @@ static void rna_def_space_image(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
 
+       /* transform */
+       prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_array(prop, 2);
+       RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
+                                    "rna_SpaceImageEditor_cursor_location_set", NULL);
+       RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+       prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "around");
+       RNA_def_property_enum_items(prop, pivot_items);
+       RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
        /* grease pencil */
        prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "gpd");