| 
									
										
										
										
											2011-02-23 10:52:22 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  |  * $Id$ | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** BEGIN GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Contributor(s): Blender Foundation (2008). | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-27 20:20:01 +00:00
										 |  |  | /** \file blender/makesrna/intern/rna_main.c
 | 
					
						
							|  |  |  |  *  \ingroup RNA | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | #include <stdlib.h>
 | 
					
						
							|  |  |  | #include <string.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "RNA_define.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-03 23:16:51 +00:00
										 |  |  | #include "rna_internal.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | #ifdef RNA_RUNTIME
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "BKE_main.h"
 | 
					
						
							| 
									
										
										
										
											2009-06-18 19:48:55 +00:00
										 |  |  | #include "BKE_mesh.h"
 | 
					
						
							| 
									
										
										
										
											2010-04-02 19:38:20 +00:00
										 |  |  | #include "BKE_global.h"
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* all the list begin functions are added manually here, Main is not in SDNA */ | 
					
						
							| 
									
										
										
										
											2010-04-02 19:38:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-31 02:14:25 +00:00
										 |  |  | static int rna_Main_is_saved_get(PointerRNA *UNUSED(ptr)) | 
					
						
							| 
									
										
										
										
											2011-04-11 15:31:05 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	return G.relbase_valid; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-18 07:14:10 +00:00
										 |  |  | static int rna_Main_is_dirty_get(PointerRNA *ptr) | 
					
						
							| 
									
										
										
										
											2010-05-03 03:02:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-04-11 15:31:05 +00:00
										 |  |  | 	/* XXX, not totally nice to do it this way, should store in main ? */ | 
					
						
							| 
									
										
										
										
											2011-05-31 02:14:25 +00:00
										 |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2011-04-11 15:31:05 +00:00
										 |  |  | 	wmWindowManager *wm; | 
					
						
							| 
									
										
										
										
											2011-05-31 02:14:25 +00:00
										 |  |  | 	for(wm= bmain->wm.first; wm; wm= wm->id.next) { | 
					
						
							| 
									
										
										
										
											2011-04-11 15:31:05 +00:00
										 |  |  | 		return !wm->file_saved; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return TRUE; | 
					
						
							| 
									
										
										
										
											2010-05-03 03:02:27 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  | static void rna_Main_filepath_get(PointerRNA *ptr, char *value) | 
					
						
							| 
									
										
										
										
											2008-11-30 00:57:32 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							|  |  |  | 	BLI_strncpy(value, bmain->name, sizeof(bmain->name)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  | static int rna_Main_filepath_length(PointerRNA *ptr) | 
					
						
							| 
									
										
										
										
											2008-11-30 00:57:32 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							|  |  |  | 	return strlen(bmain->name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-02 19:57:57 +00:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  | static void rna_Main_filepath_set(PointerRNA *ptr, const char *value) | 
					
						
							| 
									
										
										
										
											2008-11-30 00:57:32 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							|  |  |  | 	BLI_strncpy(bmain->name, value, sizeof(bmain->name)); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-02-02 19:57:57 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-11-30 00:57:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | static void rna_Main_scene_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->scene, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_object_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->object, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-18 10:57:06 +00:00
										 |  |  | static void rna_Main_lamp_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->lamp, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-18 10:57:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | static void rna_Main_library_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->library, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_mesh_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->mesh, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_curve_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->curve, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_mball_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->mball, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_mat_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->mat, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_tex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->tex, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_image_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->image, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_latt_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->latt, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_camera_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->camera, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_key_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->key, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_world_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->world, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_screen_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->screen, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_script_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->script, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | static void rna_Main_font_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->vfont, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_text_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->text, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-01 11:44:20 +00:00
										 |  |  | static void rna_Main_speaker_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							|  |  |  | 	rna_iterator_listbase_begin(iter, &bmain->speaker, NULL); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | static void rna_Main_sound_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->sound, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_group_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->group, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_armature_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->armature, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_action_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->action, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_nodetree_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->nodetree, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_brush_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->brush, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_Main_particle_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->particle, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-27 06:03:41 +00:00
										 |  |  | static void rna_Main_gpencil_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							|  |  |  | 	rna_iterator_listbase_begin(iter, &bmain->gpencil, NULL); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | static void rna_Main_wm_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Main *bmain= (Main*)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-24 12:12:24 +00:00
										 |  |  | 	rna_iterator_listbase_begin(iter, &bmain->wm, NULL); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-06 15:13:57 +00:00
										 |  |  | #ifdef UNIT_TEST
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PointerRNA rna_Test_test_get(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	PointerRNA ret= *ptr; | 
					
						
							|  |  |  | 	ret.type= &RNA_Test; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return ret; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | /* local convenience types */ | 
					
						
							|  |  |  | typedef void (CollectionDefFunc)(struct BlenderRNA *brna, struct PropertyRNA *cprop); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct MainCollectionDef { | 
					
						
							| 
									
										
										
										
											2010-03-22 09:30:00 +00:00
										 |  |  | 	const char	*identifier; | 
					
						
							|  |  |  | 	const char	*type; | 
					
						
							|  |  |  | 	const char	*iter_begin; | 
					
						
							|  |  |  | 	const char	*name; | 
					
						
							|  |  |  | 	const char	*description; | 
					
						
							|  |  |  | 	CollectionDefFunc *func; | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | } MainCollectionDef; | 
					
						
							| 
									
										
										
										
											2010-01-09 23:44:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | void RNA_def_main(BlenderRNA *brna) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	StructRNA *srna; | 
					
						
							|  |  |  | 	PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | 	CollectionDefFunc *func; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	/* plural must match idtypes in readblenentry.c */ | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | 	MainCollectionDef lists[]= { | 
					
						
							| 
									
										
										
										
											2011-09-19 13:23:58 +00:00
										 |  |  | 		{"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks", RNA_def_main_cameras}, | 
					
						
							|  |  |  | 		{"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks", RNA_def_main_scenes}, | 
					
						
							|  |  |  | 		{"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks", RNA_def_main_objects}, | 
					
						
							|  |  |  | 		{"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks", RNA_def_main_materials}, | 
					
						
							|  |  |  | 		{"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks", RNA_def_main_node_groups}, | 
					
						
							|  |  |  | 		{"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks", RNA_def_main_meshes}, | 
					
						
							|  |  |  | 		{"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks", RNA_def_main_lamps}, | 
					
						
							|  |  |  | 		{"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks", RNA_def_main_libraries}, | 
					
						
							|  |  |  | 		{"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks", RNA_def_main_screens}, | 
					
						
							|  |  |  | 		{"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks", RNA_def_main_window_managers}, | 
					
						
							|  |  |  | 		{"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks", RNA_def_main_images}, | 
					
						
							|  |  |  | 		{"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks", RNA_def_main_lattices}, | 
					
						
							|  |  |  | 		{"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves} , | 
					
						
							|  |  |  | 		{"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks", RNA_def_main_metaballs}, | 
					
						
							|  |  |  | 		{"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font datablocks", RNA_def_main_fonts}, | 
					
						
							|  |  |  | 		{"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks", RNA_def_main_textures}, | 
					
						
							|  |  |  | 		{"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks", RNA_def_main_brushes}, | 
					
						
							|  |  |  | 		{"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks", RNA_def_main_worlds}, | 
					
						
							|  |  |  | 		{"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks", RNA_def_main_groups}, | 
					
						
							|  |  |  | 		{"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key datablocks", NULL}, | 
					
						
							|  |  |  | 		{"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED)", NULL}, | 
					
						
							|  |  |  | 		{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks", RNA_def_main_texts}, | 
					
						
							|  |  |  | 		{"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker datablocks", RNA_def_main_speakers}, | 
					
						
							|  |  |  | 		{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks", RNA_def_main_sounds}, | 
					
						
							|  |  |  | 		{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks", RNA_def_main_armatures}, | 
					
						
							|  |  |  | 		{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions}, | 
					
						
							|  |  |  | 		{"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles}, | 
					
						
							|  |  |  | 		{"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil}, | 
					
						
							| 
									
										
										
										
											2010-01-09 23:44:01 +00:00
										 |  |  | 		{NULL, NULL, NULL, NULL, NULL, NULL}}; | 
					
						
							| 
									
										
										
										
											2009-06-18 19:48:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 	int i; | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-09-02 04:53:05 +00:00
										 |  |  | 	srna= RNA_def_struct(brna, "BlendData", NULL); | 
					
						
							|  |  |  | 	RNA_def_struct_ui_text(srna, "Blendfile Data", "Main data structure representing a .blend file and all its datablocks"); | 
					
						
							| 
									
										
										
										
											2009-06-03 23:16:51 +00:00
										 |  |  | 	RNA_def_struct_ui_icon(srna, ICON_BLENDER); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  | 	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); | 
					
						
							| 
									
										
										
										
											2008-11-30 00:57:32 +00:00
										 |  |  | 	RNA_def_property_string_maxlength(prop, 240); | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  | 	RNA_def_property_string_funcs(prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set"); | 
					
						
							| 
									
										
										
										
											2009-03-23 13:24:48 +00:00
										 |  |  | 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  | 	RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file"); | 
					
						
							| 
									
										
										
										
											2010-05-03 03:02:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-08-18 07:14:10 +00:00
										 |  |  | 	prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2010-05-03 03:02:27 +00:00
										 |  |  | 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2010-08-18 07:14:10 +00:00
										 |  |  | 	RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL); | 
					
						
							| 
									
										
										
										
											2011-04-11 15:31:05 +00:00
										 |  |  | 	RNA_def_property_ui_text(prop, "File is Saved", "Have recent edits been saved to disk"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	prop= RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE); | 
					
						
							|  |  |  | 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							|  |  |  | 	RNA_def_property_boolean_funcs(prop, "rna_Main_is_saved_get", NULL); | 
					
						
							| 
									
										
										
										
											2010-05-03 03:02:27 +00:00
										 |  |  | 	RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file"); | 
					
						
							| 
									
										
										
										
											2008-11-30 00:57:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | 	for(i=0; lists[i].name; i++) | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | 		prop= RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE); | 
					
						
							|  |  |  | 		RNA_def_property_struct_type(prop, lists[i].type); | 
					
						
							| 
									
										
										
										
											2011-10-01 15:40:32 +00:00
										 |  |  | 		RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | 		RNA_def_property_ui_text(prop, lists[i].name, lists[i].description); | 
					
						
							| 
									
										
										
										
											2010-01-09 23:44:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		/* collection functions */ | 
					
						
							| 
									
										
										
										
											2010-01-10 14:40:37 +00:00
										 |  |  | 		func= lists[i].func; | 
					
						
							| 
									
										
										
										
											2010-01-09 23:44:01 +00:00
										 |  |  | 		if(func) | 
					
						
							|  |  |  | 			func(brna, prop); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-06-18 19:48:55 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	RNA_api_main(srna); | 
					
						
							| 
									
										
										
										
											2009-09-06 15:13:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef UNIT_TEST
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	RNA_define_verify_sdna(0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	prop= RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE); | 
					
						
							|  |  |  | 	RNA_def_property_struct_type(prop, "Test"); | 
					
						
							| 
									
										
										
										
											2010-08-03 05:14:59 +00:00
										 |  |  | 	RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL, NULL); | 
					
						
							| 
									
										
										
										
											2009-09-06 15:13:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	RNA_define_verify_sdna(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 |