Repository: godotengine/godot
File: editor/scene/sprite_frames_editor_plugin.cpp (C++)

Code before:
		return true;
	}
	return false;
}

void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
	if (p_visible) {
		button->show();
		EditorNode::get_bottom_panel()->make_item_visible(frames_editor);
	} else {
		button->hide();
		if (frames_editor->is_visible_in_tree()) {
			EditorNode::get_bottom_panel()->hide_bottom_panel();
		}
	}
}

SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() {
	frames_editor = memnew(SpriteFramesEditor);
	frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
	button = EditorNode::get_bottom_panel()->add_item(TTRC("SpriteFrames"), frames_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTRC("Toggle SpriteFrames Bottom Panel")));
	button->hide();
}

Ref<ClipboardAnimation> ClipboardAnimation::from_sprite_frames(const Ref<SpriteFrames> &p_frames, const String &p_anim, bool p_is_copy) {
	Ref<ClipboardAnimation> clipboard_anim = memnew(ClipboardAnimation);
	clipboard_anim->animation_name = p_anim;
	clipboard_anim->animation_speed = p_frames->get_animation_speed(p_anim);
	clipboard_anim->animation_loop = p_frames->get_animation_loop(p_anim);
	clipboard_anim->is_copy = p_is_copy;

	int frame_count = p_frames->get_frame_count(p_anim);
	for (int i = 0; i < frame_count; ++i) {
		ClipboardSpriteFrames::Frame frame;
		frame.texture = p_frames->get_frame_texture(p_anim, i);
		frame.duration = p_frames->get_frame_duration(p_anim, i);
		clipboard_anim->animation_frames.push_back(frame);
	}
	return clipboard_anim;
}


Review comment (suggestion):
```suggestion
	Ref<ClipboardAnimation> clipboard_anim;
	clipboard_anim.instantiate();
```
Preferred syntax 

Code after:
	if (animated_sprite_2d && *animated_sprite_2d->get_sprite_frames()) {
		return true;
	}
	AnimatedSprite3D *animated_sprite_3d = Object::cast_to<AnimatedSprite3D>(p_object);
	if (animated_sprite_3d && *animated_sprite_3d->get_sprite_frames()) {
		return true;
	}
	SpriteFrames *frames = Object::cast_to<SpriteFrames>(p_object);
	if (frames && (frames_editor->get_sprite_frames().is_null() || frames_editor->get_sprite_frames() == frames)) {
		return true;
	}
	return false;
}

void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
	if (p_visible) {
		button->show();
		EditorNode::get_bottom_panel()->make_item_visible(frames_editor);
	} else {
		button->hide();
		if (frames_editor->is_visible_in_tree()) {
			EditorNode::get_bottom_panel()->hide_bottom_panel();
		}
	}
}

SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() {
	frames_editor = memnew(SpriteFramesEditor);
	frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
	button = EditorNode::get_bottom_panel()->add_item(TTRC("SpriteFrames"), frames_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTRC("Toggle SpriteFrames Bottom Panel")));
	button->hide();
}

Ref<ClipboardAnimation> ClipboardAnimation::from_sprite_frames(const Ref<SpriteFrames> &p_frames, const String &p_anim) {
	Ref<ClipboardAnimation> clipboard_anim;
	clipboard_anim.instantiate();
	clipboard_anim->name = p_anim;
	clipboard_anim->speed = p_frames->get_animation_speed(p_anim);
	clipboard_anim->loop = p_frames->get_animation_loop(p_anim);

	int frame_count = p_frames->get_frame_count(p_anim);
	for (int i = 0; i < frame_count; ++i) {
		ClipboardSpriteFrames::Frame frame;
		frame.texture = p_frames->get_frame_texture(p_anim, i);
		frame.duration = p_frames->get_frame_duration(p_anim, i);
		clipboard_anim->frames.push_back(frame);
	}
	return clipboard_anim;
}