Abort threaded preview generators on exit
This commit is contained in:
parent
2b987d1c54
commit
e90ea87b42
5 changed files with 114 additions and 110 deletions
|
|
@ -295,6 +295,10 @@ void EditorMaterialPreviewPlugin::_preview_done() {
|
|||
preview_done.post();
|
||||
}
|
||||
|
||||
void EditorMaterialPreviewPlugin::abort() {
|
||||
preview_done.post();
|
||||
}
|
||||
|
||||
bool EditorMaterialPreviewPlugin::handles(const String &p_type) const {
|
||||
return ClassDB::is_parent_class(p_type, "Material"); // Any material.
|
||||
}
|
||||
|
|
@ -690,6 +694,10 @@ void EditorMeshPreviewPlugin::_preview_done() {
|
|||
preview_done.post();
|
||||
}
|
||||
|
||||
void EditorMeshPreviewPlugin::abort() {
|
||||
preview_done.post();
|
||||
}
|
||||
|
||||
bool EditorMeshPreviewPlugin::handles(const String &p_type) const {
|
||||
return ClassDB::is_parent_class(p_type, "Mesh"); // Any mesh.
|
||||
}
|
||||
|
|
@ -807,6 +815,10 @@ void EditorFontPreviewPlugin::_preview_done() {
|
|||
preview_done.post();
|
||||
}
|
||||
|
||||
void EditorFontPreviewPlugin::abort() {
|
||||
preview_done.post();
|
||||
}
|
||||
|
||||
bool EditorFontPreviewPlugin::handles(const String &p_type) const {
|
||||
return ClassDB::is_parent_class(p_type, "Font");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ public:
|
|||
virtual bool handles(const String &p_type) const override;
|
||||
virtual bool generate_small_preview_automatically() const override;
|
||||
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
|
||||
virtual void abort() override;
|
||||
|
||||
EditorMaterialPreviewPlugin();
|
||||
~EditorMaterialPreviewPlugin();
|
||||
|
|
@ -149,6 +150,7 @@ class EditorMeshPreviewPlugin : public EditorResourcePreviewGenerator {
|
|||
public:
|
||||
virtual bool handles(const String &p_type) const override;
|
||||
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
|
||||
virtual void abort() override;
|
||||
|
||||
EditorMeshPreviewPlugin();
|
||||
~EditorMeshPreviewPlugin();
|
||||
|
|
@ -170,27 +172,12 @@ public:
|
|||
virtual bool handles(const String &p_type) const override;
|
||||
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
|
||||
virtual Ref<Texture2D> generate_from_path(const String &p_path, const Size2 &p_size, Dictionary &p_metadata) const override;
|
||||
virtual void abort() override;
|
||||
|
||||
EditorFontPreviewPlugin();
|
||||
~EditorFontPreviewPlugin();
|
||||
};
|
||||
|
||||
class EditorTileMapPatternPreviewPlugin : public EditorResourcePreviewGenerator {
|
||||
GDCLASS(EditorTileMapPatternPreviewPlugin, EditorResourcePreviewGenerator);
|
||||
|
||||
Semaphore preview_done;
|
||||
|
||||
void _generate_frame_started();
|
||||
void _preview_done();
|
||||
|
||||
public:
|
||||
virtual bool handles(const String &p_type) const override;
|
||||
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
|
||||
|
||||
EditorTileMapPatternPreviewPlugin();
|
||||
~EditorTileMapPatternPreviewPlugin();
|
||||
};
|
||||
|
||||
class EditorGradientPreviewPlugin : public EditorResourcePreviewGenerator {
|
||||
GDCLASS(EditorGradientPreviewPlugin, EditorResourcePreviewGenerator);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue