Skip to content

Commit 766fa6a

Browse files
Add Simplify Animation Curves tool
This tool is used to simplify animation curves in Maya using curve fitting techniques. It provides a matric for how closely the curve fits. GitHub issue #268
1 parent cab2b8e commit 766fa6a

13 files changed

Lines changed: 1762 additions & 0 deletions

File tree

python/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ if (MMSOLVER_BUILD_QT_UI)
169169
${CMAKE_CURRENT_BINARY_DIR}/mmSolver/tools/attributecurvefilterpops/ui/ui_attrcurvefilterpops_layout.py
170170
)
171171

172+
compile_qt_ui_to_python_file("attributecurvesimplify"
173+
${CMAKE_CURRENT_SOURCE_DIR}/mmSolver/tools/attributecurvesimplify/ui/attrcurvesimplify_layout.ui
174+
${CMAKE_CURRENT_BINARY_DIR}/mmSolver/tools/attributecurvesimplify/ui/ui_attrcurvesimplify_layout.py
175+
)
176+
172177
compile_qt_ui_to_python_file("createcontroller2"
173178
${CMAKE_CURRENT_SOURCE_DIR}/mmSolver/tools/createcontroller2/ui/createcontroller_layout.ui
174179
${CMAKE_CURRENT_BINARY_DIR}/mmSolver/tools/createcontroller2/ui/ui_createcontroller_layout.py
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (C) 2025 David Cattermole.
2+
#
3+
# This file is part of mmSolver.
4+
#
5+
# mmSolver is free software: you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as
7+
# published by the Free Software Foundation, either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# mmSolver is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
17+
#
18+
"""Animation Curve Simplify tool."""
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Copyright (C) 2025 David Cattermole.
2+
#
3+
# This file is part of mmSolver.
4+
#
5+
# mmSolver is free software: you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as
7+
# published by the Free Software Foundation, either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# mmSolver is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
17+
#
18+
"""
19+
Attribute Curve Filter constants.
20+
"""
21+
22+
WINDOW_TITLE = "Attribute Curve Simplify"
23+
24+
# Constants for frame range mode.
25+
FRAME_RANGE_MODE_INPUT_ANIM_CURVE_VALUE = "attrcurvesimplify_input_anim_curve"
26+
FRAME_RANGE_MODE_TIMELINE_INNER_VALUE = "attrcurvesimplify_timeline_inner"
27+
FRAME_RANGE_MODE_TIMELINE_OUTER_VALUE = "attrcurvesimplify_timeline_outer"
28+
FRAME_RANGE_MODE_CUSTOM_VALUE = "attrcurvesimplify_custom"
29+
FRAME_RANGE_MODE_VALUES = [
30+
FRAME_RANGE_MODE_INPUT_ANIM_CURVE_VALUE,
31+
FRAME_RANGE_MODE_TIMELINE_INNER_VALUE,
32+
FRAME_RANGE_MODE_TIMELINE_OUTER_VALUE,
33+
FRAME_RANGE_MODE_CUSTOM_VALUE,
34+
]
35+
36+
FRAME_RANGE_MODE_INPUT_ANIM_CURVE_LABEL = "Input AnimCurve"
37+
FRAME_RANGE_MODE_TIMELINE_INNER_LABEL = "Timeline (Inner)"
38+
FRAME_RANGE_MODE_TIMELINE_OUTER_LABEL = "Timeline (Outer)"
39+
FRAME_RANGE_MODE_CUSTOM_LABEL = "Custom"
40+
FRAME_RANGE_MODE_LABELS = [
41+
FRAME_RANGE_MODE_INPUT_ANIM_CURVE_LABEL,
42+
FRAME_RANGE_MODE_TIMELINE_INNER_LABEL,
43+
FRAME_RANGE_MODE_TIMELINE_OUTER_LABEL,
44+
FRAME_RANGE_MODE_CUSTOM_LABEL,
45+
]
46+
47+
FRAME_RANGE_MODE_VALUE_LABEL_MAP = {
48+
FRAME_RANGE_MODE_INPUT_ANIM_CURVE_VALUE: FRAME_RANGE_MODE_INPUT_ANIM_CURVE_LABEL,
49+
FRAME_RANGE_MODE_TIMELINE_INNER_VALUE: FRAME_RANGE_MODE_TIMELINE_INNER_LABEL,
50+
FRAME_RANGE_MODE_TIMELINE_OUTER_VALUE: FRAME_RANGE_MODE_TIMELINE_OUTER_LABEL,
51+
FRAME_RANGE_MODE_CUSTOM_VALUE: FRAME_RANGE_MODE_CUSTOM_LABEL,
52+
}
53+
54+
55+
# Constants for distribution.
56+
#
57+
# These string values must match up with the values in
58+
# "./src/mmSolver/cmd/MMAnimCurveSimplifyCmd.cpp".
59+
DISTRIBUTION_UNIFORM_VALUE = "uniform"
60+
DISTRIBUTION_AUTO_KEYPOINTS_VALUE = "auto_keypoints"
61+
DISTRIBUTION_VALUES = [
62+
DISTRIBUTION_UNIFORM_VALUE,
63+
DISTRIBUTION_AUTO_KEYPOINTS_VALUE,
64+
]
65+
66+
DISTRIBUTION_UNIFORM_LABEL = "Uniform"
67+
DISTRIBUTION_AUTO_KEYPOINTS_LABEL = "Auto Keypoints"
68+
DISTRIBUTION_LABELS = [
69+
DISTRIBUTION_UNIFORM_LABEL,
70+
DISTRIBUTION_AUTO_KEYPOINTS_LABEL,
71+
]
72+
73+
DISTRIBUTION_VALUE_LABEL_MAP = {
74+
DISTRIBUTION_UNIFORM_VALUE: DISTRIBUTION_UNIFORM_LABEL,
75+
DISTRIBUTION_AUTO_KEYPOINTS_VALUE: DISTRIBUTION_AUTO_KEYPOINTS_LABEL,
76+
}
77+
78+
79+
# Constants for interpolation.
80+
#
81+
# These string values must match up with the values in
82+
# "./src/mmSolver/cmd/MMAnimCurveSimplifyCmd.cpp".
83+
CMD_INTERPOLATION_LINEAR_VALUE = "linear"
84+
CMD_INTERPOLATION_QUADRATIC_NUBS_VALUE = "quadratic_nubs"
85+
CMD_INTERPOLATION_CUBIC_NUBS_VALUE = "cubic_nubs"
86+
CMD_INTERPOLATION_CUBIC_SPLINE_VALUE = "cubic_spline"
87+
CMD_INTERPOLATION_VALUES = [
88+
CMD_INTERPOLATION_LINEAR_VALUE,
89+
CMD_INTERPOLATION_QUADRATIC_NUBS_VALUE,
90+
CMD_INTERPOLATION_CUBIC_NUBS_VALUE,
91+
CMD_INTERPOLATION_CUBIC_SPLINE_VALUE,
92+
]
93+
94+
# Constants for interpolation.
95+
INTERPOLATION_LINEAR_VALUE = "linear"
96+
INTERPOLATION_SMOOTH_VALUE = "smooth"
97+
INTERPOLATION_VALUES = [
98+
INTERPOLATION_LINEAR_VALUE,
99+
INTERPOLATION_SMOOTH_VALUE,
100+
]
101+
102+
INTERPOLATION_LINEAR_LABEL = "Linear"
103+
INTERPOLATION_SMOOTH_LABEL = "Smooth"
104+
INTERPOLATION_LABELS = [
105+
INTERPOLATION_LINEAR_LABEL,
106+
INTERPOLATION_SMOOTH_LABEL,
107+
]
108+
109+
INTERPOLATION_VALUE_LABEL_MAP = {
110+
INTERPOLATION_LINEAR_VALUE: INTERPOLATION_LINEAR_LABEL,
111+
INTERPOLATION_SMOOTH_VALUE: INTERPOLATION_SMOOTH_LABEL,
112+
}
113+
114+
115+
# Default Values
116+
DEFAULT_FRAME_START = 1
117+
DEFAULT_FRAME_END = 120
118+
DEFAULT_FRAME_RANGE_MODE = FRAME_RANGE_MODE_INPUT_ANIM_CURVE_VALUE
119+
DEFAULT_CONTROL_POINTS = 3
120+
DEFAULT_DISTRIBUTION = DISTRIBUTION_UNIFORM_VALUE
121+
DEFAULT_INTERPOLATION = INTERPOLATION_SMOOTH_VALUE
122+
123+
# Config files
124+
CONFIG_FRAME_RANGE_MODE_KEY = "mmSolver_attrcurvesimplify_frame_range_mode"
125+
CONFIG_FRAME_START_KEY = "mmSolver_attrcurvesimplify_frame_start"
126+
CONFIG_FRAME_END_KEY = "mmSolver_attrcurvesimplify_frame_end"
127+
CONFIG_CONTROL_POINTS_KEY = "mmSolver_attrcurvesimplify_control_points"
128+
CONFIG_DISTRIBUTION_KEY = "mmSolver_attrcurvesimplify_distribution"
129+
CONFIG_INTERPOLATION_KEY = "mmSolver_attrcurvesimplify_interpolation"

0 commit comments

Comments
 (0)