diff options
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mask_types.h | 163 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_node_types.h | 11 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 22 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_tracking_types.h | 84 | ||||
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 2 |
7 files changed, 261 insertions, 25 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 777fcc2af0c..b6fc4f58bd7 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -206,6 +206,7 @@ typedef struct PreviewImage { #define ID_GD MAKE_ID2('G', 'D') /* GreasePencil */ #define ID_WM MAKE_ID2('W', 'M') /* WindowManager */ #define ID_MC MAKE_ID2('M', 'C') /* MovieClip */ +#define ID_MSK MAKE_ID2('M', 'S') /* Mask */ /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h new file mode 100644 index 00000000000..28fc9466613 --- /dev/null +++ b/source/blender/makesdna/DNA_mask_types.h @@ -0,0 +1,163 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2012 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Blender Foundation, + * Sergey Sharybin + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file DNA_mask_types.h + * \ingroup DNA + * \since march-2012 + * \author Sergey Sharybin + */ + +#ifndef __DNA_MASK_TYPES_H__ +#define __DNA_MASK_TYPES_H__ + +#include "DNA_defs.h" +#include "DNA_ID.h" +#include "DNA_listBase.h" +#include "DNA_curve_types.h" + +typedef struct Mask { + ID id; + struct AnimData *adt; + ListBase masklayers; /* mask layers */ + int masklay_act; /* index of active mask layer (-1 == None) */ + int masklay_tot; /* total number of mask layers */ +} Mask; + +typedef struct MaskParent { + int flag; /* parenting flags */ + int id_type; /* type of parenting */ + 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 */ + char parent[64]; /* entity of parent to which parenting happened + * in case of parenting to movie tracking data contains name of layer */ + char sub_parent[64]; /* sub-entity of parent to which parenting happened + * in case of parenting to movie tracking data contains name of track */ + float parent_orig[2]; /* track location at the moment of parenting */ +} MaskParent; + +typedef struct MaskSplinePointUW { + float u, w; /* u coordinate along spline segment and weight of this point */ + int flag; /* different flags of this point */ +} MaskSplinePointUW; + +typedef struct MaskSplinePoint { + BezTriple bezt; /* actual point coordinates and it's handles */ + int pad; + int tot_uw; /* number of uv feather values */ + MaskSplinePointUW *uw; /* feather UV values */ + MaskParent parent; /* parenting information of particular spline point */ +} MaskSplinePoint; + +typedef struct MaskSpline { + struct MaskSpline *next, *prev; + + int flag; /* defferent spline flag (closed, ...) */ + int tot_point; /* total number of points */ + MaskSplinePoint *points; /* points which defines spline itself */ + MaskParent parent; /* parenting information of the whole spline */ + + int weight_interp, pad; /* weight interpolation */ + + MaskSplinePoint *points_deform; /* deformed copy of 'points' BezTriple data - not saved */ +} MaskSpline; + +/* one per frame */ +typedef struct MaskLayerShape { + struct MaskLayerShape *next, *prev; + + 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 frame; /* different flags of this point */ + char flag; + char pad[7]; +} MaskLayerShape; + +typedef struct MaskLayer { + struct MaskLayer *next, *prev; + + char name[64]; /* name of the mask layer (64 = MAD_ID_NAME - 2) */ + + ListBase splines; /* list of splines which defines this mask layer */ + ListBase splines_shapes; + + struct MaskSpline *act_spline; /* active spline */ + struct MaskSplinePoint *act_point; /* active point */ + + /* blending options */ + float alpha; + char blend; + char blend_flag; + + //char flag; /* not used yet */ + char restrictflag; /* matching 'Object' flag of the same name - eventually use in the outliner */ + char pad[1]; +} MaskLayer; + +/* MaskParent->flag */ +#define MASK_PARENT_ACTIVE (1 << 0) + +/* MaskSpline->flag */ +/* reserve (1 << 0) for SELECT */ +#define MASK_SPLINE_CYCLIC (1 << 1) + +/* MaskSpline->weight_interp */ +#define MASK_SPLINE_INTERP_LINEAR 1 +#define MASK_SPLINE_INTERP_EASE 2 + +#define MASK_OBJECT_SHAPE_ELEM_SIZE 8 /* 3x 2D points + weight + radius == 8 */ + +/* ob->restrictflag */ +#define MASK_RESTRICT_VIEW 1 +#define MASK_RESTRICT_SELECT 2 +#define MASK_RESTRICT_RENDER 4 + +/* SpaceClip->mask_draw_flag */ +#define MASK_DRAWFLAG_SMOOTH 1 + +/* copy of eSpaceImage_UVDT */ +/* SpaceClip->mask_draw_type */ +enum { + MASK_DT_OUTLINE = 0, + MASK_DT_DASH, + MASK_DT_BLACK, + MASK_DT_WHITE +}; + +/* masklay->blend */ +enum { + MASK_BLEND_ADD = 0, + MASK_BLEND_SUBTRACT = 1 +}; + +/* masklay->blend_flag */ +enum { + MASK_BLENDFLAG_INVERT = (1 << 0) +}; + + +#endif // __DNA_MASK_TYPES_H__ diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 5b87ecc44ae..39f3fda1157 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -618,6 +618,17 @@ typedef struct TexNodeOutput { char name[64]; } TexNodeOutput; +typedef struct NodeKeyingScreenData { + char tracking_object[64]; +} NodeKeyingScreenData; + +typedef struct NodeKeyingData { + float despill_factor; + float clip_black, clip_white; + int dilate_distance; + int blur_pre, blur_post; +} NodeKeyingData; + /* frame node flags */ #define NODE_FRAME_SHRINK 1 /* keep the bounding box minimal */ #define NODE_FRAME_RESIZEABLE 2 /* test flag, if frame can be resized by user */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 198b6a9bf80..75b0b18879d 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -999,7 +999,8 @@ typedef struct ToolSettings { short snap_flag, snap_target; short proportional, prop_mode; char proportional_objects; /* proportional edit, object mode */ - char pad[5]; + char proportional_mask; /* proportional edit, object mode */ + char pad[4]; char auto_normalize; /*auto normalizing mode in wpaint*/ char multipaint; /* paint multiple bones in wpaint */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 8f3062655b7..b1e64641985 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -67,6 +67,7 @@ struct wmOperator; struct wmTimer; struct MovieClip; struct MovieClipScopes; +struct Mask; /* SpaceLink (Base) ==================================== */ @@ -998,7 +999,10 @@ typedef struct SpaceClip { * defined when drawing and used for mouse position calculation */ /* movie postprocessing */ - int postproc_flag, pad2; + int postproc_flag; + + /* grease pencil */ + short gpencil_src, pad2; void *draw_context; @@ -1006,7 +1010,14 @@ typedef struct SpaceClip { short dope_sort; /* sort order in dopesheet view */ short dope_flag; /* dopsheet view flags */ - int pad3; + int around; /* pivot point for transforms */ + + /* **** mask editing **** */ + struct Mask *mask; + /* draw options */ + char mask_draw_flag; + char mask_draw_type; + char pad3[6]; } SpaceClip; /* SpaceClip->flag */ @@ -1037,6 +1048,7 @@ typedef enum eSpaceClip_Mode { SC_MODE_TRACKING = 0, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION, + SC_MODE_MASKEDITING, } eSpaceClip_Mode; /* SpaceClip->view */ @@ -1058,6 +1070,12 @@ typedef enum eSpaceClip_Dopesheet_Flag { SC_DOPE_SORT_INVERSE = (1 << 0), } eSpaceClip_Dopesheet_Flag; +/* SPaceClip->gpencil_src */ +typedef enum eSpaceClip_GPencil_Source { + SC_GPENCIL_SRC_CLIP = 0, + SC_GPENCIL_SRC_TRACK = 1, +} eSpaceClip_GPencil_Source; + /* **************** SPACE DEFINES ********************* */ /* headerbuttons: 450-499 */ diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index 6bf059c7ecb..c5b0174a3c9 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -35,10 +35,12 @@ #ifndef __DNA_TRACKING_TYPES_H__ #define __DNA_TRACKING_TYPES_H__ +#include "DNA_defs.h" #include "DNA_listBase.h" /* match-moving data */ +struct bGPdata; struct ImBuf; struct MovieReconstructedCamera; struct MovieTrackingCamera; @@ -68,6 +70,27 @@ typedef struct MovieTrackingCamera { typedef struct MovieTrackingMarker { float pos[2]; /* 2d position of marker on frame (in unified 0..1 space) */ + + /* corners of pattern in the following order: + * + * Y + * ^ + * | (3) --- (2) + * | | | + * | | | + * | | | + * | (0) --- (1) + * +-------------> X + * + * the coordinates are stored relative to pos. + */ + float pattern_corners[4][2]; + + /* positions of left-bottom and right-top corners of search area (in unified 0..1 units, + * relative to marker->pos + */ + float search_min[2], search_max[2]; + int framenr; /* number of frame marker is associated with */ int flag; /* Marker's flag (alive, ...) */ } MovieTrackingMarker; @@ -78,8 +101,19 @@ typedef struct MovieTrackingTrack { char name[64]; /* MAX_NAME */ /* ** setings ** */ - float pat_min[2], pat_max[2]; /* positions of left-bottom and right-top corners of pattern (in unified 0..1 space) */ - float search_min[2], search_max[2]; /* positions of left-bottom and right-top corners of search area (in unified 0..1 space) */ + + /* positions of left-bottom and right-top corners of pattern (in unified 0..1 units, + * relative to marker->pos) + * moved to marker's corners since planar tracking implementation + */ + float pat_min[2] DNA_DEPRECATED, pat_max[2] DNA_DEPRECATED; + + /* positions of left-bottom and right-top corners of search area (in unified 0..1 units, + * relative to marker->pos + * moved to marker since affine tracking implementation + */ + float search_min[2] DNA_DEPRECATED, search_max[2] DNA_DEPRECATED; + float offset[2]; /* offset to "parenting" point */ /* ** track ** */ @@ -95,33 +129,32 @@ typedef struct MovieTrackingTrack { int flag, pat_flag, search_flag; /* flags (selection, ...) */ float color[3]; /* custom color for track */ - /* tracking algorithm to use; can be KLT or SAD */ + /* ** control how tracking happens */ short frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */ short margin; /* margin from frame boundaries */ short pattern_match; /* re-adjust every N frames */ - short tracker; /* tracking algorithm used for this track */ - - /* ** KLT tracker settings ** */ - short pyramid_levels, pad2; /* number of pyramid levels to use for KLT tracking */ - - /* ** SAD tracker settings ** */ + /* tracking parameters */ + short motion_model; /* model of the motion for this track */ + int algorithm_flag; /* flags for the tracking algorithm (use brute, use esm, use pyramid, etc */ float minimum_correlation; /* minimal correlation which is still treated as successful tracking */ + + struct bGPdata *gpd; /* grease-pencil data */ } MovieTrackingTrack; typedef struct MovieTrackingSettings { int flag; /* ** default tracker settings */ - short default_tracker; /* tracking algorithm used by default */ - short default_pyramid_levels; /* number of pyramid levels to use for KLT tracking */ - float default_minimum_correlation; /* minimal correlation which is still treated as successful tracking */ - short default_pattern_size; /* size of pattern area for new tracks */ - short default_search_size; /* size of search area for new tracks */ - short default_frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */ - short default_margin; /* margin from frame boundaries */ - short default_pattern_match; /* re-adjust every N frames */ - short default_flag; /* default flags like color channels used by default */ + short default_motion_model; /* model of the motion for this track */ + short default_algorithm_flag; /* flags for the tracking algorithm (use brute, use esm, use pyramid, etc */ + float default_minimum_correlation; /* minimal correlation which is still treated as successful tracking */ + short default_pattern_size; /* size of pattern area for new tracks */ + short default_search_size; /* size of search area for new tracks */ + short default_frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */ + short default_margin; /* margin from frame boundaries */ + short default_pattern_match; /* re-adjust every N frames */ + short default_flag; /* default flags like color channels used by default */ short motion_flag; /* flags describes motion type */ @@ -255,10 +288,17 @@ enum { #define TRACK_PREVIEW_GRAYSCALE (1<<9) #define TRACK_DOPE_SEL (1<<10) -/* MovieTrackingTrack->tracker */ -#define TRACKER_KLT 0 -#define TRACKER_SAD 1 -#define TRACKER_HYBRID 2 +/* MovieTrackingTrack->motion_model */ +#define TRACK_MOTION_MODEL_TRANSLATION 0 +#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION 1 +#define TRACK_MOTION_MODEL_TRANSLATION_SCALE 2 +#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE 3 +#define TRACK_MOTION_MODEL_AFFINE 4 +#define TRACK_MOTION_MODEL_HOMOGRAPHY 5 + +/* MovieTrackingTrack->algorithm_flag */ +#define TRACK_ALGORITHM_FLAG_USE_BRUTE 1 +#define TRACK_ALGORITHM_FLAG_USE_NORMALIZATION 2 /* MovieTrackingTrack->adjframes */ #define TRACK_MATCH_KEYFRAME 0 diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 0191847706a..b0f8f02ae9f 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -132,6 +132,7 @@ static const char *includefiles[] = { "DNA_movieclip_types.h", "DNA_tracking_types.h", "DNA_dynamicpaint_types.h", + "DNA_mask_types.h", // empty string to indicate end of includefiles "" @@ -1241,4 +1242,5 @@ int main(int argc, char **argv) #include "DNA_movieclip_types.h" #include "DNA_tracking_types.h" #include "DNA_dynamicpaint_types.h" +#include "DNA_mask_types.h" /* end of list */ |