|
Blender
V2.59
|
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 (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, int act) |
| struct ID * | material_from (struct Object *ob, int act) |
| void | assign_material (struct Object *ob, struct Material *ma, int act) |
| void | assign_matarar (struct Object *ob, struct Material ***matar, int totcol) |
| int | 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, float *g, float *b, float fac, float *col) |
| 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) |
General operations, lookup, etc. for materials.
Definition in file BKE_material.h.
| struct Material* add_material | ( | const char * | name | ) | [read] |
Definition at line 196 of file material.c.
References alloc_libblock(), G, ID_MA, init_material(), Global::main, and Main::mat.
Referenced by new_material_exec(), and DocumentImporter::writeMaterial().
Definition at line 787 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 716 of file material.c.
References Object::actcol, BLI_assert, Object::data, 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, 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().
| void automatname | ( | struct Material * | ) |
Definition at line 1029 of file material.c.
References Material::b, colname_array, Material::g, G, g, MA_SHLESS, Global::main, Main::mat, 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 1403 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 208 of file material.c.
References BKE_previewimg_copy(), copy_libblock(), ListBase::first, Material::gpumaterial, Material::group, 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 KX_BlenderSceneConverter::ConvertMeshSpecial(), id_copy(), make_local_material(), new_id_matar(), new_material_exec(), object_add_duplicate_internal(), and single_mat_users().
| void end_render_material | ( | struct Material * | ) |
Definition at line 958 of file material.c.
References Material::nodetree, ntreeEndExecTree(), and Material::use_nodes.
Referenced by end_render_materials(), and preview_prepare_scene().
| void end_render_materials | ( | struct Main * | ) |
Definition at line 964 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 435 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 804 of file material.c.
References give_matarar(), give_totcolp(), and NULL.
| void free_matcopybuf | ( | void | ) |
Definition at line 1377 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 78 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(), and shader_preview_free().
Definition at line 594 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_dopesheet(), animdata_filter_dopesheet_mats(), BL_ConvertMaterialIpos(), BL_ConvertMesh(), buttons_context_path_material(), ConvertCSGDescriptorsToDerivedMesh(), CreateMaterialFromBlenderObject(), GeometryExporter::createPolylist(), draw_mesh_fancy(), draw_new_particle_system(), draw_tface__set_draw_legacy(), get_driver_path_hack(), give_current_material_or_def(), give_current_object_texture(), give_render_material(), GPU_begin_object_materials(), image_aspect(), join_mesh_exec(), list_item_row(), make_links_data_exec(), mesh_noise_exec(), ob_keyframes_loop(), ob_to_keylist(), object_frame_has_keyframe(), object_select_linked_exec(), ForEachMaterialFunctor< Functor >::operator()(), preview_prepare_scene(), psys_get_particle_on_path(), psys_threads_create(), single_mat_users(), and snode_set_context().
Definition at line 443 of file material.c.
References Object::data, ELEM3, Mesh::mat, MetaBall::mat, Curve::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 486 of file material.c.
References GS, ID_CU, ID_MB, ID_ME, ID::name, and NULL.
Referenced by material_append_id(), and material_pop_id().
Definition at line 644 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(), and list_item_row().
| short* give_totcolp | ( | struct Object * | ob | ) |
Definition at line 464 of file material.c.
References Object::data, ELEM3, NULL, OB_CURVE, OB_FONT, OB_MBALL, OB_MESH, OB_SURF, MetaBall::totcol, Mesh::totcol, Curve::totcol, and Object::type.
Referenced by allow_render_dupli_instance(), assign_material(), 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 502 of file material.c.
References GS, ID_CU, ID_MB, ID_ME, ID::name, and NULL.
Referenced by material_append_id(), material_pop_id(), and test_object_materials().
| void init_def_material | ( | void | ) |
| void init_material | ( | struct Material * | ma | ) |
Definition at line 109 of file material.c.
References Material::adapt_thresh_mir, Material::adapt_thresh_tra, Material::alpha, Material::amb, Material::ang, Material::b, Material::darkness, VolumeSettings::density, VolumeSettings::density_scale, VolumeSettings::depth_cutoff, Material::dist_mir, VolumeSettings::emission, VolumeSettings::emission_col, Material::fadeto_mir, 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::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 920 of file material.c.
References do_init_render_material(), init_render_nodetree(), Material::nodetree, ntreeBeginExecTree(), and Material::use_nodes.
Referenced by init_render_materials(), and preview_prepare_scene().
| void init_render_materials | ( | struct Main * | , |
| int | , | ||
| float * | |||
| ) |
Definition at line 932 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 240 of file material.c.
References BLI_remlink(), copy_libblock(), ListBase::first, G, Material::gpumaterial, ListBase::last, Global::main, Main::mat, 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().
| void make_local_material | ( | struct Material * | ma | ) |
Definition at line 277 of file material.c.
References copy_material(), Main::curve, extern_local_material(), ListBase::first, ID::flag, G, Mesh::id, MetaBall::id, Material::id, Object::id, Curve::id, ID::lib, LIB_LOCAL, Global::main, Mesh::mat, Main::mat, MetaBall::mat, Object::mat, Curve::mat, Main::mball, Main::mesh, new_id(), ID::next, NULL, Main::object, MetaBall::totcol, Mesh::totcol, Object::totcol, Curve::totcol, and ID::us.
Referenced by id_make_local().
Definition at line 533 of file material.c.
References give_matarar_id(), give_totcolp_id(), id_us_plus(), MEM_callocN(), MEM_freeN(), and test_object_materials().
Definition at line 632 of file material.c.
References Object::data, Object::matbits, NULL, and Object::totcol.
Definition at line 989 of file material.c.
References material_in_nodetree(), Material::nodetree, and Material::use_nodes.
Referenced by zbuffer_sss().
Definition at line 550 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().
| int object_add_material_slot | ( | struct Object * | ob | ) |
Definition at line 824 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 1048 of file material.c.
References Object::actcol, Object::data, data_delete_material_index_id(), Object::disp, ELEM4, FALSE, ListBase::first, freedisplist(), G, give_matarar(), give_totcolp(), Material::id, Object::id, Global::main, Object::mat, Object::matbits, MEM_freeN(), ID::next, NULL, OB_CURVE, OB_FONT, OB_MESH, OB_SURF, Main::object, 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 1427 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, | ||
| float * | g, | ||
| float * | b, | ||
| float | fac, | ||
| float * | col | ||
| ) |
Definition at line 1122 of file material.c.
References fabsf, g, 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 669 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 699 of file material.c.
References Object::data, ListBase::first, G, give_totcolp_id(), Object::id, Global::main, ID::next, NULL, Main::object, and resize_object_material().
Referenced by assign_material(), join_mesh_exec(), make_links_data_exec(), material_append_id(), material_pop_id(), and set_mesh().