unity3d
's mecanim
animations system has custom editorwindow
allows define tree (a blend tree in case) thorough gui.
it looks like:
it offers possibility of creating nodes (states) , connect them (transitions).
now, i'm developing graph , and tree structure , write editor extension in order allow game designer populate structures.
i want pretty recreate editorwindow
1 of mecanim animator (figure above).
my question is: there available components can use such task? there builtin class used drawing , connecting boxes , arrow? or need write gui elements own?
i not asking "for find tool, library or favorite off-site resource". know how reproduce mecanim
graph editor using unity3d
api or available components provided engine (sorry if question wasn't clear).
here's answer:
no, there's isn't available component usable draw kind of graph, it's quite easy write own. here's snippet simple example using draggable gui.window represent nodes , handles.drawbezier draw edges:
public class grapheditorwindow : editorwindow { rect windowrect = new rect (100 + 100, 100, 100, 100); rect windowrect2 = new rect (100, 100, 100, 100); [menuitem ("window/graph editor window")] static void init () { editorwindow.getwindow (typeof (grapheditorwindow)); } private void ongui() { handles.begingui(); handles.drawbezier(windowrect.center, windowrect2.center, new vector2(windowrect.xmax + 50f,windowrect.center.y), new vector2(windowrect2.xmin - 50f,windowrect2.center.y),color.red,null,5f); handles.endgui(); beginwindows(); windowrect = gui.window (0, windowrect, windowfunction, "box1"); windowrect2 = gui.window (1, windowrect2, windowfunction, "box2"); endwindows(); } void windowfunction (int windowid) { gui.dragwindow(); } }
Comments
Post a Comment