Skip to content

Commit

Permalink
wip quick customization
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementPasteau committed Sep 19, 2024
1 parent 0d36a27 commit 0804cc6
Show file tree
Hide file tree
Showing 52 changed files with 1,621 additions and 966 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
"__bits": "cpp",
"__verbose_abort": "cpp",
"variant": "cpp",
"charconv": "cpp"
"charconv": "cpp",
"execution": "cpp"
},
"files.exclude": {
"Binaries/*build*": true,
Expand Down
59 changes: 48 additions & 11 deletions Core/GDCore/Project/BehaviorConfigurationContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

#include <map>
#include <memory>
#include "GDCore/Serialization/Serializer.h"

#include "GDCore/Project/QuickCustomization.h"
#include "GDCore/Project/QuickCustomizationVisibilitiesContainer.h"
#include "GDCore/Serialization/Serializer.h"
#include "GDCore/String.h"

namespace gd {
Expand All @@ -32,12 +34,21 @@ namespace gd {
*/
class GD_CORE_API BehaviorConfigurationContainer {
public:
BehaviorConfigurationContainer() : folded(false), quickCustomizationVisibility(QuickCustomization::Visibility::Default){};
BehaviorConfigurationContainer()
: folded(false),
quickCustomizationVisibility(QuickCustomization::Visibility::Default),
propertiesQuickCustomizationVisibilities() {};
BehaviorConfigurationContainer(const gd::String& name_,
const gd::String& type_)
: name(name_), type(type_), folded(false), quickCustomizationVisibility(QuickCustomization::Visibility::Default){};
: name(name_),
type(type_),
folded(false),
quickCustomizationVisibility(QuickCustomization::Visibility::Default),
propertiesQuickCustomizationVisibilities() {};
virtual ~BehaviorConfigurationContainer();
virtual BehaviorConfigurationContainer* Clone() const { return new BehaviorConfigurationContainer(*this); }
virtual BehaviorConfigurationContainer* Clone() const {
return new BehaviorConfigurationContainer(*this);
}

/**
* \brief Return the name identifying the behavior
Expand Down Expand Up @@ -68,7 +79,6 @@ class GD_CORE_API BehaviorConfigurationContainer {
*/
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const;


/**
* \brief Called when the IDE wants to update a custom property of the
* behavior
Expand All @@ -84,9 +94,7 @@ class GD_CORE_API BehaviorConfigurationContainer {
* \brief Called to initialize the content with the default properties
* for the behavior.
*/
virtual void InitializeContent() {
InitializeContent(content);
};
virtual void InitializeContent() { InitializeContent(content); };

/**
* \brief Serialize the behavior content.
Expand Down Expand Up @@ -115,15 +123,42 @@ class GD_CORE_API BehaviorConfigurationContainer {
*/
bool IsFolded() const { return folded; }

void SetQuickCustomizationVisibility(QuickCustomization::Visibility visibility) {
/**
* @brief Set if the whole behavior should be visible or not in the Quick
* Customization.
*/
void SetQuickCustomizationVisibility(
QuickCustomization::Visibility visibility) {
quickCustomizationVisibility = visibility;
}

/**
* @brief Get if the whole behavior should be visible or not in the Quick
* Customization.
*/
QuickCustomization::Visibility GetQuickCustomizationVisibility() const {
return quickCustomizationVisibility;
}

protected:
/**
* @brief Get the map of properties and their visibility in the Quick
* Customization.
*/
QuickCustomizationVisibilitiesContainer&
GetPropertiesQuickCustomizationVisibilities() {
return propertiesQuickCustomizationVisibilities;
}

/**
* @brief Get the map of properties and their visibility in the Quick
* Customization.
*/
const QuickCustomizationVisibilitiesContainer&
GetPropertiesQuickCustomizationVisibilities() const {
return propertiesQuickCustomizationVisibilities;
}

protected:
/**
* \brief Called when the IDE wants to know about the custom properties of the
* behavior.
Expand Down Expand Up @@ -159,7 +194,7 @@ class GD_CORE_API BehaviorConfigurationContainer {
* \brief Called to initialize the content with the default properties
* for the behavior.
*/
virtual void InitializeContent(gd::SerializerElement& behaviorContent){};
virtual void InitializeContent(gd::SerializerElement& behaviorContent) {};

private:
gd::String name; ///< Name of the behavior
Expand All @@ -169,6 +204,8 @@ class GD_CORE_API BehaviorConfigurationContainer {
gd::SerializerElement content; // Storage for the behavior properties
bool folded;
QuickCustomization::Visibility quickCustomizationVisibility;
QuickCustomizationVisibilitiesContainer
propertiesQuickCustomizationVisibilities;
};

} // namespace gd
Expand Down
Loading

0 comments on commit 0804cc6

Please sign in to comment.