| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /* 
 | 
					
						
							| 
									
										
										
										
											2008-03-12 09:04:07 +00:00
										 |  |  |  * $Id$ | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-16 22:40:48 +00:00
										 |  |  |  * ***** BEGIN GPL LICENSE BLOCK ***** | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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 | 
					
						
							| 
									
										
										
										
											2008-04-16 22:40:48 +00:00
										 |  |  |  * of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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, | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  |  * Inc., 59 Temple Place - Suite 330, Boston, MA	02111-1307, USA. | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This is a new part of Blender. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2004-11-07 15:05:35 +00:00
										 |  |  |  * Contributor(s): Willian P. Germano, Michel Selten, Alex Mole, | 
					
						
							| 
									
										
										
										
											2005-04-21 19:44:52 +00:00
										 |  |  |  * Alexander Szakaly, Campbell Barton, Ken Hughes | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-16 22:40:48 +00:00
										 |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #include "Material.h" /*This must come first*/
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #include "DNA_space_types.h"
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | #include "DNA_material_types.h"
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #include "BKE_main.h"
 | 
					
						
							|  |  |  | #include "BKE_global.h"
 | 
					
						
							|  |  |  | #include "BKE_library.h"
 | 
					
						
							|  |  |  | #include "BKE_material.h"
 | 
					
						
							|  |  |  | #include "BKE_texture.h"
 | 
					
						
							| 
									
										
										
										
											2006-11-17 04:46:48 +00:00
										 |  |  | #include "BKE_idprop.h"
 | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | #include "BKE_utildefines.h" /* for CLAMP */
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #include "MEM_guardedalloc.h"
 | 
					
						
							|  |  |  | #include "BLI_blenlib.h"
 | 
					
						
							|  |  |  | #include "BSE_editipo.h"
 | 
					
						
							|  |  |  | #include "BIF_space.h"
 | 
					
						
							|  |  |  | #include "mydevice.h"
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | #include "constant.h"
 | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | #include "MTex.h"
 | 
					
						
							|  |  |  | #include "Texture.h"
 | 
					
						
							| 
									
										
										
										
											2004-10-07 19:25:40 +00:00
										 |  |  | #include "Ipo.h"
 | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | #include "Group.h"
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #include "gen_utils.h"
 | 
					
						
							| 
									
										
										
										
											2007-03-11 04:05:45 +00:00
										 |  |  | #include "gen_library.h"
 | 
					
						
							| 
									
										
										
										
											2006-11-17 04:46:48 +00:00
										 |  |  | #include "IDProp.h"
 | 
					
						
							| 
									
										
										
										
											2005-02-09 15:53:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Python BPy_Material defaults: */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Material MIN, MAX values */ | 
					
						
							| 
									
										
										
										
											2005-08-07 12:09:50 +00:00
										 |  |  | #define EXPP_MAT_ADD_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_ADD_MAX			 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_ALPHA_MIN	   0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_ALPHA_MAX		 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_AMB_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_AMB_MAX			 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_COL_MIN			 0.0f /* min/max for all ... */
 | 
					
						
							|  |  |  | #define EXPP_MAT_COL_MAX			 1.0f /* ... color triplets  */
 | 
					
						
							|  |  |  | #define EXPP_MAT_EMIT_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_EMIT_MAX			 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_REF_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_REF_MAX			 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPEC_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPEC_MAX			 2.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECTRA_MIN	 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECTRA_MAX	 1.0f
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* Shader specific settings */ | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-07 12:09:50 +00:00
										 |  |  | #define EXPP_MAT_ROUGHNESS_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_ROUGHNESS_MAX			 3.140f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECSIZE_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECSIZE_MAX			 1.530f
 | 
					
						
							|  |  |  | #define EXPP_MAT_DIFFUSESIZE_MIN		 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_DIFFUSESIZE_MAX			 3.140f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECSMOOTH_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECSMOOTH_MAX			 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_DIFFUSESMOOTH_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_DIFFUSESMOOTH_MAX			 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_DIFFUSE_DARKNESS_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_DIFFUSE_DARKNESS_MAX			 2.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_REFRACINDEX_MIN			 1.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_REFRACINDEX_MAX			 10.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_RMS_MIN			 0.0f
 | 
					
						
							|  |  |  | #define EXPP_MAT_RMS_MAX			 0.4f
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | /* End shader settings */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | #define EXPP_MAT_ZOFFS_MIN			 0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_ZOFFS_MAX			10.0
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | #define EXPP_MAT_HALOSIZE_MIN			 0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_HALOSIZE_MAX		 100.0
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #define EXPP_MAT_FLARESIZE_MIN		 0.1f
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | #define EXPP_MAT_FLARESIZE_MAX		25.0
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #define EXPP_MAT_FLAREBOOST_MIN		 0.1f
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | #define EXPP_MAT_FLAREBOOST_MAX		10.0
 | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | #define EXPP_MAT_SUBSIZE_MIN			 0.1f
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | #define EXPP_MAT_SUBSIZE_MAX			25.0
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define EXPP_MAT_HARD_MIN				 1
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | #define EXPP_MAT_HARD_MAX		 255	/* 127 with MODE HALO ON */
 | 
					
						
							| 
									
										
										
										
											2007-02-06 00:20:33 +00:00
										 |  |  | #define EXPP_MAT_HALOSEED_MIN		 0
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | #define EXPP_MAT_HALOSEED_MAX    255
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | #define EXPP_MAT_NFLARES_MIN		 1
 | 
					
						
							|  |  |  | #define EXPP_MAT_NFLARES_MAX		32
 | 
					
						
							| 
									
										
										
										
											2007-02-06 00:20:33 +00:00
										 |  |  | #define EXPP_MAT_FLARESEED_MIN	 0
 | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | #define EXPP_MAT_FLARESEED_MAX 255
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | #define EXPP_MAT_NSTARS_MIN			 3
 | 
					
						
							|  |  |  | #define EXPP_MAT_NSTARS_MAX			50
 | 
					
						
							|  |  |  | #define EXPP_MAT_NLINES_MIN			 0
 | 
					
						
							|  |  |  | #define EXPP_MAT_NLINES_MAX		 250
 | 
					
						
							|  |  |  | #define EXPP_MAT_NRINGS_MIN			 0
 | 
					
						
							|  |  |  | #define EXPP_MAT_NRINGS_MAX			24
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | #define EXPP_MAT_RAYMIRR_MIN			 0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_RAYMIRR_MAX			 1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_MIRRDEPTH_MIN			 0
 | 
					
						
							|  |  |  | #define EXPP_MAT_MIRRDEPTH_MAX			 10
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELMIRR_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELMIRR_MAX			5.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELMIRRFAC_MIN			1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELMIRRFAC_MAX			5.0
 | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | #define EXPP_MAT_RAYMIRRGLOSS_MIN			 0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_RAYMIRRGLOSS_MAX			 1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN	 0
 | 
					
						
							| 
									
										
										
										
											2008-08-04 01:57:22 +00:00
										 |  |  | #define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX	 1024
 | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | #define EXPP_MAT_RAYTRANSPGLOSS_MIN			 0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_RAYTRANSPGLOSS_MAX			 1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN	 0
 | 
					
						
							| 
									
										
										
										
											2008-08-04 01:57:22 +00:00
										 |  |  | #define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX	 1024
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | #define EXPP_MAT_FILTER_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_FILTER_MAX			1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_TRANSLUCENCY_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_TRANSLUCENCY_MAX			1.0
 | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | #define EXPP_MAT_ZOFFS_MIN				0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_ZOFFS_MAX				10.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_IOR_MIN				1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_IOR_MAX				3.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_TRANSDEPTH_MIN				0
 | 
					
						
							|  |  |  | #define EXPP_MAT_TRANSDEPTH_MAX				10
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELTRANS_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELTRANS_MAX			5.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELTRANSFAC_MIN			1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_FRESNELTRANSFAC_MAX			5.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECTRANS_MIN				0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SPECTRANS_MAX				1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_MIRRTRANSADD_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_MIRRTRANSADD_MAX			1.0
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* closure values for getColorComponent()/setColorComponent() */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_R		0
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_G		1
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_B		2
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_SPECR	3
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_SPECG	4
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_SPECB	5
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_MIRR	6
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_MIRG	7
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_MIRB	8
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | #define	EXPP_MAT_COMP_SSSR	9
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_SSSG	10
 | 
					
						
							|  |  |  | #define	EXPP_MAT_COMP_SSSB	11
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | #define IPOKEY_RGB          0
 | 
					
						
							|  |  |  | #define IPOKEY_ALPHA        1 
 | 
					
						
							|  |  |  | #define IPOKEY_HALOSIZE     2 
 | 
					
						
							|  |  |  | #define IPOKEY_MODE         3
 | 
					
						
							|  |  |  | #define IPOKEY_ALLCOLOR     10
 | 
					
						
							|  |  |  | #define IPOKEY_ALLMIRROR    14
 | 
					
						
							|  |  |  | #define IPOKEY_OFS          12
 | 
					
						
							|  |  |  | #define IPOKEY_SIZE         13
 | 
					
						
							|  |  |  | #define IPOKEY_ALLMAPPING   11
 | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | /* SSS Settings */ | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_SCALE_MIN			0.001
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_SCALE_MAX			1000.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_RADIUS_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_RADIUS_MAX			10000.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_IOR_MIN			0.1
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_IOR_MAX			2.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_ERROR_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_ERROR_MAX			1.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_FRONT_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_FRONT_MAX			2.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_BACK_MIN			0.0
 | 
					
						
							|  |  |  | #define EXPP_MAT_SSS_BACK_MAX			10.0
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* Python API function prototypes for the Material module.                   */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *M_Material_New( PyObject * self, PyObject * args, | 
					
						
							|  |  |  | 				 PyObject * keywords ); | 
					
						
							|  |  |  | static PyObject *M_Material_Get( PyObject * self, PyObject * args ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* The following string definitions are used for documentation strings.  In  */ | 
					
						
							|  |  |  | /* Python these will be written to the console when doing a                  */ | 
					
						
							|  |  |  | /* Blender.Material.__doc__                                                  */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static char M_Material_doc[] = "The Blender Material module"; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static char M_Material_New_doc[] = | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	"(name) - return a new material called 'name'\n\
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | () - return a new material called 'Mat'"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static char M_Material_Get_doc[] = | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	"(name) - return the material called 'name', None if not found.\n\
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | () - return a list of all materials in the current scene."; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* Python method structure definition for Blender.Material module:           */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | struct PyMethodDef M_Material_methods[] = { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	{"New", ( PyCFunction ) M_Material_New, METH_VARARGS | METH_KEYWORDS, | 
					
						
							|  |  |  | 	 M_Material_New_doc}, | 
					
						
							|  |  |  | 	{"Get", M_Material_Get, METH_VARARGS, M_Material_Get_doc}, | 
					
						
							|  |  |  | 	{"get", M_Material_Get, METH_VARARGS, M_Material_Get_doc}, | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	{NULL, NULL, 0, NULL} | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* Function:	M_Material_New                                               */ | 
					
						
							|  |  |  | /* Python equivalent:		Blender.Material.New                             */ | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *M_Material_New( PyObject * self, PyObject * args, | 
					
						
							|  |  |  | 				 PyObject * keywords ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-28 00:29:37 +00:00
										 |  |  | 	char *name = "Mat"; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	static char *kwlist[] = { "name", NULL }; | 
					
						
							| 
									
										
										
										
											2003-10-28 00:29:37 +00:00
										 |  |  | 	BPy_Material *pymat; /* for Material Data object wrapper in Python */ | 
					
						
							|  |  |  | 	Material *blmat; /* for actual Material Data we create in Blender */ | 
					
						
							|  |  |  | 	char buf[21]; | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( !PyArg_ParseTupleAndKeywords | 
					
						
							|  |  |  | 	    ( args, keywords, "|s", kwlist, &name ) ) | 
					
						
							|  |  |  | 		return ( EXPP_ReturnPyObjError | 
					
						
							|  |  |  | 			 ( PyExc_AttributeError, | 
					
						
							|  |  |  | 			   "expected string or nothing as argument" ) ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( strcmp( name, "Mat" ) != 0 )	/* use gave us a name ? */ | 
					
						
							|  |  |  | 		PyOS_snprintf( buf, sizeof( buf ), "%s", name ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	blmat = add_material( name );	/* first create the Material Data in Blender */ | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( blmat )		/* now create the wrapper obj in Python */ | 
					
						
							|  |  |  | 		pymat = ( BPy_Material * ) Material_CreatePyObject( blmat ); | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	else | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, | 
					
						
							|  |  |  | 						"couldn't create Material Data in Blender" ) ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	blmat->id.us = 0;	/* was incref'ed by add_material() above */ | 
					
						
							| 
									
										
										
										
											2003-07-04 02:56:07 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( pymat == NULL ) | 
					
						
							|  |  |  | 		return ( EXPP_ReturnPyObjError( PyExc_MemoryError, | 
					
						
							|  |  |  | 						"couldn't create Material Data object" ) ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return ( PyObject * ) pymat; | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Function:	M_Material_Get	 */ | 
					
						
							|  |  |  | /* Python equivalent:	Blender.Material.Get */ | 
					
						
							|  |  |  | /* Description:		Receives a string and returns the material whose */ | 
					
						
							|  |  |  | /*			name matches the string.	If no argument is */ | 
					
						
							|  |  |  | /*			passed in, a list with all materials in the	 */ | 
					
						
							|  |  |  | /*			current scene is returned.			 */ | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *M_Material_Get( PyObject * self, PyObject * args ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	char *name = NULL; | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	Material *mat_iter; | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( !PyArg_ParseTuple( args, "|s", &name ) ) | 
					
						
							|  |  |  | 		return ( EXPP_ReturnPyObjError( PyExc_TypeError, | 
					
						
							|  |  |  | 						"expected string argument (or nothing)" ) ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( name ) {		/* (name) - Search material by name */ | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 		mat_iter = ( Material * ) GetIdFromList( &( G.main->mat ), name ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 		if( mat_iter == NULL ) { /* Requested material doesn't exist */ | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 			char error_msg[64]; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 			PyOS_snprintf( error_msg, sizeof( error_msg ), | 
					
						
							|  |  |  | 				       "Material \"%s\" not found", name ); | 
					
						
							|  |  |  | 			return EXPP_ReturnPyObjError( PyExc_NameError, | 
					
						
							|  |  |  | 						      error_msg ); | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 		return Material_CreatePyObject( mat_iter ); | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	else {			/* () - return a list with all materials in the scene */ | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 		int index = 0; | 
					
						
							|  |  |  | 		PyObject *matlist, *pyobj; | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		matlist = PyList_New( BLI_countlist( &( G.main->mat ) ) ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		if( !matlist ) | 
					
						
							|  |  |  | 			return ( EXPP_ReturnPyObjError( PyExc_MemoryError, | 
					
						
							|  |  |  | 							"couldn't create PyList" ) ); | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		mat_iter = G.main->mat.first; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		while( mat_iter ) { | 
					
						
							|  |  |  | 			pyobj = Material_CreatePyObject( mat_iter ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-27 21:33:48 +00:00
										 |  |  | 			if( !pyobj ) { | 
					
						
							|  |  |  | 				Py_DECREF(matlist); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 				return ( EXPP_ReturnPyObjError | 
					
						
							|  |  |  | 					 ( PyExc_MemoryError, | 
					
						
							|  |  |  | 					   "couldn't create PyObject" ) ); | 
					
						
							| 
									
										
										
										
											2007-05-27 21:33:48 +00:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 			PyList_SET_ITEM( matlist, index, pyobj ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 			mat_iter = mat_iter->id.next; | 
					
						
							|  |  |  | 			index++; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 		return matlist; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | static PyObject *Material_ModesDict( void ) | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-08-17 14:26:00 +00:00
										 |  |  | 	PyObject *Modes = PyConstant_New(  ); | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( Modes ) { | 
					
						
							|  |  |  | 		BPy_constant *c = ( BPy_constant * ) Modes; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 		PyConstant_Insert(c, "TRACEABLE", PyInt_FromLong(MA_TRACEBLE)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "SHADOW", PyInt_FromLong(MA_SHADOW)); | 
					
						
							| 
									
										
										
										
											2005-12-15 21:54:00 +00:00
										 |  |  | 		PyConstant_Insert(c, "SHADOWBUF", PyInt_FromLong(MA_SHADBUF)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "TANGENTSTR", PyInt_FromLong(MA_TANGENT_STR)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "FULLOSA", PyInt_FromLong(MA_FULL_OSA)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "RAYBIAS", PyInt_FromLong(MA_RAYBIAS)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "TRANSPSHADOW", PyInt_FromLong(MA_SHADOW_TRA)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "RAMPCOL", PyInt_FromLong(MA_RAMP_COL)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "RAMPSPEC", PyInt_FromLong(MA_RAMP_SPEC)); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 		PyConstant_Insert(c, "SHADELESS", PyInt_FromLong(MA_SHLESS)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "WIRE", PyInt_FromLong(MA_WIRE)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "VCOL_LIGHT", PyInt_FromLong(MA_VERTEXCOL)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALO", PyInt_FromLong(MA_HALO)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "ZTRANSP", PyInt_FromLong(MA_ZTRA)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "VCOL_PAINT", PyInt_FromLong(MA_VERTEXCOLP)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "ZINVERT", PyInt_FromLong(MA_ZINV)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALORINGS", PyInt_FromLong(MA_HALO_RINGS)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "ENV", PyInt_FromLong(MA_ENV)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALOLINES", PyInt_FromLong(MA_HALO_LINES)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "ONLYSHADOW", PyInt_FromLong(MA_ONLYSHADOW)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALOXALPHA", PyInt_FromLong(MA_HALO_XALPHA)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALOSTAR", PyInt_FromLong(MA_STAR)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "TEXFACE", PyInt_FromLong(MA_FACETEXTURE)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALOTEX", PyInt_FromLong(MA_HALOTEX)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALOPUNO", PyInt_FromLong(MA_HALOPUNO)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "NOMIST", PyInt_FromLong(MA_NOMIST)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALOSHADE", PyInt_FromLong(MA_HALO_SHADE)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "HALOFLARE", PyInt_FromLong(MA_HALO_FLARE)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "RADIO", PyInt_FromLong(MA_RADIO)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "RAYMIRROR", PyInt_FromLong(MA_RAYMIRROR)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "ZTRA", PyInt_FromLong(MA_ZTRA)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "RAYTRANSP", PyInt_FromLong(MA_RAYTRANSP)); | 
					
						
							| 
									
										
										
										
											2006-09-06 13:15:05 +00:00
										 |  |  | 		PyConstant_Insert(c, "TANGENT_V", PyInt_FromLong(MA_TANGENT_V)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "NMAP_TS", PyInt_FromLong(MA_NORMAP_TANG)); | 
					
						
							| 
									
										
										
										
											2006-12-11 08:57:39 +00:00
										 |  |  | 		PyConstant_Insert(c, "GROUP_EXCLUSIVE", PyInt_FromLong(MA_GROUP_NOLAY)); | 
					
						
							| 
									
										
										
										
											2008-03-12 09:04:07 +00:00
										 |  |  | 		PyConstant_Insert(c, "TEXFACE_ALPHA", PyInt_FromLong(MA_FACETEXTURE_ALPHA)); | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return Modes; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_ShadersDict( void ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2005-08-17 14:26:00 +00:00
										 |  |  | 	PyObject *Shaders = PyConstant_New(  ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if( Shaders ) { | 
					
						
							|  |  |  | 		BPy_constant *c = ( BPy_constant * ) Shaders; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 		PyConstant_Insert(c, "DIFFUSE_LAMBERT", PyInt_FromLong(MA_DIFF_LAMBERT)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "DIFFUSE_ORENNAYAR", PyInt_FromLong(MA_DIFF_ORENNAYAR)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "DIFFUSE_TOON", PyInt_FromLong(MA_DIFF_TOON)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "DIFFUSE_MINNAERT", PyInt_FromLong(MA_DIFF_MINNAERT)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "SPEC_COOKTORR", PyInt_FromLong(MA_SPEC_COOKTORR)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "SPEC_PHONG", PyInt_FromLong(MA_SPEC_PHONG)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "SPEC_BLINN", PyInt_FromLong(MA_SPEC_BLINN)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "SPEC_TOON", PyInt_FromLong(MA_SPEC_TOON)); | 
					
						
							|  |  |  | 		PyConstant_Insert(c, "SPEC_WARDISO", PyInt_FromLong(MA_SPEC_WARDISO)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return Shaders; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Function:	Material_Init */ | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | PyObject *Material_Init( void ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	PyObject *submodule, *Modes, *Shaders; | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	if( PyType_Ready( &Material_Type ) < 0) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											2003-06-02 20:15:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	Modes = Material_ModesDict(  ); | 
					
						
							|  |  |  | 	Shaders = Material_ShadersDict(  ); | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	submodule = Py_InitModule3( "Blender.Material", | 
					
						
							|  |  |  | 				    M_Material_methods, M_Material_doc ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( Modes ) | 
					
						
							|  |  |  | 		PyModule_AddObject( submodule, "Modes", Modes ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	if( Shaders ) | 
					
						
							|  |  |  | 		PyModule_AddObject( submodule, "Shaders", Shaders ); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	PyModule_AddIntConstant( submodule, "RGB", IPOKEY_RGB ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "ALPHA", IPOKEY_ALPHA ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "HALOSIZE", IPOKEY_HALOSIZE ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "MODE", IPOKEY_MODE ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "ALLCOLOR", IPOKEY_ALLCOLOR ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "ALLMIRROR", IPOKEY_ALLMIRROR ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "OFS", IPOKEY_OFS ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "SIZE", IPOKEY_SIZE ); | 
					
						
							|  |  |  | 	PyModule_AddIntConstant( submodule, "ALLMAPPING", IPOKEY_ALLMAPPING ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return ( submodule ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /***************************/ | 
					
						
							|  |  |  | /*** The Material PyType ***/ | 
					
						
							|  |  |  | /***************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static PyObject *Matr_oldsetAdd( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetAlpha( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetAmb( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetEmit( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFilter( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFlareBoost( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFlareSeed( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFlareSize( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelMirr( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelMirrFac( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelTrans( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelTransFac( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetHaloSeed( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetHaloSize( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetHardness( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetIOR( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNFlares( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNLines( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNRings( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNStars( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRayMirr( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetMirrDepth( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRef( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpec( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecTransp( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSubSize( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetTransDepth( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetZOffset( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetIpo( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRGBCol( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecCol( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecShader( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetMirCol( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseShader( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRoughness( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecSize( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseSize( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecSmooth( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseSmooth( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseDarkness( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRefracIndex( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRms( BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Matr_oldsetTranslucency( BPy_Material * self, PyObject * args ); | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setIpo( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setMode( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setRGBCol( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSpecCol( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setMirCol( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | static int Material_setSssCol( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setColorComponent( BPy_Material * self, PyObject * value, | 
					
						
							|  |  |  | 							void * closure ); | 
					
						
							|  |  |  | static int Material_setAmb( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setEmit( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSpecTransp( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setAlpha( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2006-10-15 08:43:59 +00:00
										 |  |  | static int Material_setShadAlpha( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setRef( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSpec( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setZOffset( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | static int Material_setLightGroup( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setAdd( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setHaloSize( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFlareSize( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFlareBoost( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSubSize( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setHaloSeed( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFlareSeed( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setHardness( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setNFlares( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setNStars( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setNLines( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setNRings( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setRayMirr( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setMirrDepth( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFresnelMirr( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFresnelMirrFac( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setIOR( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setTransDepth( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFresnelTrans( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | static int Material_setGlossMirr( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setGlossMirrSamples( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setGlossTrans( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setSpecShader( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setDiffuseShader( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setRoughness( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSpecSize( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setDiffuseSize( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSpecSmooth( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setDiffuseSmooth( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setDiffuseDarkness( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setRefracIndex( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setRms( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setFilter( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setTranslucency( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | static int Material_setSssEnable( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssScale( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssRadius( BPy_Material * self, PyObject * value, void * type ); | 
					
						
							|  |  |  | static int Material_setSssIOR( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssError( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssColorBlend( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssTexScatter( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssFront( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssBack( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | static int Material_setSssBack( BPy_Material * self, PyObject * value ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static PyObject *Material_getColorComponent( BPy_Material * self, | 
					
						
							|  |  |  | 							void * closure ); | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | /*static int Material_setSeptex( BPy_Material * self, PyObject * value );
 | 
					
						
							|  |  |  |   static PyObject *Material_getSeptex( BPy_Material * self );*/ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Python BPy_Material methods declarations: */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getIpo( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getMode( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getRGBCol( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2003-07-13 16:28:17 +00:00
										 |  |  | /*static PyObject *Material_getAmbCol(BPy_Material *self);*/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getSpecCol( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getMirCol( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | static PyObject *Material_getSssCol( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getAmb( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getEmit( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getAlpha( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2006-10-15 08:43:59 +00:00
										 |  |  | static PyObject *Material_getShadAlpha( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getRef( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSpec( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSpecTransp( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getAdd( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getZOffset( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | static PyObject *Material_getLightGroup( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getHaloSize( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getHaloSeed( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getFlareSize( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getFlareSeed( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getFlareBoost( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSubSize( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getHardness( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getNFlares( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getNStars( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getNLines( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getNRings( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | /* Shader settings */ | 
					
						
							|  |  |  | static PyObject *Material_getSpecShader( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseShader( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getRoughness( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSpecSize( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseSize( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSpecSmooth( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseSmooth( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseDarkness( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getRefracIndex( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getRms( BPy_Material * self ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getRayMirr( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getMirrDepth( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getFresnelMirr( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getFresnelMirrFac( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getIOR( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getTransDepth( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getFresnelTrans( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getFresnelTransFac( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | static PyObject *Material_getGlossMirr( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getGlossMirrSamples( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getGlossTrans( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getGlossTransSamples( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | static PyObject *Material_getRigidBodyFriction( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getRigidBodyRestitution( BPy_Material * self ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | static PyObject *Material_getSssEnable( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssScale( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssRadius( BPy_Material * self, void * type ); | 
					
						
							|  |  |  | static PyObject *Material_getSssIOR( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssError( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssColorBlend( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssTexScatter( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssFront( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssBack( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getSssBack( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | static PyObject *Material_getFilter( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_getTranslucency( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getTextures( BPy_Material * self ); | 
					
						
							|  |  |  | static PyObject *Material_clearIpo( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_setTexture( BPy_Material * self, PyObject * args ); | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | static PyObject *Material_clearTexture( BPy_Material * self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2003-06-24 07:21:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | static PyObject *Material_getScriptLinks(BPy_Material *self, PyObject * value ); | 
					
						
							| 
									
										
										
										
											2005-04-21 19:44:52 +00:00
										 |  |  | static PyObject *Material_addScriptLink(BPy_Material * self, PyObject * args ); | 
					
						
							|  |  |  | static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args); | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ); | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | static PyObject *Material_getColorband( BPy_Material * self, void * type); | 
					
						
							|  |  |  | int Material_setColorband( BPy_Material * self, PyObject * value, void * type); | 
					
						
							| 
									
										
										
										
											2006-08-15 11:24:08 +00:00
										 |  |  | static PyObject *Material_copy( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Python BPy_Material methods table: */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2003-06-24 07:21:17 +00:00
										 |  |  | static PyMethodDef BPy_Material_methods[] = { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	/* name, method, flags, doc */ | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 	{"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "() - Return Material's name"}, | 
					
						
							|  |  |  | 	{"getIpo", ( PyCFunction ) Material_getIpo, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's ipo or None if not found"}, | 
					
						
							|  |  |  | 	{"getMode", ( PyCFunction ) Material_getMode, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's mode flags"}, | 
					
						
							|  |  |  | 	{"getRGBCol", ( PyCFunction ) Material_getRGBCol, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's rgb color triplet"}, | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | /*	{"getAmbCol", (PyCFunction)Material_getAmbCol, METH_NOARGS,
 | 
					
						
							|  |  |  | 			"() - Return Material's ambient color"},*/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	{"getSpecCol", ( PyCFunction ) Material_getSpecCol, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's specular color"}, | 
					
						
							|  |  |  | 	{"getMirCol", ( PyCFunction ) Material_getMirCol, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's mirror color"}, | 
					
						
							|  |  |  | 	{"getAmb", ( PyCFunction ) Material_getAmb, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's ambient color blend factor"}, | 
					
						
							|  |  |  | 	{"getEmit", ( PyCFunction ) Material_getEmit, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's emitting light intensity"}, | 
					
						
							|  |  |  | 	{"getAlpha", ( PyCFunction ) Material_getAlpha, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's alpha (transparency) value"}, | 
					
						
							|  |  |  | 	{"getRef", ( PyCFunction ) Material_getRef, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's reflectivity"}, | 
					
						
							|  |  |  | 	{"getSpec", ( PyCFunction ) Material_getSpec, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's specularity"}, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	/* Shader specific settings */ | 
					
						
							|  |  |  | 	{"getSpecShader", ( PyCFunction ) Material_getSpecShader, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's specular shader" }, | 
					
						
							|  |  |  | 	{"getDiffuseShader", ( PyCFunction ) Material_getDiffuseShader, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's diffuse shader" }, | 
					
						
							|  |  |  | 	 {"getRoughness", ( PyCFunction ) Material_getRoughness, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's Roughness (applies to the \"Oren Nayar\" Diffuse Shader only)" }, | 
					
						
							|  |  |  | 	{"getSpecSize", ( PyCFunction ) Material_getSpecSize, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's size of specular area (applies to the \"Toon\" Specular Shader only)" }, | 
					
						
							|  |  |  | 	{"getDiffuseSize", ( PyCFunction ) Material_getDiffuseSize, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only)" }, | 
					
						
							|  |  |  | 	{"getSpecSmooth", ( PyCFunction ) Material_getSpecSmooth, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's smoothing of specular area (applies to the \"Toon\" Diffuse Shader only)" }, | 
					
						
							|  |  |  | 	{"getDiffuseSmooth", ( PyCFunction ) Material_getDiffuseSmooth, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only)" }, | 
					
						
							|  |  |  | 	{"getDiffuseDarkness", ( PyCFunction ) Material_getDiffuseDarkness, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only)" }, | 
					
						
							|  |  |  | 	{"getRefracIndex", ( PyCFunction ) Material_getRefracIndex, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only)" },	  | 
					
						
							|  |  |  | 	{"getRms", ( PyCFunction ) Material_getRms, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Returns Material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only)" }, | 
					
						
							|  |  |  | 	/* End shader settings */ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	{"getSpecTransp", ( PyCFunction ) Material_getSpecTransp, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's specular transparency"}, | 
					
						
							|  |  |  | 	{"getAdd", ( PyCFunction ) Material_getAdd, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's glow factor"}, | 
					
						
							|  |  |  | 	{"getZOffset", ( PyCFunction ) Material_getZOffset, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's artificial offset for faces"}, | 
					
						
							|  |  |  | 	{"getHaloSize", ( PyCFunction ) Material_getHaloSize, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's halo size"}, | 
					
						
							|  |  |  | 	{"getHaloSeed", ( PyCFunction ) Material_getHaloSeed, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's seed for random ring dimension and line " | 
					
						
							|  |  |  | 	 "location in halos"}, | 
					
						
							|  |  |  | 	{"getFlareSize", ( PyCFunction ) Material_getFlareSize, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's (flare size)/(halo size) factor"}, | 
					
						
							|  |  |  | 	{"getFlareSeed", ( PyCFunction ) Material_getFlareSeed, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's flare offset in the seed table"}, | 
					
						
							|  |  |  | 	{"getFlareBoost", ( PyCFunction ) Material_getFlareBoost, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's flare boost"}, | 
					
						
							|  |  |  | 	{"getSubSize", ( PyCFunction ) Material_getSubSize, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's dimension of subflare, dots and circles"}, | 
					
						
							|  |  |  | 	{"getHardness", ( PyCFunction ) Material_getHardness, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's specular hardness"}, | 
					
						
							|  |  |  | 	{"getNFlares", ( PyCFunction ) Material_getNFlares, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's number of flares in halo"}, | 
					
						
							|  |  |  | 	{"getNStars", ( PyCFunction ) Material_getNStars, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's number of points in the halo stars"}, | 
					
						
							|  |  |  | 	{"getNLines", ( PyCFunction ) Material_getNLines, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's number of lines in halo"}, | 
					
						
							|  |  |  | 	{"getNRings", ( PyCFunction ) Material_getNRings, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's number of rings in halo"}, | 
					
						
							|  |  |  | 	{"getRayMirr", ( PyCFunction ) Material_getRayMirr, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return mount mirror"}, | 
					
						
							|  |  |  | 	{"getMirrDepth", ( PyCFunction ) Material_getMirrDepth, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return amount mirror depth"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"getFresnelMirr", ( PyCFunction ) Material_getFresnelMirr, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "() - Return fresnel power for refractions"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"getFresnelMirrFac", ( PyCFunction ) Material_getFresnelMirrFac, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "() - Return fresnel power for refractions factor"}, | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | 	{"getRayTransGloss", ( PyCFunction ) Material_getGlossTrans, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return amount refraction glossiness"}, | 
					
						
							| 
									
										
										
										
											2008-08-04 01:57:22 +00:00
										 |  |  | 	{"getRayTransGlossSamples", ( PyCFunction ) Material_getGlossTransSamples, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return number of sampels for transparent glossiness"}, | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | 	{"getRayMirrGlossSamples", ( PyCFunction ) Material_getGlossMirrSamples, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2008-08-04 01:57:22 +00:00
										 |  |  | 	 "() - Return number of sampels for mirror glossiness"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"getFilter", ( PyCFunction ) Material_getFilter, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "() - Return the amount of filtering when transparent raytrace is enabled"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"getTranslucency", ( PyCFunction ) Material_getTranslucency, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "() - Return the Translucency, the amount of diffuse shading of the back side"}, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	{"getIOR", ( PyCFunction ) Material_getIOR, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return IOR"}, | 
					
						
							|  |  |  | 	{"getTransDepth", ( PyCFunction ) Material_getTransDepth, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return amount inter-refractions"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"getFresnelTrans", ( PyCFunction ) Material_getFresnelTrans, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "() - Return fresnel power for refractions"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"getFresnelTransFac", ( PyCFunction ) Material_getFresnelTransFac, METH_NOARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "() - Return fresnel power for refractions factor"}, | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	{"getTextures", ( PyCFunction ) Material_getTextures, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return Material's texture list as a tuple"}, | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 	{"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(s) - Change Material's name"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setIpo", ( PyCFunction ) Matr_oldsetIpo, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(Blender Ipo) - Change Material's Ipo"}, | 
					
						
							|  |  |  | 	{"clearIpo", ( PyCFunction ) Material_clearIpo, METH_NOARGS, | 
					
						
							|  |  |  | 	 "(Blender Ipo) - Unlink Ipo from this Material"}, | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	{"insertIpoKey", ( PyCFunction ) Material_insertIpoKey, METH_VARARGS, | 
					
						
							|  |  |  | 	 "(Material Ipo Constant) - Insert IPO Key at current frame"},	  | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setMode", ( PyCFunction ) Matr_oldsetMode, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "([s[,s]]) - Set Material's mode flag(s)"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setRGBCol", ( PyCFunction ) Matr_oldsetRGBCol, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f,f,f or [f,f,f]) - Set Material's rgb color triplet"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /*	{"setAmbCol", (PyCFunction)Matr_oldsetAmbCol, METH_VARARGS,
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 			"(f,f,f or [f,f,f]) - Set Material's ambient color"},*/ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setSpecCol", ( PyCFunction ) Matr_oldsetSpecCol, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f,f,f or [f,f,f]) - Set Material's specular color"}, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	  | 
					
						
							|  |  |  | 	/* Shader spesific settings */ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setSpecShader", ( PyCFunction ) Matr_oldsetSpecShader, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(i) - Set the Material's specular shader" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setDiffuseShader", ( PyCFunction ) Matr_oldsetDiffuseShader, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(i) - Set the Material's diffuse shader" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	 {"setRoughness", ( PyCFunction ) Matr_oldsetRoughness, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's Roughness (applies to the \"Oren Nayar\" Diffuse Shader only)" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setSpecSize", ( PyCFunction ) Matr_oldsetSpecSize, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's size of specular area (applies to the \"Toon\" Specular Shader only)" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setDiffuseSize", ( PyCFunction ) Matr_oldsetDiffuseSize, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only)" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setSpecSmooth", ( PyCFunction ) Matr_oldsetSpecSmooth, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's smoothing of specular area (applies to the \"Toon\" Specular Shader only)" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setDiffuseSmooth", ( PyCFunction ) Matr_oldsetDiffuseSmooth, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only)" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setDiffuseDarkness", ( PyCFunction ) Matr_oldsetDiffuseDarkness, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only)" }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setRefracIndex", ( PyCFunction ) Matr_oldsetRefracIndex, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only)" },	  | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setRms", ( PyCFunction ) Matr_oldsetRms, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only)" }, | 
					
						
							|  |  |  | 	/* End shader settings */ | 
					
						
							|  |  |  | 	  | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setMirCol", ( PyCFunction ) Matr_oldsetMirCol, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f,f,f or [f,f,f]) - Set Material's mirror color"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setAmb", ( PyCFunction ) Matr_oldsetAmb, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set how much the Material's color is affected" | 
					
						
							|  |  |  | 	 " by \nthe global ambient colors - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setEmit", ( PyCFunction ) Matr_oldsetEmit, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's emitting light intensity - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setAlpha", ( PyCFunction ) Matr_oldsetAlpha, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's alpha (transparency) - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setRef", ( PyCFunction ) Matr_oldsetRef, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's reflectivity - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setSpec", ( PyCFunction ) Matr_oldsetSpec, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's specularity - [0.0, 2.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setSpecTransp", ( PyCFunction ) Matr_oldsetSpecTransp, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's specular transparency - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setAdd", ( PyCFunction ) Matr_oldsetAdd, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's glow factor - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setZOffset", ( PyCFunction ) Matr_oldsetZOffset, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's artificial offset - [0.0, 10.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setHaloSize", ( PyCFunction ) Matr_oldsetHaloSize, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's halo size - [0.0, 100.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setHaloSeed", ( PyCFunction ) Matr_oldsetHaloSeed, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set Material's halo seed - [0, 255]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFlareSize", ( PyCFunction ) Matr_oldsetFlareSize, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's factor: (flare size)/(halo size) - [0.1, 25.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFlareSeed", ( PyCFunction ) Matr_oldsetFlareSeed, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set Material's flare seed - [0, 255]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFlareBoost", ( PyCFunction ) Matr_oldsetFlareBoost, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's flare boost - [0.1, 10.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setSubSize", ( PyCFunction ) Matr_oldsetSubSize, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set Material's dimension of subflare," | 
					
						
							|  |  |  | 	 " dots and circles - [0.1, 25.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setHardness", ( PyCFunction ) Matr_oldsetHardness, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set Material's hardness - [1, 255 (127 if halo mode is ON)]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setNFlares", ( PyCFunction ) Matr_oldsetNFlares, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set Material's number of flares in halo - [1, 32]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setNStars", ( PyCFunction ) Matr_oldsetNStars, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set Material's number of stars in halo - [3, 50]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setNLines", ( PyCFunction ) Matr_oldsetNLines, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set Material's number of lines in halo - [0, 250]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setNRings", ( PyCFunction ) Matr_oldsetNRings, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set Material's number of rings in halo - [0, 24]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setRayMirr", ( PyCFunction ) Matr_oldsetRayMirr, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set amount mirror - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setMirrDepth", ( PyCFunction ) Matr_oldsetMirrDepth, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set amount inter-reflections - [0, 10]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFresnelMirr", ( PyCFunction ) Matr_oldsetFresnelMirr, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set fresnel power for mirror - [0.0, 5.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFresnelMirrFac", ( PyCFunction ) Matr_oldsetFresnelMirrFac, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set blend fac for mirror fresnel - [1.0, 5.0]"}, | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | 	{"setRayTransGloss", ( PyCFunction ) Material_setGlossTrans, METH_VARARGS, | 
					
						
							|  |  |  | 	 "(f) - Set amount refraction glossiness - [0.0, 1.0]"}, | 
					
						
							| 
									
										
										
										
											2008-08-04 01:57:22 +00:00
										 |  |  | 	{"setRayTransGlossSamples", ( PyCFunction ) Material_setGlossTransSamples, METH_VARARGS, | 
					
						
							|  |  |  | 	 "(i) - Set number transparent gloss samples - [1, 1024]"}, | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | 	{"setRayMirrGlossSamples", ( PyCFunction ) Material_setGlossMirrSamples, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2008-08-04 01:57:22 +00:00
										 |  |  | 	 "(i) - Set number mirror gloss samples - [1, 1024]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFilter", ( PyCFunction ) Matr_oldsetFilter, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the amount of filtering when transparent raytrace is enabled"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setTranslucency", ( PyCFunction ) Matr_oldsetTranslucency, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 	 "(f) - Set the Translucency, the amount of diffuse shading of the back side"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setIOR", ( PyCFunction ) Matr_oldsetIOR, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set IOR - [1.0, 3.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setTransDepth", ( PyCFunction ) Matr_oldsetTransDepth, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(i) - Set amount inter-refractions - [0, 10]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFresnelTrans", ( PyCFunction ) Matr_oldsetFresnelTrans, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(f) - Set fresnel power for refractions - [0.0, 5.0]"}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"setFresnelTransFac", ( PyCFunction ) Matr_oldsetFresnelTransFac, METH_VARARGS, | 
					
						
							|  |  |  | 	 "(f) - Set fresnel power for refractions factor- [0.0, 5.0]"}, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	{"setTexture", ( PyCFunction ) Material_setTexture, METH_VARARGS, | 
					
						
							|  |  |  | 	 "(n,tex,texco=0,mapto=0) - Set numbered texture to tex"}, | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | 	{"clearTexture", ( PyCFunction ) Material_clearTexture, METH_O, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(n) - Remove texture from numbered slot"}, | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | 	{"getScriptLinks", ( PyCFunction ) Material_getScriptLinks, METH_O, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	 "(eventname) - Get a list of this material's scriptlinks (Text names) " | 
					
						
							|  |  |  | 	 "of the given type\n" | 
					
						
							| 
									
										
										
										
											2005-05-27 05:39:41 +00:00
										 |  |  | 	 "(eventname) - string: FrameChanged, Redraw or Render."}, | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	{"addScriptLink", ( PyCFunction ) Material_addScriptLink, METH_VARARGS, | 
					
						
							|  |  |  | 	 "(text, evt) - Add a new material scriptlink.\n" | 
					
						
							|  |  |  | 	 "(text) - string: an existing Blender Text name;\n" | 
					
						
							| 
									
										
										
										
											2005-05-27 05:39:41 +00:00
										 |  |  | 	 "(evt) string: FrameChanged, Redraw or Render."}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"clearScriptLinks", ( PyCFunction ) Material_clearScriptLinks, METH_VARARGS, | 
					
						
							| 
									
										
										
										
											2005-04-21 19:44:52 +00:00
										 |  |  | 	 "() - Delete all scriptlinks from this material.\n" | 
					
						
							|  |  |  | 	 "([s1<,s2,s3...>]) - Delete specified scriptlinks from this material."}, | 
					
						
							| 
									
										
										
										
											2006-08-15 11:24:08 +00:00
										 |  |  | 	{"__copy__", ( PyCFunction ) Material_copy, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return a copy of the material."}, | 
					
						
							| 
									
										
										
										
											2007-03-14 03:01:24 +00:00
										 |  |  | 	{"copy", ( PyCFunction ) Material_copy, METH_NOARGS, | 
					
						
							|  |  |  | 	 "() - Return a copy of the material."}, | 
					
						
							| 
									
										
										
										
											2004-06-06 22:42:51 +00:00
										 |  |  | 	{NULL, NULL, 0, NULL} | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* Python attributes get/set structure:                                      */ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyGetSetDef BPy_Material_getseters[] = { | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 	GENERIC_LIB_GETSETATTR, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"add", | 
					
						
							|  |  |  | 	 (getter)Material_getAdd, (setter)Material_setAdd, | 
					
						
							|  |  |  | 	 "Strength of the add effect", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"alpha", | 
					
						
							|  |  |  | 	 (getter)Material_getAlpha, (setter)Material_setAlpha, | 
					
						
							|  |  |  | 	 "Alpha setting ", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2006-10-15 08:43:59 +00:00
										 |  |  | 	{"shadAlpha", | 
					
						
							|  |  |  | 	 (getter)Material_getShadAlpha, (setter)Material_setShadAlpha, | 
					
						
							|  |  |  | 	 "Shadow Alpha setting", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"amb", | 
					
						
							|  |  |  | 	 (getter)Material_getAmb, (setter)Material_setAmb, | 
					
						
							|  |  |  | 	 "Amount of global ambient color material receives", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"diffuseDarkness", | 
					
						
							|  |  |  | 	 (getter)Material_getDiffuseDarkness, (setter)Material_setDiffuseDarkness, | 
					
						
							|  |  |  | 	 "Material's diffuse darkness (\"Minnaert\" diffuse shader only)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"diffuseShader", | 
					
						
							|  |  |  | 	 (getter)Material_getDiffuseShader, (setter)Material_setDiffuseShader, | 
					
						
							|  |  |  | 	 "Diffuse shader type", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"diffuseSize", | 
					
						
							|  |  |  | 	 (getter)Material_getDiffuseSize, (setter)Material_setDiffuseSize, | 
					
						
							|  |  |  | 	 "Material's diffuse area size (\"Toon\" diffuse shader only)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"diffuseSmooth", | 
					
						
							|  |  |  | 	 (getter)Material_getDiffuseSmooth, (setter)Material_setDiffuseSmooth, | 
					
						
							|  |  |  | 	 "Material's diffuse area smoothing (\"Toon\" diffuse shader only)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"emit", | 
					
						
							|  |  |  | 	 (getter)Material_getEmit, (setter)Material_setEmit, | 
					
						
							|  |  |  | 	 "Amount of light the material emits", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"filter", | 
					
						
							|  |  |  | 	 (getter)Material_getFilter, (setter)Material_setFilter, | 
					
						
							|  |  |  | 	 "Amount of filtering when transparent raytrace is enabled", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"flareBoost", | 
					
						
							|  |  |  | 	 (getter)Material_getFlareBoost, (setter)Material_setFlareBoost, | 
					
						
							|  |  |  | 	 "Flare's extra strength", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"flareSeed", | 
					
						
							|  |  |  | 	 (getter)Material_getFlareSeed, (setter)Material_setFlareSeed, | 
					
						
							|  |  |  | 	 "Offset in the flare seed table", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"flareSize", | 
					
						
							|  |  |  | 	 (getter)Material_getFlareSize, (setter)Material_setFlareSize, | 
					
						
							|  |  |  | 	 "Ratio of flare size to halo size", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"fresnelDepth", | 
					
						
							|  |  |  | 	 (getter)Material_getFresnelMirr, (setter)Material_setFresnelMirr, | 
					
						
							|  |  |  | 	 "Power of Fresnel for mirror reflection", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"fresnelDepthFac", | 
					
						
							|  |  |  | 	 (getter)Material_getFresnelMirrFac, (setter)Material_setFresnelMirrFac, | 
					
						
							|  |  |  | 	 "Blending factor for Fresnel mirror", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"fresnelTrans", | 
					
						
							|  |  |  | 	 (getter)Material_getFresnelTrans, (setter)Material_setFresnelTrans, | 
					
						
							|  |  |  | 	 "Power of Fresnel for transparency", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"fresnelTransFac", | 
					
						
							|  |  |  | 	 (getter)Material_getFresnelTransFac, (setter)Material_setFresnelTransFac, | 
					
						
							|  |  |  | 	 "Blending factor for Fresnel transparency", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | 	 {"rbFriction", | 
					
						
							|  |  |  | 	 (getter)Material_getRigidBodyFriction, (setter)Material_setRigidBodyFriction, | 
					
						
							|  |  |  | 	 "Rigid Body Friction coefficient", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	 {"rbRestitution", | 
					
						
							|  |  |  | 	 (getter)Material_getRigidBodyRestitution, (setter)Material_setRigidBodyRestitution, | 
					
						
							|  |  |  | 	 "Rigid Body Restitution coefficient", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"haloSeed", | 
					
						
							|  |  |  | 	 (getter)Material_getHaloSeed, (setter)Material_setHaloSeed, | 
					
						
							|  |  |  | 	 "Randomizes halo ring dimension and line location", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"haloSize", | 
					
						
							|  |  |  | 	 (getter)Material_getHaloSize, (setter)Material_setHaloSize, | 
					
						
							|  |  |  | 	 "Dimension of the halo", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"hard", | 
					
						
							|  |  |  | 	 (getter)Material_getHardness, (setter)Material_setHardness, | 
					
						
							|  |  |  | 	 "Specularity hardness", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"IOR", | 
					
						
							|  |  |  | 	 (getter)Material_getIOR, (setter)Material_setIOR, | 
					
						
							|  |  |  | 	 "Angular index of refraction for raytrace", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"ipo", | 
					
						
							|  |  |  | 	 (getter)Material_getIpo, (setter)Material_setIpo, | 
					
						
							|  |  |  | 	 "Material Ipo data", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"mirCol", | 
					
						
							|  |  |  | 	 (getter)Material_getMirCol, (setter)Material_setMirCol, | 
					
						
							|  |  |  | 	 "Mirror RGB color triplet", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"mirR", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Mirror color red component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_MIRR }, | 
					
						
							|  |  |  | 	{"mirG", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Mirror color green component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_MIRG }, | 
					
						
							|  |  |  | 	{"mirB", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Mirror color blue component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_MIRB }, | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	{"sssCol", | 
					
						
							|  |  |  | 	 (getter)Material_getSssCol, (setter)Material_setSssCol, | 
					
						
							|  |  |  | 	 "Sss RGB color triplet", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sssR", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "SSS color red component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_SSSR }, | 
					
						
							|  |  |  | 	{"sssG", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "SSS color green component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_SSSG }, | 
					
						
							|  |  |  | 	{"sssB", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "SSS color blue component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_SSSB }, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"mode", | 
					
						
							|  |  |  | 	 (getter)Material_getMode, (setter)Material_setMode, | 
					
						
							|  |  |  | 	 "Material mode bitmask", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"nFlares", | 
					
						
							|  |  |  | 	 (getter)Material_getNFlares, (setter)Material_setNFlares, | 
					
						
							|  |  |  | 	 "Number of subflares with halo", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"nLines", | 
					
						
							|  |  |  | 	 (getter)Material_getNLines, (setter)Material_setNLines, | 
					
						
							|  |  |  | 	 "Number of star-shaped lines with halo", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"nRings", | 
					
						
							|  |  |  | 	 (getter)Material_getNRings, (setter)Material_setNRings, | 
					
						
							|  |  |  | 	 "Number of rings with halo", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"nStars", | 
					
						
							|  |  |  | 	 (getter)Material_getNStars, (setter)Material_setNStars, | 
					
						
							|  |  |  | 	 "Number of star points with halo", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"rayMirr", | 
					
						
							|  |  |  | 	 (getter)Material_getRayMirr, (setter)Material_setRayMirr, | 
					
						
							|  |  |  | 	 "Mirror reflection amount for raytrace", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"rayMirrDepth", | 
					
						
							|  |  |  | 	 (getter)Material_getMirrDepth, (setter)Material_setMirrDepth, | 
					
						
							|  |  |  | 	 "Amount of raytrace inter-reflections", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"ref", | 
					
						
							|  |  |  | 	 (getter)Material_getRef, (setter)Material_setRef, | 
					
						
							|  |  |  | 	 "Amount of reflections (for shader)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"refracIndex", | 
					
						
							|  |  |  | 	 (getter)Material_getRefracIndex, (setter)Material_setRefracIndex, | 
					
						
							|  |  |  | 	 "Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  |  	{"glossMir", | 
					
						
							|  |  |  | 	 (getter)Material_getGlossMirr, (setter)Material_setGlossMirr, | 
					
						
							|  |  |  | 	 "Reflection glossiness", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sampGlossMir", | 
					
						
							|  |  |  | 	 (getter)Material_getGlossMirrSamples, (setter)Material_setGlossMirrSamples, | 
					
						
							|  |  |  | 	 "Reflection glossiness", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"glossTra", | 
					
						
							|  |  |  | 	 (getter)Material_getGlossTrans, (setter)Material_setGlossTrans, | 
					
						
							|  |  |  | 	 "Refraction glossiness", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sampGlossTra", | 
					
						
							|  |  |  | 	 (getter)Material_getGlossMirrSamples, (setter)Material_setGlossMirrSamples, | 
					
						
							|  |  |  | 	 "Refraction glossiness", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"rgbCol", | 
					
						
							|  |  |  | 	 (getter)Material_getRGBCol, (setter)Material_setRGBCol, | 
					
						
							|  |  |  | 	 "Diffuse RGB color triplet", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"rms", | 
					
						
							|  |  |  | 	 (getter)Material_getRms, (setter)Material_setRms, | 
					
						
							|  |  |  | 	 "Material's surface slope standard deviation (\"WardIso\" specular shader only)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"roughness", | 
					
						
							|  |  |  | 	 (getter)Material_getRoughness, (setter)Material_setRoughness, | 
					
						
							|  |  |  | 	 "Material's roughness (\"Oren Nayar\" diffuse shader only)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"spec", | 
					
						
							|  |  |  | 	 (getter)Material_getSpec, (setter)Material_setSpec, | 
					
						
							|  |  |  | 	 "Degree of specularity", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"specCol", | 
					
						
							|  |  |  | 	 (getter)Material_getSpecCol, (setter)Material_setSpecCol, | 
					
						
							|  |  |  | 	 "Specular RGB color triplet", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"specR", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Specular color red component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_SPECR }, | 
					
						
							|  |  |  | 	{"specG", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Specular color green component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_SPECG }, | 
					
						
							|  |  |  | 	{"specB", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Specular color blue component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_SPECB }, | 
					
						
							|  |  |  | 	{"specTransp", | 
					
						
							|  |  |  | 	 (getter)Material_getSpecTransp, (setter)Material_setSpecTransp, | 
					
						
							|  |  |  | 	 "Makes specular areas opaque on transparent materials", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"specShader", | 
					
						
							|  |  |  | 	 (getter)Material_getSpecShader, (setter)Material_setSpecShader, | 
					
						
							|  |  |  | 	 "Specular shader type", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"specSize", | 
					
						
							|  |  |  | 	 (getter)Material_getSpecSize, (setter)Material_setSpecSize, | 
					
						
							|  |  |  | 	 "Material's specular area size (\"Toon\" specular shader only)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"specSmooth", | 
					
						
							|  |  |  | 	 (getter)Material_getSpecSmooth, (setter)Material_setSpecSmooth, | 
					
						
							|  |  |  | 	 "Sets the smoothness of specular toon area", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"subSize", | 
					
						
							|  |  |  | 	 (getter)Material_getSubSize, (setter)Material_setSubSize, | 
					
						
							|  |  |  | 	 "Dimension of subflares, dots and circles", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"transDepth", | 
					
						
							|  |  |  | 	 (getter)Material_getTransDepth, (setter)Material_setTransDepth, | 
					
						
							|  |  |  | 	 "Amount of refractions for raytrace", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"translucency", | 
					
						
							|  |  |  | 	 (getter)Material_getTranslucency, (setter)Material_setTranslucency, | 
					
						
							|  |  |  | 	 "Amount of diffuse shading of the back side", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"zOffset", | 
					
						
							|  |  |  | 	 (getter)Material_getZOffset, (setter)Material_setZOffset, | 
					
						
							|  |  |  | 	 "Artificial offset in the Z buffer (for Ztransp option)", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | 	{"lightGroup", | 
					
						
							|  |  |  | 	 (getter)Material_getLightGroup, (setter)Material_setLightGroup, | 
					
						
							|  |  |  | 	 "Set the light group for this material", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{"R", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Diffuse color red component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_R }, | 
					
						
							|  |  |  | 	{"G", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Diffuse color green component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_G }, | 
					
						
							|  |  |  | 	{"B", | 
					
						
							|  |  |  | 	 (getter)Material_getColorComponent, (setter)Material_setColorComponent, | 
					
						
							|  |  |  | 	 "Diffuse color blue component", | 
					
						
							|  |  |  | 	 (void *) EXPP_MAT_COMP_B }, | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 	{"colorbandDiffuse", | 
					
						
							|  |  |  | 	 (getter)Material_getColorband, (setter)Material_setColorband, | 
					
						
							| 
									
										
										
										
											2007-06-23 12:39:22 +00:00
										 |  |  | 	 "The diffuse colorband for this material", | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 	 (void *) 0}, | 
					
						
							|  |  |  | 	{"colorbandSpecular", | 
					
						
							|  |  |  | 	 (getter)Material_getColorband, (setter)Material_setColorband, | 
					
						
							| 
									
										
										
										
											2007-06-23 12:39:22 +00:00
										 |  |  | 	 "The specular colorband for this material", | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 	 (void *) 1}, | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* SSS settings */ | 
					
						
							|  |  |  | 	{"enableSSS", | 
					
						
							|  |  |  | 	 (getter)Material_getSssEnable, (setter)Material_setSssEnable, | 
					
						
							|  |  |  | 	 "if true, SSS will be rendered for this material", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sssScale", | 
					
						
							|  |  |  | 	 (getter)Material_getSssScale, (setter)Material_setSssScale, | 
					
						
							|  |  |  | 	 "object scale for sss", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sssRadiusRed", | 
					
						
							|  |  |  | 	 (getter)Material_getSssRadius, (setter)Material_setSssRadius, | 
					
						
							|  |  |  | 	 "Mean red scattering path length", | 
					
						
							|  |  |  | 	 (void *) 0}, | 
					
						
							|  |  |  | 	{"sssRadiusGreen", | 
					
						
							|  |  |  | 	 (getter)Material_getSssRadius, (setter)Material_setSssRadius, | 
					
						
							|  |  |  | 	 "Mean red scattering path length", | 
					
						
							|  |  |  | 	 (void *) 1}, | 
					
						
							|  |  |  | 	{"sssRadiusBlue", | 
					
						
							|  |  |  | 	 (getter)Material_getSssRadius, (setter)Material_setSssRadius, | 
					
						
							|  |  |  | 	 "Mean red scattering path length", | 
					
						
							| 
									
										
										
										
											2008-06-01 01:49:11 +00:00
										 |  |  | 	 (void *) 2}, | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	{"sssIOR", | 
					
						
							|  |  |  | 	 (getter)Material_getSssIOR, (setter)Material_setSssIOR, | 
					
						
							|  |  |  | 	 "index of refraction", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sssError", | 
					
						
							|  |  |  | 	 (getter)Material_getSssError, (setter)Material_setSssError, | 
					
						
							|  |  |  | 	 "Error", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sssColorBlend", | 
					
						
							|  |  |  | 	 (getter)Material_getSssColorBlend, (setter)Material_setSssColorBlend, | 
					
						
							|  |  |  | 	 "Blend factor for SSS Colors", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sssTextureScatter", | 
					
						
							|  |  |  | 	 (getter)Material_getSssTexScatter, (setter)Material_setSssTexScatter, | 
					
						
							|  |  |  | 	 "Texture scattering factor", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2008-06-01 13:18:26 +00:00
										 |  |  | 	{"sssFront", | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	 (getter)Material_getSssFront, (setter)Material_setSssFront, | 
					
						
							|  |  |  | 	 "Front scattering weight", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							|  |  |  | 	{"sssBack", | 
					
						
							|  |  |  | 	 (getter)Material_getSssBack, (setter)Material_setSssBack, | 
					
						
							|  |  |  | 	 "Back scattering weight", | 
					
						
							|  |  |  | 	 NULL}, | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	{NULL,NULL,NULL,NULL,NULL}  /* Sentinel */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Python Material_Type callback function prototypes: */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static void Material_dealloc( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2006-10-06 16:48:28 +00:00
										 |  |  | static int Material_compare( BPy_Material * a, BPy_Material * b); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_repr( BPy_Material * self ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* Python Material_Type structure definition:                                */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | PyTypeObject Material_Type = { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	PyObject_HEAD_INIT( NULL )  /* required py macro */ | 
					
						
							|  |  |  | 	0,                          /* ob_size */ | 
					
						
							|  |  |  | 	/*  For printing, in format "<module>.<name>" */ | 
					
						
							|  |  |  | 	"Blender Material",         /* char *tp_name; */ | 
					
						
							|  |  |  | 	sizeof( BPy_Material ),     /* int tp_basicsize; */ | 
					
						
							|  |  |  | 	0,                          /* tp_itemsize;  For allocation */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Methods to implement standard operations */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	( destructor ) Material_dealloc,/* destructor tp_dealloc; */ | 
					
						
							|  |  |  | 	NULL,                       /* printfunc tp_print; */ | 
					
						
							|  |  |  | 	NULL,                       /* getattrfunc tp_getattr; */ | 
					
						
							|  |  |  | 	NULL,                       /* setattrfunc tp_setattr; */ | 
					
						
							| 
									
										
										
										
											2006-10-06 16:48:28 +00:00
										 |  |  | 	( cmpfunc ) Material_compare,/* cmpfunc tp_compare; */ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	( reprfunc ) Material_repr, /* reprfunc tp_repr; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Method suites for standard classes */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	NULL,                       /* PyNumberMethods *tp_as_number; */ | 
					
						
							|  |  |  | 	NULL,                       /* PySequenceMethods *tp_as_sequence; */ | 
					
						
							|  |  |  | 	NULL,                       /* PyMappingMethods *tp_as_mapping; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* More standard operations (here for binary compatibility) */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-26 02:10:24 +00:00
										 |  |  | 	( hashfunc ) GenericLib_hash,	/* hashfunc tp_hash; */ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	NULL,                       /* ternaryfunc tp_call; */ | 
					
						
							|  |  |  | 	NULL,                       /* reprfunc tp_str; */ | 
					
						
							|  |  |  | 	NULL,                       /* getattrofunc tp_getattro; */ | 
					
						
							|  |  |  | 	NULL,                       /* setattrofunc tp_setattro; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Functions to access object as input/output buffer */ | 
					
						
							|  |  |  | 	NULL,                       /* PyBufferProcs *tp_as_buffer; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /*** Flags to define presence of optional/expanded features ***/ | 
					
						
							|  |  |  | 	Py_TPFLAGS_DEFAULT,         /* long tp_flags; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	NULL,                       /*  char *tp_doc;  Documentation string */ | 
					
						
							|  |  |  |   /*** Assigned meaning in release 2.0 ***/ | 
					
						
							|  |  |  | 	/* call function for all accessible objects */ | 
					
						
							|  |  |  | 	NULL,                       /* traverseproc tp_traverse; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* delete references to contained objects */ | 
					
						
							|  |  |  | 	NULL,                       /* inquiry tp_clear; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /***  Assigned meaning in release 2.1 ***/ | 
					
						
							|  |  |  |   /*** rich comparisons ***/ | 
					
						
							|  |  |  | 	NULL,                       /* richcmpfunc tp_richcompare; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /***  weak reference enabler ***/ | 
					
						
							|  |  |  | 	0,                          /* long tp_weaklistoffset; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /*** Added in release 2.2 ***/ | 
					
						
							|  |  |  | 	/*   Iterators */ | 
					
						
							|  |  |  | 	NULL,                       /* getiterfunc tp_iter; */ | 
					
						
							|  |  |  | 	NULL,                       /* iternextfunc tp_iternext; */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /*** Attribute descriptor and subclassing stuff ***/ | 
					
						
							|  |  |  | 	BPy_Material_methods,       /* struct PyMethodDef *tp_methods; */ | 
					
						
							|  |  |  | 	NULL,                       /* struct PyMemberDef *tp_members; */ | 
					
						
							|  |  |  | 	BPy_Material_getseters,     /* struct PyGetSetDef *tp_getset; */ | 
					
						
							|  |  |  | 	NULL,                       /* struct _typeobject *tp_base; */ | 
					
						
							|  |  |  | 	NULL,                       /* PyObject *tp_dict; */ | 
					
						
							|  |  |  | 	NULL,                       /* descrgetfunc tp_descr_get; */ | 
					
						
							|  |  |  | 	NULL,                       /* descrsetfunc tp_descr_set; */ | 
					
						
							|  |  |  | 	0,                          /* long tp_dictoffset; */ | 
					
						
							|  |  |  | 	NULL,                       /* initproc tp_init; */ | 
					
						
							|  |  |  | 	NULL,                       /* allocfunc tp_alloc; */ | 
					
						
							|  |  |  | 	NULL,                       /* newfunc tp_new; */ | 
					
						
							|  |  |  | 	/*  Low-level free-memory routine */ | 
					
						
							|  |  |  | 	NULL,                       /* freefunc tp_free;  */ | 
					
						
							|  |  |  | 	/* For PyObject_IS_GC */ | 
					
						
							|  |  |  | 	NULL,                       /* inquiry tp_is_gc;  */ | 
					
						
							|  |  |  | 	NULL,                       /* PyObject *tp_bases; */ | 
					
						
							|  |  |  | 	/* method resolution order */ | 
					
						
							|  |  |  | 	NULL,                       /* PyObject *tp_mro;  */ | 
					
						
							|  |  |  | 	NULL,                       /* PyObject *tp_cache; */ | 
					
						
							|  |  |  | 	NULL,                       /* PyObject *tp_subclasses; */ | 
					
						
							|  |  |  | 	NULL,                       /* PyObject *tp_weaklist; */ | 
					
						
							|  |  |  | 	NULL | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Function:	Material_dealloc          */ | 
					
						
							| 
									
										
										
										
											2003-06-24 07:21:17 +00:00
										 |  |  | /* Description: This is a callback function for the BPy_Material type. It is */ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /*		the destructor function.				 */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static void Material_dealloc( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	Py_DECREF( self->col ); | 
					
						
							|  |  |  | 	Py_DECREF( self->amb ); | 
					
						
							|  |  |  | 	Py_DECREF( self->spec ); | 
					
						
							|  |  |  | 	Py_DECREF( self->mir ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	Py_DECREF( self->sss ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	PyObject_DEL( self ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Function:	Material_CreatePyObject		*/ | 
					
						
							|  |  |  | /* Description: Create a new BPy_Material from an  existing */ | 
					
						
							|  |  |  | /*		 Blender material structure.	 */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | PyObject *Material_CreatePyObject( struct Material *mat ) | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	BPy_Material *pymat; | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	float *col[3], *amb[3], *spec[3], *mir[3], *sss[3]; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	pymat = ( BPy_Material * ) PyObject_NEW( BPy_Material, | 
					
						
							|  |  |  | 						 &Material_Type ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( !pymat ) | 
					
						
							|  |  |  | 		return EXPP_ReturnPyObjError( PyExc_MemoryError, | 
					
						
							|  |  |  | 					      "couldn't create BPy_Material object" ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	pymat->material = mat; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	col[0] = &mat->r; | 
					
						
							|  |  |  | 	col[1] = &mat->g; | 
					
						
							|  |  |  | 	col[2] = &mat->b; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	amb[0] = &mat->ambr; | 
					
						
							|  |  |  | 	amb[1] = &mat->ambg; | 
					
						
							|  |  |  | 	amb[2] = &mat->ambb; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	spec[0] = &mat->specr; | 
					
						
							|  |  |  | 	spec[1] = &mat->specg; | 
					
						
							|  |  |  | 	spec[2] = &mat->specb; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	mir[0] = &mat->mirr; | 
					
						
							|  |  |  | 	mir[1] = &mat->mirg; | 
					
						
							|  |  |  | 	mir[2] = &mat->mirb; | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	sss[0] = &mat->sss_col[0]; | 
					
						
							|  |  |  | 	sss[1] = &mat->sss_col[1]; | 
					
						
							|  |  |  | 	sss[2] = &mat->sss_col[2]; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	pymat->col = ( BPy_rgbTuple * ) rgbTuple_New( col ); | 
					
						
							|  |  |  | 	pymat->amb = ( BPy_rgbTuple * ) rgbTuple_New( amb ); | 
					
						
							|  |  |  | 	pymat->spec = ( BPy_rgbTuple * ) rgbTuple_New( spec ); | 
					
						
							|  |  |  | 	pymat->mir = ( BPy_rgbTuple * ) rgbTuple_New( mir ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	pymat->sss = ( BPy_rgbTuple * ) rgbTuple_New( sss ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return ( PyObject * ) pymat; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-07-30 21:15:41 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Function:		Material_FromPyObject	 */ | 
					
						
							|  |  |  | /* Description: This function returns the Blender material from the given */ | 
					
						
							|  |  |  | /*		PyObject.	 */ | 
					
						
							| 
									
										
										
										
											2003-07-30 21:15:41 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | Material *Material_FromPyObject( PyObject * pyobj ) | 
					
						
							| 
									
										
										
										
											2003-07-30 21:15:41 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return ( ( BPy_Material * ) pyobj )->material; | 
					
						
							| 
									
										
										
										
											2003-07-30 21:15:41 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getIpo( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-10-26 16:51:53 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-28 00:29:37 +00:00
										 |  |  | 	Ipo *ipo = self->material->ipo; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-27 05:04:20 +00:00
										 |  |  | 	if( !ipo ) | 
					
						
							|  |  |  | 		Py_RETURN_NONE; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return Ipo_CreatePyObject( ipo ); | 
					
						
							| 
									
										
										
										
											2003-10-26 16:51:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getMode( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->mode ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getRGBCol( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return rgbTuple_getCol( self->col ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-07-13 16:28:17 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2003-06-24 07:21:17 +00:00
										 |  |  | static PyObject *Material_getAmbCol(BPy_Material *self) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	return rgbTuple_getCol(self->amb); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2003-07-13 16:28:17 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getSpecCol( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return rgbTuple_getCol( self->spec ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getMirCol( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return rgbTuple_getCol( self->mir ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | static PyObject *Material_getSssCol( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return rgbTuple_getCol( self->sss ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | static PyObject *Material_getSpecShader( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->spec_shader ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseShader( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->diff_shader ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getRoughness( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->roughness ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getSpecSize( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->param[2] ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseSize( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->param[0] ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getSpecSmooth( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->param[3] ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseSmooth( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->param[1] ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getDiffuseDarkness( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->darkness ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getRefracIndex( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->refrac ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | static PyObject *Material_getRms( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->rms ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getAmb( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->amb ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getEmit( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->emit ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getAlpha( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->alpha ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-15 08:43:59 +00:00
										 |  |  | static PyObject *Material_getShadAlpha( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->shad_alpha ); | 
					
						
							| 
									
										
										
										
											2006-10-15 08:43:59 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getRef( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->ref ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getSpec( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->spec ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getSpecTransp( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->spectra ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getAdd( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->add ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getZOffset( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->zoffs ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | static PyObject *Material_getLightGroup( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return Group_CreatePyObject( self->material->group ); | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getHaloSize( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->hasize ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getFlareSize( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->flaresize ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getFlareBoost( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->flareboost ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getSubSize( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->subsize ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getHaloSeed( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->seed1 ); | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getFlareSeed( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->seed2 ); | 
					
						
							| 
									
										
										
										
											2003-07-12 18:02:54 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getHardness( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->har ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getNFlares( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->flarec ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getNStars( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->starc ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getNLines( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->linec ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getNRings( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->ringc ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getRayMirr( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->ray_mirror ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getMirrDepth( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->ray_depth ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getFresnelMirr( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->fresnel_mir ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getFresnelMirrFac( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->fresnel_mir_i ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getFilter( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->filter ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getTranslucency( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->translucency ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getIOR( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->ang ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getTransDepth( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyInt_FromLong( ( long ) self->material->ray_depth_tra ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getFresnelTrans( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->fresnel_tra ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getFresnelTransFac( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->fresnel_tra_i ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | static PyObject *Material_getGlossMirr( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->gloss_mir ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getGlossMirrSamples( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyInt_FromLong( ( long ) self->material->samp_gloss_mir ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getGlossTrans( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->gloss_tra ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getGlossTransSamples( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyInt_FromLong( ( long ) self->material->samp_gloss_tra ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | static PyObject* Material_getRigidBodyFriction( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->friction ); | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getRigidBodyRestitution( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) self->material->reflect ); | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | /* SSS */ | 
					
						
							|  |  |  | static PyObject* Material_getSssEnable( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_getBitfield( &self->material->sss_flag, MA_DIFF_SSS, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getSssScale( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->sss_scale ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getSssRadius( BPy_Material * self, void * type ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-04-17 21:14:55 +00:00
										 |  |  | 	return PyFloat_FromDouble( ( double ) (self->material->sss_radius[GET_INT_FROM_POINTER(type)]) ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | static PyObject* Material_getSssIOR( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->sss_ior); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getSssError( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->sss_error); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getSssColorBlend( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->sss_colfac); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getSssTexScatter( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->sss_texfac); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getSssFront( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->sss_front); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject* Material_getSssBack( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyFloat_FromDouble( ( double ) self->material->sss_back); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getTextures( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	int i; | 
					
						
							|  |  |  | 	struct MTex *mtex; | 
					
						
							| 
									
										
										
										
											2004-12-04 21:49:02 +00:00
										 |  |  | 	PyObject *t[MAX_MTEX]; | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	PyObject *tuple; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	/* build a texture list */ | 
					
						
							| 
									
										
										
										
											2004-12-04 21:49:02 +00:00
										 |  |  | 	for( i = 0; i < MAX_MTEX; ++i ) { | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 		mtex = self->material->mtex[i]; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if( mtex ) { | 
					
						
							|  |  |  | 			t[i] = MTex_CreatePyObject( mtex ); | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			Py_INCREF( Py_None ); | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 			t[i] = Py_None; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* turn the array into a tuple */ | 
					
						
							| 
									
										
										
										
											2005-08-21 15:00:17 +00:00
										 |  |  | 	tuple = Py_BuildValue( "NNNNNNNNNN", t[0], t[1], t[2], t[3], | 
					
						
							|  |  |  | 			       t[4], t[5], t[6], t[7], t[8], t[9] ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( !tuple ) | 
					
						
							|  |  |  | 		return EXPP_ReturnPyObjError( PyExc_MemoryError, | 
					
						
							|  |  |  | 					      "Material_getTextures: couldn't create PyTuple" ); | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	return tuple; | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * this should accept a Py_None argument and just delete the Ipo link | 
					
						
							|  |  |  |  * (as Lamp_clearIpo() does) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setIpo( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-10-28 00:29:37 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 	return GenericLib_assignData(value, (void **) &self->material->ipo, 0, 1, ID_IP, ID_MA); | 
					
						
							| 
									
										
										
										
											2003-10-28 00:29:37 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* 
 | 
					
						
							|  |  |  |  *  Material_insertIpoKey( key ) | 
					
						
							|  |  |  |  *   inserts Material IPO key at current frame | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int key = 0, map; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | 	if( !PyArg_ParseTuple( args, "i", &( key ) ) ) | 
					
						
							|  |  |  | 		return ( EXPP_ReturnPyObjError( PyExc_AttributeError, | 
					
						
							|  |  |  | 						"expected int argument" ) );  | 
					
						
							|  |  |  |     				 | 
					
						
							|  |  |  | 	map = texchannel_to_adrcode(self->material->texact); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	if(key==IPOKEY_RGB || key==IPOKEY_ALLCOLOR) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_ALPHA || key==IPOKEY_ALLCOLOR) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_HALOSIZE || key==IPOKEY_ALLCOLOR) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_MODE || key==IPOKEY_ALLCOLOR) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_ALLCOLOR) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_ALLMIRROR) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_OFS || key==IPOKEY_ALLMAPPING) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_SIZE || key==IPOKEY_ALLMAPPING) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if(key==IPOKEY_ALLMAPPING) { | 
					
						
							| 
									
										
										
										
											2007-09-18 06:41:29 +00:00
										 |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, 0); | 
					
						
							|  |  |  | 		insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, 0); | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	allspace(REMAKEIPO, 0); | 
					
						
							|  |  |  | 	EXPP_allqueue(REDRAWIPO, 0); | 
					
						
							|  |  |  | 	EXPP_allqueue(REDRAWVIEW3D, 0); | 
					
						
							|  |  |  | 	EXPP_allqueue(REDRAWACTION, 0); | 
					
						
							|  |  |  | 	EXPP_allqueue(REDRAWNLA, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-27 05:04:20 +00:00
										 |  |  | 	Py_RETURN_NONE; | 
					
						
							| 
									
										
										
										
											2005-03-20 18:28:36 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setMode( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int param; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-01 05:41:23 +00:00
										 |  |  | 	if( !PyInt_Check( value ) ) { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 		char errstr[128]; | 
					
						
							| 
									
										
										
										
											2005-12-15 21:54:00 +00:00
										 |  |  | 		sprintf ( errstr , "expected int bitmask of 0x%08x", MA_MODE_MASK ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 		return EXPP_ReturnIntError( PyExc_TypeError, errstr ); | 
					
						
							| 
									
										
										
										
											2005-05-27 05:39:41 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	param = PyInt_AS_LONG ( value ); | 
					
						
							| 
									
										
										
										
											2005-05-27 05:39:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-15 21:54:00 +00:00
										 |  |  | 	if ( ( param & MA_MODE_MASK ) != param ) | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 		return EXPP_ReturnIntError( PyExc_ValueError, | 
					
						
							|  |  |  | 						"invalid bit(s) set in mask" ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-15 21:54:00 +00:00
										 |  |  | 	self->material->mode &= ( MA_RAMP_COL | MA_RAMP_SPEC ); | 
					
						
							|  |  |  | 	self->material->mode |= param & ~( MA_RAMP_COL | MA_RAMP_SPEC ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return 0; | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setRGBCol( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return rgbTuple_setCol( self->col, value ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-07-13 16:28:17 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static PyObject *Material_setAmbCol (BPy_Material *self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return rgbTuple_setCol(self->amb, value); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2003-07-13 16:28:17 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSpecCol( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return rgbTuple_setCol( self->spec, value ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setMirCol( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return rgbTuple_setCol( self->mir, value ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | static int Material_setSssCol( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return rgbTuple_setCol( self->sss, value ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setColorComponent( BPy_Material * self, PyObject * value, | 
					
						
							|  |  |  | 							void * closure ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	float param; | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	if( !PyNumber_Check ( value ) ) | 
					
						
							|  |  |  | 		return EXPP_ReturnIntError( PyExc_TypeError, | 
					
						
							|  |  |  | 						"expected float argument in [0.0,1.0]" ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-26 14:46:14 +00:00
										 |  |  | 	param = (float)PyFloat_AsDouble( value ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	param = EXPP_ClampFloat( param, EXPP_MAT_COL_MIN, EXPP_MAT_COL_MAX ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-17 21:14:55 +00:00
										 |  |  | 	switch ( GET_INT_FROM_POINTER(closure) ) { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_R: | 
					
						
							|  |  |  | 		self->material->r = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_G: | 
					
						
							|  |  |  | 		self->material->g = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_B: | 
					
						
							|  |  |  | 		self->material->b = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_SPECR: | 
					
						
							|  |  |  | 		self->material->specr = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_SPECG: | 
					
						
							|  |  |  | 		self->material->specg = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_SPECB: | 
					
						
							|  |  |  | 		self->material->specb = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_MIRR: | 
					
						
							|  |  |  | 		self->material->mirr = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_MIRG: | 
					
						
							|  |  |  | 		self->material->mirg = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_MIRB: | 
					
						
							|  |  |  | 		self->material->mirb = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_SSSR: | 
					
						
							|  |  |  | 		self->material->sss_col[0] = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_SSSG: | 
					
						
							|  |  |  | 		self->material->sss_col[1] = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	case EXPP_MAT_COMP_SSSB: | 
					
						
							|  |  |  | 		self->material->sss_col[2] = param; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	return EXPP_ReturnIntError( PyExc_RuntimeError, | 
					
						
							|  |  |  | 				"unknown color component specified" ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | /*#define setFloatWrapper(val, min, max) {return EXPP_setFloatClamped ( value, &self->material->#val, #min, #max}*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setAmb( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | {  | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->amb, | 
					
						
							|  |  |  | 								EXPP_MAT_AMB_MIN, | 
					
						
							|  |  |  | 					       		EXPP_MAT_AMB_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setEmit( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->emit, | 
					
						
							|  |  |  | 								EXPP_MAT_EMIT_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_EMIT_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setSpecTransp( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->spectra, | 
					
						
							|  |  |  | 								EXPP_MAT_SPECTRA_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SPECTRA_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setAlpha( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->alpha, | 
					
						
							|  |  |  | 								EXPP_MAT_ALPHA_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_ALPHA_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-15 08:43:59 +00:00
										 |  |  | static int Material_setShadAlpha( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->shad_alpha, | 
					
						
							|  |  |  | 								EXPP_MAT_ALPHA_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_ALPHA_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setRef( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->ref, | 
					
						
							|  |  |  | 								EXPP_MAT_REF_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_REF_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setSpec( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->spec, | 
					
						
							|  |  |  | 								EXPP_MAT_SPEC_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SPEC_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setZOffset( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->zoffs, | 
					
						
							|  |  |  | 		   						EXPP_MAT_ZOFFS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_ZOFFS_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | static int Material_setLightGroup( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return GenericLib_assignData(value, (void **) &self->material->group, NULL, 1, ID_GR, 0); | 
					
						
							| 
									
										
										
										
											2006-08-13 10:13:19 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setAdd( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->add, | 
					
						
							|  |  |  | 								EXPP_MAT_ADD_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_ADD_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setHaloSize( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->hasize, | 
					
						
							|  |  |  | 		   						EXPP_MAT_HALOSIZE_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_HALOSIZE_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFlareSize( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->flaresize, | 
					
						
							|  |  |  | 								EXPP_MAT_FLARESIZE_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FLARESIZE_MAX ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFlareBoost( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->flareboost, | 
					
						
							|  |  |  | 								EXPP_MAT_FLAREBOOST_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FLAREBOOST_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setSubSize( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->subsize, | 
					
						
							|  |  |  | 								EXPP_MAT_SUBSIZE_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SUBSIZE_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setHaloSeed( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->seed1, | 
					
						
							|  |  |  | 								EXPP_MAT_HALOSEED_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_HALOSEED_MAX, 'b' ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFlareSeed( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->seed2, | 
					
						
							|  |  |  | 								EXPP_MAT_FLARESEED_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FLARESEED_MAX, 'b' ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setHardness( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->har, | 
					
						
							|  |  |  | 		   						EXPP_MAT_HARD_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_HARD_MAX, 'h' ); | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setNFlares( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->flarec, | 
					
						
							|  |  |  | 								EXPP_MAT_NFLARES_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_NFLARES_MAX, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-08-01 03:06:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setNStars( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->starc, | 
					
						
							|  |  |  | 								EXPP_MAT_NSTARS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_NSTARS_MAX, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setNLines( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->linec, | 
					
						
							|  |  |  | 								EXPP_MAT_NLINES_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_NLINES_MAX, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setNRings( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->ringc, | 
					
						
							|  |  |  | 		   						EXPP_MAT_NRINGS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_NRINGS_MAX, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setRayMirr( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->ray_mirror, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYMIRR_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYMIRR_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setMirrDepth( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->ray_depth, | 
					
						
							|  |  |  | 								EXPP_MAT_MIRRDEPTH_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_MIRRDEPTH_MAX, 'h' ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFresnelMirr( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->fresnel_mir, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELMIRR_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELMIRR_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFresnelMirrFac( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->fresnel_mir_i, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELMIRRFAC_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELMIRRFAC_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setIOR( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->ang, | 
					
						
							|  |  |  | 								EXPP_MAT_IOR_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_IOR_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setTransDepth( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->ray_depth_tra, | 
					
						
							|  |  |  | 								EXPP_MAT_TRANSDEPTH_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_TRANSDEPTH_MAX, 'h' ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFresnelTrans( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->fresnel_tra, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELTRANS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELTRANS_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->fresnel_tra_i, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELTRANSFAC_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FRESNELTRANSFAC_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-06 18:57:24 +00:00
										 |  |  | static int Material_setGlossMirr( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->gloss_mir, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYMIRRGLOSS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYMIRRGLOSS_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setGlossMirrSamples( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->samp_gloss_mir, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setGlossTrans( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->gloss_tra, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYTRANSPGLOSS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYTRANSPGLOSS_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueClamped ( value, &self->material->samp_gloss_tra, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-02 20:59:29 +00:00
										 |  |  | static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->friction, | 
					
						
							|  |  |  | 								0.f, | 
					
						
							|  |  |  | 								100.f ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->reflect, | 
					
						
							|  |  |  | 								0.f, | 
					
						
							|  |  |  | 								1.f ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setSpecShader( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueRange( value, &self->material->spec_shader, | 
					
						
							|  |  |  | 								MA_SPEC_COOKTORR, | 
					
						
							|  |  |  | 								MA_SPEC_WARDISO, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setDiffuseShader( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setIValueRange( value, &self->material->diff_shader, | 
					
						
							|  |  |  | 								MA_DIFF_LAMBERT, | 
					
						
							|  |  |  | 								MA_DIFF_MINNAERT, 'h' ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setRoughness( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->roughness, | 
					
						
							|  |  |  | 								EXPP_MAT_ROUGHNESS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_ROUGHNESS_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setSpecSize( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->param[2], | 
					
						
							|  |  |  | 								EXPP_MAT_SPECSIZE_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SPECSIZE_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setDiffuseSize( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->param[0], | 
					
						
							|  |  |  | 								EXPP_MAT_DIFFUSESIZE_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_DIFFUSESIZE_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setSpecSmooth( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->param[3], | 
					
						
							|  |  |  | 								EXPP_MAT_SPECSMOOTH_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SPECSMOOTH_MAX ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setDiffuseSmooth( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->param[1], | 
					
						
							|  |  |  | 								EXPP_MAT_DIFFUSESMOOTH_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_DIFFUSESMOOTH_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setDiffuseDarkness( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->darkness, | 
					
						
							|  |  |  | 								EXPP_MAT_DIFFUSE_DARKNESS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_DIFFUSE_DARKNESS_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setRefracIndex( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->refrac, | 
					
						
							|  |  |  | 								EXPP_MAT_REFRACINDEX_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_REFRACINDEX_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setRms( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->rms, | 
					
						
							|  |  |  | 								EXPP_MAT_RMS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_RMS_MAX ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setFilter( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->filter, | 
					
						
							|  |  |  | 								EXPP_MAT_FILTER_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_FILTER_MAX ); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | static int Material_setTranslucency( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->translucency, | 
					
						
							|  |  |  | 								EXPP_MAT_TRANSLUCENCY_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_TRANSLUCENCY_MAX ); | 
					
						
							| 
									
										
										
										
											2004-09-14 20:03:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | /* SSS */ | 
					
						
							|  |  |  | static int Material_setSssEnable( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setBitfield( value, &self->material->sss_flag, MA_DIFF_SSS, 'h' ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssScale( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_scale, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_SCALE_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_SCALE_MAX); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssRadius( BPy_Material * self, PyObject * value, void *type ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-04-17 21:14:55 +00:00
										 |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_radius[GET_INT_FROM_POINTER(type)], | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 								EXPP_MAT_SSS_RADIUS_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_RADIUS_MAX); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssIOR( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_ior, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_IOR_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_IOR_MAX); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssError( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_error, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_IOR_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_IOR_MAX); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssColorBlend( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_colfac, | 
					
						
							|  |  |  | 								0.0, | 
					
						
							|  |  |  | 								1.0); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssTexScatter( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_texfac, | 
					
						
							|  |  |  | 								0.0, | 
					
						
							|  |  |  | 								1.0); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssFront( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_front, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_FRONT_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_FRONT_MAX); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int Material_setSssBack( BPy_Material * self, PyObject * value ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setFloatClamped ( value, &self->material->sss_back, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_BACK_MIN, | 
					
						
							|  |  |  | 								EXPP_MAT_SSS_BACK_MAX); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_setTexture( BPy_Material * self, PyObject * args ) | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	int texnum; | 
					
						
							|  |  |  | 	PyObject *pytex; | 
					
						
							|  |  |  | 	Tex *bltex; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	int texco = TEXCO_ORCO, mapto = MAP_COL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if( !PyArg_ParseTuple( args, "iO!|ii", &texnum, &Texture_Type, &pytex, | 
					
						
							|  |  |  | 			       &texco, &mapto ) ) | 
					
						
							|  |  |  | 		return EXPP_ReturnPyObjError( PyExc_TypeError, | 
					
						
							| 
									
										
										
										
											2004-12-04 21:49:02 +00:00
										 |  |  | 					      "expected int in [0,9] and Texture" ); | 
					
						
							|  |  |  | 	if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) ) | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		return EXPP_ReturnPyObjError( PyExc_TypeError, | 
					
						
							| 
									
										
										
										
											2004-12-04 21:49:02 +00:00
										 |  |  | 					      "expected int in [0,9] and Texture" ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	bltex = Texture_FromPyObject( pytex ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if( !self->material->mtex[texnum] ) { | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 		/* there isn't an mtex for this slot so we need to make one */ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		self->material->mtex[texnum] = add_mtex(  ); | 
					
						
							|  |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 		/* we already had a texture here so deal with the old one first */ | 
					
						
							|  |  |  | 		self->material->mtex[texnum]->tex->id.us--; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	self->material->mtex[texnum]->tex = bltex; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	id_us_plus( &bltex->id ); | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | 	self->material->mtex[texnum]->texco = (short)texco; | 
					
						
							|  |  |  | 	self->material->mtex[texnum]->mapto = (short)mapto; | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-27 05:04:20 +00:00
										 |  |  | 	Py_RETURN_NONE; | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | static PyObject *Material_clearTexture( BPy_Material * self, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | 	int texnum = (int)PyInt_AsLong(value); | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	struct MTex *mtex; | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | 	/* non ints will be -1 */ | 
					
						
							| 
									
										
										
										
											2004-12-04 21:49:02 +00:00
										 |  |  | 	if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) ) | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		return EXPP_ReturnPyObjError( PyExc_TypeError, | 
					
						
							| 
									
										
										
										
											2004-12-04 21:49:02 +00:00
										 |  |  | 					      "expected int in [0,9]" ); | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 	mtex = self->material->mtex[texnum]; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( mtex ) { | 
					
						
							|  |  |  | 		if( mtex->tex ) | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 			mtex->tex->id.us--; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		MEM_freeN( mtex ); | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 		self->material->mtex[texnum] = NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-27 05:04:20 +00:00
										 |  |  | 	Py_RETURN_NONE; | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* mat.addScriptLink */ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_addScriptLink( BPy_Material * self, PyObject * args ) | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	Material *mat = self->material; | 
					
						
							|  |  |  | 	ScriptLink *slink = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	slink = &( mat )->scriptlink; | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-21 19:44:52 +00:00
										 |  |  | 	return EXPP_addScriptLink( slink, args, 0 ); | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* mat.clearScriptLinks */ | 
					
						
							| 
									
										
										
										
											2005-04-21 19:44:52 +00:00
										 |  |  | static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args ) | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	Material *mat = self->material; | 
					
						
							|  |  |  | 	ScriptLink *slink = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	slink = &( mat )->scriptlink; | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-21 19:44:52 +00:00
										 |  |  | 	return EXPP_clearScriptLinks( slink, args ); | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* mat.getScriptLinks */ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_getScriptLinks( BPy_Material * self, | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | 					  PyObject * value ) | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	Material *mat = self->material; | 
					
						
							|  |  |  | 	ScriptLink *slink = NULL; | 
					
						
							|  |  |  | 	PyObject *ret = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	slink = &( mat )->scriptlink; | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	/* can't this just return?  EXP_getScriptLinks() returns a PyObject*
 | 
					
						
							|  |  |  | 	 * or NULL anyway */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-16 12:24:41 +00:00
										 |  |  | 	ret = EXPP_getScriptLinks( slink, value, 0 ); | 
					
						
							| 
									
										
										
										
											2004-06-24 09:43:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( ret ) | 
					
						
							|  |  |  | 		return ret; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											2003-11-23 17:46:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-08-15 11:24:08 +00:00
										 |  |  | /* mat.__copy__ */ | 
					
						
							|  |  |  | static PyObject *Material_copy( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	BPy_Material *pymat; /* for Material Data object wrapper in Python */ | 
					
						
							|  |  |  | 	Material *blmat; /* for actual Material Data we create in Blender */ | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	blmat = copy_material( self->material );	/* first copy the Material Data in Blender */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if( blmat )		/* now create the wrapper obj in Python */ | 
					
						
							|  |  |  | 		pymat = ( BPy_Material * ) Material_CreatePyObject( blmat ); | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, | 
					
						
							|  |  |  | 						"couldn't create Material Data in Blender" ) ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	blmat->id.us = 0;	/* was incref'ed by add_material() above */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if( pymat == NULL ) | 
					
						
							|  |  |  | 		return ( EXPP_ReturnPyObjError( PyExc_MemoryError, | 
					
						
							|  |  |  | 						"couldn't create Material Data object" ) ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return ( PyObject * ) pymat; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-06 16:48:28 +00:00
										 |  |  | /* mat_a==mat_b or mat_a!=mat_b*/ | 
					
						
							|  |  |  | static int Material_compare( BPy_Material * a, BPy_Material * b ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return ( a->material == b->material) ? 0 : -1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* Function:	Material_repr	 */ | 
					
						
							|  |  |  | /* Description: This is a callback function for the BPy_Material type. It  */ | 
					
						
							|  |  |  | /*		 builds a meaninful string to represent material objects.   */ | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static PyObject *Material_repr( BPy_Material * self ) | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return PyString_FromFormat( "[Material \"%s\"]", | 
					
						
							|  |  |  | 				    self->material->id.name + 2 ); | 
					
						
							| 
									
										
										
										
											2003-05-28 04:36:18 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | /* These functions are used here and in in Texture.c						*/ | 
					
						
							|  |  |  | /*****************************************************************************/ | 
					
						
							|  |  |  | PyObject *EXPP_PyList_fromColorband( ColorBand *coba ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	short i; | 
					
						
							|  |  |  | 	PyObject *cbls; | 
					
						
							|  |  |  | 	PyObject *colls; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	if (!coba) | 
					
						
							|  |  |  | 		return PyList_New( 0 ); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	cbls = PyList_New( coba->tot ); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	for (i=0; i < coba->tot; i++) { | 
					
						
							|  |  |  | 		colls = PyList_New( 5 ); | 
					
						
							|  |  |  | 		PyList_SET_ITEM( colls, 0, PyFloat_FromDouble(coba->data[i].r) ); | 
					
						
							|  |  |  | 		PyList_SET_ITEM( colls, 1, PyFloat_FromDouble(coba->data[i].g) ); | 
					
						
							|  |  |  | 		PyList_SET_ITEM( colls, 2, PyFloat_FromDouble(coba->data[i].b) ); | 
					
						
							|  |  |  | 		PyList_SET_ITEM( colls, 3, PyFloat_FromDouble(coba->data[i].a) ); | 
					
						
							|  |  |  | 		PyList_SET_ITEM( colls, 4, PyFloat_FromDouble(coba->data[i].pos) ); | 
					
						
							|  |  |  | 		PyList_SET_ITEM(cbls, i, colls); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return cbls; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* make sure you coba is not none before calling this */ | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | int EXPP_Colorband_fromPyList( ColorBand **coba, PyObject * value ) | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	short totcol, i; | 
					
						
							|  |  |  | 	PyObject *colseq; | 
					
						
							|  |  |  | 	PyObject *pyflt; | 
					
						
							|  |  |  | 	float f; | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 	if ( !PySequence_Check( value )  ) | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 		return ( EXPP_ReturnIntError( PyExc_TypeError, | 
					
						
							|  |  |  | 				"Colorband must be a sequence" ) ); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	totcol = PySequence_Size(value); | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 	if ( totcol > 31) | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 		return ( EXPP_ReturnIntError( PyExc_ValueError, | 
					
						
							|  |  |  | 				"Colorband must be between 1 and 31 in length" ) ); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 	if (totcol==0) { | 
					
						
							|  |  |  | 		MEM_freeN(*coba); | 
					
						
							|  |  |  | 		*coba = NULL; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	if (!*coba) | 
					
						
							|  |  |  | 		*coba = MEM_callocN( sizeof(ColorBand), "colorband"); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 	for (i=0; i<totcol; i++) { | 
					
						
							|  |  |  | 		colseq = PySequence_GetItem( value, i ); | 
					
						
							|  |  |  | 		if ( !PySequence_Check( colseq ) || PySequence_Size( colseq ) != 5) { | 
					
						
							|  |  |  | 			Py_DECREF ( colseq ); | 
					
						
							|  |  |  | 			return ( EXPP_ReturnIntError( PyExc_ValueError, | 
					
						
							|  |  |  | 				"Colorband colors must be sequences of 5 floats" ) ); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		for (i=0; i<5; i++) { | 
					
						
							|  |  |  | 			pyflt = PySequence_GetItem( colseq, i ); | 
					
						
							|  |  |  | 			if (!PyNumber_Check(pyflt)) { | 
					
						
							|  |  |  | 				return ( EXPP_ReturnIntError( PyExc_ValueError, | 
					
						
							|  |  |  | 					"Colorband colors must be sequences of 5 floats" ) ); | 
					
						
							|  |  |  | 				Py_DECREF ( pyflt ); | 
					
						
							|  |  |  | 				Py_DECREF ( colseq ); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			Py_DECREF ( pyflt ); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		Py_DECREF ( colseq ); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	/* ok, continue - should check for 5 floats, will ignore non floats for now */ | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 	(*coba)->tot = totcol; | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 	for (i=0; i<totcol; i++) { | 
					
						
							|  |  |  | 		colseq = PySequence_GetItem( value, i ); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		pyflt = PySequence_GetItem( colseq, 0 );  | 
					
						
							|  |  |  | 		f = (float)PyFloat_AsDouble( pyflt ); | 
					
						
							|  |  |  | 		CLAMP(f, 0.0, 1.0); | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 		(*coba)->data[i].r = f; | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 		Py_DECREF ( pyflt ); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		pyflt = PySequence_GetItem( colseq, 1 );  | 
					
						
							|  |  |  | 		f = (float)PyFloat_AsDouble( pyflt ); | 
					
						
							|  |  |  | 		CLAMP(f, 0.0, 1.0); | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 		(*coba)->data[i].g = f; | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 		Py_DECREF ( pyflt ); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		pyflt = PySequence_GetItem( colseq, 2 );  | 
					
						
							|  |  |  | 		f = (float)PyFloat_AsDouble( pyflt ); | 
					
						
							|  |  |  | 		CLAMP(f, 0.0, 1.0); | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 		(*coba)->data[i].b = f; | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 		Py_DECREF ( pyflt ); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		pyflt = PySequence_GetItem( colseq, 3 );  | 
					
						
							|  |  |  | 		f = (float)PyFloat_AsDouble( pyflt ); | 
					
						
							|  |  |  | 		CLAMP(f, 0.0, 1.0); | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 		(*coba)->data[i].a = f; | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 		Py_DECREF ( pyflt ); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		pyflt = PySequence_GetItem( colseq, 4 );  | 
					
						
							|  |  |  | 		f = (float)PyFloat_AsDouble( pyflt ); | 
					
						
							|  |  |  | 		CLAMP(f, 0.0, 1.0); | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 		(*coba)->data[i].pos = f; | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 		Py_DECREF ( pyflt ); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		Py_DECREF ( colseq ); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | /* These functions are used in NMesh.c and Object.c	 */ | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | /*****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | PyObject *EXPP_PyList_fromMaterialList( Material ** matlist, int len, int all ) | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	PyObject *list; | 
					
						
							|  |  |  | 	int i; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	list = PyList_New( 0 ); | 
					
						
							|  |  |  | 	if( !matlist ) | 
					
						
							|  |  |  | 		return list; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	for( i = 0; i < len; i++ ) { | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 		Material *mat = matlist[i]; | 
					
						
							|  |  |  | 		PyObject *ob; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		if( mat ) { | 
					
						
							|  |  |  | 			ob = Material_CreatePyObject( mat ); | 
					
						
							|  |  |  | 			PyList_Append( list, ob ); | 
					
						
							|  |  |  | 			Py_DECREF( ob );	/* because Append increfs */ | 
					
						
							|  |  |  | 		} else if( all ) {	/* return NULL mats (empty slots) as Py_None */ | 
					
						
							|  |  |  | 			PyList_Append( list, Py_None ); | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	return list; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | Material **EXPP_newMaterialList_fromPyList( PyObject * list ) | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	int i, len; | 
					
						
							|  |  |  | 	BPy_Material *pymat = 0; | 
					
						
							|  |  |  | 	Material *mat; | 
					
						
							|  |  |  | 	Material **matlist; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	len = PySequence_Length( list ); | 
					
						
							|  |  |  | 	if( len > 16 ) | 
					
						
							|  |  |  | 		len = 16; | 
					
						
							| 
									
										
										
										
											2004-11-07 15:05:35 +00:00
										 |  |  | 	else if( len <= 0 ) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	matlist = EXPP_newMaterialList( len ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	for( i = 0; i < len; i++ ) { | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		pymat = ( BPy_Material * ) PySequence_GetItem( list, i ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-15 01:09:14 +00:00
										 |  |  | 		if( BPy_Material_Check( ( PyObject * ) pymat ) ) { | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 			mat = pymat->material; | 
					
						
							|  |  |  | 			matlist[i] = mat; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		} else if( ( PyObject * ) pymat == Py_None ) { | 
					
						
							| 
									
										
										
										
											2004-07-20 08:16:46 +00:00
										 |  |  | 			matlist[i] = NULL; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		} else {	/* error; illegal type in material list */ | 
					
						
							|  |  |  | 			Py_DECREF( pymat ); | 
					
						
							|  |  |  | 			MEM_freeN( matlist ); | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 			return NULL; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		Py_DECREF( pymat ); | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	return matlist; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | Material **EXPP_newMaterialList( int len ) | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	Material **matlist = | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		( Material ** ) MEM_mallocN( len * sizeof( Material * ), | 
					
						
							|  |  |  | 					     "MaterialList" ); | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	return matlist; | 
					
						
							| 
									
										
										
										
											2003-05-31 04:43:10 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | int EXPP_releaseMaterialList( Material ** matlist, int len ) | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	int i; | 
					
						
							| 
									
										
										
										
											2004-07-20 08:16:46 +00:00
										 |  |  | 	Material *mat; | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( ( len < 0 ) || ( len > MAXMAT ) ) { | 
					
						
							|  |  |  | 		printf( "illegal matindex!\n" ); | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	for( i = 0; i < len; i++ ) { | 
					
						
							|  |  |  | 		mat = matlist[i]; | 
					
						
							|  |  |  | 		if( mat ) { | 
					
						
							|  |  |  | 			if( ( ( ID * ) mat )->us > 0 ) | 
					
						
							|  |  |  | 				( ( ID * ) mat )->us--; | 
					
						
							|  |  |  | 			else | 
					
						
							|  |  |  | 				printf( "FATAL: material usage=0: %s", | 
					
						
							|  |  |  | 					( ( ID * ) mat )->name ); | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	MEM_freeN( matlist ); | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-20 08:16:46 +00:00
										 |  |  | 	return 1; | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** expands pointer array of length 'oldsize' to length 'newsize'.
 | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 	* A pointer to the (void *) array must be passed as first argument  | 
					
						
							|  |  |  | 	* The array pointer content can be NULL, in this case a new array of length | 
					
						
							|  |  |  | 	* 'newsize' is created. | 
					
						
							|  |  |  | 	*/ | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | static int expandPtrArray( void **p, int oldsize, int newsize ) | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	void *newarray; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( newsize < oldsize ) { | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | 		return 0; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	newarray = MEM_callocN( sizeof( void * ) * newsize, "PtrArray" ); | 
					
						
							|  |  |  | 	if( *p ) { | 
					
						
							|  |  |  | 		memcpy( newarray, *p, sizeof( void * ) * oldsize ); | 
					
						
							|  |  |  | 		MEM_freeN( *p ); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | 	*p = newarray; | 
					
						
							|  |  |  | 	return 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | int EXPP_synchronizeMaterialLists( Object * object ) | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	Material ***p_dataMaterials = give_matarar( object ); | 
					
						
							|  |  |  | 	short *nmaterials = give_totcolp( object ); | 
					
						
							|  |  |  | 	int result = 0; | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( object->totcol > *nmaterials ) { | 
					
						
							|  |  |  | 		/* More object mats than data mats */ | 
					
						
							|  |  |  | 		result = expandPtrArray( ( void * ) p_dataMaterials, | 
					
						
							|  |  |  | 					 *nmaterials, object->totcol ); | 
					
						
							|  |  |  | 		*nmaterials = object->totcol; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		if( object->totcol < *nmaterials ) { | 
					
						
							|  |  |  | 			/* More data mats than object mats */ | 
					
						
							|  |  |  | 			result = expandPtrArray( ( void * ) &object->mat, | 
					
						
							|  |  |  | 						 object->totcol, *nmaterials ); | 
					
						
							| 
									
										
										
										
											2005-07-18 03:50:37 +00:00
										 |  |  | 			object->totcol = (char)*nmaterials; | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	}			/* else no synchronization needed, they are of equal length */ | 
					
						
							| 
									
										
										
										
											2003-10-26 06:03:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	return result;		/* 1 if changed, 0 otherwise */ | 
					
						
							| 
									
										
										
										
											2003-06-29 16:49:21 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2003-07-01 05:19:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | void EXPP_incr_mats_us( Material ** matlist, int len ) | 
					
						
							| 
									
										
										
										
											2003-07-01 05:19:14 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	int i; | 
					
						
							|  |  |  | 	Material *mat; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	if( len <= 0 ) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2003-07-01 05:19:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 	for( i = 0; i < len; i++ ) { | 
					
						
							| 
									
										
										
										
											2003-07-01 05:19:14 +00:00
										 |  |  | 		mat = matlist[i]; | 
					
						
							| 
									
										
										
										
											2004-09-25 20:30:40 +00:00
										 |  |  | 		if( mat ) | 
					
						
							|  |  |  | 			mat->id.us++; | 
					
						
							| 
									
										
										
										
											2003-07-01 05:19:14 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_getColorComponent( BPy_Material * self,  | 
					
						
							|  |  |  | 							void * closure ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-04-17 21:14:55 +00:00
										 |  |  | 	switch ( GET_INT_FROM_POINTER(closure) ) { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_R: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->r ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_G: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->g ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_B: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->b ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_SPECR: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->specr ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_SPECG: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->specg ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_SPECB: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->specb ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_MIRR: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->mirr ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_MIRG: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->mirg ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_MIRB: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->mirb ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_SSSR: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->sss_col[0] ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_SSSG: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->sss_col[1] ); | 
					
						
							| 
									
										
										
										
											2007-05-04 03:23:40 +00:00
										 |  |  | 	case EXPP_MAT_COMP_SSSB: | 
					
						
							| 
									
										
										
										
											2007-06-29 08:59:26 +00:00
										 |  |  | 		return PyFloat_FromDouble( ( double ) self->material->sss_col[2] ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	default: | 
					
						
							|  |  |  | 		return EXPP_ReturnPyObjError( PyExc_RuntimeError, | 
					
						
							|  |  |  | 					"unknown color component specified" ); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | static PyObject *Material_getColorband( BPy_Material * self, void * type) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	switch( (long)type ) { | 
					
						
							|  |  |  |     case 0:	/* these are backwards, but that how it works */ | 
					
						
							|  |  |  | 		return EXPP_PyList_fromColorband( self->material->ramp_col ); | 
					
						
							|  |  |  |     case 1: | 
					
						
							|  |  |  | 		return EXPP_PyList_fromColorband( self->material->ramp_spec ); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	Py_RETURN_NONE; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int Material_setColorband( BPy_Material * self, PyObject * value, void * type) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	switch( (long)type ) { | 
					
						
							|  |  |  |     case 0:	/* these are backwards, but that how it works */ | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 		return EXPP_Colorband_fromPyList( &self->material->ramp_col, value ); | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  |     case 1: | 
					
						
							| 
									
										
										
										
											2007-03-08 14:37:34 +00:00
										 |  |  | 		return EXPP_Colorband_fromPyList( &self->material->ramp_spec, value ); | 
					
						
							| 
									
										
										
										
											2007-03-08 06:35:01 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | /* #####DEPRECATED###### */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetAdd( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setAdd ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetAlpha( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setAlpha ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetAmb( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setAmb ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseDarkness( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseDarkness ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseShader( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseShader ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseSize( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseSize ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetDiffuseSmooth( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setDiffuseSmooth ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetEmit( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setEmit ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFilter( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFilter ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFlareBoost( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFlareBoost ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFlareSeed( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFlareSeed ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFlareSize( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFlareSize ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelMirr( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelMirr ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelMirrFac( BPy_Material * self, | 
					
						
							|  |  |  | 					     PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelMirrFac ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelTrans( BPy_Material * self, | 
					
						
							|  |  |  | 					   PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelTrans ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetFresnelTransFac( BPy_Material * self, | 
					
						
							|  |  |  | 					      PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setFresnelTransFac ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetHaloSeed( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setHaloSeed ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetHaloSize( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setHaloSize ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetHardness( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setHardness ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetIOR( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setIOR ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNFlares( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNFlares ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNLines( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNLines ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNRings( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNRings ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetNStars( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setNStars ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRayMirr( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRayMirr ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRoughness( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRoughness ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetMirrDepth( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setMirrDepth ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRef( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRef ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRefracIndex( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRefracIndex ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRms( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setRms ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpec( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpec ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecShader( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecShader ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecSize( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecSize ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecSmooth( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecSmooth ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecTransp( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSpecTransp ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSubSize( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setSubSize ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetTranslucency( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setTranslucency ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetTransDepth( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setTransDepth ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetZOffset( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setZOffset ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetRGBCol( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2006-01-01 16:28:57 +00:00
										 |  |  | 	return EXPP_setterWrapperTuple( (void *)self, args, | 
					
						
							|  |  |  | 			(setter)Material_setRGBCol ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetSpecCol( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2006-01-01 16:28:57 +00:00
										 |  |  | 	return EXPP_setterWrapperTuple( (void *)self, args, | 
					
						
							|  |  |  | 			(setter)Material_setSpecCol ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetMirCol( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2006-01-01 16:28:57 +00:00
										 |  |  | 	return EXPP_setterWrapperTuple( (void *)self, args, | 
					
						
							|  |  |  | 			(setter)Material_setMirCol ); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Possible modes are traceable, shadow, shadeless, wire, vcolLight,
 | 
					
						
							|  |  |  |  * vcolPaint, halo, ztransp, zinvert, haloRings, env, haloLines, | 
					
						
							|  |  |  |  * onlyShadow, xalpha, star, faceTexture, haloTex, haloPuno, noMist, | 
					
						
							|  |  |  |  * haloShaded, haloFlare */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned int i, flag = 0, ok = 0; | 
					
						
							|  |  |  | 	PyObject *value, *error; | 
					
						
							|  |  |  | 	char *m[28] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 
					
						
							|  |  |  | 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 
					
						
							|  |  |  | 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 
					
						
							|  |  |  | 		NULL, NULL, NULL, NULL, NULL, NULL | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* 
 | 
					
						
							|  |  |  | 	 * check for a single integer argument; do a quick check for now | 
					
						
							|  |  |  | 	 * that the value is not larger than double the highest flag bit | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if ( (PySequence_Size( args ) == 1) | 
					
						
							| 
									
										
										
										
											2005-10-03 22:06:16 +00:00
										 |  |  | 		    && PyInt_Check ( PyTuple_GET_ITEM ( args , 0 ) ) | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 		    && PyArg_ParseTuple( args, "i", &flag )  | 
					
						
							| 
									
										
										
										
											2005-12-15 21:54:00 +00:00
										 |  |  | 			&& (flag & MA_MODE_MASK ) == flag ) { | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 			ok = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * check for either an empty argument list, or up to 28 strings | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} else if( PyArg_ParseTuple( args, "|ssssssssssssssssssssssssssss", | 
					
						
							|  |  |  | 			       &m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6], | 
					
						
							|  |  |  | 			       &m[7], &m[8], &m[9], &m[10], &m[11], &m[12], | 
					
						
							|  |  |  | 			       &m[13], &m[14], &m[15], &m[16], &m[17], &m[18], | 
					
						
							|  |  |  | 			       &m[19], &m[20], &m[21], &m[22], &m[23], &m[24], | 
					
						
							|  |  |  | 			       &m[25], &m[26], &m[27] ) ) { | 
					
						
							|  |  |  | 		for( i = 0; i < 28; i++ ) { | 
					
						
							|  |  |  | 			if( m[i] == NULL ) | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			if( strcmp( m[i], "Traceable" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_TRACEBLE; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "Shadow" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_SHADOW; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "Shadeless" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_SHLESS; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "Wire" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_WIRE; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "VColLight" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_VERTEXCOL; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "VColPaint" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_VERTEXCOLP; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "Halo" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALO; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "ZTransp" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_ZTRA; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "ZInvert" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_ZINV; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloRings" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALO_RINGS; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloLines" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALO_LINES; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "OnlyShadow" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_ONLYSHADOW; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloXAlpha" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALO_XALPHA; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloStar" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_STAR; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "TexFace" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_FACETEXTURE; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloTex" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALOTEX; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloPuno" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALOPUNO; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "NoMist" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_NOMIST; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloShaded" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALO_SHADE; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "HaloFlare" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_HALO_FLARE; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "Radio" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_RADIO; | 
					
						
							|  |  |  | 			/* ** Mirror ** */ | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "RayMirr" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_RAYMIRROR; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "ZTransp" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_ZTRA; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "RayTransp" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_RAYTRANSP; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "OnlyShadow" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_ONLYSHADOW; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "NoMist" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_NOMIST; | 
					
						
							|  |  |  | 			else if( strcmp( m[i], "Env" ) == 0 ) | 
					
						
							|  |  |  | 				flag |= MA_ENV; | 
					
						
							|  |  |  | 			else | 
					
						
							|  |  |  | 				return ( EXPP_ReturnPyObjError( PyExc_AttributeError, | 
					
						
							|  |  |  | 								"unknown Material mode argument" ) ); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		ok = 1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* if neither input method worked, then throw an exception */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if ( ok == 0 ) | 
					
						
							|  |  |  | 		return ( EXPP_ReturnPyObjError | 
					
						
							|  |  |  | 			 ( PyExc_AttributeError, | 
					
						
							|  |  |  | 			   "expected nothing, an integer or up to 22 string argument(s)" ) ); | 
					
						
							|  |  |  | 	/* build tuple, call wrapper */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-03 16:33:08 +00:00
										 |  |  | 	value = Py_BuildValue("(i)", flag); | 
					
						
							| 
									
										
										
										
											2005-09-21 19:48:40 +00:00
										 |  |  | 	error = EXPP_setterWrapper( (void *)self, value, (setter)Material_setMode ); | 
					
						
							|  |  |  | 	Py_DECREF ( value ); | 
					
						
							|  |  |  | 	return error; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Matr_oldsetIpo( BPy_Material * self, PyObject * args ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return EXPP_setterWrapper( (void *)self, args, (setter)Material_setIpo ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * clearIpo() returns True/False depending on whether material has an Ipo | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject *Material_clearIpo( BPy_Material * self ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/* if Ipo defined, delete it and return true */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if( self->material->ipo ) { | 
					
						
							|  |  |  | 		PyObject *value = Py_BuildValue( "(O)", Py_None ); | 
					
						
							|  |  |  | 		EXPP_setterWrapper( (void *)self, value, (setter)Material_setIpo ); | 
					
						
							|  |  |  | 		Py_DECREF ( value ); | 
					
						
							|  |  |  | 		return EXPP_incr_ret_True(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return EXPP_incr_ret_False(); /* no ipo found */ | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2007-02-25 07:36:50 +00:00
										 |  |  | 
 |