Skip to content

Commit 5d09e97

Browse files
committed
fix: restore mac morph and spline compatibility
1 parent 8844a4a commit 5d09e97

2 files changed

Lines changed: 50 additions & 39 deletions

File tree

source/module/tools/object/mmd_morph.cpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77
#include "mmd_bone_manager.h"
88
#include "description/OMMDModelManager.h"
99

10-
inline Bool IMorph::Read(HyperFile* hf)
10+
Bool IMorph::Read(HyperFile* hf)
1111
{
1212
IOReadField(m_strength_id);
1313
IOReadField(m_name);
1414
return true;
1515
}
1616

17-
inline Bool IMorph::Write(HyperFile* hf) SDK2024_Const
17+
Bool IMorph::Write(HyperFile* hf) SDK2024_Const
1818
{
1919
IOWriteField(m_strength_id);
2020
IOWriteField(m_name);
2121
return true;
2222
}
2323

24-
inline Bool IMorph::CopyTo(IMorph* dest) const
24+
Bool IMorph::CopyTo(IMorph* dest) const
2525
{
2626
dest->m_strength_id = m_strength_id;
2727
dest->m_name = m_name;
2828
return true;
2929
}
3030

31-
inline Bool GroupMorph::Read(HyperFile* hf)
31+
Bool GroupMorph::Read(HyperFile* hf)
3232
{
3333
if (!IMorph::Read(hf))
3434
return false;
@@ -44,7 +44,7 @@ inline Bool GroupMorph::Read(HyperFile* hf)
4444
return true;
4545
}
4646

47-
inline Bool GroupMorph::Write(HyperFile* hf) SDK2024_Const
47+
Bool GroupMorph::Write(HyperFile* hf) SDK2024_Const
4848
{
4949
if (IMorph::Write(hf) == false)
5050
return false;
@@ -58,7 +58,7 @@ inline Bool GroupMorph::Write(HyperFile* hf) SDK2024_Const
5858
return true;
5959
}
6060

61-
inline Bool GroupMorph::CopyTo(IMorph* dest) const
61+
Bool GroupMorph::CopyTo(IMorph* dest) const
6262
{
6363
if (IMorph::CopyTo(dest) == false)
6464
return false;
@@ -70,7 +70,7 @@ inline Bool GroupMorph::CopyTo(IMorph* dest) const
7070
return true;
7171
}
7272

73-
inline Bool FlipMorph::Read(HyperFile* hf)
73+
Bool FlipMorph::Read(HyperFile* hf)
7474
{
7575
if (IMorph::Read(hf) == false)
7676
return false;
@@ -85,7 +85,7 @@ inline Bool FlipMorph::Read(HyperFile* hf)
8585
return true;
8686
}
8787

88-
inline Bool FlipMorph::Write(HyperFile* hf) SDK2024_Const
88+
Bool FlipMorph::Write(HyperFile* hf) SDK2024_Const
8989
{
9090
if (IMorph::Write(hf) == false)
9191
return false;
@@ -99,7 +99,7 @@ inline Bool FlipMorph::Write(HyperFile* hf) SDK2024_Const
9999
return true;
100100
}
101101

102-
inline Bool FlipMorph::CopyTo(IMorph* dest) const
102+
Bool FlipMorph::CopyTo(IMorph* dest) const
103103
{
104104
if (IMorph::CopyTo(dest) == false)
105105
return false;
@@ -150,7 +150,7 @@ void IMorph::DeletePanelUI(MMDModelManagerObject& model)
150150
model.DeleteDynamicDescription(m_panel_id);
151151
}
152152

153-
inline Float IMorph::GetStrength(SDK2024_Const GeListNode* node) const
153+
Float IMorph::GetStrength(SDK2024_Const GeListNode* node) const
154154
{
155155
GeData ge_data;
156156
if (!node->GetParameter(m_strength_id, ge_data, DESCFLAGS_GET::NONE))
@@ -180,7 +180,7 @@ void IMorph::RenameMorph(const String& name)
180180
m_name = name;
181181
}
182182

183-
inline void GroupMorph::RenameSubMorph(const Int old_id, const Int new_id)
183+
void GroupMorph::RenameSubMorph(const Int old_id, const Int new_id)
184184
{
185185
if (auto* data_ptr = m_data.Find(old_id); data_ptr)
186186
{
@@ -190,7 +190,7 @@ inline void GroupMorph::RenameSubMorph(const Int old_id, const Int new_id)
190190
}
191191
}
192192

193-
inline void FlipMorph::RenameSubMorph(const Int old_id, const Int new_id)
193+
void FlipMorph::RenameSubMorph(const Int old_id, const Int new_id)
194194
{
195195
if (auto* data_ptr = m_data.Find(old_id); data_ptr)
196196
{
@@ -219,7 +219,7 @@ GroupMorph::GroupMorph(GroupMorph&& other) noexcept:
219219
m_data(std::move(other.m_data))
220220
{}
221221

222-
inline void GroupMorph::UpdateMorph(MMDModelManagerObject& model)
222+
void GroupMorph::UpdateMorph(MMDModelManagerObject& model)
223223
{
224224
GeListNode* node = model.Get();
225225
auto& morph_arr = model.GetMorphData();
@@ -251,7 +251,7 @@ FlipMorph::FlipMorph(FlipMorph&& other) noexcept:
251251
m_data(std::move(other.m_data))
252252
{}
253253

254-
inline void FlipMorph::UpdateMorph(MMDModelManagerObject& model)
254+
void FlipMorph::UpdateMorph(MMDModelManagerObject& model)
255255
{
256256
GeListNode* node = model.Get();
257257
auto& morph_arr = model.GetMorphData();
@@ -264,7 +264,7 @@ inline void FlipMorph::UpdateMorph(MMDModelManagerObject& model)
264264
}
265265
}
266266

267-
inline void MeshMorph::UpdateMorph(MMDModelManagerObject& model)
267+
void MeshMorph::UpdateMorph(MMDModelManagerObject& model)
268268
{
269269
if (BaseObject* mesh_manager = model.GetMeshManagerObject())
270270
{
@@ -273,7 +273,7 @@ inline void MeshMorph::UpdateMorph(MMDModelManagerObject& model)
273273

274274
}
275275

276-
inline void BoneMorph::UpdateMorph(MMDModelManagerObject& model)
276+
void BoneMorph::UpdateMorph(MMDModelManagerObject& model)
277277
{
278278
if (BaseObject* bone_manager = model.GetBoneManagerObject())
279279
{
@@ -288,7 +288,7 @@ inline void BoneMorph::UpdateMorph(MMDModelManagerObject& model)
288288
}
289289
}
290290

291-
inline void GroupMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
291+
void GroupMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
292292
{
293293
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_GROUP);
294294
bc.SetString(DESC_NAME, m_name);
@@ -328,7 +328,7 @@ inline void GroupMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
328328
SendCoreMessage(COREMSG_CINEMA, BaseContainer(COREMSG_CINEMA_FORCE_AM_UPDATE));
329329
}
330330

331-
inline void FlipMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
331+
void FlipMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
332332
{
333333
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_GROUP);
334334
bc.SetString(DESC_NAME, m_name);
@@ -368,7 +368,7 @@ inline void FlipMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
368368
SendCoreMessage(COREMSG_CINEMA, BaseContainer(COREMSG_CINEMA_FORCE_AM_UPDATE));
369369
}
370370

371-
inline void MeshMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
371+
void MeshMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
372372
{
373373
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_REAL);
374374
bc.SetString(DESC_NAME, m_name);
@@ -391,15 +391,15 @@ UVMorph::UVMorph(String name, DescID strength_id) : IMorph(std::move(name), std:
391391
UVMorph::UVMorph(UVMorph&& other) noexcept : IMorph(std::move(other))
392392
{}
393393

394-
inline void UVMorph::UpdateMorph(MMDModelManagerObject& model)
394+
void UVMorph::UpdateMorph(MMDModelManagerObject& model)
395395
{
396396
if (BaseObject* mesh_manager = model.GetMeshManagerObject())
397397
{
398398
mesh_manager->GetNodeData<MMDMeshManagerObject>()->SetMorphStrength(m_name, GetStrength(model.Get()));
399399
}
400400
}
401401

402-
inline void UVMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
402+
void UVMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
403403
{
404404
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_REAL);
405405
bc.SetString(DESC_NAME, m_name);
@@ -416,7 +416,7 @@ inline void UVMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
416416
SendCoreMessage(COREMSG_CINEMA, BaseContainer(COREMSG_CINEMA_FORCE_AM_UPDATE));
417417
}
418418

419-
inline void UVMorph::DeleteMorphUI(MMDModelManagerObject& model)
419+
void UVMorph::DeleteMorphUI(MMDModelManagerObject& model)
420420
{
421421
DeletePanelUI(model);
422422
model.DeleteDynamicDescription(m_strength_id);
@@ -428,7 +428,7 @@ inline void UVMorph::DeleteMorphUI(MMDModelManagerObject& model)
428428
}
429429
}
430430

431-
inline void BoneMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
431+
void BoneMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
432432
{
433433
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_REAL);
434434
bc.SetString(DESC_NAME, m_name);
@@ -445,7 +445,7 @@ inline void BoneMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
445445
SendCoreMessage(COREMSG_CINEMA, BaseContainer(COREMSG_CINEMA_FORCE_AM_UPDATE));
446446
}
447447

448-
inline void GroupMorph::DeleteMorphUI(MMDModelManagerObject& model)
448+
void GroupMorph::DeleteMorphUI(MMDModelManagerObject& model)
449449
{
450450
model.DeleteDynamicDescription(m_button_editor_id);
451451
model.DeleteDynamicDescription(m_button_delete_id);
@@ -462,7 +462,7 @@ inline void GroupMorph::DeleteMorphUI(MMDModelManagerObject& model)
462462
}
463463
}
464464

465-
inline void FlipMorph::DeleteMorphUI(MMDModelManagerObject& model)
465+
void FlipMorph::DeleteMorphUI(MMDModelManagerObject& model)
466466
{
467467
model.DeleteDynamicDescription(m_button_editor_id);
468468
model.DeleteDynamicDescription(m_button_delete_id);
@@ -479,7 +479,7 @@ inline void FlipMorph::DeleteMorphUI(MMDModelManagerObject& model)
479479
}
480480
}
481481

482-
inline void MeshMorph::DeleteMorphUI(MMDModelManagerObject& model)
482+
void MeshMorph::DeleteMorphUI(MMDModelManagerObject& model)
483483
{
484484
DeletePanelUI(model);
485485
model.DeleteDynamicDescription(m_strength_id);
@@ -497,7 +497,7 @@ BoneMorph::BoneMorph(String name, DescID strength_id): IMorph(std::move(name), s
497497
BoneMorph::BoneMorph(BoneMorph&& other) noexcept: IMorph(std::move(other))
498498
{}
499499

500-
inline void BoneMorph::DeleteMorphUI(MMDModelManagerObject& model)
500+
void BoneMorph::DeleteMorphUI(MMDModelManagerObject& model)
501501
{
502502
DeletePanelUI(model);
503503
model.DeleteDynamicDescription(m_strength_id);
@@ -509,27 +509,27 @@ inline void BoneMorph::DeleteMorphUI(MMDModelManagerObject& model)
509509
}
510510
}
511511

512-
inline void GroupMorph::AddSubMorph(MMDModelManagerObject* model, Int id, const Float weight)
512+
void GroupMorph::AddSubMorph(MMDModelManagerObject* model, Int id, const Float weight)
513513
{
514514
if (model->GetMorphNum() > id)
515515
{
516516
std::ignore = m_data.Insert(id, weight);
517517
}
518518
}
519519

520-
inline void FlipMorph::AddSubMorph(MMDModelManagerObject* model, Int id, const Float weight)
520+
void FlipMorph::AddSubMorph(MMDModelManagerObject* model, Int id, const Float weight)
521521
{
522522
if (model->GetMorphNum() > id) {
523523
std::ignore = m_data.Insert(id, weight);
524524
}
525525
}
526526

527-
inline void GroupMorph::AddSubMorphNoCheck(Int id, const Float weight)
527+
void GroupMorph::AddSubMorphNoCheck(Int id, const Float weight)
528528
{
529529
std::ignore = m_data.Insert(id, weight);
530530
}
531531

532-
inline auto FlipMorph::AddSubMorphNoCheck(Int id, const Float weight) -> void
532+
auto FlipMorph::AddSubMorphNoCheck(Int id, const Float weight) -> void
533533
{
534534
std::ignore = m_data.Insert(id, weight);
535535
}
@@ -540,10 +540,10 @@ MaterialMorph::MaterialMorph(String name, DescID strength_id) : IMorph(std::move
540540
MaterialMorph::MaterialMorph(MaterialMorph&& other) noexcept : IMorph(std::move(other))
541541
{}
542542

543-
inline void MaterialMorph::UpdateMorph(MMDModelManagerObject& model)
543+
void MaterialMorph::UpdateMorph(MMDModelManagerObject& model)
544544
{}
545545

546-
inline void MaterialMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
546+
void MaterialMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
547547
{
548548
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_REAL);
549549
bc.SetString(DESC_NAME, m_name);
@@ -560,7 +560,7 @@ inline void MaterialMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id
560560
SendCoreMessage(COREMSG_CINEMA, BaseContainer(COREMSG_CINEMA_FORCE_AM_UPDATE));
561561
}
562562

563-
inline void MaterialMorph::DeleteMorphUI(MMDModelManagerObject& model)
563+
void MaterialMorph::DeleteMorphUI(MMDModelManagerObject& model)
564564
{
565565
DeletePanelUI(model);
566566
model.DeleteDynamicDescription(m_strength_id);
@@ -577,10 +577,10 @@ ImpulseMorph::ImpulseMorph(String name, DescID strength_id) : IMorph(std::move(n
577577
ImpulseMorph::ImpulseMorph(ImpulseMorph&& other) noexcept : IMorph(std::move(other))
578578
{}
579579

580-
inline void ImpulseMorph::UpdateMorph(MMDModelManagerObject& model)
580+
void ImpulseMorph::UpdateMorph(MMDModelManagerObject& model)
581581
{}
582582

583-
inline void ImpulseMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
583+
void ImpulseMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
584584
{
585585
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_REAL);
586586
bc.SetString(DESC_NAME, m_name);
@@ -597,7 +597,7 @@ inline void ImpulseMorph::AddMorphUI(MMDModelManagerObject& model, Int morph_id)
597597
SendCoreMessage(COREMSG_CINEMA, BaseContainer(COREMSG_CINEMA_FORCE_AM_UPDATE));
598598
}
599599

600-
inline void ImpulseMorph::DeleteMorphUI(MMDModelManagerObject& model)
600+
void ImpulseMorph::DeleteMorphUI(MMDModelManagerObject& model)
601601
{
602602
DeletePanelUI(model);
603603
model.DeleteDynamicDescription(m_strength_id);

source/module/tools/tag/mmd_bone.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ namespace
6969
#endif
7070
}
7171

72+
const CustomSplineKnot* GetSplineKnot(const SplineData* spline, const Int32 index)
73+
{
74+
if (!spline)
75+
return nullptr;
76+
#if API_VERSION < 23000
77+
return const_cast<SplineData*>(spline)->GetKnot(index);
78+
#else
79+
return spline->GetKnot(index);
80+
#endif
81+
}
82+
7283
Float32 ClampSplineCoordinate(const Float value)
7384
{
7485
return maxon::SafeConvert<Float32>(std::clamp(value, 0.0, static_cast<double>(kBoneAnimationSplineMax)));
@@ -190,8 +201,8 @@ namespace
190201
if (!spline || spline->GetKnotCount() < 2)
191202
return bezier;
192203

193-
const CustomSplineKnot* const first = spline->GetKnot(0);
194-
const CustomSplineKnot* const last = spline->GetKnot(spline->GetKnotCount() - 1);
204+
const CustomSplineKnot* const first = GetSplineKnot(spline, 0);
205+
const CustomSplineKnot* const last = GetSplineKnot(spline, spline->GetKnotCount() - 1);
195206
if (!first || !last)
196207
return bezier;
197208

0 commit comments

Comments
 (0)