rename 'mask shape' to mask object, will make adding shape keys less confusing.
This commit is contained in:
@@ -555,10 +555,10 @@ class CLIP_PT_tracking_camera(Panel):
|
||||
col.prop(clip.tracking.camera, "k3")
|
||||
|
||||
|
||||
class CLIP_PT_shapes(Panel):
|
||||
class CLIP_PT_mask_objects(Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Shapes"
|
||||
bl_label = "Mask Objects"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -573,15 +573,15 @@ class CLIP_PT_shapes(Panel):
|
||||
mask = sc.mask
|
||||
|
||||
row = layout.row()
|
||||
row.template_list(mask, "shapes",
|
||||
mask, "active_shape_index", rows=3)
|
||||
row.template_list(mask, "objects",
|
||||
mask, "active_object_index", rows=3)
|
||||
|
||||
sub = row.column(align=True)
|
||||
|
||||
sub.operator("mask.shape_new", icon='ZOOMIN', text="")
|
||||
sub.operator("mask.shape_remove", icon='ZOOMOUT', text="")
|
||||
sub.operator("mask.object_new", icon='ZOOMIN', text="")
|
||||
sub.operator("mask.object_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
active = mask.shapes.active
|
||||
active = mask.objects.active
|
||||
if active:
|
||||
layout.prop(active, "name")
|
||||
|
||||
@@ -597,7 +597,7 @@ class CLIP_PT_active_mask_spline(Panel):
|
||||
mask = sc.mask
|
||||
|
||||
if mask and sc.mode == 'MASKEDITING':
|
||||
return mask.shapes.active and mask.shapes.active.splines.active
|
||||
return mask.objects.active and mask.objects.active.splines.active
|
||||
|
||||
return False
|
||||
|
||||
@@ -606,7 +606,7 @@ class CLIP_PT_active_mask_spline(Panel):
|
||||
|
||||
sc = context.space_data
|
||||
mask = sc.mask
|
||||
spline = mask.shapes.active.splines.active
|
||||
spline = mask.objects.active.splines.active
|
||||
|
||||
col = layout.column()
|
||||
col.prop(spline, "weight_interpolation")
|
||||
@@ -624,7 +624,7 @@ class CLIP_PT_active_mask_point(Panel):
|
||||
mask = sc.mask
|
||||
|
||||
if mask and sc.mode == 'MASKEDITING':
|
||||
return mask.shapes.active and mask.shapes.active.splines.active_point
|
||||
return mask.objects.active and mask.objects.active.splines.active_point
|
||||
|
||||
return False
|
||||
|
||||
@@ -633,7 +633,7 @@ class CLIP_PT_active_mask_point(Panel):
|
||||
|
||||
sc = context.space_data
|
||||
mask = sc.mask
|
||||
point = mask.shapes.active.splines.active_point
|
||||
point = mask.objects.active.splines.active_point
|
||||
parent = point.parent
|
||||
|
||||
col = layout.column()
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
struct Main;
|
||||
struct Mask;
|
||||
struct MaskParent;
|
||||
struct MaskShape;
|
||||
struct MaskObject;
|
||||
struct MaskSpline;
|
||||
struct MaskSplinePoint;
|
||||
struct MaskSplinePointUW;
|
||||
@@ -38,20 +38,20 @@ struct MovieClip;
|
||||
struct MovieClipUser;
|
||||
struct Scene;
|
||||
|
||||
/* shapes */
|
||||
struct MaskShape *BKE_mask_shape_new(struct Mask *mask, const char *name);
|
||||
struct MaskShape *BKE_mask_shape_active(struct Mask *mask);
|
||||
void BKE_mask_shape_active_set(struct Mask *mask, struct MaskShape *shape);
|
||||
void BKE_mask_shape_remove(struct Mask *mask, struct MaskShape *shape);
|
||||
/* mask objects */
|
||||
struct MaskObject *BKE_mask_object_new(struct Mask *mask, const char *name);
|
||||
struct MaskObject *BKE_mask_object_active(struct Mask *mask);
|
||||
void BKE_mask_object_active_set(struct Mask *mask, struct MaskObject *maskobj);
|
||||
void BKE_mask_object_remove(struct Mask *mask, struct MaskObject *maskobj);
|
||||
|
||||
void BKE_mask_shape_free(struct MaskShape *shape);
|
||||
void BKE_mask_object_free(struct MaskObject *maskobj);
|
||||
void BKE_mask_spline_free(struct MaskSpline *spline);
|
||||
void BKE_mask_point_free(struct MaskSplinePoint *point);
|
||||
|
||||
void BKE_mask_shape_unique_name(struct Mask *mask, struct MaskShape *shape);
|
||||
void BKE_mask_object_unique_name(struct Mask *mask, struct MaskObject *maskobj);
|
||||
|
||||
/* splines */
|
||||
struct MaskSpline *BKE_mask_spline_add(struct MaskShape *shape);
|
||||
struct MaskSpline *BKE_mask_spline_add(struct MaskObject *maskobj);
|
||||
int BKE_mask_spline_resolution(struct MaskSpline *spline);
|
||||
float *BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point);
|
||||
float *BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point);
|
||||
|
||||
@@ -55,68 +55,68 @@
|
||||
#include "BKE_movieclip.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
/* shapes */
|
||||
/* mask objects */
|
||||
|
||||
MaskShape *BKE_mask_shape_new(Mask *mask, const char *name)
|
||||
MaskObject *BKE_mask_object_new(Mask *mask, const char *name)
|
||||
{
|
||||
MaskShape *shape = MEM_callocN(sizeof(MaskShape), "new mask shape");
|
||||
MaskObject *maskobj = MEM_callocN(sizeof(MaskObject), "new mask object");
|
||||
|
||||
if (name && name[0])
|
||||
BLI_strncpy(shape->name, name, sizeof(shape->name));
|
||||
BLI_strncpy(maskobj->name, name, sizeof(maskobj->name));
|
||||
else
|
||||
strcpy(shape->name, "Shape");
|
||||
strcpy(maskobj->name, "MaskObject");
|
||||
|
||||
BLI_addtail(&mask->shapes, shape);
|
||||
BLI_addtail(&mask->maskobjs, maskobj);
|
||||
|
||||
BKE_mask_shape_unique_name(mask, shape);
|
||||
BKE_mask_object_unique_name(mask, maskobj);
|
||||
|
||||
mask->tot_shape++;
|
||||
mask->tot_maskobj++;
|
||||
|
||||
return shape;
|
||||
return maskobj;
|
||||
}
|
||||
|
||||
MaskShape *BKE_mask_shape_active(Mask *mask)
|
||||
MaskObject *BKE_mask_object_active(Mask *mask)
|
||||
{
|
||||
return BLI_findlink(&mask->shapes, mask->shapenr);
|
||||
return BLI_findlink(&mask->maskobjs, mask->act_maskobj);
|
||||
}
|
||||
|
||||
void BKE_mask_shape_active_set(Mask *mask, MaskShape *shape)
|
||||
void BKE_mask_object_active_set(Mask *mask, MaskObject *maskobj)
|
||||
{
|
||||
int index = BLI_findindex(&mask->shapes, shape);
|
||||
int index = BLI_findindex(&mask->maskobjs, maskobj);
|
||||
|
||||
if (index >= 0)
|
||||
mask->shapenr = index;
|
||||
mask->act_maskobj = index;
|
||||
else
|
||||
mask->shapenr = 0;
|
||||
mask->act_maskobj = 0;
|
||||
}
|
||||
|
||||
void BKE_mask_shape_remove(Mask *mask, MaskShape *shape)
|
||||
void BKE_mask_object_remove(Mask *mask, MaskObject *maskobj)
|
||||
{
|
||||
BLI_remlink(&mask->shapes, shape);
|
||||
BKE_mask_shape_free(shape);
|
||||
BLI_remlink(&mask->maskobjs, maskobj);
|
||||
BKE_mask_object_free(maskobj);
|
||||
|
||||
mask->tot_shape--;
|
||||
mask->tot_maskobj--;
|
||||
|
||||
if (mask->shapenr >= mask->tot_shape)
|
||||
mask->shapenr = mask->tot_shape - 1;
|
||||
if (mask->act_maskobj >= mask->tot_maskobj)
|
||||
mask->act_maskobj = mask->tot_maskobj - 1;
|
||||
}
|
||||
|
||||
void BKE_mask_shape_unique_name(Mask *mask, MaskShape *shape)
|
||||
void BKE_mask_object_unique_name(Mask *mask, MaskObject *maskobj)
|
||||
{
|
||||
BLI_uniquename(&mask->shapes, shape, "Shape", '.', offsetof(MaskShape, name), sizeof(shape->name));
|
||||
BLI_uniquename(&mask->maskobjs, maskobj, "MaskObject", '.', offsetof(MaskObject, name), sizeof(maskobj->name));
|
||||
}
|
||||
|
||||
/* splines */
|
||||
|
||||
MaskSpline *BKE_mask_spline_add(MaskShape *shape)
|
||||
MaskSpline *BKE_mask_spline_add(MaskObject *maskobj)
|
||||
{
|
||||
MaskSpline *spline;
|
||||
|
||||
spline = MEM_callocN(sizeof(MaskSpline), "new shape spline");
|
||||
BLI_addtail(&shape->splines, spline);
|
||||
spline = MEM_callocN(sizeof(MaskSpline), "new mask spline");
|
||||
BLI_addtail(&maskobj->splines, spline);
|
||||
|
||||
/* spline shall have one point at least */
|
||||
spline->points = MEM_callocN(sizeof(MaskSplinePoint), "new shape spline point");
|
||||
spline->points = MEM_callocN(sizeof(MaskSplinePoint), "new mask spline point");
|
||||
spline->tot_point = 1;
|
||||
|
||||
/* cyclic shapes are more usually used */
|
||||
@@ -662,33 +662,33 @@ void BKE_mask_spline_free(MaskSpline *spline)
|
||||
MEM_freeN(spline);
|
||||
}
|
||||
|
||||
void BKE_mask_shape_free(MaskShape *shape)
|
||||
void BKE_mask_object_free(MaskObject *maskobj)
|
||||
{
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
MaskSpline *next_spline = spline->next;
|
||||
|
||||
BLI_remlink(&shape->splines, spline);
|
||||
BLI_remlink(&maskobj->splines, spline);
|
||||
BKE_mask_spline_free(spline);
|
||||
|
||||
spline = next_spline;
|
||||
}
|
||||
|
||||
MEM_freeN(shape);
|
||||
MEM_freeN(maskobj);
|
||||
}
|
||||
|
||||
void BKE_mask_free(Mask *mask)
|
||||
{
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
|
||||
while (shape) {
|
||||
MaskShape *next_shape = shape->next;
|
||||
while (maskobj) {
|
||||
MaskObject *next_maskobj = maskobj->next;
|
||||
|
||||
BLI_remlink(&mask->shapes, shape);
|
||||
BKE_mask_shape_free(shape);
|
||||
BLI_remlink(&mask->maskobjs, maskobj);
|
||||
BKE_mask_object_free(maskobj);
|
||||
|
||||
shape = next_shape;
|
||||
maskobj = next_maskobj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,12 +940,12 @@ void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplineP
|
||||
|
||||
void BKE_mask_calc_handles(Mask *mask)
|
||||
{
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
|
||||
for (shape = mask->shapes.first; shape; shape = shape->next) {
|
||||
for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
|
||||
MaskSpline *spline;
|
||||
|
||||
for (spline = shape->splines.first; spline; spline = spline->next) {
|
||||
for (spline = maskobj->splines.first; spline; spline = spline->next) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < spline->tot_point; i++) {
|
||||
@@ -957,10 +957,10 @@ void BKE_mask_calc_handles(Mask *mask)
|
||||
|
||||
void BKE_mask_evaluate(Mask *mask, float ctime)
|
||||
{
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
int i;
|
||||
|
||||
while (spline) {
|
||||
@@ -981,7 +981,7 @@ void BKE_mask_evaluate(Mask *mask, float ctime)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
BKE_mask_calc_handles(mask);
|
||||
|
||||
@@ -6276,19 +6276,19 @@ static void lib_link_movieclip(FileData *fd, Main *main)
|
||||
|
||||
static void direct_link_mask(FileData *fd, Mask *mask)
|
||||
{
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
|
||||
mask->adt = newdataadr(fd, mask->adt);
|
||||
|
||||
link_list(fd, &mask->shapes);
|
||||
link_list(fd, &mask->maskobjs);
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline;
|
||||
|
||||
link_list(fd, &shape->splines);
|
||||
link_list(fd, &maskobj->splines);
|
||||
|
||||
spline = shape->splines.first;
|
||||
spline = maskobj->splines.first;
|
||||
while (spline) {
|
||||
int i;
|
||||
|
||||
@@ -6304,10 +6304,10 @@ static void direct_link_mask(FileData *fd, Mask *mask)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape->act_spline = newdataadr(fd, shape->act_spline);
|
||||
shape->act_point = newdataadr(fd, shape->act_point);
|
||||
maskobj->act_spline = newdataadr(fd, maskobj->act_spline);
|
||||
maskobj->act_point = newdataadr(fd, maskobj->act_point);
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6323,16 +6323,16 @@ static void lib_link_mask(FileData *fd, Main *main)
|
||||
mask = main->mask.first;
|
||||
while (mask) {
|
||||
if(mask->id.flag & LIB_NEEDLINK) {
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
|
||||
if (mask->adt)
|
||||
lib_link_animdata(fd, &mask->id, mask->adt);
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline;
|
||||
|
||||
spline = shape->splines.first;
|
||||
spline = maskobj->splines.first;
|
||||
while (spline) {
|
||||
int i;
|
||||
|
||||
@@ -6347,7 +6347,7 @@ static void lib_link_mask(FileData *fd, Main *main)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
mask->id.flag -= LIB_NEEDLINK;
|
||||
|
||||
@@ -2762,20 +2762,20 @@ static void write_masks(WriteData *wd, ListBase *idbase)
|
||||
mask = idbase->first;
|
||||
while (mask) {
|
||||
if (mask->id.us > 0 || wd->current) {
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
|
||||
writestruct(wd, ID_MSK, "Mask", 1, mask);
|
||||
|
||||
if (mask->adt)
|
||||
write_animdata(wd, mask->adt);
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline;
|
||||
|
||||
writestruct(wd, DATA, "MaskShape", 1, shape);
|
||||
writestruct(wd, DATA, "MaskObject", 1, maskobj);
|
||||
|
||||
spline = shape->splines.first;
|
||||
spline = maskobj->splines.first;
|
||||
while (spline) {
|
||||
int i;
|
||||
|
||||
@@ -2792,7 +2792,7 @@ static void write_masks(WriteData *wd, ListBase *idbase)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
|
||||
#include "mask_intern.h" /* own include */
|
||||
|
||||
static void set_spline_color(MaskShape *shape, MaskSpline *spline)
|
||||
static void set_spline_color(MaskObject *maskobj, MaskSpline *spline)
|
||||
{
|
||||
if (spline->flag & SELECT) {
|
||||
if (shape->act_spline == spline)
|
||||
if (maskobj->act_spline == spline)
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
else
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
@@ -63,7 +63,7 @@ static void set_spline_color(MaskShape *shape, MaskSpline *spline)
|
||||
}
|
||||
|
||||
/* return non-zero if spline is selected */
|
||||
static void draw_spline_points(MaskShape *shape, MaskSpline *spline)
|
||||
static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline)
|
||||
{
|
||||
int i, hsize, tot_feather_point;
|
||||
float *feather_points, *fp;
|
||||
@@ -92,7 +92,7 @@ static void draw_spline_points(MaskShape *shape, MaskSpline *spline)
|
||||
}
|
||||
|
||||
if (sel) {
|
||||
if (point == shape->act_point)
|
||||
if (point == maskobj->act_point)
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
else
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
@@ -121,7 +121,7 @@ static void draw_spline_points(MaskShape *shape, MaskSpline *spline)
|
||||
|
||||
/* draw handle segment */
|
||||
if (has_handle) {
|
||||
set_spline_color(shape, spline);
|
||||
set_spline_color(maskobj, spline);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex3fv(vert);
|
||||
@@ -131,7 +131,7 @@ static void draw_spline_points(MaskShape *shape, MaskSpline *spline)
|
||||
|
||||
/* draw CV point */
|
||||
if (MASKPOINT_CV_ISSEL(point)) {
|
||||
if (point == shape->act_point)
|
||||
if (point == maskobj->act_point)
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
else
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
@@ -146,7 +146,7 @@ static void draw_spline_points(MaskShape *shape, MaskSpline *spline)
|
||||
/* draw handle points */
|
||||
if (has_handle) {
|
||||
if (MASKPOINT_HANDLE_ISSEL(point)) {
|
||||
if (point == shape->act_point)
|
||||
if (point == maskobj->act_point)
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
else
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
@@ -189,7 +189,7 @@ static void draw_dashed_curve(MaskSpline *spline, float *points, int tot_point)
|
||||
glDisable(GL_LINE_STIPPLE);
|
||||
}
|
||||
|
||||
static void draw_spline_curve(MaskShape *shape, MaskSpline *spline)
|
||||
static void draw_spline_curve(MaskObject *maskobj, MaskSpline *spline)
|
||||
{
|
||||
float *diff_points, *feather_points;
|
||||
int tot_diff_point, tot_feather_point;
|
||||
@@ -209,31 +209,31 @@ static void draw_spline_curve(MaskShape *shape, MaskSpline *spline)
|
||||
draw_dashed_curve(spline, feather_points, tot_feather_point);
|
||||
|
||||
/* draw main curve */
|
||||
set_spline_color(shape, spline);
|
||||
set_spline_color(maskobj, spline);
|
||||
draw_dashed_curve(spline, diff_points, tot_diff_point);
|
||||
|
||||
MEM_freeN(diff_points);
|
||||
MEM_freeN(feather_points);
|
||||
}
|
||||
|
||||
static void draw_shapes(Mask *mask)
|
||||
static void draw_maskobjs(Mask *mask)
|
||||
{
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
/* draw curve itself first... */
|
||||
draw_spline_curve(shape, spline);
|
||||
draw_spline_curve(maskobj, spline);
|
||||
|
||||
/* ...and then handles over the curve so they're nicely visible */
|
||||
draw_spline_points(shape, spline);
|
||||
draw_spline_points(maskobj, spline);
|
||||
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,5 +244,5 @@ void ED_mask_draw(const bContext *C)
|
||||
if (!mask)
|
||||
return;
|
||||
|
||||
draw_shapes(mask);
|
||||
draw_maskobjs(mask);
|
||||
}
|
||||
|
||||
@@ -146,9 +146,9 @@ void ED_operatortypes_mask(void)
|
||||
{
|
||||
WM_operatortype_append(MASK_OT_new);
|
||||
|
||||
/* shapes */
|
||||
WM_operatortype_append(MASK_OT_shape_new);
|
||||
WM_operatortype_append(MASK_OT_shape_remove);
|
||||
/* mask objects */
|
||||
WM_operatortype_append(MASK_OT_object_new);
|
||||
WM_operatortype_append(MASK_OT_object_remove);
|
||||
|
||||
/* geometry */
|
||||
WM_operatortype_append(MASK_OT_add_vertex);
|
||||
|
||||
@@ -40,8 +40,8 @@ struct wmOperatorType;
|
||||
|
||||
/* mask_ops.c */
|
||||
void MASK_OT_new(struct wmOperatorType *ot);
|
||||
void MASK_OT_shape_new(struct wmOperatorType *ot);
|
||||
void MASK_OT_shape_remove(struct wmOperatorType *ot);
|
||||
void MASK_OT_object_new(struct wmOperatorType *ot);
|
||||
void MASK_OT_object_remove(struct wmOperatorType *ot);
|
||||
|
||||
void MASK_OT_add_vertex(struct wmOperatorType *ot);
|
||||
void MASK_OT_add_feather_vertex(struct wmOperatorType *ot);
|
||||
|
||||
@@ -167,10 +167,10 @@ static int points_has_selection(MaskSplinePoint *points, int tot_point)
|
||||
|
||||
static int mask_has_selection(Mask *mask)
|
||||
{
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
if (points_has_selection(spline->points, spline->tot_point))
|
||||
@@ -179,7 +179,7 @@ static int mask_has_selection(Mask *mask)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -187,7 +187,7 @@ static int mask_has_selection(Mask *mask)
|
||||
|
||||
static void toggle_selection_all(Mask *mask, int action)
|
||||
{
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
|
||||
if (action == SEL_TOGGLE) {
|
||||
if (mask_has_selection(mask))
|
||||
@@ -196,8 +196,8 @@ static void toggle_selection_all(Mask *mask, int action)
|
||||
action = SEL_SELECT;
|
||||
}
|
||||
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i;
|
||||
@@ -211,16 +211,16 @@ static void toggle_selection_all(Mask *mask, int action)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
}
|
||||
|
||||
static MaskSplinePoint *find_nearest_point(bContext *C, Mask *mask, float normal_co[2], int threshold,
|
||||
MaskShape **shape_r, MaskSpline **spline_r, int *is_handle_r,
|
||||
MaskObject **maskobj_r, MaskSpline **spline_r, int *is_handle_r,
|
||||
float *score)
|
||||
{
|
||||
MaskShape *shape;
|
||||
MaskShape *point_shape = NULL;
|
||||
MaskObject *maskobj;
|
||||
MaskObject *point_maskobj = NULL;
|
||||
MaskSpline *point_spline = NULL;
|
||||
MaskSplinePoint *point = NULL;
|
||||
float co[2], aspx, aspy;
|
||||
@@ -234,9 +234,9 @@ static MaskSplinePoint *find_nearest_point(bContext *C, Mask *mask, float normal
|
||||
co[0] = normal_co[0] * scalex;
|
||||
co[1] = normal_co[1] * scaley;
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i;
|
||||
@@ -256,7 +256,7 @@ static MaskSplinePoint *find_nearest_point(bContext *C, Mask *mask, float normal
|
||||
cur_len = len_v2v2(co, handle);
|
||||
|
||||
if (cur_len < len) {
|
||||
point_shape = shape;
|
||||
point_maskobj = maskobj;
|
||||
point_spline = spline;
|
||||
point = cur_point;
|
||||
len = cur_len;
|
||||
@@ -268,7 +268,7 @@ static MaskSplinePoint *find_nearest_point(bContext *C, Mask *mask, float normal
|
||||
|
||||
if (cur_len < len) {
|
||||
point_spline = spline;
|
||||
point_shape = shape;
|
||||
point_maskobj = maskobj;
|
||||
point = cur_point;
|
||||
len = cur_len;
|
||||
is_handle = FALSE;
|
||||
@@ -278,12 +278,12 @@ static MaskSplinePoint *find_nearest_point(bContext *C, Mask *mask, float normal
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
if (len < threshold) {
|
||||
if (shape_r)
|
||||
*shape_r = point_shape;
|
||||
if (maskobj_r)
|
||||
*maskobj_r = point_maskobj;
|
||||
|
||||
if (spline_r)
|
||||
*spline_r = point_spline;
|
||||
@@ -297,8 +297,8 @@ static MaskSplinePoint *find_nearest_point(bContext *C, Mask *mask, float normal
|
||||
return point;
|
||||
}
|
||||
|
||||
if (shape_r)
|
||||
*shape_r = NULL;
|
||||
if (maskobj_r)
|
||||
*maskobj_r = NULL;
|
||||
|
||||
if (spline_r)
|
||||
*spline_r = NULL;
|
||||
@@ -310,10 +310,10 @@ static MaskSplinePoint *find_nearest_point(bContext *C, Mask *mask, float normal
|
||||
}
|
||||
|
||||
static int find_nearest_feather(bContext *C, Mask *mask, float normal_co[2], int threshold,
|
||||
MaskShape **shape_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
||||
MaskObject **maskobj_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
||||
MaskSplinePointUW **uw_r, float *score)
|
||||
{
|
||||
MaskShape *shape, *point_shape = NULL;
|
||||
MaskObject *maskobj, *point_maskobj = NULL;
|
||||
MaskSpline *point_spline = NULL;
|
||||
MaskSplinePoint *point = NULL;
|
||||
MaskSplinePointUW *uw = NULL;
|
||||
@@ -328,9 +328,9 @@ static int find_nearest_feather(bContext *C, Mask *mask, float normal_co[2], int
|
||||
co[0] = normal_co[0] * scalex;
|
||||
co[1] = normal_co[1] * scaley;
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i, tot_feather_point;
|
||||
@@ -356,7 +356,7 @@ static int find_nearest_feather(bContext *C, Mask *mask, float normal_co[2], int
|
||||
else
|
||||
uw = &cur_point->uw[j - 1];
|
||||
|
||||
point_shape = shape;
|
||||
point_maskobj = maskobj;
|
||||
point_spline = spline;
|
||||
point = cur_point;
|
||||
len = cur_len;
|
||||
@@ -371,12 +371,12 @@ static int find_nearest_feather(bContext *C, Mask *mask, float normal_co[2], int
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
if (len < threshold) {
|
||||
if (shape_r)
|
||||
*shape_r = point_shape;
|
||||
if (maskobj_r)
|
||||
*maskobj_r = point_maskobj;
|
||||
|
||||
if (spline_r)
|
||||
*spline_r = point_spline;
|
||||
@@ -393,8 +393,8 @@ static int find_nearest_feather(bContext *C, Mask *mask, float normal_co[2], int
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (shape_r)
|
||||
*shape_r = NULL;
|
||||
if (maskobj_r)
|
||||
*maskobj_r = NULL;
|
||||
|
||||
if (spline_r)
|
||||
*spline_r = NULL;
|
||||
@@ -406,10 +406,10 @@ static int find_nearest_feather(bContext *C, Mask *mask, float normal_co[2], int
|
||||
}
|
||||
|
||||
static int find_nearest_diff_point(bContext *C, Mask *mask, float normal_co[2], int threshold, int feather,
|
||||
MaskShape **shape_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
||||
MaskObject **maskobj_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
|
||||
float *u_r, float tangent[2])
|
||||
{
|
||||
MaskShape *shape, *point_shape;
|
||||
MaskObject *maskobj, *point_maskobj;
|
||||
MaskSpline *point_spline;
|
||||
MaskSplinePoint *point = NULL;
|
||||
float dist, co[2];
|
||||
@@ -424,9 +424,9 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, float normal_co[2],
|
||||
co[0] = normal_co[0] * scalex;
|
||||
co[1] = normal_co[1] * scaley;
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i;
|
||||
@@ -469,7 +469,7 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, float normal_co[2],
|
||||
if (tangent)
|
||||
sub_v2_v2v2(tangent, &diff_points[2 * i + 2], &diff_points[2 * i]);
|
||||
|
||||
point_shape = shape;
|
||||
point_maskobj = maskobj;
|
||||
point_spline = spline;
|
||||
point = cur_point;
|
||||
dist = cur_dist;
|
||||
@@ -488,12 +488,12 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, float normal_co[2],
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
if (point && dist < threshold) {
|
||||
if (shape_r)
|
||||
*shape_r = point_shape;
|
||||
if (maskobj_r)
|
||||
*maskobj_r = point_maskobj;
|
||||
|
||||
if (spline_r)
|
||||
*spline_r = point_spline;
|
||||
@@ -510,8 +510,8 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, float normal_co[2],
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (shape_r)
|
||||
*shape_r = NULL;
|
||||
if (maskobj_r)
|
||||
*maskobj_r = NULL;
|
||||
|
||||
if (spline_r)
|
||||
*spline_r = NULL;
|
||||
@@ -524,11 +524,11 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, float normal_co[2],
|
||||
|
||||
static void mask_flush_selection(Mask *mask)
|
||||
{
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i;
|
||||
@@ -556,7 +556,7 @@ static void mask_flush_selection(Mask *mask)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,50 +596,50 @@ void MASK_OT_new(wmOperatorType *ot)
|
||||
RNA_def_string(ot->srna, "name", "", MAX_ID_NAME - 2, "Name", "Name of new mask");
|
||||
}
|
||||
|
||||
/******************** create new shape *********************/
|
||||
/******************** create new maskobj *********************/
|
||||
|
||||
static int shape_new_exec(bContext *C, wmOperator *op)
|
||||
static int maskobj_new_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
char name[MAX_ID_NAME - 2];
|
||||
|
||||
RNA_string_get(op->ptr, "name", name);
|
||||
|
||||
BKE_mask_shape_new(mask, name);
|
||||
mask->shapenr = mask->tot_shape - 1;
|
||||
BKE_mask_object_new(mask, name);
|
||||
mask->act_maskobj = mask->tot_maskobj - 1;
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MASK_OT_shape_new(wmOperatorType *ot)
|
||||
void MASK_OT_object_new(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Add Shape";
|
||||
ot->description = "Add new shape for masking";
|
||||
ot->idname = "MASK_OT_shape_new";
|
||||
ot->name = "Add Mask Object";
|
||||
ot->description = "Add new mask object for masking";
|
||||
ot->idname = "MASK_OT_object_new";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = shape_new_exec;
|
||||
ot->exec = maskobj_new_exec;
|
||||
ot->poll = ED_maskediting_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_string(ot->srna, "name", "", MAX_ID_NAME - 2, "Name", "Name of new shape");
|
||||
RNA_def_string(ot->srna, "name", "", MAX_ID_NAME - 2, "Name", "Name of new mask object");
|
||||
}
|
||||
|
||||
/******************** remove shape *********************/
|
||||
/******************** remove mask object *********************/
|
||||
|
||||
static int shape_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int maskobj_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskShape *shape = BKE_mask_shape_active(mask);
|
||||
MaskObject *maskobj = BKE_mask_object_active(mask);
|
||||
|
||||
if (shape) {
|
||||
BKE_mask_shape_remove(mask, shape);
|
||||
if (maskobj) {
|
||||
BKE_mask_object_remove(mask, maskobj);
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
}
|
||||
@@ -647,15 +647,15 @@ static int shape_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MASK_OT_shape_remove(wmOperatorType *ot)
|
||||
void MASK_OT_object_remove(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Remove Shape";
|
||||
ot->description = "Remove shape used for masking";
|
||||
ot->idname = "MASK_OT_shape_remove";
|
||||
ot->name = "Remove Mask Object";
|
||||
ot->description = "Remove mask object";
|
||||
ot->idname = "MASK_OT_object_remove";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = shape_remove_exec;
|
||||
ot->exec = maskobj_remove_exec;
|
||||
ot->poll = ED_maskediting_poll;
|
||||
|
||||
/* flags */
|
||||
@@ -676,7 +676,7 @@ typedef struct SlidePointData {
|
||||
float vec[3][3];
|
||||
|
||||
Mask *mask;
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
MaskSpline *spline;
|
||||
MaskSplinePoint *point;
|
||||
MaskSplinePointUW *uw;
|
||||
@@ -692,7 +692,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
SlidePointData *customdata = NULL;
|
||||
MaskShape *shape, *cv_shape, *feather_shape;
|
||||
MaskObject *maskobj, *cv_maskobj, *feather_maskobj;
|
||||
MaskSpline *spline, *cv_spline, *feather_spline;
|
||||
MaskSplinePoint *point, *cv_point, *feather_point;
|
||||
MaskSplinePointUW *uw = NULL;
|
||||
@@ -704,13 +704,13 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
||||
ED_mask_mouse_pos(C, event, co);
|
||||
ED_mask_size(C, &width, &height);
|
||||
|
||||
cv_point = find_nearest_point(C, mask, co, threshold, &cv_shape, &cv_spline, &is_handle, &cv_score);
|
||||
cv_point = find_nearest_point(C, mask, co, threshold, &cv_maskobj, &cv_spline, &is_handle, &cv_score);
|
||||
|
||||
if (find_nearest_feather(C, mask, co, threshold, &feather_shape, &feather_spline, &feather_point, &uw, &feather_score)) {
|
||||
if (find_nearest_feather(C, mask, co, threshold, &feather_maskobj, &feather_spline, &feather_point, &uw, &feather_score)) {
|
||||
if (slide_feather || !cv_point || feather_score < cv_score) {
|
||||
action = SLIDE_ACTION_FEATHER;
|
||||
|
||||
shape = feather_shape;
|
||||
maskobj = feather_maskobj;
|
||||
spline = feather_spline;
|
||||
point = feather_point;
|
||||
}
|
||||
@@ -722,7 +722,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
||||
else
|
||||
action = SLIDE_ACTION_POINT;
|
||||
|
||||
shape = cv_shape;
|
||||
maskobj = cv_maskobj;
|
||||
spline = cv_spline;
|
||||
point = cv_point;
|
||||
}
|
||||
@@ -731,7 +731,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
|
||||
customdata = MEM_callocN(sizeof(SlidePointData), "mask slide point data");
|
||||
|
||||
customdata->mask = mask;
|
||||
customdata->shape = shape;
|
||||
customdata->maskobj = maskobj;
|
||||
customdata->spline = spline;
|
||||
customdata->point = point;
|
||||
customdata->width = width;
|
||||
@@ -798,8 +798,8 @@ static int slide_point_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
mask_flush_selection(mask);
|
||||
}
|
||||
|
||||
slidedata->shape->act_spline = slidedata->spline;
|
||||
slidedata->shape->act_point = slidedata->point;
|
||||
slidedata->maskobj->act_spline = slidedata->spline;
|
||||
slidedata->maskobj->act_point = slidedata->point;
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
|
||||
|
||||
@@ -999,7 +999,7 @@ void MASK_OT_select_all(wmOperatorType *ot)
|
||||
static int select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
MaskSpline *spline;
|
||||
MaskSplinePoint *point = NULL;
|
||||
float co[2];
|
||||
@@ -1009,7 +1009,7 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
RNA_float_get_array(op->ptr, "location", co);
|
||||
|
||||
point = find_nearest_point(C, mask, co, threshold, &shape, &spline, &is_handle, NULL);
|
||||
point = find_nearest_point(C, mask, co, threshold, &maskobj, &spline, &is_handle, NULL);
|
||||
|
||||
if (point) {
|
||||
if (!extend)
|
||||
@@ -1022,8 +1022,8 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
spline_point_select(point, SEL_SELECT);
|
||||
}
|
||||
|
||||
shape->act_spline = spline;
|
||||
shape->act_point = point;
|
||||
maskobj->act_spline = spline;
|
||||
maskobj->act_point = point;
|
||||
|
||||
mask_flush_selection(mask);
|
||||
|
||||
@@ -1032,14 +1032,14 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
else {
|
||||
MaskSplinePointUW *uw;
|
||||
|
||||
if (find_nearest_feather(C, mask, co, threshold, &shape, &spline, &point, &uw, NULL)) {
|
||||
if (find_nearest_feather(C, mask, co, threshold, &maskobj, &spline, &point, &uw, NULL)) {
|
||||
if (!extend)
|
||||
toggle_selection_all(mask, SEL_DESELECT);
|
||||
|
||||
uw->flag |= SELECT;
|
||||
|
||||
shape->act_spline = spline;
|
||||
shape->act_point = point;
|
||||
maskobj->act_spline = spline;
|
||||
maskobj->act_point = point;
|
||||
|
||||
mask_flush_selection(mask);
|
||||
|
||||
@@ -1217,13 +1217,13 @@ static void setup_vertex_point(bContext *C, Mask *mask, MaskSpline *spline, Mask
|
||||
|
||||
static int add_vertex_subdivide(bContext *C, Mask *mask, float co[2])
|
||||
{
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
MaskSpline *spline;
|
||||
MaskSplinePoint *point = NULL;
|
||||
const float threshold = 9;
|
||||
float tangent[2];
|
||||
|
||||
if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &shape, &spline, &point, NULL, tangent)) {
|
||||
if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &maskobj, &spline, &point, NULL, tangent)) {
|
||||
MaskSplinePoint *new_point_array, *new_point;
|
||||
int point_index = point - spline->points;
|
||||
|
||||
@@ -1243,7 +1243,7 @@ static int add_vertex_subdivide(bContext *C, Mask *mask, float co[2])
|
||||
|
||||
setup_vertex_point(C, mask, spline, new_point, co, tangent, NULL, TRUE);
|
||||
|
||||
shape->act_point = new_point;
|
||||
maskobj->act_point = new_point;
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
|
||||
@@ -1255,17 +1255,17 @@ static int add_vertex_subdivide(bContext *C, Mask *mask, float co[2])
|
||||
|
||||
/* **** add extrude vertex **** */
|
||||
|
||||
static void finSelectedSplinePoint(MaskShape *shape, MaskSpline **spline, MaskSplinePoint **point, short check_active)
|
||||
static void finSelectedSplinePoint(MaskObject *maskobj, MaskSpline **spline, MaskSplinePoint **point, short check_active)
|
||||
{
|
||||
MaskSpline *cur_spline = shape->splines.first;
|
||||
MaskSpline *cur_spline = maskobj->splines.first;
|
||||
|
||||
*spline = NULL;
|
||||
*point = NULL;
|
||||
|
||||
if (check_active) {
|
||||
if (shape->act_spline && shape->act_point) {
|
||||
*spline = shape->act_spline;
|
||||
*point = shape->act_point;
|
||||
if (maskobj->act_spline && maskobj->act_point) {
|
||||
*spline = maskobj->act_spline;
|
||||
*point = maskobj->act_point;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1298,30 +1298,30 @@ static void finSelectedSplinePoint(MaskShape *shape, MaskSpline **spline, MaskSp
|
||||
|
||||
static int add_vertex_extrude(bContext *C, Mask *mask, float co[2])
|
||||
{
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
MaskSpline *spline;
|
||||
MaskSplinePoint *point;
|
||||
MaskSplinePoint *new_point = NULL, *ref_point = NULL;
|
||||
|
||||
toggle_selection_all(mask, SEL_DESELECT);
|
||||
|
||||
shape = BKE_mask_shape_active(mask);
|
||||
maskobj = BKE_mask_object_active(mask);
|
||||
|
||||
if (!shape) {
|
||||
/* if there's no shape currently operationg on, create new one */
|
||||
shape = BKE_mask_shape_new(mask, "");
|
||||
mask->shapenr = mask->tot_shape - 1;
|
||||
if (!maskobj) {
|
||||
/* if there's no maskobj currently operationg on, create new one */
|
||||
maskobj = BKE_mask_object_new(mask, "");
|
||||
mask->act_maskobj = mask->tot_maskobj - 1;
|
||||
spline = NULL;
|
||||
point = NULL;
|
||||
}
|
||||
else {
|
||||
finSelectedSplinePoint(shape, &spline, &point, TRUE);
|
||||
finSelectedSplinePoint(maskobj, &spline, &point, TRUE);
|
||||
}
|
||||
|
||||
if (!spline) {
|
||||
/* no selected splines in actuve shape, create new spline */
|
||||
spline = BKE_mask_spline_add(shape);
|
||||
shape->act_spline = spline;
|
||||
/* no selected splines in active maskobj, create new spline */
|
||||
spline = BKE_mask_spline_add(maskobj);
|
||||
maskobj->act_spline = spline;
|
||||
new_point = spline->points;
|
||||
}
|
||||
|
||||
@@ -1351,13 +1351,13 @@ static int add_vertex_extrude(bContext *C, Mask *mask, float co[2])
|
||||
ref_point = &spline->points[1];
|
||||
}
|
||||
else {
|
||||
spline = BKE_mask_spline_add(shape);
|
||||
shape->act_spline = spline;
|
||||
spline = BKE_mask_spline_add(maskobj);
|
||||
maskobj->act_spline = spline;
|
||||
new_point = spline->points;
|
||||
}
|
||||
}
|
||||
|
||||
shape->act_point = new_point;
|
||||
maskobj->act_point = new_point;
|
||||
|
||||
setup_vertex_point(C, mask, spline, new_point, co, NULL, ref_point, FALSE);
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
@@ -1416,7 +1416,7 @@ void MASK_OT_add_vertex(wmOperatorType *ot)
|
||||
static int add_feather_vertex_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
MaskSpline *spline;
|
||||
MaskSplinePoint *point = NULL;
|
||||
const float threshold = 9;
|
||||
@@ -1428,7 +1428,7 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op)
|
||||
if (point)
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &shape, &spline, &point, &u, NULL)) {
|
||||
if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &maskobj, &spline, &point, &u, NULL)) {
|
||||
float w = BKE_mask_point_weight(spline, point, u);
|
||||
|
||||
BKE_mask_point_add_uw(point, u, w);
|
||||
@@ -1477,10 +1477,10 @@ void MASK_OT_add_feather_vertex(wmOperatorType *ot)
|
||||
static int cyclic_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
if (points_has_selection(spline->points, spline->tot_point))
|
||||
@@ -1489,7 +1489,7 @@ static int cyclic_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
@@ -1553,10 +1553,10 @@ static void delete_feather_points(MaskSplinePoint *point)
|
||||
static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i, count = 0;
|
||||
@@ -1572,12 +1572,12 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
if (count == 0) {
|
||||
/* delete the whole spline */
|
||||
BLI_remlink(&shape->splines, spline);
|
||||
BLI_remlink(&maskobj->splines, spline);
|
||||
BKE_mask_spline_free(spline);
|
||||
|
||||
if (spline == shape->act_spline) {
|
||||
shape->act_spline = NULL;
|
||||
shape->act_point = NULL;
|
||||
if (spline == maskobj->act_spline) {
|
||||
maskobj->act_spline = NULL;
|
||||
maskobj->act_point = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1590,8 +1590,8 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
MaskSplinePoint *point = &spline->points[i];
|
||||
|
||||
if (!MASKPOINT_ISSEL(point)) {
|
||||
if (point == shape->act_point)
|
||||
shape->act_point = &new_points[j];
|
||||
if (point == maskobj->act_point)
|
||||
maskobj->act_point = &new_points[j];
|
||||
|
||||
delete_feather_points(point);
|
||||
|
||||
@@ -1599,8 +1599,8 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
j++;
|
||||
}
|
||||
else {
|
||||
if (point == shape->act_point)
|
||||
shape->act_point = NULL;
|
||||
if (point == maskobj->act_point)
|
||||
maskobj->act_point = NULL;
|
||||
|
||||
BKE_mask_point_free(point);
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
spline = next_spline;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
@@ -1645,11 +1645,11 @@ void MASK_OT_delete(wmOperatorType *ot)
|
||||
static int set_handle_type_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
int handle_type = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
int i;
|
||||
|
||||
while (spline) {
|
||||
@@ -1666,7 +1666,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
|
||||
|
||||
@@ -5943,15 +5943,15 @@ static void createTransMaskingData(bContext *C, TransInfo *t)
|
||||
{
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskShape *shape;
|
||||
MaskObject *maskobj;
|
||||
TransData *td = NULL;
|
||||
TransData2D *td2d = NULL;
|
||||
TransDataMasking *tdm = NULL;
|
||||
|
||||
/* count */
|
||||
shape = mask ? mask->shapes.first : NULL;
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
maskobj = mask ? mask->maskobjs.first : NULL;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i;
|
||||
@@ -5970,7 +5970,7 @@ static void createTransMaskingData(bContext *C, TransInfo *t)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
if (t->total == 0)
|
||||
@@ -5985,9 +5985,9 @@ static void createTransMaskingData(bContext *C, TransInfo *t)
|
||||
t->flag |= T_FREE_CUSTOMDATA;
|
||||
|
||||
/* create data */
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
int i;
|
||||
@@ -6014,7 +6014,7 @@ static void createTransMaskingData(bContext *C, TransInfo *t)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
typedef struct Mask {
|
||||
ID id;
|
||||
struct AnimData *adt;
|
||||
ListBase shapes; /* shapes which defines this mask */
|
||||
int shapenr; /* index of active shape */
|
||||
int tot_shape; /* total number of shapes */
|
||||
ListBase maskobjs; /* mask objects */
|
||||
int act_maskobj; /* index of active mask object */
|
||||
int tot_maskobj; /* total number of mask objects */
|
||||
} Mask;
|
||||
|
||||
typedef struct MaskParent {
|
||||
@@ -85,15 +85,15 @@ typedef struct MaskSpline {
|
||||
int weight_interp, pad; /* weight interpolation */
|
||||
} MaskSpline;
|
||||
|
||||
typedef struct MaskShape {
|
||||
struct MaskShape *next, *prev;
|
||||
typedef struct MaskObject {
|
||||
struct MaskObject *next, *prev;
|
||||
|
||||
char name[64]; /* name of the shape (64 = MAD_ID_NAME - 2) */
|
||||
char name[64]; /* name of the mask object (64 = MAD_ID_NAME - 2) */
|
||||
|
||||
ListBase splines; /* list of splines which defines this shape */
|
||||
ListBase splines; /* list of splines which defines this mask object */
|
||||
struct MaskSpline *act_spline; /* active spline */
|
||||
struct MaskSplinePoint *act_point; /* active point */
|
||||
} MaskShape;
|
||||
} MaskObject;
|
||||
|
||||
/* MaskParent->flag */
|
||||
#define MASK_PARENT_ACTIVE (1 << 0)
|
||||
|
||||
@@ -93,106 +93,106 @@ static void rna_MaskParent_id_type_set(PointerRNA *ptr, int value)
|
||||
mpar->id = NULL;
|
||||
}
|
||||
|
||||
static void rna_Mask_shapes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
static void rna_Mask_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
Mask *mask = (Mask *)ptr->id.data;
|
||||
|
||||
rna_iterator_listbase_begin(iter, &mask->shapes, NULL);
|
||||
rna_iterator_listbase_begin(iter, &mask->maskobjs, NULL);
|
||||
}
|
||||
|
||||
static int rna_Mask_active_shape_index_get(PointerRNA *ptr)
|
||||
static int rna_Mask_object_active_index_get(PointerRNA *ptr)
|
||||
{
|
||||
Mask *mask = (Mask *)ptr->id.data;
|
||||
|
||||
return mask->shapenr;
|
||||
return mask->act_maskobj;
|
||||
}
|
||||
|
||||
static void rna_Mask_active_shape_index_set(PointerRNA *ptr, int value)
|
||||
static void rna_Mask_object_active_index_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Mask *mask = (Mask *)ptr->id.data;
|
||||
|
||||
mask->shapenr = value;
|
||||
mask->act_maskobj = value;
|
||||
}
|
||||
|
||||
static void rna_Mask_active_shape_index_range(PointerRNA *ptr, int *min, int *max)
|
||||
static void rna_Mask_object_active_index_range(PointerRNA *ptr, int *min, int *max)
|
||||
{
|
||||
Mask *mask = (Mask *)ptr->id.data;
|
||||
|
||||
*min = 0;
|
||||
*max = mask->tot_shape - 1;
|
||||
*max = mask->tot_maskobj - 1;
|
||||
*max = MAX2(0, *max);
|
||||
}
|
||||
|
||||
static PointerRNA rna_Mask_active_shape_get(PointerRNA *ptr)
|
||||
static PointerRNA rna_Mask_object_active_get(PointerRNA *ptr)
|
||||
{
|
||||
Mask *mask = (Mask *)ptr->id.data;
|
||||
MaskShape *shape = BKE_mask_shape_active(mask);
|
||||
MaskObject *maskobj = BKE_mask_object_active(mask);
|
||||
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskShape, shape);
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskObject, maskobj);
|
||||
}
|
||||
|
||||
static void rna_Mask_active_shape_set(PointerRNA *ptr, PointerRNA value)
|
||||
static void rna_Mask_object_active_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
Mask *mask = (Mask *)ptr->id.data;
|
||||
MaskShape *shape = (MaskShape *)value.data;
|
||||
MaskObject *maskobj = (MaskObject *)value.data;
|
||||
|
||||
BKE_mask_shape_active_set(mask, shape);
|
||||
BKE_mask_object_active_set(mask, maskobj);
|
||||
}
|
||||
|
||||
static void rna_MaskShape_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
static void rna_MaskObject_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
MaskShape *shape = (MaskShape *)ptr->data;
|
||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
||||
|
||||
rna_iterator_listbase_begin(iter, &shape->splines, NULL);
|
||||
rna_iterator_listbase_begin(iter, &maskobj->splines, NULL);
|
||||
}
|
||||
|
||||
void rna_MaskShape_name_set(PointerRNA *ptr, const char *value)
|
||||
void rna_MaskObject_name_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
Mask *mask = (Mask *)ptr->id.data;
|
||||
MaskShape *shape = (MaskShape *)ptr->data;
|
||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
||||
|
||||
BLI_strncpy(shape->name, value, sizeof(shape->name));
|
||||
BLI_strncpy(maskobj->name, value, sizeof(maskobj->name));
|
||||
|
||||
BKE_mask_shape_unique_name(mask, shape);
|
||||
BKE_mask_object_unique_name(mask, maskobj);
|
||||
}
|
||||
|
||||
static PointerRNA rna_MaskShape_active_spline_get(PointerRNA *ptr)
|
||||
static PointerRNA rna_MaskObject_active_spline_get(PointerRNA *ptr)
|
||||
{
|
||||
MaskShape *shape = (MaskShape *)ptr->data;
|
||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
||||
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskSpline, shape->act_spline);
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskSpline, maskobj->act_spline);
|
||||
}
|
||||
|
||||
static void rna_MaskShape_active_spline_set(PointerRNA *ptr, PointerRNA value)
|
||||
static void rna_MaskObject_active_spline_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
MaskShape *shape = (MaskShape *)ptr->data;
|
||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
||||
MaskSpline *spline = (MaskSpline *)value.data;
|
||||
int index = BLI_findindex(&shape->splines, spline);
|
||||
int index = BLI_findindex(&maskobj->splines, spline);
|
||||
|
||||
if (index >= 0)
|
||||
shape->act_spline = spline;
|
||||
maskobj->act_spline = spline;
|
||||
else
|
||||
shape->act_spline = NULL;
|
||||
maskobj->act_spline = NULL;
|
||||
}
|
||||
|
||||
static PointerRNA rna_MaskShape_active_spline_point_get(PointerRNA *ptr)
|
||||
static PointerRNA rna_MaskObject_active_spline_point_get(PointerRNA *ptr)
|
||||
{
|
||||
MaskShape *shape = (MaskShape *)ptr->data;
|
||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
||||
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskSplinePoint, shape->act_point);
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_MaskSplinePoint, maskobj->act_point);
|
||||
}
|
||||
|
||||
static void rna_MaskShape_active_spline_point_set(PointerRNA *ptr, PointerRNA value)
|
||||
static void rna_MaskObject_active_spline_point_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
MaskShape *shape = (MaskShape *)ptr->data;
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
MaskObject *maskobj = (MaskObject *)ptr->data;
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
MaskSplinePoint *point = (MaskSplinePoint *)value.data;
|
||||
|
||||
shape->act_point = NULL;
|
||||
maskobj->act_point = NULL;
|
||||
|
||||
while (spline) {
|
||||
if (point >= spline->points && point < spline->points + spline->tot_point) {
|
||||
shape->act_point = point;
|
||||
maskobj->act_point = point;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -279,29 +279,29 @@ static void rna_MaskSplinePoint_handle_type_set(PointerRNA *ptr, int value)
|
||||
|
||||
/* ** API ** */
|
||||
|
||||
static MaskShape *rna_Mask_shape_new(Mask *mask, const char *name)
|
||||
static MaskObject *rna_Mask_object_new(Mask *mask, const char *name)
|
||||
{
|
||||
MaskShape *shape = BKE_mask_shape_new(mask, name);
|
||||
MaskObject *maskobj = BKE_mask_object_new(mask, name);
|
||||
|
||||
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
||||
|
||||
return shape;
|
||||
return maskobj;
|
||||
}
|
||||
|
||||
void rna_Mask_shape_remove(Mask *mask, MaskShape *shape)
|
||||
void rna_Mask_object_remove(Mask *mask, MaskObject *maskobj)
|
||||
{
|
||||
BKE_mask_shape_remove(mask, shape);
|
||||
BKE_mask_object_remove(mask, maskobj);
|
||||
|
||||
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
||||
}
|
||||
|
||||
static void rna_MaskShape_spline_add(ID *id, MaskShape *shape, int number)
|
||||
static void rna_MaskObject_spline_add(ID *id, MaskObject *maskobj, int number)
|
||||
{
|
||||
Mask *mask = (Mask*) id;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < number; i++)
|
||||
BKE_mask_spline_add(shape);
|
||||
BKE_mask_spline_add(maskobj);
|
||||
|
||||
WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
|
||||
}
|
||||
@@ -402,7 +402,7 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
||||
rna_def_maskSplinePointUW(brna);
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskSplinePoint", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Mask Spline Point", "Single point in spline used for defining mash shape");
|
||||
RNA_def_struct_ui_text(srna, "Mask Spline Point", "Single point in spline used for defining mask");
|
||||
|
||||
/* Vector values */
|
||||
prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
|
||||
@@ -447,34 +447,34 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Feather Points", "Points defining feather");
|
||||
}
|
||||
|
||||
static void rna_def_maskSplines(BlenderRNA *brna)
|
||||
static void rna_def_mask_splines(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskSplines", NULL);
|
||||
RNA_def_struct_sdna(srna, "MaskShape");
|
||||
RNA_def_struct_sdna(srna, "MaskObject");
|
||||
RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
|
||||
|
||||
func = RNA_def_function(srna, "add", "rna_MaskShape_spline_add");
|
||||
func = RNA_def_function(srna, "add", "rna_MaskObject_spline_add");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func, "Add a number of splines to mask shape");
|
||||
RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of splines to add to the shape", 0, INT_MAX);
|
||||
RNA_def_function_ui_description(func, "Add a number of splines to mask object");
|
||||
RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of splines to add to the object", 0, INT_MAX);
|
||||
|
||||
/* active spline */
|
||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MaskSpline");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_MaskShape_active_spline_get", "rna_MaskShape_active_spline_set", NULL, NULL);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_MaskObject_active_spline_get", "rna_MaskObject_active_spline_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
||||
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking shape");
|
||||
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking object");
|
||||
|
||||
/* active point */
|
||||
prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MaskSplinePoint");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_MaskShape_active_spline_point_get", "rna_MaskShape_active_spline_point_set", NULL, NULL);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_MaskObject_active_spline_point_get", "rna_MaskObject_active_spline_point_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
||||
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking shape");
|
||||
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking object");
|
||||
}
|
||||
|
||||
static void rna_def_maskSpline(BlenderRNA *brna)
|
||||
@@ -507,34 +507,34 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
}
|
||||
|
||||
static void rna_def_maskShape(BlenderRNA *brna)
|
||||
static void rna_def_mask_object(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
rna_def_maskSpline(brna);
|
||||
rna_def_maskSplines(brna);
|
||||
rna_def_mask_splines(brna);
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskShape", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Mask shape", "Single shape used for masking stuff");
|
||||
srna = RNA_def_struct(brna, "MaskObject", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Mask Object", "Single object used for masking pixels");
|
||||
|
||||
/* name */
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Name", "Unique name of shape");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskShape_name_set");
|
||||
RNA_def_property_ui_text(prop, "Name", "Unique name of object");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskObject_name_set");
|
||||
RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
|
||||
/* splines */
|
||||
prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_funcs(prop, "rna_MaskShape_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_MaskObject_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_ui_text(prop, "Splines", "Collection of splines which defines this shape");
|
||||
RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this object");
|
||||
RNA_def_property_srna(prop, "MaskSplines");
|
||||
}
|
||||
|
||||
static void rna_def_maskShapes(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
static void rna_def_maskobjects(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
@@ -542,27 +542,27 @@ static void rna_def_maskShapes(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "MaskShapes");
|
||||
srna = RNA_def_struct(brna, "MaskShapes", NULL);
|
||||
RNA_def_property_srna(cprop, "MaskObjects");
|
||||
srna = RNA_def_struct(brna, "MaskObjects", NULL);
|
||||
RNA_def_struct_sdna(srna, "Mask");
|
||||
RNA_def_struct_ui_text(srna, "Mask Shapes", "Collection of shapes used by mask");
|
||||
RNA_def_struct_ui_text(srna, "Mask Objects", "Collection of objects used by mask");
|
||||
|
||||
func = RNA_def_function(srna, "new", "rna_Mask_shape_new");
|
||||
RNA_def_function_ui_description(func, "Add shape to this mask");
|
||||
RNA_def_string(func, "name", "", 0, "Name", "Name of new shape");
|
||||
parm = RNA_def_pointer(func, "shape", "MaskShape", "", "New mask shape");
|
||||
func = RNA_def_function(srna, "new", "rna_Mask_object_new");
|
||||
RNA_def_function_ui_description(func, "Add object to this mask");
|
||||
RNA_def_string(func, "name", "", 0, "Name", "Name of new object");
|
||||
parm = RNA_def_pointer(func, "object", "MaskObject", "", "New mask object");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func = RNA_def_function(srna, "remove", "rna_Mask_shape_remove");
|
||||
RNA_def_function_ui_description(func, "Remove shape from this mask");
|
||||
RNA_def_pointer(func, "shape", "MaskShape", "", "Shape to be removed");
|
||||
func = RNA_def_function(srna, "remove", "rna_Mask_object_remove");
|
||||
RNA_def_function_ui_description(func, "Remove object from this mask");
|
||||
RNA_def_pointer(func, "object", "MaskObject", "", "Shape to be removed");
|
||||
|
||||
/* active object */
|
||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MaskShape");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Mask_active_shape_get", "rna_Mask_active_shape_set", NULL, NULL);
|
||||
RNA_def_property_struct_type(prop, "MaskObject");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Mask_object_active_get", "rna_Mask_object_active_set", NULL, NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
|
||||
RNA_def_property_ui_text(prop, "Active Shape", "Active shape in this mask");
|
||||
RNA_def_property_ui_text(prop, "Active Shape", "Active object in this mask");
|
||||
}
|
||||
|
||||
static void rna_def_mask(BlenderRNA *brna)
|
||||
@@ -570,25 +570,25 @@ static void rna_def_mask(BlenderRNA *brna)
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
rna_def_maskShape(brna);
|
||||
rna_def_mask_object(brna);
|
||||
|
||||
srna = RNA_def_struct(brna, "Mask", "ID");
|
||||
RNA_def_struct_ui_text(srna, "Mask", "Mask datablock defining mask for compositing");
|
||||
RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
|
||||
|
||||
/* shapes */
|
||||
prop = RNA_def_property(srna, "shapes", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_funcs(prop, "rna_Mask_shapes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
|
||||
RNA_def_property_struct_type(prop, "MaskShape");
|
||||
RNA_def_property_ui_text(prop, "Shapes", "Collection of shapes which defines this mask");
|
||||
rna_def_maskShapes(brna, prop);
|
||||
/* mask objects */
|
||||
prop = RNA_def_property(srna, "objects", 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_struct_type(prop, "MaskObject");
|
||||
RNA_def_property_ui_text(prop, "Objects", "Collection of objects which defines this mask");
|
||||
rna_def_maskobjects(brna, prop);
|
||||
|
||||
/* active shape index */
|
||||
prop = RNA_def_property(srna, "active_shape_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "shapenr");
|
||||
/* active maskobj index */
|
||||
prop = RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "act_maskobj");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_funcs(prop, "rna_Mask_active_shape_index_get", "rna_Mask_active_shape_index_set", "rna_Mask_active_shape_index_range");
|
||||
RNA_def_property_ui_text(prop, "Active Shape Index", "Index of active shape in list of all mask's shapes");
|
||||
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_ui_text(prop, "Active Shape Index", "Index of active object in list of all mask's objects");
|
||||
}
|
||||
|
||||
void RNA_def_mask(BlenderRNA *brna)
|
||||
|
||||
@@ -58,7 +58,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
Mask *mask = (Mask *)node->id;
|
||||
CompBuf *stackbuf;
|
||||
RenderData *rd = data;
|
||||
MaskShape *shape = mask->shapes.first;
|
||||
MaskObject *maskobj = mask->maskobjs.first;
|
||||
float *res;
|
||||
int sx, sy;
|
||||
|
||||
@@ -84,9 +84,9 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
stackbuf = alloc_compbuf(sx, sy, CB_VAL, TRUE);
|
||||
res = stackbuf->rect;
|
||||
|
||||
shape = mask->shapes.first;
|
||||
while (shape) {
|
||||
MaskSpline *spline = shape->splines.first;
|
||||
maskobj = mask->maskobjs.first;
|
||||
while (maskobj) {
|
||||
MaskSpline *spline = maskobj->splines.first;
|
||||
|
||||
while (spline) {
|
||||
float *diff_points;
|
||||
@@ -123,7 +123,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
spline = spline->next;
|
||||
}
|
||||
|
||||
shape = shape->next;
|
||||
maskobj = maskobj->next;
|
||||
}
|
||||
|
||||
/* pass on output and free */
|
||||
|
||||
Reference in New Issue
Block a user