Blender V5.3
material.cc File Reference
#include <algorithm>
#include <cmath>
#include <cstring>
#include <optional>
#include "BLI_utildefines.hh"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_curve_types.h"
#include "DNA_curves_types.h"
#include "DNA_gpencil_legacy_types.h"
#include "DNA_grease_pencil_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "DNA_volume_types.h"
#include "BLI_array_utils_c.hh"
#include "BLI_enum_flags.hh"
#include "BLI_listbase.hh"
#include "BLI_math_color_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_string.hh"
#include "BLT_translation.hh"
#include "BKE_anim_data.hh"
#include "BKE_attribute.h"
#include "BKE_attribute.hh"
#include "BKE_brush.hh"
#include "BKE_colorband.hh"
#include "BKE_curve.hh"
#include "BKE_curves.hh"
#include "BKE_displist.h"
#include "BKE_editmesh.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_icons.hh"
#include "BKE_idtype.hh"
#include "BKE_image.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"
#include "BKE_material.hh"
#include "BKE_mesh.hh"
#include "BKE_node.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_object.hh"
#include "BKE_object_types.hh"
#include "BKE_pointcloud.hh"
#include "BKE_preview_image.hh"
#include "BKE_scene.hh"
#include "BKE_vfont.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"
#include "DEG_depsgraph_query.hh"
#include "GPU_material.hh"
#include "NOD_shader.h"
#include "BLO_read_write.hh"

Go to the source code of this file.

Classes

struct  blender::FillTexPaintSlotsData
struct  blender::FindTexPaintNodeData

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define DNA_DEPRECATED_ALLOW

Typedefs

using blender::ForEachTexNodeCallback = bool (*)(bNodeTree *nodetree, bNode *node, void *userdata)

Enumerations

enum  blender::ePaintSlotFilter { blender::PAINT_SLOT_IMAGE = 1 << 0 , blender::PAINT_SLOT_COLOR_ATTRIBUTE = 1 << 1 }

Functions

static void blender::material_init_data (ID *id)
static void blender::material_copy_data (Main *bmain, std::optional< Library * > owner_library, ID *id_dst, const ID *id_src, const int flag)
static void blender::material_free_data (ID *id)
static void blender::material_foreach_id (ID *id, LibraryForeachIDData *data)
static void blender::material_foreach_working_space_color (ID *id, const IDTypeForeachColorFunctionCallback &fn)
static void blender::material_blend_write (BlendWriter *writer, ID *id, const void *id_address)
static void blender::material_blend_read_data (BlendDataReader *reader, ID *id)
static void blender::nodetree_mark_previews_dirty_reccursive (bNodeTree *tree)
static void blender::material_data_index_remove_id (ID *id, short index)
static void blender::material_data_index_clear_id (ID *id)
static const ID * blender::get_evaluated_object_data_with_materials (const Object *ob)
static void blender::object_material_assign (Main *bmain, Object *ob, Material *ma, short act, int assign_type, bool do_test_all)
static bNode * blender::nodetree_uv_node_recursive (bNode *node)
static bool blender::ntree_foreach_texnode_recursive (bNodeTree *nodetree, ForEachTexNodeCallback callback, void *userdata, ePaintSlotFilter slot_filter)
static bool blender::count_texture_nodes_cb (bNodeTree *, bNode *, void *userdata)
static int blender::count_texture_nodes_recursive (bNodeTree *nodetree, ePaintSlotFilter slot_filter)
static bool blender::fill_texpaint_slots_cb (bNodeTree *, bNode *node, void *userdata)
static void blender::fill_texpaint_slots_recursive (bNodeTree *nodetree, bNode *active_node, const Object *ob, Material *ma, int slot_len, ePaintSlotFilter slot_filter)
static bool blender::texpaint_slot_node_find_cb (bNodeTree *nodetree, bNode *node, void *userdata)
static Material * blender::material_default_create (Material **ma_p, const char *name)
static void blender::material_default_gpencil_init (Material **ma_p)
static void blender::material_default_surface_init (Material **ma_p)
static void blender::material_default_volume_init (Material **ma_p)
static void blender::material_default_holdout_init (Material **ma_p)
static void blender::material_default_gsplat_init (Material **ma_p)
Materials
void blender::BKE_gpencil_material_attr_init (Material *ma)
void blender::BKE_material_make_node_previews_dirty (Material *ma)
Material * blender::BKE_material_add (Main *bmain, const char *name)
Material * blender::BKE_gpencil_material_add (Main *bmain, const char *name)
void blender::BKE_object_material_resize (Main *bmain, Object *ob, short totcol, bool do_id_user)
void blender::BKE_object_materials_sync_length (Main *bmain, Object *ob, ID *id)
void blender::BKE_objects_materials_sync_length_all (Main *bmain, ID *id)
void blender::BKE_material_attr_indices_remap (bke::MutableAttributeAccessor attributes, const unsigned int *remap, int remap_num)
void blender::BKE_object_material_remap (Object *ob, const unsigned int *remap)
void blender::BKE_object_material_remap_calc (Object *ob_dst, Object *ob_src, short *remap_src_to_dst)
void blender::BKE_object_material_from_eval_data (Main *bmain, Object *ob_orig, const ID *data_eval)
Material Slots
Material *** blender::BKE_object_material_array_p (Object *ob)
short * blender::BKE_object_material_len_p (Object *ob)
Material *** blender::BKE_id_material_array_p (ID *id)
short * blender::BKE_id_material_len_p (ID *id)
bool blender::BKE_object_material_slot_used (Object *object, short actcol)
Material ** blender::BKE_object_material_get_p (Object *ob, short act)
Material * blender::BKE_object_material_get (Object *ob, short act)
int blender::BKE_object_material_index_get (Object *ob, const Material *ma)
int blender::BKE_object_material_index_get_with_hint (Object *ob, const Material *ma, int hint_index)
int blender::BKE_object_material_ensure (Main *bmain, Object *ob, Material *material)
Material * blender::BKE_gpencil_material (Object *ob, short act)
MaterialGPencilStyle * blender::BKE_gpencil_material_settings (Object *ob, short act)
void blender::BKE_object_material_active_index_sanitize (Object *ob)
void blender::BKE_id_material_assign (Main *bmain, ID *id, Material *ma, short act)
void blender::BKE_object_material_assign (Main *bmain, Object *ob, Material *ma, short act, int assign_type)
void blender::BKE_object_material_assign_single_obdata (Main *bmain, Object *ob, Material *ma, short act)
void blender::BKE_object_material_array_assign (Main *bmain, Object *ob, Material ***matar, int totcol, bool to_object_only)
short blender::BKE_object_material_slot_find_index (Object *ob, Material *ma)
bool blender::BKE_object_material_slot_add (Main *bmain, Object *ob, bool set_active=true)
bool blender::BKE_object_material_slot_remove (Main *bmain, Object *ob)
int blender::BKE_object_material_remove_unused (Main *bmain, Object *ob)
int blender::BKE_object_material_remove_all (Main *bmain, Object *ob)
void blender::BKE_texpaint_slot_refresh_cache (Scene *scene, Material *ma, const Object *ob)
void blender::BKE_texpaint_slots_refresh_object (Scene *scene, Object *ob)
std::pair< bNodeTree *, bNode * > blender::BKE_texpaint_slot_material_find_node (Material *ma, short texpaint_slot)
RNA API
void blender::BKE_id_materials_copy (Main *bmain, ID *id_src, ID *id_dst)
void blender::BKE_id_material_resize (Main *bmain, ID *id, short totcol, bool do_id_user)
void blender::BKE_id_material_append (Main *bmain, ID *id, Material *ma)
Material * blender::BKE_id_material_pop (Main *bmain, ID *id, int index)
void blender::BKE_id_material_clear (Main *bmain, ID *id)
Evaluation API
Material * blender::BKE_object_material_get_eval (Object *ob, short act)
const Material * blender::BKE_object_material_get_eval (const Object &ob, const ID &data, short act)
int blender::BKE_object_material_count_eval (const Object *ob)
int blender::BKE_object_material_count_eval (const Object &ob, const ID &data)
std::optional< int > blender::BKE_id_material_index_max_eval (const ID &id)
int blender::BKE_id_material_used_eval (const ID &id)
int blender::BKE_id_material_used_with_fallback_eval (const ID &id)
int blender::BKE_object_material_used_with_fallback_eval (const Object &ob)
void blender::BKE_id_material_eval_assign (ID *id, int slot, Material *material)
void blender::BKE_id_material_eval_ensure_default_slot (ID *id)
Rendering
void blender::ramp_blend (int type, float r_col[4], float fac, const float col[4])
Dependency graph evaluation
void blender::BKE_material_eval (Depsgraph *depsgraph, Material *material)
Default Materials

TODO: Explain expected usages? Seems to be primarily defined for GPU/viewport code?

Warning
NEVER use these materials as fallback data for regular ID data. They should only be used as template/copy source, or in some very specific, local and short-lived contexts.
Material * blender::BKE_material_default_empty ()
Material * blender::BKE_material_default_holdout ()
Material * blender::BKE_material_default_surface ()
Material * blender::BKE_material_default_volume ()
Material * blender::BKE_material_default_gpencil ()
Material * blender::BKE_material_default_gsplat ()
void blender::BKE_material_defaults_free_gpu ()
Module
void blender::BKE_materials_init ()
void blender::BKE_materials_exit ()

Variables

static CLG_LogRef blender::LOG = {"material"}
static Material * blender::default_material_empty = nullptr
static Material * blender::default_material_holdout = nullptr
static Material * blender::default_material_surface = nullptr
static Material * blender::default_material_volume = nullptr
static Material * blender::default_material_gpencil = nullptr
static Material * blender::default_material_gsplat = nullptr
static Material ** blender::default_materials []

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 20 of file blenkernel/intern/material.cc.