mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 05:31:01 +00:00 
			
		
		
		
	Don't crash on previewing an AtlasTexture without a region
This commit is contained in:
		
							parent
							
								
									270bbee018
								
							
						
					
					
						commit
						464e1142c4
					
				
					 2 changed files with 8 additions and 0 deletions
				
			
		|  | @ -92,7 +92,12 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 | ||||||
| 		if (!tex.is_valid()) { | 		if (!tex.is_valid()) { | ||||||
| 			return Ref<Texture>(); | 			return Ref<Texture>(); | ||||||
| 		} | 		} | ||||||
|  | 
 | ||||||
| 		Ref<Image> atlas = tex->get_data(); | 		Ref<Image> atlas = tex->get_data(); | ||||||
|  | 		if (!atlas.is_valid()) { | ||||||
|  | 			return Ref<Texture>(); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		img = atlas->get_rect(atex->get_region()); | 		img = atlas->get_rect(atex->get_region()); | ||||||
| 	} else if (ltex.is_valid()) { | 	} else if (ltex.is_valid()) { | ||||||
| 		img = ltex->to_image(); | 		img = ltex->to_image(); | ||||||
|  |  | ||||||
|  | @ -426,6 +426,8 @@ ImageTexture::ImageTexture() { | ||||||
| 	texture = VisualServer::get_singleton()->texture_create(); | 	texture = VisualServer::get_singleton()->texture_create(); | ||||||
| 	storage = STORAGE_RAW; | 	storage = STORAGE_RAW; | ||||||
| 	lossy_storage_quality = 0.7; | 	lossy_storage_quality = 0.7; | ||||||
|  | 	image_stored = false; | ||||||
|  | 	format = Image::Format::FORMAT_L8; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ImageTexture::~ImageTexture() { | ImageTexture::~ImageTexture() { | ||||||
|  | @ -1514,6 +1516,7 @@ CubeMap::CubeMap() { | ||||||
| 	cubemap = VisualServer::get_singleton()->texture_create(); | 	cubemap = VisualServer::get_singleton()->texture_create(); | ||||||
| 	storage = STORAGE_RAW; | 	storage = STORAGE_RAW; | ||||||
| 	lossy_storage_quality = 0.7; | 	lossy_storage_quality = 0.7; | ||||||
|  | 	format = Image::Format::FORMAT_BPTC_RGBA; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| CubeMap::~CubeMap() { | CubeMap::~CubeMap() { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hein-Pieter van Braam
						Hein-Pieter van Braam