Merging r46062 through r46073 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Sun, 29 Apr 2012 14:10:13 +0000 (14:10 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 29 Apr 2012 14:10:13 +0000 (14:10 +0000)
26 files changed:
intern/cycles/util/util_math.h
intern/cycles/util/util_types.h
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/intern/armature.c
source/blender/blenlib/BLI_math_vector.h
source/blender/blenlib/intern/math_vector.c
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/bmesh/intern/bmesh_operators_private.h
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/intern/bmesh_queries.h
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_wireframe.c [new file with mode: 0644]
source/blender/editors/include/ED_clip.h
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/windowmanager/intern/wm_event_system.c

index 33e351c74e9366f752b1583e92e685f9628ba504..53c1302b4a1168df554279c9f23eb64f41b81349 100644 (file)
@@ -541,7 +541,7 @@ __device_inline bool is_zero(const float3 a)
 #endif
 }
 
-__device_inline float reduce_add(const float3& a)
+__device_inline float reduce_add(const float3 a)
 {
 #ifdef __KERNEL_SSE__
        return (a.x + a.y + a.z);
index cf167707e47a3002defcf03028cb8068e54210bf..0451d877c45fb05381a10da8b2c5e0e2ac840e3c 100644 (file)
@@ -36,7 +36,7 @@
 #define __shared
 #define __constant
 
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(FREE_WINDOWS)
 #define __device_inline static __forceinline
 #define __align(...) __declspec(align(__VA_ARGS__))
 #else
index 9cf52056875075f08ca5f1df5e80fe8e3338d20e..ff9484e6baf599ef801557643e1d2ef1bb8d25ac 100644 (file)
@@ -1767,6 +1767,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
         layout.operator("mesh.inset")
         layout.operator("mesh.bevel")
         layout.operator("mesh.solidify")
+        layout.operator("mesh.wireframe")
         layout.operator("mesh.sort_faces")
 
         layout.separator()
index d1d6833e903cb29fc2297639a8984f35cbfea538..0827cb5cb14c3bd894973ab42d43e0f0ed0f2dd4 100644 (file)
@@ -1208,9 +1208,8 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
                else
                        mult_m4_m4m4(rotscale_mat, parchan->pose_mat, offs_bone);
 
-# if 1
                /* Compose the loc matrix for this bone. */
-               /* NOTE: That version deos not modify bone's loc when HINGE/NO_SCALE options are set. */
+               /* NOTE: That version does not modify bone's loc when HINGE/NO_SCALE options are set. */
 
                /* In this case, use the object's space *orientation*. */
                if (bone->flag & BONE_NO_LOCAL_LOCATION) {
@@ -1236,58 +1235,6 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
                /* Else (i.e. default, usual case), just use the same matrix for rotation/scaling, and location. */
                else
                        copy_m4_m4(loc_mat, rotscale_mat);
-# endif
-# if 0
-               /* Compose the loc matrix for this bone. */
-               /* NOTE: That version modifies bone's loc when HINGE/NO_SCALE options are set. */
-
-               /* In these cases we need to compute location separately */
-               if (bone->flag & (BONE_HINGE|BONE_NO_SCALE|BONE_NO_LOCAL_LOCATION)) {
-                       float bone_loc[4][4], bone_rotscale[3][3], tmat4[4][4], tmat3[3][3];
-                       unit_m4(bone_loc);
-                       unit_m4(loc_mat);
-                       unit_m4(tmat4);
-
-                       mul_v3_m4v3(bone_loc[3], parchan->pose_mat, offs_bone[3]);
-
-                       /* "No local location" is not transformed by bone matrix. */
-                       /* This only affects orientations (rotations), as scale is always 1.0 here. */
-                       if (bone->flag & BONE_NO_LOCAL_LOCATION)
-                               unit_m3(bone_rotscale);
-                       else
-                               /* We could also use bone->bone_mat directly, here... */
-                               copy_m3_m4(bone_rotscale, offs_bone);
-
-                       if (bone->flag & BONE_HINGE) {
-                               copy_m3_m4(tmat3, parbone->arm_mat);
-                               /* for hinge-only, we use armature *rotation*, but pose mat *scale*! */
-                               if (!(bone->flag & BONE_NO_SCALE)) {
-                                       float size[3], tsmat[3][3];
-                                       mat4_to_size(size, parchan->pose_mat);
-                                       size_to_mat3(tsmat, size);
-                                       mul_m3_m3m3(tmat3, tsmat, tmat3);
-                               }
-                               mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
-                       }
-                       else if (bone->flag & BONE_NO_SCALE) {
-                               /* For no-scale only, normalized parent pose mat is enough! */
-                               copy_m3_m4(tmat3, parchan->pose_mat);
-                               normalize_m3(tmat3);
-                               mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
-                       }
-                       /* NO_LOCAL_LOCATION only. */
-                       else {
-                               copy_m3_m4(tmat3, parchan->pose_mat);
-                               mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
-                       }
-
-                       copy_m4_m3(tmat4, bone_rotscale);
-                       mult_m4_m4m4(loc_mat, bone_loc, tmat4);
-               }
-               /* Else, just use the same matrix for rotation/scaling, and location. */
-               else
-                       copy_m4_m4(loc_mat, rotscale_mat);
-# endif
        }
        /* Root bones. */
        else {
@@ -2438,16 +2385,6 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
        /* Construct the posemat based on PoseChannels, that we do before applying constraints. */
        /* pose_mat(b) = pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
        armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat);
-#if 0 /* XXX Old code, will remove this later. */
-       {
-               float rotscale_mat[4][4], loc_mat[4][4];
-               pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
-               /* Rotation and scale. */
-               mult_m4_m4m4(pchan->pose_mat, rotscale_mat, pchan->chan_mat);
-               /* Location. */
-               mul_v3_m4v3(pchan->pose_mat[3], loc_mat, pchan->chan_mat[3]);
-       }
-#endif
 
        /* Only rootbones get the cyclic offset (unless user doesn't want that). */
        /* XXX That could be a problem for snapping and other "reverse transform" features... */
index af3df9c9ed29726504c75e36cabfdc96added31c..df5199e19e73a50d6e6e610f91cc3fb08fca4977 100644 (file)
@@ -186,6 +186,7 @@ float angle_normalized_v2v2(const float a[2], const float b[2]);
 float angle_v3v3(const float a[3], const float b[3]);
 float angle_v3v3v3(const float a[3], const float b[3], const float c[3]);
 float angle_normalized_v3v3(const float v1[3], const float v2[3]);
+float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]);
 void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3]);
 void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
 void angle_poly_v3(float* angles, const float* verts[3], int len);
index f734e01943f740605b02cf9a673f32671ffddfa2..90e6a4cb94531adc048ad8dcb44a969d27c4e06d 100644 (file)
@@ -217,6 +217,25 @@ float angle_normalized_v2v2(const float v1[2], const float v2[2])
                return 2.0f * (float)saasin(len_v2v2(v2, v1) / 2.0f);
 }
 
+/**
+ * angle between 2 vectors defined by 3 coords, about an axis. */
+float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3])
+{
+       float v1_proj[3], v2_proj[3], tproj[3];
+
+       sub_v3_v3v3(v1_proj, v1, v2);
+       sub_v3_v3v3(v2_proj, v3, v2);
+
+       /* project the vectors onto the axis */
+       project_v3_v3v3(tproj, v1_proj, axis);
+       sub_v3_v3(v1_proj, tproj);
+
+       project_v3_v3v3(tproj, v2_proj, axis);
+       sub_v3_v3(v2_proj, tproj);
+
+       return angle_v3v3(v1_proj, v2_proj);
+}
+
 void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3])
 {
        float ed1[3], ed2[3], ed3[3];
index 1cf2b9113b2a8805ceb08e2cc61286c5619a05a4..a23f1935ae054cf19df542bd40d4efe75ae6f077 100644 (file)
@@ -51,6 +51,7 @@ set(SRC
        operators/bmo_subdivide.h
        operators/bmo_triangulate.c
        operators/bmo_utils.c
+       operators/bmo_wireframe.c
 
        intern/bmesh_construct.c
        intern/bmesh_construct.h
index 4b5c67c86715ba054b0e312bde9540b47cce1780..af083fc30a66addfbd8e5f3aff22c0e7571ce1e2 100644 (file)
@@ -1108,6 +1108,26 @@ static BMOpDefine bmo_inset_def = {
        0
 };
 
+/*
+ * Wire Frame
+ *
+ * Makes a wire copy of faces.
+ */
+static BMOpDefine bmo_wireframe_def = {
+       "wireframe",
+       {{BMO_OP_SLOT_ELEMENT_BUF, "faces"},   /* input faces */
+        {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
+        {BMO_OP_SLOT_BOOL, "use_boundary"},
+        {BMO_OP_SLOT_BOOL, "use_even_offset"},
+        {BMO_OP_SLOT_BOOL, "use_crease"},
+        {BMO_OP_SLOT_FLT, "thickness"},
+        {BMO_OP_SLOT_BOOL, "use_relative_offset"},
+        {BMO_OP_SLOT_FLT, "depth"},
+        {0} /* null-terminating sentinel */},
+       bmo_wireframe_exec,
+       0
+};
+
 /*
  * Vertex Slide
  *
@@ -1192,6 +1212,7 @@ BMOpDefine *opdefines[] = {
        &bmo_bridge_loops_def,
        &bmo_solidify_def,
        &bmo_inset_def,
+       &bmo_wireframe_def,
        &bmo_vertex_slide_def,
 };
 
index 423b30a503afddf43644567bab0fe645d1fc198a..e222c3422c0584fca00260465753ad1c59c31f7b 100644 (file)
@@ -100,5 +100,6 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op);
 void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op);
 void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op);
 void bmo_inset_exec(BMesh *bm, BMOperator *op);
+void bmo_wireframe_exec(BMesh *bm, BMOperator *op);
 
 #endif /* __BMESH_OPERATORS_PRIVATE_H__ */
index 3543fd952bb954a1b035633ba8ea520c0792a569..e9a35ff70a239f07ea7d2226516c548ae4531a03 100644 (file)
@@ -927,6 +927,28 @@ float BM_vert_calc_shell_factor(BMVert *v)
        return accum_shell / accum_angle;
 }
 
+/**
+ * \note quite an obscure function.
+ * used in bmesh operators that have a relative scale options,
+ */
+float BM_vert_calc_mean_tagged_edge_length(BMVert *v)
+{
+       BMIter iter;
+       BMEdge *e;
+       int tot;
+       float length = 0.0f;
+
+       BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) {
+               BMVert *v_other = BM_edge_other_vert(e, v);
+               if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
+                       length += BM_edge_calc_length(e);
+               }
+       }
+
+       return length / (float)tot;
+}
+
+
 /**
  * Returns the edge existing between v1 and v2, or NULL if there isn't one.
  *
index aefeb80c4f39d316dfd9c5981ace06a23b534833..08e15884b3f35db61cc216d4cb1553a45d59b3a5 100644 (file)
@@ -65,6 +65,7 @@ void    BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3])
 
 float   BM_vert_calc_edge_angle(BMVert *v);
 float   BM_vert_calc_shell_factor(BMVert *v);
+float   BM_vert_calc_mean_tagged_edge_length(BMVert *v);
 
 BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
 
index 712f6b736d635cab8841bd17fdceb31ce1b9035b..e08f08baacdca44321151a42b30d7ec3d809f788 100644 (file)
@@ -80,23 +80,6 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
        }
 }
 
-float bm_vert_avg_tag_dist(BMVert *v)
-{
-       BMIter iter;
-       BMEdge *e;
-       int tot;
-       float length = 0.0f;
-
-       BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) {
-               BMVert *v_other = BM_edge_other_vert(e, v);
-               if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
-                       length += BM_edge_calc_length(e);
-               }
-       }
-
-       return length / (float)tot;
-}
-
 /**
  * implementation is as follows...
  *
@@ -544,7 +527,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
                BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
                        if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
                                const float fac = (depth *
-                                                  (use_relative_offset ? bm_vert_avg_tag_dist(v) : 1.0f) *
+                                                  (use_relative_offset ? BM_vert_calc_mean_tagged_edge_length(v) : 1.0f) *
                                                   (use_even_boundry    ? BM_vert_calc_shell_factor(v) : 1.0f));
                                madd_v3_v3v3fl(varr_co[i], v->co, v->no, fac);
                        }
diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c
new file mode 100644 (file)
index 0000000..7cb8ac0
--- /dev/null
@@ -0,0 +1,404 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_wireframe.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+BMLoop *bm_edge_tag_faceloop(BMEdge *e)
+{
+       BMLoop *l, *l_first;
+
+       l = l_first = e->l;
+       do {
+               if (BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
+                       return l;
+               }
+       } while ((l = l->radial_next) != l_first);
+
+       /* in the case this is used, we know this will never happen */
+       return NULL;
+}
+
+static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3],
+                                     BMVert **r_va_other, BMVert **r_vb_other)
+{
+       BMIter iter;
+       BMEdge *e_iter;
+
+       BMEdge *e_a = NULL, *e_b = NULL;
+       BMVert *v_a, *v_b;
+
+       BMLoop *l_a, *l_b;
+
+       float no_face[3], no_edge[3];
+       float tvec_a[3], tvec_b[3];
+
+       /* get 2 boundary edges, there should only _be_ 2,
+        * in case there are more - results wont be valid of course */
+       BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) {
+               if (BM_elem_flag_test(e_iter, BM_ELEM_TAG)) {
+                       if (e_a == NULL) {
+                               e_a = e_iter;
+                       }
+                       else {
+                               e_b = e_iter;
+                               break;
+                       }
+               }
+       }
+
+       l_a = bm_edge_tag_faceloop(e_a);
+       l_b = bm_edge_tag_faceloop(e_b);
+
+       /* average edge face normal */
+       add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
+
+       /* average edge direction */
+       v_a = BM_edge_other_vert(e_a, v);
+       v_b = BM_edge_other_vert(e_b, v);
+
+       sub_v3_v3v3(tvec_a, v->co, v_a->co);
+       sub_v3_v3v3(tvec_b, v_b->co, v->co);
+       normalize_v3(tvec_a);
+       normalize_v3(tvec_b);
+       add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
+
+
+       /* find the normal */
+       cross_v3_v3v3(r_no, no_edge, no_face);
+       normalize_v3(r_no);
+
+       /* check are we flipped the right way */
+       BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
+       BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
+       add_v3_v3(tvec_a, tvec_b);
+
+       if (dot_v3v3(r_no, tvec_a) > 0.0) {
+               negate_v3(r_no);
+       }
+
+       copy_v3_v3(r_no_face, no_face);
+       *r_va_other = v_a;
+       *r_vb_other = v_b;
+}
+
+/* check if we are the only tagged loop-face around this edge */
+static int bm_loop_is_radial_boundary(BMLoop *l_first)
+{
+       BMLoop *l = l_first->radial_next;
+
+       if (l == l_first) {
+               return TRUE; /* a real boundary */
+       }
+       else {
+               do {
+                       if (BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
+                               return FALSE;
+                       }
+               } while ((l = l->radial_next) != l_first);
+       }
+       return TRUE;
+}
+
+extern float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
+
+void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
+{
+       const int use_boundary        = BMO_slot_bool_get(op,  "use_boundary");
+       const int use_even_offset     = BMO_slot_bool_get(op,  "use_even_offset");
+       const int use_relative_offset = BMO_slot_bool_get(op,  "use_relative_offset");
+       const int use_crease          = (BMO_slot_bool_get(op,  "use_crease") &&
+                                        CustomData_has_layer(&bm->edata, CD_CREASE));
+       const float depth             = BMO_slot_float_get(op, "thickness");
+       const float inset             = depth;
+
+       const int totvert_orig = bm->totvert;
+
+       BMOIter oiter;
+       BMIter iter;
+       BMIter itersub;
+
+       /* filled only with boundary verts */
+       BMVert **verts_src      = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
+       BMVert **verts_neg      = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
+       BMVert **verts_pos      = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
+
+       /* will over-alloc, but makes for easy lookups by index to keep aligned  */
+       BMVert **verts_boundary = use_boundary ?
+                                 MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__) : NULL;
+
+       float  *verts_relfac    = use_relative_offset ?
+                                 MEM_mallocN(sizeof(float) * totvert_orig, __func__) : NULL;
+
+       /* may over-alloc if not all faces have wire */
+       BMVert **verts_loop;
+       int verts_loop_tot = 0;
+
+       BMVert *v_src;
+
+       BMFace *f_src;
+       BMLoop *l;
+
+       float tvec[3];
+       float fac;
+
+       int i;
+
+       BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+       BM_ITER_MESH_INDEX (v_src, &iter, bm, BM_VERTS_OF_MESH, i) {
+               BM_elem_flag_disable(v_src, BM_ELEM_TAG);
+               verts_src[i] = v_src;
+       }
+
+       /* setup tags, all faces and verts will be tagged which will be duplicated */
+       BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
+
+       BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+               verts_loop_tot += f_src->len;
+               BM_elem_flag_enable(f_src, BM_ELEM_TAG);
+               BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
+                       BM_elem_flag_enable(l->v, BM_ELEM_TAG);
+
+                       /* also tag boundary edges */
+                       BM_elem_flag_set(l->e, BM_ELEM_TAG, bm_loop_is_radial_boundary(l));
+               }
+       }
+
+       /* duplicate tagged verts */
+       for (i = 0, v_src = verts_src[i]; i < totvert_orig; i++, v_src = verts_src[i]) {
+               if (BM_elem_flag_test(v_src, BM_ELEM_TAG)) {
+                       fac = depth;
+
+                       if (use_relative_offset) {
+                               verts_relfac[i] = BM_vert_calc_mean_tagged_edge_length(v_src);
+                               fac *= verts_relfac[i];
+                       }
+
+                       madd_v3_v3v3fl(tvec, v_src->co, v_src->no, -fac);
+                       verts_neg[i] = BM_vert_create(bm, tvec, v_src);
+                       madd_v3_v3v3fl(tvec, v_src->co, v_src->no,  fac);
+                       verts_pos[i] = BM_vert_create(bm, tvec, v_src);
+               }
+               else {
+                       /* could skip this */
+                       verts_src[i] = NULL;
+                       verts_neg[i] = NULL;
+                       verts_pos[i] = NULL;
+               }
+
+               /* conflicts with BM_vert_calc_mean_tagged_edge_length */
+               if (use_relative_offset == FALSE) {
+                       BM_elem_flag_disable(v_src, BM_ELEM_TAG);
+               }
+       }
+
+       if (use_relative_offset) {
+               BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
+       }
+
+       verts_loop = MEM_mallocN(sizeof(BMVert **) * verts_loop_tot, __func__);
+       verts_loop_tot = 0; /* count up again */
+
+       BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+               BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
+                       BM_elem_index_set(l, verts_loop_tot); /* set_loop */
+
+                       BM_loop_calc_face_tangent(l, tvec);
+
+                       /* create offset vert */
+                       fac = inset;
+                       if (use_even_offset) {
+                               fac *= shell_angle_to_dist((M_PI - BM_loop_calc_face_angle(l)) * 0.5f);
+                       }
+                       if (use_relative_offset) {
+                               fac *= verts_relfac[BM_elem_index_get(l->v)];
+                       }
+
+                       madd_v3_v3v3fl(tvec, l->v->co, tvec, fac);
+                       verts_loop[verts_loop_tot] = BM_vert_create(bm, tvec, l->v);
+
+
+                       if (use_boundary) {
+                               if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) {  /* is this a boundary? */
+
+                                       BMLoop *l_pair[2] = {l, l->next};
+
+                                       BM_elem_flag_enable(l->e, BM_ELEM_TAG);
+                                       for (i = 0; i < 2; i++) {
+                                               if (!BM_elem_flag_test(l_pair[i]->v, BM_ELEM_TAG)) {
+                                                       float no_face[3];
+                                                       BMVert *va_other;
+                                                       BMVert *vb_other;
+
+                                                       BM_elem_flag_enable(l_pair[i]->v, BM_ELEM_TAG);
+
+                                                       bm_vert_boundary_tangent(l_pair[i]->v, tvec, no_face, &va_other, &vb_other);
+
+                                                       /* create offset vert */
+                                                       /* similar to code above but different angle calc */
+                                                       fac = inset;
+                                                       if (use_even_offset) {
+                                                               fac *= shell_angle_to_dist((M_PI - angle_on_axis_v3v3v3_v3(va_other->co,
+                                                                                                                          l_pair[i]->v->co,
+                                                                                                                          vb_other->co,
+                                                                                                                          no_face)) * 0.5f);
+                                                       }
+                                                       if (use_relative_offset) {
+                                                               fac *= verts_relfac[BM_elem_index_get(l_pair[i]->v)];
+                                                       }
+                                                       madd_v3_v3v3fl(tvec, l_pair[i]->v->co, tvec, fac);
+                                                       verts_boundary[BM_elem_index_get(l_pair[i]->v)] = BM_vert_create(bm, tvec, l_pair[i]->v);
+                                               }
+                                       }
+                               }
+                       }
+
+                       verts_loop_tot++;
+               }
+       }
+
+       BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+               BM_elem_flag_disable(f_src, BM_ELEM_TAG);
+               BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
+                       BMFace *f_new;
+                       BMLoop *l_new;
+                       BMLoop *l_next = l->next;
+                       BMVert *v_l1 = verts_loop[BM_elem_index_get(l)];
+                       BMVert *v_l2 = verts_loop[BM_elem_index_get(l_next)];
+
+                       BMVert *v_src_l1 = l->v;
+                       BMVert *v_src_l2 = l_next->v;
+
+                       const int i_1 = BM_elem_index_get(v_src_l1);
+                       const int i_2 = BM_elem_index_get(v_src_l2);
+
+                       BMVert *v_neg1 = verts_neg[i_1];
+                       BMVert *v_neg2 = verts_neg[i_2];
+
+                       BMVert *v_pos1 = verts_pos[i_1];
+                       BMVert *v_pos2 = verts_pos[i_2];
+
+                       f_new = BM_face_create_quad_tri(bm, v_l1, v_l2, v_neg2, v_neg1, f_src, FALSE);
+                       BM_elem_flag_enable(f_new, BM_ELEM_TAG);
+                       l_new = BM_FACE_FIRST_LOOP(f_new);
+
+                       BM_elem_attrs_copy(bm, bm, l,      l_new);
+                       BM_elem_attrs_copy(bm, bm, l,      l_new->prev);
+                       BM_elem_attrs_copy(bm, bm, l_next, l_new->next);
+                       BM_elem_attrs_copy(bm, bm, l_next, l_new->next->next);
+
+                       f_new = BM_face_create_quad_tri(bm, v_l2, v_l1, v_pos1, v_pos2, f_src, FALSE);
+                       BM_elem_flag_enable(f_new, BM_ELEM_TAG);
+                       l_new = BM_FACE_FIRST_LOOP(f_new);
+
+                       BM_elem_attrs_copy(bm, bm, l_next, l_new);
+                       BM_elem_attrs_copy(bm, bm, l_next, l_new->prev);
+                       BM_elem_attrs_copy(bm, bm, l,      l_new->next);
+                       BM_elem_attrs_copy(bm, bm, l,      l_new->next->next);
+
+                       if (use_boundary) {
+                               if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) {
+                                       /* we know its a boundary and this is the only face user (which is being wire'd) */
+                                       /* we know we only touch this edge/face once */
+                                       BMVert *v_b1 = verts_boundary[i_1];
+                                       BMVert *v_b2 = verts_boundary[i_2];
+
+                                       f_new = BM_face_create_quad_tri(bm, v_b2, v_b1, v_neg1, v_neg2, f_src, FALSE);
+                                       BM_elem_flag_enable(f_new, BM_ELEM_TAG);
+                                       l_new = BM_FACE_FIRST_LOOP(f_new);
+
+                                       BM_elem_attrs_copy(bm, bm, l_next, l_new);
+                                       BM_elem_attrs_copy(bm, bm, l_next, l_new->prev);
+                                       BM_elem_attrs_copy(bm, bm, l,      l_new->next);
+                                       BM_elem_attrs_copy(bm, bm, l,      l_new->next->next);
+
+                                       f_new = BM_face_create_quad_tri(bm, v_b1, v_b2, v_pos2, v_pos1, f_src, FALSE);
+                                       BM_elem_flag_enable(f_new, BM_ELEM_TAG);
+                                       l_new = BM_FACE_FIRST_LOOP(f_new);
+
+                                       BM_elem_attrs_copy(bm, bm, l,      l_new);
+                                       BM_elem_attrs_copy(bm, bm, l,      l_new->prev);
+                                       BM_elem_attrs_copy(bm, bm, l_next, l_new->next);
+                                       BM_elem_attrs_copy(bm, bm, l_next, l_new->next->next);
+
+                                       if (use_crease) {
+                                               BMEdge *e_new;
+                                               e_new = BM_edge_exists(v_pos1, v_b1);
+                                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+
+                                               e_new = BM_edge_exists(v_pos2, v_b2);
+                                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+
+                                               e_new = BM_edge_exists(v_neg1, v_b1);
+                                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+
+                                               e_new = BM_edge_exists(v_neg2, v_b2);
+                                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+                                       }
+                               }
+                       }
+
+                       if (use_crease) {
+                               BMEdge *e_new;
+                               e_new = BM_edge_exists(v_pos1, v_l1);
+                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+
+                               e_new = BM_edge_exists(v_pos2, v_l2);
+                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+
+                               e_new = BM_edge_exists(v_neg1, v_l1);
+                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+
+                               e_new = BM_edge_exists(v_neg2, v_l2);
+                               BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
+                       }
+
+               }
+       }
+
+       if (use_boundary) {
+               MEM_freeN(verts_boundary);
+       }
+
+       if (use_relative_offset) {
+               MEM_freeN(verts_relfac);
+       }
+
+       MEM_freeN(verts_src);
+       MEM_freeN(verts_neg);
+       MEM_freeN(verts_pos);
+       MEM_freeN(verts_loop);
+
+       BMO_slot_buffer_from_enabled_hflag(bm, op, "faceout", BM_FACE, BM_ELEM_TAG);
+}
index dd306d38765b8652aa6519060341b6533b3324f7..24d9fd3a297b4eaedca930bf7841548dfa017321 100644 (file)
@@ -42,6 +42,9 @@ struct wmEvent;
 
 /* clip_editor.c */
 int ED_space_clip_poll(struct bContext *C);
+int ED_space_clip_tracking_poll(struct bContext *C);
+int ED_space_clip_tracking_size_poll(struct bContext *C);
+int ED_space_clip_tracking_frame_poll(struct bContext *C);
 
 void ED_space_clip_set(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip);
 struct MovieClip *ED_space_clip(struct SpaceClip *sc);
@@ -64,6 +67,8 @@ int ED_space_clip_load_movieclip_buffer(struct SpaceClip *sc, struct ImBuf *ibuf
 void ED_space_clip_unload_movieclip_buffer(struct SpaceClip *sc);
 void ED_space_clip_free_texture_buffer(struct SpaceClip *sc);
 
+int ED_space_clip_show_trackedit(struct SpaceClip *sc);
+
 /* clip_ops.c */
 void ED_operatormacros_clip(void);
 
index 7eae8b4d67e2e508b5811e3af8f4054a8585106f..b650a361369a3152680aa370dde3094011fd501f 100644 (file)
@@ -4266,3 +4266,72 @@ void MESH_OT_inset(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "use_select_inset", TRUE, "Select Outer", "Select the new inset faces");
 }
 
+static int edbm_wireframe_exec(bContext *C, wmOperator *op)
+{
+       Object *obedit = CTX_data_edit_object(C);
+       BMEditMesh *em = BMEdit_FromObject(obedit);
+       BMOperator bmop;
+       const int use_boundary        = RNA_boolean_get(op->ptr, "use_boundary");
+       const int use_even_offset     = RNA_boolean_get(op->ptr, "use_even_offset");
+       const int use_replace         = RNA_boolean_get(op->ptr, "use_replace");
+       const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+       const int use_crease          = RNA_boolean_get(op->ptr, "use_crease");
+       const float thickness         = RNA_float_get(op->ptr,   "thickness");
+
+       EDBM_op_init(em, &bmop, op,
+                    "wireframe faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b use_crease=%b "
+                    "thickness=%f",
+                    BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, use_crease,
+                    thickness);
+
+       BMO_op_exec(em->bm, &bmop);
+
+       if (use_replace) {
+               BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
+               BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+
+               BMO_op_callf(em->bm, "del geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
+       }
+
+       BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
+       BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+
+       if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+               return OPERATOR_CANCELLED;
+       }
+       else {
+               EDBM_update_generic(C, em, TRUE);
+               return OPERATOR_FINISHED;
+       }
+}
+
+void MESH_OT_wireframe(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+
+       /* identifiers */
+       ot->name = "Wire Frame";
+       ot->idname = "MESH_OT_wireframe";
+       ot->description = "Inset new faces into selected faces";
+
+       /* api callbacks */
+       ot->exec = edbm_wireframe_exec;
+       ot->poll = ED_operator_editmesh;
+
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+       /* properties */
+       RNA_def_boolean(ot->srna, "use_boundary",        TRUE,  "Boundary",        "Inset face boundaries");
+       RNA_def_boolean(ot->srna, "use_even_offset",     TRUE,  "Offset Even",     "Scale the offset to give more even thickness");
+       RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry");
+       RNA_def_boolean(ot->srna, "use_crease",          FALSE, "Crease",          "Crease hub edges for improved subsurf");
+
+       prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f);
+       /* use 1 rather then 10 for max else dragging the button moves too far */
+       RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
+
+
+       RNA_def_boolean(ot->srna, "use_replace",         TRUE, "Replace", "Remove original faces");
+}
+
index b6403f33bc9a555bc1761135086b0541e0c94e9d..ca989a25ccd1bd403dba491ab214d30818d6943b 100644 (file)
@@ -211,6 +211,7 @@ void MESH_OT_bevel(struct wmOperatorType *ot);
 
 void MESH_OT_bridge_edge_loops(struct wmOperatorType *ot);
 void MESH_OT_inset(struct wmOperatorType *ot);
+void MESH_OT_wireframe(struct wmOperatorType *ot);
 void MESH_OT_vert_slide(struct wmOperatorType *ot);
 
 /* ******************* mesh_navmesh.c */
index 4b4fef53275317feccc5bf3bd77b14630aa94e6c..0b2a6d2bd6604157b1c7c831bce41108788f0d8f 100644 (file)
@@ -164,6 +164,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_wireframe);
        WM_operatortype_append(MESH_OT_edge_split);
 
 #ifdef WITH_GAMEENGINE
index 099c3c7532c555f691b89552e27d2ceb91e54aa5..69a8b0f4c92423efee63f99ff2e9f3a7b1648340 100644 (file)
@@ -37,6 +37,7 @@
 #include "BKE_movieclip.h"
 #include "BKE_context.h"
 #include "BKE_tracking.h"
+
 #include "DNA_object_types.h"  /* SELECT */
 
 #include "BLI_utildefines.h"
@@ -60,6 +61,8 @@
 
 #include "clip_intern.h"       // own include
 
+/* ******** operactor poll functions ******** */
+
 int ED_space_clip_poll(bContext *C)
 {
        SpaceClip *sc = CTX_wm_space_clip(C);
@@ -70,6 +73,51 @@ int ED_space_clip_poll(bContext *C)
        return FALSE;
 }
 
+int ED_space_clip_tracking_poll(bContext *C)
+{
+       SpaceClip *sc= CTX_wm_space_clip(C);
+
+       if (sc && sc->clip)
+               return ED_space_clip_show_trackedit(sc);
+
+       return FALSE;
+}
+
+int ED_space_clip_tracking_size_poll(bContext *C)
+{
+       if (ED_space_clip_tracking_poll(C)) {
+               MovieClip *clip = CTX_data_edit_movieclip(C);
+
+               if (clip) {
+                       SpaceClip *sc = CTX_wm_space_clip(C);
+                       int width, height;
+
+                       BKE_movieclip_get_size(clip, &sc->user, &width, &height);
+
+                       return width > 0 && height > 0;
+               }
+       }
+
+       return FALSE;
+}
+
+int ED_space_clip_tracking_frame_poll(bContext *C)
+{
+       if (ED_space_clip_tracking_poll(C)) {
+               MovieClip *clip = CTX_data_edit_movieclip(C);
+
+               if (clip) {
+                       SpaceClip *sc = CTX_wm_space_clip(C);
+
+                       return BKE_movieclip_has_frame(clip, &sc->user);
+               }
+       }
+
+       return FALSE;
+}
+
+/* ******** editing functions ******** */
+
 void ED_space_clip_set(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip)
 {
        MovieClip *old_clip;
@@ -508,3 +556,12 @@ void ED_space_clip_free_texture_buffer(SpaceClip *sc)
                MEM_freeN(context);
        }
 }
+
+int ED_space_clip_show_trackedit(SpaceClip *sc)
+{
+       if (sc) {
+               return ELEM3(sc->mode, SC_MODE_TRACKING, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION);
+       }
+
+       return FALSE;
+}
index 113c11995d1444a451f55addb2d3136cee0dcede..7ab41078e16d42500bf0d7ea9d41a5e2ab05830f 100644 (file)
@@ -63,9 +63,9 @@
 
 static int ED_space_clip_graph_poll(bContext *C)
 {
-       SpaceClip *sc = CTX_wm_space_clip(C);
+       if (ED_space_clip_tracking_poll(C)) {
+               SpaceClip *sc = CTX_wm_space_clip(C);
 
-       if (sc && sc->clip) {
                if (sc->view == SC_VIEW_GRAPH) {
                        ARegion *ar = CTX_wm_region(C);
 
@@ -488,7 +488,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke = WM_operator_confirm;
        ot->exec = delete_curve_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
index 9a5a7120a3df6a89b1db457bac50d96f8dd68102..80db32303cb5661af12b893adf9ac8e56beb71b4 100644 (file)
@@ -718,10 +718,13 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
 
        if (CTX_data_dir(member)) {
                CTX_data_dir_set(result, clip_context_dir);
+
                return TRUE;
        }
        else if (CTX_data_equals(member, "edit_movieclip")) {
-               CTX_data_id_pointer_set(result, &sc->clip->id);
+               if (sc->clip)
+                       CTX_data_id_pointer_set(result, &sc->clip->id);
+
                return TRUE;
        }
 
index f4454394ca314ee2686ab6ec3558be2b3b1b4e9c..b3bb7464761a946523a878e2b0f3e4c3e0a3e724 100644 (file)
 
 #include "clip_intern.h"       // own include
 
-static int space_clip_frame_poll(bContext *C)
-{
-       SpaceClip *sc = CTX_wm_space_clip(C);
-
-       if (sc) {
-               MovieClip *clip = ED_space_clip(sc);
-
-               if (clip)
-                       return BKE_movieclip_has_frame(clip, &sc->user);
-       }
-
-       return FALSE;
-}
-
-static int space_clip_size_poll(bContext *C)
-{
-       SpaceClip *sc = CTX_wm_space_clip(C);
-
-       if (sc) {
-               MovieClip *clip = ED_space_clip(sc);
-
-               if (clip) {
-                       int width, height;
-
-                       BKE_movieclip_get_size(clip, &sc->user, &width, &height);
-
-                       return width > 0 && height > 0;
-               }
-       }
-
-       return FALSE;
-}
-
 /********************** add marker operator *********************/
 
 static void add_marker(SpaceClip *sc, float x, float y)
@@ -175,7 +142,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke = add_marker_invoke;
        ot->exec = add_marker_exec;
-       ot->poll = space_clip_size_poll;
+       ot->poll = ED_space_clip_tracking_size_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -220,7 +187,7 @@ void CLIP_OT_delete_track(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke = WM_operator_confirm;
        ot->exec = delete_track_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -271,7 +238,7 @@ void CLIP_OT_delete_marker(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke = WM_operator_confirm;
        ot->exec = delete_marker_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -662,7 +629,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
        ot->idname = "CLIP_OT_slide_marker";
 
        /* api callbacks */
-       ot->poll = space_clip_size_poll;
+       ot->poll = ED_space_clip_tracking_size_poll;
        ot->invoke = slide_marker_invoke;
        ot->modal = slide_marker_modal;
 
@@ -876,7 +843,7 @@ void CLIP_OT_select(wmOperatorType *ot)
        /* api callbacks */
        ot->exec = select_exec;
        ot->invoke = select_invoke;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -953,7 +920,7 @@ void CLIP_OT_select_border(wmOperatorType *ot)
        ot->invoke = WM_border_select_invoke;
        ot->exec = border_select_exec;
        ot->modal = WM_border_select_modal;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -1037,7 +1004,7 @@ void CLIP_OT_select_circle(wmOperatorType *ot)
        ot->invoke = WM_gesture_circle_invoke;
        ot->modal = WM_gesture_circle_modal;
        ot->exec = circle_select_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1128,7 +1095,7 @@ void CLIP_OT_select_all(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = select_all_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1219,7 +1186,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = select_groped_exec;
-       ot->poll = space_clip_size_poll;
+       ot->poll = ED_space_clip_tracking_size_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1596,7 +1563,7 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
        /* api callbacks */
        ot->exec = track_markers_exec;
        ot->invoke = track_markers_invoke;
-       ot->poll = space_clip_frame_poll;
+       ot->poll = ED_space_clip_tracking_frame_poll;
        ot->modal = track_markers_modal;
 
        /* flags */
@@ -1819,7 +1786,7 @@ void CLIP_OT_solve_camera(wmOperatorType *ot)
        ot->exec = solve_camera_exec;
        ot->invoke = solve_camera_invoke;
        ot->modal = solve_camera_modal;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1867,7 +1834,7 @@ void CLIP_OT_clear_solution(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = clear_solution_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1919,7 +1886,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = clear_track_path_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1977,7 +1944,7 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = disable_markers_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2035,7 +2002,7 @@ static Object *get_orientation_object(bContext *C)
 
 static int set_orientation_poll(bContext *C)
 {
-       if (space_clip_size_poll(C)) {
+       if (ED_space_clip_tracking_size_poll(C)) {
                Scene *scene = CTX_data_scene(C);
                SpaceClip *sc = CTX_wm_space_clip(C);
                MovieClip *clip = ED_space_clip(sc);
@@ -2645,7 +2612,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
 
 static int set_solution_scale_poll(bContext *C)
 {
-       if (space_clip_size_poll(C)) {
+       if (ED_space_clip_tracking_size_poll(C)) {
                SpaceClip *sc = CTX_wm_space_clip(C);
                MovieClip *clip = ED_space_clip(sc);
                MovieTracking *tracking = &clip->tracking;
@@ -2723,7 +2690,7 @@ void CLIP_OT_set_center_principal(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = set_center_principal_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2777,7 +2744,7 @@ void CLIP_OT_hide_tracks(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = hide_tracks_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2816,7 +2783,7 @@ void CLIP_OT_hide_tracks_clear(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = hide_tracks_clear_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2898,7 +2865,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = detect_features_exec;
-       ot->poll = space_clip_frame_poll;
+       ot->poll = ED_space_clip_tracking_frame_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2993,7 +2960,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = frame_jump_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3050,7 +3017,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = join_tracks_exec;
-       ot->poll = space_clip_size_poll;
+       ot->poll = ED_space_clip_tracking_size_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3100,7 +3067,7 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = lock_tracks_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3150,7 +3117,7 @@ void CLIP_OT_track_copy_color(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = track_copy_color_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3199,7 +3166,7 @@ void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = stabilize_2d_add_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3259,7 +3226,7 @@ void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = stabilize_2d_remove_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3302,7 +3269,7 @@ void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = stabilize_2d_select_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3339,7 +3306,7 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = stabilize_2d_set_rotation_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3530,7 +3497,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
        /* api callbacks */
        ot->exec = clean_tracks_exec;
        ot->invoke = clean_tracks_invoke;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3567,7 +3534,7 @@ void CLIP_OT_tracking_object_new(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = tracking_object_new_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3605,7 +3572,7 @@ void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = tracking_object_remove_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3636,7 +3603,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = copy_tracks_exec;
-       ot->poll = ED_space_clip_poll;
+       ot->poll = ED_space_clip_tracking_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER;
@@ -3646,7 +3613,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
 
 static int paste_tracks_poll(bContext *C)
 {
-       if (ED_space_clip_poll(C)) {
+       if (ED_space_clip_tracking_poll(C)) {
                return BKE_tracking_clipboard_has_tracks();
        }
 
index 6214201a87d4b022a8efe7d1ad870363aff7491c..1b60a0a39acb41cc599711767afb3395023dd346 100644 (file)
@@ -516,6 +516,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
        if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) {
                ANIM_sync_animchannels_to_data(C);
                sipo->flag &= ~SIPO_TEMP_NEEDCHANSYNC;
+               ED_area_tag_redraw(sa);
        }
        
        /* init/adjust F-Curve colors */
@@ -551,21 +552,21 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
                                         * TODO: find a way to module the hue so that not all curves have same color...
                                         */
                                        float *col= fcu->color;
-
+                                       
                                        switch (fcu->array_index) {
-                                       case 0:
-                                               col[0]= 1.0f; col[1]= 0.0f; col[2]= 0.0f;
-                                               break;
-                                       case 1:
-                                               col[0]= 0.0f; col[1]= 1.0f; col[2]= 0.0f;
-                                               break;
-                                       case 2:
-                                               col[0]= 0.0f; col[1]= 0.0f; col[2]= 1.0f;
-                                               break;
-                                       default:
-                                               /* 'unknown' color - bluish so as to not conflict with handles */
-                                               col[0]= 0.3f; col[1]= 0.8f; col[2]= 1.0f;
-                                               break;
+                                               case 0:
+                                                       col[0] = 1.0f; col[1] = 0.0f; col[2] = 0.0f;
+                                                       break;
+                                               case 1:
+                                                       col[0] = 0.0f; col[1] = 1.0f; col[2] = 0.0f;
+                                                       break;
+                                               case 2:
+                                                       col[0] = 0.0f; col[1] = 0.0f; col[2] = 1.0f;
+                                                       break;
+                                               default:
+                                                       /* 'unknown' color - bluish so as to not conflict with handles */
+                                                       col[0] = 0.3f; col[1] = 0.8f; col[2] = 1.0f;
+                                                       break;
                                        }
                                }
                                        break;
@@ -596,55 +597,55 @@ void ED_spacetype_ipo(void)
        st->spaceid= SPACE_IPO;
        strncpy(st->name, "Graph", BKE_ST_MAXNAME);
        
-       st->new= graph_new;
-       st->free= graph_free;
-       st->init= graph_init;
-       st->duplicate= graph_duplicate;
-       st->operatortypes= graphedit_operatortypes;
-       st->keymap= graphedit_keymap;
-       st->listener= graph_listener;
-       st->refresh= graph_refresh;
+       st->new = graph_new;
+       st->free = graph_free;
+       st->init = graph_init;
+       st->duplicate = graph_duplicate;
+       st->operatortypes = graphedit_operatortypes;
+       st->keymap = graphedit_keymap;
+       st->listener = graph_listener;
+       st->refresh = graph_refresh;
        
        /* regions: main window */
-       art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+       art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
        art->regionid = RGN_TYPE_WINDOW;
-       art->init= graph_main_area_init;
-       art->draw= graph_main_area_draw;
-       art->listener= graph_region_listener;
-       art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+       art->init = graph_main_area_init;
+       art->draw = graph_main_area_draw;
+       art->listener = graph_region_listener;
+       art->keymapflag = ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
 
        BLI_addhead(&st->regiontypes, art);
        
        /* regions: header */
-       art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+       art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
        art->regionid = RGN_TYPE_HEADER;
-       art->prefsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
-       art->listener= graph_region_listener;
-       art->init= graph_header_area_init;
-       art->draw= graph_header_area_draw;
+       art->prefsizey = HEADERY;
+       art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
+       art->listener = graph_region_listener;
+       art->init = graph_header_area_init;
+       art->draw = graph_header_area_draw;
        
        BLI_addhead(&st->regiontypes, art);
        
        /* regions: channels */
-       art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+       art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
        art->regionid = RGN_TYPE_CHANNELS;
-       art->prefsizex= 200+V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
-       art->listener= graph_region_listener;
-       art->init= graph_channel_area_init;
-       art->draw= graph_channel_area_draw;
+       art->prefsizex = 200 + V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
+       art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->listener = graph_region_listener;
+       art->init = graph_channel_area_init;
+       art->draw = graph_channel_area_draw;
        
        BLI_addhead(&st->regiontypes, art);
        
        /* regions: UI buttons */
-       art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+       art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
        art->regionid = RGN_TYPE_UI;
-       art->prefsizex= 200;
-       art->keymapflag= ED_KEYMAP_UI;
-       art->listener= graph_region_listener;
-       art->init= graph_buttons_area_init;
-       art->draw= graph_buttons_area_draw;
+       art->prefsizex = 200;
+       art->keymapflag = ED_KEYMAP_UI;
+       art->listener = graph_region_listener;
+       art->init = graph_buttons_area_init;
+       art->draw = graph_buttons_area_draw;
        
        BLI_addhead(&st->regiontypes, art);
 
index 233719033c73ff75d5ba1a95635def45eec49ec3..fd21bd1922fde0aef8343c6561ac2cb4d18586ea 100644 (file)
@@ -225,7 +225,11 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
                adr[1]= out[1];
        }
        else if (t->spacetype==SPACE_CLIP) {
-               UI_view2d_to_region_no_clip(t->view, vec[0], vec[1], adr, adr+1);
+               float v[2];
+
+               copy_v2_v2(v, vec);
+
+               UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
        }
 }
 
@@ -274,6 +278,19 @@ void applyAspectRatio(TransInfo *t, float *vec)
                vec[0] /= aspx;
                vec[1] /= aspy;
        }
+       else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
+               if (t->options & CTX_MOVIECLIP) {
+                       SpaceClip *sc = t->sa->spacedata.first;
+                       float aspx, aspy;
+                       int width, height;
+
+                       ED_space_clip_size(sc, &width, &height);
+                       ED_space_clip_aspect(sc, &aspx, &aspy);
+
+                       vec[0] *= width / aspx;
+                       vec[1] *= height / aspy;
+               }
+       }
 }
 
 void removeAspectRatio(TransInfo *t, float *vec)
@@ -294,6 +311,19 @@ void removeAspectRatio(TransInfo *t, float *vec)
                vec[0] *= aspx;
                vec[1] *= aspy;
        }
+       else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
+               if (t->options & CTX_MOVIECLIP) {
+                       SpaceClip *sc = t->sa->spacedata.first;
+                       float aspx, aspy;
+                       int width, height;
+
+                       ED_space_clip_size(sc, &width, &height);
+                       ED_space_clip_aspect(sc, &aspx, &aspy);
+
+                       vec[0] *= aspx / width;
+                       vec[1] *= aspy / height;
+               }
+       }
 }
 
 static void viewRedrawForce(const bContext *C, TransInfo *t)
@@ -624,10 +654,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                        t->redraw |= TREDRAW_HARD;
                                }
                                else if (t->mode == TFM_TRANSLATION) {
-                                       if (t->options&CTX_MOVIECLIP) {
+                                       if(t->options & CTX_MOVIECLIP) {
                                                restoreTransObjects(t);
 
-                                               t->flag^= T_ALT_TRANSFORM;
+                                               t->flag ^= T_ALT_TRANSFORM;
                                                t->redraw |= TREDRAW_HARD;
                                        }
                                }
index 00c8e0a1d3445251b286c8b80a2fc9b5c364465a..c4edeefa598eafd7502f2ec41f46691fd59b1d9c 100644 (file)
@@ -424,51 +424,6 @@ static short apply_targetless_ik(Object *ob)
                                bone= parchan->bone;
                                bone->flag |= BONE_TRANSFORM;   /* ensures it gets an auto key inserted */
 
-       /* XXX Old code. Will remove it later. */
-#if 0
-                               if (parchan->parent) {
-                                       Bone *parbone= parchan->parent->bone;
-                                       float offs_bone[4][4];
-
-                                       /* offs_bone =  yoffs(b-1) + root(b) + bonemat(b) */
-                                       copy_m4_m3(offs_bone, bone->bone_mat);
-
-                                       /* The bone's root offset (is in the parent's coordinate system) */
-                                       copy_v3_v3(offs_bone[3], bone->head);
-
-                                       /* Get the length translation of parent (length along y axis) */
-                                       offs_bone[3][1]+= parbone->length;
-
-                                       /* pose_mat(b-1) * offs_bone */
-                                       if (parchan->bone->flag & BONE_HINGE) {
-                                               /* the rotation of the parent restposition */
-                                               copy_m4_m4(rmat, parbone->arm_mat);     /* rmat used as temp */
-
-                                               /* the location of actual parent transform */
-                                               copy_v3_v3(rmat[3], offs_bone[3]);
-                                               offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
-                                               mul_m4_v3(parchan->parent->pose_mat, rmat[3]);
-
-                                               mult_m4_m4m4(tmat, rmat, offs_bone);
-                                       }
-                                       else if (parchan->bone->flag & BONE_NO_SCALE) {
-                                               mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
-                                               normalize_m4(tmat);
-                                       }
-                                       else
-                                               mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
-
-                                       invert_m4_m4(imat, tmat);
-                               }
-                               else {
-                                       copy_m4_m3(tmat, bone->bone_mat);
-
-                                       copy_v3_v3(tmat[3], bone->head);
-                                       invert_m4_m4(imat, tmat);
-                               }
-                               /* result matrix */
-                               mult_m4_m4m4(rmat, imat, parchan->pose_mat);
-#endif
                                armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat);
 
                                /* apply and decompose, doesn't work for constraints or non-uniform scale well */
@@ -599,48 +554,6 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
                        mul_serie_m3(td->mtx, pmat, omat, NULL, NULL,NULL,NULL,NULL,NULL);
        }
 
-       /* XXX Old code. Will remove it later. */
-#if 0
-       if (ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION))
-               unit_m3(bmat);
-       else
-               copy_m3_m3(bmat, pchan->bone->bone_mat);
-
-       if (pchan->parent) {
-               if (pchan->bone->flag & BONE_HINGE) {
-                       copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
-                       if (!(pchan->bone->flag & BONE_NO_SCALE)) {
-                               float tsize[3], tsmat[3][3];
-                               mat4_to_size(tsize, pchan->parent->pose_mat);
-                               size_to_mat3(tsmat, tsize);
-                               mul_m3_m3m3(pmat, tsmat, pmat);
-                       }
-               }
-               else {
-                       copy_m3_m4(pmat, pchan->parent->pose_mat);
-                       if (pchan->bone->flag & BONE_NO_SCALE)
-                               normalize_m3(pmat);
-               }
-
-               if (constraints_list_needinv(t, &pchan->constraints)) {
-                       copy_m3_m4(tmat, pchan->constinv);
-                       invert_m3_m3(cmat, tmat);
-                       mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, NULL,NULL,NULL,NULL);
-               }
-               else
-                       mul_serie_m3(td->mtx, bmat, pmat, omat, NULL,NULL,NULL,NULL,NULL);
-       }
-       else {
-               if (constraints_list_needinv(t, &pchan->constraints)) {
-                       copy_m3_m4(tmat, pchan->constinv);
-                       invert_m3_m3(cmat, tmat);
-                       mul_serie_m3(td->mtx, bmat, omat, cmat, NULL,NULL,NULL,NULL,NULL);
-               }
-               else
-                       mul_m3_m3m3(td->mtx, omat, bmat);
-       }
-# endif
-
        invert_m3_m3(td->smtx, td->mtx);
 
        /* exceptional case: rotate the pose bone which also applies transformation
@@ -4924,14 +4837,16 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
                ED_node_link_intersect_test(t->sa, 0);
        }
        else if (t->spacetype == SPACE_CLIP) {
-               SpaceClip *sc = t->sa->spacedata.first;
-               MovieClip *clip = ED_space_clip(sc);
-
-               if (t->scene->nodetree) {
-                       /* tracks can be used for stabilization nodes,
-                        * flush update for such nodes */
-                       nodeUpdateID(t->scene->nodetree, &clip->id);
-                       WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+               if (t->options & CTX_MOVIECLIP) {
+                       SpaceClip *sc = t->sa->spacedata.first;
+                       MovieClip *clip = ED_space_clip(sc);
+
+                       if (t->scene->nodetree) {
+                               /* tracks can be used for stabilization nodes,
+                                * flush update for such nodes */
+                               nodeUpdateID(t->scene->nodetree, &clip->id);
+                               WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+                       }
                }
        }
        else if (t->spacetype == SPACE_ACTION) {
@@ -5402,6 +5317,8 @@ static void createTransNodeData(bContext *C, TransInfo *t)
 
 /* *** CLIP EDITOR *** */
 
+/* * motion tracking * */
+
 enum {
        transDataTracking_ModeTracks = 0,
        transDataTracking_ModeCurves = 1,
@@ -5923,7 +5840,8 @@ void createTransData(bContext *C, TransInfo *t)
        }
        else if (t->spacetype == SPACE_CLIP) {
                t->flag |= T_POINTS|T_2D_EDIT;
-               createTransTrackingData(C, t);
+               if (t->options & CTX_MOVIECLIP)
+                       createTransTrackingData(C, t);
        }
        else if (t->obedit) {
                t->ext = NULL;
index 217e0d36fceafb0df47fc23fe3a20c33ac0b7e6d..c1b995e8a539814067dd87e8ae46337cc38bd3e2 100644 (file)
@@ -633,15 +633,16 @@ static void recalcData_image(TransInfo *t)
 }
 
 /* helper for recalcData() - for Movie Clip transforms */
-static void recalcData_clip(TransInfo *t)
+static void recalcData_spaceclip(TransInfo *t)
 {
        SpaceClip *sc = t->sa->spacedata.first;
+
        MovieClip *clip = ED_space_clip(sc);
        ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
        MovieTrackingTrack *track;
-       
+
        flushTransTracking(t);
-       
+
        track = tracksbase->first;
        while (track) {
                if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
@@ -658,10 +659,10 @@ static void recalcData_clip(TransInfo *t)
                                        BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
                        }
                }
-               
+
                track = track->next;
        }
-       
+
        DAG_id_tag_update(&clip->id, 0);
 }
 
@@ -900,7 +901,7 @@ void recalcData(TransInfo *t)
                recalcData_view3d(t);
        }
        else if (t->spacetype == SPACE_CLIP) {
-               recalcData_clip(t);
+               recalcData_spaceclip(t);
        }
 }
 
index 78ad364b8e8fe61cd26a54e88aa8bdff4aa1782b..9ff71c72e7eb4c17f5ef9b5cd0fa2d34389ba1d0 100644 (file)
@@ -746,7 +746,7 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event)
        }
 }
 
-#if 0 /* disabling for 2.63 release, since we keep getting reports some menu items are leaving props undefined */
+#if 1 /* disabling for 2.63 release, since we keep getting reports some menu items are leaving props undefined */
 int WM_operator_last_properties_init(wmOperator *op)
 {
        int change = FALSE;