[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59355] trunk/blender/source/blender/ editors/mask/mask_ops.c: Clear cyclic flag if we didn' t copy the whole mask spline
Sergey Sharybin
sergey.vfx at gmail.com
Wed Aug 21 12:17:56 CEST 2013
Revision: 59355
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59355
Author: nazgul
Date: 2013-08-21 10:17:55 +0000 (Wed, 21 Aug 2013)
Log Message:
-----------
Clear cyclic flag if we didn't copy the whole mask spline
Modified Paths:
--------------
trunk/blender/source/blender/editors/mask/mask_ops.c
Modified: trunk/blender/source/blender/editors/mask/mask_ops.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_ops.c 2013-08-21 10:12:42 UTC (rev 59354)
+++ trunk/blender/source/blender/editors/mask/mask_ops.c 2013-08-21 10:17:55 UTC (rev 59355)
@@ -1489,6 +1489,7 @@
int i = 0;
while (i < spline->tot_point) {
int start = i, end = -1;
+ /* Find next selected segment. */
while (MASKPOINT_ISSEL_ANY(point)) {
BKE_mask_point_select_set(point, false);
end = i;
@@ -1502,21 +1503,27 @@
MaskSpline *new_spline = BKE_mask_spline_add(mask_layer);
MaskSplinePoint *new_point;
int b;
+
+ /* BKE_mask_spline_add might allocate the points, need to free them in this case. */
if (new_spline->points) {
MEM_freeN(new_spline->points);
}
+ /* Copy options from old spline. */
new_spline->flag = spline->flag;
new_spline->offset_mode = spline->offset_mode;
new_spline->weight_interp = spline->weight_interp;
new_spline->parent = spline->parent;
+ /* Allocate new points and copy them from old spline. */
new_spline->tot_point = end - start + 1;
new_spline->points = MEM_mallocN(sizeof(MaskSplinePoint) * new_spline->tot_point,
"duplicated mask points");
memcpy(new_spline->points, spline->points + start,
new_spline->tot_point * sizeof(MaskSplinePoint));
+
+ /* Select points and duplicate their UWs (if needed). */
for (b = 0, new_point = new_spline->points;
b < new_spline->tot_point;
b++, new_point++)
@@ -1527,6 +1534,14 @@
BKE_mask_point_select_set(new_point, true);
}
+ /* Clear cyclic flag if we didn't copy the whole spline. */
+ if (new_spline->flag & MASK_SPLINE_CYCLIC) {
+ if (start != 0 || end != spline->tot_point - 1) {
+ new_spline->flag &= ~MASK_SPLINE_CYCLIC;
+ }
+ }
+
+ /* Flush selection to splines. */
new_spline->flag |= SELECT;
spline->flag &= ~SELECT;
More information about the Bf-blender-cvs
mailing list