|
Blender
V2.59
|
#include <string.h>#include <math.h>#include "MEM_guardedalloc.h"#include "DNA_curve_types.h"#include "DNA_material_types.h"#include "DNA_mesh_types.h"#include "DNA_meta_types.h"#include "DNA_node_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_math.h"#include "BLI_listbase.h"#include "BLI_utildefines.h"#include "BKE_animsys.h"#include "BKE_displist.h"#include "BKE_global.h"#include "BKE_icons.h"#include "BKE_library.h"#include "BKE_main.h"#include "BKE_material.h"#include "BKE_mesh.h"#include "BKE_node.h"#include "BKE_curve.h"#include "GPU_material.h"Go to the source code of this file.
Definition in file material.c.
| #define GS | ( | a | ) | (*((short *)(a))) |
Definition at line 664 of file material.c.
Referenced by data_delete_material_index_id(), give_matarar_id(), give_totcolp_id(), init_render_nodetree(), and material_in_nodetree().
| 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 | ( | Material * | ma | ) |
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_matcopybuf | ( | void | ) |
| void copy_matcopybuf | ( | 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 data_delete_material_index_id | ( | ID * | id, |
| int | index | ||
| ) |
Definition at line 518 of file material.c.
References curve_delete_material_index(), GS, ID_CU, ID_MB, ID_ME, mesh_delete_material_index(), and ID::name.
Referenced by material_pop_id(), and object_remove_material_slot().
| static void do_init_render_material | ( | Material * | ma, |
| int | r_mode, | ||
| float * | amb | ||
| ) | [static] |
Definition at line 834 of file material.c.
References Material::amb, Material::ambb, Material::ambg, Material::ambr, ELEM3, Material::flarec, MA_FACETEXTURE, MA_NORMAP_TANG, MA_RAYMIRROR, MA_RAYTRANSP, MA_SHADOW_TRA, MA_SHLESS, MA_STR_SURFDIFF, MA_TRANSP, MA_VERTEXCOL, MA_VERTEXCOLP, MAP_NORM, MTex::mapto, Material::mapto, MAX_MTEX, Material::mode, Material::mode_l, Material::mtex, MTEX_3TAP_BUMP, MTEX_5TAP_BUMP, MTEX_COMPAT_BUMP, MTEX_NSPACE_TANGENT, NEED_UV, Material::nodetree, Tex::nodetree, MTex::normapspace, ntreeShaderGetTexcoMode(), R_OSA, R_RAYTRACE, Material::septex, Material::strand_surfnor, MTex::tex, TEX_ENVMAP, TEX_IMAGE, TEX_PLUGIN, MTex::texco, Material::texco, TEXCO_GLOB, TEXCO_LAVECTOR, TEXCO_NORM, TEXCO_OBJECT, TEXCO_ORCO, TEXCO_OSA, TEXCO_REFL, TEXCO_SPEED, TEXCO_STICKY, TEXCO_STRAND, TEXCO_STRESS, TEXCO_UV, TEXCO_VIEW, MTex::texflag, Tex::type, Material::use_nodes, and Tex::use_nodes.
Referenced by init_render_material(), init_render_materials(), and init_render_nodetree().
| void end_render_material | ( | Material * | mat | ) |
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 | ( | Main * | bmain | ) |
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().
| static void extern_local_material | ( | Material * | ma | ) | [static] |
Definition at line 269 of file material.c.
References i, id_lib_extern(), MAX_MTEX, Material::mtex, and MTex::tex.
Referenced by make_local_material().
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 | ( | Material * | ma | ) |
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 | ( | 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 | ( | 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 | ( | 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 | ( | Material * | mat, |
| int | r_mode, | ||
| float * | amb | ||
| ) |
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 | ( | Main * | bmain, |
| int | r_mode, | ||
| float * | amb | ||
| ) |
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().
| static void init_render_nodetree | ( | bNodeTree * | ntree, |
| Material * | basemat, | ||
| int | r_mode, | ||
| float * | amb | ||
| ) | [static] |
Definition at line 900 of file material.c.
References do_init_render_material(), ListBase::first, GS, bNode::id, ID_MA, MA_RAYTRANSP, MA_TRANSP, MA_ZTRANSP, Material::mode_l, ID::name, bNode::next, NODE_GROUP, bNodeTree::nodes, Material::texco, and bNode::type.
Referenced by init_render_material().
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 | ( | 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 972 of file material.c.
References ListBase::first, GS, bNode::id, ID_MA, ID::name, bNode::next, NODE_GROUP, bNodeTree::nodes, and bNode::type.
Referenced by material_in_material().
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 | ( | 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 | ( | 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_matcopybuf | ( | 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 | ( | 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 | ( | 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().
char colname_array[125][20] [static] |
{
"Black","DarkRed","HalfRed","Red","Red",
"DarkGreen","DarkOlive","Brown","Chocolate","OrangeRed",
"HalfGreen","GreenOlive","DryOlive","Goldenrod","DarkOrange",
"LightGreen","Chartreuse","YellowGreen","Yellow","Gold",
"Green","LawnGreen","GreenYellow","LightOlive","Yellow",
"DarkBlue","DarkPurple","HotPink","VioletPink","RedPink",
"SlateGray","DarkGrey","PalePurple","IndianRed","Tomato",
"SeaGreen","PaleGreen","GreenKhaki","LightBrown","LightSalmon",
"SpringGreen","PaleGreen","MediumOlive","YellowBrown","LightGold",
"LightGreen","LightGreen","LightGreen","GreenYellow","PaleYellow",
"HalfBlue","DarkSky","HalfMagenta","VioletRed","DeepPink",
"SteelBlue","SkyBlue","Orchid","LightHotPink","HotPink",
"SeaGreen","SlateGray","MediumGrey","Burlywood","LightPink",
"SpringGreen","Aquamarine","PaleGreen","Khaki","PaleOrange",
"SpringGreen","SeaGreen","PaleGreen","PaleWhite","YellowWhite",
"LightBlue","Purple","MediumOrchid","Magenta","Magenta",
"RoyalBlue","SlateBlue","MediumOrchid","Orchid","Magenta",
"DeepSkyBlue","LightSteelBlue","LightSkyBlue","Violet","LightPink",
"Cyan","DarkTurquoise","SkyBlue","Grey","Snow",
"Mint","Mint","Aquamarine","MintCream","Ivory",
"Blue","Blue","DarkMagenta","DarkOrchid","Magenta",
"SkyBlue","RoyalBlue","LightSlateBlue","MediumOrchid","Magenta",
"DodgerBlue","SteelBlue","MediumPurple","PalePurple","Plum",
"DeepSkyBlue","PaleBlue","LightSkyBlue","PalePurple","Thistle",
"Cyan","ColdBlue","PaleTurquoise","GhostWhite","White"
}
Definition at line 1001 of file material.c.
Referenced by automatname().
Definition at line 69 of file material.c.
Referenced by BL_ConvertMesh(), give_current_material_or_def(), give_render_material(), GPU_begin_object_materials(), GPU_extensions_exit(), and GPU_materials_free().
short matcopied = 0 [static] |
Definition at line 1369 of file material.c.
Referenced by clear_matcopybuf(), copy_matcopybuf(), free_matcopybuf(), and paste_matcopybuf().
Definition at line 1368 of file material.c.