Accept DynamicFontData for Fonts

This commit is contained in:
Tomasz Chabora 2020-08-25 18:12:35 +02:00
parent b2aae76f85
commit b5fe41988b

View file

@ -36,6 +36,7 @@
#include "editor_properties_array_dict.h"
#include "editor_scale.h"
#include "scene/main/window.h"
#include "scene/resources/dynamic_font.h"
///////////////////// NULL /////////////////////////
@ -3014,6 +3015,8 @@ bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const
allowed_types.append("Texture2D");
} else if (at == "ShaderMaterial") {
allowed_types.append("Shader");
} else if (at == "Font") {
allowed_types.append("DynamicFontData");
}
}
@ -3111,6 +3114,13 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &
res = mat;
break;
}
if (at == "Font" && ClassDB::is_parent_class(res->get_class(), "DynamicFontData")) {
Ref<DynamicFont> font = memnew(DynamicFont);
font->set_font_data(res);
res = font;
break;
}
}
}