From 14b0acdc2c9d600d5f244363ac5a6cb855768082 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Mon, 31 May 2021 21:42:06 +0000 Subject: [PATCH] Added graphNode overwrite on load_graph_node --- src/moon/mod-engine/models/mod-model.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/moon/mod-engine/models/mod-model.cpp b/src/moon/mod-engine/models/mod-model.cpp index 2766c8f6..2bdd0dfb 100644 --- a/src/moon/mod-engine/models/mod-model.cpp +++ b/src/moon/mod-engine/models/mod-model.cpp @@ -21,11 +21,11 @@ namespace MoonInternal { } extern "C"{ -void bind_graph_node(int modelId, struct GraphNode *graphNode){ +void bind_graph_node(int modelId, GraphNode *graphNode){ MoonInternal::bindHook(SAVE_GRAPH_NODE); MoonInternal::initBindHook(2, - (struct HookParameter){.name = "modelId", .parameter = (void*) &modelId}, - (struct HookParameter){.name = "graphNode", .parameter = (void*) &graphNode} + (HookParameter){.name = "modelId", .parameter = (void*) &modelId}, + (HookParameter){.name = "graphNode", .parameter = (void*) &graphNode} ); MoonInternal::callBindHook(0); loadedGraphNodes[modelId] = graphNode; @@ -35,7 +35,11 @@ struct GraphNode * get_graph_node(int modelId){ MoonInternal::initBindHook(1, (struct HookParameter){.name = "modelId", .parameter = (void*) &modelId} ); - MoonInternal::callBindHook(0); - return loadedGraphNodes[modelId]; + GraphNode* graphNode = loadedGraphNodes[modelId]; + if(graphNode == NULL) return NULL; + MoonInternal::callBindHook(1, + (HookParameter){.name = "graphNode", .parameter = (void*) &graphNode} + ); + return graphNode; } } \ No newline at end of file