Skip to content

Commit 142e7a9

Browse files
committed
feature(Things): change various variables in ::SetVariables/::GetVariables to be more intuitive
Also cleaned up some mistakes and whitespace stuff.
1 parent a391b0f commit 142e7a9

11 files changed

Lines changed: 19 additions & 25 deletions

File tree

Editor/gui/imgui_editor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ void ImGui_Editor::TheatreEntered()
5959
return;
6060
}
6161
TheatreFile::ThingData mat_dat{ThingType::Material, "ThingAdderSpawnLocation_Material"};
62-
mat_dat.set_variable(true, "NoTexture");
6362
mat_dat.set_variable(glm::vec3{1.0f, 0.0f, 0.0f}, "Color");
64-
mat_dat.set_variable(true, "mat_fullbright");
63+
mat_dat.set_variable(true, "FullBright");
6564
sSpawnLocationMaterialID = g_pTheatreManager->CurrentTheatre()->CreateThing(mat_dat);
6665

6766
TheatreFile::ThingData mesh_inst_dat{ThingType::MeshInstance3D,"ThingAdderSpawnLocation_MeshInstance"};

Nostalgia/core/bitmask.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef BIT_MASK_H
22
#define BIT_MASK_H
33

4-
54
inline constinit const uint MaxBitMaskPlaces{30};
65

76
struct BitMask

Nostalgia/theatre/things/resources/material.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void Material::SetVariables(Farg<ThingData> data)
1212
data.get_variable(mAlpha, "Alpha");
1313
data.get_variable(mSpecularSharpness, "SpecularSharpness");
1414
data.get_variable(mSpecularStrength, "SpecularStrength");
15-
data.get_variable(mFullBright, "FullBright", "mat_fullbright");
15+
data.get_variable(mFullBright, "FullBright");
1616
}
1717

1818
Shared<ThingData> Material::GetVariables() const

Nostalgia/theatre/things/thinkers/2d/camera_2d.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ void Camera2D::SetVariables(Farg<ThingData> data)
2626

2727
if(int bitmask; data.get_variable(bitmask, "RenderLayersMask", "LayersMask") == OK)
2828
{ mLayersMask.set(bitmask); }
29-
data.get_variable(mZoom, "FOV");
30-
data.get_variable(mViewportID, "Viewport", "ViewportID");
29+
data.get_variable(mZoom, "Zoom");
3130
data.get_variable(mInitCurrent, "Current", "CurrentCamera", "IsCurrent");
3231

3332
mVisible = mVisible and Settings::Engine::IsEditorHint;
@@ -38,8 +37,7 @@ Shared<ThingData> Camera2D::GetVariables() const
3837
Shared<ThingData> data{Actor2D::GetVariables()};
3938

4039
data->set_variable(mLayersMask.get(), "RenderLayersMask");
41-
data->set_variable(mZoom, "FOV");
42-
data->set_variable(mViewportID, "Viewport");
40+
data->set_variable(mZoom, "Zoom");
4341
data->set_variable(mInitCurrent, "Current");
4442
if(!mViewportID.invalid())
4543
{ data->set_variable(mViewportID, "Parent"); }

Nostalgia/theatre/things/thinkers/3d/actor_3d.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ void Actor3D::SetVariables(Farg<ThingData> data)
1414
mLocalTransform.euler_rotation_radians = glm::radians(mLocalTransform.euler_rotation_degrees);
1515
mLocalTransform.quaternion = glm::normalize(glm::quat{mLocalTransform.euler_rotation_radians});
1616
}
17-
if(data.get_variable(mLocalTransform.euler_rotation_radians, "Rotation", "Euler") == OK)
17+
if(data.get_variable(mLocalTransform.euler_rotation_radians,
18+
"Rotation", "RotationRadians", "Euler", "EulerRadians") == OK)
1819
{
1920
mLocalTransform.quaternion = glm::normalize(glm::quat{mLocalTransform.euler_rotation_radians});
2021
mLocalTransform.euler_rotation_degrees = glm::degrees(mLocalTransform.euler_rotation_radians);

Nostalgia/theatre/things/thinkers/3d/collider_3d.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ void Collider3D::SetVariables(Farg<ThingData> data)
6565
data.get_variable(mMotion, "Motion", "ColliderMotion", "BodyMotion");
6666
data.get_variable(mMass, "Mass", "ColliderMass", "BodyMass");
6767
data.get_variable(mMaterial.friction, "Friction", "ColliderFriction", "BodyFriction");
68-
data.get_variable(mMaterial.friction, "Friction", "ColliderFriction", "BodyFriction");
6968
data.get_variable(mActivateOnNextChange, "StartActive", "Active");
7069
if(data.get_variable(mActivateOnNextChange, "StartInactive", "Inactive") == OK)
7170
{ mActivateOnNextChange = true; }

Nostalgia/theatre/things/thinkers/3d/light_3d.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ void Light3D::SetVariables(Farg<ThingData> data)
6969
data.get_variable(mAttenuation, "FadeIntensity");
7070
data.get_variable(mAttenuation, "Attenuation");
7171
data.get_variable(mRange, "Range");
72-
data.get_variable(mEnabled, "LightVisible");
73-
data.get_variable(mEnabled, "Enabled");
74-
if(data.get_variable(mEnabled, "Disabled") == OK)
72+
data.get_variable(mEnabled, "LightVisible", "Enabled");
73+
if(data.get_variable(mEnabled, "LightDisabled", "Disabled") == OK)
7574
{ mEnabled = !mEnabled; }
7675
}
7776

@@ -87,7 +86,6 @@ Shared<ThingData> Light3D::GetVariables() const
8786
data->set_variable(mAttenuation, "Attenuation");
8887
data->set_variable(mRange, "Range");
8988
data->set_variable(mEnabled, "LightVisible");
90-
data->set_variable(mEnabled, "Enabled");
9189
data->set_variable(mVisible, "Visible");
9290

9391
return data;
@@ -113,18 +111,14 @@ int SpotLight3D::GetCount()
113111
void SpotLight3D::SetVariables(Farg<ThingData> data)
114112
{
115113
Light3D::SetVariables(data);
116-
data.get_variable(mSpotAngle, "Angle");
117114
data.get_variable(mSpotAngle, "SpotAngle");
118-
data.get_variable(mSpotAngleFade, "AngleFade");
119115
data.get_variable(mSpotAngleFade, "SpotAngleFade");
120116
}
121117

122118
Shared<ThingData> SpotLight3D::GetVariables() const
123119
{
124120
Shared<ThingData> data{Light3D::GetVariables()};
125-
data->set_variable(mSpotAngle, "Angle");
126121
data->set_variable(mSpotAngle, "SpotAngle");
127-
data->set_variable(mSpotAngleFade, "AngleFade");
128122
data->set_variable(mSpotAngleFade, "SpotAngleFade");
129123
return data;
130124
}
@@ -145,12 +139,14 @@ void DirectionalLight3D::SetVariables(Farg<ThingData> data)
145139
SetRotationDegrees({-90.0f, 0.0f, 0.0f});
146140
Light3D::SetVariables(data);
147141
mVisible = false;
142+
data.get_variable(mVisible, "ShowDirectionalLightDebugMesh", "ShowLightMeshOverride");
148143
}
149144

150145
Shared<ThingData> DirectionalLight3D::GetVariables() const
151146
{
152147
Shared<ThingData> data{Light3D::GetVariables()};
153-
data->set_variable(false, "Visible");
148+
if(mVisible)
149+
{ data->set_variable(mVisible, "ShowDirectionalLightDebugMesh"); }
154150
return data;
155151
}
156152

Nostalgia/theatre/things/thinkers/3d/mesh_instance_3d.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ class MeshInstance3D : public Visual3D
2323
bool mWireframe{false};
2424
};
2525

26-
2726
#endif // MESH_INSTANCE_3D_H

Nostalgia/theatre/things/thinkers/3d/nostalgia_player_3d.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,27 @@ using namespace TheatreFile;
88
void NostalgiaPlayer3D::SetVariables(Farg<ThingData> data)
99
{
1010
Actor3D::SetVariables(data);
11+
data.get_variable(mCreateDefaultCamera, "NoDefaultCamera", "NoCamera");
1112
}
1213

1314
Shared<ThingData> NostalgiaPlayer3D::GetVariables() const
1415
{
1516
Shared<ThingData> data{Actor3D::GetVariables()};
17+
data->set_variable(mCreateDefaultCamera, "NoDefaultCamera");
1618
return data;
1719
}
1820

1921
void NostalgiaPlayer3D::Ready()
2022
{
2123
Actor3D::Ready();
2224

23-
bool _has_camera{false};
2425
for(ID child : Children())
2526
{
2627
if(ThingFactory::IsDerivedFrom(my_theatre()->TypeOf(child), ThingType::Camera3D))
27-
{ _has_camera = true; }
28+
{ mCreateDefaultCamera = false; }
2829
}
29-
if(!_has_camera)
30+
31+
if(mCreateDefaultCamera)
3032
{
3133
std::string cam_name{"DefaultPlayerCam"};
3234
if(!my_theatre()->ThingExists(cam_name))

Nostalgia/theatre/things/thinkers/3d/nostalgia_player_3d.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class NostalgiaPlayer3D : public Actor3D
1212

1313
protected:
1414
ID mCameraID{};
15+
bool mCreateDefaultCamera{true};
1516
};
1617

1718
#endif // NOSTALGIA_PLAYER_3D_H

0 commit comments

Comments
 (0)