Skip to content

Commit

Permalink
Restored old script field names
Browse files Browse the repository at this point in the history
  • Loading branch information
Mag1str02 committed Nov 22, 2024
1 parent 939902b commit 8417c8f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DummyEditor/EditorLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ namespace DummyEngine {
}
}
if (editor_camera_.Valid()) {
bool& active = editor_camera_.Get<ScriptComponent>()->GetField<bool>("active_");
bool& active = editor_camera_.Get<ScriptComponent>()->GetField<bool>("Active");
if (input_state_ == InputState::ViewPort) {
active = true;
} else {
Expand Down
2 changes: 1 addition & 1 deletion DummyEditor/Scripts/EditorCameraController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ class EditorCameraController : public Script {
bool active_ = false;
};

SCRIPT_BASE(EditorCameraController, FIELD(active_))
SCRIPT_BASE(EditorCameraController, FIELD("Active", active_))
4 changes: 2 additions & 2 deletions DummyEngine/Core/Scripting/Script.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ namespace DummyEngine {
m_Entity.Remove<T>();
}

#define FIELD(field) \
#define FIELD(field_name, field) \
{ \
#field, { \
field_name, { \
TypeToScriptFieldType<decltype(field)>(), OffsetOf(&CurrentScriptType::field) \
} \
}
Expand Down
7 changes: 6 additions & 1 deletion Sandbox/Assets/Scripts/BasicScripts/SquareMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ class SquareMovement : public Script {
Vec2 right_front_ = {0.0, 0.0};
};

SCRIPT_BASE(SquareMovement, FIELD(cycle_time_), FIELD(height_), FIELD(offset_), FIELD(left_back_), FIELD(right_front_))
SCRIPT_BASE(SquareMovement,
FIELD("CycleTime", cycle_time_),
FIELD("Height", height_),
FIELD("Offset", offset_),
FIELD("LeftBack", left_back_),
FIELD("RightFront", right_front_))
7 changes: 6 additions & 1 deletion Sandbox/Assets/Scripts/Gate/GateController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ class GateController : public Script {
Entity controller_;
};

SCRIPT_BASE(GateController, FIELD(speed_), FIELD(distance_), FIELD(open_height_), FIELD(close_height_), FIELD(controller_))
SCRIPT_BASE(GateController,
FIELD("Speed", speed_),
FIELD("Distance", distance_),
FIELD("OpenHeight", open_height_),
FIELD("CloseHeight", close_height_),
FIELD("Controller", controller_))
2 changes: 1 addition & 1 deletion Sandbox/Assets/Scripts/Gate/SinMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ class SinMovement : public Script {
float current_time_ = 0;
};

SCRIPT_BASE(SinMovement, FIELD(pos_a_), FIELD(pos_b_), FIELD(speed_))
SCRIPT_BASE(SinMovement, FIELD("PosA", pos_a_), FIELD("PosB", pos_b_), FIELD("Speed", speed_))
2 changes: 1 addition & 1 deletion Sandbox/Assets/Scripts/Grass/Grass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ class Grass : public Script {
Ref<Shader> shader_;
};

SCRIPT_BASE(Grass, FIELD(camera_), FIELD(speed_))
SCRIPT_BASE(Grass, FIELD("Camera", camera_), FIELD("Speed", speed_))
2 changes: 1 addition & 1 deletion Sandbox/Assets/Scripts/Sky/SkyController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ class SkyContoller : public Script {
float current_time_ = 0;
};

SCRIPT_BASE(SkyContoller, FIELD(rotation_speed_))
SCRIPT_BASE(SkyContoller, FIELD("RotationSpeed", rotation_speed_))

0 comments on commit 8417c8f

Please sign in to comment.