Breaking change: Change property owner identifier renderable to Renderable

This commit is contained in:
Emil Axelsson
2018-11-06 14:58:11 -05:00
parent 8e93463c1a
commit c58ae52735
14 changed files with 77 additions and 69 deletions

View File

@@ -30,7 +30,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
@@ -45,7 +45,7 @@ asset.onInitialize(function ()
end)
asset.onDeinitialize(function ()
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"Dawn", "Ceres", "Vesta"
})

View File

@@ -23,10 +23,10 @@ asset.request('customization/globebrowsing')
local Keybindings = {
{
Key = "s",
Command = propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.PerformShading') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Atmosphere') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled'),
Command = propertyHelper.invert('Scene.Earth.Renderable.Layers.NightLayers.Earth at Night 2012.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.PerformShading') ..
propertyHelper.invert('Scene.Earth.Renderable.Atmosphere') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.WaterMasks.MODIS_Water_Mask.Enabled'),
Name = "Night for earth",
Documentation = "Toggle night texture, shading, atmosphere, and water for Earth.",
GuiPath = "/Rendering",
@@ -35,8 +35,8 @@ local Keybindings = {
{
Key = "b",
Name = "Toggle background",
Command = propertyHelper.invert('Scene.MilkyWay.renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.renderable.Enabled'),
Command = propertyHelper.invert('Scene.MilkyWay.Renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.Renderable.Enabled'),
Documentation = "Toggle background (Stars and Milkyway).",
GuiPath = "/Rendering",
Local = false
@@ -44,14 +44,14 @@ local Keybindings = {
{
Key = "g",
Name = "Toggle background/shading",
Command = propertyHelper.invert('Scene.MilkyWay.renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.NightLayers.Earth_at_Night_2012.Enabled') ..
propertyHelper.invert('Scene.EarthAtmosphere.renderable.Enabled') ..
propertyHelper.invert('Scene.MarsAtmosphere.renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled') ..
propertyHelper.invert('Scene.Moon.RenderableGlobe.Enabled') ..
propertyHelper.invert('Scene.Sun.renderable.Enabled'),
Command = propertyHelper.invert('Scene.MilkyWay.Renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.Renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Enabled') ..
propertyHelper.invert('Scene.EarthAtmosphere.Renderable.Enabled') ..
propertyHelper.invert('Scene.MarsAtmosphere.Renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.WaterMasks.MODIS_Water_Mask.Enabled') ..
propertyHelper.invert('Scene.Moon.Renderable.Enabled') ..
propertyHelper.invert('Scene.Sun.Renderable.Enabled'),
Documentation = "Toogles background and shading mode on the Earth and Mars alongside visibility of the Moon and the Sun",
GuiPath = "/Rendering",
Local = false
@@ -59,7 +59,7 @@ local Keybindings = {
{
Key = "h",
Name="Hide Trails",
Command = "openspace.setPropertyValue('Scene.*Trail.renderable.Enabled', false)",
Command = "openspace.setPropertyValue('Scene.*Trail.Renderable.Enabled', false)",
Documentation = "Disables visibility of the trails",
GuiPath = "/Rendering",
Local = false
@@ -88,7 +88,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"Scene.*Trail.renderable.Enabled",
"Scene.*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
@@ -107,7 +107,7 @@ end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"Earth", "Mars", "Moon"

View File

@@ -44,7 +44,7 @@ assetHelper.registerDashboardItems(asset, {
Type = "DashboardItemPropertyValue",
Identifier = "asd",
GuiName = "adasd",
URI = "Scene.Earth.RenderableGlobe.Enabled",
URI = "Scene.Earth.Renderable.Enabled",
DisplayString = "Earth is enabled: {}"
}
})

View File

@@ -4,21 +4,21 @@ states = {
{
Title = "Highlight EarthTrail",
Play = function ()
openspace.setPropertyValue("Scene.EarthTrail.renderable.LineWidth", 10, 1)
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 10, 1)
end,
Rewind = function ()
openspace.setPropertyValue("Scene.EarthTrail.renderable.LineWidth", 2, 1)
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 2, 1)
end
},
{
Title = "Highlight MarsTrail",
Play = function ()
openspace.setPropertyValue("Scene.EarthTrail.renderable.LineWidth", 2, 1)
openspace.setPropertyValue("Scene.MarsTrail.renderable.LineWidth", 10, 1)
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 2, 1)
openspace.setPropertyValue("Scene.MarsTrail.Renderable.LineWidth", 10, 1)
end,
Rewind = function ()
openspace.setPropertyValue("Scene.MarsTrail.renderable.LineWidth", 2, 1)
openspace.setPropertyValue("Scene.EarthTrail.renderable.LineWidth", 10, 1)
openspace.setPropertyValue("Scene.MarsTrail.Renderable.LineWidth", 2, 1)
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 10, 1)
end
}
}

View File

@@ -33,7 +33,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
@@ -48,7 +48,7 @@ asset.onInitialize(function ()
end)
asset.onDeinitialize(function ()
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"Jupiter", "Juno"

View File

@@ -54,7 +54,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"Scene.*Trail.renderable.Enabled",
"Scene.*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,

View File

@@ -44,8 +44,8 @@ local Keybindings = {
},
{
Key = "F8",
Command = "openspace.setPropertyValue('Scene.Pluto.renderable.ProjectionComponent.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.renderable.ProjectionComponent.ClearAllProjections', true);",
Command = "openspace.setPropertyValue('Scene.Pluto.Renderable.ProjectionComponent.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.Renderable.ProjectionComponent.ClearAllProjections', true);",
Documentation = "Removes all image projections from Pluto and Charon.",
Name = "Clear image projections",
GuiPath = "/New Horizons",
@@ -54,8 +54,8 @@ local Keybindings = {
{
Key = "F9",
Command = "openspace.time.setTime('2015-07-14T09:00:00.00');" ..
"openspace.setPropertyValue('Scene.Pluto.renderable.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.renderable.ClearAllProjections', true);",
"openspace.setPropertyValue('Scene.Pluto.Renderable.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.Renderable.ClearAllProjections', true);",
Documentation = "Jumps to the 14th of July 2015 at 0900 UTC and clears all projections.",
Name = "Reset time and projections",
GuiPath = "/New Horizons",
@@ -63,7 +63,7 @@ local Keybindings = {
},
{
Key = "KP_8",
Command = propertyHelper.increment('Scene.Pluto.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.increment('Scene.Pluto.Renderable.HeightExaggeration', 5000000),
Documentation = "Increases the height map exaggeration on Pluto.",
Name = "Pluto HeightExaggeration +",
GuiPath = "/New Horizons",
@@ -71,7 +71,7 @@ local Keybindings = {
},
{
Key = "KP_2",
Command = propertyHelper.decrement('Scene.Pluto.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.decrement('Scene.Pluto.Renderable.HeightExaggeration', 5000000),
Documentation = "Decreases the height map exaggeration on Pluto.",
Name = "Pluto HeightExaggeration -",
GuiPath = "/New Horizons",
@@ -79,7 +79,7 @@ local Keybindings = {
},
{
Key = "KP_9",
Command = propertyHelper.increment('Scene.Charon.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.increment('Scene.Charon.Renderable.HeightExaggeration', 5000000),
Documentation = "Increases the height map exaggeration on Charon.",
Name = "Charon HeightExaggeration +",
GuiPath = "/New Horizons",
@@ -87,7 +87,7 @@ local Keybindings = {
},
{
Key = "KP_3",
Command = propertyHelper.decrement('Scene.Charon.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.decrement('Scene.Charon.Renderable.HeightExaggeration', 5000000),
Documentation = "Decreases the height map exaggeration on Charon.",
Name = "Charon HeightExaggeration -",
GuiPath = "/New Horizons",
@@ -95,7 +95,7 @@ local Keybindings = {
},
{
Key = "o",
Command = propertyHelper.invert('Scene.PlutoTrail.renderable.Enabled'),
Command = propertyHelper.invert('Scene.PlutoTrail.Renderable.Enabled'),
Documentation = "Toggles the visibility of the trail behind Pluto.",
Name = "Toggle Pluto Trail",
GuiPath = "/New Horizons",
@@ -113,7 +113,7 @@ local Keybindings = {
},
{
Key = "l",
Command = propertyHelper.fadeInOut('Scene.Labels.renderable.Opacity', 2.0),
Command = propertyHelper.fadeInOut('Scene.Labels.Renderable.Opacity', 2.0),
Documentation = "Toggles the visibility of the labels for the New Horizons instruments.",
Name = "Toggle New Horizons Labels",
GuiPath = "/New Horizons",
@@ -121,17 +121,17 @@ local Keybindings = {
},
{
Key = "m",
Command = propertyHelper.invert('Scene.NH_LORRI.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_LEISA.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN1.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN2.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_RED.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_BLUE.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_FT.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_METHANE.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_NIR.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_AIRGLOW.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_SOC.renderable.SolidDraw'),
Command = propertyHelper.invert('Scene.NH_LORRI.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_LEISA.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN1.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN2.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_RED.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_BLUE.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_FT.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_METHANE.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_NIR.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_AIRGLOW.Renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_SOC.Renderable.SolidDraw'),
Documentation = "Draws the instrument field of views in a solid color or as lines.",
Name = "Toggle instrument FOVs",
GuiPath = "/New Horizons",
@@ -192,7 +192,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
@@ -209,7 +209,7 @@ end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"Pluto", "NewHorizons", "Charon"
})

View File

@@ -67,13 +67,13 @@ local Keybindings = {
},
{
Key = "q",
Command = propertyHelper.invert('Scene.SunMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.SunMarker.Renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Sun.",
Local = false
},
{
Key = "e",
Command = propertyHelper.invert('Scene.EarthMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.EarthMarker.Renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Earth.",
Local = false
}
@@ -123,7 +123,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
@@ -140,7 +140,7 @@ end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"OsirisRex", "BennuBarycenter", "Earth"
})

View File

@@ -45,13 +45,13 @@ local Keybindings = {
},
{
Key = "F8",
Command = "openspace.setPropertyValue('Scene.67P.renderable.ProjectionComponent.clearAllProjections', true)",
Command = "openspace.setPropertyValue('Scene.67P.Renderable.ProjectionComponent.clearAllProjections', true)",
Documentation = "Removes all image projections from 67P.",
Local = false
},
{
Key = "q",
Command = propertyHelper.invert('Scene.SunMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.SunMarker.Renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Sun.",
Local = false
},
@@ -76,7 +76,7 @@ local Keybindings = {
},
{
Key = "p",
Command = propertyHelper.invert('Scene.67P.renderable.ProjectionComponent.performProjection'),
Command = propertyHelper.invert('Scene.67P.Renderable.ProjectionComponent.performProjection'),
Documentation = "Enables or disables the image projection on 67P.",
Local = false
}
@@ -125,7 +125,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
@@ -138,13 +138,13 @@ asset.onInitialize(function ()
Rotation = { -0.106166, 0.981574, -0.084545, 0.134513 },
})
openspace.setPropertyValue('Scene.67P.renderable.PerformShading', false);
openspace.setPropertyValue('Scene.67P.Renderable.PerformShading', false);
end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"67PBarycenter", "Rosetta", "Philae"
})

View File

@@ -2,12 +2,12 @@ local propertyHelper = asset.require('./property_helper')
-- Function that returns the string that enables/disables the renderable 'renderable'
local toggle = function(renderable)
return propertyHelper.invert(renderable .. ".renderable.Enabled")
return propertyHelper.invert(renderable .. ".Renderable.Enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
local setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.Enabled', " .. (enabled and "true" or "false") .. ");";
return "openspace.setPropertyValue('" .. renderable .. ".Renderable.Enabled', " .. (enabled and "true" or "false") .. ");";
end

View File

@@ -61,7 +61,7 @@ asset.onInitialize(function ()
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"*Trail.Renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
@@ -76,7 +76,7 @@ asset.onInitialize(function ()
end)
asset.onDeinitialize(function ()
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"Earth", "Voyager 1", "Voyager 2", "Jupiter", "Saturn", "Uranus", "Neptune"
})

View File

@@ -403,8 +403,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
, _rightRoot(Chunk(RightHemisphereIndex))
, _grid(DefaultSkirtedGridSegments, DefaultSkirtedGridSegments)
{
setIdentifier("RenderableGlobe");
// Read the radii in to its own dictionary
if (dictionary.hasKeyAndValue<glm::dvec3>(KeyRadii)) {
_ellipsoid = Ellipsoid(dictionary.value<glm::vec3>(KeyRadii));

View File

@@ -48,9 +48,11 @@ namespace openspace {
SubscriptionTopic::~SubscriptionTopic() {
if (_prop && _onChangeHandle != UnsetCallbackHandle) {
_prop->removeOnChange(_onChangeHandle);
_onChangeHandle = UnsetCallbackHandle;
}
if (_prop && !_onDeleteHandle) {
_prop->removeOnDelete(_onDeleteHandle);
_onDeleteHandle = UnsetCallbackHandle;
}
}
@@ -86,6 +88,14 @@ void SubscriptionTopic::handleJson(const nlohmann::json& json) {
}
if (event == StopSubscription) {
_isSubscribedTo = false;
if (_prop && _onChangeHandle != UnsetCallbackHandle) {
_prop->removeOnChange(_onChangeHandle);
_onChangeHandle = UnsetCallbackHandle;
}
if (_prop && !_onDeleteHandle) {
_prop->removeOnDelete(_onDeleteHandle);
_onDeleteHandle = UnsetCallbackHandle;
}
}
}

View File

@@ -96,7 +96,7 @@ std::unique_ptr<Renderable> Renderable::createFromDictionary(
}
Renderable::Renderable(const ghoul::Dictionary& dictionary)
: properties::PropertyOwner({ "renderable" })
: properties::PropertyOwner({ "Renderable" })
, _enabled(EnabledInfo, true)
, _opacity(OpacityInfo, 1.f, 0.f, 1.f)
{