GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
EffectMetadata.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-present Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 #pragma once
7 
8 #include <functional>
9 #include <map>
10 #include <memory>
11 #include <algorithm>
12 
13 #include "GDCore/Project/PropertyDescriptor.h"
14 #include "GDCore/String.h"
15 
16 namespace gd {
17 
23 class GD_CORE_API EffectMetadata {
24  public:
28  EffectMetadata(const gd::String &type_)
29  : type(type_), isMarkedAsNotWorkingForObjects(false),
30  isMarkedAsOnlyWorkingFor2D(false), isMarkedAsOnlyWorkingFor3D(false),
31  isMarkedAsUnique(false) {}
32 
38 
39  virtual ~EffectMetadata(){};
40 
44  EffectMetadata &SetFullName(const gd::String &fullname_) {
45  fullname = fullname_;
46  return *this;
47  };
48 
52  EffectMetadata& SetDescription(const gd::String& description_) {
53  description = description_;
54  return *this;
55  };
56 
62  helpPath = path;
63  return *this;
64  }
65 
71  EffectMetadata& SetIncludeFile(const gd::String& includeFile);
72 
76  EffectMetadata& AddIncludeFile(const gd::String& includeFile);
77 
81  std::map<gd::String, gd::PropertyDescriptor>& GetProperties() {
82  return properties;
83  }
84 
88  const std::map<gd::String, gd::PropertyDescriptor>& GetProperties() const {
89  return properties;
90  }
91 
96  const gd::String& GetHelpPath() const { return helpPath; }
97 
102  const gd::String& GetType() const { return type; }
103 
107  const gd::String& GetFullName() const { return fullname; }
108 
112  const gd::String& GetDescription() const { return description; }
113 
117  const std::vector<gd::String>& GetIncludeFiles() const {
118  return includeFiles;
119  }
120 
125  isMarkedAsNotWorkingForObjects = true;
126  return *this;
127  }
128 
133  isMarkedAsOnlyWorkingFor2D = true;
134  return *this;
135  }
136 
141  isMarkedAsOnlyWorkingFor3D = true;
142  return *this;
143  }
144 
149  isMarkedAsUnique = true;
150  return *this;
151  }
152 
157  return isMarkedAsNotWorkingForObjects;
158  };
159 
164  return isMarkedAsOnlyWorkingFor2D;
165  };
166 
171  return isMarkedAsOnlyWorkingFor3D;
172  };
173 
177  bool IsMarkedAsUnique() const {
178  return isMarkedAsUnique;
179  };
180 
181  private:
182  gd::String extensionNamespace;
183  gd::String type;
184  gd::String helpPath;
185  gd::String fullname;
186  gd::String description;
187  std::vector<gd::String> includeFiles;
188  bool isMarkedAsNotWorkingForObjects = false;
189  bool isMarkedAsOnlyWorkingFor2D = false;
190  bool isMarkedAsOnlyWorkingFor3D = false;
191  bool isMarkedAsUnique = false;
192  std::map<gd::String, gd::PropertyDescriptor> properties;
193 };
194 
195 } // namespace gd
Contains user-friendly information about an effect.
Definition: EffectMetadata.h:23
EffectMetadata & MarkAsOnlyWorkingFor3D()
Mark the effect as only working for the 3D renderer.
Definition: EffectMetadata.h:140
EffectMetadata & MarkAsNotWorkingForObjects()
Mark the effect as not working as an object effect.
Definition: EffectMetadata.h:124
const std::vector< gd::String > & GetIncludeFiles() const
Get the required include files for this effect.
Definition: EffectMetadata.h:117
EffectMetadata(const gd::String &type_)
Construct an effect metadata, with the given type.
Definition: EffectMetadata.h:28
bool IsMarkedAsUnique() const
Check if the effect can only be added once.
Definition: EffectMetadata.h:177
const gd::String & GetHelpPath() const
Get the help path of the effect, relative to the GDevelop documentation root.
Definition: EffectMetadata.h:96
const gd::String & GetDescription() const
Get the user friendly description of the effect.
Definition: EffectMetadata.h:112
const std::map< gd::String, gd::PropertyDescriptor > & GetProperties() const
Return a (const) reference to the properties of this effect.
Definition: EffectMetadata.h:88
bool IsMarkedAsOnlyWorkingFor2D() const
Check if the effect is marked as only working for the 2D renderer.
Definition: EffectMetadata.h:163
const gd::String & GetType() const
Get the type of the effect (its internal name, like "BlackAndWhite").
Definition: EffectMetadata.h:102
bool IsMarkedAsOnlyWorkingFor3D() const
Check if the effect is marked as only working for the 3D renderer.
Definition: EffectMetadata.h:170
std::map< gd::String, gd::PropertyDescriptor > & GetProperties()
Return a reference to the properties of this effect.
Definition: EffectMetadata.h:81
EffectMetadata & SetFullName(const gd::String &fullname_)
Set the name shown to the user.
Definition: EffectMetadata.h:44
const gd::String & GetFullName() const
Get the user facing name of the effect (like "Black and White").
Definition: EffectMetadata.h:107
EffectMetadata & SetHelpPath(const gd::String &path)
Definition: EffectMetadata.h:61
EffectMetadata()
Default constructor, only used for initializing badEffectMetadata.
Definition: EffectMetadata.h:37
EffectMetadata & SetDescription(const gd::String &description_)
Set the description shown to the user.
Definition: EffectMetadata.h:52
EffectMetadata & MarkAsUnique()
Mark the effect as only addable once.
Definition: EffectMetadata.h:148
EffectMetadata & MarkAsOnlyWorkingFor2D()
Mark the effect as only working for the 2D renderer.
Definition: EffectMetadata.h:132
bool IsMarkedAsNotWorkingForObjects() const
Check if the effect is marked as not working as an object effect.
Definition: EffectMetadata.h:156
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24