mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Added custom node export
This commit is contained in:
		
							parent
							
								
									39534a7aec
								
							
						
					
					
						commit
						5d06843fcf
					
				
					 5 changed files with 39 additions and 8 deletions
				
			
		|  | @ -3765,13 +3765,19 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node | |||
| 				break; | ||||
| 			case GDScriptParser::DataType::CLASS: | ||||
| 				// Can assume type is a global GDScript class.
 | ||||
| 				if (!ClassDB::is_parent_class(export_type.native_type, SNAME("Resource"))) { | ||||
| 					push_error(R"(Exported script type must extend Resource.)"); | ||||
| 				if (ClassDB::is_parent_class(export_type.native_type, SNAME("Resource"))) { | ||||
| 					variable->export_info.type = Variant::OBJECT; | ||||
| 					variable->export_info.hint = PROPERTY_HINT_RESOURCE_TYPE; | ||||
| 					variable->export_info.hint_string = export_type.class_type->identifier->name; | ||||
| 				} else if (ClassDB::is_parent_class(export_type.native_type, SNAME("Node"))) { | ||||
| 					variable->export_info.type = Variant::OBJECT; | ||||
| 					variable->export_info.hint = PROPERTY_HINT_NODE_TYPE; | ||||
| 					variable->export_info.hint_string = export_type.class_type->identifier->name; | ||||
| 				} else { | ||||
| 					push_error(R"(Export type can only be built-in, a resource, a node or an enum.)", variable); | ||||
| 					return false; | ||||
| 				} | ||||
| 				variable->export_info.type = Variant::OBJECT; | ||||
| 				variable->export_info.hint = PROPERTY_HINT_RESOURCE_TYPE; | ||||
| 				variable->export_info.hint_string = export_type.class_type->identifier->name; | ||||
| 
 | ||||
| 				break; | ||||
| 			case GDScriptParser::DataType::SCRIPT: { | ||||
| 				StringName class_name; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guilherme Sousa
						Guilherme Sousa