Simplify Property code (#1575)

* Remove the PropertyDelegate

* Remove some unused and redundant property types

* Use helper functions for Lua/Json conversion

* Solve a bug in SelectionProperty that occurred when re-setting options

* General simplification and refactoring of the code
This commit is contained in:
Emma Broman
2021-05-04 09:32:29 +02:00
committed by GitHub
parent d47ac2f248
commit 804444e267
135 changed files with 1560 additions and 6710 deletions
@@ -133,7 +133,7 @@ namespace {
"Clear Projection Buffer",
"Remove all pending projections from the buffer"
};
struct [[codegen::Dictionary(RenderablePlanetProjection)]] Parameters {
// The geometry that is used for rendering this planet
ghoul::Dictionary geometry [[codegen::reference("space_geometry_planet")]];
@@ -177,7 +177,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
, _addColorTexturePath(AddColorTextureInfo)
, _heightMapTexturePaths(HeightTexturePathsInfo)
, _addHeightMapTexturePath(AddHeightTextureInfo)
, _heightExaggeration(HeightExaggerationInfo, 1.f, 0.f, 1e6f, 1.f, 3.f)
, _heightExaggeration(HeightExaggerationInfo, 1.f, 0.f, 1e6f, 1.f)
, _meridianShift(MeridianShiftInfo, false)
, _ambientBrightness(AmbientBrightnessInfo, 0.075f, 0.f, 1.f)
, _maxProjectionsPerFrame(MaxProjectionsPerFrameInfo, 1, 1, 64)
@@ -220,8 +220,6 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
});
addProperty(_addColorTexturePath);
_heightMapTexturePaths.addOption(0, NoImageText);
_heightMapTexturePaths.onChange([this]() { _heightMapTextureDirty = true; });
addProperty(_heightMapTexturePaths);
@@ -266,9 +264,10 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
addPropertySubOwner(_geometry.get());
addPropertySubOwner(_projectionComponent);
_heightExaggeration.setExponent(3.f);
_heightExaggeration = p.heightExaggeration.value_or(_heightExaggeration);
addProperty(_heightExaggeration);
_maxProjectionsPerFrame = p.maxProjectionsPerFrame.value_or(_maxProjectionsPerFrame);
addProperty(_maxProjectionsPerFrame);