Skip to content

Commit 7b83b36

Browse files
committed
try to fix #59
1 parent 6d60449 commit 7b83b36

File tree

8 files changed

+16
-9
lines changed

8 files changed

+16
-9
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ assets
4444

4545
screenshot.png
4646

47+
123.error.txt
48+
123.txt

Framework/src/Effect/CubismBreath.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const csmVector<CubismBreath::BreathParameterData>& CubismBreath::GetParameters(
4040

4141
void CubismBreath::UpdateParameters(CubismModel* model, csmFloat32 deltaTimeSeconds)
4242
{
43+
// printf("%f\n", _currentTime);
4344
_currentTime += deltaTimeSeconds;
4445

4546
const csmFloat32 t = _currentTime * 2.0f * CubismMath::Pi;
@@ -49,6 +50,8 @@ void CubismBreath::UpdateParameters(CubismModel* model, csmFloat32 deltaTimeSeco
4950
BreathParameterData* data = &_breathParameters[i];
5051

5152
model->AddParameterValue(data->ParameterId, data->Offset + (data->Peak * sinf(t / data->Cycle)), data->Weight);
53+
// printf("%f %f %f %f %f %f\n", _currentTime, deltaTimeSeconds, t, data->Offset, data->Peak, data->Cycle);
54+
// printf("%s %f %f\n", data->ParameterId->GetString().GetRawString(), data->Offset + (data->Peak * sinf(t / data->Cycle)), data->Weight);
5255
}
5356
}
5457

Main/src/LAppModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ void LAppModel::ReleaseExpressions()
368368
void LAppModel::Update()
369369
{
370370
_currentFrame = LAppPal::GetCurrentTimePoint();
371-
_deltaTimeSeconds = std::min(0.1f, static_cast<float>(_currentFrame - _lastFrame)); // 防止间隔过大导致后续状态异常
371+
_deltaTimeSeconds = std::min(0.1f, _currentFrame - _lastFrame); // 防止间隔过大导致后续状态异常
372372
_lastFrame = _currentFrame;
373373

374374
_dragManager->Update(_deltaTimeSeconds);

Main/src/LAppModel.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ class LAppModel : public Csm::CubismUserModel
281281

282282
int* _tmpOrderedDrawIndices;
283283

284-
double _currentFrame;
285-
double _lastFrame;
286-
double _deltaTimeSeconds;
284+
float _currentFrame;
285+
float _lastFrame;
286+
float _deltaTimeSeconds;
287287

288288
// used to clear motion effect
289289
const float* _defaultParameterValues;

Main/src/LAppPal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void LAppPal::PrintLn(const Csm::csmChar *message)
6969
Info(message);
7070
}
7171

72-
double LAppPal::GetCurrentTimePoint()
72+
float LAppPal::GetCurrentTimePoint()
7373
{
74-
return std::chrono::duration<double>(std::chrono::steady_clock::now().time_since_epoch()).count();
74+
return std::chrono::duration<float>(std::chrono::steady_clock::now().time_since_epoch()).count();
7575
}

Main/src/LAppPal.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ class LAppPal
4242

4343
static void PrintLn(const Csm::csmChar* message);
4444

45-
static double GetCurrentTimePoint();
45+
static float GetCurrentTimePoint();
4646
};

package/main_facial_bind.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def main():
4141
if live2d.LIVE2D_VERSION == 3:
4242
model.LoadModelJson(os.path.join(resources.RESOURCES_DIRECTORY,
4343
"v3/llny/llny.model3.json"
44-
# "v3/whitecat/SDwhite cat free.model3.json"
44+
# "v3/whitecat/sdwhite cat free.model3.json"
4545
))
4646
elif live2d.LIVE2D_VERSION == 2:
4747
model.LoadModelJson(os.path.join(resources.RESOURCES_DIRECTORY, "v2/kasumi2/kasumi2.model.json"))
@@ -52,6 +52,8 @@ def main():
5252
params = Params()
5353
td.Thread(None, mediapipe_capture_task, "Capture Task", (params,), daemon=True).start()
5454

55+
# model.SetAutoBreathEnable(False)
56+
5557
while True:
5658
for event in pygame.event.get():
5759
if event.type == pygame.QUIT:

package/main_pygame_three_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def main():
1717
l2d_v3.glewInit()
1818
l2d_v2.glewInit()
1919

20-
model_v3 = l2d_v3.LAppModel()
2120
model_v2 = l2d_v2.LAppModel()
21+
model_v3 = l2d_v3.LAppModel()
2222
model_v3_2 = l2d_v3.LAppModel()
2323

2424
model_v3.LoadModelJson(

0 commit comments

Comments
 (0)