mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	Fix GDScript exports having the wrong type of default value by converting it
Also, initialize elements of PoolArrays when resizing them in the editor. Fixes #26066.
This commit is contained in:
		
							parent
							
								
									22ee7ba4f0
								
							
						
					
					
						commit
						db7864c1fd
					
				
					 2 changed files with 22 additions and 2 deletions
				
			
		|  | @ -4691,6 +4691,16 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { | |||
| 
 | ||||
| 						ConstantNode *cn = static_cast<ConstantNode *>(subexpr); | ||||
| 						if (cn->value.get_type() != Variant::NIL) { | ||||
| 							if (member._export.type != Variant::NIL && cn->value.get_type() != member._export.type) { | ||||
| 								if (Variant::can_convert(cn->value.get_type(), member._export.type)) { | ||||
| 									Variant::CallError err; | ||||
| 									const Variant *args = &cn->value; | ||||
| 									cn->value = Variant::construct(member._export.type, &args, 1, err); | ||||
| 								} else { | ||||
| 									_set_error("Cannot convert the provided value to the export type."); | ||||
| 									return; | ||||
| 								} | ||||
| 							} | ||||
| 							member.default_value = cn->value; | ||||
| 						} | ||||
| 					} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Bojidar Marinov
						Bojidar Marinov