|
Blender
V2.59
|
00001 /* 00002 * $Id: DNA_gpencil_types.h 35935 2011-04-01 11:55:21Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2008, Blender Foundation. 00021 * This is a new part of Blender 00022 * 00023 * Contributor(s): Joshua Leung 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 #ifndef DNA_GPENCIL_TYPES_H 00028 #define DNA_GPENCIL_TYPES_H 00029 00034 #include "DNA_listBase.h" 00035 #include "DNA_ID.h" 00036 00037 /* Grease-Pencil Annotations - 'Stroke Point' 00038 * -> Coordinates may either be 2d or 3d depending on settings at the time 00039 * -> Coordinates of point on stroke, in proportions of window size 00040 * This assumes that the bottom-left corner is (0,0) 00041 */ 00042 typedef struct bGPDspoint { 00043 float x, y, z; /* co-ordinates of point (usually 2d, but can be 3d as well) */ 00044 float pressure; /* pressure of input device (from 0 to 1) at this point */ 00045 } bGPDspoint; 00046 00047 /* Grease-Pencil Annotations - 'Stroke' 00048 * -> A stroke represents a (simplified version) of the curve 00049 * drawn by the user in one 'mousedown'->'mouseup' operation 00050 */ 00051 typedef struct bGPDstroke { 00052 struct bGPDstroke *next, *prev; 00053 00054 bGPDspoint *points; /* array of data-points for stroke */ 00055 int totpoints; /* number of data-points in array */ 00056 00057 short thickness; /* thickness of stroke (currently not used) */ 00058 short flag; /* various settings about this stroke */ 00059 } bGPDstroke; 00060 00061 /* bGPDstroke->flag */ 00062 /* stroke is in 3d-space */ 00063 #define GP_STROKE_3DSPACE (1<<0) 00064 /* stroke is in 2d-space */ 00065 #define GP_STROKE_2DSPACE (1<<1) 00066 /* stroke is in 2d-space (but with special 'image' scaling) */ 00067 #define GP_STROKE_2DIMAGE (1<<2) 00068 /* only for use with stroke-buffer (while drawing eraser) */ 00069 #define GP_STROKE_ERASER (1<<15) 00070 00071 00072 /* Grease-Pencil Annotations - 'Frame' 00073 * -> Acts as storage for the 'image' formed by strokes 00074 */ 00075 typedef struct bGPDframe { 00076 struct bGPDframe *next, *prev; 00077 00078 ListBase strokes; /* list of the simplified 'strokes' that make up the frame's data */ 00079 00080 int framenum; /* frame number of this frame */ 00081 int flag; /* temp settings */ 00082 } bGPDframe; 00083 00084 /* bGPDframe->flag */ 00085 /* frame is being painted on */ 00086 #define GP_FRAME_PAINT (1<<0) 00087 /* for editing in Action Editor */ 00088 #define GP_FRAME_SELECT (1<<1) 00089 00090 00091 /* Grease-Pencil Annotations - 'Layer' */ 00092 typedef struct bGPDlayer { 00093 struct bGPDlayer *next, *prev; 00094 00095 ListBase frames; /* list of annotations to display for frames (bGPDframe list) */ 00096 bGPDframe *actframe; /* active frame (should be the frame that is currently being displayed) */ 00097 00098 int flag; /* settings for layer */ 00099 short thickness; /* current thickness to apply to strokes */ 00100 short gstep; /* max number of frames between active and ghost to show (0=only those on either side) */ 00101 00102 float color[4]; /* color that should be used to draw all the strokes in this layer */ 00103 00104 char info[128]; /* optional reference info about this layer (i.e. "director's comments, 12/3") */ 00105 } bGPDlayer; 00106 00107 /* bGPDlayer->flag */ 00108 /* don't display layer */ 00109 #define GP_LAYER_HIDE (1<<0) 00110 /* protected from further editing */ 00111 #define GP_LAYER_LOCKED (1<<1) 00112 /* layer is 'active' layer being edited */ 00113 #define GP_LAYER_ACTIVE (1<<2) 00114 /* draw points of stroke for debugging purposes */ 00115 #define GP_LAYER_DRAWDEBUG (1<<3) 00116 /* do onionskinning */ 00117 #define GP_LAYER_ONIONSKIN (1<<4) 00118 /* for editing in Action Editor */ 00119 #define GP_LAYER_SELECT (1<<5) 00120 /* current frame for layer can't be changed */ 00121 #define GP_LAYER_FRAMELOCK (1<<6) 00122 /* don't render xray (which is default) */ 00123 #define GP_LAYER_NO_XRAY (1<<7) 00124 00125 00126 /* Grease-Pencil Annotations - 'DataBlock' */ 00127 typedef struct bGPdata { 00128 ID id; /* Grease Pencil data is */ 00129 00130 /* saved Grease-Pencil data */ 00131 ListBase layers; /* bGPDlayers */ 00132 int flag; /* settings for this datablock */ 00133 00134 /* not-saved stroke buffer data (only used during paint-session) 00135 * - buffer must be initialised before use, but freed after 00136 * whole paint operation is over 00137 */ 00138 short sbuffer_size; /* number of elements currently in cache */ 00139 short sbuffer_sflag; /* flags for stroke that cache represents */ 00140 void *sbuffer; /* stroke buffer (can hold GP_STROKE_BUFFER_MAX) */ 00141 } bGPdata; 00142 00143 /* bGPdata->flag */ 00144 // XXX many of these flags should be depreceated for more general ideas in 2.5 00145 /* don't allow painting to occur at all */ 00146 // XXX is depreceated - not well understood 00147 #define GP_DATA_LMBPLOCK (1<<0) 00148 /* show debugging info in viewport (i.e. status print) */ 00149 #define GP_DATA_DISPINFO (1<<1) 00150 /* in Action Editor, show as expanded channel */ 00151 #define GP_DATA_EXPAND (1<<2) 00152 /* is the block overriding all clicks? */ 00153 // XXX is depreceated - nasty old concept 00154 #define GP_DATA_EDITPAINT (1<<3) 00155 /* new strokes are added in viewport space */ 00156 #define GP_DATA_VIEWALIGN (1<<4) 00157 /* Project into the screens Z values */ 00158 #define GP_DATA_DEPTH_VIEW (1<<5) 00159 #define GP_DATA_DEPTH_STROKE (1<<6) 00160 00161 #define GP_DATA_DEPTH_STROKE_ENDPOINTS (1<<7) 00162 00163 #endif /* DNA_GPENCIL_TYPES_H */