- Home /
is it possible to extend Mecanim?
what i would like to so far:
color state nodes color transitions by the color of state (switchable in/out maybe)
get all list of states and be able to work with them from custom inspector
is it possible to accomplish this somehow ?
(i know how to extend editor, i just don't know if there is way to extend existing built in features like mecanim, animation timeline or connect to them from outside)
Answer by whydoidoit · Nov 22, 2013 at 02:07 PM
Pretty sure you'd have to rewrite the whole thing - which I guess wouldn't actually be impossible - but quite an undertaking - to get that colouring.
You can get a list of all of the states from it using UnityEditorInternal and UnityEngineInternal then something like this:
List<Layer> layers;
class Layer
{
public string name;
public int index;
public AnimatorControllerLayer layer;
public HashSet<StateMachine> stateMachines;
public List<State> states;
public List<string> stateUniqueNames;
}
void WorkOutStates(AnimatorController controller)
{
layers = Enumerable.Range(0, controller.layerCount).Select(c => {
var layer = new Layer { layer = controller.GetLayer(c) };
layer.name = layer.layer.name;
layer.stateMachines = GetStateMachines(layer.layer.stateMachine);
layer.states = layer.stateMachines.SelectMany(m=>Enumerable.Range(0, m.stateCount).Select(i=>m.GetState(i))).ToList();
layer.stateUniqueNames = layer.states.Select(s=>s.uniqueName).ToList();
return layer;
}).ToList();
}
I finally got it, now exploring the UnityEditorInternal, thank you very much
i finally got it; it works very well and it's very helpful, i'll make asset from this tool i made!
thx very much mr. whydoidoit
Your answer
Follow this Question
Related Questions
UnityEditor.Animations.AnimatorControllerLayer.SetOverrideMotion not working 0 Answers
Getting error clipCount == internalClipCount 0 Answers
Create an Editor Window like Mecanim 1 Answer
Issue with a Mecanim motion reference in synchronized layers 0 Answers
Animation preview not working for model with generic rig and root motion. Is this a bug? 2 Answers