You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Fix ghost SpriteFramesEditor cause crash
This commit is contained in:
@@ -1171,32 +1171,29 @@ void SpriteFramesEditor::edit(Ref<SpriteFrames> p_frames) {
|
|||||||
|
|
||||||
if (!p_frames.is_valid()) {
|
if (!p_frames.is_valid()) {
|
||||||
frames.unref();
|
frames.unref();
|
||||||
|
hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
frames = p_frames;
|
frames = p_frames;
|
||||||
read_only = EditorNode::get_singleton()->is_resource_read_only(p_frames);
|
read_only = EditorNode::get_singleton()->is_resource_read_only(p_frames);
|
||||||
|
|
||||||
if (p_frames.is_valid()) {
|
if (!p_frames->has_animation(edited_anim)) {
|
||||||
if (!p_frames->has_animation(edited_anim)) {
|
List<StringName> anim_names;
|
||||||
List<StringName> anim_names;
|
frames->get_animation_list(&anim_names);
|
||||||
frames->get_animation_list(&anim_names);
|
anim_names.sort_custom<StringName::AlphCompare>();
|
||||||
anim_names.sort_custom<StringName::AlphCompare>();
|
if (anim_names.size()) {
|
||||||
if (anim_names.size()) {
|
edited_anim = anim_names.front()->get();
|
||||||
edited_anim = anim_names.front()->get();
|
} else {
|
||||||
} else {
|
edited_anim = StringName();
|
||||||
edited_anim = StringName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_update_library();
|
|
||||||
// Clear zoom and split sheet texture
|
|
||||||
split_sheet_preview->set_texture(Ref<Texture2D>());
|
|
||||||
_zoom_reset();
|
|
||||||
} else {
|
|
||||||
hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_update_library();
|
||||||
|
// Clear zoom and split sheet texture
|
||||||
|
split_sheet_preview->set_texture(Ref<Texture2D>());
|
||||||
|
_zoom_reset();
|
||||||
|
|
||||||
add_anim->set_disabled(read_only);
|
add_anim->set_disabled(read_only);
|
||||||
delete_anim->set_disabled(read_only);
|
delete_anim->set_disabled(read_only);
|
||||||
anim_speed->set_editable(!read_only);
|
anim_speed->set_editable(!read_only);
|
||||||
|
|||||||
Reference in New Issue
Block a user