/** * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Contributor(s): Blender Foundation (2008), Nathan Letwory * * ***** END GPL LICENSE BLOCK ***** */ #include #include #include "RNA_define.h" #include "RNA_types.h" #include "rna_internal.h" #include "DNA_material_types.h" #include "DNA_texture_types.h" #include "WM_types.h" #ifdef RNA_RUNTIME static PointerRNA rna_Material_mirror_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_MaterialRaytraceMirror, ptr->id.data); } static PointerRNA rna_Material_transp_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_MaterialRaytraceTransparency, ptr->id.data); } static PointerRNA rna_Material_halo_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_MaterialHalo, ptr->id.data); } static PointerRNA rna_Material_sss_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_MaterialSubsurfaceScattering, ptr->id.data); } static PointerRNA rna_Material_strand_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_MaterialStrand, ptr->id.data); } static void rna_Material_type_set(PointerRNA *ptr, int value) { Material *ma= (Material*)ptr->data; if(ma->material_type == MA_TYPE_HALO && value != MA_TYPE_HALO) ma->mode &= ~(MA_STAR|MA_HALO_XALPHA|MA_ZINV|MA_ENV); ma->material_type= value; } static void rna_Material_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Material *ma= (Material*)ptr->data; rna_iterator_array_begin(iter, (void*)ma->mtex, sizeof(MTex*), MAX_MTEX, NULL); } static PointerRNA rna_Material_active_texture_get(PointerRNA *ptr) { Material *ma= (Material*)ptr->data; return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, ma->mtex[(int)ma->texact]); } static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max) { Material *ma= (Material*)ptr->id.data; if(ma->mode & MA_STR_B_UNITS) { *min= 0.0001f; *max= 2.0f; } else { *min= 0.25f; *max= 20.0f; } } static void rna_MaterialStrand_end_size_range(PointerRNA *ptr, float *min, float *max) { Material *ma= (Material*)ptr->id.data; if(ma->mode & MA_STR_B_UNITS) { *min= 0.0001f; *max= 1.0f; } else { *min= 0.25f; *max= 10.0f; } } static int rna_MaterialTextureSlot_enabled_get(PointerRNA *ptr) { Material *ma= (Material*)ptr->id.data; MTex *mtex= (MTex*)ptr->data; int a; for(a=0; amtex[a] == mtex) return (ma->septex & (1<id.data; MTex *mtex= (MTex*)ptr->data; int a; for(a=0; amtex[a] == mtex) { if(value) ma->septex &= ~(1<septex |= (1<