Expose Moveable Scale (#1587)

* Done

* Update CHANGELOG.md

* Cleanup

* Minor fixes

* Update CHANGELOG.md

---------

Co-authored-by: Lwmte <3331699+Lwmte@users.noreply.github.com>
This commit is contained in:
TrainWrack 2025-02-27 20:54:26 -05:00 committed by GitHub
parent eff0f4d363
commit 2c8af9fa20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 5 deletions

View file

@ -32,10 +32,11 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Added diary module.
* Added View.GetFlyByPosition() and View.GetFlyByRotation() functions to get flyby sequence parameters at a specified time point.
* Added Effects.EmitAirBubble() function to spawn air bubbles.
* Added extra arguments for sprite object slots and starting rotation value for EmitParticle function.
* Added Moveable:GetScale() and Movebale:SetScale() methods to set visible scale of moveables.
* Added Rotation:Lerp() function to allow linear interpolation between rotations.
* Added various Translate() methods to Vec2 and Vec3 script objects.
* Added Lerp() function to the Rotation object to allow linear interpolation between rotations.
* Added alpha transparency functionality for statics and moveables by using SetColor() method.
* Added extra arguments for sprite object slots and starting rotation value for EmitParticle function.
## [Version 1.7.1](https://github.com/TombEngine/TombEditorReleases/releases/tag/v1.7.4) - 2025-04-01

View file

@ -128,6 +128,8 @@ static constexpr char ScriptReserved_GetAmmoType[] = "GetAmmoType";
static constexpr char ScriptReserved_GetAmmoCount[] = "GetAmmoCount";
static constexpr char ScriptReserved_GetVehicle[] = "GetVehicle";
static constexpr char ScriptReserved_GetTarget[] = "GetTarget";
static constexpr char ScriptReserved_GetScale[] = "GetScale";
static constexpr char ScriptReserved_SetScale[] = "SetScale";
static constexpr char ScriptReserved_GetColor[] = "GetColor";
static constexpr char ScriptReserved_SetColor[] = "SetColor";
static constexpr char ScriptReserved_SetFlags[] = "SetFlags";
@ -140,8 +142,6 @@ static constexpr char ScriptReserved_GetRotation[] = "GetRotation";
static constexpr char ScriptReserved_SetRotation[] = "SetRotation";
static constexpr char ScriptReserved_GetRotationY[] = "GetRotationY";
static constexpr char ScriptReserved_SetRotationY[] = "SetRotationY";
static constexpr char ScriptReserved_GetScale[] = "GetScale";
static constexpr char ScriptReserved_SetScale[] = "SetScale";
static constexpr char ScriptReserved_GetSolid[] = "GetSolid";
static constexpr char ScriptReserved_SetSolid[] = "SetSolid";
static constexpr char ScriptReserved_GetName[] = "GetName";

View file

@ -127,6 +127,7 @@ void Moveable::Register(sol::state& state, sol::table& parent)
ScriptReserved_GetRoom, &Moveable::GetRoom,
ScriptReserved_GetRoomNumber, &Moveable::GetRoomNumber,
ScriptReserved_GetRotation, &Moveable::GetRotation,
ScriptReserved_GetScale, &Moveable::GetScale,
ScriptReserved_GetVelocity, &Moveable::GetVelocity,
ScriptReserved_GetColor, &Moveable::GetColor,
ScriptReserved_GetCollidable, &Moveable::GetCollidable,
@ -153,6 +154,7 @@ void Moveable::Register(sol::state& state, sol::table& parent)
ScriptReserved_SetName, &Moveable::SetName,
ScriptReserved_SetObjectID, &Moveable::SetObjectID,
ScriptReserved_SetPosition, &Moveable::SetPosition,
ScriptReserved_SetScale, &Moveable::SetScale,
ScriptReserved_SetRoomNumber, &Moveable::SetRoomNumber,
ScriptReserved_SetRotation, &Moveable::SetRotation,
ScriptReserved_SetColor, &Moveable::SetColor,
@ -380,7 +382,7 @@ bool Moveable::SetName(const std::string& id)
return true;
}
/// Get the object's position
/// Get the moveable's position
// @function Moveable:GetPosition
// @treturn Vec3 a copy of the moveable's position
Vec3 Moveable::GetPosition() const
@ -496,6 +498,23 @@ void Moveable::SetRotation(const Rotation& rot)
_moveable->DisableInterpolation = true;
}
/// Get the moveable's scale
// @function Moveable:GetScale
// @treturn Vec3 a copy of the moveable's visual scale.
Vec3 Moveable::GetScale() const
{
return Vec3(_moveable->Pose.Scale);
}
/// Set the moveable's scale
// Sets the scale of the moveable. It's only a visual effect and does not affect collision.
// @function Moveable:SetScale
// @tparam Vec3 new scale of the moveable
void Moveable::SetScale(Vec3 scale)
{
_moveable->Pose.Scale = Vector3(scale.x, scale.y, scale.z);
}
/// Get current HP (hit points/health points)
// @function Moveable:GetHP
// @treturn int the amount of HP the moveable currently has

View file

@ -54,6 +54,7 @@ public:
Vec3 GetJointPos(int jointID, sol::optional<Vec3> offset) const;
Rotation GetJointRot(int index) const;
Rotation GetRotation() const;
Vec3 GetScale() const;
int GetStateNumber() const;
int GetTargetStateNumber() const;
int GetAnimNumber() const;
@ -84,6 +85,7 @@ public:
std::unique_ptr<Room> GetRoom() const;
int GetRoomNumber() const;
void SetRotation(const Rotation& rot);
void SetScale(Vec3 scale);
void SetStateNumber(int stateNumber);
void SetAnimNumber(int animNumber, sol::optional<int> slotIndex);
void SetFrameNumber(int frameNumber);