From 1b4067787965199f6791ca12b7006838bf536c1f Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Wed, 18 May 2022 14:43:37 +0530 Subject: [PATCH 1/3] Add TransformAnimationComponent to LuaInterpreter --- rootex/script/interpreter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rootex/script/interpreter.cpp b/rootex/script/interpreter.cpp index d008b39ab..b473592d8 100644 --- a/rootex/script/interpreter.cpp +++ b/rootex/script/interpreter.cpp @@ -50,6 +50,7 @@ #include "core/resource_files/text_resource_file.h" #include "core/resource_files/particle_effect_resource_file.h" #include "event_manager.h" +#include "components/space/transform_animation_component.h" extern "C" int luaopen_lpeg(lua_State* L); @@ -449,6 +450,7 @@ void LuaInterpreter::registerTypes() { sol::usertype entity = rootex.new_usertype("Entity", "transform", sol::property(&Entity::getComponent), + "transformAnimationComponent", sol::property(&Entity::getComponent), "model", sol::property(&Entity::getComponent), "animatedModel", sol::property(&Entity::getComponent), "particleEffect", sol::property(&Entity::getComponent), @@ -522,6 +524,13 @@ void LuaInterpreter::registerTypes() sol::base_classes, sol::bases()); modelComponent["getModelResourceFile"] = &ModelComponent::getModelResourceFile; } + { + sol::usertype transformAnimationComponent = rootex.new_usertype( + "TransformAnimationComponent", + sol::base_classes, sol::bases()); + transformAnimationComponent["play"] = &TransformAnimationComponent::setPlaying; + transformAnimationComponent["reset"] = &TransformAnimationComponent::reset; + } { sol::usertype animatedModelComponent = rootex.new_usertype( "AnimatedModelComponent", From 97636f817b5140b7572a6076a713f433bb92105f Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Wed, 18 May 2022 20:14:23 +0530 Subject: [PATCH 2/3] Add isPlaying and hasEnded flags --- rootex/script/interpreter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rootex/script/interpreter.cpp b/rootex/script/interpreter.cpp index b473592d8..086c0fe49 100644 --- a/rootex/script/interpreter.cpp +++ b/rootex/script/interpreter.cpp @@ -530,6 +530,8 @@ void LuaInterpreter::registerTypes() sol::base_classes, sol::bases()); transformAnimationComponent["play"] = &TransformAnimationComponent::setPlaying; transformAnimationComponent["reset"] = &TransformAnimationComponent::reset; + transformAnimationComponent["isPlaying"] = &TransformAnimationComponent::isPlaying; + transformAnimationComponent["hasEnded"] = &TransformAnimationComponent::hasEnded; } { sol::usertype animatedModelComponent = rootex.new_usertype( From cfd4e7bbb819b45ad4ee406afd665258931ef19e Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Wed, 1 Jun 2022 15:55:45 +0530 Subject: [PATCH 3/3] Rename exposed functions for TransformAnimationComponent --- rootex/script/interpreter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rootex/script/interpreter.cpp b/rootex/script/interpreter.cpp index 086c0fe49..fe150ca37 100644 --- a/rootex/script/interpreter.cpp +++ b/rootex/script/interpreter.cpp @@ -450,7 +450,7 @@ void LuaInterpreter::registerTypes() { sol::usertype entity = rootex.new_usertype("Entity", "transform", sol::property(&Entity::getComponent), - "transformAnimationComponent", sol::property(&Entity::getComponent), + "transformAnimation", sol::property(&Entity::getComponent), "model", sol::property(&Entity::getComponent), "animatedModel", sol::property(&Entity::getComponent), "particleEffect", sol::property(&Entity::getComponent), @@ -528,7 +528,7 @@ void LuaInterpreter::registerTypes() sol::usertype transformAnimationComponent = rootex.new_usertype( "TransformAnimationComponent", sol::base_classes, sol::bases()); - transformAnimationComponent["play"] = &TransformAnimationComponent::setPlaying; + transformAnimationComponent["setPlaying"] = &TransformAnimationComponent::setPlaying; transformAnimationComponent["reset"] = &TransformAnimationComponent::reset; transformAnimationComponent["isPlaying"] = &TransformAnimationComponent::isPlaying; transformAnimationComponent["hasEnded"] = &TransformAnimationComponent::hasEnded;