mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	make sure array is created if not existing, as noted by Guilherme Felipe
This commit is contained in:
		
							parent
							
								
									d50921b550
								
							
						
					
					
						commit
						b0be30d9ef
					
				
					 4 changed files with 14 additions and 7 deletions
				
			
		|  | @ -9,7 +9,12 @@ Variant ArrayPropertyEdit::get_array() const{ | |||
| 	Object*o = ObjectDB::get_instance(obj); | ||||
| 	if (!o) | ||||
| 		return Array(); | ||||
| 	return o->get(property); | ||||
| 	Variant arr=o->get(property); | ||||
| 	if (!arr.is_array()) { | ||||
| 		Variant::CallError ce; | ||||
| 		arr=Variant::construct(default_type,NULL,0,ce); | ||||
| 	} | ||||
| 	return arr; | ||||
| } | ||||
| 
 | ||||
| void ArrayPropertyEdit::_notif_change() { | ||||
|  | @ -195,11 +200,12 @@ void ArrayPropertyEdit::_get_property_list( List<PropertyInfo> *p_list) const{ | |||
| 
 | ||||
| } | ||||
| 
 | ||||
| void ArrayPropertyEdit::edit(Object* p_obj,const StringName& p_prop) { | ||||
| void ArrayPropertyEdit::edit(Object* p_obj,const StringName& p_prop,Variant::Type p_deftype) { | ||||
| 
 | ||||
| 	page=0; | ||||
| 	property=p_prop; | ||||
| 	obj=p_obj->get_instance_ID(); | ||||
| 	default_type=p_deftype; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  | @ -220,5 +226,6 @@ ArrayPropertyEdit::ArrayPropertyEdit() | |||
| 			vtypes+=","; | ||||
| 		vtypes+=Variant::get_type_name( Variant::Type(i) ); | ||||
| 	} | ||||
| 	default_type=Variant::NIL; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Juan Linietsky
						Juan Linietsky