Blender V2.61 - r43446
|
General operations, lookup, etc. for materials. More...
Go to the source code of this file.
Functions | |
void | init_def_material (void) |
void | free_material (struct Material *sc) |
void | test_object_materials (struct ID *id) |
void | resize_object_material (struct Object *ob, const short totcol) |
void | init_material (struct Material *ma) |
struct Material * | add_material_main (struct Main *main, const char *name) |
struct Material * | add_material (const char *name) |
struct Material * | copy_material (struct Material *ma) |
struct Material * | localize_material (struct Material *ma) |
struct Material * | give_node_material (struct Material *ma) |
void | make_local_material (struct Material *ma) |
void | extern_local_matarar (struct Material **matar, short totcol) |
void | automatname (struct Material *) |
struct Material *** | give_matarar (struct Object *ob) |
short * | give_totcolp (struct Object *ob) |
struct Material *** | give_matarar_id (struct ID *id) |
short * | give_totcolp_id (struct ID *id) |
struct Material * | give_current_material (struct Object *ob, short act) |
struct ID * | material_from (struct Object *ob, short act) |
void | assign_material_id (struct ID *id, struct Material *ma, short act) |
void | assign_material (struct Object *ob, struct Material *ma, short act) |
void | assign_matarar (struct Object *ob, struct Material ***matar, short totcol) |
short | find_material_index (struct Object *ob, struct Material *ma) |
int | object_add_material_slot (struct Object *ob) |
int | object_remove_material_slot (struct Object *ob) |
void | material_append_id (struct ID *id, struct Material *ma) |
struct Material * | material_pop_id (struct ID *id, int index, int remove_material_slot) |
void | init_render_material (struct Material *, int, float *) |
void | init_render_materials (struct Main *, int, float *) |
void | end_render_material (struct Material *) |
void | end_render_materials (struct Main *) |
int | material_in_material (struct Material *parmat, struct Material *mat) |
void | ramp_blend (int type, float r_col[3], const float fac, const float col[3]) |
void | clear_matcopybuf (void) |
void | free_matcopybuf (void) |
void | copy_matcopybuf (struct Material *ma) |
void | paste_matcopybuf (struct Material *ma) |
void | clear_mat_mtex_copybuf (void) |
void | copy_mat_mtex_copybuf (struct ID *id) |
void | paste_mat_mtex_copybuf (struct ID *id) |
int | do_version_tface (struct Main *main, int fileload) |
General operations, lookup, etc. for materials.
Definition in file BKE_material.h.
struct Material* add_material | ( | const char * | name | ) | [read] |
Definition at line 202 of file material.c.
References alloc_libblock(), G, ID_MA, and init_material().
Referenced by convert_tfacenomaterial(), new_material_exec(), and DocumentImporter::writeMaterial().
Definition at line 838 of file material.c.
References Object::actcol, assign_material(), i, object_remove_material_slot(), and Object::totcol.
Referenced by material_slot_copy_exec(), and mesh_separate_selected().
Definition at line 767 of file material.c.
References Object::actcol, BLI_assert, Object::data, UserDef::flag, give_matarar(), give_totcolp(), Material::id, Object::id, id_us_plus(), ID::lib, Object::mat, Object::matbits, MAXMAT, MEM_callocN(), MEM_freeN(), NULL, test_object_materials(), Object::totcol, U, ID::us, and USER_MAT_ON_OB.
Referenced by assign_matarar(), MeshImporter::assign_material_to_geom(), drop_named_material_invoke(), make_links_data_exec(), NewBooleanMesh(), object_add_material_slot(), and single_mat_users().
Definition at line 725 of file material.c.
References BLI_assert, give_matarar_id(), give_totcolp_id(), Material::id, id_us_plus(), ID::lib, MAXMAT, MEM_callocN(), MEM_freeN(), NULL, test_object_materials(), and ID::us.
void automatname | ( | struct Material * | ) |
Definition at line 1084 of file material.c.
References Material::b, colname_array, Material::g, G, g, MA_SHLESS, Material::mode, new_id(), NULL, Material::r, and Material::ref.
void clear_mat_mtex_copybuf | ( | void | ) |
void clear_matcopybuf | ( | void | ) |
void copy_mat_mtex_copybuf | ( | struct ID * | id | ) |
void copy_matcopybuf | ( | struct Material * | ma | ) |
Definition at line 1434 of file material.c.
References ListBase::first, free_matcopybuf(), Material::gpumaterial, ListBase::last, matcopied, MAX_MTEX, MEM_dupallocN(), Material::mtex, Material::nodetree, ntreeCopyTree(), NULL, Material::preview, Material::ramp_col, and Material::ramp_spec.
Referenced by copy_material_exec().
Definition at line 214 of file material.c.
References BKE_previewimg_copy(), copy_libblock(), ListBase::first, Material::gpumaterial, Material::group, Material::id, id_lib_extern(), id_us_plus(), ListBase::last, MAX_MTEX, MEM_dupallocN(), MEM_mallocN(), Material::mtex, Material::nodetree, ntreeCopyTree(), NULL, Material::preview, Material::ramp_col, Material::ramp_spec, and MTex::tex.
Referenced by convert_tfacematerial(), KX_BlenderSceneConverter::ConvertMeshSpecial(), id_copy(), make_local_material(), new_id_matar(), new_material_exec(), object_add_duplicate_internal(), and single_mat_users().
int do_version_tface | ( | struct Main * | main, |
int | fileload | ||
) |
Definition at line 1781 of file material.c.
References CD_MTFACE, check_tfaceneedmaterial(), convert_tfacematerial(), convert_tfacenomaterial(), CustomData_get_active_layer_index(), CustomDataLayer::data, decode_tfaceflag(), encode_tfaceflag(), Mesh::fdata, ListBase::first, GameSettings::flag, Material::game, GEMAT_BACKCULL, Material::id, Mesh::id, if(), CustomData::layers, ID::lib, Main::mat, Mesh::mat, MAT_BGE_DISPUTED, MFace::mat_nr, Main::mesh, Mesh::mface, MTFace::mode, ID::name, ID::next, NULL, set_facetexture_flags(), TF_CONVERTED, Mesh::totcol, and MTFace::tpage.
Referenced by convert_tface_mt(), and texface_convert_exec().
void end_render_material | ( | struct Material * | ) |
Definition at line 1011 of file material.c.
References bNodeTree::execdata, Material::nodetree, ntreeShaderEndExecTree(), and Material::use_nodes.
Referenced by end_render_materials(), and preview_prepare_scene().
void end_render_materials | ( | struct Main * | ) |
Definition at line 1019 of file material.c.
References end_render_material(), ListBase::first, Material::id, Main::mat, ID::next, and ID::us.
Referenced by RE_Database_Free().
void extern_local_matarar | ( | struct Material ** | matar, |
short | totcol | ||
) |
Definition at line 443 of file material.c.
References i, and id_lib_extern().
Referenced by expand_local_mesh(), extern_local_curve(), extern_local_mball(), and extern_local_object().
Definition at line 856 of file material.c.
References give_matarar(), give_totcolp(), and NULL.
void free_matcopybuf | ( | void | ) |
Definition at line 1408 of file material.c.
References matcopied, MAX_MTEX, MEM_freeN(), Material::mtex, Material::nodetree, ntreeFreeTree(), NULL, Material::ramp_col, and Material::ramp_spec.
Referenced by copy_matcopybuf().
void free_material | ( | struct Material * | sc | ) |
Definition at line 80 of file material.c.
References BKE_free_animdata(), BKE_icon_delete(), BKE_previewimg_free(), GPU_material_free(), ID::icon_id, Tex::id, MAX_MTEX, MEM_freeN(), Material::mtex, ntreeFreeTree(), Material::ramp_col, Material::ramp_spec, MTex::tex, and ID::us.
Referenced by free_libblock(), RE_free_sample_material(), and shader_preview_free().
Definition at line 603 of file material.c.
References give_matarar(), give_totcolp(), Object::mat, Object::matbits, NULL, and Object::totcol.
Referenced by InstanceWriter::add_material_bindings(), add_tface_color_layer(), allow_render_dupli_instance(), animdata_filter_ds_materials(), BL_ConvertMaterialIpos(), BL_ConvertMesh(), buttons_context_path_material(), buttons_texture_users_from_context(), ConvertCSGDescriptorsToDerivedMesh(), CreateMaterialFromBlenderObject(), GeometryExporter::createPolylist(), draw_mesh_fancy(), draw_mesh_object(), draw_new_particle_system(), draw_tface__set_draw(), draw_tface__set_draw_legacy(), dynamicPaint_Modifier_apply(), dynamicPaint_updateBrushMaterials(), ED_object_assign_active_image(), ED_object_get_active_image(), get_driver_path_hack(), give_current_material_or_def(), give_current_object_texture(), give_render_material(), GPU_begin_object_materials(), AnimationExporter::hasAnimations(), image_aspect(), join_mesh_exec(), list_item_row(), make_links_data_exec(), mesh_noise_exec(), object_frame_has_keyframe(), object_select_linked_exec(), ForEachMaterialFunctor< Functor >::operator()(), AnimationExporter::operator()(), preview_prepare_scene(), psys_get_particle_on_path(), psys_threads_create(), single_mat_users(), snode_set_context(), and AnimationImporter::translate_Animations().
Definition at line 451 of file material.c.
References Object::data, ELEM3, MetaBall::mat, Curve::mat, Mesh::mat, NULL, OB_CURVE, OB_FONT, OB_MBALL, OB_MESH, OB_SURF, and Object::type.
Referenced by assign_material(), find_material_index(), give_current_material(), make_local_exec(), material_slot_copy_exec(), mesh_separate_selected(), object_add_duplicate_internal(), object_remove_material_slot(), preview_prepare_scene(), and set_dupli_tex_mat().
Definition at line 494 of file material.c.
References GS, ID_CU, ID_MB, ID_ME, ID::name, and NULL.
Referenced by assign_material_id(), material_append_id(), and material_pop_id().
Definition at line 653 of file material.c.
References bNode::id, ID_MA, nodeGetActiveID(), Material::nodetree, NULL, and Material::use_nodes.
Referenced by buttons_context(), buttons_context_path_material(), give_current_object_texture(), and list_item_row().
short* give_totcolp | ( | struct Object * | ob | ) |
Definition at line 472 of file material.c.
References Object::data, ELEM3, NULL, OB_CURVE, OB_FONT, OB_MBALL, OB_MESH, OB_SURF, MetaBall::totcol, Curve::totcol, Mesh::totcol, and Object::type.
Referenced by allow_render_dupli_instance(), assign_material(), dynamicPaint_doMaterialTex(), dynamicPaint_updateBrushMaterials(), find_material_index(), give_current_material(), lib_link_object(), mesh_separate_selected(), object_remove_material_slot(), and set_dupli_tex_mat().
short* give_totcolp_id | ( | struct ID * | id | ) |
Definition at line 510 of file material.c.
References GS, ID_CU, ID_MB, ID_ME, ID::name, and NULL.
Referenced by assign_material_id(), material_append_id(), material_pop_id(), and test_object_materials().
void init_def_material | ( | void | ) |
void init_material | ( | struct Material * | ma | ) |
Definition at line 111 of file material.c.
References Material::adapt_thresh_mir, Material::adapt_thresh_tra, Material::alpha, GameSettings::alpha_blend, Material::amb, Material::ang, Material::b, Material::darkness, VolumeSettings::density, VolumeSettings::density_scale, VolumeSettings::depth_cutoff, Material::dist_mir, VolumeSettings::emission, VolumeSettings::emission_col, GameSettings::face_orientation, Material::fadeto_mir, GameSettings::flag, Material::flareboost, Material::flarec, Material::flaresize, Material::fresnel_mir, Material::fresnel_mir_i, Material::fresnel_tra, Material::fresnel_tra_i, Material::friction, Material::g, Material::game, GEMAT_BACKCULL, Material::gloss_mir, Material::gloss_tra, Material::har, Material::hasize, Material::linec, MA_APPROX_OCCLUSION, MA_RAYBIAS, MA_RAYMIR_FADETOSKY, MA_SHADBUF, MA_SHADOW, MA_SPHERE, MA_TANGENT_STR, MA_TRACEBLE, MA_VOL_PRECACHESHADING, MA_VOL_SHADE_SHADED, MA_VOL_STEP_RANDOMIZED, MA_ZTRANSP, Material::mirb, Material::mirg, Material::mirr, Material::mode, VolumeSettings::ms_diff, VolumeSettings::ms_intensity, VolumeSettings::ms_spread, NULL, Material::param, Material::pr_lamp, Material::pr_type, VolumeSettings::precache_resolution, Material::preview, Material::r, Material::rampfac_col, Material::rampfac_spec, Material::ray_depth, Material::ray_depth_tra, Material::ref, VolumeSettings::reflection, VolumeSettings::reflection_col, Material::refrac, Material::ringc, Material::rms, Material::roughness, Material::samp_gloss_mir, Material::samp_gloss_tra, VolumeSettings::scattering, Material::seed2, Material::shad_alpha, Material::shade_flag, VolumeSettings::shade_type, VolumeSettings::shadeflag, Material::spec, Material::specb, Material::specg, Material::specr, Material::spectra, Material::sss_back, Material::sss_col, Material::sss_colfac, Material::sss_error, Material::sss_front, Material::sss_ior, Material::sss_radius, Material::sss_scale, Material::sss_texfac, Material::starc, VolumeSettings::stepsize, VolumeSettings::stepsize_type, Material::strand_end, Material::strand_sta, Material::subsize, VolumeSettings::transmission_col, Material::tx_falloff, Material::tx_limit, and Material::vol.
Referenced by add_material(), and init_def_material().
void init_render_material | ( | struct Material * | , |
int | , | ||
float * | |||
) |
Definition at line 972 of file material.c.
References do_init_render_material(), bNodeTree::execdata, init_render_nodetree(), Material::nodetree, ntreeShaderBeginExecTree(), and Material::use_nodes.
Referenced by init_render_materials(), and preview_prepare_scene().
void init_render_materials | ( | struct Main * | , |
int | , | ||
float * | |||
) |
Definition at line 985 of file material.c.
References do_init_render_material(), ListBase::first, Material::flag, Material::id, init_render_material(), MA_IS_USED, Material::mapto, Main::mat, ID::next, Material::texco, and ID::us.
Referenced by RE_Database_Baking(), and RE_Database_FromScene().
Definition at line 246 of file material.c.
References BLI_remlink(), copy_libblock(), ListBase::first, G, Material::gpumaterial, Material::id, ListBase::last, MAX_MTEX, MEM_dupallocN(), MEM_mallocN(), Material::mtex, Material::nodetree, ntreeLocalize(), NULL, Material::preview, Material::ramp_col, and Material::ramp_spec.
Referenced by preview_prepare_scene(), and RE_init_sample_material().
void make_local_material | ( | struct Material * | ma | ) |
Definition at line 283 of file material.c.
References BKE_id_lib_local_paths(), copy_material(), Main::curve, extern_local_material(), FALSE, ListBase::first, G, MetaBall::id, Material::id, Mesh::id, Object::id, Curve::id, id_clear_lib_data(), ID::lib, Object::mat, Mesh::mat, Curve::mat, MetaBall::mat, Main::mball, Main::mesh, ID::next, NULL, Main::object, Curve::totcol, Object::totcol, Mesh::totcol, MetaBall::totcol, TRUE, and ID::us.
Referenced by id_make_local().
Definition at line 541 of file material.c.
References give_matarar_id(), give_totcolp_id(), id_us_plus(), MEM_callocN(), MEM_freeN(), and test_object_materials().
Referenced by mesh_addmaterial().
Definition at line 641 of file material.c.
References Object::data, Object::matbits, NULL, and Object::totcol.
Definition at line 1044 of file material.c.
References material_in_nodetree(), Material::nodetree, and Material::use_nodes.
Referenced by zbuffer_sss().
Definition at line 558 of file material.c.
References data_delete_material_index_id(), give_matarar_id(), give_totcolp_id(), id_us_min(), MEM_callocN(), MEM_freeN(), NULL, and test_object_materials().
Referenced by convert_tfacematerial().
int object_add_material_slot | ( | struct Object * | ob | ) |
Definition at line 876 of file material.c.
References Object::actcol, assign_material(), FALSE, MAXMAT, NULL, Object::totcol, and TRUE.
Referenced by material_slot_add_exec().
int object_remove_material_slot | ( | struct Object * | ob | ) |
Definition at line 1103 of file material.c.
References Object::actcol, BLI_assert, Object::data, data_delete_material_index_id(), Object::disp, ELEM4, FALSE, freedisplist(), G, give_matarar(), give_totcolp(), Object::id, Material::id, Object::mat, Object::matbits, MEM_freeN(), ID::next, NULL, OB_CURVE, OB_FONT, OB_MESH, OB_SURF, Object::totcol, TRUE, Object::type, and ID::us.
Referenced by assign_matarar(), and material_slot_remove_exec().
void paste_mat_mtex_copybuf | ( | struct ID * | id | ) |
void paste_matcopybuf | ( | struct Material * | ma | ) |
Definition at line 1458 of file material.c.
References GPU_material_free(), Material::id, Tex::id, id_us_plus(), matcopied, MAX_MTEX, MEM_dupallocN(), MEM_freeN(), Material::mtex, Material::nodetree, ntreeCopyTree(), ntreeFreeTree(), Material::ramp_col, Material::ramp_spec, MTex::tex, and ID::us.
Referenced by paste_material_exec().
void ramp_blend | ( | int | type, |
float | r_col[3], | ||
const float | fac, | ||
const float | col[3] | ||
) |
Definition at line 1183 of file material.c.
References 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, and rgb_to_hsv().
Referenced by add_to_diffuse(), colorfn(), do_colorband_blend(), do_mix_rgb(), do_proc(), do_specular_ramp(), node_shader_exec_mix_rgb(), ramp_diffuse_result(), ramp_spec_result(), shadeSunView(), and texture_rgb_blend().
void resize_object_material | ( | struct Object * | ob, |
const short | totcol | ||
) |
Definition at line 678 of file material.c.
References Object::actcol, Object::mat, Object::matbits, MEM_callocN(), MEM_freeN(), NULL, and Object::totcol.
Referenced by lib_link_object(), and test_object_materials().
void test_object_materials | ( | struct ID * | id | ) |
Definition at line 708 of file material.c.
References Object::data, G, give_totcolp_id(), Object::id, ID::next, NULL, and resize_object_material().
Referenced by assign_material(), assign_material_id(), join_mesh_exec(), make_links_data_exec(), material_append_id(), material_pop_id(), and set_mesh().