@@ -547,7 +547,9 @@ namespace
547547
548548 BaseTime GetDocumentTimeOrInvalid (const BaseDocument* doc)
549549 {
550- return doc ? doc->GetTime () : BaseTime (-1 .);
550+ // Older Cinema 4D SDKs expose BaseDocument::GetTime() as non-const.
551+ BaseDocument* const mutable_doc = const_cast <BaseDocument*>(doc);
552+ return mutable_doc ? mutable_doc->GetTime () : BaseTime (-1 .);
551553 }
552554
553555 Float GetAnimationFrameFromDocumentContinuous (BaseDocument* doc)
@@ -1156,7 +1158,7 @@ Bool MMDBoneTag::GetPlaybackRuntimeOverride(Vector& translation, std::array<Floa
11561158 if (!has_runtime_playback_override_)
11571159 return false ;
11581160
1159- const BaseTag* const self_tag = static_cast <BaseTag*>(const_cast <MMDBoneTag*>(this )->Get ());
1161+ BaseTag* const self_tag = static_cast <BaseTag*>(const_cast <MMDBoneTag*>(this )->Get ());
11601162 const BaseDocument* const doc = self_tag ? self_tag->GetDocument () : nullptr ;
11611163 if (runtime_playback_override_time_ != GetDocumentTimeOrInvalid (doc))
11621164 return false ;
@@ -1168,12 +1170,12 @@ Bool MMDBoneTag::GetPlaybackRuntimeOverride(Vector& translation, std::array<Floa
11681170
11691171Bool MMDBoneTag::HasPostPhysicsIKSolveAtTime (const BaseDocument* doc) const
11701172{
1171- return doc != nullptr && last_postphysics_ik_solve_time_ == doc-> GetTime ( );
1173+ return last_postphysics_ik_solve_time_ == GetDocumentTimeOrInvalid (doc );
11721174}
11731175
11741176void MMDBoneTag::MarkPostPhysicsIKSolvedAtTime (const BaseDocument* doc)
11751177{
1176- last_postphysics_ik_solve_time_ = doc ? doc-> GetTime () : BaseTime (- 1 . );
1178+ last_postphysics_ik_solve_time_ = GetDocumentTimeOrInvalid (doc );
11771179}
11781180
11791181void MMDBoneTag::SetAppendRecursionDepth (const Int32 depth)
@@ -2273,8 +2275,6 @@ void MMDBoneTag::BuildStandaloneIKChains()
22732275 if (!CollectStandaloneIKChainEntries (tag, entries))
22742276 return ;
22752277
2276- BaseDocument* const tag_doc = tag->GetDocument ();
2277-
22782278 if (entries.IsEmpty ())
22792279 {
22802280 ik_solver->ClearIKChains ();
@@ -2470,7 +2470,6 @@ Bool MMDBoneTag::RunIKSolveAnimMode(BaseObject* op, const Bool mark_prephysics_c
24702470 return false ;
24712471
24722472 BaseDocument* const doc = op->GetDocument ();
2473- const Int32 current_frame = GetAnimationFrameFromDocument (doc);
24742473 const BaseTime current_time = GetDocumentTimeOrInvalid (doc);
24752474 if (!allow_same_frame_resolve && last_ik_solve_time_ == current_time)
24762475 return false ;
0 commit comments