mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Add extended check option to GDFunctionState::is_valid()
This commit is contained in:
		
							parent
							
								
									9fa4f1c54c
								
							
						
					
					
						commit
						b69d4ebff4
					
				
					 3 changed files with 20 additions and 4 deletions
				
			
		|  | @ -1433,9 +1433,21 @@ Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount | |||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| bool GDFunctionState::is_valid() const { | ||||
| bool GDFunctionState::is_valid(bool p_extended_check) const { | ||||
| 
 | ||||
| 	return function != NULL; | ||||
| 	if (function == NULL) | ||||
| 		return false; | ||||
| 
 | ||||
| 	if (p_extended_check) { | ||||
| 		//class instance gone?
 | ||||
| 		if (state.instance_id && !ObjectDB::get_instance(state.instance_id)) | ||||
| 			return false; | ||||
| 		//script gone?
 | ||||
| 		if (state.script_id && !ObjectDB::get_instance(state.script_id)) | ||||
| 			return false; | ||||
| 	} | ||||
| 
 | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| Variant GDFunctionState::resume(const Variant &p_arg) { | ||||
|  | @ -1464,7 +1476,7 @@ Variant GDFunctionState::resume(const Variant &p_arg) { | |||
| void GDFunctionState::_bind_methods() { | ||||
| 
 | ||||
| 	ClassDB::bind_method(D_METHOD("resume:Variant", "arg"), &GDFunctionState::resume, DEFVAL(Variant())); | ||||
| 	ClassDB::bind_method(D_METHOD("is_valid"), &GDFunctionState::is_valid); | ||||
| 	ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDFunctionState::is_valid, DEFVAL(false)); | ||||
| 	ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &GDFunctionState::_signal_callback, MethodInfo("_signal_callback")); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pedro J. Estébanez
						Pedro J. Estébanez