Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Core/GDCore/Project/CinematicSequence.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* GDevelop Core
* Copyright 2008-2026 Florian Rival (Florian.Rival@gmail.com). All rights
* reserved. This project is released under the MIT License.
*/

#include "CinematicSequence.h"
#include "GDCore/Serialization/SerializerElement.h"

namespace gd {

void CinematicSequence::SerializeTo(SerializerElement& element) const {
element.SetAttribute("name", name);
element.SetAttribute("sequenceData", sequenceData);
element.SetAttribute("associatedLayout", associatedLayout);
}

void CinematicSequence::UnserializeFrom(gd::Project& project,
const SerializerElement& element) {
name = element.GetStringAttribute("name", "", "Name");
sequenceData = element.GetStringAttribute("sequenceData", "");
associatedLayout = element.GetStringAttribute("associatedLayout", "", "AssociatedLayout");
}

} // namespace gd
83 changes: 83 additions & 0 deletions Core/GDCore/Project/CinematicSequence.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* GDevelop Core
* Copyright 2008-2026 Florian Rival (Florian.Rival@gmail.com). All rights
* reserved. This project is released under the MIT License.
*/

#pragma once

#include <memory>
#include "GDCore/String.h"
namespace gd {
class SerializerElement;
class Project;
}

namespace gd {

/**
* \brief A cinematic sequence allows to store keyframes, tracks and orchestrate
* an animation or a cutscene that can be then read and played at runtime.
*/
class GD_CORE_API CinematicSequence {
public:
CinematicSequence(){};
virtual ~CinematicSequence(){};

/**
* \brief Return a pointer to a new CinematicSequence constructed from this one.
*/
CinematicSequence* Clone() const { return new CinematicSequence(*this); };

/**
* \brief Return the name of the cinematic sequence.
*/
const gd::String& GetName() const { return name; }

/**
* \brief Change the name of the cinematic sequence.
*/
void SetName(const gd::String& name_) { name = name_; }

/**
* \brief Get the serialized content of the sequence (JSON format)
* managed by the IDE.
*/
const gd::String& GetSequenceData() const { return sequenceData; }

/**
* \brief Change the serialized content of the sequence.
*/
void SetSequenceData(const gd::String& data) { sequenceData = data; }

/**
* \brief Get the name of the layout last used to preview the cinematic sequence.
*/
const gd::String& GetAssociatedLayout() const { return associatedLayout; }

/**
* \brief Set the name of the layout used to preview the cinematic sequence.
*/
void SetAssociatedLayout(const gd::String& name) { associatedLayout = name; }

/** \name Serialization
*/
///@{
/**
* \brief Serialize cinematic sequence.
*/
void SerializeTo(SerializerElement& element) const;

/**
* \brief Unserialize the cinematic sequence.
*/
void UnserializeFrom(gd::Project &project, const SerializerElement& element);
///@}

private:
gd::String name;
gd::String sequenceData; // JSON representation of Tracks/Keyframes
gd::String associatedLayout; // Used to know in which layout we preview
};

} // namespace gd
Loading