1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 */ 16 17 /** \file 18 * \ingroup DNA 19 */ 20 21 #pragma once 22 23 #include "DNA_listBase.h" 24 struct PaintSurfaceData; 25 26 /* surface format */ 27 enum { 28 MOD_DPAINT_SURFACE_F_PTEX = 0, 29 MOD_DPAINT_SURFACE_F_VERTEX = 1, 30 MOD_DPAINT_SURFACE_F_IMAGESEQ = 2, 31 }; 32 33 /* surface type */ 34 enum { 35 MOD_DPAINT_SURFACE_T_PAINT = 0, 36 MOD_DPAINT_SURFACE_T_DISPLACE = 1, 37 MOD_DPAINT_SURFACE_T_WEIGHT = 2, 38 MOD_DPAINT_SURFACE_T_WAVE = 3, 39 }; 40 41 /* surface flags */ 42 enum { 43 MOD_DPAINT_ACTIVE = 1 << 0, /* Is surface enabled */ 44 45 MOD_DPAINT_ANTIALIAS = 1 << 1, /* do antialiasing */ 46 MOD_DPAINT_DISSOLVE = 1 << 2, /* do dissolve */ 47 MOD_DPAINT_MULALPHA = 1 << 3, /* Multiply color by alpha when saving image */ 48 MOD_DPAINT_DISSOLVE_LOG = 1 << 4, /* Use 1/x for surface dissolve */ 49 MOD_DPAINT_DRY_LOG = 1 << 5, /* Use 1/x for drying paint */ 50 51 MOD_DPAINT_WAVE_OPEN_BORDERS = 1 << 7, /* passes waves through mesh edges */ 52 MOD_DPAINT_DISP_INCREMENTAL = 1 << 8, /* builds displace on top of earlier values */ 53 MOD_DPAINT_USE_DRYING = 1 << 9, /* use drying */ 54 55 MOD_DPAINT_OUT1 = 1 << 10, /* output primary surface */ 56 MOD_DPAINT_OUT2 = 1 << 11, /* output secondary surface */ 57 }; 58 59 /* image_fileformat */ 60 enum { 61 MOD_DPAINT_IMGFORMAT_PNG = 0, 62 MOD_DPAINT_IMGFORMAT_OPENEXR = 1, 63 }; 64 65 /* disp_format */ 66 enum { 67 MOD_DPAINT_DISP_DISPLACE = 0, /* displacement output displace map */ 68 MOD_DPAINT_DISP_DEPTH = 1, /* displacement output depth data */ 69 }; 70 71 /* effect */ 72 enum { 73 MOD_DPAINT_EFFECT_DO_SPREAD = 1 << 0, /* do spread effect */ 74 MOD_DPAINT_EFFECT_DO_DRIP = 1 << 1, /* do drip effect */ 75 MOD_DPAINT_EFFECT_DO_SHRINK = 1 << 2, /* do shrink effect */ 76 }; 77 78 /* init_color_type */ 79 enum { 80 MOD_DPAINT_INITIAL_NONE = 0, 81 MOD_DPAINT_INITIAL_COLOR = 1, 82 MOD_DPAINT_INITIAL_TEXTURE = 2, 83 MOD_DPAINT_INITIAL_VERTEXCOLOR = 3, 84 }; 85 86 /* Is stored in ModifierData.runtime. */ 87 # 88 # 89 typedef struct DynamicPaintRuntime { 90 struct Mesh *canvas_mesh; 91 struct Mesh *brush_mesh; 92 } DynamicPaintRuntime; 93 94 typedef struct DynamicPaintSurface { 95 96 struct DynamicPaintSurface *next, *prev; 97 /** For fast RNA access. */ 98 struct DynamicPaintCanvasSettings *canvas; 99 struct PaintSurfaceData *data; 100 101 struct Collection *brush_group; 102 struct EffectorWeights *effector_weights; 103 104 /* cache */ 105 struct PointCache *pointcache; 106 struct ListBase ptcaches; 107 int current_frame; 108 109 /* surface */ 110 char name[64]; 111 short format, type; 112 short disp_type, image_fileformat; 113 /** Ui selection box. */ 114 short effect_ui; 115 short init_color_type; 116 int flags, effect; 117 118 int image_resolution, substeps; 119 int start_frame, end_frame; 120 121 /* initial color */ 122 float init_color[4]; 123 struct Tex *init_texture; 124 /** MAX_CUSTOMDATA_LAYER_NAME. */ 125 char init_layername[64]; 126 127 int dry_speed, diss_speed; 128 float color_dry_threshold; 129 float depth_clamp, disp_factor; 130 131 float spread_speed, color_spread_speed, shrink_speed; 132 float drip_vel, drip_acc; 133 134 /* per surface brush settings */ 135 float influence_scale, radius_scale; 136 137 /* wave settings */ 138 float wave_damping, wave_speed, wave_timescale, wave_spring, wave_smoothness; 139 char _pad2[4]; 140 141 /** MAX_CUSTOMDATA_LAYER_NAME. */ 142 char uvlayer_name[64]; 143 /** 1024 = FILE_MAX. */ 144 char image_output_path[1024]; 145 /** MAX_CUSTOMDATA_LAYER_NAME. */ 146 char output_name[64]; 147 /** MAX_CUSTOMDATA_LAYER_NAME */ /* some surfaces have 2 outputs. */ 148 char output_name2[64]; 149 150 } DynamicPaintSurface; 151 152 /* canvas flags */ 153 enum { 154 /** surface is already baking, so it wont get updated (loop) */ 155 MOD_DPAINT_BAKING = 1 << 1, 156 }; 157 158 /* Canvas settings */ 159 typedef struct DynamicPaintCanvasSettings { 160 /** For fast RNA access. */ 161 struct DynamicPaintModifierData *pmd; 162 163 struct ListBase surfaces; 164 short active_sur, flags; 165 char _pad[4]; 166 167 /** Bake error description. */ 168 char error[64]; 169 170 } DynamicPaintCanvasSettings; 171 172 /* flags */ 173 enum { 174 /** use particle radius */ 175 MOD_DPAINT_PART_RAD = 1 << 0, 176 // MOD_DPAINT_USE_MATERIAL = 1 << 1, /* DNA_DEPRECATED */ 177 /** don't increase alpha unless paint alpha is higher than existing */ 178 MOD_DPAINT_ABS_ALPHA = 1 << 2, 179 /** removes paint */ 180 MOD_DPAINT_ERASE = 1 << 3, 181 182 /** only read falloff ramp alpha */ 183 MOD_DPAINT_RAMP_ALPHA = 1 << 4, 184 /** do proximity check only in defined dir */ 185 MOD_DPAINT_PROX_PROJECT = 1 << 5, 186 /** inverse proximity painting */ 187 MOD_DPAINT_INVERSE_PROX = 1 << 6, 188 /** negates volume influence on "volume + prox" mode */ 189 MOD_DPAINT_NEGATE_VOLUME = 1 << 7, 190 191 /** brush smudges existing paint */ 192 MOD_DPAINT_DO_SMUDGE = 1 << 8, 193 /** multiply brush influence by velocity */ 194 MOD_DPAINT_VELOCITY_ALPHA = 1 << 9, 195 /** replace brush color by velocity color ramp */ 196 MOD_DPAINT_VELOCITY_COLOR = 1 << 10, 197 /** multiply brush intersection depth by velocity */ 198 MOD_DPAINT_VELOCITY_DEPTH = 1 << 11, 199 200 MOD_DPAINT_USES_VELOCITY = (MOD_DPAINT_DO_SMUDGE | MOD_DPAINT_VELOCITY_ALPHA | 201 MOD_DPAINT_VELOCITY_COLOR | MOD_DPAINT_VELOCITY_DEPTH), 202 }; 203 204 /* collision type */ 205 enum { 206 MOD_DPAINT_COL_VOLUME = 0, /* paint with mesh volume */ 207 MOD_DPAINT_COL_DIST = 1, /* paint using distance to mesh surface */ 208 MOD_DPAINT_COL_VOLDIST = 2, /* use both volume and distance */ 209 MOD_DPAINT_COL_PSYS = 3, /* use particle system */ 210 MOD_DPAINT_COL_POINT = 4, /* use distance to object center point */ 211 }; 212 213 /* proximity_falloff */ 214 enum { 215 MOD_DPAINT_PRFALL_CONSTANT = 0, /* no-falloff */ 216 MOD_DPAINT_PRFALL_SMOOTH = 1, /* smooth, linear falloff */ 217 MOD_DPAINT_PRFALL_RAMP = 2, /* use color ramp */ 218 }; 219 220 /* wave_brush_type */ 221 enum { 222 MOD_DPAINT_WAVEB_DEPTH = 0, /* use intersection depth */ 223 MOD_DPAINT_WAVEB_FORCE = 1, /* act as a force on intersection area */ 224 MOD_DPAINT_WAVEB_REFLECT = 2, /* obstacle that reflects waves */ 225 MOD_DPAINT_WAVEB_CHANGE = 3, /* use change of intersection depth from previous frame */ 226 }; 227 228 /* brush ray_dir */ 229 enum { 230 MOD_DPAINT_RAY_CANVAS = 0, 231 MOD_DPAINT_RAY_BRUSH_AVG = 1, 232 MOD_DPAINT_RAY_ZPLUS = 2, 233 }; 234 235 /* Brush settings */ 236 typedef struct DynamicPaintBrushSettings { 237 /** For fast RNA access. */ 238 struct DynamicPaintModifierData *pmd; 239 struct ParticleSystem *psys; 240 241 int flags; 242 int collision; 243 244 float r, g, b, alpha; 245 float wetness; 246 247 float particle_radius, particle_smooth; 248 float paint_distance; 249 250 /* color ramps */ 251 /** Proximity paint falloff. */ 252 struct ColorBand *paint_ramp; 253 /** Velocity paint ramp. */ 254 struct ColorBand *vel_ramp; 255 256 short proximity_falloff; 257 short wave_type; 258 short ray_dir; 259 char _pad[2]; 260 261 float wave_factor, wave_clamp; 262 float max_velocity, smudge_strength; 263 } DynamicPaintBrushSettings; 264