diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-03 18:53:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-03 18:53:54 +0400 |
commit | 0cf0f5a62225f9f9cc2ed9715274e94dc09ad8b0 (patch) | |
tree | f89e9ebe84dc32179532ab8fc269c46b8b6e8b8a /source/blender/makesrna/intern/rna_material_api.c | |
parent | 52cefa4bc1104231cf6c6ef5b12124df135e2914 (diff) |
rna api
- move: material.add_texture(tex, coords, mapto) --> material.texture_slots.add()
- added material.texture_slots.create(index), material.texture_slots.clear(index)
- texture slot functions also work for lamp and world now.
Other minor changes
- allow rna functions to set FUNC_NO_SELF and FUNC_USE_SELF_ID at once.
- [#23317] Changed some operators' RNA to accept lengths, a modification I made to this patch made it not work as intended, removed this edit so unit buttons appier in the UI for certain operators.
- Sphinx doc gen, 2 columns rather then 3, didnt quite fit in some cases.
Diffstat (limited to 'source/blender/makesrna/intern/rna_material_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_material_api.c | 85 |
1 files changed, 2 insertions, 83 deletions
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c index d271b3b374c..22eb537f24a 100644 --- a/source/blender/makesrna/intern/rna_material_api.c +++ b/source/blender/makesrna/intern/rna_material_api.c @@ -35,93 +35,12 @@ #ifdef RNA_RUNTIME -#include "BKE_material.h" -#include "BKE_texture.h" - -/* - Adds material to the first free texture slot. - If all slots are busy, replaces the first. -*/ -static void rna_Material_add_texture(Material *ma, Tex *tex, int texco, int mapto) -{ - int i; - MTex *mtex; - int slot= -1; - - for (i= 0; i < MAX_MTEX; i++) { - if (!ma->mtex[i]) { - slot= i; - break; - } - } - - if (slot == -1) - slot= 0; - - if (ma->mtex[slot]) { - ma->mtex[slot]->tex->id.us--; - } - else { - ma->mtex[slot]= add_mtex(); - } - - mtex= ma->mtex[slot]; - - mtex->tex= tex; - if (tex) - id_us_plus(&tex->id); - - mtex->texco= texco; - mtex->mapto= mapto; -} - #else void RNA_api_material(StructRNA *srna) { - FunctionRNA *func; - PropertyRNA *parm; - - /* copied from rna_def_material_mtex (rna_material.c) */ - static EnumPropertyItem prop_texture_coordinates_items[] = { - {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"}, - {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"}, - {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"}, - {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"}, - {TEXCO_STRAND, "STRAND", 0, "Strand", "Uses normalized strand texture coordinate (1D)"}, - {TEXCO_STICKY, "STICKY", 0, "Sticky", "Uses mesh's sticky coordinates for the texture coordinates"}, - {TEXCO_WINDOW, "WINDOW", 0, "Window", "Uses screen coordinates as texture coordinates"}, - {TEXCO_NORM, "NORMAL", 0, "Normal", "Uses normal vector as texture coordinates"}, - {TEXCO_REFL, "REFLECTION", 0, "Reflection", "Uses reflection vector as texture coordinates"}, - {TEXCO_STRESS, "STRESS", 0, "Stress", "Uses the difference of edge lengths compared to original coordinates of the mesh"}, - {TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates"}, - - {0, NULL, 0, NULL, NULL}}; - - static EnumPropertyItem prop_texture_mapto_items[] = { - {MAP_COL, "COLOR", 0, "Color", "Causes the texture to affect basic color of the material"}, - {MAP_NORM, "NORMAL", 0, "Normal", "Causes the texture to affect the rendered normal"}, - {MAP_COLSPEC, "SPECULAR_COLOR", 0, "Specularity Color", "Causes the texture to affect the specularity color"}, - {MAP_COLMIR, "MIRROR", 0, "Mirror", "Causes the texture to affect the mirror color"}, - {MAP_REF, "REFLECTION", 0, "Reflection", "Causes the texture to affect the value of the materials reflectivity"}, - {MAP_SPEC, "SPECULARITY", 0, "Specularity", "Causes the texture to affect the value of specularity"}, - {MAP_EMIT, "EMIT", 0, "Emit", "Causes the texture to affect the emit value"}, - {MAP_ALPHA, "ALPHA", 0, "Alpha", "Causes the texture to affect the alpha value"}, - {MAP_HAR, "HARDNESS", 0, "Hardness", "Causes the texture to affect the hardness value"}, - {MAP_RAYMIRR, "RAY_MIRROR", 0, "Ray-Mirror", "Causes the texture to affect the ray-mirror value"}, - {MAP_TRANSLU, "TRANSLUCENCY", 0, "Translucency", "Causes the texture to affect the translucency value"}, - {MAP_AMB, "AMBIENT", 0, "Ambient", "Causes the texture to affect the value of ambient"}, - {MAP_DISPLACE, "DISPLACEMENT", 0, "Displacement", "Let the texture displace the surface"}, - {MAP_WARP, "WARP", 0, "Warp", "Let the texture warp texture coordinates of next channels"}, - {0, NULL, 0, NULL, NULL}}; - - func= RNA_def_function(srna, "add_texture", "rna_Material_add_texture"); - RNA_def_function_ui_description(func, "Add a texture to material's free texture slot."); - parm= RNA_def_pointer(func, "texture", "Texture", "Texture", "Texture to add."); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_enum(func, "texture_coords", prop_texture_coordinates_items, TEXCO_UV, "", "Source of texture coordinate information."); /* optional */ - parm= RNA_def_enum(func, "map_to", prop_texture_mapto_items, MAP_COL, "", "Controls which material property the texture affects."); /* optional */ - RNA_def_property_flag(parm, PROP_ENUM_FLAG); + // FunctionRNA *func; + // PropertyRNA *parm; } #endif |