Now HTMLTemplateDataEditorPlugin will only handle HTMLTemplateDatas, if they are on disk.

This commit is contained in:
Relintai 2024-02-25 19:25:58 +01:00
parent 35e328576a
commit ce638a69c1

View File

@ -96,6 +96,12 @@ void HTMLTemplateDataEditorPlugin::edit(Object *p_object) {
Ref<HTMLTemplateData> f = Ref<HTMLTemplateData>(Object::cast_to<HTMLTemplateData>(p_object)); Ref<HTMLTemplateData> f = Ref<HTMLTemplateData>(Object::cast_to<HTMLTemplateData>(p_object));
if (f.is_valid()) { if (f.is_valid()) {
String path = f->get_path();
if (path.empty()) {
return;
}
EditorPlugin *ep = EditorNode::get_singleton()->get_editor_by_name("Text"); EditorPlugin *ep = EditorNode::get_singleton()->get_editor_by_name("Text");
if (ep) { if (ep) {
@ -105,7 +111,15 @@ void HTMLTemplateDataEditorPlugin::edit(Object *p_object) {
} }
bool HTMLTemplateDataEditorPlugin::handles(Object *p_object) const { bool HTMLTemplateDataEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("HTMLTemplateData"); Ref<HTMLTemplateData> f = Ref<HTMLTemplateData>(Object::cast_to<HTMLTemplateData>(p_object));
if (f.is_valid()) {
String path = f->get_path();
return !path.empty();
}
return false;
} }
HTMLTemplateDataEditorPlugin::HTMLTemplateDataEditorPlugin(EditorNode *p_node) { HTMLTemplateDataEditorPlugin::HTMLTemplateDataEditorPlugin(EditorNode *p_node) {