rename mask-objects to mask-layers.
This commit is contained in:
@@ -565,7 +565,7 @@ class CLIP_PT_tracking_camera(Panel):
|
|||||||
class CLIP_PT_mask_objects(Panel):
|
class CLIP_PT_mask_objects(Panel):
|
||||||
bl_space_type = 'CLIP_EDITOR'
|
bl_space_type = 'CLIP_EDITOR'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_label = "Mask Objects"
|
bl_label = "Mask Layers"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@@ -580,15 +580,15 @@ class CLIP_PT_mask_objects(Panel):
|
|||||||
mask = sc.mask
|
mask = sc.mask
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.template_list(mask, "objects",
|
row.template_list(mask, "layers",
|
||||||
mask, "active_object_index", rows=3)
|
mask, "active_layer_index", rows=3)
|
||||||
|
|
||||||
sub = row.column(align=True)
|
sub = row.column(align=True)
|
||||||
|
|
||||||
sub.operator("mask.object_new", icon='ZOOMIN', text="")
|
sub.operator("mask.layer_new", icon='ZOOMIN', text="")
|
||||||
sub.operator("mask.object_remove", icon='ZOOMOUT', text="")
|
sub.operator("mask.layer_remove", icon='ZOOMOUT', text="")
|
||||||
|
|
||||||
active = mask.objects.active
|
active = mask.layers.active
|
||||||
if active:
|
if active:
|
||||||
layout.prop(active, "name")
|
layout.prop(active, "name")
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ class CLIP_PT_active_mask_spline(Panel):
|
|||||||
mask = sc.mask
|
mask = sc.mask
|
||||||
|
|
||||||
if mask and sc.mode == 'MASKEDITING':
|
if mask and sc.mode == 'MASKEDITING':
|
||||||
return mask.objects.active and mask.objects.active.splines.active
|
return mask.layers.active and mask.layers.active.splines.active
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -620,7 +620,7 @@ class CLIP_PT_active_mask_spline(Panel):
|
|||||||
|
|
||||||
sc = context.space_data
|
sc = context.space_data
|
||||||
mask = sc.mask
|
mask = sc.mask
|
||||||
spline = mask.objects.active.splines.active
|
spline = mask.layers.active.splines.active
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.prop(spline, "weight_interpolation")
|
col.prop(spline, "weight_interpolation")
|
||||||
@@ -638,7 +638,7 @@ class CLIP_PT_active_mask_point(Panel):
|
|||||||
mask = sc.mask
|
mask = sc.mask
|
||||||
|
|
||||||
if mask and sc.mode == 'MASKEDITING':
|
if mask and sc.mode == 'MASKEDITING':
|
||||||
return mask.objects.active and mask.objects.active.splines.active_point
|
return mask.layers.active and mask.layers.active.splines.active_point
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -647,7 +647,7 @@ class CLIP_PT_active_mask_point(Panel):
|
|||||||
|
|
||||||
sc = context.space_data
|
sc = context.space_data
|
||||||
mask = sc.mask
|
mask = sc.mask
|
||||||
point = mask.objects.active.splines.active_point
|
point = mask.layers.active.splines.active_point
|
||||||
parent = point.parent
|
parent = point.parent
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
struct Main;
|
struct Main;
|
||||||
struct Mask;
|
struct Mask;
|
||||||
struct MaskParent;
|
struct MaskParent;
|
||||||
struct MaskObject;
|
struct MaskLayer;
|
||||||
struct MaskObjectShape;
|
struct MaskLayerShape;
|
||||||
struct MaskSpline;
|
struct MaskSpline;
|
||||||
struct MaskSplinePoint;
|
struct MaskSplinePoint;
|
||||||
struct MaskSplinePointUW;
|
struct MaskSplinePointUW;
|
||||||
@@ -42,20 +42,20 @@ struct Scene;
|
|||||||
struct MaskSplinePoint *BKE_mask_spline_point_array(struct MaskSpline *spline);
|
struct MaskSplinePoint *BKE_mask_spline_point_array(struct MaskSpline *spline);
|
||||||
struct MaskSplinePoint *BKE_mask_spline_point_array_from_point(struct MaskSpline *spline, struct MaskSplinePoint *point_ref);
|
struct MaskSplinePoint *BKE_mask_spline_point_array_from_point(struct MaskSpline *spline, struct MaskSplinePoint *point_ref);
|
||||||
|
|
||||||
/* mask objects */
|
/* mask layers */
|
||||||
struct MaskObject *BKE_mask_object_new(struct Mask *mask, const char *name);
|
struct MaskLayer *BKE_mask_layer_new(struct Mask *mask, const char *name);
|
||||||
struct MaskObject *BKE_mask_object_active(struct Mask *mask);
|
struct MaskLayer *BKE_mask_layer_active(struct Mask *mask);
|
||||||
void BKE_mask_object_active_set(struct Mask *mask, struct MaskObject *maskobj);
|
void BKE_mask_layer_active_set(struct Mask *mask, struct MaskLayer *masklay);
|
||||||
void BKE_mask_object_remove(struct Mask *mask, struct MaskObject *maskobj);
|
void BKE_mask_layer_remove(struct Mask *mask, struct MaskLayer *masklay);
|
||||||
|
|
||||||
void BKE_mask_object_free(struct MaskObject *maskobj);
|
void BKE_mask_layer_free(struct MaskLayer *masklay);
|
||||||
void BKE_mask_spline_free(struct MaskSpline *spline);
|
void BKE_mask_spline_free(struct MaskSpline *spline);
|
||||||
void BKE_mask_point_free(struct MaskSplinePoint *point);
|
void BKE_mask_point_free(struct MaskSplinePoint *point);
|
||||||
|
|
||||||
void BKE_mask_object_unique_name(struct Mask *mask, struct MaskObject *maskobj);
|
void BKE_mask_layer_unique_name(struct Mask *mask, struct MaskLayer *masklay);
|
||||||
|
|
||||||
/* splines */
|
/* splines */
|
||||||
struct MaskSpline *BKE_mask_spline_add(struct MaskObject *maskobj);
|
struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay);
|
||||||
int BKE_mask_spline_resolution(struct MaskSpline *spline, float max_seg_len);
|
int BKE_mask_spline_resolution(struct MaskSpline *spline, float max_seg_len);
|
||||||
|
|
||||||
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point, int dynamic_res, float max_dseg_len))[2];
|
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point, int dynamic_res, float max_dseg_len))[2];
|
||||||
@@ -107,31 +107,31 @@ void BKE_mask_calc_handles(struct Mask *mask);
|
|||||||
void BKE_mask_spline_ensure_deform(struct MaskSpline *spline);
|
void BKE_mask_spline_ensure_deform(struct MaskSpline *spline);
|
||||||
|
|
||||||
/* animation */
|
/* animation */
|
||||||
int BKE_mask_object_shape_totvert(struct MaskObject *maskobj);
|
int BKE_mask_layer_shape_totvert(struct MaskLayer *masklay);
|
||||||
void BKE_mask_object_shape_from_mask(struct MaskObject *maskobj, struct MaskObjectShape *maskobj_shape);
|
void BKE_mask_layer_shape_from_mask(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape);
|
||||||
void BKE_mask_object_shape_to_mask(struct MaskObject *maskobj, struct MaskObjectShape *maskobj_shape);
|
void BKE_mask_layer_shape_to_mask(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape);
|
||||||
void BKE_mask_object_shape_to_mask_interp(struct MaskObject *maskobj,
|
void BKE_mask_layer_shape_to_mask_interp(struct MaskLayer *masklay,
|
||||||
struct MaskObjectShape *maskobj_shape_a,
|
struct MaskLayerShape *masklay_shape_a,
|
||||||
struct MaskObjectShape *maskobj_shape_b,
|
struct MaskLayerShape *masklay_shape_b,
|
||||||
const float fac);
|
const float fac);
|
||||||
struct MaskObjectShape *BKE_mask_object_shape_find_frame(struct MaskObject *maskobj, int frame);
|
struct MaskLayerShape *BKE_mask_layer_shape_find_frame(struct MaskLayer *masklay, int frame);
|
||||||
int BKE_mask_object_shape_find_frame_range(struct MaskObject *maskobj, int frame,
|
int BKE_mask_layer_shape_find_frame_range(struct MaskLayer *masklay, int frame,
|
||||||
struct MaskObjectShape **r_maskobj_shape_a,
|
struct MaskLayerShape **r_masklay_shape_a,
|
||||||
struct MaskObjectShape **r_maskobj_shape_b);
|
struct MaskLayerShape **r_masklay_shape_b);
|
||||||
struct MaskObjectShape *BKE_mask_object_shape_varify_frame(struct MaskObject *maskobj, int frame);
|
struct MaskLayerShape *BKE_mask_layer_shape_varify_frame(struct MaskLayer *masklay, int frame);
|
||||||
void BKE_mask_object_shape_unlink(struct MaskObject *maskobj, struct MaskObjectShape *maskobj_shape);
|
void BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape);
|
||||||
void BKE_mask_object_shape_sort(struct MaskObject *maskobj);
|
void BKE_mask_layer_shape_sort(struct MaskLayer *masklay);
|
||||||
|
|
||||||
int BKE_mask_object_shape_spline_from_index(struct MaskObject *maskobj, int index,
|
int BKE_mask_layer_shape_spline_from_index(struct MaskLayer *masklay, int index,
|
||||||
struct MaskSpline **r_maskobj_shape, int *r_index);
|
struct MaskSpline **r_masklay_shape, int *r_index);
|
||||||
int BKE_mask_object_shape_spline_to_index(struct MaskObject *maskobj, struct MaskSpline *spline);
|
int BKE_mask_layer_shape_spline_to_index(struct MaskLayer *masklay, struct MaskSpline *spline);
|
||||||
|
|
||||||
int BKE_mask_object_shape_spline_index(struct MaskObject *maskobj, int index,
|
int BKE_mask_layer_shape_spline_index(struct MaskLayer *masklay, int index,
|
||||||
struct MaskSpline **r_maskobj_shape, int *r_index);
|
struct MaskSpline **r_masklay_shape, int *r_index);
|
||||||
void BKE_mask_object_shape_changed_add(struct MaskObject *maskobj, int index,
|
void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index,
|
||||||
int do_init, int do_init_interpolate);
|
int do_init, int do_init_interpolate);
|
||||||
|
|
||||||
void BKE_mask_object_shape_changed_remove(struct MaskObject *maskobj, int index, int count);
|
void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, int count);
|
||||||
|
|
||||||
/* rasterization */
|
/* rasterization */
|
||||||
void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer);
|
void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer);
|
||||||
|
|||||||
@@ -77,63 +77,63 @@ MaskSplinePoint *BKE_mask_spline_point_array_from_point(MaskSpline *spline, Mask
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mask objects */
|
/* mask layers */
|
||||||
|
|
||||||
MaskObject *BKE_mask_object_new(Mask *mask, const char *name)
|
MaskLayer *BKE_mask_layer_new(Mask *mask, const char *name)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = MEM_callocN(sizeof(MaskObject), "new mask object");
|
MaskLayer *masklay = MEM_callocN(sizeof(MaskLayer), __func__);
|
||||||
|
|
||||||
if (name && name[0])
|
if (name && name[0])
|
||||||
BLI_strncpy(maskobj->name, name, sizeof(maskobj->name));
|
BLI_strncpy(masklay->name, name, sizeof(masklay->name));
|
||||||
else
|
else
|
||||||
strcpy(maskobj->name, "MaskObject");
|
strcpy(masklay->name, "MaskLayer");
|
||||||
|
|
||||||
BLI_addtail(&mask->maskobjs, maskobj);
|
BLI_addtail(&mask->masklayers, masklay);
|
||||||
|
|
||||||
BKE_mask_object_unique_name(mask, maskobj);
|
BKE_mask_layer_unique_name(mask, masklay);
|
||||||
|
|
||||||
mask->tot_maskobj++;
|
mask->masklay_tot++;
|
||||||
|
|
||||||
maskobj->alpha = 1.0f;
|
masklay->alpha = 1.0f;
|
||||||
|
|
||||||
return maskobj;
|
return masklay;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* note: may still be hidden, caller needs to check */
|
/* note: may still be hidden, caller needs to check */
|
||||||
MaskObject *BKE_mask_object_active(Mask *mask)
|
MaskLayer *BKE_mask_layer_active(Mask *mask)
|
||||||
{
|
{
|
||||||
return BLI_findlink(&mask->maskobjs, mask->act_maskobj);
|
return BLI_findlink(&mask->masklayers, mask->masklay_act);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_active_set(Mask *mask, MaskObject *maskobj)
|
void BKE_mask_layer_active_set(Mask *mask, MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
mask->act_maskobj = BLI_findindex(&mask->maskobjs, maskobj);
|
mask->masklay_act = BLI_findindex(&mask->masklayers, masklay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_remove(Mask *mask, MaskObject *maskobj)
|
void BKE_mask_layer_remove(Mask *mask, MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
BLI_remlink(&mask->maskobjs, maskobj);
|
BLI_remlink(&mask->masklayers, masklay);
|
||||||
BKE_mask_object_free(maskobj);
|
BKE_mask_layer_free(masklay);
|
||||||
|
|
||||||
mask->tot_maskobj--;
|
mask->masklay_tot--;
|
||||||
|
|
||||||
if (mask->act_maskobj >= mask->tot_maskobj)
|
if (mask->masklay_act >= mask->masklay_tot)
|
||||||
mask->act_maskobj = mask->tot_maskobj - 1;
|
mask->masklay_act = mask->masklay_tot - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_unique_name(Mask *mask, MaskObject *maskobj)
|
void BKE_mask_layer_unique_name(Mask *mask, MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
BLI_uniquename(&mask->maskobjs, maskobj, "MaskObject", '.', offsetof(MaskObject, name), sizeof(maskobj->name));
|
BLI_uniquename(&mask->masklayers, masklay, "MaskLayer", '.', offsetof(MaskLayer, name), sizeof(masklay->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* splines */
|
/* splines */
|
||||||
|
|
||||||
MaskSpline *BKE_mask_spline_add(MaskObject *maskobj)
|
MaskSpline *BKE_mask_spline_add(MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
spline = MEM_callocN(sizeof(MaskSpline), "new mask spline");
|
spline = MEM_callocN(sizeof(MaskSpline), "new mask spline");
|
||||||
BLI_addtail(&maskobj->splines, spline);
|
BLI_addtail(&masklay->splines, spline);
|
||||||
|
|
||||||
/* spline shall have one point at least */
|
/* spline shall have one point at least */
|
||||||
spline->points = MEM_callocN(sizeof(MaskSplinePoint), "new mask spline point");
|
spline->points = MEM_callocN(sizeof(MaskSplinePoint), "new mask spline point");
|
||||||
@@ -747,54 +747,54 @@ void BKE_mask_spline_free(MaskSpline *spline)
|
|||||||
MEM_freeN(spline);
|
MEM_freeN(spline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_shape_free(MaskObjectShape *maskobj_shape)
|
void BKE_mask_layer_shape_free(MaskLayerShape *masklay_shape)
|
||||||
{
|
{
|
||||||
MEM_freeN(maskobj_shape->data);
|
MEM_freeN(masklay_shape->data);
|
||||||
|
|
||||||
MEM_freeN(maskobj_shape);
|
MEM_freeN(masklay_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_free(MaskObject *maskobj)
|
void BKE_mask_layer_free(MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
/* free splines */
|
/* free splines */
|
||||||
spline = maskobj->splines.first;
|
spline = masklay->splines.first;
|
||||||
while (spline) {
|
while (spline) {
|
||||||
MaskSpline *next_spline = spline->next;
|
MaskSpline *next_spline = spline->next;
|
||||||
|
|
||||||
BLI_remlink(&maskobj->splines, spline);
|
BLI_remlink(&masklay->splines, spline);
|
||||||
BKE_mask_spline_free(spline);
|
BKE_mask_spline_free(spline);
|
||||||
|
|
||||||
spline = next_spline;
|
spline = next_spline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free animation data */
|
/* free animation data */
|
||||||
maskobj_shape = maskobj->splines_shapes.first;
|
masklay_shape = masklay->splines_shapes.first;
|
||||||
while (maskobj_shape) {
|
while (masklay_shape) {
|
||||||
MaskObjectShape *next_maskobj_shape = maskobj_shape->next;
|
MaskLayerShape *next_masklay_shape = masklay_shape->next;
|
||||||
|
|
||||||
BLI_remlink(&maskobj->splines_shapes, maskobj_shape);
|
BLI_remlink(&masklay->splines_shapes, masklay_shape);
|
||||||
BKE_mask_object_shape_free(maskobj_shape);
|
BKE_mask_layer_shape_free(masklay_shape);
|
||||||
|
|
||||||
maskobj_shape = next_maskobj_shape;
|
masklay_shape = next_masklay_shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_freeN(maskobj);
|
MEM_freeN(masklay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_free(Mask *mask)
|
void BKE_mask_free(Mask *mask)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = mask->maskobjs.first;
|
MaskLayer *masklay = mask->masklayers.first;
|
||||||
|
|
||||||
while (maskobj) {
|
while (masklay) {
|
||||||
MaskObject *next_maskobj = maskobj->next;
|
MaskLayer *next_masklay = masklay->next;
|
||||||
|
|
||||||
BLI_remlink(&mask->maskobjs, maskobj);
|
BLI_remlink(&mask->masklayers, masklay);
|
||||||
BKE_mask_object_free(maskobj);
|
BKE_mask_layer_free(masklay);
|
||||||
|
|
||||||
maskobj = next_maskobj;
|
masklay = next_masklay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1107,12 +1107,12 @@ void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplineP
|
|||||||
|
|
||||||
void BKE_mask_calc_handles(Mask *mask)
|
void BKE_mask_calc_handles(Mask *mask)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
@@ -1129,12 +1129,12 @@ void BKE_mask_calc_handles(Mask *mask)
|
|||||||
|
|
||||||
void BKE_mask_update_deform(Mask *mask)
|
void BKE_mask_update_deform(Mask *mask)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
@@ -1192,35 +1192,35 @@ void BKE_mask_spline_ensure_deform(MaskSpline *spline)
|
|||||||
|
|
||||||
void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe)
|
void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
|
|
||||||
/* animation if available */
|
/* animation if available */
|
||||||
if (do_newframe) {
|
if (do_newframe) {
|
||||||
MaskObjectShape *maskobj_shape_a;
|
MaskLayerShape *masklay_shape_a;
|
||||||
MaskObjectShape *maskobj_shape_b;
|
MaskLayerShape *masklay_shape_b;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
if ((found = BKE_mask_object_shape_find_frame_range(maskobj, (int)ctime,
|
if ((found = BKE_mask_layer_shape_find_frame_range(masklay, (int)ctime,
|
||||||
&maskobj_shape_a, &maskobj_shape_b)))
|
&masklay_shape_a, &masklay_shape_b)))
|
||||||
{
|
{
|
||||||
if (found == 1) {
|
if (found == 1) {
|
||||||
#if 0
|
#if 0
|
||||||
printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_countlist(&maskobj->splines_shapes),
|
printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
|
||||||
maskobj_shape_a->frame);
|
masklay_shape_a->frame);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BKE_mask_object_shape_to_mask(maskobj, maskobj_shape_a);
|
BKE_mask_layer_shape_to_mask(masklay, masklay_shape_a);
|
||||||
}
|
}
|
||||||
else if (found == 2) {
|
else if (found == 2) {
|
||||||
float w = maskobj_shape_b->frame - maskobj_shape_a->frame;
|
float w = masklay_shape_b->frame - masklay_shape_a->frame;
|
||||||
#if 0
|
#if 0
|
||||||
printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_countlist(&maskobj->splines_shapes),
|
printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
|
||||||
maskobj_shape_a->frame, maskobj_shape_b->frame);
|
masklay_shape_a->frame, masklay_shape_b->frame);
|
||||||
#endif
|
#endif
|
||||||
BKE_mask_object_shape_to_mask_interp(maskobj, maskobj_shape_a, maskobj_shape_b,
|
BKE_mask_layer_shape_to_mask_interp(masklay, masklay_shape_a, masklay_shape_b,
|
||||||
(ctime - maskobj_shape_a->frame) / w);
|
(ctime - masklay_shape_a->frame) / w);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* always fail, should never happen */
|
/* always fail, should never happen */
|
||||||
@@ -1234,11 +1234,11 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe)
|
|||||||
BKE_mask_calc_handles(mask);
|
BKE_mask_calc_handles(mask);
|
||||||
|
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
|
|
||||||
BKE_mask_spline_ensure_deform(spline);
|
BKE_mask_spline_ensure_deform(spline);
|
||||||
|
|
||||||
@@ -1267,12 +1267,12 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe)
|
|||||||
void BKE_mask_update_display(Mask *mask, float ctime)
|
void BKE_mask_update_display(Mask *mask, float ctime)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
if (spline->points_deform) {
|
if (spline->points_deform) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -1324,21 +1324,21 @@ void BKE_mask_parent_init(MaskParent *parent)
|
|||||||
|
|
||||||
|
|
||||||
/* *** own animation/shapekey implimentation ***
|
/* *** own animation/shapekey implimentation ***
|
||||||
* BKE_mask_object_shape_XXX */
|
* BKE_mask_layer_shape_XXX */
|
||||||
|
|
||||||
int BKE_mask_object_shape_totvert(MaskObject *maskobj)
|
int BKE_mask_layer_shape_totvert(MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
int tot = 0;
|
int tot = 0;
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
tot += spline->tot_point;
|
tot += spline->tot_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tot;
|
return tot;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mask_object_shape_from_mask_point(BezTriple *bezt, float fp[MASK_OBJECT_SHAPE_ELEM_SIZE])
|
static void mask_layer_shape_from_mask_point(BezTriple *bezt, float fp[MASK_OBJECT_SHAPE_ELEM_SIZE])
|
||||||
{
|
{
|
||||||
copy_v2_v2(&fp[0], bezt->vec[0]);
|
copy_v2_v2(&fp[0], bezt->vec[0]);
|
||||||
copy_v2_v2(&fp[2], bezt->vec[1]);
|
copy_v2_v2(&fp[2], bezt->vec[1]);
|
||||||
@@ -1347,7 +1347,7 @@ static void mask_object_shape_from_mask_point(BezTriple *bezt, float fp[MASK_OBJ
|
|||||||
fp[7] = bezt->radius;
|
fp[7] = bezt->radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mask_object_shape_to_mask_point(BezTriple *bezt, float fp[MASK_OBJECT_SHAPE_ELEM_SIZE])
|
static void mask_layer_shape_to_mask_point(BezTriple *bezt, float fp[MASK_OBJECT_SHAPE_ELEM_SIZE])
|
||||||
{
|
{
|
||||||
copy_v2_v2(bezt->vec[0], &fp[0]);
|
copy_v2_v2(bezt->vec[0], &fp[0]);
|
||||||
copy_v2_v2(bezt->vec[1], &fp[2]);
|
copy_v2_v2(bezt->vec[1], &fp[2]);
|
||||||
@@ -1357,47 +1357,47 @@ static void mask_object_shape_to_mask_point(BezTriple *bezt, float fp[MASK_OBJEC
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* these functions match. copy is swapped */
|
/* these functions match. copy is swapped */
|
||||||
void BKE_mask_object_shape_from_mask(MaskObject *maskobj, MaskObjectShape *maskobj_shape)
|
void BKE_mask_layer_shape_from_mask(MaskLayer *masklay, MaskLayerShape *masklay_shape)
|
||||||
{
|
{
|
||||||
int tot = BKE_mask_object_shape_totvert(maskobj);
|
int tot = BKE_mask_layer_shape_totvert(masklay);
|
||||||
|
|
||||||
if (maskobj_shape->tot_vert == tot) {
|
if (masklay_shape->tot_vert == tot) {
|
||||||
float *fp = maskobj_shape->data;
|
float *fp = masklay_shape->data;
|
||||||
|
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
mask_object_shape_from_mask_point(&spline->points[i].bezt, fp);
|
mask_layer_shape_from_mask_point(&spline->points[i].bezt, fp);
|
||||||
fp += MASK_OBJECT_SHAPE_ELEM_SIZE;
|
fp += MASK_OBJECT_SHAPE_ELEM_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
||||||
__func__, maskobj_shape->tot_vert, tot, maskobj_shape->frame);
|
__func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_shape_to_mask(MaskObject *maskobj, MaskObjectShape *maskobj_shape)
|
void BKE_mask_layer_shape_to_mask(MaskLayer *masklay, MaskLayerShape *masklay_shape)
|
||||||
{
|
{
|
||||||
int tot = BKE_mask_object_shape_totvert(maskobj);
|
int tot = BKE_mask_layer_shape_totvert(masklay);
|
||||||
|
|
||||||
if (maskobj_shape->tot_vert == tot) {
|
if (masklay_shape->tot_vert == tot) {
|
||||||
float *fp = maskobj_shape->data;
|
float *fp = masklay_shape->data;
|
||||||
|
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
mask_object_shape_to_mask_point(&spline->points[i].bezt, fp);
|
mask_layer_shape_to_mask_point(&spline->points[i].bezt, fp);
|
||||||
fp += MASK_OBJECT_SHAPE_ELEM_SIZE;
|
fp += MASK_OBJECT_SHAPE_ELEM_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
||||||
__func__, maskobj_shape->tot_vert, tot, maskobj_shape->frame);
|
__func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1409,23 +1409,23 @@ BLI_INLINE void interp_v2_v2v2_flfl(float target[2], const float a[2], const flo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* linear interpolation only */
|
/* linear interpolation only */
|
||||||
void BKE_mask_object_shape_to_mask_interp(MaskObject *maskobj,
|
void BKE_mask_layer_shape_to_mask_interp(MaskLayer *masklay,
|
||||||
MaskObjectShape *maskobj_shape_a,
|
MaskLayerShape *masklay_shape_a,
|
||||||
MaskObjectShape *maskobj_shape_b,
|
MaskLayerShape *masklay_shape_b,
|
||||||
const float fac)
|
const float fac)
|
||||||
{
|
{
|
||||||
int tot = BKE_mask_object_shape_totvert(maskobj);
|
int tot = BKE_mask_layer_shape_totvert(masklay);
|
||||||
if (maskobj_shape_a->tot_vert == tot && maskobj_shape_b->tot_vert == tot) {
|
if (masklay_shape_a->tot_vert == tot && masklay_shape_b->tot_vert == tot) {
|
||||||
float *fp_a = maskobj_shape_a->data;
|
float *fp_a = masklay_shape_a->data;
|
||||||
float *fp_b = maskobj_shape_b->data;
|
float *fp_b = masklay_shape_b->data;
|
||||||
const float ifac = 1.0f - fac;
|
const float ifac = 1.0f - fac;
|
||||||
|
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
BezTriple *bezt = &spline->points[i].bezt;
|
BezTriple *bezt = &spline->points[i].bezt;
|
||||||
/* *** BKE_mask_object_shape_from_mask - swapped *** */
|
/* *** BKE_mask_layer_shape_from_mask - swapped *** */
|
||||||
interp_v2_v2v2_flfl(bezt->vec[0], fp_a, fp_b, fac, ifac); fp_a += 2; fp_b += 2;
|
interp_v2_v2v2_flfl(bezt->vec[0], fp_a, fp_b, fac, ifac); fp_a += 2; fp_b += 2;
|
||||||
interp_v2_v2v2_flfl(bezt->vec[1], fp_a, fp_b, fac, ifac); fp_a += 2; fp_b += 2;
|
interp_v2_v2v2_flfl(bezt->vec[1], fp_a, fp_b, fac, ifac); fp_a += 2; fp_b += 2;
|
||||||
interp_v2_v2v2_flfl(bezt->vec[2], fp_a, fp_b, fac, ifac); fp_a += 2; fp_b += 2;
|
interp_v2_v2v2_flfl(bezt->vec[2], fp_a, fp_b, fac, ifac); fp_a += 2; fp_b += 2;
|
||||||
@@ -1436,23 +1436,23 @@ void BKE_mask_object_shape_to_mask_interp(MaskObject *maskobj,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%s: vert mismatch %d != %d != %d (frame %d - %d)\n",
|
printf("%s: vert mismatch %d != %d != %d (frame %d - %d)\n",
|
||||||
__func__, maskobj_shape_a->tot_vert, maskobj_shape_b->tot_vert, tot,
|
__func__, masklay_shape_a->tot_vert, masklay_shape_b->tot_vert, tot,
|
||||||
maskobj_shape_a->frame, maskobj_shape_b->frame);
|
masklay_shape_a->frame, masklay_shape_b->frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MaskObjectShape *BKE_mask_object_shape_find_frame(MaskObject *maskobj, int frame)
|
MaskLayerShape *BKE_mask_layer_shape_find_frame(MaskLayer *masklay, int frame)
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
for (masklay_shape = masklay->splines_shapes.first;
|
||||||
maskobj_shape;
|
masklay_shape;
|
||||||
maskobj_shape = maskobj_shape->next)
|
masklay_shape = masklay_shape->next)
|
||||||
{
|
{
|
||||||
if (frame == maskobj_shape->frame) {
|
if (frame == masklay_shape->frame) {
|
||||||
return maskobj_shape;
|
return masklay_shape;
|
||||||
}
|
}
|
||||||
else if (frame < maskobj_shape->frame) {
|
else if (frame < masklay_shape->frame) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1461,106 +1461,106 @@ MaskObjectShape *BKE_mask_object_shape_find_frame(MaskObject *maskobj, int frame
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* when returning 2 - the frame isnt found but before/after frames are */
|
/* when returning 2 - the frame isnt found but before/after frames are */
|
||||||
int BKE_mask_object_shape_find_frame_range(MaskObject *maskobj, int frame,
|
int BKE_mask_layer_shape_find_frame_range(MaskLayer *masklay, int frame,
|
||||||
MaskObjectShape **r_maskobj_shape_a,
|
MaskLayerShape **r_masklay_shape_a,
|
||||||
MaskObjectShape **r_maskobj_shape_b)
|
MaskLayerShape **r_masklay_shape_b)
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
for (masklay_shape = masklay->splines_shapes.first;
|
||||||
maskobj_shape;
|
masklay_shape;
|
||||||
maskobj_shape = maskobj_shape->next)
|
masklay_shape = masklay_shape->next)
|
||||||
{
|
{
|
||||||
if (frame == maskobj_shape->frame) {
|
if (frame == masklay_shape->frame) {
|
||||||
*r_maskobj_shape_a = maskobj_shape;
|
*r_masklay_shape_a = masklay_shape;
|
||||||
*r_maskobj_shape_b = NULL;
|
*r_masklay_shape_b = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (frame < maskobj_shape->frame) {
|
else if (frame < masklay_shape->frame) {
|
||||||
if (maskobj_shape->prev) {
|
if (masklay_shape->prev) {
|
||||||
*r_maskobj_shape_a = maskobj_shape->prev;
|
*r_masklay_shape_a = masklay_shape->prev;
|
||||||
*r_maskobj_shape_b = maskobj_shape;
|
*r_masklay_shape_b = masklay_shape;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*r_maskobj_shape_a = maskobj_shape;
|
*r_masklay_shape_a = masklay_shape;
|
||||||
*r_maskobj_shape_b = NULL;
|
*r_masklay_shape_b = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*r_maskobj_shape_a = NULL;
|
*r_masklay_shape_a = NULL;
|
||||||
*r_maskobj_shape_b = NULL;
|
*r_masklay_shape_b = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaskObjectShape *BKE_mask_object_shape_varify_frame(MaskObject *maskobj, int frame)
|
MaskLayerShape *BKE_mask_layer_shape_varify_frame(MaskLayer *masklay, int frame)
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
maskobj_shape = BKE_mask_object_shape_find_frame(maskobj, frame);
|
masklay_shape = BKE_mask_layer_shape_find_frame(masklay, frame);
|
||||||
|
|
||||||
if (maskobj_shape == NULL) {
|
if (masklay_shape == NULL) {
|
||||||
int tot_vert = BKE_mask_object_shape_totvert(maskobj);
|
int tot_vert = BKE_mask_layer_shape_totvert(masklay);
|
||||||
|
|
||||||
maskobj_shape = MEM_mallocN(sizeof(MaskObjectShape), __func__);
|
masklay_shape = MEM_mallocN(sizeof(MaskLayerShape), __func__);
|
||||||
maskobj_shape->frame = frame;
|
masklay_shape->frame = frame;
|
||||||
maskobj_shape->tot_vert = tot_vert;
|
masklay_shape->tot_vert = tot_vert;
|
||||||
maskobj_shape->data = MEM_mallocN(tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, __func__);
|
masklay_shape->data = MEM_mallocN(tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, __func__);
|
||||||
|
|
||||||
BLI_addtail(&maskobj->splines_shapes, maskobj_shape);
|
BLI_addtail(&masklay->splines_shapes, masklay_shape);
|
||||||
|
|
||||||
BKE_mask_object_shape_sort(maskobj);
|
BKE_mask_layer_shape_sort(masklay);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
for (masklay_shape = masklay->splines_shapes.first;
|
||||||
maskobj_shape;
|
masklay_shape;
|
||||||
maskobj_shape = maskobj_shape->next)
|
masklay_shape = masklay_shape->next)
|
||||||
{
|
{
|
||||||
printf("mask %d, %d\n", i++, maskobj_shape->frame);
|
printf("mask %d, %d\n", i++, masklay_shape->frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return maskobj_shape;
|
return masklay_shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_shape_unlink(MaskObject *maskobj, MaskObjectShape *maskobj_shape)
|
void BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape)
|
||||||
{
|
{
|
||||||
BLI_remlink(&maskobj->splines_shapes, maskobj_shape);
|
BLI_remlink(&masklay->splines_shapes, masklay_shape);
|
||||||
|
|
||||||
BKE_mask_object_shape_free(maskobj_shape);
|
BKE_mask_layer_shape_free(masklay_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mask_object_shape_sort_cb(void *maskobj_shape_a_ptr, void *maskobj_shape_b_ptr)
|
static int mask_layer_shape_sort_cb(void *masklay_shape_a_ptr, void *masklay_shape_b_ptr)
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape_a = (MaskObjectShape *)maskobj_shape_a_ptr;
|
MaskLayerShape *masklay_shape_a = (MaskLayerShape *)masklay_shape_a_ptr;
|
||||||
MaskObjectShape *maskobj_shape_b = (MaskObjectShape *)maskobj_shape_b_ptr;
|
MaskLayerShape *masklay_shape_b = (MaskLayerShape *)masklay_shape_b_ptr;
|
||||||
|
|
||||||
if (maskobj_shape_a->frame < maskobj_shape_b->frame) return -1;
|
if (masklay_shape_a->frame < masklay_shape_b->frame) return -1;
|
||||||
else if (maskobj_shape_a->frame > maskobj_shape_b->frame) return 1;
|
else if (masklay_shape_a->frame > masklay_shape_b->frame) return 1;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mask_object_shape_sort(MaskObject *maskobj)
|
void BKE_mask_layer_shape_sort(MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
BLI_sortlist(&maskobj->splines_shapes, mask_object_shape_sort_cb);
|
BLI_sortlist(&masklay->splines_shapes, mask_layer_shape_sort_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BKE_mask_object_shape_spline_from_index(MaskObject *maskobj, int index,
|
int BKE_mask_layer_shape_spline_from_index(MaskLayer *masklay, int index,
|
||||||
MaskSpline **r_maskobj_shape, int *r_index)
|
MaskSpline **r_masklay_shape, int *r_index)
|
||||||
{
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
if (index < spline->tot_point) {
|
if (index < spline->tot_point) {
|
||||||
*r_maskobj_shape = spline;
|
*r_masklay_shape = spline;
|
||||||
*r_index = index;
|
*r_index = index;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1570,11 +1570,11 @@ int BKE_mask_object_shape_spline_from_index(MaskObject *maskobj, int index,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BKE_mask_object_shape_spline_to_index(MaskObject *maskobj, MaskSpline *spline)
|
int BKE_mask_layer_shape_spline_to_index(MaskLayer *masklay, MaskSpline *spline)
|
||||||
{
|
{
|
||||||
MaskSpline *spline_iter;
|
MaskSpline *spline_iter;
|
||||||
int i_abs = 0;
|
int i_abs = 0;
|
||||||
for (spline_iter = maskobj->splines.first;
|
for (spline_iter = masklay->splines.first;
|
||||||
spline_iter && spline_iter != spline;
|
spline_iter && spline_iter != spline;
|
||||||
i_abs += spline_iter->tot_point, spline_iter = spline_iter->next)
|
i_abs += spline_iter->tot_point, spline_iter = spline_iter->next)
|
||||||
{
|
{
|
||||||
@@ -1608,21 +1608,21 @@ static void interp_weights_uv_v2_apply(const float uv[2], float r_pt[2], const f
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* when a now points added - resize all shapekey array */
|
/* when a now points added - resize all shapekey array */
|
||||||
void BKE_mask_object_shape_changed_add(MaskObject *maskobj, int index,
|
void BKE_mask_layer_shape_changed_add(MaskLayer *masklay, int index,
|
||||||
int do_init, int do_init_interpolate)
|
int do_init, int do_init_interpolate)
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
/* spline index from maskobj */
|
/* spline index from masklay */
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
int spline_point_index;
|
int spline_point_index;
|
||||||
|
|
||||||
if (BKE_mask_object_shape_spline_from_index(maskobj, index,
|
if (BKE_mask_layer_shape_spline_from_index(masklay, index,
|
||||||
&spline, &spline_point_index))
|
&spline, &spline_point_index))
|
||||||
{
|
{
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
/* the point has already been removed in this array so subtract one when comparing with the shapes */
|
/* the point has already been removed in this array so subtract one when comparing with the shapes */
|
||||||
int tot = BKE_mask_object_shape_totvert(maskobj) - 1;
|
int tot = BKE_mask_layer_shape_totvert(masklay) - 1;
|
||||||
|
|
||||||
/* for interpolation */
|
/* for interpolation */
|
||||||
/* TODO - assumes closed curve for now */
|
/* TODO - assumes closed curve for now */
|
||||||
@@ -1646,31 +1646,31 @@ void BKE_mask_object_shape_changed_add(MaskObject *maskobj, int index,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
for (masklay_shape = masklay->splines_shapes.first;
|
||||||
maskobj_shape;
|
masklay_shape;
|
||||||
maskobj_shape = maskobj_shape->next)
|
masklay_shape = masklay_shape->next)
|
||||||
{
|
{
|
||||||
if (tot == maskobj_shape->tot_vert) {
|
if (tot == masklay_shape->tot_vert) {
|
||||||
float *data_resized;
|
float *data_resized;
|
||||||
|
|
||||||
maskobj_shape->tot_vert++;
|
masklay_shape->tot_vert++;
|
||||||
data_resized = MEM_mallocN(maskobj_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, __func__);
|
data_resized = MEM_mallocN(masklay_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, __func__);
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
memcpy(data_resized,
|
memcpy(data_resized,
|
||||||
maskobj_shape->data,
|
masklay_shape->data,
|
||||||
index * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
index * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index != maskobj_shape->tot_vert - 1) {
|
if (index != masklay_shape->tot_vert - 1) {
|
||||||
memcpy(&data_resized[(index + 1) * MASK_OBJECT_SHAPE_ELEM_SIZE],
|
memcpy(&data_resized[(index + 1) * MASK_OBJECT_SHAPE_ELEM_SIZE],
|
||||||
maskobj_shape->data + (index * MASK_OBJECT_SHAPE_ELEM_SIZE),
|
masklay_shape->data + (index * MASK_OBJECT_SHAPE_ELEM_SIZE),
|
||||||
(maskobj_shape->tot_vert - (index + 1)) * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
(masklay_shape->tot_vert - (index + 1)) * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_init) {
|
if (do_init) {
|
||||||
float *fp = &data_resized[index * MASK_OBJECT_SHAPE_ELEM_SIZE];
|
float *fp = &data_resized[index * MASK_OBJECT_SHAPE_ELEM_SIZE];
|
||||||
|
|
||||||
mask_object_shape_from_mask_point(&spline->points[spline_point_index].bezt, fp);
|
mask_layer_shape_from_mask_point(&spline->points[spline_point_index].bezt, fp);
|
||||||
|
|
||||||
if (do_init_interpolate && spline->tot_point > 2) {
|
if (do_init_interpolate && spline->tot_point > 2) {
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
@@ -1687,12 +1687,12 @@ void BKE_mask_object_shape_changed_add(MaskObject *maskobj, int index,
|
|||||||
sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_freeN(maskobj_shape->data);
|
MEM_freeN(masklay_shape->data);
|
||||||
maskobj_shape->data = data_resized;
|
masklay_shape->data = data_resized;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
||||||
__func__, maskobj_shape->tot_vert, tot, maskobj_shape->frame);
|
__func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1700,40 +1700,40 @@ void BKE_mask_object_shape_changed_add(MaskObject *maskobj, int index,
|
|||||||
|
|
||||||
|
|
||||||
/* move array to account for removed point */
|
/* move array to account for removed point */
|
||||||
void BKE_mask_object_shape_changed_remove(MaskObject *maskobj, int index, int count)
|
void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int count)
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
/* the point has already been removed in this array so add one when comparing with the shapes */
|
/* the point has already been removed in this array so add one when comparing with the shapes */
|
||||||
int tot = BKE_mask_object_shape_totvert(maskobj);
|
int tot = BKE_mask_layer_shape_totvert(masklay);
|
||||||
|
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
for (masklay_shape = masklay->splines_shapes.first;
|
||||||
maskobj_shape;
|
masklay_shape;
|
||||||
maskobj_shape = maskobj_shape->next)
|
masklay_shape = masklay_shape->next)
|
||||||
{
|
{
|
||||||
if (tot == maskobj_shape->tot_vert - count) {
|
if (tot == masklay_shape->tot_vert - count) {
|
||||||
float *data_resized;
|
float *data_resized;
|
||||||
|
|
||||||
maskobj_shape->tot_vert -= count;
|
masklay_shape->tot_vert -= count;
|
||||||
data_resized = MEM_mallocN(maskobj_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, __func__);
|
data_resized = MEM_mallocN(masklay_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, __func__);
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
memcpy(data_resized,
|
memcpy(data_resized,
|
||||||
maskobj_shape->data,
|
masklay_shape->data,
|
||||||
index * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
index * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index != maskobj_shape->tot_vert) {
|
if (index != masklay_shape->tot_vert) {
|
||||||
memcpy(&data_resized[index * MASK_OBJECT_SHAPE_ELEM_SIZE],
|
memcpy(&data_resized[index * MASK_OBJECT_SHAPE_ELEM_SIZE],
|
||||||
maskobj_shape->data + ((index + count) * MASK_OBJECT_SHAPE_ELEM_SIZE),
|
masklay_shape->data + ((index + count) * MASK_OBJECT_SHAPE_ELEM_SIZE),
|
||||||
(maskobj_shape->tot_vert - index) * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
(masklay_shape->tot_vert - index) * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_freeN(maskobj_shape->data);
|
MEM_freeN(masklay_shape->data);
|
||||||
maskobj_shape->data = data_resized;
|
masklay_shape->data = data_resized;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
printf("%s: vert mismatch %d != %d (frame %d)\n",
|
||||||
__func__, maskobj_shape->tot_vert - count, tot, maskobj_shape->frame);
|
__func__, masklay_shape->tot_vert - count, tot, masklay_shape->frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1775,7 +1775,7 @@ static void linear_clamp_vn_vn(float *array, const int size)
|
|||||||
/* rasterization */
|
/* rasterization */
|
||||||
void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
|
void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
/* temp blending buffer */
|
/* temp blending buffer */
|
||||||
const int buffer_size = width * height;
|
const int buffer_size = width * height;
|
||||||
@@ -1789,17 +1789,17 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
|
|||||||
}
|
}
|
||||||
max_dseg_len = 1.0f / max_dseg_len;
|
max_dseg_len = 1.0f / max_dseg_len;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
float alpha;
|
float alpha;
|
||||||
|
|
||||||
if (maskobj->restrictflag & MASK_RESTRICT_RENDER) {
|
if (masklay->restrictflag & MASK_RESTRICT_RENDER) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buffer_tmp, 0, sizeof(float) * buffer_size);
|
memset(buffer_tmp, 0, sizeof(float) * buffer_size);
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
float (*diff_points)[2];
|
float (*diff_points)[2];
|
||||||
int tot_diff_point;
|
int tot_diff_point;
|
||||||
|
|
||||||
@@ -1853,10 +1853,10 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* blend with original */
|
/* blend with original */
|
||||||
if (maskobj->blend_flag & MASK_BLENDFLAG_INVERT) {
|
if (masklay->blend_flag & MASK_BLENDFLAG_INVERT) {
|
||||||
/* apply alpha multiply before inverting */
|
/* apply alpha multiply before inverting */
|
||||||
if (maskobj->alpha != 1.0f) {
|
if (masklay->alpha != 1.0f) {
|
||||||
m_invert_vn_vn(buffer_tmp, maskobj->alpha, buffer_size);
|
m_invert_vn_vn(buffer_tmp, masklay->alpha, buffer_size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
invert_vn_vn(buffer_tmp, buffer_size);
|
invert_vn_vn(buffer_tmp, buffer_size);
|
||||||
@@ -1865,10 +1865,10 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
|
|||||||
alpha = 1.0f;
|
alpha = 1.0f;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alpha = maskobj->alpha;
|
alpha = masklay->alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (maskobj->blend) {
|
switch (masklay->blend) {
|
||||||
case MASK_BLEND_SUBTRACT:
|
case MASK_BLEND_SUBTRACT:
|
||||||
{
|
{
|
||||||
if (alpha == 1.0f) {
|
if (alpha == 1.0f) {
|
||||||
|
|||||||
@@ -6182,19 +6182,19 @@ static void lib_link_movieclip(FileData *fd, Main *main)
|
|||||||
|
|
||||||
static void direct_link_mask(FileData *fd, Mask *mask)
|
static void direct_link_mask(FileData *fd, Mask *mask)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
mask->adt = newdataadr(fd, mask->adt);
|
mask->adt = newdataadr(fd, mask->adt);
|
||||||
|
|
||||||
link_list(fd, &mask->maskobjs);
|
link_list(fd, &mask->masklayers);
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
link_list(fd, &maskobj->splines);
|
link_list(fd, &masklay->splines);
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
spline->points = newdataadr(fd, spline->points);
|
spline->points = newdataadr(fd, spline->points);
|
||||||
@@ -6207,14 +6207,14 @@ static void direct_link_mask(FileData *fd, Mask *mask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
link_list(fd, &maskobj->splines_shapes);
|
link_list(fd, &masklay->splines_shapes);
|
||||||
|
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first; maskobj_shape; maskobj_shape = maskobj_shape->next) {
|
for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) {
|
||||||
maskobj_shape->data = newdataadr(fd, maskobj_shape->data);
|
masklay_shape->data = newdataadr(fd, masklay_shape->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
maskobj->act_spline = newdataadr(fd, maskobj->act_spline);
|
masklay->act_spline = newdataadr(fd, masklay->act_spline);
|
||||||
maskobj->act_point = newdataadr(fd, maskobj->act_point);
|
masklay->act_point = newdataadr(fd, masklay->act_point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6230,15 +6230,15 @@ static void lib_link_mask(FileData *fd, Main *main)
|
|||||||
mask = main->mask.first;
|
mask = main->mask.first;
|
||||||
while (mask) {
|
while (mask) {
|
||||||
if(mask->id.flag & LIB_NEEDLINK) {
|
if(mask->id.flag & LIB_NEEDLINK) {
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
if (mask->adt)
|
if (mask->adt)
|
||||||
lib_link_animdata(fd, &mask->id, mask->adt);
|
lib_link_animdata(fd, &mask->id, mask->adt);
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
spline = maskobj->splines.first;
|
spline = masklay->splines.first;
|
||||||
while (spline) {
|
while (spline) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@@ -2760,20 +2760,20 @@ static void write_masks(WriteData *wd, ListBase *idbase)
|
|||||||
mask = idbase->first;
|
mask = idbase->first;
|
||||||
while (mask) {
|
while (mask) {
|
||||||
if (mask->id.us > 0 || wd->current) {
|
if (mask->id.us > 0 || wd->current) {
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
writestruct(wd, ID_MSK, "Mask", 1, mask);
|
writestruct(wd, ID_MSK, "Mask", 1, mask);
|
||||||
|
|
||||||
if (mask->adt)
|
if (mask->adt)
|
||||||
write_animdata(wd, mask->adt);
|
write_animdata(wd, mask->adt);
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
writestruct(wd, DATA, "MaskObject", 1, maskobj);
|
writestruct(wd, DATA, "MaskLayer", 1, masklay);
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
void *points_deform = spline->points_deform;
|
void *points_deform = spline->points_deform;
|
||||||
@@ -2792,9 +2792,9 @@ static void write_masks(WriteData *wd, ListBase *idbase)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first; maskobj_shape; maskobj_shape = maskobj_shape->next) {
|
for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) {
|
||||||
writestruct(wd, DATA, "MaskObjectShape", 1, maskobj_shape);
|
writestruct(wd, DATA, "MaskLayerShape", 1, masklay_shape);
|
||||||
writedata(wd, DATA, maskobj_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, maskobj_shape->data);
|
writedata(wd, DATA, masklay_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, masklay_shape->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,28 +188,28 @@ static void nupdate_ak_gpframe(void *node, void *data)
|
|||||||
/* ......... */
|
/* ......... */
|
||||||
|
|
||||||
/* Comparator callback used for ActKeyColumns and GPencil frame */
|
/* Comparator callback used for ActKeyColumns and GPencil frame */
|
||||||
static short compare_ak_maskobjshape(void *node, void *data)
|
static short compare_ak_masklayshape(void *node, void *data)
|
||||||
{
|
{
|
||||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||||
MaskObjectShape *maskobj_shape = (MaskObjectShape *)data;
|
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
|
||||||
|
|
||||||
if (maskobj_shape->frame < ak->cfra)
|
if (masklay_shape->frame < ak->cfra)
|
||||||
return -1;
|
return -1;
|
||||||
else if (maskobj_shape->frame > ak->cfra)
|
else if (masklay_shape->frame > ak->cfra)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* New node callback used for building ActKeyColumns from GPencil frames */
|
/* New node callback used for building ActKeyColumns from GPencil frames */
|
||||||
static DLRBT_Node *nalloc_ak_maskobjshape(void *data)
|
static DLRBT_Node *nalloc_ak_masklayshape(void *data)
|
||||||
{
|
{
|
||||||
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
|
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
|
||||||
MaskObjectShape *maskobj_shape = (MaskObjectShape *)data;
|
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
|
||||||
|
|
||||||
/* store settings based on state of BezTriple */
|
/* store settings based on state of BezTriple */
|
||||||
ak->cfra = maskobj_shape->frame;
|
ak->cfra = masklay_shape->frame;
|
||||||
ak->sel = (maskobj_shape->flag & SELECT) ? SELECT : 0;
|
ak->sel = (masklay_shape->flag & SELECT) ? SELECT : 0;
|
||||||
|
|
||||||
/* set 'modified', since this is used to identify long keyframes */
|
/* set 'modified', since this is used to identify long keyframes */
|
||||||
ak->modified = 1;
|
ak->modified = 1;
|
||||||
@@ -218,13 +218,13 @@ static DLRBT_Node *nalloc_ak_maskobjshape(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Node updater callback used for building ActKeyColumns from GPencil frames */
|
/* Node updater callback used for building ActKeyColumns from GPencil frames */
|
||||||
static void nupdate_ak_maskobjshape(void *node, void *data)
|
static void nupdate_ak_masklayshape(void *node, void *data)
|
||||||
{
|
{
|
||||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||||
MaskObjectShape *maskobj_shape = (MaskObjectShape *)data;
|
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
|
||||||
|
|
||||||
/* set selection status and 'touched' status */
|
/* set selection status and 'touched' status */
|
||||||
if (maskobj_shape->flag & SELECT) ak->sel = SELECT;
|
if (masklay_shape->flag & SELECT) ak->sel = SELECT;
|
||||||
ak->modified += 1;
|
ak->modified += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,13 +249,13 @@ static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
|
|||||||
BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
|
BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the given MaskObjectShape Frame to the given 'list' of Keyframes */
|
/* Add the given MaskLayerShape Frame to the given 'list' of Keyframes */
|
||||||
static void add_maskobj_to_keycolumns_list(DLRBT_Tree *keys, MaskObjectShape *maskobj_shape)
|
static void add_masklay_to_keycolumns_list(DLRBT_Tree *keys, MaskLayerShape *masklay_shape)
|
||||||
{
|
{
|
||||||
if (ELEM(NULL, keys, maskobj_shape))
|
if (ELEM(NULL, keys, masklay_shape))
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
BLI_dlrbTree_add(keys, compare_ak_maskobjshape, nalloc_ak_maskobjshape, nupdate_ak_maskobjshape, maskobj_shape);
|
BLI_dlrbTree_add(keys, compare_ak_masklayshape, nalloc_ak_masklayshape, nupdate_ak_masklayshape, masklay_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
|
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
|
||||||
@@ -994,16 +994,16 @@ void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskObject *maskobj, DLRBT_Tree *keys)
|
void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskLayer *masklay, DLRBT_Tree *keys)
|
||||||
{
|
{
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
if (maskobj && keys) {
|
if (masklay && keys) {
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
for (masklay_shape = masklay->splines_shapes.first;
|
||||||
maskobj_shape;
|
masklay_shape;
|
||||||
maskobj_shape = maskobj_shape->next)
|
masklay_shape = masklay_shape->next)
|
||||||
{
|
{
|
||||||
add_maskobj_to_keycolumns_list(keys, maskobj_shape);
|
add_masklay_to_keycolumns_list(keys, masklay_shape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ struct bActionGroup;
|
|||||||
struct Object;
|
struct Object;
|
||||||
struct ListBase;
|
struct ListBase;
|
||||||
struct bGPDlayer;
|
struct bGPDlayer;
|
||||||
struct MaskObject;
|
struct MaskLayer;
|
||||||
struct Scene;
|
struct Scene;
|
||||||
struct View2D;
|
struct View2D;
|
||||||
struct DLRBT_Tree;
|
struct DLRBT_Tree;
|
||||||
@@ -142,7 +142,7 @@ void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct
|
|||||||
void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
|
void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
|
||||||
/* Mask */
|
/* Mask */
|
||||||
// XXX not restored
|
// XXX not restored
|
||||||
void mask_to_keylist(struct bDopeSheet *UNUSED(ads), struct MaskObject *maskobj, struct DLRBT_Tree *keys);
|
void mask_to_keylist(struct bDopeSheet *UNUSED(ads), struct MaskLayer *masklay, struct DLRBT_Tree *keys);
|
||||||
|
|
||||||
/* ActKeyColumn API ---------------- */
|
/* ActKeyColumn API ---------------- */
|
||||||
/* Comparator callback used for ActKeyColumns and cframe float-value pointer */
|
/* Comparator callback used for ActKeyColumns and cframe float-value pointer */
|
||||||
|
|||||||
@@ -42,6 +42,6 @@ void ED_operatormacros_mask(void);
|
|||||||
void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type);
|
void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type);
|
||||||
|
|
||||||
/* mask_shapekey.c */
|
/* mask_shapekey.c */
|
||||||
int ED_mask_object_shape_auto_key_all(struct Mask *mask, const int frame);
|
int ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame);
|
||||||
|
|
||||||
#endif /* ED_TEXT_H */
|
#endif /* ED_TEXT_H */
|
||||||
|
|||||||
@@ -2241,7 +2241,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
|||||||
uiItemL(split, name, ICON_OBJECT_DATA);
|
uiItemL(split, name, ICON_OBJECT_DATA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (itemptr->type == &RNA_MaskObject) {
|
else if (itemptr->type == &RNA_MaskLayer) {
|
||||||
split = uiLayoutSplit(sub, 0.66f, 0);
|
split = uiLayoutSplit(sub, 0.66f, 0);
|
||||||
|
|
||||||
uiItemL(split, name, icon);
|
uiItemL(split, name, icon);
|
||||||
|
|||||||
@@ -49,11 +49,11 @@
|
|||||||
|
|
||||||
#include "mask_intern.h" /* own include */
|
#include "mask_intern.h" /* own include */
|
||||||
|
|
||||||
static void mask_spline_color_get(MaskObject *maskobj, MaskSpline *spline, const int is_sel,
|
static void mask_spline_color_get(MaskLayer *masklay, MaskSpline *spline, const int is_sel,
|
||||||
unsigned char r_rgb[4])
|
unsigned char r_rgb[4])
|
||||||
{
|
{
|
||||||
if (is_sel) {
|
if (is_sel) {
|
||||||
if (maskobj->act_spline == spline) {
|
if (masklay->act_spline == spline) {
|
||||||
r_rgb[0] = r_rgb[1] = r_rgb[2] = 255;
|
r_rgb[0] = r_rgb[1] = r_rgb[2] = 255;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -69,7 +69,7 @@ static void mask_spline_color_get(MaskObject *maskobj, MaskSpline *spline, const
|
|||||||
r_rgb[3] = 255;
|
r_rgb[3] = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mask_spline_feather_color_get(MaskObject *UNUSED(maskobj), MaskSpline *UNUSED(spline), const int is_sel,
|
static void mask_spline_feather_color_get(MaskLayer *UNUSED(masklay), MaskSpline *UNUSED(spline), const int is_sel,
|
||||||
unsigned char r_rgb[4])
|
unsigned char r_rgb[4])
|
||||||
{
|
{
|
||||||
if (is_sel) {
|
if (is_sel) {
|
||||||
@@ -85,7 +85,7 @@ static void mask_spline_feather_color_get(MaskObject *UNUSED(maskobj), MaskSplin
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void draw_spline_parents(MaskObject *UNUSED(maskobj), MaskSpline *spline)
|
static void draw_spline_parents(MaskLayer *UNUSED(masklay), MaskSpline *spline)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||||
@@ -119,9 +119,9 @@ static void draw_spline_parents(MaskObject *UNUSED(maskobj), MaskSpline *spline)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* return non-zero if spline is selected */
|
/* return non-zero if spline is selected */
|
||||||
static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline)
|
static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline)
|
||||||
{
|
{
|
||||||
const int is_spline_sel = (spline->flag & SELECT) && (maskobj->restrictflag & MASK_RESTRICT_SELECT) == 0;
|
const int is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0;
|
||||||
unsigned char rgb_spline[4];
|
unsigned char rgb_spline[4];
|
||||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline)
|
|||||||
|
|
||||||
glPointSize(hsize);
|
glPointSize(hsize);
|
||||||
|
|
||||||
mask_spline_color_get(maskobj, spline, is_spline_sel, rgb_spline);
|
mask_spline_color_get(masklay, spline, is_spline_sel, rgb_spline);
|
||||||
|
|
||||||
/* feather points */
|
/* feather points */
|
||||||
feather_points = fp = BKE_mask_spline_feather_points(spline, &tot_feather_point);
|
feather_points = fp = BKE_mask_spline_feather_points(spline, &tot_feather_point);
|
||||||
@@ -157,7 +157,7 @@ static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sel) {
|
if (sel) {
|
||||||
if (point == maskobj->act_point)
|
if (point == masklay->act_point)
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
else
|
else
|
||||||
glColor3f(1.0f, 1.0f, 0.0f);
|
glColor3f(1.0f, 1.0f, 0.0f);
|
||||||
@@ -201,7 +201,7 @@ static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline)
|
|||||||
|
|
||||||
/* draw CV point */
|
/* draw CV point */
|
||||||
if (MASKPOINT_ISSEL_KNOT(point)) {
|
if (MASKPOINT_ISSEL_KNOT(point)) {
|
||||||
if (point == maskobj->act_point)
|
if (point == masklay->act_point)
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
else
|
else
|
||||||
glColor3f(1.0f, 1.0f, 0.0f);
|
glColor3f(1.0f, 1.0f, 0.0f);
|
||||||
@@ -216,7 +216,7 @@ static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline)
|
|||||||
/* draw handle points */
|
/* draw handle points */
|
||||||
if (has_handle) {
|
if (has_handle) {
|
||||||
if (MASKPOINT_ISSEL_HANDLE(point)) {
|
if (MASKPOINT_ISSEL_HANDLE(point)) {
|
||||||
if (point == maskobj->act_point)
|
if (point == masklay->act_point)
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
else
|
else
|
||||||
glColor3f(1.0f, 1.0f, 0.0f);
|
glColor3f(1.0f, 1.0f, 0.0f);
|
||||||
@@ -322,12 +322,12 @@ static void mask_draw_curve_type(MaskSpline *spline, float (*points)[2], int tot
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_spline_curve(MaskObject *maskobj, MaskSpline *spline,
|
static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
|
||||||
const char draw_flag, const char draw_type)
|
const char draw_flag, const char draw_type)
|
||||||
{
|
{
|
||||||
unsigned char rgb_tmp[4];
|
unsigned char rgb_tmp[4];
|
||||||
|
|
||||||
const short is_spline_sel = (spline->flag & SELECT) && (maskobj->restrictflag & MASK_RESTRICT_SELECT) == 0;
|
const short is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0;
|
||||||
const short is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH);
|
const short is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH);
|
||||||
|
|
||||||
int tot_diff_point;
|
int tot_diff_point;
|
||||||
@@ -350,14 +350,14 @@ static void draw_spline_curve(MaskObject *maskobj, MaskSpline *spline,
|
|||||||
feather_points = BKE_mask_spline_feather_differentiated_points(spline, &tot_feather_point, 0, 0.0f);
|
feather_points = BKE_mask_spline_feather_differentiated_points(spline, &tot_feather_point, 0, 0.0f);
|
||||||
|
|
||||||
/* draw feather */
|
/* draw feather */
|
||||||
mask_spline_feather_color_get(maskobj, spline, is_spline_sel, rgb_tmp);
|
mask_spline_feather_color_get(masklay, spline, is_spline_sel, rgb_tmp);
|
||||||
mask_draw_curve_type(spline, feather_points, tot_feather_point,
|
mask_draw_curve_type(spline, feather_points, tot_feather_point,
|
||||||
TRUE, is_smooth,
|
TRUE, is_smooth,
|
||||||
rgb_tmp, draw_type);
|
rgb_tmp, draw_type);
|
||||||
MEM_freeN(feather_points);
|
MEM_freeN(feather_points);
|
||||||
|
|
||||||
/* draw main curve */
|
/* draw main curve */
|
||||||
mask_spline_color_get(maskobj, spline, is_spline_sel, rgb_tmp);
|
mask_spline_color_get(masklay, spline, is_spline_sel, rgb_tmp);
|
||||||
mask_draw_curve_type(spline, diff_points, tot_diff_point,
|
mask_draw_curve_type(spline, diff_points, tot_diff_point,
|
||||||
FALSE, is_smooth,
|
FALSE, is_smooth,
|
||||||
rgb_tmp, draw_type);
|
rgb_tmp, draw_type);
|
||||||
@@ -371,28 +371,28 @@ static void draw_spline_curve(MaskObject *maskobj, MaskSpline *spline,
|
|||||||
(void)draw_type;
|
(void)draw_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_maskobjs(Mask *mask,
|
static void draw_masklays(Mask *mask,
|
||||||
const char draw_flag, const char draw_type)
|
const char draw_flag, const char draw_type)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
|
if (masklay->restrictflag & MASK_RESTRICT_VIEW) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
|
|
||||||
/* draw curve itself first... */
|
/* draw curve itself first... */
|
||||||
draw_spline_curve(maskobj, spline, draw_flag, draw_type);
|
draw_spline_curve(masklay, spline, draw_flag, draw_type);
|
||||||
|
|
||||||
// draw_spline_parents(maskobj, spline);
|
// draw_spline_parents(masklay, spline);
|
||||||
|
|
||||||
if (!(maskobj->restrictflag & MASK_RESTRICT_SELECT)) {
|
if (!(masklay->restrictflag & MASK_RESTRICT_SELECT)) {
|
||||||
/* ...and then handles over the curve so they're nicely visible */
|
/* ...and then handles over the curve so they're nicely visible */
|
||||||
draw_spline_points(maskobj, spline);
|
draw_spline_points(masklay, spline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show undeform for testing */
|
/* show undeform for testing */
|
||||||
@@ -400,9 +400,9 @@ static void draw_maskobjs(Mask *mask,
|
|||||||
void *back = spline->points_deform;
|
void *back = spline->points_deform;
|
||||||
|
|
||||||
spline->points_deform = NULL;
|
spline->points_deform = NULL;
|
||||||
draw_spline_curve(maskobj, spline, draw_flag, draw_type);
|
draw_spline_curve(masklay, spline, draw_flag, draw_type);
|
||||||
// draw_spline_parents(maskobj, spline);
|
// draw_spline_parents(masklay, spline);
|
||||||
draw_spline_points(maskobj, spline);
|
draw_spline_points(masklay, spline);
|
||||||
spline->points_deform = back;
|
spline->points_deform = back;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -417,5 +417,5 @@ void ED_mask_draw(const bContext *C,
|
|||||||
if (!mask)
|
if (!mask)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
draw_maskobjs(mask, draw_flag, draw_type);
|
draw_masklays(mask, draw_flag, draw_type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,9 +189,9 @@ void ED_operatortypes_mask(void)
|
|||||||
{
|
{
|
||||||
WM_operatortype_append(MASK_OT_new);
|
WM_operatortype_append(MASK_OT_new);
|
||||||
|
|
||||||
/* mask objects */
|
/* mask layers */
|
||||||
WM_operatortype_append(MASK_OT_object_new);
|
WM_operatortype_append(MASK_OT_layer_new);
|
||||||
WM_operatortype_append(MASK_OT_object_remove);
|
WM_operatortype_append(MASK_OT_layer_remove);
|
||||||
|
|
||||||
/* geometry */
|
/* geometry */
|
||||||
WM_operatortype_append(MASK_OT_add_vertex);
|
WM_operatortype_append(MASK_OT_add_vertex);
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ struct wmOperatorType;
|
|||||||
|
|
||||||
/* mask_ops.c */
|
/* mask_ops.c */
|
||||||
void MASK_OT_new(struct wmOperatorType *ot);
|
void MASK_OT_new(struct wmOperatorType *ot);
|
||||||
void MASK_OT_object_new(struct wmOperatorType *ot);
|
void MASK_OT_layer_new(struct wmOperatorType *ot);
|
||||||
void MASK_OT_object_remove(struct wmOperatorType *ot);
|
void MASK_OT_layer_remove(struct wmOperatorType *ot);
|
||||||
|
|
||||||
void MASK_OT_add_vertex(struct wmOperatorType *ot);
|
void MASK_OT_add_vertex(struct wmOperatorType *ot);
|
||||||
void MASK_OT_add_feather_vertex(struct wmOperatorType *ot);
|
void MASK_OT_add_feather_vertex(struct wmOperatorType *ot);
|
||||||
@@ -58,12 +58,12 @@ void MASK_OT_handle_type_set(struct wmOperatorType *ot);
|
|||||||
|
|
||||||
int ED_mask_feather_find_nearest(
|
int ED_mask_feather_find_nearest(
|
||||||
struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
|
struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
|
||||||
struct MaskObject **maskobj_r, struct MaskSpline **spline_r, struct MaskSplinePoint **point_r,
|
struct MaskLayer **masklay_r, struct MaskSpline **spline_r, struct MaskSplinePoint **point_r,
|
||||||
struct MaskSplinePointUW **uw_r, float *score);
|
struct MaskSplinePointUW **uw_r, float *score);
|
||||||
|
|
||||||
struct MaskSplinePoint *ED_mask_point_find_nearest(
|
struct MaskSplinePoint *ED_mask_point_find_nearest(
|
||||||
struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
|
struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
|
||||||
struct MaskObject **maskobj_r, struct MaskSpline **spline_r, int *is_handle_r,
|
struct MaskLayer **masklay_r, struct MaskSpline **spline_r, int *is_handle_r,
|
||||||
float *score);
|
float *score);
|
||||||
|
|
||||||
/* mask_relationships.c */
|
/* mask_relationships.c */
|
||||||
@@ -79,10 +79,10 @@ void MASK_OT_select_lasso(struct wmOperatorType *ot);
|
|||||||
void MASK_OT_select_circle(struct wmOperatorType *ot);
|
void MASK_OT_select_circle(struct wmOperatorType *ot);
|
||||||
|
|
||||||
int ED_mask_spline_select_check(struct MaskSplinePoint *points, int tot_point);
|
int ED_mask_spline_select_check(struct MaskSplinePoint *points, int tot_point);
|
||||||
int ED_mask_object_select_check(struct MaskObject *maskobj);
|
int ED_mask_layer_select_check(struct MaskLayer *masklay);
|
||||||
int ED_mask_select_check(struct Mask *mask);
|
int ED_mask_select_check(struct Mask *mask);
|
||||||
|
|
||||||
void ED_mask_object_select_set(struct MaskObject *maskobj, int select);
|
void ED_mask_layer_select_set(struct MaskLayer *masklay, int select);
|
||||||
void ED_mask_select_toggle_all(struct Mask *mask, int action);
|
void ED_mask_select_toggle_all(struct Mask *mask, int action);
|
||||||
void ED_mask_select_flush_all(struct Mask *mask);
|
void ED_mask_select_flush_all(struct Mask *mask);
|
||||||
|
|
||||||
|
|||||||
@@ -122,11 +122,11 @@ static float projection_on_spline(MaskSpline *spline, MaskSplinePoint *point, fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float normal_co[2], int threshold,
|
MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float normal_co[2], int threshold,
|
||||||
MaskObject **maskobj_r, MaskSpline **spline_r, int *is_handle_r,
|
MaskLayer **masklay_r, MaskSpline **spline_r, int *is_handle_r,
|
||||||
float *score)
|
float *score)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
MaskObject *point_maskobj = NULL;
|
MaskLayer *point_masklay = NULL;
|
||||||
MaskSpline *point_spline = NULL;
|
MaskSpline *point_spline = NULL;
|
||||||
MaskSplinePoint *point = NULL;
|
MaskSplinePoint *point = NULL;
|
||||||
float co[2], aspx, aspy;
|
float co[2], aspx, aspy;
|
||||||
@@ -140,14 +140,14 @@ MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float norma
|
|||||||
co[0] = normal_co[0] * scalex;
|
co[0] = normal_co[0] * scalex;
|
||||||
co[1] = normal_co[1] * scaley;
|
co[1] = normal_co[1] * scaley;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -168,7 +168,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float norma
|
|||||||
cur_len = len_v2v2(co, handle);
|
cur_len = len_v2v2(co, handle);
|
||||||
|
|
||||||
if (cur_len < len) {
|
if (cur_len < len) {
|
||||||
point_maskobj = maskobj;
|
point_masklay = masklay;
|
||||||
point_spline = spline;
|
point_spline = spline;
|
||||||
point = cur_point;
|
point = cur_point;
|
||||||
len = cur_len;
|
len = cur_len;
|
||||||
@@ -180,7 +180,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float norma
|
|||||||
|
|
||||||
if (cur_len < len) {
|
if (cur_len < len) {
|
||||||
point_spline = spline;
|
point_spline = spline;
|
||||||
point_maskobj = maskobj;
|
point_masklay = masklay;
|
||||||
point = cur_point;
|
point = cur_point;
|
||||||
len = cur_len;
|
len = cur_len;
|
||||||
is_handle = FALSE;
|
is_handle = FALSE;
|
||||||
@@ -190,8 +190,8 @@ MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float norma
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (len < threshold) {
|
if (len < threshold) {
|
||||||
if (maskobj_r)
|
if (masklay_r)
|
||||||
*maskobj_r = point_maskobj;
|
*masklay_r = point_masklay;
|
||||||
|
|
||||||
if (spline_r)
|
if (spline_r)
|
||||||
*spline_r = point_spline;
|
*spline_r = point_spline;
|
||||||
@@ -205,8 +205,8 @@ MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float norma
|
|||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maskobj_r)
|
if (masklay_r)
|
||||||
*maskobj_r = NULL;
|
*masklay_r = NULL;
|
||||||
|
|
||||||
if (spline_r)
|
if (spline_r)
|
||||||
*spline_r = NULL;
|
*spline_r = NULL;
|
||||||
@@ -218,10 +218,10 @@ MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float norma
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], int threshold,
|
int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], int threshold,
|
||||||
MaskObject **maskobj_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
||||||
MaskSplinePointUW **uw_r, float *score)
|
MaskSplinePointUW **uw_r, float *score)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj, *point_maskobj = NULL;
|
MaskLayer *masklay, *point_masklay = NULL;
|
||||||
MaskSpline *point_spline = NULL;
|
MaskSpline *point_spline = NULL;
|
||||||
MaskSplinePoint *point = NULL;
|
MaskSplinePoint *point = NULL;
|
||||||
MaskSplinePointUW *uw = NULL;
|
MaskSplinePointUW *uw = NULL;
|
||||||
@@ -236,16 +236,16 @@ int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], in
|
|||||||
co[0] = normal_co[0] * scalex;
|
co[0] = normal_co[0] * scalex;
|
||||||
co[1] = normal_co[1] * scaley;
|
co[1] = normal_co[1] * scaley;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
//MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
//MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||||
|
|
||||||
int i, tot_feather_point;
|
int i, tot_feather_point;
|
||||||
float (*feather_points)[2], (*fp)[2];
|
float (*feather_points)[2], (*fp)[2];
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], in
|
|||||||
else
|
else
|
||||||
uw = &cur_point->uw[j - 1];
|
uw = &cur_point->uw[j - 1];
|
||||||
|
|
||||||
point_maskobj = maskobj;
|
point_masklay = masklay;
|
||||||
point_spline = spline;
|
point_spline = spline;
|
||||||
point = cur_point;
|
point = cur_point;
|
||||||
len = cur_len;
|
len = cur_len;
|
||||||
@@ -284,8 +284,8 @@ int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], in
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (len < threshold) {
|
if (len < threshold) {
|
||||||
if (maskobj_r)
|
if (masklay_r)
|
||||||
*maskobj_r = point_maskobj;
|
*masklay_r = point_masklay;
|
||||||
|
|
||||||
if (spline_r)
|
if (spline_r)
|
||||||
*spline_r = point_spline;
|
*spline_r = point_spline;
|
||||||
@@ -302,8 +302,8 @@ int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], in
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maskobj_r)
|
if (masklay_r)
|
||||||
*maskobj_r = NULL;
|
*masklay_r = NULL;
|
||||||
|
|
||||||
if (spline_r)
|
if (spline_r)
|
||||||
*spline_r = NULL;
|
*spline_r = NULL;
|
||||||
@@ -315,10 +315,10 @@ int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], in
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_co[2], int threshold, int feather,
|
static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_co[2], int threshold, int feather,
|
||||||
MaskObject **maskobj_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
||||||
float *u_r, float tangent[2])
|
float *u_r, float tangent[2])
|
||||||
{
|
{
|
||||||
MaskObject *maskobj, *point_maskobj;
|
MaskLayer *masklay, *point_masklay;
|
||||||
MaskSpline *point_spline;
|
MaskSpline *point_spline;
|
||||||
MaskSplinePoint *point = NULL;
|
MaskSplinePoint *point = NULL;
|
||||||
float dist, co[2];
|
float dist, co[2];
|
||||||
@@ -333,14 +333,14 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_c
|
|||||||
co[0] = normal_co[0] * scalex;
|
co[0] = normal_co[0] * scalex;
|
||||||
co[1] = normal_co[1] * scaley;
|
co[1] = normal_co[1] * scaley;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
@@ -381,7 +381,7 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_c
|
|||||||
if (tangent)
|
if (tangent)
|
||||||
sub_v2_v2v2(tangent, &diff_points[2 * i + 2], &diff_points[2 * i]);
|
sub_v2_v2v2(tangent, &diff_points[2 * i + 2], &diff_points[2 * i]);
|
||||||
|
|
||||||
point_maskobj = maskobj;
|
point_masklay = masklay;
|
||||||
point_spline = spline;
|
point_spline = spline;
|
||||||
point = cur_point;
|
point = cur_point;
|
||||||
dist = cur_dist;
|
dist = cur_dist;
|
||||||
@@ -400,8 +400,8 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (point && dist < threshold) {
|
if (point && dist < threshold) {
|
||||||
if (maskobj_r)
|
if (masklay_r)
|
||||||
*maskobj_r = point_maskobj;
|
*masklay_r = point_masklay;
|
||||||
|
|
||||||
if (spline_r)
|
if (spline_r)
|
||||||
*spline_r = point_spline;
|
*spline_r = point_spline;
|
||||||
@@ -418,8 +418,8 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_c
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maskobj_r)
|
if (masklay_r)
|
||||||
*maskobj_r = NULL;
|
*masklay_r = NULL;
|
||||||
|
|
||||||
if (spline_r)
|
if (spline_r)
|
||||||
*spline_r = NULL;
|
*spline_r = NULL;
|
||||||
@@ -466,50 +466,50 @@ void MASK_OT_new(wmOperatorType *ot)
|
|||||||
RNA_def_string(ot->srna, "name", "", MAX_ID_NAME - 2, "Name", "Name of new mask");
|
RNA_def_string(ot->srna, "name", "", MAX_ID_NAME - 2, "Name", "Name of new mask");
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************** create new maskobj *********************/
|
/******************** create new masklay *********************/
|
||||||
|
|
||||||
static int maskobj_new_exec(bContext *C, wmOperator *op)
|
static int masklay_new_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
char name[MAX_ID_NAME - 2];
|
char name[MAX_ID_NAME - 2];
|
||||||
|
|
||||||
RNA_string_get(op->ptr, "name", name);
|
RNA_string_get(op->ptr, "name", name);
|
||||||
|
|
||||||
BKE_mask_object_new(mask, name);
|
BKE_mask_layer_new(mask, name);
|
||||||
mask->act_maskobj = mask->tot_maskobj - 1;
|
mask->masklay_act = mask->masklay_tot - 1;
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MASK_OT_object_new(wmOperatorType *ot)
|
void MASK_OT_layer_new(wmOperatorType *ot)
|
||||||
{
|
{
|
||||||
/* identifiers */
|
/* identifiers */
|
||||||
ot->name = "Add Mask Object";
|
ot->name = "Add Mask Layer";
|
||||||
ot->description = "Add new mask object for masking";
|
ot->description = "Add new mask layer for masking";
|
||||||
ot->idname = "MASK_OT_object_new";
|
ot->idname = "MASK_OT_layer_new";
|
||||||
|
|
||||||
/* api callbacks */
|
/* api callbacks */
|
||||||
ot->exec = maskobj_new_exec;
|
ot->exec = masklay_new_exec;
|
||||||
ot->poll = ED_maskediting_poll;
|
ot->poll = ED_maskediting_poll;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
RNA_def_string(ot->srna, "name", "", MAX_ID_NAME - 2, "Name", "Name of new mask object");
|
RNA_def_string(ot->srna, "name", "", MAX_ID_NAME - 2, "Name", "Name of new mask layer");
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************** remove mask object *********************/
|
/******************** remove mask layer *********************/
|
||||||
|
|
||||||
static int maskobj_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
static int masklay_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj = BKE_mask_object_active(mask);
|
MaskLayer *masklay = BKE_mask_layer_active(mask);
|
||||||
|
|
||||||
if (maskobj) {
|
if (masklay) {
|
||||||
BKE_mask_object_remove(mask, maskobj);
|
BKE_mask_layer_remove(mask, masklay);
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||||
}
|
}
|
||||||
@@ -517,15 +517,15 @@ static int maskobj_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MASK_OT_object_remove(wmOperatorType *ot)
|
void MASK_OT_layer_remove(wmOperatorType *ot)
|
||||||
{
|
{
|
||||||
/* identifiers */
|
/* identifiers */
|
||||||
ot->name = "Remove Mask Object";
|
ot->name = "Remove Mask Layer";
|
||||||
ot->description = "Remove mask object";
|
ot->description = "Remove mask layer";
|
||||||
ot->idname = "MASK_OT_object_remove";
|
ot->idname = "MASK_OT_layer_remove";
|
||||||
|
|
||||||
/* api callbacks */
|
/* api callbacks */
|
||||||
ot->exec = maskobj_remove_exec;
|
ot->exec = masklay_remove_exec;
|
||||||
ot->poll = ED_maskediting_poll;
|
ot->poll = ED_maskediting_poll;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
@@ -546,7 +546,7 @@ typedef struct SlidePointData {
|
|||||||
float vec[3][3];
|
float vec[3][3];
|
||||||
|
|
||||||
Mask *mask;
|
Mask *mask;
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskSplinePoint *point;
|
MaskSplinePoint *point;
|
||||||
MaskSplinePointUW *uw;
|
MaskSplinePointUW *uw;
|
||||||
@@ -562,7 +562,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
SlidePointData *customdata = NULL;
|
SlidePointData *customdata = NULL;
|
||||||
MaskObject *maskobj, *cv_maskobj, *feather_maskobj;
|
MaskLayer *masklay, *cv_masklay, *feather_masklay;
|
||||||
MaskSpline *spline, *cv_spline, *feather_spline;
|
MaskSpline *spline, *cv_spline, *feather_spline;
|
||||||
MaskSplinePoint *point, *cv_point, *feather_point;
|
MaskSplinePoint *point, *cv_point, *feather_point;
|
||||||
MaskSplinePointUW *uw = NULL;
|
MaskSplinePointUW *uw = NULL;
|
||||||
@@ -574,13 +574,13 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
ED_mask_mouse_pos(C, event, co);
|
ED_mask_mouse_pos(C, event, co);
|
||||||
ED_mask_size(C, &width, &height);
|
ED_mask_size(C, &width, &height);
|
||||||
|
|
||||||
cv_point = ED_mask_point_find_nearest(C, mask, co, threshold, &cv_maskobj, &cv_spline, &is_handle, &cv_score);
|
cv_point = ED_mask_point_find_nearest(C, mask, co, threshold, &cv_masklay, &cv_spline, &is_handle, &cv_score);
|
||||||
|
|
||||||
if (ED_mask_feather_find_nearest(C, mask, co, threshold, &feather_maskobj, &feather_spline, &feather_point, &uw, &feather_score)) {
|
if (ED_mask_feather_find_nearest(C, mask, co, threshold, &feather_masklay, &feather_spline, &feather_point, &uw, &feather_score)) {
|
||||||
if (slide_feather || !cv_point || feather_score < cv_score) {
|
if (slide_feather || !cv_point || feather_score < cv_score) {
|
||||||
action = SLIDE_ACTION_FEATHER;
|
action = SLIDE_ACTION_FEATHER;
|
||||||
|
|
||||||
maskobj = feather_maskobj;
|
masklay = feather_masklay;
|
||||||
spline = feather_spline;
|
spline = feather_spline;
|
||||||
point = feather_point;
|
point = feather_point;
|
||||||
}
|
}
|
||||||
@@ -592,7 +592,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
else
|
else
|
||||||
action = SLIDE_ACTION_POINT;
|
action = SLIDE_ACTION_POINT;
|
||||||
|
|
||||||
maskobj = cv_maskobj;
|
masklay = cv_masklay;
|
||||||
spline = cv_spline;
|
spline = cv_spline;
|
||||||
point = cv_point;
|
point = cv_point;
|
||||||
}
|
}
|
||||||
@@ -601,7 +601,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
customdata = MEM_callocN(sizeof(SlidePointData), "mask slide point data");
|
customdata = MEM_callocN(sizeof(SlidePointData), "mask slide point data");
|
||||||
|
|
||||||
customdata->mask = mask;
|
customdata->mask = mask;
|
||||||
customdata->maskobj = maskobj;
|
customdata->masklay = masklay;
|
||||||
customdata->spline = spline;
|
customdata->spline = spline;
|
||||||
customdata->point = point;
|
customdata->point = point;
|
||||||
customdata->width = width;
|
customdata->width = width;
|
||||||
@@ -668,8 +668,8 @@ static int slide_point_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
ED_mask_select_flush_all(mask);
|
ED_mask_select_flush_all(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
slidedata->maskobj->act_spline = slidedata->spline;
|
slidedata->masklay->act_spline = slidedata->spline;
|
||||||
slidedata->maskobj->act_point = slidedata->point;
|
slidedata->masklay->act_point = slidedata->point;
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
|
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
|
||||||
|
|
||||||
@@ -794,7 +794,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
free_slide_point_data(op->customdata);
|
free_slide_point_data(op->customdata);
|
||||||
|
|
||||||
if (IS_AUTOKEY_ON(scene)) {
|
if (IS_AUTOKEY_ON(scene)) {
|
||||||
ED_mask_object_shape_auto_key_all(data->mask, CFRA);
|
ED_mask_layer_shape_auto_key_all(data->mask, CFRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, data->mask);
|
WM_event_add_notifier(C, NC_MASK | NA_EDITED, data->mask);
|
||||||
@@ -986,13 +986,13 @@ static void mask_spline_add_point_at_index(MaskSpline *spline, int point_index)
|
|||||||
|
|
||||||
static int add_vertex_subdivide(bContext *C, Mask *mask, const float co[2])
|
static int add_vertex_subdivide(bContext *C, Mask *mask, const float co[2])
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskSplinePoint *point = NULL;
|
MaskSplinePoint *point = NULL;
|
||||||
const float threshold = 9;
|
const float threshold = 9;
|
||||||
float tangent[2];
|
float tangent[2];
|
||||||
|
|
||||||
if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &maskobj, &spline, &point, NULL, tangent)) {
|
if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &masklay, &spline, &point, NULL, tangent)) {
|
||||||
MaskSplinePoint *new_point;
|
MaskSplinePoint *new_point;
|
||||||
int point_index = point - spline->points;
|
int point_index = point - spline->points;
|
||||||
|
|
||||||
@@ -1005,9 +1005,9 @@ static int add_vertex_subdivide(bContext *C, Mask *mask, const float co[2])
|
|||||||
setup_vertex_point(C, mask, spline, new_point, co, tangent, NULL, TRUE);
|
setup_vertex_point(C, mask, spline, new_point, co, tangent, NULL, TRUE);
|
||||||
|
|
||||||
/* TODO - we could pass the spline! */
|
/* TODO - we could pass the spline! */
|
||||||
BKE_mask_object_shape_changed_add(maskobj, BKE_mask_object_shape_spline_to_index(maskobj, spline) + point_index + 1, TRUE, TRUE);
|
BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index + 1, TRUE, TRUE);
|
||||||
|
|
||||||
maskobj->act_point = new_point;
|
masklay->act_point = new_point;
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||||
|
|
||||||
@@ -1019,17 +1019,17 @@ static int add_vertex_subdivide(bContext *C, Mask *mask, const float co[2])
|
|||||||
|
|
||||||
/* **** add extrude vertex **** */
|
/* **** add extrude vertex **** */
|
||||||
|
|
||||||
static void finSelectedSplinePoint(MaskObject *maskobj, MaskSpline **spline, MaskSplinePoint **point, short check_active)
|
static void finSelectedSplinePoint(MaskLayer *masklay, MaskSpline **spline, MaskSplinePoint **point, short check_active)
|
||||||
{
|
{
|
||||||
MaskSpline *cur_spline = maskobj->splines.first;
|
MaskSpline *cur_spline = masklay->splines.first;
|
||||||
|
|
||||||
*spline = NULL;
|
*spline = NULL;
|
||||||
*point = NULL;
|
*point = NULL;
|
||||||
|
|
||||||
if (check_active) {
|
if (check_active) {
|
||||||
if (maskobj->act_spline && maskobj->act_point) {
|
if (masklay->act_spline && masklay->act_point) {
|
||||||
*spline = maskobj->act_spline;
|
*spline = masklay->act_spline;
|
||||||
*point = maskobj->act_point;
|
*point = masklay->act_point;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1060,7 +1060,7 @@ static void finSelectedSplinePoint(MaskObject *maskobj, MaskSpline **spline, Mas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_vertex_extrude(bContext *C, Mask *mask, MaskObject *maskobj, const float co[2])
|
static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const float co[2])
|
||||||
{
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskSplinePoint *point;
|
MaskSplinePoint *point;
|
||||||
@@ -1076,11 +1076,11 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskObject *maskobj, cons
|
|||||||
|
|
||||||
ED_mask_select_toggle_all(mask, SEL_DESELECT);
|
ED_mask_select_toggle_all(mask, SEL_DESELECT);
|
||||||
|
|
||||||
if (!maskobj) {
|
if (!masklay) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
finSelectedSplinePoint(maskobj, &spline, &point, TRUE);
|
finSelectedSplinePoint(masklay, &spline, &point, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
point_index = (point - spline->points);
|
point_index = (point - spline->points);
|
||||||
@@ -1141,13 +1141,13 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskObject *maskobj, cons
|
|||||||
new_point = &spline->points[point_index + 1];
|
new_point = &spline->points[point_index + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
maskobj->act_point = new_point;
|
masklay->act_point = new_point;
|
||||||
|
|
||||||
setup_vertex_point(C, mask, spline, new_point, co, NULL, ref_point, FALSE);
|
setup_vertex_point(C, mask, spline, new_point, co, NULL, ref_point, FALSE);
|
||||||
|
|
||||||
if (maskobj->splines_shapes.first) {
|
if (masklay->splines_shapes.first) {
|
||||||
point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
|
point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
|
||||||
BKE_mask_object_shape_changed_add(maskobj, BKE_mask_object_shape_spline_to_index(maskobj, spline) + point_index, TRUE, TRUE);
|
BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_recalc_src) {
|
if (do_recalc_src) {
|
||||||
@@ -1160,7 +1160,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskObject *maskobj, cons
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_vertex_new(bContext *C, Mask *mask, MaskObject *maskobj, const float co[2])
|
static int add_vertex_new(bContext *C, Mask *mask, MaskLayer *masklay, const float co[2])
|
||||||
{
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskSplinePoint *point;
|
MaskSplinePoint *point;
|
||||||
@@ -1168,32 +1168,32 @@ static int add_vertex_new(bContext *C, Mask *mask, MaskObject *maskobj, const fl
|
|||||||
|
|
||||||
ED_mask_select_toggle_all(mask, SEL_DESELECT);
|
ED_mask_select_toggle_all(mask, SEL_DESELECT);
|
||||||
|
|
||||||
if (!maskobj) {
|
if (!masklay) {
|
||||||
/* if there's no maskobj currently operationg on, create new one */
|
/* if there's no masklay currently operationg on, create new one */
|
||||||
maskobj = BKE_mask_object_new(mask, "");
|
masklay = BKE_mask_layer_new(mask, "");
|
||||||
mask->act_maskobj = mask->tot_maskobj - 1;
|
mask->masklay_act = mask->masklay_tot - 1;
|
||||||
spline = NULL;
|
spline = NULL;
|
||||||
point = NULL;
|
point = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
finSelectedSplinePoint(maskobj, &spline, &point, TRUE);
|
finSelectedSplinePoint(masklay, &spline, &point, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!spline) {
|
if (!spline) {
|
||||||
/* no selected splines in active maskobj, create new spline */
|
/* no selected splines in active masklay, create new spline */
|
||||||
spline = BKE_mask_spline_add(maskobj);
|
spline = BKE_mask_spline_add(masklay);
|
||||||
}
|
}
|
||||||
|
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
new_point = spline->points;
|
new_point = spline->points;
|
||||||
|
|
||||||
maskobj->act_point = new_point;
|
masklay->act_point = new_point;
|
||||||
|
|
||||||
setup_vertex_point(C, mask, spline, new_point, co, NULL, ref_point, FALSE);
|
setup_vertex_point(C, mask, spline, new_point, co, NULL, ref_point, FALSE);
|
||||||
|
|
||||||
{
|
{
|
||||||
int point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
|
int point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
|
||||||
BKE_mask_object_shape_changed_add(maskobj, BKE_mask_object_shape_spline_to_index(maskobj, spline) + point_index, TRUE, TRUE);
|
BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||||
@@ -1204,23 +1204,23 @@ static int add_vertex_new(bContext *C, Mask *mask, MaskObject *maskobj, const fl
|
|||||||
static int add_vertex_exec(bContext *C, wmOperator *op)
|
static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
float co[2];
|
float co[2];
|
||||||
|
|
||||||
maskobj = BKE_mask_object_active(mask);
|
masklay = BKE_mask_layer_active(mask);
|
||||||
|
|
||||||
if (maskobj && maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay && masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
maskobj = NULL;
|
masklay = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_float_get_array(op->ptr, "location", co);
|
RNA_float_get_array(op->ptr, "location", co);
|
||||||
|
|
||||||
if (maskobj && maskobj->act_point && MASKPOINT_ISSEL_ANY(maskobj->act_point)) {
|
if (masklay && masklay->act_point && MASKPOINT_ISSEL_ANY(masklay->act_point)) {
|
||||||
|
|
||||||
/* cheap trick - double click for cyclic */
|
/* cheap trick - double click for cyclic */
|
||||||
MaskSpline *spline = maskobj->act_spline;
|
MaskSpline *spline = masklay->act_spline;
|
||||||
MaskSplinePoint *point = maskobj->act_point;
|
MaskSplinePoint *point = masklay->act_point;
|
||||||
|
|
||||||
int is_sta = (point == spline->points);
|
int is_sta = (point == spline->points);
|
||||||
int is_end = (point == &spline->points[spline->tot_point - 1]);
|
int is_end = (point == &spline->points[spline->tot_point - 1]);
|
||||||
@@ -1249,14 +1249,14 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!add_vertex_subdivide(C, mask, co)) {
|
if (!add_vertex_subdivide(C, mask, co)) {
|
||||||
if (!add_vertex_extrude(C, mask, maskobj, co)) {
|
if (!add_vertex_extrude(C, mask, masklay, co)) {
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!add_vertex_subdivide(C, mask, co)) {
|
if (!add_vertex_subdivide(C, mask, co)) {
|
||||||
if (!add_vertex_new(C, mask, maskobj, co)) {
|
if (!add_vertex_new(C, mask, masklay, co)) {
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1304,7 +1304,7 @@ void MASK_OT_add_vertex(wmOperatorType *ot)
|
|||||||
static int add_feather_vertex_exec(bContext *C, wmOperator *op)
|
static int add_feather_vertex_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskSplinePoint *point = NULL;
|
MaskSplinePoint *point = NULL;
|
||||||
const float threshold = 9;
|
const float threshold = 9;
|
||||||
@@ -1316,7 +1316,7 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op)
|
|||||||
if (point)
|
if (point)
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
|
|
||||||
if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &maskobj, &spline, &point, &u, NULL)) {
|
if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &masklay, &spline, &point, &u, NULL)) {
|
||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
float w = BKE_mask_point_weight(spline, point, u);
|
float w = BKE_mask_point_weight(spline, point, u);
|
||||||
|
|
||||||
@@ -1370,16 +1370,16 @@ void MASK_OT_add_feather_vertex(wmOperatorType *ot)
|
|||||||
static int cyclic_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
static int cyclic_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
if (ED_mask_spline_select_check(spline->points, spline->tot_point)) {
|
if (ED_mask_spline_select_check(spline->points, spline->tot_point)) {
|
||||||
spline->flag ^= MASK_SPLINE_CYCLIC;
|
spline->flag ^= MASK_SPLINE_CYCLIC;
|
||||||
}
|
}
|
||||||
@@ -1447,17 +1447,17 @@ static void delete_feather_points(MaskSplinePoint *point)
|
|||||||
static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int mask_object_shape_ofs = 0;
|
int mask_layer_shape_ofs = 0;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
spline = maskobj->splines.first;
|
spline = masklay->splines.first;
|
||||||
|
|
||||||
while (spline) {
|
while (spline) {
|
||||||
const int tot_point_orig = spline->tot_point;
|
const int tot_point_orig = spline->tot_point;
|
||||||
@@ -1475,15 +1475,15 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
|
|
||||||
/* delete the whole spline */
|
/* delete the whole spline */
|
||||||
BLI_remlink(&maskobj->splines, spline);
|
BLI_remlink(&masklay->splines, spline);
|
||||||
BKE_mask_spline_free(spline);
|
BKE_mask_spline_free(spline);
|
||||||
|
|
||||||
if (spline == maskobj->act_spline) {
|
if (spline == masklay->act_spline) {
|
||||||
maskobj->act_spline = NULL;
|
masklay->act_spline = NULL;
|
||||||
maskobj->act_point = NULL;
|
masklay->act_point = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BKE_mask_object_shape_changed_remove(maskobj, mask_object_shape_ofs, tot_point_orig);
|
BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs, tot_point_orig);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MaskSplinePoint *new_points;
|
MaskSplinePoint *new_points;
|
||||||
@@ -1495,8 +1495,8 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
MaskSplinePoint *point = &spline->points[i];
|
MaskSplinePoint *point = &spline->points[i];
|
||||||
|
|
||||||
if (!MASKPOINT_ISSEL_ANY(point)) {
|
if (!MASKPOINT_ISSEL_ANY(point)) {
|
||||||
if (point == maskobj->act_point)
|
if (point == masklay->act_point)
|
||||||
maskobj->act_point = &new_points[j];
|
masklay->act_point = &new_points[j];
|
||||||
|
|
||||||
delete_feather_points(point);
|
delete_feather_points(point);
|
||||||
|
|
||||||
@@ -1504,17 +1504,17 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (point == maskobj->act_point)
|
if (point == masklay->act_point)
|
||||||
maskobj->act_point = NULL;
|
masklay->act_point = NULL;
|
||||||
|
|
||||||
BKE_mask_point_free(point);
|
BKE_mask_point_free(point);
|
||||||
spline->tot_point--;
|
spline->tot_point--;
|
||||||
|
|
||||||
BKE_mask_object_shape_changed_remove(maskobj, mask_object_shape_ofs + j, 1);
|
BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs + j, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mask_object_shape_ofs += spline->tot_point;
|
mask_layer_shape_ofs += spline->tot_point;
|
||||||
|
|
||||||
MEM_freeN(spline->points);
|
MEM_freeN(spline->points);
|
||||||
spline->points = new_points;
|
spline->points = new_points;
|
||||||
@@ -1555,18 +1555,18 @@ void MASK_OT_delete(wmOperatorType *ot)
|
|||||||
static int set_handle_type_exec(bContext *C, wmOperator *op)
|
static int set_handle_type_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int handle_type = RNA_enum_get(op->ptr, "type");
|
int handle_type = RNA_enum_get(op->ptr, "type");
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
MaskSplinePoint *point = &spline->points[i];
|
MaskSplinePoint *point = &spline->points[i];
|
||||||
|
|
||||||
@@ -1616,14 +1616,14 @@ void MASK_OT_handle_type_set(wmOperatorType *ot)
|
|||||||
static int mask_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
static int mask_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int changed = FALSE;
|
int changed = FALSE;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
|
|
||||||
if (maskobj->restrictflag & OB_RESTRICT_VIEW) {
|
if (masklay->restrictflag & OB_RESTRICT_VIEW) {
|
||||||
ED_mask_object_select_set(maskobj, TRUE);
|
ED_mask_layer_select_set(masklay, TRUE);
|
||||||
maskobj->restrictflag &= ~OB_RESTRICT_VIEW;
|
masklay->restrictflag &= ~OB_RESTRICT_VIEW;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1644,7 +1644,7 @@ void MASK_OT_hide_view_clear(wmOperatorType *ot)
|
|||||||
|
|
||||||
/* identifiers */
|
/* identifiers */
|
||||||
ot->name = "Clear Restrict View";
|
ot->name = "Clear Restrict View";
|
||||||
ot->description = "Reveal the object by setting the hide flag";
|
ot->description = "Reveal the layer by setting the hide flag";
|
||||||
ot->idname = "MASK_OT_hide_view_clear";
|
ot->idname = "MASK_OT_hide_view_clear";
|
||||||
|
|
||||||
/* api callbacks */
|
/* api callbacks */
|
||||||
@@ -1658,33 +1658,33 @@ void MASK_OT_hide_view_clear(wmOperatorType *ot)
|
|||||||
static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
|
static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
const int unselected = RNA_boolean_get(op->ptr, "unselected");
|
const int unselected = RNA_boolean_get(op->ptr, "unselected");
|
||||||
int changed = FALSE;
|
int changed = FALSE;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
|
|
||||||
if (maskobj->restrictflag & MASK_RESTRICT_SELECT) {
|
if (masklay->restrictflag & MASK_RESTRICT_SELECT) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!unselected) {
|
if (!unselected) {
|
||||||
if (ED_mask_object_select_check(maskobj)) {
|
if (ED_mask_layer_select_check(masklay)) {
|
||||||
ED_mask_object_select_set(maskobj, FALSE);
|
ED_mask_layer_select_set(masklay, FALSE);
|
||||||
|
|
||||||
maskobj->restrictflag |= OB_RESTRICT_VIEW;
|
masklay->restrictflag |= OB_RESTRICT_VIEW;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
if (maskobj == BKE_mask_object_active(mask)) {
|
if (masklay == BKE_mask_layer_active(mask)) {
|
||||||
BKE_mask_object_active_set(mask, NULL);
|
BKE_mask_layer_active_set(mask, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!ED_mask_object_select_check(maskobj)) {
|
if (!ED_mask_layer_select_check(masklay)) {
|
||||||
maskobj->restrictflag |= OB_RESTRICT_VIEW;
|
masklay->restrictflag |= OB_RESTRICT_VIEW;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
if (maskobj == BKE_mask_object_active(mask)) {
|
if (masklay == BKE_mask_layer_active(mask)) {
|
||||||
BKE_mask_object_active_set(mask, NULL);
|
BKE_mask_layer_active_set(mask, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1705,7 +1705,7 @@ void MASK_OT_hide_view_set(wmOperatorType *ot)
|
|||||||
{
|
{
|
||||||
/* identifiers */
|
/* identifiers */
|
||||||
ot->name = "Set Restrict View";
|
ot->name = "Set Restrict View";
|
||||||
ot->description = "Hide the object by setting the hide flag";
|
ot->description = "Hide the layer by setting the hide flag";
|
||||||
ot->idname = "MASK_OT_hide_view_set";
|
ot->idname = "MASK_OT_hide_view_set";
|
||||||
|
|
||||||
/* api callbacks */
|
/* api callbacks */
|
||||||
@@ -1715,6 +1715,6 @@ void MASK_OT_hide_view_set(wmOperatorType *ot)
|
|||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
|
|
||||||
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
|
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected layers");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,17 +60,17 @@
|
|||||||
static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
MaskSplinePoint *point = &spline->points[i];
|
MaskSplinePoint *point = &spline->points[i];
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ void MASK_OT_parent_clear(wmOperatorType *ot)
|
|||||||
static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
|
static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
/* parent info */
|
/* parent info */
|
||||||
SpaceClip *sc;
|
SpaceClip *sc;
|
||||||
@@ -132,15 +132,15 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
BKE_mask_coord_from_movieclip(clip, &sc->user, parmask_pos, marker_pos_ofs);
|
BKE_mask_coord_from_movieclip(clip, &sc->user, parmask_pos, marker_pos_ofs);
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
MaskSplinePoint *point = &spline->points[i];
|
MaskSplinePoint *point = &spline->points[i];
|
||||||
|
|
||||||
|
|||||||
@@ -71,15 +71,15 @@ int ED_mask_spline_select_check(MaskSplinePoint *points, int tot_point)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ED_mask_object_select_check(MaskObject *maskobj)
|
int ED_mask_layer_select_check(MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
if (ED_mask_spline_select_check(spline->points, spline->tot_point)) {
|
if (ED_mask_spline_select_check(spline->points, spline->tot_point)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -90,10 +90,10 @@ int ED_mask_object_select_check(MaskObject *maskobj)
|
|||||||
|
|
||||||
int ED_mask_select_check(Mask *mask)
|
int ED_mask_select_check(Mask *mask)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
if (ED_mask_object_select_check(maskobj)) {
|
if (ED_mask_layer_select_check(masklay)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,17 +101,17 @@ int ED_mask_select_check(Mask *mask)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ED_mask_object_select_set(MaskObject *maskobj, int select)
|
void ED_mask_layer_select_set(MaskLayer *masklay, int select)
|
||||||
{
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & MASK_RESTRICT_SELECT) {
|
if (masklay->restrictflag & MASK_RESTRICT_SELECT) {
|
||||||
if (select == TRUE) {
|
if (select == TRUE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (select)
|
if (select)
|
||||||
@@ -129,7 +129,7 @@ void ED_mask_object_select_set(MaskObject *maskobj, int select)
|
|||||||
|
|
||||||
void ED_mask_select_toggle_all(Mask *mask, int action)
|
void ED_mask_select_toggle_all(Mask *mask, int action)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
if (action == SEL_TOGGLE) {
|
if (action == SEL_TOGGLE) {
|
||||||
if (ED_mask_select_check(mask))
|
if (ED_mask_select_check(mask))
|
||||||
@@ -138,31 +138,31 @@ void ED_mask_select_toggle_all(Mask *mask, int action)
|
|||||||
action = SEL_SELECT;
|
action = SEL_SELECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
|
|
||||||
if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
|
if (masklay->restrictflag & MASK_RESTRICT_VIEW) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ED_mask_object_select_set(maskobj, (action == SEL_SELECT) ? TRUE : FALSE);
|
ED_mask_layer_select_set(masklay, (action == SEL_SELECT) ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ED_mask_select_flush_all(Mask *mask)
|
void ED_mask_select_flush_all(Mask *mask)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
spline->flag &= ~SELECT;
|
spline->flag &= ~SELECT;
|
||||||
|
|
||||||
/* intentionally _dont_ do this in the maskobj loop
|
/* intentionally _dont_ do this in the masklay loop
|
||||||
* so we clear flags on all splines */
|
* so we clear flags on all splines */
|
||||||
if (maskobj->restrictflag & MASK_RESTRICT_VIEW) {
|
if (masklay->restrictflag & MASK_RESTRICT_VIEW) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ void MASK_OT_select_all(wmOperatorType *ot)
|
|||||||
static int select_exec(bContext *C, wmOperator *op)
|
static int select_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskSplinePoint *point = NULL;
|
MaskSplinePoint *point = NULL;
|
||||||
float co[2];
|
float co[2];
|
||||||
@@ -238,7 +238,7 @@ static int select_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
RNA_float_get_array(op->ptr, "location", co);
|
RNA_float_get_array(op->ptr, "location", co);
|
||||||
|
|
||||||
point = ED_mask_point_find_nearest(C, mask, co, threshold, &maskobj, &spline, &is_handle, NULL);
|
point = ED_mask_point_find_nearest(C, mask, co, threshold, &masklay, &spline, &is_handle, NULL);
|
||||||
|
|
||||||
if (point) {
|
if (point) {
|
||||||
if (extend == 0 && deselect == 0 && toggle == 0)
|
if (extend == 0 && deselect == 0 && toggle == 0)
|
||||||
@@ -246,8 +246,8 @@ static int select_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
if (is_handle) {
|
if (is_handle) {
|
||||||
if (extend) {
|
if (extend) {
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
maskobj->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
BKE_mask_point_select_set_handle(point, TRUE);
|
BKE_mask_point_select_set_handle(point, TRUE);
|
||||||
}
|
}
|
||||||
@@ -255,8 +255,8 @@ static int select_exec(bContext *C, wmOperator *op)
|
|||||||
BKE_mask_point_select_set_handle(point, FALSE);
|
BKE_mask_point_select_set_handle(point, FALSE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
maskobj->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
if (!MASKPOINT_ISSEL_HANDLE(point)) {
|
if (!MASKPOINT_ISSEL_HANDLE(point)) {
|
||||||
BKE_mask_point_select_set_handle(point, TRUE);
|
BKE_mask_point_select_set_handle(point, TRUE);
|
||||||
@@ -268,8 +268,8 @@ static int select_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (extend) {
|
if (extend) {
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
maskobj->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
BKE_mask_point_select_set(point, TRUE);
|
BKE_mask_point_select_set(point, TRUE);
|
||||||
}
|
}
|
||||||
@@ -277,8 +277,8 @@ static int select_exec(bContext *C, wmOperator *op)
|
|||||||
BKE_mask_point_select_set(point, FALSE);
|
BKE_mask_point_select_set(point, FALSE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
maskobj->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
if (!MASKPOINT_ISSEL_ANY(point)) {
|
if (!MASKPOINT_ISSEL_ANY(point)) {
|
||||||
BKE_mask_point_select_set(point, TRUE);
|
BKE_mask_point_select_set(point, TRUE);
|
||||||
@@ -289,8 +289,8 @@ static int select_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
maskobj->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
ED_mask_select_flush_all(mask);
|
ED_mask_select_flush_all(mask);
|
||||||
|
|
||||||
@@ -301,15 +301,15 @@ static int select_exec(bContext *C, wmOperator *op)
|
|||||||
else {
|
else {
|
||||||
MaskSplinePointUW *uw;
|
MaskSplinePointUW *uw;
|
||||||
|
|
||||||
if (ED_mask_feather_find_nearest(C, mask, co, threshold, &maskobj, &spline, &point, &uw, NULL)) {
|
if (ED_mask_feather_find_nearest(C, mask, co, threshold, &masklay, &spline, &point, &uw, NULL)) {
|
||||||
if (!extend)
|
if (!extend)
|
||||||
ED_mask_select_toggle_all(mask, SEL_DESELECT);
|
ED_mask_select_toggle_all(mask, SEL_DESELECT);
|
||||||
|
|
||||||
if (uw)
|
if (uw)
|
||||||
uw->flag |= SELECT;
|
uw->flag |= SELECT;
|
||||||
|
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
maskobj->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
ED_mask_select_flush_all(mask);
|
ED_mask_select_flush_all(mask);
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ void MASK_OT_select(wmOperatorType *ot)
|
|||||||
static int border_select_exec(bContext *C, wmOperator *op)
|
static int border_select_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rcti rect;
|
rcti rect;
|
||||||
@@ -382,14 +382,14 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
|||||||
extend = RNA_boolean_get(op->ptr, "extend");
|
extend = RNA_boolean_get(op->ptr, "extend");
|
||||||
|
|
||||||
/* do actual selection */
|
/* do actual selection */
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
@@ -447,7 +447,7 @@ void MASK_OT_select_border(wmOperatorType *ot)
|
|||||||
static int do_lasso_select_mask(bContext *C, int mcords[][2], short moves, short select)
|
static int do_lasso_select_mask(bContext *C, int mcords[][2], short moves, short select)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rcti rect;
|
rcti rect;
|
||||||
@@ -457,14 +457,14 @@ static int do_lasso_select_mask(bContext *C, int mcords[][2], short moves, short
|
|||||||
BLI_lasso_boundbox(&rect, mcords, moves);
|
BLI_lasso_boundbox(&rect, mcords, moves);
|
||||||
|
|
||||||
/* do actual selection */
|
/* do actual selection */
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
@@ -559,7 +559,7 @@ static int mask_spline_point_inside_ellipse(BezTriple *bezt, float offset[2], fl
|
|||||||
static int circle_select_exec(bContext *C, wmOperator *op)
|
static int circle_select_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||||
@@ -586,14 +586,14 @@ static int circle_select_exec(bContext *C, wmOperator *op)
|
|||||||
ED_mask_point_pos(C, x, y, &offset[0], &offset[1]);
|
ED_mask_point_pos(C, x, y, &offset[0], &offset[1]);
|
||||||
|
|
||||||
/* do actual selection */
|
/* do actual selection */
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
|
|||||||
@@ -61,18 +61,18 @@ static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
const int frame = CFRA;
|
const int frame = CFRA;
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int change = FALSE;
|
int change = FALSE;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
if (!ED_mask_object_select_check(maskobj)) {
|
if (!ED_mask_layer_select_check(masklay)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
maskobj_shape = BKE_mask_object_shape_varify_frame(maskobj, frame);
|
masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, frame);
|
||||||
BKE_mask_object_shape_from_mask(maskobj, maskobj_shape);
|
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
|
||||||
change = TRUE;
|
change = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,20 +107,20 @@ static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
const int frame = CFRA;
|
const int frame = CFRA;
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int change = FALSE;
|
int change = FALSE;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
if (!ED_mask_object_select_check(maskobj)) {
|
if (!ED_mask_layer_select_check(masklay)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
maskobj_shape = BKE_mask_object_shape_find_frame(maskobj, frame);
|
masklay_shape = BKE_mask_layer_shape_find_frame(masklay, frame);
|
||||||
|
|
||||||
if (maskobj_shape) {
|
if (masklay_shape) {
|
||||||
BKE_mask_object_shape_unlink(maskobj, maskobj_shape);
|
BKE_mask_layer_shape_unlink(masklay, masklay_shape);
|
||||||
change = TRUE;
|
change = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,16 +151,16 @@ void MASK_OT_shape_key_clear(wmOperatorType *ot)
|
|||||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ED_mask_object_shape_auto_key_all(Mask *mask, const int frame)
|
int ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
int change = FALSE;
|
int change = FALSE;
|
||||||
|
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
maskobj_shape = BKE_mask_object_shape_varify_frame(maskobj, frame);
|
masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, frame);
|
||||||
BKE_mask_object_shape_from_mask(maskobj, maskobj_shape);
|
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
|
||||||
change = TRUE;
|
change = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1952,8 +1952,8 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
|
|||||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||||
if (sc) {
|
if (sc) {
|
||||||
if ((sc->mode == SC_MODE_MASKEDITING) && sc->mask) {
|
if ((sc->mode == SC_MODE_MASKEDITING) && sc->mask) {
|
||||||
MaskObject *maskobj = BKE_mask_object_active(sc->mask);
|
MaskLayer *masklay = BKE_mask_layer_active(sc->mask);
|
||||||
mask_to_keylist(&ads, maskobj, &keys);
|
mask_to_keylist(&ads, masklay, &keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,18 +199,18 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
|
|||||||
|
|
||||||
/* movie clip animation */
|
/* movie clip animation */
|
||||||
if ((sc->mode == SC_MODE_MASKEDITING) && sc->mask) {
|
if ((sc->mode == SC_MODE_MASKEDITING) && sc->mask) {
|
||||||
MaskObject *maskobj = BKE_mask_object_active(sc->mask);
|
MaskLayer *masklay = BKE_mask_layer_active(sc->mask);
|
||||||
if (maskobj) {
|
if (masklay) {
|
||||||
MaskObjectShape *maskobj_shape;
|
MaskLayerShape *masklay_shape;
|
||||||
|
|
||||||
glColor4ub(255, 175, 0, 255);
|
glColor4ub(255, 175, 0, 255);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
|
|
||||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
for (masklay_shape = masklay->splines_shapes.first;
|
||||||
maskobj_shape;
|
masklay_shape;
|
||||||
maskobj_shape = maskobj_shape->next)
|
masklay_shape = masklay_shape->next)
|
||||||
{
|
{
|
||||||
i = maskobj_shape->frame;
|
i = masklay_shape->frame;
|
||||||
|
|
||||||
/* glRecti((i - sfra) * framelen, 0, (i - sfra + 1) * framelen, 4); */
|
/* glRecti((i - sfra) * framelen, 0, (i - sfra + 1) * framelen, 4); */
|
||||||
|
|
||||||
|
|||||||
@@ -4915,7 +4915,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
|
|||||||
if (IS_AUTOKEY_ON(t->scene)) {
|
if (IS_AUTOKEY_ON(t->scene)) {
|
||||||
Scene *scene = t->scene;
|
Scene *scene = t->scene;
|
||||||
|
|
||||||
ED_mask_object_shape_auto_key_all(mask, CFRA);
|
ED_mask_layer_shape_auto_key_all(mask, CFRA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5974,7 +5974,7 @@ static void createTransMaskingData(bContext *C, TransInfo *t)
|
|||||||
{
|
{
|
||||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||||
Mask *mask = CTX_data_edit_mask(C);
|
Mask *mask = CTX_data_edit_mask(C);
|
||||||
MaskObject *maskobj;
|
MaskLayer *masklay;
|
||||||
TransData *td = NULL;
|
TransData *td = NULL;
|
||||||
TransData2D *td2d = NULL;
|
TransData2D *td2d = NULL;
|
||||||
TransDataMasking *tdm = NULL;
|
TransDataMasking *tdm = NULL;
|
||||||
@@ -5982,14 +5982,14 @@ static void createTransMaskingData(bContext *C, TransInfo *t)
|
|||||||
int propmode = t->flag & T_PROP_EDIT;
|
int propmode = t->flag & T_PROP_EDIT;
|
||||||
|
|
||||||
/* count */
|
/* count */
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline = maskobj->splines.first;
|
MaskSpline *spline = masklay->splines.first;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
@@ -6021,14 +6021,14 @@ static void createTransMaskingData(bContext *C, TransInfo *t)
|
|||||||
t->flag |= T_FREE_CUSTOMDATA;
|
t->flag |= T_FREE_CUSTOMDATA;
|
||||||
|
|
||||||
/* create data */
|
/* create data */
|
||||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||||
MaskSpline *spline = maskobj->splines.first;
|
MaskSpline *spline = masklay->splines.first;
|
||||||
|
|
||||||
if (maskobj->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < spline->tot_point; i++) {
|
for (i = 0; i < spline->tot_point; i++) {
|
||||||
|
|||||||
@@ -43,9 +43,9 @@
|
|||||||
typedef struct Mask {
|
typedef struct Mask {
|
||||||
ID id;
|
ID id;
|
||||||
struct AnimData *adt;
|
struct AnimData *adt;
|
||||||
ListBase maskobjs; /* mask objects */
|
ListBase masklayers; /* mask layers */
|
||||||
int act_maskobj; /* index of active mask object (-1 == None) */
|
int masklay_act; /* index of active mask layer (-1 == None) */
|
||||||
int tot_maskobj; /* total number of mask objects */
|
int masklay_tot; /* total number of mask layers */
|
||||||
} Mask;
|
} Mask;
|
||||||
|
|
||||||
typedef struct MaskParent {
|
typedef struct MaskParent {
|
||||||
@@ -54,7 +54,7 @@ typedef struct MaskParent {
|
|||||||
ID *id; /* ID block of entity to which mask/spline is parented to
|
ID *id; /* ID block of entity to which mask/spline is parented to
|
||||||
* in case of parenting to movie tracking data set to MovieClip datablock */
|
* in case of parenting to movie tracking data set to MovieClip datablock */
|
||||||
char parent[64]; /* entity of parent to which parenting happened
|
char parent[64]; /* entity of parent to which parenting happened
|
||||||
* in case of parenting to movie tracking data contains name of object */
|
* in case of parenting to movie tracking data contains name of layer */
|
||||||
char sub_parent[64]; /* sub-entity of parent to which parenting happened
|
char sub_parent[64]; /* sub-entity of parent to which parenting happened
|
||||||
* in case of parenting to movie tracking data contains name of track */
|
* in case of parenting to movie tracking data contains name of track */
|
||||||
float parent_orig[2]; /* track location at the moment of parenting */
|
float parent_orig[2]; /* track location at the moment of parenting */
|
||||||
@@ -87,22 +87,22 @@ typedef struct MaskSpline {
|
|||||||
} MaskSpline;
|
} MaskSpline;
|
||||||
|
|
||||||
/* one per frame */
|
/* one per frame */
|
||||||
typedef struct MaskObjectShape {
|
typedef struct MaskLayerShape {
|
||||||
struct MaskObjectShape *next, *prev;
|
struct MaskLayerShape *next, *prev;
|
||||||
|
|
||||||
float *data; /* u coordinate along spline segment and weight of this point */
|
float *data; /* u coordinate along spline segment and weight of this point */
|
||||||
int tot_vert; /* to ensure no buffer overruns's: alloc size is (tot_vert * MASK_OBJECT_SHAPE_ELEM_SIZE) */
|
int tot_vert; /* to ensure no buffer overruns's: alloc size is (tot_vert * MASK_OBJECT_SHAPE_ELEM_SIZE) */
|
||||||
int frame; /* different flags of this point */
|
int frame; /* different flags of this point */
|
||||||
char flag;
|
char flag;
|
||||||
char pad[7];
|
char pad[7];
|
||||||
} MaskObjectShape;
|
} MaskLayerShape;
|
||||||
|
|
||||||
typedef struct MaskObject {
|
typedef struct MaskLayer {
|
||||||
struct MaskObject *next, *prev;
|
struct MaskLayer *next, *prev;
|
||||||
|
|
||||||
char name[64]; /* name of the mask object (64 = MAD_ID_NAME - 2) */
|
char name[64]; /* name of the mask layer (64 = MAD_ID_NAME - 2) */
|
||||||
|
|
||||||
ListBase splines; /* list of splines which defines this mask object */
|
ListBase splines; /* list of splines which defines this mask layer */
|
||||||
ListBase splines_shapes;
|
ListBase splines_shapes;
|
||||||
|
|
||||||
struct MaskSpline *act_spline; /* active spline */
|
struct MaskSpline *act_spline; /* active spline */
|
||||||
@@ -116,7 +116,7 @@ typedef struct MaskObject {
|
|||||||
//char flag; /* not used yet */
|
//char flag; /* not used yet */
|
||||||
char restrictflag; /* matching 'Object' flag of the same name - eventually use in the outliner */
|
char restrictflag; /* matching 'Object' flag of the same name - eventually use in the outliner */
|
||||||
char pad[1];
|
char pad[1];
|
||||||
} MaskObject;
|
} MaskLayer;
|
||||||
|
|
||||||
/* MaskParent->flag */
|
/* MaskParent->flag */
|
||||||
#define MASK_PARENT_ACTIVE (1 << 0)
|
#define MASK_PARENT_ACTIVE (1 << 0)
|
||||||
@@ -148,13 +148,13 @@ enum {
|
|||||||
MASK_DT_WHITE
|
MASK_DT_WHITE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* maskobj->blend */
|
/* masklay->blend */
|
||||||
enum {
|
enum {
|
||||||
MASK_BLEND_ADD = 0,
|
MASK_BLEND_ADD = 0,
|
||||||
MASK_BLEND_SUBTRACT = 1
|
MASK_BLEND_SUBTRACT = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* maskobj->blend_flag */
|
/* masklay->blend_flag */
|
||||||
enum {
|
enum {
|
||||||
MASK_BLENDFLAG_INVERT = (1 << 0)
|
MASK_BLENDFLAG_INVERT = (1 << 0)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ extern StructRNA RNA_MaterialSubsurfaceScattering;
|
|||||||
extern StructRNA RNA_MaterialTextureSlot;
|
extern StructRNA RNA_MaterialTextureSlot;
|
||||||
extern StructRNA RNA_MaterialVolume;
|
extern StructRNA RNA_MaterialVolume;
|
||||||
extern StructRNA RNA_Mask;
|
extern StructRNA RNA_Mask;
|
||||||
extern StructRNA RNA_MaskObject;
|
extern StructRNA RNA_MaskLayer;
|
||||||
extern StructRNA RNA_Menu;
|
extern StructRNA RNA_Menu;
|
||||||
extern StructRNA RNA_Mesh;
|
extern StructRNA RNA_Mesh;
|
||||||
extern StructRNA RNA_MeshColor;
|
extern StructRNA RNA_MeshColor;
|
||||||
|
|||||||
@@ -93,114 +93,114 @@ static void rna_MaskParent_id_type_set(PointerRNA *ptr, int value)
|
|||||||
mpar->id = NULL;
|
mpar->id = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Mask_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
static void rna_Mask_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->id.data;
|
Mask *mask = (Mask *)ptr->id.data;
|
||||||
|
|
||||||
rna_iterator_listbase_begin(iter, &mask->maskobjs, NULL);
|
rna_iterator_listbase_begin(iter, &mask->masklayers, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_Mask_object_active_index_get(PointerRNA *ptr)
|
static int rna_Mask_layer_active_index_get(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->id.data;
|
Mask *mask = (Mask *)ptr->id.data;
|
||||||
|
|
||||||
return mask->act_maskobj;
|
return mask->masklay_act;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Mask_object_active_index_set(PointerRNA *ptr, int value)
|
static void rna_Mask_layer_active_index_set(PointerRNA *ptr, int value)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->id.data;
|
Mask *mask = (Mask *)ptr->id.data;
|
||||||
|
|
||||||
mask->act_maskobj = value;
|
mask->masklay_act = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Mask_object_active_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
|
static void rna_Mask_layer_active_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->id.data;
|
Mask *mask = (Mask *)ptr->id.data;
|
||||||
|
|
||||||
*min = 0;
|
*min = 0;
|
||||||
*max = mask->tot_maskobj - 1;
|
*max = mask->masklay_tot - 1;
|
||||||
*max = MAX2(0, *max);
|
*max = MAX2(0, *max);
|
||||||
|
|
||||||
*softmin = *min;
|
*softmin = *min;
|
||||||
*softmax = *max;
|
*softmax = *max;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *rna_MaskObject_path(PointerRNA *ptr)
|
static char *rna_MaskLayer_path(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
return BLI_sprintfN("objects[\"%s\"]", ((MaskObject *)ptr->data)->name);
|
return BLI_sprintfN("layers[\"%s\"]", ((MaskLayer *)ptr->data)->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PointerRNA rna_Mask_object_active_get(PointerRNA *ptr)
|
static PointerRNA rna_Mask_layer_active_get(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->id.data;
|
Mask *mask = (Mask *)ptr->id.data;
|
||||||
MaskObject *maskobj = BKE_mask_object_active(mask);
|
MaskLayer *masklay = BKE_mask_layer_active(mask);
|
||||||
|
|
||||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskObject, maskobj);
|
return rna_pointer_inherit_refine(ptr, &RNA_MaskLayer, masklay);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Mask_object_active_set(PointerRNA *ptr, PointerRNA value)
|
static void rna_Mask_layer_active_set(PointerRNA *ptr, PointerRNA value)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->id.data;
|
Mask *mask = (Mask *)ptr->id.data;
|
||||||
MaskObject *maskobj = (MaskObject *)value.data;
|
MaskLayer *masklay = (MaskLayer *)value.data;
|
||||||
|
|
||||||
BKE_mask_object_active_set(mask, maskobj);
|
BKE_mask_layer_active_set(mask, masklay);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskObject_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
static void rna_MaskLayer_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
|
|
||||||
rna_iterator_listbase_begin(iter, &maskobj->splines, NULL);
|
rna_iterator_listbase_begin(iter, &masklay->splines, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rna_MaskObject_name_set(PointerRNA *ptr, const char *value)
|
void rna_MaskLayer_name_set(PointerRNA *ptr, const char *value)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->id.data;
|
Mask *mask = (Mask *)ptr->id.data;
|
||||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
|
|
||||||
BLI_strncpy(maskobj->name, value, sizeof(maskobj->name));
|
BLI_strncpy(masklay->name, value, sizeof(masklay->name));
|
||||||
|
|
||||||
BKE_mask_object_unique_name(mask, maskobj);
|
BKE_mask_layer_unique_name(mask, masklay);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PointerRNA rna_MaskObject_active_spline_get(PointerRNA *ptr)
|
static PointerRNA rna_MaskLayer_active_spline_get(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
|
|
||||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskSpline, maskobj->act_spline);
|
return rna_pointer_inherit_refine(ptr, &RNA_MaskSpline, masklay->act_spline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskObject_active_spline_set(PointerRNA *ptr, PointerRNA value)
|
static void rna_MaskLayer_active_spline_set(PointerRNA *ptr, PointerRNA value)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
MaskSpline *spline = (MaskSpline *)value.data;
|
MaskSpline *spline = (MaskSpline *)value.data;
|
||||||
int index = BLI_findindex(&maskobj->splines, spline);
|
int index = BLI_findindex(&masklay->splines, spline);
|
||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
maskobj->act_spline = spline;
|
masklay->act_spline = spline;
|
||||||
else
|
else
|
||||||
maskobj->act_spline = NULL;
|
masklay->act_spline = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PointerRNA rna_MaskObject_active_spline_point_get(PointerRNA *ptr)
|
static PointerRNA rna_MaskLayer_active_spline_point_get(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
|
|
||||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskSplinePoint, maskobj->act_point);
|
return rna_pointer_inherit_refine(ptr, &RNA_MaskSplinePoint, masklay->act_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskObject_active_spline_point_set(PointerRNA *ptr, PointerRNA value)
|
static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr, PointerRNA value)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
MaskSplinePoint *point = (MaskSplinePoint *)value.data;
|
MaskSplinePoint *point = (MaskSplinePoint *)value.data;
|
||||||
|
|
||||||
maskobj->act_point = NULL;
|
masklay->act_point = NULL;
|
||||||
|
|
||||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||||
if (point >= spline->points && point < spline->points + spline->tot_point) {
|
if (point >= spline->points && point < spline->points + spline->tot_point) {
|
||||||
maskobj->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -285,29 +285,29 @@ static void rna_MaskSplinePoint_handle_type_set(PointerRNA *ptr, int value)
|
|||||||
|
|
||||||
/* ** API ** */
|
/* ** API ** */
|
||||||
|
|
||||||
static MaskObject *rna_Mask_object_new(Mask *mask, const char *name)
|
static MaskLayer *rna_Mask_layer_new(Mask *mask, const char *name)
|
||||||
{
|
{
|
||||||
MaskObject *maskobj = BKE_mask_object_new(mask, name);
|
MaskLayer *masklay = BKE_mask_layer_new(mask, name);
|
||||||
|
|
||||||
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
||||||
|
|
||||||
return maskobj;
|
return masklay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rna_Mask_object_remove(Mask *mask, MaskObject *maskobj)
|
void rna_Mask_layer_remove(Mask *mask, MaskLayer *masklay)
|
||||||
{
|
{
|
||||||
BKE_mask_object_remove(mask, maskobj);
|
BKE_mask_layer_remove(mask, masklay);
|
||||||
|
|
||||||
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskObject_spline_add(ID *id, MaskObject *maskobj, int number)
|
static void rna_MaskLayer_spline_add(ID *id, MaskLayer *masklay, int number)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask*) id;
|
Mask *mask = (Mask*) id;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < number; i++)
|
for (i = 0; i < number; i++)
|
||||||
BKE_mask_spline_add(maskobj);
|
BKE_mask_spline_add(masklay);
|
||||||
|
|
||||||
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ static void rna_def_maskParent(BlenderRNA *brna)
|
|||||||
prop = RNA_def_property(srna, "use_parent", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "use_parent", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_PARENT_ACTIVE);
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_PARENT_ACTIVE);
|
||||||
RNA_def_property_ui_text(prop, "Use Parent", "Use parenting for this object");
|
RNA_def_property_ui_text(prop, "Use Parent", "Use parenting for this layer");
|
||||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||||
|
|
||||||
/* Target Properties - ID-block to Drive */
|
/* Target Properties - ID-block to Drive */
|
||||||
@@ -460,27 +460,27 @@ static void rna_def_mask_splines(BlenderRNA *brna)
|
|||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
|
|
||||||
srna = RNA_def_struct(brna, "MaskSplines", NULL);
|
srna = RNA_def_struct(brna, "MaskSplines", NULL);
|
||||||
RNA_def_struct_sdna(srna, "MaskObject");
|
RNA_def_struct_sdna(srna, "MaskLayer");
|
||||||
RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
|
RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
|
||||||
|
|
||||||
func = RNA_def_function(srna, "add", "rna_MaskObject_spline_add");
|
func = RNA_def_function(srna, "add", "rna_MaskLayer_spline_add");
|
||||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||||
RNA_def_function_ui_description(func, "Add a number of splines to mask object");
|
RNA_def_function_ui_description(func, "Add a number of splines to mask layer");
|
||||||
RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of splines to add to the object", 0, INT_MAX);
|
RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of splines to add to the layer", 0, INT_MAX);
|
||||||
|
|
||||||
/* active spline */
|
/* active spline */
|
||||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||||
RNA_def_property_struct_type(prop, "MaskSpline");
|
RNA_def_property_struct_type(prop, "MaskSpline");
|
||||||
RNA_def_property_pointer_funcs(prop, "rna_MaskObject_active_spline_get", "rna_MaskObject_active_spline_set", NULL, NULL);
|
RNA_def_property_pointer_funcs(prop, "rna_MaskLayer_active_spline_get", "rna_MaskLayer_active_spline_set", NULL, NULL);
|
||||||
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
||||||
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking object");
|
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
|
||||||
|
|
||||||
/* active point */
|
/* active point */
|
||||||
prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
|
prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
|
||||||
RNA_def_property_struct_type(prop, "MaskSplinePoint");
|
RNA_def_property_struct_type(prop, "MaskSplinePoint");
|
||||||
RNA_def_property_pointer_funcs(prop, "rna_MaskObject_active_spline_point_get", "rna_MaskObject_active_spline_point_set", NULL, NULL);
|
RNA_def_property_pointer_funcs(prop, "rna_MaskLayer_active_spline_point_get", "rna_MaskLayer_active_spline_point_set", NULL, NULL);
|
||||||
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
||||||
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking object");
|
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_maskSpline(BlenderRNA *brna)
|
static void rna_def_maskSpline(BlenderRNA *brna)
|
||||||
@@ -514,9 +514,9 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
|||||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_mask_object(BlenderRNA *brna)
|
static void rna_def_mask_layer(BlenderRNA *brna)
|
||||||
{
|
{
|
||||||
static EnumPropertyItem maskobj_blend_mode_items[] = {
|
static EnumPropertyItem masklay_blend_mode_items[] = {
|
||||||
{MASK_BLEND_ADD, "ADD", 0, "Add", ""},
|
{MASK_BLEND_ADD, "ADD", 0, "Add", ""},
|
||||||
{MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
|
{MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
|
||||||
{0, NULL, 0, NULL, NULL}
|
{0, NULL, 0, NULL, NULL}
|
||||||
@@ -528,23 +528,23 @@ static void rna_def_mask_object(BlenderRNA *brna)
|
|||||||
rna_def_maskSpline(brna);
|
rna_def_maskSpline(brna);
|
||||||
rna_def_mask_splines(brna);
|
rna_def_mask_splines(brna);
|
||||||
|
|
||||||
srna = RNA_def_struct(brna, "MaskObject", NULL);
|
srna = RNA_def_struct(brna, "MaskLayer", NULL);
|
||||||
RNA_def_struct_ui_text(srna, "Mask Object", "Single object used for masking pixels");
|
RNA_def_struct_ui_text(srna, "Mask Layer", "Single layer used for masking pixels");
|
||||||
RNA_def_struct_path_func(srna, "rna_MaskObject_path");
|
RNA_def_struct_path_func(srna, "rna_MaskLayer_path");
|
||||||
|
|
||||||
/* name */
|
/* name */
|
||||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||||
RNA_def_property_ui_text(prop, "Name", "Unique name of object");
|
RNA_def_property_ui_text(prop, "Name", "Unique name of layer");
|
||||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskObject_name_set");
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskLayer_name_set");
|
||||||
RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
|
RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
|
||||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||||
RNA_def_struct_name_property(srna, prop);
|
RNA_def_struct_name_property(srna, prop);
|
||||||
|
|
||||||
/* splines */
|
/* splines */
|
||||||
prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
|
prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
|
||||||
RNA_def_property_collection_funcs(prop, "rna_MaskObject_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
|
RNA_def_property_collection_funcs(prop, "rna_MaskLayer_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
|
||||||
RNA_def_property_struct_type(prop, "MaskSpline");
|
RNA_def_property_struct_type(prop, "MaskSpline");
|
||||||
RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this object");
|
RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this layer");
|
||||||
RNA_def_property_srna(prop, "MaskSplines");
|
RNA_def_property_srna(prop, "MaskSplines");
|
||||||
|
|
||||||
/* restrict */
|
/* restrict */
|
||||||
@@ -576,8 +576,8 @@ static void rna_def_mask_object(BlenderRNA *brna)
|
|||||||
/* weight interpolation */
|
/* weight interpolation */
|
||||||
prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
|
prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
|
||||||
RNA_def_property_enum_sdna(prop, NULL, "blend");
|
RNA_def_property_enum_sdna(prop, NULL, "blend");
|
||||||
RNA_def_property_enum_items(prop, maskobj_blend_mode_items);
|
RNA_def_property_enum_items(prop, masklay_blend_mode_items);
|
||||||
RNA_def_property_ui_text(prop, "Blend", "Method of blending mask objects");
|
RNA_def_property_ui_text(prop, "Blend", "Method of blending mask layers");
|
||||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||||
|
|
||||||
@@ -588,7 +588,7 @@ static void rna_def_mask_object(BlenderRNA *brna)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_maskobjects(BlenderRNA *brna, PropertyRNA *cprop)
|
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
|
||||||
{
|
{
|
||||||
StructRNA *srna;
|
StructRNA *srna;
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
@@ -596,27 +596,27 @@ static void rna_def_maskobjects(BlenderRNA *brna, PropertyRNA *cprop)
|
|||||||
FunctionRNA *func;
|
FunctionRNA *func;
|
||||||
PropertyRNA *parm;
|
PropertyRNA *parm;
|
||||||
|
|
||||||
RNA_def_property_srna(cprop, "MaskObjects");
|
RNA_def_property_srna(cprop, "MaskLayers");
|
||||||
srna = RNA_def_struct(brna, "MaskObjects", NULL);
|
srna = RNA_def_struct(brna, "MaskLayers", NULL);
|
||||||
RNA_def_struct_sdna(srna, "Mask");
|
RNA_def_struct_sdna(srna, "Mask");
|
||||||
RNA_def_struct_ui_text(srna, "Mask Objects", "Collection of objects used by mask");
|
RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask");
|
||||||
|
|
||||||
func = RNA_def_function(srna, "new", "rna_Mask_object_new");
|
func = RNA_def_function(srna, "new", "rna_Mask_layer_new");
|
||||||
RNA_def_function_ui_description(func, "Add object to this mask");
|
RNA_def_function_ui_description(func, "Add layer to this mask");
|
||||||
RNA_def_string(func, "name", "", 0, "Name", "Name of new object");
|
RNA_def_string(func, "name", "", 0, "Name", "Name of new layer");
|
||||||
parm = RNA_def_pointer(func, "object", "MaskObject", "", "New mask object");
|
parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer");
|
||||||
RNA_def_function_return(func, parm);
|
RNA_def_function_return(func, parm);
|
||||||
|
|
||||||
func = RNA_def_function(srna, "remove", "rna_Mask_object_remove");
|
func = RNA_def_function(srna, "remove", "rna_Mask_layer_remove");
|
||||||
RNA_def_function_ui_description(func, "Remove object from this mask");
|
RNA_def_function_ui_description(func, "Remove layer from this mask");
|
||||||
RNA_def_pointer(func, "object", "MaskObject", "", "Shape to be removed");
|
RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
|
||||||
|
|
||||||
/* active object */
|
/* active layer */
|
||||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||||
RNA_def_property_struct_type(prop, "MaskObject");
|
RNA_def_property_struct_type(prop, "MaskLayer");
|
||||||
RNA_def_property_pointer_funcs(prop, "rna_Mask_object_active_get", "rna_Mask_object_active_set", NULL, NULL);
|
RNA_def_property_pointer_funcs(prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", NULL, NULL);
|
||||||
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
||||||
RNA_def_property_ui_text(prop, "Active Shape", "Active object in this mask");
|
RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_mask(BlenderRNA *brna)
|
static void rna_def_mask(BlenderRNA *brna)
|
||||||
@@ -624,25 +624,25 @@ static void rna_def_mask(BlenderRNA *brna)
|
|||||||
StructRNA *srna;
|
StructRNA *srna;
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
|
|
||||||
rna_def_mask_object(brna);
|
rna_def_mask_layer(brna);
|
||||||
|
|
||||||
srna = RNA_def_struct(brna, "Mask", "ID");
|
srna = RNA_def_struct(brna, "Mask", "ID");
|
||||||
RNA_def_struct_ui_text(srna, "Mask", "Mask datablock defining mask for compositing");
|
RNA_def_struct_ui_text(srna, "Mask", "Mask datablock defining mask for compositing");
|
||||||
RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
|
RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
|
||||||
|
|
||||||
/* mask objects */
|
/* mask layers */
|
||||||
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
|
prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
|
||||||
RNA_def_property_collection_funcs(prop, "rna_Mask_objects_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
|
RNA_def_property_collection_funcs(prop, "rna_Mask_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
|
||||||
RNA_def_property_struct_type(prop, "MaskObject");
|
RNA_def_property_struct_type(prop, "MaskLayer");
|
||||||
RNA_def_property_ui_text(prop, "Objects", "Collection of objects which defines this mask");
|
RNA_def_property_ui_text(prop, "Layers", "Collection of layers which defines this mask");
|
||||||
rna_def_maskobjects(brna, prop);
|
rna_def_masklayers(brna, prop);
|
||||||
|
|
||||||
/* active maskobj index */
|
/* active masklay index */
|
||||||
prop = RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
|
prop = RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
|
||||||
RNA_def_property_int_sdna(prop, NULL, "act_maskobj");
|
RNA_def_property_int_sdna(prop, NULL, "masklay_act");
|
||||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||||
RNA_def_property_int_funcs(prop, "rna_Mask_object_active_index_get", "rna_Mask_object_active_index_set", "rna_Mask_object_active_index_range");
|
RNA_def_property_int_funcs(prop, "rna_Mask_layer_active_index_get", "rna_Mask_layer_active_index_set", "rna_Mask_layer_active_index_range");
|
||||||
RNA_def_property_ui_text(prop, "Active Shape Index", "Index of active object in list of all mask's objects");
|
RNA_def_property_ui_text(prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
|
||||||
|
|
||||||
/* pointers */
|
/* pointers */
|
||||||
rna_def_animdata_common(srna);
|
rna_def_animdata_common(srna);
|
||||||
|
|||||||
Reference in New Issue
Block a user