Blender V5.3
DNA_material_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_ID.h"
12#include "DNA_defs.h"
13#include "DNA_listBase.h"
14
15#include "BLI_enum_flags.hh"
16
17namespace blender {
18
19#ifndef MAX_MTEX
20# define MAX_MTEX 18
21#endif
22
23struct AnimData;
24struct Image;
25struct bNodeTree;
26
27/* MaterialGPencilStyle->flag */
29 /* Fill Texture is a pattern */
31 /* don't display color */
32 GP_MATERIAL_HIDE = (1 << 1),
33 /* protected from further editing */
35 /* do onion skinning */
37 /* clamp texture */
39 /* mix fill texture */
41 /* Flip fill colors */
42 GP_MATERIAL_FLIP_FILL = (1 << 6), /* Deprecated. Only used for compatibility. */
43 /* Stroke Texture is a pattern */
45 GP_MATERIAL_STROKE_SHOW = (1 << 8), /* Deprecated. Only used for compatibility. */
46 GP_MATERIAL_FILL_SHOW = (1 << 9), /* Deprecated. Only used for compatibility. */
47 /* mix stroke texture */
49 /* disable stencil clipping (overlap) */
51 /* Material used as stroke masking. */
53 /* Material used as fill masking. */
55 /* Material use randomization. */
56 GP_MATERIAL_USE_DOTS_RANDOMIZATION = static_cast<short>(1 << 15),
57};
59
65
72
73/* maximum number of materials per material array.
74 * (on object, mesh, light, etc.). limited by
75 * short mat_nr in verts, faces.
76 * -1 because for active material we store the index + 1 */
77#define MAXMAT (32767 - 1)
78
80enum eMaterial_Flag : short {
82 MA_IS_USED = 1 << 0, /* UNUSED */
84 MA_DS_EXPAND = 1 << 1,
91};
93
94/* ramps */
116
118enum eMTex_TexCo : int {
119 TEXCO_ORCO = 1 << 0,
120 // TEXCO_REFL = 1 << 1, /* Deprecated. */
121 // TEXCO_NORM = 1 << 2, /* Deprecated. */
122 TEXCO_GLOB = 1 << 3,
123 TEXCO_UV = 1 << 4,
124 TEXCO_OBJECT = 1 << 5,
125 // TEXCO_LAVECTOR = 1 << 6, /* Deprecated. */
126 // TEXCO_VIEW = 1 << 7, /* Deprecated. */
127 // TEXCO_STICKY = 1 << 8, /* Deprecated. */
128 // TEXCO_OSA = 1 << 9, /* Deprecated. */
129 TEXCO_WINDOW = 1 << 10,
130 // NEED_UV = 1 << 11, /* Deprecated. */
131 // TEXCO_TANGENT = 1 << 12, /* Deprecated. */
133 TEXCO_STRAND = 1 << 13,
135 TEXCO_PARTICLE = 1 << 13,
136 // TEXCO_STRESS = 1 << 14, /* Deprecated. */
137 // TEXCO_SPEED = 1 << 15, /* Deprecated. */
138};
140
141
142enum eMTex_MapTo : int {
143 MAP_COL = 1 << 0,
144 MAP_ALPHA = 1 << 7,
145};
147
148
149enum ePreviewType : char {
154 MA_SPHERE_A = 4, /* Used for icon renders only. */
162};
163
167};
169
170
175
181
185 // MA_BM_ADD = 1, /* deprecated */
186 // MA_BM_MULTIPLY = 2, /* deprecated */
190};
191
204
205
212
219
225
226/* Grease Pencil Stroke styles */
231
232/* Grease Pencil Fill styles */
239
240/* Grease Pencil Gradient Types */
245
246/* Grease Pencil Follow Drawing Modes */
252
253/* Grease Pencil Placement Drawing Modes */
259
262
263
264 struct Image *ima = nullptr;
265 struct ImageUser *image_user = nullptr;
266
271 char *uvname = nullptr;
276 char *attribute_name = nullptr;
278 int valid = 0;
280 int interp = 0;
281};
282
285
286
287 struct Image *sima = nullptr;
289 struct Image *ima = nullptr;
291 float stroke_rgba[4] = {};
293 float fill_rgba[4] = {};
295 float mix_rgba[4] = {};
299 short index = 0;
305 float mix_factor = 0;
310 char _pad2[4] = {};
316 float texture_angle = 0;
318 float texture_scale[2] = {};
320 float texture_offset[2] = {};
327
330
339 /* Number of points per segment when placement mode is `GP_MATERIAL_PLACEMENT_COUNT` */
341 /* Radius factor for points when placement mode is `GP_MATERIAL_PLACEMENT_RADIUS` */
343 /* Point density per unit when placement mode is `GP_MATERIAL_PLACEMENT_DENSITY` */
345
349
353
355 char _pad3[4] = {};
356
358 struct ColorBand *gradient = nullptr;
359};
360
363
364 /* Used to filter line art occlusion edges */
365 unsigned char material_mask_bits = 0;
366
368 unsigned char mat_occlusion = 1;
369
370 unsigned char intersection_priority = 0;
371
372 char _pad = {};
373};
374
375struct Material {
376#ifdef __cplusplus
379 static constexpr ID_Type id_type = ID_MA;
380#endif
381
384 struct AnimData *adt = nullptr;
385
389 char _pad1[1] = {};
390
391 /* Colors from Blender Internal that we are still using. */
392 float r = 0.8, g = 0.8, b = 0.8, a = 1.0f;
393 float specr = 1.0, specg = 1.0, specb = 1.0;
396 float spec = 0.5;
399 float roughness = 0.4f;
400 float metallic = 0;
401
404
407 short pr_texture = 0;
409
411 short index = 0;
412
413 /* #Material::use_nodes is deprecated so it's not possible to create an embedded node tree from
414 * the UI or Python API by setting `use_nodes = True`. Therefore, #nodetree is required to never
415 * be nullptr. */
416 struct bNodeTree *nodetree = nullptr;
417 struct PreviewImage *preview = nullptr;
418
419 /* Freestyle line settings. */
420 float line_col[4] = {};
421 short line_priority = 0;
422 short vcol_alpha = 0;
423
424 /* Texture painting slots. */
427 short tot_slots = 0;
428
429 /* Displacement. */
431
432 /* Thickness. */
434
435 /* Transparency. */
436 float alpha_threshold = 0.5f;
437 float refract_depth = 0;
439 MA_BM_SOLID; /* TODO(fclem): Deprecate once we remove legacy EEVEE. */
441 MA_BS_SOLID; /* TODO(fclem): Deprecate once we remove legacy EEVEE. */
443
444 /* Volume. */
446
447 /* Displacement. */
448 float inflate_bounds = 0;
449
450 char _pad3[4] = {};
451
456 struct TexPaintSlot *texpaintslot = nullptr;
457
459 ListBaseT<LinkData> gpumaterial = {nullptr, nullptr};
460
464};
465
466} // namespace blender
#define ENUM_OPERATORS(_enum_type)
ID and Library types, which are fundamental for SDNA.
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:104
#define DNA_DEPRECATED
Definition DNA_defs.h:21
These structs are the foundation for all linked lists in the library system.
BMesh Iterators.
eMaterial_VolumeIntersectionMethod
@ GP_MATERIAL_PLACEMENT_RADIUS
@ GP_MATERIAL_PLACEMENT_COUNT
@ GP_MATERIAL_PLACEMENT_DENSITY
@ MA_BL_THICKNESS_FROM_SHADOW
@ MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED
@ GP_MATERIAL_STROKE_PATTERN
@ GP_MATERIAL_DISABLE_STENCIL
@ GP_MATERIAL_USE_DOTS_RANDOMIZATION
@ GP_MATERIAL_STROKE_TEX_MIX
@ GP_MATERIAL_IS_FILL_HOLDOUT
@ GP_MATERIAL_HIDE_ONIONSKIN
@ GP_MATERIAL_IS_STROKE_HOLDOUT
eMaterialGPencilStyle_StrokeStyle
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_TEXTURE
eMaterialGPencilStyle_GradientType
@ GP_MATERIAL_GRADIENT_RADIAL
@ GP_MATERIAL_GRADIENT_LINEAR
@ LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS
@ LRT_MATERIAL_CUSTOM_INTERSECTION_PRIORITY
@ LRT_MATERIAL_MASK_ENABLED
@ GP_MATERIAL_FILL_STYLE_CHECKER
@ GP_MATERIAL_FILL_STYLE_TEXTURE
@ GP_MATERIAL_FILL_STYLE_SOLID
@ GP_MATERIAL_FILL_STYLE_GRADIENT
eMaterialGPencilStyle_StrokeStyle stroke_style
eMaterialGPencilStyle_GradientType gradient_type
eMaterialGPencilStyle_Flag flag
DNA_DEPRECATED float gradient_shift[2]
eMaterialGPencilStyle_FollowMode alignment_mode
DNA_DEPRECATED float gradient_scale[2]
eMaterialGPencilStyle_Mode mode
DNA_DEPRECATED float gradient_radius
eMaterialGPencilPlacementMode placement_mode
DNA_DEPRECATED float texture_opacity
eMaterialGPencilStyle_FillStyle fill_style
DNA_DEPRECATED float gradient_angle
eMaterialLineArtFlags flags
struct MaterialGPencilStyle * gp_style
DNA_DEPRECATED float ray_mirror
DNA_DEPRECATED char use_nodes
struct PreviewImage * preview
eMaterial_DisplacementMethod displacement_method
ListBaseT< LinkData > gpumaterial
eMaterial_SurfaceRenderMethod surface_render_method
struct bNodeTree * nodetree
struct MaterialLineArt lineart
eMaterial_VolumeIntersectionMethod volume_intersection_method
struct AnimData * adt
DNA_DEPRECATED float alpha
eMaterial_BlendMethod blend_method
eMaterial_PreviewFlag pr_flag
struct TexPaintSlot * texpaintslot
eMaterial_BlendShadow blend_shadow
DNA_DEPRECATED float gloss_mir
eMaterial_ThicknessMode thickness_mode
eMaterial_BlendFlag blend_flag
struct ImageUser * image_user