Blender
V3.3
|
#include <math.h>
#include <stddef.h>
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_anim_types.h"
#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
#include "DNA_curves_types.h"
#include "DNA_customdata_types.h"
#include "DNA_defaults.h"
#include "DNA_gpencil_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_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_volume_types.h"
#include "BLI_array_utils.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_anim_data.h"
#include "BKE_attribute.h"
#include "BKE_brush.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
#include "BKE_gpencil.h"
#include "BKE_icons.h"
#include "BKE_idtype.h"
#include "BKE_image.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_vfont.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "GPU_material.h"
#include "NOD_shader.h"
#include "BLO_read_write.h"
Go to the source code of this file.
Classes | |
struct | FillTexPaintSlotsData |
struct | FindTexPaintNodeData |
Macros | |
#define | DNA_DEPRECATED_ALLOW |
Typedefs | |
typedef enum ePaintSlotFilter | ePaintSlotFilter |
typedef bool(* | ForEachTexNodeCallback) (bNode *node, void *userdata) |
Enumerations | |
enum | ePaintSlotFilter { PAINT_SLOT_IMAGE = 1 << 0 , PAINT_SLOT_COLOR_ATTRIBUTE = 1 << 1 } |
Variables | |
static CLG_LogRef | LOG = {"bke.material"} |
IDTypeInfo | IDType_ID_MA |
static Material | matcopybuf |
copy/paste buffer, if we had a proper py api that would be better More... | |
static short | matcopied = 0 |
static Material | default_material_empty |
static Material | default_material_holdout |
static Material | default_material_surface |
static Material | default_material_volume |
static Material | default_material_gpencil |
static Material * | default_materials [] |
#define DNA_DEPRECATED_ALLOW |
Definition at line 17 of file material.c.
typedef enum ePaintSlotFilter ePaintSlotFilter |
Bitwise filter for updating paint slots.
Definition at line 1369 of file material.c.
enum ePaintSlotFilter |
Bitwise filter for updating paint slots.
Enumerator | |
---|---|
PAINT_SLOT_IMAGE | |
PAINT_SLOT_COLOR_ATTRIBUTE |
Definition at line 1364 of file material.c.
Definition at line 795 of file material.c.
References BKE_material_default_gpencil(), BKE_object_material_get(), and NULL.
Referenced by BKE_gpencil_merge_materials_table_get(), ED_gpencil_join_objects_exec(), ED_gpencil_update_color_uv(), get_automasking_strokes_list(), gpencil_lock_layer_exec(), gpencil_material_hide_exec(), gpencil_material_isolate_exec(), gpencil_material_lock_all_exec(), gpencil_material_reveal_exec(), gpencil_material_unlock_all_exec(), gpencil_materials_copy_to_object_exec(), gpencil_stroke_change_color_exec(), gpencil_stroke_separate_exec(), gpencil_strokes_merge_poll(), is_stroke_affected_by_modifier(), and object_gpencil_add_exec().
Definition at line 298 of file material.c.
References BKE_gpencil_material_attr_init(), BKE_material_add(), and NULL.
Referenced by BKE_gpencil_brush_preset_set(), BKE_gpencil_object_material_new(), BLO_update_defaults_startup_blend(), gpencil_material_to_vertex_exec(), and new_material_exec().
Definition at line 270 of file material.c.
References ARRAY_SET_ITEMS, MaterialGPencilStyle::fill_rgba, MaterialGPencilStyle::flag, GP_MATERIAL_STROKE_SHOW, Material::gp_style, MEM_callocN, MaterialGPencilStyle::mix_factor, MaterialGPencilStyle::mix_rgba, NULL, MaterialGPencilStyle::stroke_rgba, MaterialGPencilStyle::texture_offset, MaterialGPencilStyle::texture_pixsize, and MaterialGPencilStyle::texture_scale.
Referenced by BKE_gpencil_material_add(), BKE_gpencil_material_settings(), BKE_gpencil_object_material_ensure_active(), and material_default_gpencil_init().
MaterialGPencilStyle* BKE_gpencil_material_settings | ( | Object * | ob, |
short | act | ||
) |
Definition at line 805 of file material.c.
References BKE_gpencil_material_attr_init(), BKE_material_default_gpencil(), BKE_object_material_get(), Material::gp_style, and NULL.
Referenced by BKE_gpencil_merge_materials(), deformStroke(), ED_gpencil_stroke_material_editable(), ED_gpencil_stroke_material_visible(), gpencil_create_extensions(), gpencil_draw_datablock(), gpencil_extract_palette_from_vertex(), gpencil_generic_curve_select(), gpencil_generic_stroke_select(), gpencil_material_hide_exec(), gpencil_material_isolate_exec(), gpencil_material_pool_create(), gpencil_material_select_exec(), gpencil_material_to_vertex_exec(), gpencil_object_cache_add(), gpencil_sculpt_brush_do_frame(), gpencil_stroke_cache_populate(), gpencil_stroke_caps_set_exec(), gpencil_stroke_cyclical_set_exec(), blender::eevee::gpencil_stroke_sync(), gpencil_vertexpaint_select_stroke(), gpencil_zoom_level_set(), and blender::io::gpencil::GpencilIO::prepare_stroke_export_colors().
Definition at line 559 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BKE_objects_materials_test_all(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_COPY_ON_WRITE, id_us_plus(), MEM_callocN, and MEM_freeN.
Definition at line 377 of file material.c.
References BLI_assert, GS, id, ID_CU_LEGACY, ID_CV, ID_GD, ID_MB, ID_ME, ID_PT, ID_VO, ID::name, NULL, and OB_DATA_SUPPORT_ID.
Referenced by BKE_id_material_append(), BKE_id_material_assign(), BKE_id_material_clear(), BKE_id_material_eval_assign(), BKE_id_material_pop(), BKE_id_material_resize(), BKE_id_materials_copy(), BKE_object_material_from_eval_data(), BKE_object_material_get_eval(), and mesh_separate_material_assign_mat_nr().
Definition at line 905 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BKE_objects_materials_test_all(), Material::id, id_us_min(), id_us_plus(), MAXMAT, MEM_callocN, MEM_freeN, and NULL.
Definition at line 621 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BKE_objects_materials_test_all(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_COPY_ON_WRITE, id_us_min(), material_data_index_clear_id(), MEM_freeN, and NULL.
Referenced by mesh_separate_material_assign_mat_nr().
Definition at line 758 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BLI_assert, BLI_assert_unreachable, ELEM, material, MEM_reallocN, and NULL.
Referenced by blender::nodes::node_geo_set_material_cc::assign_material_to_faces(), BKE_id_material_eval_ensure_default_slot(), blender::geometry::execute_realize_mesh_tasks(), and blender::nodes::node_geo_set_material_cc::node_geo_exec().
Add an empty material slot if the id has no material slots. This material slot allows the material to be overwritten by object-linked materials.
Definition at line 784 of file material.c.
References BKE_id_material_eval_assign(), BKE_id_material_len_p(), and NULL.
Referenced by blender::nodes::node_geo_set_material_cc::assign_material_to_faces(), blender::nodes::node_geo_mesh_primitive_circle_cc::create_circle_mesh(), blender::nodes::node_geo_mesh_primitive_cube_cc::create_cuboid_mesh(), blender::nodes::create_cylinder_or_cone_mesh(), blender::nodes::node_geo_mesh_primitive_ico_sphere_cc::create_ico_sphere_mesh(), blender::nodes::create_line_mesh(), blender::nodes::node_geo_mesh_primitive_uv_sphere_cc::create_uv_sphere_mesh(), and blender::nodes::node_geo_mesh_primitive_grid_cc::node_geo_exec().
short* BKE_id_material_len_p | ( | ID * | id | ) |
Definition at line 403 of file material.c.
References BLI_assert, GS, id, ID_CU_LEGACY, ID_CV, ID_GD, ID_MB, ID_ME, ID_PT, ID_VO, ID::name, NULL, and OB_DATA_SUPPORT_ID.
Referenced by BKE_id_material_append(), BKE_id_material_assign(), BKE_id_material_clear(), BKE_id_material_eval_assign(), BKE_id_material_eval_ensure_default_slot(), BKE_id_material_pop(), BKE_id_material_resize(), BKE_id_materials_copy(), BKE_object_material_count_eval(), BKE_object_material_from_eval_data(), BKE_object_material_get_eval(), BKE_object_materials_test(), BKE_objects_materials_test_all(), ED_object_add_type_with_obdata(), and mesh_separate_material_assign_mat_nr().
Definition at line 583 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BKE_objects_materials_test_all(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_COPY_ON_WRITE, id_us_min(), material_data_index_remove_id(), MEM_freeN, MEM_reallocN, NULL, and ret.
Definition at line 528 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_COPY_ON_WRITE, id_us_min(), MEM_freeN, MEM_recallocN, and NULL.
Referenced by BKE_object_materials_test(), and mesh_separate_material_assign_mat_nr().
Definition at line 507 of file material.c.
References Freestyle::a, BKE_id_material_array_p(), BKE_id_material_len_p(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_COPY_ON_WRITE, id_us_plus(), and MEM_dupallocN.
Referenced by BKE_mesh_to_pointcloud(), and BKE_pointcloud_to_mesh().
Definition at line 289 of file material.c.
References BKE_id_new(), and ID_MA.
Referenced by blender::io::usd::USDMaterialReader::add_material(), blender::io::alembic::utils::assign_materials(), BKE_gpencil_material_add(), get_or_create_current_material(), blender::io::obj::get_or_create_material(), Freestyle::BlenderStrokeRenderer::GetStrokeShader(), new_material_exec(), and DocumentImporter::writeMaterial().
Definition at line 1871 of file material.c.
References matcopied, and matcopybuf.
Referenced by WM_init().
Definition at line 1889 of file material.c.
References BKE_material_copybuf_free(), BLI_listbase_clear(), Material::gpumaterial, matcopied, matcopybuf, Material::nodetree, ntreeCopyTree_ex(), NULL, and Material::preview.
Referenced by copy_material_exec().
Definition at line 1877 of file material.c.
References BLI_assert, bNodeTree::id, matcopied, matcopybuf, MEM_freeN, Material::nodetree, ntreeFreeLocalTree, NULL, and ID::py_instance.
Referenced by BKE_material_copybuf_copy().
Definition at line 1907 of file material.c.
References GPU_material_free(), Material::gpumaterial, id, Material::id, matcopied, matcopybuf, MEM_freeN, Material::nodetree, ntreeCopyTree_ex(), ntreeFreeEmbeddedTree(), and NULL.
Referenced by paste_material_exec().
Definition at line 2041 of file material.c.
References default_material_empty.
Referenced by workbench_object_material_get().
Definition at line 2061 of file material.c.
References default_material_gpencil.
Referenced by BKE_gpencil_material(), BKE_gpencil_material_settings(), BKE_gpencil_object_material_ensure_from_active_input_material(), and gpencil_draw_strokes().
Definition at line 2046 of file material.c.
References default_material_holdout.
Referenced by eevee_object_material_get().
Definition at line 2051 of file material.c.
References default_material_surface.
Referenced by ED_node_shader_default(), EEVEE_material_default_get(), and eevee_object_material_get().
Definition at line 2056 of file material.c.
References default_material_volume.
Referenced by ED_node_shader_default(), EEVEE_material_default_get(), eevee_object_material_get(), and EEVEE_volumes_cache_object_add().
Definition at line 2066 of file material.c.
Definition at line 1932 of file material.c.
References DEG_debug_print_eval(), depsgraph, GPU_material_free(), Material::gpumaterial, Material::id, material, and ID::name.
Definition at line 2090 of file material.c.
References default_materials, and material_free_data().
Referenced by WM_exit_ex().
Definition at line 2078 of file material.c.
References default_material_gpencil, default_material_holdout, default_material_surface, default_material_volume, default_materials, material_default_gpencil_init(), material_default_holdout_init(), material_default_surface_init(), material_default_volume_init(), and material_init_data().
Referenced by main().
void BKE_object_material_array_assign | ( | struct Main * | bmain, |
struct Object * | ob, | ||
struct Material *** | matar, | ||
int | totcol, | ||
bool | to_object_only | ||
) |
Definition at line 1173 of file material.c.
References Object::actcol, BKE_MAT_ASSIGN_OBJECT, BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), BKE_object_material_slot_remove(), Object::matbits, and Object::totcol.
Referenced by material_slot_copy_exec(), mesh_separate_arrays(), and mesh_separate_tagged().
Definition at line 311 of file material.c.
References curves, Object::data, ELEM, Curve::mat, bGPdata::mat, Mesh::mat, MetaBall::mat, PointCloud::mat, Volume::mat, NULL, OB_CURVES, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL, OB_MBALL, OB_MESH, OB_POINTCLOUD, OB_SURF, OB_VOLUME, and Object::type.
Referenced by BKE_object_duplicate(), BKE_object_material_get_p(), BKE_object_material_remap(), BKE_object_material_slot_find_index(), BKE_object_material_slot_remove(), blender::deg::DepsgraphNodeBuilder::build_object_data(), blender::deg::DepsgraphRelationBuilder::build_object_data(), make_local_exec(), material_slot_copy_exec(), mesh_separate_arrays(), mesh_separate_tagged(), object_material_assign(), preview_prepare_scene(), and similar_face_select_exec().
void BKE_object_material_assign | ( | Main * | bmain, |
Object * | ob, | ||
Material * | ma, | ||
short | act, | ||
int | assign_type | ||
) |
Definition at line 1047 of file material.c.
References object_material_assign().
Referenced by MeshImporter::assign_material_to_geom(), BKE_gpencil_object_material_ensure(), BKE_gpencil_object_material_ensure_from_brush(), BKE_gpencil_object_material_new(), BKE_object_material_array_assign(), BKE_object_material_slot_add(), drop_named_material_invoke(), get_or_create_current_material(), gpencil_bake_grease_pencil_animation_exec(), gpencil_material_to_vertex_exec(), make_links_data_exec(), material_drop_invoke(), single_mat_users(), and ui_drop_material_exec().
void BKE_object_material_assign_single_obdata | ( | struct Main * | bmain, |
struct Object * | ob, | ||
struct Material * | ma, | ||
short | act | ||
) |
Similar to BKE_object_material_assign with BKE_MAT_ASSIGN_OBDATA type, but does not scan whole Main for other usages of the same obdata. Only use in cases where you know that the object's obdata is only used by this one object.
Definition at line 1052 of file material.c.
References BKE_MAT_ASSIGN_OBDATA, and object_material_assign().
Referenced by utils::assign_materials(), and blender::io::alembic::utils::assign_materials().
int BKE_object_material_count_eval | ( | Object * | ob | ) |
Definition at line 746 of file material.c.
References BKE_id_material_len_p(), BLI_assert, Object::data, DEG_is_evaluated_object(), get_evaluated_object_data_with_materials(), NULL, OB_EMPTY, and Object::type.
Referenced by gpencil_material_pool_create(), and gpencil_object_cache_add().
Definition at line 1138 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BKE_object_materials_test(), Object::data, DEG_get_original_id(), ELEM, Material::id, id_us_min(), id_us_plus(), MEM_callocN, MEM_SAFE_FREE, and NULL.
Definition at line 687 of file material.c.
References BKE_object_material_get_p(), and NULL.
Referenced by InstanceWriter::add_material_bindings(), animdata_filter_ds_materials(), bake_object_check(), bc_has_animations(), BKE_gpencil_convert_mesh(), BKE_gpencil_material(), BKE_gpencil_material_find_index_by_name_prefix(), BKE_gpencil_material_settings(), BKE_gpencil_object_material_ensure_by_name(), BKE_gpencil_object_material_ensure_from_active_input_material(), BKE_gpencil_object_material_ensure_from_brush(), BKE_gpencil_object_material_from_brush_get(), BKE_gpencil_object_material_index_get(), BKE_gpencil_object_material_index_get_by_name(), BKE_object_material_remap_calc(), BKE_texpaint_slots_refresh_object(), buttons_context_path_material(), GeometryExporter::create_mesh_primitive_list(), ED_gpencil_material_enum_itemf(), ED_mesh_join_objects_exec(), ED_object_assign_active_image(), ED_object_get_active_image(), ED_object_ot_drop_named_material_tooltip(), ED_object_texture_paint_mode_enter_ex(), ED_paint_proj_mesh_data_check(), AnimationExporter::export_curve_animation(), eyedropper_add_material(), blender::bke::paint::canvas::get_active_slot(), blender::ed::sculpt_paint::canvas::get_active_slot(), BCAnimationCurve::get_animation_name(), get_automasking_strokes_list(), blender::ed::space_node::get_context_path_node_shader(), get_default_texture_layer_name_for_object(), get_or_create_current_material(), gpencil_bake_grease_pencil_animation_exec(), gpencil_check_same_material_color(), gpencil_fill_invoke(), gpencil_layer_duplicate_object_exec(), gpencil_material_find_index_by_name(), gpencil_material_lock_unsused_exec(), gpencil_materials_copy_to_object_exec(), gpencil_modifier_masking_panel_draw(), gpencil_strokes_copy_exec(), imapaint_pick_uv(), Freestyle::BlenderFileLoader::insertShapeNode(), join_mesh_single(), make_links_data_exec(), material_slot_assign_exec(), material_slot_de_select(), mesh_new_from_mball_object(), object_frame_has_keyframe(), object_select_all_by_material(), object_select_linked_exec(), ForEachMaterialFunctor< Functor >::operator()(), paint_sample_color(), proj_paint_state_mesh_eval_init(), psys_get_particle_on_path(), psys_thread_context_init(), shader_get_from_context(), single_mat_users(), texture_paint_add_texture_paint_slot_invoke(), and AnimationImporter::translate_Animations().
On evaluated objects the number of materials on an object and its data might go out of sync. This is because during evaluation materials can be added/removed on the object data.
For rendering or exporting we generally use the materials on the object data. However, some material indices might be overwritten by the object.
Definition at line 707 of file material.c.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BLI_assert, clamp_i(), data, DEG_is_evaluated_object(), get_evaluated_object_data_with_materials(), Object::mat, Object::matbits, material, materials_data, NULL, and Object::totcol.
Referenced by EEVEE_cryptomatte_cache_populate(), EEVEE_cryptomatte_object_curves_cache_populate(), EEVEE_cryptomatte_particle_hair_cache_populate(), eevee_object_material_get(), EEVEE_volumes_cache_object_add(), blender::io::obj::OBJMesh::get_object_material(), lineart_identify_mlooptri_feature_edges(), lineart_load_tri_task(), overlay_gpencil_draw_stroke_color_name(), OVERLAY_particle_cache_populate(), paint_object_is_rendered_transparent(), workbench_object_material_get(), and workbench_volume_material_color().
Definition at line 644 of file material.c.
References BKE_object_material_array_p(), BKE_object_material_len_p(), clamp_i(), Object::mat, Object::matbits, NULL, and Object::totcol.
Referenced by BKE_object_material_get(), and new_material_exec().
short* BKE_object_material_len_p | ( | Object * | ob | ) |
Definition at line 344 of file material.c.
References curves, Object::data, ELEM, NULL, OB_CURVES, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL, OB_MBALL, OB_MESH, OB_POINTCLOUD, OB_SURF, OB_VOLUME, Curve::totcol, bGPdata::totcol, Mesh::totcol, MetaBall::totcol, PointCloud::totcol, Volume::totcol, and Object::type.
Referenced by BKE_gpencil_merge_materials(), BKE_gpencil_merge_materials_table_get(), BKE_gpencil_object_material_index_get(), BKE_gpencil_object_material_index_get_by_name(), BKE_object_material_get_p(), BKE_object_material_remap(), BKE_object_material_slot_find_index(), BKE_object_material_slot_remove(), blender::deg::DepsgraphNodeBuilder::build_object_data(), blender::deg::DepsgraphRelationBuilder::build_object_data(), ED_gpencil_join_objects_exec(), eyedropper_add_material(), gpencil_active_material_poll(), gpencil_lock_layer_exec(), gpencil_material_hide_exec(), gpencil_material_isolate_exec(), gpencil_material_lock_all_exec(), gpencil_material_lock_unsused_exec(), gpencil_material_reveal_exec(), gpencil_material_to_vertex_exec(), gpencil_material_unlock_all_exec(), gpencil_materials_copy_to_object_poll(), gpencil_stroke_merge_material_exec(), material_slot_copy_exec(), mesh_separate_arrays(), mesh_separate_tagged(), and object_material_assign().
Definition at line 1060 of file material.c.
References BKE_curve_material_remap(), BKE_gpencil_material_remap(), BKE_mesh_material_remap(), BKE_object_material_array_p(), BKE_object_material_len_p(), BLI_array_permute, BLI_assert, Object::data, ELEM, Object::mat, Object::matbits, NULL, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL, OB_MESH, OB_SURF, Object::totcol, and Object::type.
Referenced by material_slot_move_exec().
void BKE_object_material_remap_calc | ( | struct Object * | ob_dst, |
struct Object * | ob_src, | ||
short * | remap_src_to_dst | ||
) |
Calculate a material remapping from ob_src to ob_dst.
remap_src_to_dst | An array the size of ob_src->totcol where index values are filled in which map to ob_dst materials. |
Definition at line 1090 of file material.c.
References BKE_object_material_get(), BLI_ghash_free(), BLI_ghash_lookup_p(), BLI_ghash_ptr_new_ex(), BLI_ghash_reinsert(), NULL, POINTER_AS_INT, POINTER_FROM_INT, and Object::totcol.
Referenced by BMD_mesh_intersection().
Definition at line 819 of file material.c.
References Object::actcol, DEG_id_tag_update(), DEG_relations_tag_update(), Object::id, ID_RECALC_COPY_ON_WRITE, ID_RECALC_GEOMETRY, id_us_min(), Object::mat, Object::matbits, MEM_callocN, MEM_freeN, NULL, and Object::totcol.
Referenced by BKE_object_materials_test(), BKE_objects_materials_test_all(), and mesh_separate_material_assign_mat_nr().
Definition at line 1232 of file material.c.
References Object::actcol, BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), MAXMAT, NULL, and Object::totcol.
Referenced by BKE_gpencil_object_material_ensure(), BKE_gpencil_object_material_ensure_from_brush(), BKE_gpencil_object_material_new(), gpencil_bake_grease_pencil_animation_exec(), gpencil_material_to_vertex_exec(), material_slot_add_exec(), and new_material_exec().
Definition at line 1205 of file material.c.
References Freestyle::a, BKE_object_material_array_p(), BKE_object_material_len_p(), and NULL.
Referenced by gpencil_init_colors().
Definition at line 1248 of file material.c.
References Freestyle::a, Object::actcol, BKE_displist_free(), BKE_gpencil_material_index_reassign(), BKE_object_material_array_p(), BKE_object_material_len_p(), CLOG_ERROR, Object_Runtime::curve_cache, Object::data, CurveCache::disp, ELEM, ListBase::first, Material::id, id_us_min(), LOG, material_data_index_remove_id(), MEM_freeN, NULL, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL, OB_MESH, OB_SURF, Main::objects, Object::runtime, Object::totcol, and Object::type.
Referenced by BKE_gpencil_convert_curve(), BKE_object_material_array_assign(), gpencil_stroke_separate_exec(), material_slot_remove_exec(), material_slot_remove_unused_exec(), and object_convert_exec().
Definition at line 452 of file material.c.
References BKE_curve_material_index_used(), BKE_gpencil_material_index_used(), BKE_mesh_material_index_used(), BKE_object_supports_material_slots(), GS, ID_CU_LEGACY, ID_GD, ID_MB, ID_ME, LISTBASE_FOREACH, ID::name, NULL, OB_DATA_SUPPORT_ID, and Object::particlesystem.
Referenced by BKE_gpencil_convert_curve(), gpencil_stroke_separate_exec(), material_slot_remove_unused_exec(), and object_convert_exec().
Definition at line 864 of file material.c.
References BKE_id_material_len_p(), BKE_id_material_resize(), BKE_object_material_resize(), id, Object::id, LIB_TAG_MISSING, NULL, ID::tag, and Object::totcol.
Referenced by BKE_mesh_assign_object(), BKE_object_material_from_eval_data(), ED_object_add_type_with_obdata(), Freestyle::BlenderStrokeRenderer::GenerateStrokeMesh(), libblock_remap_data_postprocess_obdata_relink(), loose_data_instantiate_obdata_process(), make_links_data_exec(), object_blend_read_lib(), object_convert_exec(), object_material_assign(), and placeholders_ensure_valid().
Definition at line 886 of file material.c.
References BKE_id_material_len_p(), BKE_main_lock(), BKE_main_unlock(), BKE_object_material_resize(), Object::data, ListBase::first, Object::id, ID::next, NULL, and Main::objects.
Referenced by BKE_id_material_append(), BKE_id_material_assign(), BKE_id_material_clear(), BKE_id_material_pop(), ED_mesh_join_objects_exec(), and object_material_assign().
Definition at line 1599 of file material.c.
References Material::nodetree, ntree_foreach_texnode_recursive(), NULL, PAINT_SLOT_COLOR_ATTRIBUTE, PAINT_SLOT_IMAGE, FindTexPaintNodeData::r_node, FindTexPaintNodeData::slot, texpaint_slot_node_find_cb(), and Material::texpaintslot.
Definition at line 1501 of file material.c.
References FillTexPaintSlotsData::active_node, count, count_texture_nodes_recursive(), DEG_id_tag_update(), fill_texpaint_slots_recursive(), Material::id, ID_RECALC_COPY_ON_WRITE, ID_RECALC_SHADING, IMAGEPAINT_MODE_IMAGE, ToolSettings::imapaint, FillTexPaintSlotsData::ma, material_paint_slot_filter(), MEM_callocN, MEM_SAFE_FREE, ImagePaintSettings::mode, nodeGetActivePaintCanvas(), Material::nodetree, NULL, FillTexPaintSlotsData::ob, Material::paint_active_slot, Material::paint_clone_slot, scene, Material::texpaintslot, Scene::toolsettings, and Material::tot_slots.
Referenced by BKE_texpaint_slots_refresh_object(), ED_paint_proj_mesh_data_check(), paint_sample_color(), and proj_paint_add_slot().
Definition at line 1564 of file material.c.
References BKE_object_material_get(), BKE_texpaint_slot_refresh_cache(), FillTexPaintSlotsData::ma, FillTexPaintSlotsData::ob, scene, and Object::totcol.
Referenced by ED_editors_init_for_undo(), ED_object_texture_paint_mode_enter_ex(), scene_changed(), and sculpt_update_object().
Definition at line 1400 of file material.c.
Referenced by count_texture_nodes_recursive().
|
static |
Definition at line 1406 of file material.c.
References count_texture_nodes_cb(), and ntree_foreach_texnode_recursive().
Referenced by BKE_texpaint_slot_refresh_cache().
Definition at line 1422 of file material.c.
References FillTexPaintSlotsData::active_node, TexPaintSlot::attribute_name, BKE_id_attributes_color_find(), Object::data, Mesh::id, TexPaintSlot::ima, TexPaintSlot::image_user, FillTexPaintSlotsData::index, TexPaintSlot::interp, FillTexPaintSlotsData::ma, mesh, NodeShaderAttribute::name, node, nodetree_uv_node_recursive(), NULL, FillTexPaintSlotsData::ob, Material::paint_active_slot, SH_NODE_ATTRIBUTE, SH_NODE_TEX_IMAGE, SHD_ATTRIBUTE_GEOMETRY, FillTexPaintSlotsData::slot_len, bNode::storage, Material::texpaintslot, NodeShaderAttribute::type, NodeShaderUVMap::uv_map, TexPaintSlot::uvname, and TexPaintSlot::valid.
Referenced by fill_texpaint_slots_recursive().
|
static |
Definition at line 1480 of file material.c.
References FillTexPaintSlotsData::active_node, fill_texpaint_slots_cb(), FillTexPaintSlotsData::ma, ntree_foreach_texnode_recursive(), FillTexPaintSlotsData::ob, and FillTexPaintSlotsData::slot_len.
Referenced by BKE_texpaint_slot_refresh_cache().
Definition at line 693 of file material.c.
References BKE_object_get_editmesh_eval_final(), data, Object::data, Mesh::edit_mesh, Mesh::id, mesh, Object::mode, OB_MESH, OB_MODE_EDIT, and Object::type.
Referenced by BKE_object_material_count_eval(), and BKE_object_material_get_eval().
|
static |
Definition at line 195 of file material.c.
References Material::adt, BKE_animdata_blend_read_data(), BKE_previewimg_blend_read(), BLI_listbase_clear(), BLO_read_data_address, Material::gp_style, Material::gpumaterial, NULL, Material::preview, and Material::texpaintslot.
|
static |
Definition at line 228 of file material.c.
References BLO_expand, Material::gp_style, MaterialGPencilStyle::ima, and MaterialGPencilStyle::sima.
|
static |
Definition at line 211 of file material.c.
References BLO_read_id_address, Material::gp_style, Material::id, MaterialGPencilStyle::ima, ID::lib, NULL, and MaterialGPencilStyle::sima.
|
static |
Definition at line 165 of file material.c.
References Material::adt, BKE_animdata_blend_write(), BKE_id_blend_write(), BKE_previewimg_blend_write(), BLI_listbase_clear(), BLO_write_id_struct, BLO_write_struct, Material::gp_style, Material::gpumaterial, Material::id, Material::nodetree, ntreeBlendWrite(), NULL, Material::preview, and Material::texpaintslot.
|
static |
Definition at line 86 of file material.c.
References BKE_id_copy_ex(), BKE_previewimg_id_copy(), BLI_listbase_clear(), Material::gp_style, Material::gpumaterial, Material::id, LIB_ID_COPY_NO_PREVIEW, LIB_ID_CREATE_LOCAL, LIB_ID_CREATE_NO_ALLOCATE, MEM_dupallocN, Material::nodetree, ntreeLocalize, NULL, Material::preview, and Material::texpaintslot.
Definition at line 484 of file material.c.
References BKE_curve_material_index_clear(), BKE_mesh_material_index_clear(), BLI_assert, GS, id, ID_CU_LEGACY, ID_CV, ID_MB, ID_ME, ID_PT, ID_VO, ID::name, and OB_DATA_SUPPORT_ID.
Referenced by BKE_id_material_clear().
Definition at line 429 of file material.c.
References BKE_curve_material_index_remove(), BKE_mesh_material_index_remove(), BLI_assert, GS, id, ID_CU_LEGACY, ID_CV, ID_MB, ID_ME, ID_PT, ID_VO, ID::name, and OB_DATA_SUPPORT_ID.
Referenced by BKE_id_material_pop(), and BKE_object_material_slot_remove().
Definition at line 1956 of file material.c.
References add_v3_fl(), BKE_gpencil_material_attr_init(), Material::gp_style, Material::id, ID::name, and MaterialGPencilStyle::stroke_rgba.
Referenced by BKE_materials_init().
Definition at line 2016 of file material.c.
References Material::id, bNodeTreeType::idname, bNode::locx, bNode::locy, ID::name, nodeAddLink(), nodeAddStaticNode(), nodeFindSocket(), nodeSetActive(), Material::nodetree, ntree, ntreeAddTree(), ntreeType_Shader, NULL, output, SH_NODE_HOLDOUT, SH_NODE_OUTPUT_MATERIAL, SOCK_IN, SOCK_OUT, and Material::use_nodes.
Referenced by BKE_materials_init().
Definition at line 1963 of file material.c.
References copy_v3_v3(), bNodeSocket::default_value, Material::id, bNodeTreeType::idname, bNode::locx, bNode::locy, ID::name, nodeAddLink(), nodeAddStaticNode(), nodeFindSocket(), nodeSetActive(), Material::nodetree, ntree, ntreeAddTree(), ntreeType_Shader, NULL, output, Material::r, SH_NODE_BSDF_PRINCIPLED, SH_NODE_OUTPUT_MATERIAL, SOCK_IN, SOCK_OUT, and Material::use_nodes.
Referenced by BKE_materials_init().
Definition at line 1991 of file material.c.
References Material::id, bNodeTreeType::idname, bNode::locx, bNode::locy, ID::name, nodeAddLink(), nodeAddStaticNode(), nodeFindSocket(), nodeSetActive(), Material::nodetree, ntree, ntreeAddTree(), ntreeType_Shader, NULL, output, SH_NODE_OUTPUT_MATERIAL, SH_NODE_VOLUME_PRINCIPLED, SOCK_IN, SOCK_OUT, and Material::use_nodes.
Referenced by BKE_materials_init().
|
static |
Definition at line 150 of file material.c.
References BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL, BKE_LIB_FOREACHID_PROCESS_IDSUPER, BKE_library_foreach_ID_embedded(), data, Material::gp_style, IDWALK_CB_NOP, IDWALK_CB_USER, TexPaintSlot::ima, MaterialGPencilStyle::ima, material, Material::nodetree, NULL, MaterialGPencilStyle::sima, and Material::texpaintslot.
Definition at line 128 of file material.c.
References BKE_icon_id_delete(), BKE_previewimg_free(), Material::gp_style, GPU_material_free(), Material::gpumaterial, material, MEM_freeN, MEM_SAFE_FREE, Material::nodetree, ntreeFreeEmbeddedTree(), NULL, Material::preview, and Material::texpaintslot.
Referenced by BKE_materials_exit().
Definition at line 77 of file material.c.
References BLI_assert, DNA_struct_default_get, material, MEMCMP_STRUCT_AFTER_IS_ZERO, and MEMCPY_STRUCT_AFTER.
Referenced by BKE_materials_init().
|
static |
Check which type of paint slots should be filled for the given object.
Definition at line 1492 of file material.c.
References Object::mode, FillTexPaintSlotsData::ob, OB_MODE_SCULPT, PAINT_SLOT_COLOR_ATTRIBUTE, and PAINT_SLOT_IMAGE.
Referenced by BKE_texpaint_slot_refresh_cache().
Definition at line 1344 of file material.c.
References bNodeLink::fromnode, bNodeSocket::link, bNodeType::nclass, bNodeSocket::next, node, NODE_CLASS_INPUT, NULL, SH_NODE_UVMAP, bNodeType::type, and bNode::typeinfo.
Referenced by fill_texpaint_slots_cb().
|
static |
Definition at line 1370 of file material.c.
References callback, ELEM, LISTBASE_FOREACH, node, NODE_CLASS_TEXTURE, NODE_CUSTOM_GROUP, NODE_GROUP, bNodeTree::nodes, PAINT_SLOT_COLOR_ATTRIBUTE, PAINT_SLOT_IMAGE, SH_NODE_ATTRIBUTE, and SH_NODE_TEX_IMAGE.
Referenced by BKE_texpaint_slot_material_find_node(), count_texture_nodes_recursive(), and fill_texpaint_slots_recursive().
|
static |
Definition at line 952 of file material.c.
References Object::actcol, BKE_MAT_ASSIGN_EXISTING, BKE_MAT_ASSIGN_OBDATA, BKE_MAT_ASSIGN_OBJECT, BKE_MAT_ASSIGN_USERPREF, BKE_object_material_array_p(), BKE_object_material_len_p(), BKE_object_materials_test(), BKE_objects_materials_test_all(), Object::data, Material::id, id_us_min(), id_us_plus(), Object::mat, Object::matbits, MAXMAT, MEM_callocN, MEM_freeN, MEM_recallocN_id, NULL, Object::totcol, and USER_MAT_ON_OB.
Referenced by BKE_object_material_assign(), and BKE_object_material_assign_single_obdata().
r_col | current value. |
col | new value. |
fac | Zero for is no change. |
Definition at line 1611 of file material.c.
References col, fabsf, hsv_to_rgb(), MA_RAMP_ADD, MA_RAMP_BLEND, MA_RAMP_BURN, MA_RAMP_COLOR, MA_RAMP_DARK, MA_RAMP_DIFF, MA_RAMP_DIV, MA_RAMP_DODGE, MA_RAMP_HUE, MA_RAMP_LIGHT, MA_RAMP_LINEAR, MA_RAMP_MULT, MA_RAMP_OVERLAY, MA_RAMP_SAT, MA_RAMP_SCREEN, MA_RAMP_SOFT, MA_RAMP_SUB, MA_RAMP_VAL, min_ff(), rgb_to_hsv(), and type.
Referenced by blender::nodes::node_shader_mix_rgb_cc::MixRGBFunction::call(), colorfn(), do_proc(), and Freestyle_blendRamp().
Definition at line 1577 of file material.c.
References TexPaintSlot::attribute_name, if(), TexPaintSlot::ima, NodeShaderAttribute::name, node, FindTexPaintNodeData::r_node, SH_NODE_ATTRIBUTE, SH_NODE_TEX_IMAGE, FindTexPaintNodeData::slot, and STREQLEN.
Referenced by BKE_texpaint_slot_material_find_node().
|
static |
Definition at line 1943 of file material.c.
Referenced by BKE_material_default_empty().
|
static |
Definition at line 1947 of file material.c.
Referenced by BKE_material_default_gpencil(), and BKE_materials_init().
|
static |
Definition at line 1944 of file material.c.
Referenced by BKE_material_default_holdout(), and BKE_materials_init().
|
static |
Definition at line 1945 of file material.c.
Referenced by BKE_material_default_surface(), and BKE_materials_init().
|
static |
Definition at line 1946 of file material.c.
Referenced by BKE_material_default_volume(), and BKE_materials_init().
|
static |
Definition at line 1949 of file material.c.
Referenced by BKE_material_defaults_free_gpu(), BKE_materials_exit(), and BKE_materials_init().
IDTypeInfo IDType_ID_MA |
Definition at line 240 of file material.c.
|
static |
Definition at line 75 of file material.c.
Referenced by BKE_object_material_slot_remove().
|
static |
Definition at line 1869 of file material.c.
Referenced by BKE_material_copybuf_clear(), BKE_material_copybuf_copy(), BKE_material_copybuf_free(), and BKE_material_copybuf_paste().
|
static |
copy/paste buffer, if we had a proper py api that would be better
Definition at line 1868 of file material.c.
Referenced by BKE_material_copybuf_clear(), BKE_material_copybuf_copy(), BKE_material_copybuf_free(), and BKE_material_copybuf_paste().