Skip to content

Commit e591ddf

Browse files
Fix start/end frames for mmAnimCurve* commands
1 parent 31634a6 commit e591ddf

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

src/mmSolver/cmd/MMAnimCurveFilterPopsCmd.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ MStatus MMAnimCurveFilterPopsCmd::parseArgs(const MArgList &args) {
144144
}
145145

146146
// Parse optional arguments
147-
m_startFrame = std::numeric_limits<uint32_t>::max();
148-
m_endFrame = std::numeric_limits<uint32_t>::max();
147+
m_startFrame = std::numeric_limits<FrameNumber>::max();
148+
m_endFrame = std::numeric_limits<FrameNumber>::max();
149149
if (argData.isFlagSet(START_FRAME_FLAG_SHORT)) {
150150
status =
151151
argData.getFlagArgument(START_FRAME_FLAG_SHORT, 0, m_startFrame);
@@ -182,7 +182,7 @@ MStatus MMAnimCurveFilterPopsCmd::doIt(const MArgList &args) {
182182
// Don't store each individual edit, just store the combination.
183183
m_curveChange.setInteractive(true);
184184

185-
auto count = static_cast<size_t>(m_endFrame - m_startFrame) + 1;
185+
const auto count = static_cast<size_t>(m_endFrame - m_startFrame) + 1;
186186
MMSOLVER_MAYA_VRB(CMD_NAME << ": count=" << count);
187187

188188
rust::Vec<mmsg::Real> values_x;

src/mmSolver/cmd/MMAnimCurveSimplifyCmd.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858

5959
// MM Solver
6060
#include "mmSolver/cmd/anim_curve_cmd_utils.h"
61+
#include "mmSolver/core/frame.h"
62+
#include "mmSolver/core/types.h"
6163
#include "mmSolver/utilities/assert_utils.h"
6264
#include "mmSolver/utilities/debug_utils.h"
6365

@@ -178,8 +180,8 @@ MStatus MMAnimCurveSimplifyCmd::parseArgs(const MArgList &args) {
178180
MMSOLVER_CHECK_MSTATUS_AND_RETURN_IT(status);
179181
}
180182

181-
m_startFrame = std::numeric_limits<uint32_t>::max();
182-
m_endFrame = std::numeric_limits<uint32_t>::max();
183+
m_startFrame = std::numeric_limits<FrameNumber>::max();
184+
m_endFrame = std::numeric_limits<FrameNumber>::max();
183185
if (argData.isFlagSet(START_FRAME_FLAG_SHORT)) {
184186
status =
185187
argData.getFlagArgument(START_FRAME_FLAG_SHORT, 0, m_startFrame);
@@ -309,7 +311,7 @@ MStatus MMAnimCurveSimplifyCmd::doIt(const MArgList &args) {
309311

310312
MMSOLVER_MAYA_VRB(CMD_NAME << ": m_startFrame=" << m_startFrame);
311313
MMSOLVER_MAYA_VRB(CMD_NAME << ": m_endFrame=" << m_endFrame);
312-
auto frame_count = static_cast<size_t>(m_endFrame - m_startFrame) + 1;
314+
const auto frame_count = static_cast<size_t>(m_endFrame - m_startFrame) + 1;
313315
MMSOLVER_MAYA_VRB(CMD_NAME << ": frame_count=" << frame_count);
314316
MMSOLVER_MAYA_VRB(CMD_NAME << ": m_selection.length()="
315317
<< m_selection.length());
@@ -324,8 +326,8 @@ MStatus MMAnimCurveSimplifyCmd::doIt(const MArgList &args) {
324326
MDoubleArray result;
325327

326328
const auto time_unit = MTime::uiUnit();
327-
uint32_t success_count = 0;
328-
uint32_t failure_count = 0;
329+
Count32 success_count = 0;
330+
Count32 failure_count = 0;
329331
for (auto i = 0; i < m_selection.length(); i++) {
330332
MMSOLVER_MAYA_VRB(CMD_NAME << ": i=" << i);
331333

@@ -353,7 +355,7 @@ MStatus MMAnimCurveSimplifyCmd::doIt(const MArgList &args) {
353355
min_frame_count, m_animCurveFn, start_frame, end_frame);
354356
if (!success) {
355357
MGlobal::displayWarning(CMD_NAME
356-
": failed to validate animation curve.");
358+
": Failed to validate animation curve.");
357359
failure_count++;
358360
continue;
359361
}
@@ -362,7 +364,7 @@ MStatus MMAnimCurveSimplifyCmd::doIt(const MArgList &args) {
362364
m_animCurveFn, values_x, values_y);
363365
if (status != MS::kSuccess) {
364366
MGlobal::displayWarning(
365-
CMD_NAME ": failed to set animation curve keyframes.");
367+
CMD_NAME ": Failed to set animation curve keyframes.");
366368
failure_count++;
367369
continue;
368370
}
@@ -381,7 +383,7 @@ MStatus MMAnimCurveSimplifyCmd::doIt(const MArgList &args) {
381383

382384
MMSOLVER_MAYA_VRB(CMD_NAME
383385
<< ": m_controlPointCount="
384-
<< static_cast<int32_t>(m_controlPointCount));
386+
<< static_cast<Count32>(m_controlPointCount));
385387

386388
rust::Slice<const mmsg::Real> values_slice_x{values_x.data(),
387389
values_x.size()};
@@ -413,7 +415,7 @@ MStatus MMAnimCurveSimplifyCmd::doIt(const MArgList &args) {
413415
preserve_first_last_keys);
414416
if (status != MS::kSuccess) {
415417
MGlobal::displayWarning(
416-
CMD_NAME ": failed to set animation curve keyframes.");
418+
CMD_NAME ": Failed to set animation curve keyframes.");
417419
failure_count++;
418420
continue;
419421
}
@@ -423,12 +425,12 @@ MStatus MMAnimCurveSimplifyCmd::doIt(const MArgList &args) {
423425
}
424426

425427
MMSOLVER_MAYA_VRB(CMD_NAME << ": failure_count="
426-
<< static_cast<int32_t>(failure_count));
428+
<< static_cast<Count32>(failure_count));
427429
MMSOLVER_MAYA_VRB(CMD_NAME << ": success_count="
428-
<< static_cast<int32_t>(success_count));
430+
<< static_cast<Count32>(success_count));
429431
if (failure_count > 0) {
430432
MGlobal::displayError(CMD_NAME
431-
": failed to simplify on animation curves.");
433+
": Failed to simplify on animation curves.");
432434
}
433435
if (success_count == 0) {
434436
status = MS::kFailure;

0 commit comments

Comments
 (0)