Skip to content

Commit 552d5dc

Browse files
committed
Release v1.10.3
1 parent fd87059 commit 552d5dc

File tree

8 files changed

+189
-24
lines changed

8 files changed

+189
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
2424
2525
-->
2626

27+
## [1.10.3] Skinning Import Bugfix
28+
29+
### Fixes
30+
* Set all target `MeshNodes` in the `Skin` object when importing skin objects with multiple target nodes from gltf files.
31+
32+
2733
## [1.10.2] Ramses Logic Update
2834

2935
### Changes

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.19)
1111

1212
SET(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo")
1313

14-
project(RaCoOS VERSION 1.10.2)
14+
project(RaCoOS VERSION 1.10.3)
1515

1616
SET(RACO_RELEASE_DIRECTORY ${CMAKE_BINARY_DIR}/release)
1717

components/libApplication/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ raco_package_test_resources_process(
4040
meshes/InterpolationTest/InterpolationTest.gltf
4141
meshes/InterpolationTest/interpolation.bin
4242
meshes/InterpolationTest/l.jpg
43+
meshes/SimpleSkin/SimpleSkin-multi-target.gltf
4344
meshes/Duck.glb
4445
meshes/meshless.gltf
4546
meshes/negativeScaleQuad.gltf

components/libApplication/tests/RaCoApplication_test.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,27 @@ TEST_F(RaCoApplicationFixture, importglTFScenegraphMeshNodesDontReferenceDeselec
763763
}
764764
}
765765

766+
TEST_F(RaCoApplicationFixture, importglTFScenegraphMultiTargetSkin) {
767+
using namespace raco;
768+
core::MeshDescriptor desc;
769+
desc.absPath = (test_path() / "meshes/SimpleSkin/SimpleSkin-multi-target.gltf").string();
770+
desc.bakeAllSubmeshes = false;
771+
772+
auto [scenegraph, dummyCacheEntry] = raco::getMeshSceneGraphWithHandler(commandInterface().meshCache(), desc);
773+
commandInterface().insertAssetScenegraph(scenegraph, desc.absPath, nullptr);
774+
775+
auto skin = select<user_types::Skin>(project().instances());
776+
auto node_0 = select<user_types::Node>(project().instances(), "nodes_0");
777+
auto node_1 = select<user_types::Node>(project().instances(), "nodes_1");
778+
auto node_2 = select<user_types::Node>(project().instances(), "nodes_2");
779+
auto node_3 = select<user_types::Node>(project().instances(), "nodes_3");
780+
781+
EXPECT_EQ(skin->targets_->size(), 2);
782+
EXPECT_EQ(skin->targets_->asVector<core::SEditorObject>(), std::vector<core::SEditorObject>({node_0, node_3}));
783+
EXPECT_EQ(skin->joints_->size(), 2);
784+
EXPECT_EQ(skin->joints_->asVector<core::SEditorObject>(), std::vector<core::SEditorObject>({node_1, node_2}));
785+
}
786+
766787
TEST_F(RaCoApplicationFixture, LuaScriptRuntimeErrorCausesInformationForAllScripts) {
767788
auto* commandInterface = application.activeRaCoProject().commandInterface();
768789

components/libMeshLoader/src/glTFFileLoader.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,15 @@ void glTFFileLoader::importSkins() {
220220
const auto& skin = scene_->skins[index];
221221
std::string name = skin.name.empty() ? fmt::format("skin_{}", index) : skin.name;
222222

223-
// Find node by searching through all nodes in scene
224-
auto it = std::find_if(scene_->nodes.begin(), scene_->nodes.end(), [index](const tinygltf::Node& node) {
225-
return index == node.skin;
226-
});
227-
if (it != scene_->nodes.end()) {
228-
int nodeIndex = it - scene_->nodes.begin();
229-
sceneGraph_->skins.emplace_back(raco::core::SkinDescription{name, nodeIndex, skin.joints});
223+
// Find target nodes by searching through all nodes in scene
224+
std::vector<int> targets;
225+
for (int nodeIndex = 0; nodeIndex < scene_->nodes.size(); nodeIndex++) {
226+
if (scene_->nodes[nodeIndex].skin == index) {
227+
targets.emplace_back(nodeIndex);
228+
}
229+
}
230+
if (!targets.empty()) {
231+
sceneGraph_->skins.emplace_back(core::SkinDescription{name, targets, skin.joints});
230232
}
231233
}
232234
}

datamodel/libCore/include/core/MeshCacheInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ struct MeshAnimation {
242242

243243
struct SkinDescription {
244244
std::string name;
245-
int meshNodeIndex;
245+
std::vector<int> meshNodeIndices;
246246
std::vector<int> jointNodeIndices;
247247
};
248248

datamodel/libCore/src/Context.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ void BaseContext::insertAssetScenegraph(const raco::core::MeshScenegraph& sceneg
10641064
auto meshWithSameProperties = propertiesToMeshMap.find({false, static_cast<int>(i), relativeFilePath.string()});
10651065
if (meshWithSameProperties == propertiesToMeshMap.end()) {
10661066
LOG_DEBUG(log_system::CONTEXT, "Did not find existing local Mesh with same properties as asset mesh, creating one instead...");
1067-
auto &currentSubmesh = meshScenegraphMeshes.emplace_back(createObject(raco::user_types::Mesh::typeDescription.typeName, *scenegraph.meshes[i]));
1067+
auto& currentSubmesh = meshScenegraphMeshes.emplace_back(createObject(raco::user_types::Mesh::typeDescription.typeName, *scenegraph.meshes[i]));
10681068
auto currentSubmeshHandle = ValueHandle{currentSubmesh};
10691069

10701070
set(currentSubmeshHandle.get("bakeMeshes"), false);
@@ -1184,10 +1184,9 @@ void BaseContext::insertAssetScenegraph(const raco::core::MeshScenegraph& sceneg
11841184
}
11851185
LOG_INFO(log_system::CONTEXT, "Scenegraph structure restored.");
11861186

1187-
11881187
LOG_INFO(log_system::CONTEXT, "Importing animation samplers...");
11891188
std::map<int, std::vector<SEditorObject>> sceneChannels;
1190-
for (auto animIndex = 0; animIndex < scenegraph.animationSamplers.size(); ++animIndex) {
1189+
for (auto animIndex = 0; animIndex < scenegraph.animationSamplers.size(); ++animIndex) {
11911190
auto& samplers = scenegraph.animationSamplers[animIndex];
11921191
for (auto samplerIndex = 0; samplerIndex < samplers.size(); ++samplerIndex) {
11931192
auto& meshAnimSampler = scenegraph.animationSamplers.at(animIndex)[samplerIndex];
@@ -1208,7 +1207,6 @@ void BaseContext::insertAssetScenegraph(const raco::core::MeshScenegraph& sceneg
12081207
LOG_DEBUG(log_system::CONTEXT, "Found existing local AnimationChannel '{}' with same properties as asset animation sampler, using this AnimationChannel...", *meshAnimSampler);
12091208
sceneChannels[animIndex].emplace_back(samplerWithSameProperties->second);
12101209
}
1211-
12121210
}
12131211
}
12141212
LOG_INFO(log_system::CONTEXT, "Animation samplers imported.");
@@ -1247,7 +1245,7 @@ void BaseContext::insertAssetScenegraph(const raco::core::MeshScenegraph& sceneg
12471245
continue;
12481246
}
12491247

1250-
auto &linkEndNode = meshScenegraphNodes[channel.nodeIndex];
1248+
auto& linkEndNode = meshScenegraphNodes[channel.nodeIndex];
12511249
ValueHandle linkEndProp;
12521250
auto& animTargetProp = channel.targetPath;
12531251

@@ -1287,16 +1285,18 @@ void BaseContext::insertAssetScenegraph(const raco::core::MeshScenegraph& sceneg
12871285
}
12881286

12891287
std::vector<SEditorObject> targetMeshNodes;
1290-
auto targetMeshNode = meshScenegraphNodes[sceneSkin->meshNodeIndex];
1291-
if (targetMeshNode->isType<user_types::MeshNode>()) {
1292-
targetMeshNodes.emplace_back(targetMeshNode);
1293-
} else {
1294-
auto submeshRootNode = targetMeshNode->children_->get(0)->asRef()->as<user_types::Node>();
1295-
for (auto child : submeshRootNode->children_->asVector<SEditorObject>()) {
1296-
if (child->isType<user_types::MeshNode>()) {
1297-
targetMeshNodes.emplace_back(child);
1298-
} else {
1299-
LOG_ERROR(log_system::CONTEXT, "Target child node is not a MeshNode '{}'", child->objectName());
1288+
for (const auto& targetIndex : sceneSkin->meshNodeIndices) {
1289+
auto targetMeshNode = meshScenegraphNodes[targetIndex];
1290+
if (targetMeshNode->isType<user_types::MeshNode>()) {
1291+
targetMeshNodes.emplace_back(targetMeshNode);
1292+
} else {
1293+
auto submeshRootNode = targetMeshNode->children_->get(0)->asRef()->as<user_types::Node>();
1294+
for (auto child : submeshRootNode->children_->asVector<SEditorObject>()) {
1295+
if (child->isType<user_types::MeshNode>()) {
1296+
targetMeshNodes.emplace_back(child);
1297+
} else {
1298+
LOG_ERROR(log_system::CONTEXT, "Target child node is not a MeshNode '{}'", child->objectName());
1299+
}
13001300
}
13011301
}
13021302
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"scene" : 0,
3+
"scenes" : [ {
4+
"nodes" : [ 0, 1 ]
5+
} ],
6+
7+
"nodes" : [ {
8+
"skin" : 0,
9+
"mesh" : 0
10+
}, {
11+
"children" : [ 2 ],
12+
"translation" : [ 0.0, 1.0, 0.0 ]
13+
}, {
14+
"rotation" : [ 0.0, 0.0, 0.0, 1.0 ]
15+
}, {
16+
"skin" : 0,
17+
"mesh" : 0,
18+
"translation" : [1.0, 0.0, 0.0]
19+
} ],
20+
21+
"meshes" : [ {
22+
"primitives" : [ {
23+
"attributes" : {
24+
"POSITION" : 1,
25+
"JOINTS_0" : 2,
26+
"WEIGHTS_0" : 3
27+
},
28+
"indices" : 0
29+
} ]
30+
} ],
31+
32+
"skins" : [ {
33+
"inverseBindMatrices" : 4,
34+
"joints" : [ 1, 2 ]
35+
} ],
36+
37+
"animations" : [ {
38+
"channels" : [ {
39+
"sampler" : 0,
40+
"target" : {
41+
"node" : 2,
42+
"path" : "rotation"
43+
}
44+
} ],
45+
"samplers" : [ {
46+
"input" : 5,
47+
"interpolation" : "LINEAR",
48+
"output" : 6
49+
} ]
50+
} ],
51+
52+
"buffers" : [ {
53+
"uri" : "data:application/gltf-buffer;base64,AAABAAMAAAADAAIAAgADAAUAAgAFAAQABAAFAAcABAAHAAYABgAHAAkABgAJAAgAAAAAvwAAAAAAAAAAAAAAPwAAAAAAAAAAAAAAvwAAAD8AAAAAAAAAPwAAAD8AAAAAAAAAvwAAgD8AAAAAAAAAPwAAgD8AAAAAAAAAvwAAwD8AAAAAAAAAPwAAwD8AAAAAAAAAvwAAAEAAAAAAAAAAPwAAAEAAAAAA",
54+
"byteLength" : 168
55+
}, {
56+
"uri" : "data:application/gltf-buffer;base64,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAABAPwAAgD4AAAAAAAAAAAAAQD8AAIA+AAAAAAAAAAAAAAA/AAAAPwAAAAAAAAAAAAAAPwAAAD8AAAAAAAAAAAAAgD4AAEA/AAAAAAAAAAAAAIA+AABAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAA=",
57+
"byteLength" : 320
58+
}, {
59+
"uri" : "data:application/gltf-buffer;base64,AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAgL8AAAAAAACAPwAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAIC/AAAAAAAAgD8=",
60+
"byteLength" : 128
61+
}, {
62+
"uri" : "data:application/gltf-buffer;base64,AAAAAAAAAD8AAIA/AADAPwAAAEAAACBAAABAQAAAYEAAAIBAAACQQAAAoEAAALBAAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAkxjEPkSLbD8AAAAAAAAAAPT9ND/0/TQ/AAAAAAAAAAD0/TQ/9P00PwAAAAAAAAAAkxjEPkSLbD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAkxjEvkSLbD8AAAAAAAAAAPT9NL/0/TQ/AAAAAAAAAAD0/TS/9P00PwAAAAAAAAAAkxjEvkSLbD8AAAAAAAAAAAAAAAAAAIA/",
63+
"byteLength" : 240
64+
} ],
65+
66+
"bufferViews" : [ {
67+
"buffer" : 0,
68+
"byteLength" : 48,
69+
"target" : 34963
70+
}, {
71+
"buffer" : 0,
72+
"byteOffset" : 48,
73+
"byteLength" : 120,
74+
"target" : 34962
75+
}, {
76+
"buffer" : 1,
77+
"byteLength" : 320,
78+
"byteStride" : 16
79+
}, {
80+
"buffer" : 2,
81+
"byteLength" : 128
82+
}, {
83+
"buffer" : 3,
84+
"byteLength" : 240
85+
} ],
86+
87+
"accessors" : [ {
88+
"bufferView" : 0,
89+
"componentType" : 5123,
90+
"count" : 24,
91+
"type" : "SCALAR"
92+
}, {
93+
"bufferView" : 1,
94+
"componentType" : 5126,
95+
"count" : 10,
96+
"type" : "VEC3",
97+
"max" : [ 0.5, 2.0, 0.0 ],
98+
"min" : [ -0.5, 0.0, 0.0 ]
99+
}, {
100+
"bufferView" : 2,
101+
"componentType" : 5123,
102+
"count" : 10,
103+
"type" : "VEC4"
104+
}, {
105+
"bufferView" : 2,
106+
"byteOffset" : 160,
107+
"componentType" : 5126,
108+
"count" : 10,
109+
"type" : "VEC4"
110+
}, {
111+
"bufferView" : 3,
112+
"componentType" : 5126,
113+
"count" : 2,
114+
"type" : "MAT4"
115+
}, {
116+
"bufferView" : 4,
117+
"componentType" : 5126,
118+
"count" : 12,
119+
"type" : "SCALAR",
120+
"max" : [ 5.5 ],
121+
"min" : [ 0.0 ]
122+
}, {
123+
"bufferView" : 4,
124+
"byteOffset" : 48,
125+
"componentType" : 5126,
126+
"count" : 12,
127+
"type" : "VEC4",
128+
"max" : [ 0.0, 0.0, 0.707, 1.0 ],
129+
"min" : [ 0.0, 0.0, -0.707, 0.707 ]
130+
} ],
131+
132+
"asset" : {
133+
"version" : "2.0"
134+
}
135+
}

0 commit comments

Comments
 (0)