| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  |  # ***** BEGIN GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  # | 
					
						
							|  |  |  |  # This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  # modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  # as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  # of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  # | 
					
						
							|  |  |  |  # This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  # GNU General Public License for more details. | 
					
						
							|  |  |  |  # | 
					
						
							|  |  |  |  # You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  # along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  |  # Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
					
						
							|  |  |  |  # | 
					
						
							|  |  |  |  # Contributor(s): Campbell Barton | 
					
						
							|  |  |  |  # | 
					
						
							|  |  |  |  # #**** END GPL LICENSE BLOCK #**** | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-07 23:22:20 +00:00
										 |  |  | script_help_msg = '''
 | 
					
						
							|  |  |  | Usage, | 
					
						
							|  |  |  | run this script from blenders root path once you have compiled blender | 
					
						
							|  |  |  | 	./blender.bin -P source/blender/python/epy_doc_gen.py | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | This will generate rna.py and bpyoperator.py in "./source/blender/python/doc/" | 
					
						
							|  |  |  | Generate html docs  by running... | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-11 08:40:50 +00:00
										 |  |  | 	epydoc source/blender/python/doc/*.py -v \\ | 
					
						
							|  |  |  | 			-o source/blender/python/doc/html \\ | 
					
						
							|  |  |  | 			--inheritance=included \\ | 
					
						
							|  |  |  | 			--no-sourcecode \\ | 
					
						
							|  |  |  | 			--graph=classtree \\ | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 			--graph-font-size=8 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-07 23:22:20 +00:00
										 |  |  | '''
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | # if you dont have graphvis installed ommit the --graph arg. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 03:24:13 +00:00
										 |  |  | def range_str(val): | 
					
						
							|  |  |  | 	if val < -10000000:	return '-inf' | 
					
						
							|  |  |  | 	if val >  10000000:	return 'inf' | 
					
						
							|  |  |  | 	if type(val)==float: | 
					
						
							|  |  |  | 		return '%g'  % val | 
					
						
							|  |  |  | 	else: | 
					
						
							|  |  |  | 		return str(val)	 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 12:04:25 +00:00
										 |  |  | def get_array_str(length): | 
					
						
							|  |  |  | 	if length > 0:	return ' array of %d items' % length | 
					
						
							|  |  |  | 	else:		return '' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | def full_rna_struct_path(rna_struct): | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	Needed when referencing one struct from another | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	nested = rna_struct.nested | 
					
						
							|  |  |  | 	if nested: | 
					
						
							|  |  |  | 		return "%s.%s" % (full_rna_struct_path(nested), rna_struct.identifier) | 
					
						
							|  |  |  | 	else: | 
					
						
							|  |  |  | 		return rna_struct.identifier | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | def write_func(rna, ident, out, func_type): | 
					
						
							|  |  |  | 	# Keyword attributes | 
					
						
							|  |  |  | 	kw_args = [] # "foo = 1", "bar=0.5", "spam='ENUM'" | 
					
						
							|  |  |  | 	kw_arg_attrs = [] # "@type mode: int" | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	rna_struct= rna.rna_type | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	# Operators and functions work differently | 
					
						
							|  |  |  | 	if func_type=='OPERATOR': | 
					
						
							|  |  |  | 		rna_func_name = rna_struct.identifier | 
					
						
							| 
									
										
										
										
											2009-07-26 18:56:27 +00:00
										 |  |  | 		rna_func_desc = rna_struct.description.strip() | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		items = rna_struct.properties.items() | 
					
						
							|  |  |  | 	else: | 
					
						
							|  |  |  | 		rna_func_name = rna.identifier | 
					
						
							| 
									
										
										
										
											2009-07-26 18:56:27 +00:00
										 |  |  | 		rna_func_desc = rna.description.strip() | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		items = rna.parameters.items() | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-08-16 15:46:09 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 	for rna_prop_identifier, rna_prop in items: | 
					
						
							|  |  |  | 		if rna_prop_identifier=='rna_type': | 
					
						
							|  |  |  | 			continue | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		# clear vars			 | 
					
						
							|  |  |  | 		val = val_error = val_str = rna_prop_type = None | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		# ['rna_type', 'name', 'array_length', 'description', 'hard_max', 'hard_min', 'identifier', 'precision', 'readonly', 'soft_max', 'soft_min', 'step', 'subtype', 'type'] | 
					
						
							|  |  |  | 		#rna_prop=  op_rna.rna_type.properties[attr] | 
					
						
							|  |  |  | 		rna_prop_type = rna_prop.type.lower() # enum, float, int, boolean | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 		# only for rna functions, operators should not get pointers as args | 
					
						
							| 
									
										
										
										
											2009-08-16 15:46:09 +00:00
										 |  |  | 		if rna_prop_type=='pointer': | 
					
						
							|  |  |  | 			rna_prop_type_refine = "L{%s}" % rna_prop.fixed_type.identifier | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			rna_prop_type_refine = rna_prop_type | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		try:		length = rna_prop.array_length | 
					
						
							|  |  |  | 		except:	length = 0 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		array_str = get_array_str(length) | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-08-16 15:46:09 +00:00
										 |  |  | 		if rna_prop.use_return: | 
					
						
							|  |  |  | 			kw_type_str= "@rtype: %s%s" % (rna_prop_type_refine, array_str) | 
					
						
							|  |  |  | 			kw_param_str= "@return: %s" % (rna_prop.description.strip()) | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			kw_type_str= "@type %s: %s%s" % (rna_prop_identifier, rna_prop_type_refine, array_str) | 
					
						
							|  |  |  | 			kw_param_str= "@param %s: %s" % (rna_prop_identifier, rna_prop.description.strip()) | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		kw_param_set = False | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if func_type=='OPERATOR': | 
					
						
							|  |  |  | 			try: | 
					
						
							|  |  |  | 				val = getattr(rna, rna_prop_identifier) | 
					
						
							|  |  |  | 				val_error = False | 
					
						
							|  |  |  | 			except: | 
					
						
							|  |  |  | 				val = "'<UNDEFINED>'" | 
					
						
							|  |  |  | 				val_error = True | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 			if val_error: | 
					
						
							|  |  |  | 				val_str = val | 
					
						
							|  |  |  | 			elif rna_prop_type=='float': | 
					
						
							|  |  |  | 				if length==0: | 
					
						
							|  |  |  | 					val_str= '%g' % val | 
					
						
							|  |  |  | 					if '.' not in val_str: | 
					
						
							|  |  |  | 						val_str += '.0' | 
					
						
							|  |  |  | 				else: | 
					
						
							|  |  |  | 					# array | 
					
						
							|  |  |  | 					val_str = str(tuple(val)) | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 				kw_param_str += (' in (%s, %s)' % (range_str(rna_prop.hard_min), range_str(rna_prop.hard_max))) | 
					
						
							|  |  |  | 				kw_param_set= True | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 			elif rna_prop_type=='int': | 
					
						
							|  |  |  | 				if length==0: | 
					
						
							|  |  |  | 					val_str='%d' % val | 
					
						
							|  |  |  | 				else: | 
					
						
							|  |  |  | 					val_str = str(tuple(val)) | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 				# print(dir(rna_prop)) | 
					
						
							|  |  |  | 				kw_param_str += (' in (%s, %s)' % (range_str(rna_prop.hard_min), range_str(rna_prop.hard_max))) | 
					
						
							|  |  |  | 				# These strings dont have a max length??? | 
					
						
							|  |  |  | 				#kw_param_str += ' (maximum length of %s)' %  (rna_prop.max_length) | 
					
						
							|  |  |  | 				kw_param_set= True | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 			elif rna_prop_type=='boolean': | 
					
						
							|  |  |  | 				if length==0: | 
					
						
							|  |  |  | 					if val:	val_str='True' | 
					
						
							|  |  |  | 					else:	val_str='False' | 
					
						
							|  |  |  | 				else: | 
					
						
							|  |  |  | 					val_str = str(tuple(val)) | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			elif rna_prop_type=='enum': | 
					
						
							|  |  |  | 				# no array here? | 
					
						
							|  |  |  | 				val_str="'%s'" % val | 
					
						
							|  |  |  | 				# Too cramped | 
					
						
							|  |  |  | 				kw_param_str += (' in (%s)' % ', '.join(rna_prop.items.keys())) | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 				kw_param_set= True | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 			elif rna_prop_type=='string': | 
					
						
							|  |  |  | 				# no array here? | 
					
						
							|  |  |  | 				val_str='"%s"' % val | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			# todo - collection - array | 
					
						
							|  |  |  | 			# print (rna_prop.type) | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			kw_args.append('%s = %s' % (rna_prop_identifier, val_str)) | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			# stora  | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			# currently functions dont have a default value | 
					
						
							| 
									
										
										
										
											2009-08-16 15:46:09 +00:00
										 |  |  | 			if not rna_prop.use_return: | 
					
						
							|  |  |  | 				kw_args.append('%s' % (rna_prop_identifier)) | 
					
						
							|  |  |  | 			else: | 
					
						
							|  |  |  | 				kw_param_set = True | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		# Same for operators and functions | 
					
						
							|  |  |  | 		kw_arg_attrs.append(kw_type_str) | 
					
						
							|  |  |  | 		if kw_param_set: | 
					
						
							|  |  |  | 			kw_arg_attrs.append(kw_param_str) | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	out.write(ident+'def %s(%s):\n' % (rna_func_name, ', '.join(kw_args))) | 
					
						
							|  |  |  | 	out.write(ident+'\t"""\n') | 
					
						
							|  |  |  | 	out.write(ident+'\t%s\n' % rna_func_desc) | 
					
						
							|  |  |  | 	for desc in kw_arg_attrs: | 
					
						
							|  |  |  | 		out.write(ident+'\t%s\n' % desc) | 
					
						
							| 
									
										
										
										
											2009-08-16 15:46:09 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 	# out.write(ident+'\t@rtype: None\n') # implicit | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 	out.write(ident+'\t"""\n') | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | def rna2epy(target_path): | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 	# Use for faster lookups | 
					
						
							|  |  |  | 	# use rna_struct.identifier as the key for each dict | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 	rna_struct_dict =		{}  # store identifier:rna lookups | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 	rna_full_path_dict =	{}	# store the result of full_rna_struct_path(rna_struct) | 
					
						
							|  |  |  | 	rna_children_dict =		{}	# store all rna_structs nested from here | 
					
						
							|  |  |  | 	rna_references_dict =	{}	# store a list of rna path strings that reference this type | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 	rna_functions_dict =	{}	# store all functions directly in this type (not inherited) | 
					
						
							| 
									
										
										
										
											2009-03-28 11:44:07 +00:00
										 |  |  | 	rna_words = set() | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 	# def write_func(rna_func, ident): | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 	def write_struct(rna_struct, ident): | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 		identifier = rna_struct.identifier | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		rna_base = rna_struct.base | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if rna_base: | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 			out.write(ident+ 'class %s(%s):\n' % (identifier, rna_base.identifier)) | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 			rna_base_prop_keys = rna_base.properties.keys() # could be cached | 
					
						
							|  |  |  | 			rna_base_func_keys = [f.identifier for f in rna_base.functions] | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 		else: | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 			out.write(ident+ 'class %s:\n' % identifier) | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 			rna_base_prop_keys = [] | 
					
						
							|  |  |  | 			rna_base_func_keys = [] | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 		out.write(ident+ '\t"""\n') | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		title = 'The %s Object' % rna_struct.name | 
					
						
							| 
									
										
										
										
											2009-07-26 18:56:27 +00:00
										 |  |  | 		description = rna_struct.description.strip() | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 		out.write(ident+ '\t%s\n' %  title) | 
					
						
							|  |  |  | 		out.write(ident+ '\t%s\n' %  ('=' * len(title))) | 
					
						
							| 
									
										
										
										
											2009-03-28 11:44:07 +00:00
										 |  |  | 		out.write(ident+ '\t\t%s\n' %  description) | 
					
						
							|  |  |  | 		rna_words.update(description.split()) | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		# For convenience, give a list of all places were used. | 
					
						
							|  |  |  | 		rna_refs= rna_references_dict[identifier] | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if rna_refs: | 
					
						
							|  |  |  | 			out.write(ident+ '\t\t\n') | 
					
						
							|  |  |  | 			out.write(ident+ '\t\tReferences\n') | 
					
						
							|  |  |  | 			out.write(ident+ '\t\t==========\n') | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			for rna_ref_string in rna_refs: | 
					
						
							|  |  |  | 				out.write(ident+ '\t\t\t- L{%s}\n' % rna_ref_string) | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			out.write(ident+ '\t\t\n') | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			out.write(ident+ '\t\t\n') | 
					
						
							|  |  |  | 			out.write(ident+ '\t\t(no references to this struct found)\n') | 
					
						
							|  |  |  | 			out.write(ident+ '\t\t\n') | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 		for rna_prop_identifier, rna_prop in rna_struct.properties.items(): | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 			if rna_prop_identifier=='RNA':					continue | 
					
						
							|  |  |  | 			if rna_prop_identifier=='rna_type':				continue | 
					
						
							|  |  |  | 			if rna_prop_identifier in rna_base_prop_keys:	continue # does this prop exist in our parent class, if so skip | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-07-26 18:56:27 +00:00
										 |  |  | 			rna_desc = rna_prop.description.strip() | 
					
						
							| 
									
										
										
										
											2009-03-28 11:44:07 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			if rna_desc: rna_words.update(rna_desc.split()) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 			if not rna_desc: rna_desc = rna_prop.name | 
					
						
							|  |  |  | 			if not rna_desc: rna_desc = 'Note - No documentation for this property!' | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			rna_prop_type = rna_prop.type.lower() | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			if rna_prop_type=='collection':	collection_str = 'Collection of ' | 
					
						
							|  |  |  | 			else:							collection_str = '' | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			try:		rna_prop_ptr = rna_prop.fixed_type | 
					
						
							|  |  |  | 			except:	rna_prop_ptr = None | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			try:		length = rna_prop.array_length | 
					
						
							|  |  |  | 			except:	length = 0 | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2008-12-29 12:04:25 +00:00
										 |  |  | 			array_str = get_array_str(length) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-01-02 07:54:38 +00:00
										 |  |  | 			if rna_prop.editable:	readonly_str = '' | 
					
						
							|  |  |  | 			else:				readonly_str = ' (readonly)' | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			if rna_prop_ptr: # Use the pointer type | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 				out.write(ident+ '\t@ivar %s: %s\n' %  (rna_prop_identifier, rna_desc)) | 
					
						
							|  |  |  | 				out.write(ident+ '\t@type %s: %sL{%s}%s%s\n' %  (rna_prop_identifier, collection_str, rna_prop_ptr.identifier, array_str, readonly_str)) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 			else: | 
					
						
							|  |  |  | 				if rna_prop_type == 'enum': | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 					if 0: | 
					
						
							|  |  |  | 						out.write(ident+ '\t@ivar %s: %s in (%s)\n' %  (rna_prop_identifier, rna_desc, ', '.join(rna_prop.items.keys()))) | 
					
						
							|  |  |  | 					else: | 
					
						
							|  |  |  | 						out.write(ident+ '\t@ivar %s: %s in...\n' %  (rna_prop_identifier, rna_desc)) | 
					
						
							| 
									
										
										
										
											2009-08-16 15:46:09 +00:00
										 |  |  | 						for e, e_rna_prop in rna_prop.items.items(): | 
					
						
							|  |  |  | 							#out.write(ident+ '\t\t- %s: %s\n' % (e, e_rna_prop.description)) # XXX - segfaults, FIXME | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 							out.write(ident+ '\t\t- %s\n' % e) | 
					
						
							|  |  |  | 						 | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 					out.write(ident+ '\t@type %s: %s%s%s\n' %  (rna_prop_identifier, rna_prop_type,  array_str, readonly_str)) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 				elif rna_prop_type == 'int' or rna_prop_type == 'float': | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 					out.write(ident+ '\t@ivar %s: %s\n' %  (rna_prop_identifier, rna_desc)) | 
					
						
							|  |  |  | 					out.write(ident+ '\t@type %s: %s%s%s in [%s, %s]\n' %  (rna_prop_identifier, rna_prop_type, array_str, readonly_str, range_str(rna_prop.hard_min), range_str(rna_prop.hard_max) )) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 				elif rna_prop_type == 'string': | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 					out.write(ident+ '\t@ivar %s: %s (maximum length of %s)\n' %  (rna_prop_identifier, rna_desc, rna_prop.max_length)) | 
					
						
							|  |  |  | 					out.write(ident+ '\t@type %s: %s%s%s\n' %  (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 				else: | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 					out.write(ident+ '\t@ivar %s: %s\n' %  (rna_prop_identifier, rna_desc)) | 
					
						
							|  |  |  | 					out.write(ident+ '\t@type %s: %s%s%s\n' %  (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 				 | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 		out.write(ident+ '\t"""\n\n') | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		# Write functions  | 
					
						
							|  |  |  | 		# for rna_func in rna_struct.functions: # Better ignore inherited (line below) | 
					
						
							|  |  |  | 		for rna_func in rna_functions_dict[identifier]: | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 			if rna_func not in rna_base_func_keys: | 
					
						
							|  |  |  | 				write_func(rna_func, ident+'\t', out, 'FUNCTION') | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		out.write('\n') | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 		# Now write children recursively | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 		for child in rna_children_dict[identifier]: | 
					
						
							|  |  |  | 			write_struct(child, ident + '\t') | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	out = open(target_path, 'w') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	def base_id(rna_struct): | 
					
						
							|  |  |  | 		try:		return rna_struct.base.identifier | 
					
						
							| 
									
										
										
										
											2008-12-26 16:50:05 +00:00
										 |  |  | 		except:	return '' # invalid id | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-13 07:50:07 +00:00
										 |  |  | 	#structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] | 
					
						
							|  |  |  | 	'''
 | 
					
						
							| 
									
										
										
										
											2009-03-05 12:09:30 +00:00
										 |  |  | 	structs = [] | 
					
						
							| 
									
										
										
										
											2009-03-13 07:50:07 +00:00
										 |  |  | 	for rna_struct in bpy.doc.structs.values(): | 
					
						
							| 
									
										
										
										
											2009-03-05 12:09:30 +00:00
										 |  |  | 		structs.append( (base_id(rna_struct), rna_struct.identifier, rna_struct) ) | 
					
						
							| 
									
										
										
										
											2009-03-13 07:50:07 +00:00
										 |  |  | 	'''
 | 
					
						
							|  |  |  | 	structs = [] | 
					
						
							|  |  |  | 	for rna_type_name in dir(bpy.types): | 
					
						
							|  |  |  | 		rna_type = getattr(bpy.types, rna_type_name) | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		try:		rna_struct = rna_type.__rna__ | 
					
						
							|  |  |  | 		except:	rna_struct = None | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if rna_struct: | 
					
						
							| 
									
										
										
										
											2009-03-21 06:55:30 +00:00
										 |  |  | 			#if not rna_type_name.startswith('__'): | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 			identifier = rna_struct.identifier | 
					
						
							|  |  |  | 			structs.append( (base_id(rna_struct), identifier, rna_struct) )	 | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 			# Simple lookup | 
					
						
							|  |  |  | 			rna_struct_dict[identifier] = rna_struct | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			# Store full rna path 'GameObjectSettings' -> 'Object.GameObjectSettings' | 
					
						
							|  |  |  | 			rna_full_path_dict[identifier] = full_rna_struct_path(rna_struct) | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 			# Store a list of functions, remove inherited later | 
					
						
							|  |  |  | 			rna_functions_dict[identifier]= list(rna_struct.functions) | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 			# fill in these later | 
					
						
							|  |  |  | 			rna_children_dict[identifier]= [] | 
					
						
							|  |  |  | 			rna_references_dict[identifier]= [] | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-03-21 06:55:30 +00:00
										 |  |  | 		else: | 
					
						
							|  |  |  | 			print("Ignoring", rna_type_name) | 
					
						
							| 
									
										
										
										
											2009-03-13 07:50:07 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-05 12:09:30 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 	# Sucks but we need to copy this so we can check original parent functions | 
					
						
							|  |  |  | 	rna_functions_dict__copy = {} | 
					
						
							|  |  |  | 	for key, val in rna_functions_dict.items(): | 
					
						
							|  |  |  | 		rna_functions_dict__copy[key] = val[:] | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-05 12:09:30 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 	structs.sort() # not needed but speeds up sort below, setting items without an inheritance first | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	# Arrange so classes are always defined in the correct order | 
					
						
							|  |  |  | 	deps_ok = False | 
					
						
							|  |  |  | 	while deps_ok == False: | 
					
						
							|  |  |  | 		deps_ok = True | 
					
						
							|  |  |  | 		rna_done = set() | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		for i, (rna_base, identifier, rna_struct) in enumerate(structs): | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			rna_done.add(identifier) | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			if rna_base and rna_base not in rna_done: | 
					
						
							|  |  |  | 				deps_ok = False | 
					
						
							|  |  |  | 				data = structs.pop(i) | 
					
						
							|  |  |  | 				ok = False | 
					
						
							|  |  |  | 				while i < len(structs): | 
					
						
							|  |  |  | 					if structs[i][1]==rna_base: | 
					
						
							|  |  |  | 						structs.insert(i+1, data) # insert after the item we depend on. | 
					
						
							|  |  |  | 						ok = True | 
					
						
							|  |  |  | 						break | 
					
						
							|  |  |  | 					i+=1 | 
					
						
							|  |  |  | 					 | 
					
						
							|  |  |  | 				if not ok: | 
					
						
							| 
									
										
										
										
											2009-03-21 06:55:30 +00:00
										 |  |  | 					print('Dependancy "%s" could not be found for "%s"' % (identifier, rna_base)) | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 				 | 
					
						
							|  |  |  | 				break | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	# Done ordering structs | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 	# precalc vars to avoid a lot of looping | 
					
						
							|  |  |  | 	for (rna_base, identifier, rna_struct) in structs: | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 		if rna_base: | 
					
						
							|  |  |  | 			rna_base_prop_keys = rna_struct_dict[rna_base].properties.keys() # could cache | 
					
						
							|  |  |  | 			rna_base_func_keys = [f.identifier for f in rna_struct_dict[rna_base].functions] | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			rna_base_prop_keys = [] | 
					
						
							|  |  |  | 			rna_base_func_keys= [] | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		# rna_struct_path = full_rna_struct_path(rna_struct) | 
					
						
							|  |  |  | 		rna_struct_path = rna_full_path_dict[identifier] | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		for rna_prop_identifier, rna_prop in rna_struct.properties.items(): | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 			if rna_prop_identifier=='RNA':					continue | 
					
						
							|  |  |  | 			if rna_prop_identifier=='rna_type':				continue | 
					
						
							|  |  |  | 			if rna_prop_identifier in rna_base_prop_keys:	continue | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			try:		rna_prop_ptr = rna_prop.fixed_type | 
					
						
							|  |  |  | 			except:	rna_prop_ptr = None | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			# Does this property point to me? | 
					
						
							|  |  |  | 			if rna_prop_ptr: | 
					
						
							|  |  |  | 				rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_prop_identifier) ) | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-08-17 17:26:54 +00:00
										 |  |  | 		for rna_func in rna_struct.functions: | 
					
						
							|  |  |  | 			for rna_prop_identifier, rna_prop in rna_func.parameters.items(): | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 				if rna_prop_identifier=='RNA':					continue | 
					
						
							|  |  |  | 				if rna_prop_identifier=='rna_type':				continue | 
					
						
							|  |  |  | 				if rna_prop_identifier in rna_base_func_keys:	continue | 
					
						
							|  |  |  | 					 | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 				try:		rna_prop_ptr = rna_prop.fixed_type | 
					
						
							|  |  |  | 				except:	rna_prop_ptr = None | 
					
						
							|  |  |  | 				 | 
					
						
							|  |  |  | 				# Does this property point to me? | 
					
						
							|  |  |  | 				if rna_prop_ptr: | 
					
						
							|  |  |  | 					rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_func.identifier) ) | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		# Store nested children | 
					
						
							|  |  |  | 		nested = rna_struct.nested | 
					
						
							|  |  |  | 		if nested: | 
					
						
							|  |  |  | 			rna_children_dict[nested.identifier].append(rna_struct) | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if rna_base: | 
					
						
							|  |  |  | 			rna_funcs =			rna_functions_dict[identifier] | 
					
						
							|  |  |  | 			if rna_funcs: | 
					
						
							|  |  |  | 				# Remove inherited functions if we have any | 
					
						
							|  |  |  | 				rna_base_funcs =	rna_functions_dict__copy[rna_base] | 
					
						
							|  |  |  | 				rna_funcs[:] =		[f for f in rna_funcs if f not in rna_base_funcs] | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	rna_functions_dict__copy.clear() | 
					
						
							|  |  |  | 	del rna_functions_dict__copy | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	# Sort the refs, just reads nicer | 
					
						
							|  |  |  | 	for rna_refs in rna_references_dict.values(): | 
					
						
							|  |  |  | 		rna_refs.sort() | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-27 06:06:11 +00:00
										 |  |  | 	for (rna_base, identifier, rna_struct) in structs: | 
					
						
							| 
									
										
										
										
											2009-01-10 22:57:33 +00:00
										 |  |  | 		if rna_struct.nested: | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 			continue | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-03-24 06:53:57 +00:00
										 |  |  | 		write_struct(rna_struct, '') | 
					
						
							| 
									
										
										
										
											2009-01-09 16:08:47 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 	out.write('\n') | 
					
						
							|  |  |  | 	out.close() | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	# # We could also just run.... | 
					
						
							|  |  |  | 	# os.system('epydoc source/blender/python/doc/rna.py -o ./source/blender/python/doc/html -v') | 
					
						
							| 
									
										
										
										
											2009-03-27 06:06:11 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	# Write graphviz | 
					
						
							|  |  |  | 	out= open(target_path.replace('.py', '.dot'), 'w') | 
					
						
							|  |  |  | 	out.write('digraph "rna data api" {\n') | 
					
						
							|  |  |  | 	out.write('\tnode [style=filled, shape = "box"];\n') | 
					
						
							|  |  |  | 	out.write('\toverlap=false;\n') | 
					
						
							|  |  |  | 	out.write('\trankdir = LR;\n') | 
					
						
							|  |  |  | 	out.write('\tsplines=true;\n') | 
					
						
							|  |  |  | 	out.write('\tratio=auto;\n') | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	out.write('\tsize="10,10"\n') | 
					
						
							|  |  |  | 	#out.write('\tpage="8.5,11"\n') | 
					
						
							|  |  |  | 	#out.write('\tcenter=""\n') | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	def isop(rna_struct): | 
					
						
							|  |  |  | 		return '_OT_' in rna_struct.identifier | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	for (rna_base, identifier, rna_struct) in structs: | 
					
						
							|  |  |  | 		if isop(rna_struct): | 
					
						
							|  |  |  | 			continue | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		base = rna_struct.base | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		out.write('\t"%s";\n' % identifier) | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	for (rna_base, identifier, rna_struct) in structs: | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if isop(rna_struct): | 
					
						
							|  |  |  | 			continue | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 		base = rna_struct.base | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if base and not isop(base): | 
					
						
							|  |  |  | 			out.write('\t"%s" -> "%s" [label="(base)" weight=1.0];\n' % (base.identifier, identifier)) | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		nested = rna_struct.nested | 
					
						
							|  |  |  | 		if nested and not isop(nested): | 
					
						
							|  |  |  | 			out.write('\t"%s" -> "%s" [label="(nested)"  weight=1.0];\n' % (nested.identifier, identifier)) | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		rna_refs= rna_references_dict[identifier] | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		for rna_ref_string in rna_refs: | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			if '_OT_' in rna_ref_string: | 
					
						
							|  |  |  | 				continue | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			ref = rna_ref_string.split('.')[-2] | 
					
						
							|  |  |  | 			out.write('\t"%s" -> "%s" [label="%s" weight=0.01];\n' % (ref, identifier, rna_ref_string)) | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-27 06:06:11 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	out.write('}\n') | 
					
						
							|  |  |  | 	out.close() | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	# # We could also just run.... | 
					
						
							|  |  |  | 	# os.system('dot source/blender/python/doc/rna.dot -Tsvg -o ./source/blender/python/doc/rna.svg') | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-03-28 11:44:07 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	out= open(target_path.replace('.py', '.words'), 'w') | 
					
						
							|  |  |  | 	rna_words = list(rna_words) | 
					
						
							|  |  |  | 	rna_words.sort() | 
					
						
							|  |  |  | 	for w in rna_words: | 
					
						
							|  |  |  | 		out.write('%s\n' % w) | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 03:24:13 +00:00
										 |  |  | def op2epy(target_path): | 
					
						
							|  |  |  | 	out = open(target_path, 'w') | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-07-26 18:18:14 +00:00
										 |  |  | 	op_mods = dir(bpy.ops) | 
					
						
							|  |  |  | 	op_mods.remove('add') | 
					
						
							|  |  |  | 	op_mods.remove('remove') | 
					
						
							| 
									
										
										
										
											2008-12-29 03:24:13 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-07-26 18:18:14 +00:00
										 |  |  | 	for op_mod_name in sorted(op_mods): | 
					
						
							|  |  |  | 		if op_mod_name.startswith('__'): | 
					
						
							| 
									
										
										
										
											2009-03-05 12:09:30 +00:00
										 |  |  | 			continue | 
					
						
							| 
									
										
										
										
											2009-07-26 18:18:14 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		op_mod = getattr(bpy.ops, op_mod_name) | 
					
						
							| 
									
										
										
										
											2008-12-29 03:24:13 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-26 18:18:14 +00:00
										 |  |  | 		operators = dir(op_mod) | 
					
						
							|  |  |  | 		for op in sorted(operators): | 
					
						
							|  |  |  | 			# rna = getattr(bpy.types, op).__rna__ | 
					
						
							|  |  |  | 			rna = getattr(op_mod, op).get_rna() | 
					
						
							|  |  |  | 			write_func(rna, '', out, 'OPERATOR') | 
					
						
							| 
									
										
										
										
											2008-12-29 03:24:13 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	out.write('\n') | 
					
						
							|  |  |  | 	out.close() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-19 05:05:23 +00:00
										 |  |  | if __name__ == '__main__': | 
					
						
							| 
									
										
										
										
											2009-04-07 23:22:20 +00:00
										 |  |  | 	if 'bpy' not in dir(): | 
					
						
							| 
									
										
										
										
											2009-05-11 08:40:50 +00:00
										 |  |  | 		print("\nError, this script must run from inside blender2.5") | 
					
						
							| 
									
										
										
										
											2009-04-12 22:53:54 +00:00
										 |  |  | 		print(script_help_msg) | 
					
						
							| 
									
										
										
										
											2009-04-07 23:22:20 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 	else: | 
					
						
							|  |  |  | 		rna2epy('source/blender/python/doc/rna.py') | 
					
						
							|  |  |  | 		op2epy('source/blender/python/doc/bpyoperator.py') | 
					
						
							| 
									
										
										
										
											2009-04-21 20:03:39 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-04-07 23:22:20 +00:00
										 |  |  | 	import sys | 
					
						
							|  |  |  | 	sys.exit() |