Repository: godotengine/godot
File: editor/animation/animation_track_editor.h (C/C++)

Code before:
	virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage);
	virtual AnimationTrackEdit *create_audio_track_edit();
	virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object);
};

class AnimationTrackKeyEdit;
class AnimationMultiTrackKeyEdit;
class AnimationBezierTrackEdit;

class AnimationTrackEditGroup : public Control {
	friend class AnimationTrackEditor;

	GDCLASS(AnimationTrackEditGroup, Control);
	Ref<Texture2D> icon;
	Vector2 icon_size;
	String node_name;
	NodePath node;
	Node *root = nullptr;
	AnimationTimelineEdit *timeline = nullptr;
	AnimationTrackEditor *editor = nullptr;

	bool hovered = false;
	bool track_edits_visible = true;
	Vector<AnimationTrackEdit *> track_edits;

	void add_track_edit(AnimationTrackEdit *p_edit) { track_edits.append(p_edit); }
	void _zoom_changed();

protected:
	void _notification(int p_what);

	virtual void gui_input(const Ref<InputEvent> &p_event) override;

public:
	void set_type_and_name(const Ref<Texture2D> &p_type, const String &p_name, const NodePath &p_node);
	virtual Size2 get_minimum_size() const override;
	void set_timeline(AnimationTimelineEdit *p_timeline);
	void set_root(Node *p_root);
	void set_editor(AnimationTrackEditor *p_editor);
	String get_node_name() const;

	AnimationTrackEditGroup();
};

class AnimationTrackEditor : public VBoxContainer {
	GDCLASS(AnimationTrackEditor, VBoxContainer);
	friend class AnimationTimelineEdit;
	friend class AnimationBezierTrackEdit;
	friend class AnimationMarkerKeyEditEditor;

	Ref<Animation> animation;

Review comment (suggestion):
I would personally not bother with this method. You've already got `friend` access, so you might as well just `push_back` to the collection directly.

Alternatively, I guess you can also make this method public instead and drop the `friend` access.

Code after:
public:
	virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage);
	virtual AnimationTrackEdit *create_audio_track_edit();
	virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object);
};

class AnimationTrackKeyEdit;
class AnimationMultiTrackKeyEdit;
class AnimationBezierTrackEdit;

class AnimationTrackEditGroup : public Control {
	friend class AnimationTrackEditor;

	GDCLASS(AnimationTrackEditGroup, Control);
	Ref<Texture2D> icon;
	Vector2 icon_size;
	String node_name;
	NodePath node;
	Node *root = nullptr;
	AnimationTimelineEdit *timeline = nullptr;
	AnimationTrackEditor *editor = nullptr;

	bool hovered = false;
	LocalVector<AnimationTrackEdit *> track_edits;
	void _zoom_changed();

protected:
	void _notification(int p_what);

	virtual void gui_input(const Ref<InputEvent> &p_event) override;

public:
	void set_type_and_name(const Ref<Texture2D> &p_type, const String &p_name, const NodePath &p_node);
	virtual Size2 get_minimum_size() const override;
	void set_timeline(AnimationTimelineEdit *p_timeline);
	void set_root(Node *p_root);
	void set_editor(AnimationTrackEditor *p_editor);
	String get_node_name() const;

	AnimationTrackEditGroup();
};

class AnimationTrackEditor : public VBoxContainer {
	GDCLASS(AnimationTrackEditor, VBoxContainer);
	friend class AnimationTimelineEdit;
	friend class AnimationBezierTrackEdit;
	friend class AnimationMarkerKeyEditEditor;

	Ref<Animation> animation;
	bool read_only = false;
	Node *root = nullptr;