|
Blender V4.3
|
#include <cmath>#include <cstddef>#include <cstring>#include <optional>#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_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_volume_types.h"#include "BLI_array_utils.h"#include "BLI_listbase.h"#include "BLI_math_color.h"#include "BLI_math_vector.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "BLT_translation.hh"#include "BKE_anim_data.hh"#include "BKE_attribute.hh"#include "BKE_brush.hh"#include "BKE_curve.hh"#include "BKE_displist.h"#include "BKE_editmesh.hh"#include "BKE_gpencil_legacy.h"#include "BKE_grease_pencil.hh"#include "BKE_icons.h"#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.h"#include "BKE_mesh.hh"#include "BKE_node.hh"#include "BKE_node_runtime.hh"#include "BKE_object.hh"#include "BKE_object_types.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 | FillTexPaintSlotsData |
| struct | FindTexPaintNodeData |
Macros | |
| #define | DNA_DEPRECATED_ALLOW |
Typedefs | |
| using | ForEachTexNodeCallback = bool (*)(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 | 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 19 of file blenkernel/intern/material.cc.
| using ForEachTexNodeCallback = bool (*)(bNode *node, void *userdata) |
Definition at line 1452 of file blenkernel/intern/material.cc.
| enum ePaintSlotFilter |
Bitwise filter for updating paint slots.
| Enumerator | |
|---|---|
| PAINT_SLOT_IMAGE | |
| PAINT_SLOT_COLOR_ATTRIBUTE | |
Definition at line 1446 of file blenkernel/intern/material.cc.
Definition at line 880 of file blenkernel/intern/material.cc.
References BKE_material_default_gpencil(), and BKE_object_material_get().
Referenced by blender::ed::greasepencil::grease_pencil_material_reveal_exec(), and blender::ed::greasepencil::material_isolate_exec().
Definition at line 320 of file blenkernel/intern/material.cc.
References BKE_gpencil_material_attr_init(), and BKE_material_add().
Referenced by BKE_grease_pencil_object_material_new(), BLO_update_defaults_startup_blend(), and new_material_exec().
| void BKE_gpencil_material_attr_init | ( | Material * | ma | ) |
Definition at line 270 of file blenkernel/intern/material.cc.
References ARRAY_SET_ITEMS, MaterialGPencilStyle::fill_rgba, MaterialGPencilStyle::flag, GP_MATERIAL_STROKE_SHOW, Material::gp_style, MEM_callocN, MaterialGPencilStyle::mix_factor, MaterialGPencilStyle::mix_rgba, MaterialGPencilStyle::stroke_rgba, MaterialGPencilStyle::texture_offset, MaterialGPencilStyle::texture_pixsize, and MaterialGPencilStyle::texture_scale.
Referenced by BKE_gpencil_material_add(), BKE_gpencil_material_settings(), BKE_grease_pencil_object_material_ensure_active(), and material_default_gpencil_init().
| MaterialGPencilStyle * BKE_gpencil_material_settings | ( | Object * | ob, |
| short | act ) |
Definition at line 890 of file blenkernel/intern/material.cc.
References BKE_gpencil_material_attr_init(), BKE_material_default_gpencil(), BKE_object_material_get(), and Material::gp_style.
Referenced by blender::draw::overlay::GreasePencil::draw_grease_pencil(), ED_gpencil_stroke_material_editable(), gpencil_material_pool_create(), gpencil_object_cache_add(), grease_pencil_object_cache_populate(), blender::ed::greasepencil::grease_pencil_texture_gradient_exec(), blender::ed::greasepencil::material_isolate_exec(), and OVERLAY_outline_grease_pencil().
Definition at line 597 of file blenkernel/intern/material.cc.
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_SYNC_TO_EVAL, id_us_plus(), and MEM_freeN().
Definition at line 407 of file blenkernel/intern/material.cc.
References BLI_assert, GS, ID_CU_LEGACY, ID_CV, ID_GD_LEGACY, ID_GP, ID_MB, ID_ME, ID_PT, ID_VO, and OB_DATA_SUPPORT_ID.
Referenced by blender::nodes::node_geo_set_material_cc::assign_material_to_id_geometry(), 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 998 of file blenkernel/intern/material.cc.
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, and MEM_freeN().
Definition at line 659 of file blenkernel/intern/material.cc.
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_SYNC_TO_EVAL, id_us_min(), material_data_index_clear_id(), and MEM_freeN().
Referenced by mesh_separate_material_assign_mat_nr().
Definition at line 804 of file blenkernel/intern/material.cc.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BLI_assert, BLI_assert_unreachable, ELEM, material, and MEM_reallocN.
Referenced by blender::nodes::node_geo_set_material_cc::assign_material_to_id_geometry(), BKE_id_material_eval_ensure_default_slot(), blender::geometry::execute_realize_mesh_tasks(), and blender::nodes::node_geo_set_material_cc::node_geo_exec().
| void BKE_id_material_eval_ensure_default_slot | ( | struct ID * | id | ) |
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 831 of file blenkernel/intern/material.cc.
References BKE_id_material_eval_assign(), and BKE_id_material_len_p().
Referenced by blender::nodes::node_geo_set_material_cc::assign_material_to_id_geometry(), blender::nodes::node_geo_mesh_primitive_circle_cc::create_circle_mesh(), blender::nodes::node_geo_mesh_primitive_ico_sphere_cc::create_ico_sphere_mesh(), blender::nodes::node_geo_grid_to_mesh_cc::node_geo_exec(), blender::nodes::node_geo_mesh_primitive_cone_cc::node_geo_exec(), blender::nodes::node_geo_mesh_primitive_cube_cc::node_geo_exec(), blender::nodes::node_geo_mesh_primitive_cylinder_cc::node_geo_exec(), blender::nodes::node_geo_mesh_primitive_grid_cc::node_geo_exec(), blender::nodes::node_geo_mesh_primitive_line_cc::node_geo_exec(), and blender::nodes::node_geo_mesh_primitive_uv_sphere_cc::node_geo_exec().
| short * BKE_id_material_len_p | ( | ID * | id | ) |
Definition at line 435 of file blenkernel/intern/material.cc.
References BLI_assert, GS, ID_CU_LEGACY, ID_CV, ID_GD_LEGACY, ID_GP, ID_MB, ID_ME, ID_PT, ID_VO, and OB_DATA_SUPPORT_ID.
Referenced by blender::ed::object::add_type_with_obdata(), blender::nodes::node_geo_set_material_cc::assign_material_to_id_geometry(), 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(), and mesh_separate_material_assign_mat_nr().
Definition at line 621 of file blenkernel/intern/material.cc.
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_SYNC_TO_EVAL, id_us_min(), material_data_index_remove_id(), MEM_freeN(), MEM_reallocN, and ret.
Definition at line 566 of file blenkernel/intern/material.cc.
References BKE_id_material_array_p(), BKE_id_material_len_p(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_SYNC_TO_EVAL, id_us_min(), MEM_freeN(), and MEM_recallocN.
Referenced by BKE_object_materials_test(), and mesh_separate_material_assign_mat_nr().
Definition at line 545 of file blenkernel/intern/material.cc.
References BKE_id_material_array_p(), BKE_id_material_len_p(), DEG_id_tag_update(), DEG_relations_tag_update(), ID_RECALC_SYNC_TO_EVAL, id_us_plus(), and MEM_dupallocN.
Referenced by BKE_mesh_to_pointcloud(), BKE_pointcloud_to_mesh(), and blender::bke::greasepencil::convert::legacy_gpencil_to_grease_pencil().
Definition at line 311 of file blenkernel/intern/material.cc.
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(), blender::animrig::tests::KeyframingTest::SetUp(), and DocumentImporter::writeMaterial().
| Material * BKE_material_default_empty | ( | void | ) |
Definition at line 2075 of file blenkernel/intern/material.cc.
References default_material_empty.
Referenced by blender::workbench::Instance::get_material().
| Material * BKE_material_default_gpencil | ( | void | ) |
Definition at line 2095 of file blenkernel/intern/material.cc.
References default_material_gpencil.
Referenced by BKE_gpencil_material(), BKE_gpencil_material_settings(), and BKE_grease_pencil_object_material_ensure_from_active_input_material().
| Material * BKE_material_default_holdout | ( | void | ) |
Definition at line 2080 of file blenkernel/intern/material.cc.
References default_material_holdout.
| Material * BKE_material_default_surface | ( | void | ) |
Definition at line 2085 of file blenkernel/intern/material.cc.
References default_material_surface.
Referenced by ED_node_shader_default(), blender::eevee::ShaderModule::material_default_shader_get(), and blender::eevee::ShaderModule::material_shader_get().
| Material * BKE_material_default_volume | ( | void | ) |
Definition at line 2090 of file blenkernel/intern/material.cc.
References default_material_volume.
Referenced by ED_node_shader_default(), blender::eevee::ShaderModule::material_default_shader_get(), and blender::eevee::ShaderModule::material_shader_get().
| void BKE_material_defaults_free_gpu | ( | void | ) |
Definition at line 2100 of file blenkernel/intern/material.cc.
| void BKE_material_eval | ( | Depsgraph * | depsgraph, |
| Material * | material ) |
Definition at line 1965 of file blenkernel/intern/material.cc.
References DEG_debug_print_eval(), depsgraph, and GPU_material_free().
| void BKE_material_make_node_previews_dirty | ( | Material * | ma | ) |
Definition at line 304 of file blenkernel/intern/material.cc.
References Material::nodetree, and nodetree_mark_previews_dirty_reccursive().
Referenced by ED_render_engine_changed().
| void BKE_materials_exit | ( | void | ) |
Definition at line 2124 of file blenkernel/intern/material.cc.
References default_materials, and material_free_data().
Referenced by WM_exit_ex().
| void BKE_materials_init | ( | void | ) |
Definition at line 2112 of file blenkernel/intern/material.cc.
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 1265 of file blenkernel/intern/material.cc.
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 ED_grease_pencil_join_objects_exec(), blender::ed::greasepencil::grease_pencil_separate_layer(), blender::ed::greasepencil::grease_pencil_separate_material(), blender::ed::greasepencil::grease_pencil_separate_selected(), material_slot_copy_exec(), mesh_separate_arrays(), and mesh_separate_tagged().
Definition at line 333 of file blenkernel/intern/material.cc.
References Object::data, ELEM, bGPdata::mat, Curve::mat, MetaBall::mat, PointCloud::mat, GreasePencil::material_array, OB_CURVES, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL, 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(), blender::ed::greasepencil::grease_pencil_separate_layer(), blender::ed::greasepencil::grease_pencil_separate_material(), blender::ed::greasepencil::grease_pencil_separate_selected(), blender::ed::object::make_local_exec(), material_slot_copy_exec(), mesh_separate_arrays(), mesh_separate_tagged(), object_material_assign(), blender::ed::space_node::preview_prepare_scene(), 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 1142 of file blenkernel/intern/material.cc.
References object_material_assign().
Referenced by MeshImporter::assign_material_to_geom(), blender::ed::greasepencil::bake_grease_pencil_animation_exec(), BKE_grease_pencil_object_material_ensure_from_brush(), BKE_grease_pencil_object_material_new(), BKE_object_material_array_assign(), BKE_object_material_ensure(), BKE_object_material_slot_add(), blender::ed::object::drop_named_material_invoke(), get_or_create_current_material(), blender::ed::object::make_links_data_exec(), blender::ed::outliner::material_drop_invoke(), blender::animrig::tests::KeyframingTest::SetUp(), blender::ed::object::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 1147 of file blenkernel/intern/material.cc.
References BKE_MAT_ASSIGN_OBDATA, and object_material_assign().
Referenced by blender::io::alembic::utils::assign_materials(), and utils::assign_materials().
Definition at line 792 of file blenkernel/intern/material.cc.
References BKE_id_material_len_p(), BLI_assert, Object::data, DEG_is_evaluated_object(), get_evaluated_object_data_with_materials(), OB_EMPTY, and Object::type.
Definition at line 866 of file blenkernel/intern/material.cc.
References BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), BKE_object_material_index_get(), BKE_object_material_slot_add(), and Object::totcol.
Referenced by blender::ed::greasepencil::clipboard_materials_remap(), and blender::ed::greasepencil::grease_pencil_material_copy_to_object_exec().
Definition at line 1230 of file blenkernel/intern/material.cc.
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(), and MEM_SAFE_FREE.
Definition at line 725 of file blenkernel/intern/material.cc.
References BKE_object_material_get_p(), Material::gp_style, OB_GREASE_PENCIL, and Object::type.
Referenced by InstanceWriter::add_material_bindings(), animdata_filter_ds_materials(), blender::io::usd::USDCurvesWriter::assign_materials(), blender::ed::greasepencil::bake_grease_pencil_animation_exec(), blender::ed::object::bake_object_check(), bc_has_animations(), BKE_gpencil_material(), BKE_gpencil_material_find_index_by_name_prefix(), BKE_gpencil_material_settings(), BKE_grease_pencil_object_material_ensure_by_name(), BKE_grease_pencil_object_material_ensure_from_active_input_material(), BKE_grease_pencil_object_material_ensure_from_brush(), BKE_grease_pencil_object_material_from_brush_get(), BKE_grease_pencil_object_material_index_get_by_name(), BKE_object_material_index_get(), BKE_object_material_index_get_with_hint(), BKE_object_material_remap_calc(), BKE_texpaint_slots_refresh_object(), buttons_context_path_material(), GeometryExporter::create_mesh_primitive_list(), blender::ed::greasepencil::image_render::draw_grease_pencil_strokes(), blender::ed::object::drop_named_material_tooltip(), ED_mesh_join_objects_exec(), ED_object_assign_active_image(), ED_object_get_active_image(), ED_object_texture_paint_mode_enter_ex(), ED_paint_proj_mesh_data_check(), AnimationExporter::export_curve_animation(), blender::ui::greasepencil::eyedropper_add_material(), eyedropper_cryptomatte_sample_view3d_fl(), blender::bke::paint::canvas::get_active_slot(), blender::ed::sculpt_paint::canvas::get_active_slot(), BCAnimationCurve::get_animation_name(), blender::ed::greasepencil::get_boundary_bounds(), blender::ed::space_node::get_context_path_node_shader(), get_default_texture_layer_name_for_object(), blender::ed::greasepencil::get_editable_material_indices(), blender::ed::greasepencil::get_fill_material_indices(), blender::modifier::greasepencil::get_grease_pencil_material_passes(), blender::ed::greasepencil::get_hidden_material_indices(), get_or_create_current_material(), blender::ed::greasepencil::get_visible_boundary_strokes(), blender::io::grease_pencil::get_visible_strokes(), blender::ed::sculpt_paint::grease_pencil_fill_invoke(), blender::ed::greasepencil::grease_pencil_material_copy_to_object_exec(), blender::ed::greasepencil::grease_pencil_material_hide_exec(), blender::ed::greasepencil::grease_pencil_material_lock_all_exec(), blender::ed::greasepencil::grease_pencil_material_lock_unselected_exec(), blender::ed::greasepencil::grease_pencil_material_lock_unused_exec(), blender::ed::greasepencil::grease_pencil_material_unlock_all_exec(), imapaint_pick_uv(), blender::io::obj::OBJImportTest::import_and_check(), CryptomatteSession::init(), Freestyle::BlenderFileLoader::insertShapeNode(), join_mesh_single(), lineart_load_tri_task(), blender::ed::object::make_links_data_exec(), blender::ed::greasepencil::material_enum_itemf(), material_slot_assign_exec(), material_slot_de_select(), blender::modify_fill_color(), blender::modify_fill_color(), blender::modify_stroke_color(), blender::modify_stroke_color(), blender::ed::object::object_grease_pencil_add_exec(), blender::ed::object::object_select_all_by_material(), blender::ed::object::object_select_linked_exec(), ForEachMaterialFunctor< Functor >::operator()(), paint_sample_color(), proj_paint_state_mesh_eval_init(), psys_cache_paths(), psys_get_particle_on_path(), psys_thread_context_init(), shader_get_from_context(), blender::ed::object::single_mat_users(), texture_paint_add_texture_paint_slot_invoke(), AnimationImporter::translate_Animations(), and versioning_eevee_shadow_settings().
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 753 of file blenkernel/intern/material.cc.
References BKE_id_material_array_p(), BKE_id_material_len_p(), BLI_assert, clamp_i(), DEG_is_evaluated_object(), get_evaluated_object_data_with_materials(), Object::mat, Object::matbits, material, materials_data, and Object::totcol.
Referenced by ED_object_get_active_image(), blender::workbench::Instance::get_material(), lineart_identify_corner_tri_feature_edges(), blender::draw::overlay::Particles::object_sync(), blender::io::obj::OBJMesh::OBJMesh(), overlay_grease_pencil_draw_stroke_color_name(), OVERLAY_particle_cache_populate(), paint_object_is_rendered_transparent(), blender::io::hydra::CurvesData::write_materials(), blender::io::hydra::MeshData::write_materials(), and blender::io::hydra::VolumeData::write_materials().
Definition at line 682 of file blenkernel/intern/material.cc.
References BKE_object_material_array_p(), BKE_object_material_len_p(), clamp_i(), Object::mat, Object::matbits, and Object::totcol.
Referenced by BKE_object_material_get(), and new_material_exec().
Definition at line 842 of file blenkernel/intern/material.cc.
References BKE_object_material_get(), and BKE_object_material_len_p().
Referenced by blender::ed::greasepencil::bake_grease_pencil_animation_exec(), bake_strokes(), BKE_grease_pencil_object_material_ensure_from_brush(), BKE_object_material_ensure(), BKE_object_material_index_get_with_hint(), blender::generate_strokes(), blender::modifier::greasepencil::get_filtered_stroke_mask(), blender::ed::sculpt_paint::grease_pencil_fill_init(), blender::ed::greasepencil::grease_pencil_primitive_invoke(), blender::ed::greasepencil::grease_pencil_stroke_material_set_exec(), blender::modify_drawing(), blender::ed::sculpt_paint::greasepencil::PaintOperation::on_stroke_begin(), and blender::ed::sculpt_paint::greasepencil::PaintOperation::on_stroke_done().
A version of BKE_object_material_index_get that takes an index to test first.
| hint_index | When this index is in a valid range, test it first. Useful when an active-index is preferred but may not match the material. |
Definition at line 855 of file blenkernel/intern/material.cc.
References BKE_object_material_get(), BKE_object_material_index_get(), and BKE_object_material_len_p().
Referenced by material_slot_de_select().
| short * BKE_object_material_len_p | ( | Object * | ob | ) |
Definition at line 370 of file blenkernel/intern/material.cc.
References Object::data, ELEM, GreasePencil::material_array_num, OB_CURVES, OB_CURVES_LEGACY, OB_FONT, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL, OB_MBALL, OB_MESH, OB_POINTCLOUD, OB_SURF, OB_VOLUME, bGPdata::totcol, Curve::totcol, MetaBall::totcol, PointCloud::totcol, and Object::type.
Referenced by blender::ed::greasepencil::active_grease_pencil_material_poll(), BKE_grease_pencil_object_material_index_get_by_name(), BKE_object_material_get_p(), BKE_object_material_index_get(), BKE_object_material_index_get_with_hint(), 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(), blender::ui::greasepencil::eyedropper_add_material(), blender::modifier::greasepencil::get_grease_pencil_material_passes(), blender::ed::greasepencil::grease_pencil_separate_layer(), blender::ed::greasepencil::grease_pencil_separate_material(), blender::ed::greasepencil::grease_pencil_separate_selected(), blender::ed::greasepencil::material_isolate_exec(), material_slot_copy_exec(), mesh_separate_arrays(), mesh_separate_tagged(), blender::modify_stroke_by_material(), object_material_assign(), and versioning_eevee_shadow_settings().
Definition at line 1152 of file blenkernel/intern/material.cc.
References BKE_curve_material_remap(), BKE_grease_pencil_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, OB_CURVES_LEGACY, OB_FONT, OB_GREASE_PENCIL, 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 1182 of file blenkernel/intern/material.cc.
References BKE_object_material_get(), BLI_ghash_free(), BLI_ghash_lookup_p(), BLI_ghash_ptr_new_ex(), BLI_ghash_reinsert(), POINTER_AS_INT, POINTER_FROM_INT, and Object::totcol.
Referenced by BMD_mesh_intersection().
Definition at line 904 of file blenkernel/intern/material.cc.
References Object::actcol, DEG_id_tag_update(), DEG_relations_tag_update(), Object::id, ID_RECALC_GEOMETRY, ID_RECALC_SYNC_TO_EVAL, id_us_min(), Object::mat, Object::matbits, MEM_freeN(), and Object::totcol.
Referenced by BKE_object_materials_test(), BKE_objects_materials_test_all(), and mesh_separate_material_assign_mat_nr().
Definition at line 1321 of file blenkernel/intern/material.cc.
References Object::actcol, BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), MAXMAT, and Object::totcol.
Referenced by blender::ed::greasepencil::bake_grease_pencil_animation_exec(), BKE_grease_pencil_object_material_ensure_from_brush(), BKE_grease_pencil_object_material_new(), BKE_object_material_ensure(), material_slot_add_exec(), and new_material_exec().
Definition at line 1294 of file blenkernel/intern/material.cc.
References BKE_object_material_array_p(), and BKE_object_material_len_p().
Referenced by blender::ed::sculpt_paint::greasepencil::PaintOperation::on_stroke_done().
Definition at line 1337 of file blenkernel/intern/material.cc.
References Object::actcol, BKE_displist_free(), BKE_object_material_array_p(), BKE_object_material_len_p(), CLOG_ERROR, Object::data, ELEM, ListBase::first, Material::id, id_us_min(), LOG, material_data_index_remove_id(), MEM_freeN(), OB_CURVES_LEGACY, OB_FONT, OB_GREASE_PENCIL, OB_MESH, OB_SURF, Main::objects, Object::runtime, Object::totcol, and Object::type.
Referenced by BKE_object_material_array_assign(), material_slot_remove_exec(), material_slot_remove_unused_exec(), and blender::ed::greasepencil::remove_unused_materials().
| bool BKE_object_material_slot_used | ( | Object * | object, |
| short | actcol ) |
Definition at line 489 of file blenkernel/intern/material.cc.
References BKE_curve_material_index_used(), BKE_grease_pencil_material_index_used(), BKE_mesh_material_index_used(), BKE_object_supports_material_slots(), GS, ID_CU_LEGACY, ID_GP, ID_MB, ID_ME, LISTBASE_FOREACH, ID::name, and OB_DATA_SUPPORT_ID.
Referenced by blender::ed::greasepencil::grease_pencil_material_lock_unused_exec(), blender::ed::greasepencil::grease_pencil_separate_material(), material_slot_remove_unused_exec(), and blender::ed::greasepencil::remove_unused_materials().
Definition at line 949 of file blenkernel/intern/material.cc.
References BKE_id_material_len_p(), BKE_id_material_resize(), BKE_object_material_resize(), Object::id, ID_TAG_MISSING, ID::tag, and Object::totcol.
Referenced by blender::ed::object::add_type_with_obdata(), BKE_mesh_assign_object(), BKE_object_material_from_eval_data(), Freestyle::BlenderStrokeRenderer::GenerateStrokeMesh(), libblock_remap_data_postprocess_obdata_relink(), loose_data_instantiate_obdata_process(), blender::ed::object::make_links_data_exec(), object_blend_read_after_liblink(), blender::ed::object::object_convert_exec(), object_material_assign(), and placeholders_ensure_valid().
Definition at line 971 of file blenkernel/intern/material.cc.
References BKE_id_material_len_p(), BKE_main_lock(), BKE_main_unlock(), BKE_object_material_resize(), BLI_assert, Object::data, ListBase::first, Object::id, ID::next, 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 1685 of file blenkernel/intern/material.cc.
References Material::nodetree, ntree_foreach_texnode_recursive(), PAINT_SLOT_COLOR_ATTRIBUTE, PAINT_SLOT_IMAGE, FindTexPaintNodeData::r_node, texpaint_slot_node_find_cb(), Material::texpaintslot, and Material::tot_slots.
Definition at line 1585 of file blenkernel/intern/material.cc.
References count, count_texture_nodes_recursive(), DEG_id_tag_update(), fill_texpaint_slots_recursive(), Material::id, ID_RECALC_SHADING, ID_RECALC_SYNC_TO_EVAL, IMAGEPAINT_MODE_IMAGE, material_paint_slot_filter(), MEM_callocN, MEM_SAFE_FREE, blender::bke::node_get_active_paint_canvas(), Material::nodetree, Material::paint_active_slot, Material::paint_clone_slot, Material::texpaintslot, and Material::tot_slots.
Referenced by BKE_texpaint_slots_refresh_object().
Definition at line 1650 of file blenkernel/intern/material.cc.
References BKE_object_material_get(), BKE_texpaint_slot_refresh_cache(), and Object::totcol.
Referenced by ED_editors_init_for_undo(), ED_object_texture_paint_mode_enter_ex(), scene_changed(), and sculpt_update_object().
|
static |
Definition at line 1484 of file blenkernel/intern/material.cc.
Referenced by count_texture_nodes_recursive().
|
static |
Definition at line 1490 of file blenkernel/intern/material.cc.
References count_texture_nodes_cb(), and ntree_foreach_texnode_recursive().
Referenced by BKE_texpaint_slot_refresh_cache().
|
static |
Definition at line 1506 of file blenkernel/intern/material.cc.
References FillTexPaintSlotsData::active_node, TexPaintSlot::attribute_name, BKE_id_attributes_color_find(), Object::data, Image::id, TexPaintSlot::ima, TexPaintSlot::image_user, FillTexPaintSlotsData::index, TexPaintSlot::interp, NodeTexImage::interpolation, NodeTexImage::iuser, FillTexPaintSlotsData::ma, NodeShaderAttribute::name, nodetree_uv_node_recursive(), 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 1564 of file blenkernel/intern/material.cc.
References fill_texpaint_slots_cb(), and ntree_foreach_texnode_recursive().
Referenced by BKE_texpaint_slot_refresh_cache().
Definition at line 739 of file blenkernel/intern/material.cc.
References BKE_object_get_editmesh_eval_final(), data, Object::data, Mesh::id, 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 226 of file blenkernel/intern/material.cc.
References BKE_previewimg_blend_read(), BLI_listbase_clear(), BLO_read_struct, Material::gp_style, Material::gpumaterial, Material::preview, and Material::texpaintslot.
|
static |
Definition at line 193 of file blenkernel/intern/material.cc.
References BKE_id_blend_write(), BKE_previewimg_blend_write(), BLI_listbase_clear(), BLO_write_allocate_id_buffer(), BLO_write_destroy_id_buffer(), BLO_write_get_id_buffer_temp_id(), BLO_write_id_struct, BLO_write_init_id_buffer_from_id(), BLO_write_is_undo(), BLO_write_struct, BLO_write_struct_at_address, Material::gp_style, Material::gpumaterial, bNodeTree::id, Material::id, blender::bke::node_tree_blend_write(), Material::nodetree, Material::preview, and Material::texpaintslot.
|
static |
Definition at line 95 of file blenkernel/intern/material.cc.
References BKE_id_copy_in_lib(), BKE_previewimg_id_copy(), BLI_listbase_clear(), flag, Material::gp_style, Material::gpumaterial, bNodeTree::id, Material::id, LIB_ID_COPY_NO_PREVIEW, LIB_ID_CREATE_LOCAL, LIB_ID_CREATE_NO_USER_REFCOUNT, MEM_dupallocN, blender::bke::node_tree_localize(), Material::nodetree, Material::preview, and Material::texpaintslot.
|
static |
Definition at line 522 of file blenkernel/intern/material.cc.
References BKE_curve_material_index_clear(), BKE_mesh_material_index_clear(), BLI_assert, GS, ID_CU_LEGACY, ID_CV, ID_MB, ID_ME, ID_PT, ID_VO, and OB_DATA_SUPPORT_ID.
Referenced by BKE_id_material_clear().
|
static |
Definition at line 463 of file blenkernel/intern/material.cc.
References BKE_curve_material_index_remove(), BKE_grease_pencil_material_index_remove(), BKE_mesh_material_index_remove(), BLI_assert, GS, ID_CU_LEGACY, ID_CV, ID_GP, ID_MB, ID_ME, ID_PT, ID_VO, and OB_DATA_SUPPORT_ID.
Referenced by BKE_id_material_pop(), and BKE_object_material_slot_remove().
|
static |
Definition at line 1989 of file blenkernel/intern/material.cc.
References add_v3_fl(), BKE_gpencil_material_attr_init(), BLI_strncpy(), Material::gp_style, Material::id, MAX_NAME, ID::name, and MaterialGPencilStyle::stroke_rgba.
Referenced by BKE_materials_init().
|
static |
Definition at line 2050 of file blenkernel/intern/material.cc.
References BLI_strncpy(), Material::id, blender::bke::bNodeTreeType::idname, MAX_NAME, ID::name, blender::bke::node_add_link(), blender::bke::node_add_static_node(), blender::bke::node_find_socket(), blender::bke::node_set_active(), blender::bke::node_tree_add_tree_embedded(), ntreeType_Shader, SH_NODE_OUTPUT_MATERIAL, SOCK_IN, SOCK_OUT, and Material::use_nodes.
Referenced by BKE_materials_init().
|
static |
Definition at line 1996 of file blenkernel/intern/material.cc.
References BLI_strncpy(), copy_v3_v3(), bNodeSocket::default_value, Material::id, blender::bke::bNodeTreeType::idname, bNode::locx, bNode::locy, MAX_NAME, ID::name, blender::bke::node_add_link(), blender::bke::node_add_static_node(), blender::bke::node_find_socket(), blender::bke::node_set_active(), blender::bke::node_tree_add_tree_embedded(), ntreeType_Shader, Material::r, SH_NODE_OUTPUT_MATERIAL, SOCK_IN, SOCK_OUT, and Material::use_nodes.
Referenced by BKE_materials_init().
|
static |
Definition at line 2024 of file blenkernel/intern/material.cc.
References BLI_strncpy(), Material::id, blender::bke::bNodeTreeType::idname, bNode::locx, bNode::locy, MAX_NAME, ID::name, blender::bke::node_add_link(), blender::bke::node_add_static_node(), blender::bke::node_find_socket(), blender::bke::node_set_active(), blender::bke::node_tree_add_tree_embedded(), ntreeType_Shader, SH_NODE_OUTPUT_MATERIAL, SOCK_IN, SOCK_OUT, and Material::use_nodes.
Referenced by BKE_materials_init().
|
static |
Definition at line 172 of file blenkernel/intern/material.cc.
References BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL, BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK, BKE_LIB_FOREACHID_PROCESS_IDSUPER, BKE_lib_query_foreachid_process_flags_get(), BKE_library_foreach_ID_embedded(), flag, IDWALK_CB_NOP, IDWALK_CB_USER, and IDWALK_DO_DEPRECATED_POINTERS.
|
static |
Definition at line 149 of file blenkernel/intern/material.cc.
References BKE_icon_id_delete(), BKE_previewimg_free(), GPU_material_free(), MEM_freeN(), MEM_SAFE_FREE, and blender::bke::node_tree_free_embedded_tree().
Referenced by BKE_materials_exit().
|
static |
Definition at line 84 of file blenkernel/intern/material.cc.
References BLI_assert, DNA_struct_default_get, ID_MA, 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 1576 of file blenkernel/intern/material.cc.
References Object::mode, OB_MODE_SCULPT, PAINT_SLOT_COLOR_ATTRIBUTE, and PAINT_SLOT_IMAGE.
Referenced by BKE_texpaint_slot_refresh_cache().
|
static |
Definition at line 290 of file blenkernel/intern/material.cc.
References NODE_GROUP, nodetree_mark_previews_dirty_reccursive(), and tree.
Referenced by BKE_material_make_node_previews_dirty(), and nodetree_mark_previews_dirty_reccursive().
Definition at line 1429 of file blenkernel/intern/material.cc.
References LISTBASE_FOREACH, NODE_CLASS_INPUT, nodetree_uv_node_recursive(), SH_NODE_UVMAP, and bNode::typeinfo.
Referenced by fill_texpaint_slots_cb(), and nodetree_uv_node_recursive().
|
static |
Definition at line 1453 of file blenkernel/intern/material.cc.
References callback, ELEM, NODE_CLASS_TEXTURE, NODE_CUSTOM_GROUP, NODE_GROUP, ntree_foreach_texnode_recursive(), PAINT_SLOT_COLOR_ATTRIBUTE, PAINT_SLOT_IMAGE, and SH_NODE_TEX_IMAGE.
Referenced by BKE_texpaint_slot_material_find_node(), count_texture_nodes_recursive(), fill_texpaint_slots_recursive(), and ntree_foreach_texnode_recursive().
|
static |
Definition at line 1045 of file blenkernel/intern/material.cc.
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_freeN(), MEM_recallocN_id, 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 1705 of file blenkernel/intern/material.cc.
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_EXCLUSION, 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, max_ff(), min_ff(), and rgb_to_hsv().
Referenced by blender::nodes::node_sh_mix_cc::MixColorFunction::call(), blender::nodes::node_shader_mix_rgb_cc::MixRGBFunction::call(), colorfn(), colorfn(), colorfn(), do_proc(), and Freestyle_blendRamp().
|
static |
Definition at line 1663 of file blenkernel/intern/material.cc.
References TexPaintSlot::attribute_name, Image::id, TexPaintSlot::ima, NodeShaderAttribute::name, node, FindTexPaintNodeData::r_node, SH_NODE_TEX_IMAGE, FindTexPaintNodeData::slot, STREQLEN, and Image::type.
Referenced by BKE_texpaint_slot_material_find_node().
|
static |
Definition at line 1976 of file blenkernel/intern/material.cc.
Referenced by BKE_material_default_empty().
|
static |
Definition at line 1980 of file blenkernel/intern/material.cc.
Referenced by BKE_material_default_gpencil(), and BKE_materials_init().
|
static |
Definition at line 1977 of file blenkernel/intern/material.cc.
Referenced by BKE_material_default_holdout(), and BKE_materials_init().
|
static |
Definition at line 1978 of file blenkernel/intern/material.cc.
Referenced by BKE_material_default_surface(), and BKE_materials_init().
|
static |
Definition at line 1979 of file blenkernel/intern/material.cc.
Referenced by BKE_material_default_volume(), and BKE_materials_init().
|
static |
Definition at line 1982 of file blenkernel/intern/material.cc.
Referenced by BKE_material_defaults_free_gpu(), BKE_materials_exit(), and BKE_materials_init().
| IDTypeInfo IDType_ID_MA |
Definition at line 240 of file blenkernel/intern/material.cc.
|
static |
Definition at line 82 of file blenkernel/intern/material.cc.
Referenced by BKE_object_material_slot_remove().