{"id":16604291,"url":"https://github.com/david-cattermole/animcurvematch-maya","last_synced_at":"2025-10-29T15:31:32.420Z","repository":{"id":112688686,"uuid":"96031758","full_name":"david-cattermole/animCurveMatch-maya","owner":"david-cattermole","description":"Match sparse to dense animCurves in Autodesk Maya","archived":false,"fork":false,"pushed_at":"2017-08-21T22:04:27.000Z","size":30,"stargazers_count":26,"open_issues_count":1,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-06T11:14:41.433Z","etag":null,"topics":["animation","c-plus-plus","computer-graphics","curves","levenberg-marquardt","maya","maya-plugin","mayaapi"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/david-cattermole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-07-02T15:21:43.000Z","updated_at":"2024-12-03T01:25:53.000Z","dependencies_parsed_at":"2023-09-11T20:31:54.954Z","dependency_job_id":null,"html_url":"https://github.com/david-cattermole/animCurveMatch-maya","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-cattermole%2FanimCurveMatch-maya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-cattermole%2FanimCurveMatch-maya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-cattermole%2FanimCurveMatch-maya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-cattermole%2FanimCurveMatch-maya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/david-cattermole","download_url":"https://codeload.github.com/david-cattermole/animCurveMatch-maya/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238848111,"owners_count":19540826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","c-plus-plus","computer-graphics","curves","levenberg-marquardt","maya","maya-plugin","mayaapi"],"created_at":"2024-10-12T00:56:53.046Z","updated_at":"2025-10-29T15:31:27.101Z","avatar_url":"https://github.com/david-cattermole.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Maya AnimCurve Match\n\nMatches a sparse Maya animCurve to a dense animCurve using a Non-linear Least Squares algorithm.\n\nThis plug-in command can be used to help create simplified animCurves using less keyframes, while matching closely to the original densely baked animation curve.\n\nUses of this plug-in are:\n- animCurve sub-division (increasing keyframes)\n- animCurve keyframe reduction (used to match to a reference curve)\n- Motion Capture animCurve clean-up and re-targeting.\n- Animated space switching, while keeping world space positioning (re-parenting a child node into world, while keeping the original keyframe positions, and re-adjusting tangents).\n\n## Features\n\n- Calculates animCurve keyframe values, tangents and times to fit a different animCurve (dense or sparse).\n- Ability to adjusting:\n  - Keyframe Value\n  - Keyframe Time\n  - Keyframe Tangents\n- Creation of new animCurve curve, with given name.\n- When start/end keyframe times do not match source curve, scaling the destination curve to the correct start/end times is possible.\n- Maya Undo / Redo support.\n\n## Usage\n\nHere is a simple example of how to use the animCurveMatch command.\n\n```python\nstart = 1\nend = 10\n\nimport math\nimport maya.cmds\n\n# Load Plugin\nmaya.cmds.loadPlugin('animCurveMatch')\n\ntfm, shp = maya.cmds.polySphere()\n\nmaya.cmds.setKeyframe(tfm, attribute='translateX', time=start, value=10)\nmaya.cmds.setKeyframe(tfm, attribute='translateX', time=end, value=-10)\n\nfor i in range(start, end+1):\n    v = math.cos((float(i-1) / float(end-1)) * math.pi)\n    maya.cmds.setKeyframe(tfm, attribute='translateZ', time=i, value=v)\nmaya.cmds.keyTangent(tfm, inTangentType='spline', outTangentType='spline', time=())\n\nsrcCurve = maya.cmds.listConnections(tfm + '.translateZ', type='animCurve')[0]\ndstCurve = maya.cmds.listConnections(tfm + '.translateX', type='animCurve')[0]\n\n# Run command! This will modify 'dstCurve' animCurve.\nmaya.cmds.animCurveMatch(srcCurve, dstCurve, iterations=1000)\n```\n\n_See 'test.py' for more details_\n\n## Command Flags\n\nThe command syntax is:\n```text\nanimCurveMatch \u003csource\u003e \u003cdestination\u003e [flags]\n```\n\nThe command can be run in both MEL and Python.\n\nMEL:\n```text\nanimCurveMatch \"srcCurve\" \"dstCurve\" -iterations 1000;\n```\n\nPython:\n```python\nmaya.cmds.animCurveMatch(\"srcCurve\", \"dstCurve\", iterations=1000)\n```\n\nHere is a table of command flags, as currently specified in the command. Note some are \"UNSUPPORTED\", these flags have been added, but do not function correctly.\n\n| Flag         | Type          | Description | Default Value |\n| ------------ | ------------- | ----------- | ------------- |\n| -name (-n)   | string        | The name for the new animCurve created, must be a unique name. | name_solved |\n| -iterations (-it) | int | Number of iterations to perform. | 1000 |\n| -adjustValues (-avl) | bool | Adjust the keyframe values to minimise differences. | true |\n| -adjustTimes (-atm) | bool | Adjust the keyframe times to minimise differences. | false |\n| -adjustTangentAngles (-ata) | bool | Adjust the keyframe tangent angles to minimise differences. | true |\n| -adjustTangentWeights (-atw) | bool | UNSUPPORTED - Adjust the keyframe tangent angles to minimise differences. | false |\n| -forceWholeFrames (-fwf) | bool | When adjusting keyframe times, only modify time values by +/- 1.0. | true |\n| -scaleTimeKeys (-stk) | bool | Re-maps destination animCurves keyframe times to start/end of source animCurve. | true |\n| -addKeys (-ak) | bool | UNSUPPORTED - Allow adding keyframes to reduce the error. | false |\n| -newCurve (-nw) | bool | If true, the destination animCurve is copied and renamed, otherwise the destination animCurve is modified in-place. | false |\n\n## Building and Install\n\n### Dependencies\n\n- C++ compiler with support for C++11\n- CMake 2.6+\n- levmar 2.6+ (http://users.ics.forth.gr/~lourakis/levmar/)\n- Autodesk Maya 2016+\n\n### Build and Install\n  \nRun the following in a Bash-like shell:\n\n#### Build Levmar\n\nBuilding Levmar is quite simple. Levmar does not have an 'make install', and it will only compile a static library, which we will link against in the next step.\n\n```commandline\n$ tar -xf levmar-2.6.tgz\n$ cd levmar-2.6\n$ mkdir build\n$ cd build\n$ cmake -DNEED_F2C=0 -DHAVE_LAPACK=0 -DBUILD_DEMO=0 ..\n-- The C compiler identification is GNU 4.4.7\n-- The CXX compiler identification is GNU 4.4.7\n-- Check for working C compiler: /usr/bin/cc\n-- Check for working C compiler: /usr/bin/cc -- works\n-- Detecting C compiler ABI info\n-- Detecting C compiler ABI info - done\n-- Check for working CXX compiler: /usr/bin/c++\n-- Check for working CXX compiler: /usr/bin/c++ -- works\n-- Detecting CXX compiler ABI info\n-- Detecting CXX compiler ABI info - done\n-- Configuring done\n-- Generating done\n-- Build files have been written to: /path/to/example/directory/levmar-2.6/build\n$ make\nScanning dependencies of target levmar\n[ 14%] Building C object CMakeFiles/levmar.dir/lm.c.o\n[ 28%] Building C object CMakeFiles/levmar.dir/Axb.c.o\n[ 42%] Building C object CMakeFiles/levmar.dir/misc.c.o\nIn file included from /home/davidc/bin/levmar/test/levmar-2.6/misc.c:47:\n/path/to/example/directory/levmar-2.6/misc_core.c:577:2: warning: #warning LAPACK not available, LU will be used for matrix inversion when computing the covariance; this might be unstable at times\nIn file included from /path/to/example/directory/levmar-2.6/misc.c:64:\n/path/to/example/directory/levmar-2.6/misc_core.c:577:2: warning: #warning LAPACK not available, LU will be used for matrix inversion when computing the covariance; this might be unstable at times\n[ 57%] Building C object CMakeFiles/levmar.dir/lmlec.c.o\n/path/to/example/directory/levmar-2.6/lmlec.c:39:2: warning: #warning Linearly constrained optimization requires LAPACK and was not compiled!\n[ 71%] Building C object CMakeFiles/levmar.dir/lmbc.c.o\n[ 85%] Building C object CMakeFiles/levmar.dir/lmblec.c.o\n/path/to/example/directory/levmar-2.6/lmblec.c:39:2: warning: #warning Combined box and linearly constrained optimization requires LAPACK and was not compiled!\n[100%] Building C object CMakeFiles/levmar.dir/lmbleic.c.o\n/path/to/example/directory/levmar-2.6/lmbleic.c:40:2: warning: #warning Linear inequalities constrained optimization requires LAPACK and was not compiled!\nLinking C static library liblevmar.a\n[100%] Built target levmar\n$ ls -l -h liblevmar.a\n-rw-rw-r--. 1 user user 97K Aug 22 13:19 liblevmar.a\n```\n\nNote we do not use the LAPACK library, we do not need it. If you would like to compile with LAPACK, you'll need to change your cmake flags accordingly.\n\n#### Build animCurveMatch\n\nTo compile the Maya plugin, run the commands.\n\n```commandline\n$ cd \u003cproject root\u003e\n$ mkdir build\n$ cd build\n$ cmake \\\n  -DMAYA_INCLUDE_PATH=/path/to/maya/include \\\n  -DMAYA_LIB_PATH=/path/to/maya/lib \\\n  -DLEVMAR_LIB_PATH=/path/to/levmar/lib\n  -DLEVMAR_INCLUDE_PATH=/path/to/levmar/include ..\n$ make -j 4\n```\n\n#### Install animCurveMatch\n\nNow lets install into our home directory maya 'plug-ins' directory.\n\n```commandline\n$ mkdir ~/maya/\u003cmaya version\u003e/plug-ins\n$ cp animCurveMatch.so ~/maya/\u003cmaya version\u003e/plug-ins\n```\n\n## Limitations and Known Bugs \n\n- Adjusting Tangent Weights does not currently work.\n- Adding or removing keyframes is not supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-cattermole%2Fanimcurvematch-maya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavid-cattermole%2Fanimcurvematch-maya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-cattermole%2Fanimcurvematch-maya/lists"}