Open
Conversation
Contributor
|
请提供一个 CMake option 控制该功能是否启用,Spine 需要拥有一个有效的 Spine 编辑器许可证,你不要默认集成进引擎里。 |
Collaborator
Author
|
已添加 默认为OFF |
BAKAOLC
reviewed
Feb 26, 2026
| } | ||
| LAPP.updateGraph2DBlendMode(mode); | ||
|
|
||
| auto vertices = new core::Graphics::IRenderer::DrawVertex[n_vertices]; |
BAKAOLC
reviewed
Feb 26, 2026
| auto skeleton = data->getSkeleton(); | ||
| auto& skeletonRenderer = spine::LuaSTGSkeletonRenderer::Instance(); | ||
| spine::RenderCommand* command = skeletonRenderer.render(*skeleton); | ||
| while (command) { |
BAKAOLC
reviewed
Feb 26, 2026
|
|
||
| return 1; | ||
| } | ||
| static int setBoneState(lua_State* L) |
BAKAOLC
reviewed
Feb 26, 2026
Comment on lines
+19
to
+22
| std::unordered_map<std::string_view, Bone*> bonecache; | ||
| std::unordered_map<std::string_view, Animation*> animationcache; | ||
| std::unordered_map <std::string_view, Skin*> skincache; | ||
| std::unordered_map <std::string_view, LuaSTGSlotCacheHelper> slotcache; |
BAKAOLC
reviewed
Feb 26, 2026
| #define GETUDATA(p, i) SpineInstance* (p) = static_cast<SpineInstance*>(luaL_checkudata(L, (i), LUASTG_LUA_TYPENAME_SPINE)); | ||
| struct Wrapper | ||
| { | ||
| static int CreateSpineInstance(lua_State* L) noexcept |
There was a problem hiding this comment.
创建的 instance 指针管理似乎有误,会导致资源允许在实例存活期间被卸载,这会导致潜在的空指针异常
BAKAOLC
reviewed
Feb 26, 2026
Comment on lines
+107
to
+111
| { | ||
| lua_State* L = LAPP.GetLuaEngine(); | ||
| if (animation_callback != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, animation_callback); | ||
| if (event_callback != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, event_callback); | ||
| if (self_weak_table != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, self_weak_table); |
BAKAOLC
reviewed
Feb 26, 2026
Comment on lines
+598
to
+603
|
|
||
| auto listener = [data](spine::AnimationState* state, spine::EventType type, spine::TrackEntry* entry, spine::Event* event) | ||
| { | ||
| lua_State* L = LAPP.GetLuaEngine(); | ||
| int stack_top = lua_gettop(L); | ||
|
|
BAKAOLC
reviewed
Feb 26, 2026
| lua_pushnumber(L, event->getBalance()); | ||
| lua_pushnumber(L, event->getVolume()); | ||
|
|
||
| lua_call(L, 8, 0); |
BAKAOLC
reviewed
Feb 26, 2026
|
|
||
| return 1; | ||
| } | ||
| static int setEventListener(lua_State* L) |
There was a problem hiding this comment.
回调缺少重入保护机制,可能在回调中触发回调
比如在回调中设置新的 animation 时
There was a problem hiding this comment.
建议改用类似这种风格的 api 设计
spine.events:on("animation", function(event)
print(event.type, event.animation)
end)
BAKAOLC
reviewed
Feb 26, 2026
|
|
||
| auto listener = [data](spine::AnimationState* state, spine::EventType type, spine::TrackEntry* entry, spine::Event* event) | ||
| { | ||
| lua_State* L = LAPP.GetLuaEngine(); |
BAKAOLC
reviewed
Feb 26, 2026
|
|
||
| auto* ctx = LAPP.GetAppModel()->getRenderer(); | ||
| core::Graphics::IRenderer::DrawVertex vertex[3]; | ||
| vertex[0].z = 0.5f; vertex[1].z = 0.5f; vertex[2].z = 0.5f; |
BAKAOLC
reviewed
Feb 26, 2026
BAKAOLC
left a comment
There was a problem hiding this comment.
可以多参考一下已有的实现方案进行设计
比如 cocos,甚至 luastg-x 那边的实现方案也是能参考的
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
support for spine 4.2