Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Posts
    103

    Custom Graph Editor help

    I am prototyping out a window for animation, basicly I don’t think cant get the layout I want by using the panel editor. However I cant seem to find out how to add the menu bar and tool bar to the animCurveEditor so it looks like the default graph editor.

    Also is it possible to have a second time slider & range slider? I cant seem to find anything on this either.

    On a side note “f” doesn’t frame up on the selected keys. I suspect is has something to do with the menu/tool bar. Either that or the animCurveEditor is not in focus.

    Code:
    import maya.cmds as cmds
    
    cmds.window()
    main=cmds.paneLayout(configuration='vertical2')
    
    outliners=cmds.paneLayout(configuration='horizontal2', parent=main)
    
    outliner = cmds.outlinerPanel(outlinerEditor=True)
    cmds.outlinerEditor(outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter', parent=outliners)
    
    cmds.outlinerEditor(mainListConnection='modelList', selectionConnection='modelList', showShapes=False, showAttributes=True, showConnected=True, showAnimCurvesOnly=True, autoExpand=True, showDagOnly=False, ignoreDagHierarchy=True, expandConnections=False, showCompounds=False, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter', parent=outliners)
    
    mid=cmds.paneLayout(configuration='top3', parent=main)
    cmds.modelPanel(parent=mid, camera='persp', mbv=True)
    cmds.modelPanel(parent=mid, camera='front', mbv=True)
    
    cmds.animCurveEditor(mlc='modelList', displayKeys='on', parent=mid)
    
    cmds.showWindow()

  2. #2
    Join Date
    Feb 2005
    Location
    /..
    Posts
    2,595
    I think you might be better off using a scriptedPanel for your Graph Editor. The animCurveEditor is an internal component of a graph editor and is just for editing keys. The way f to frame works is that it queries the active panel and animCurveEditor doesn't count as a panel.

    This (messy) MEL script is what I use sometimes to see keys for an object and it's shader at the same time (...for animating ramp to line up with geometry movement etc). See I've called scriptedPanel -type "graphEditor"; which should give you a whole graph editor complete with little outliner and framing.
    Code:
    //Window already exists test
     if ( `window -exists keyerUI` ) {
        deleteUI keyerUI; // delete window when it exists
    }
    window -t "Keyframe UI" keyerUI;
     
    //build simple layout
    
    paneLayout -configuration "horizontal4" -ps 1 1 1 myKeys;
    
         text "Top graph object, lower for shader";
         scriptedPanel -type "graphEditor";
         scriptedPanel -type "graphEditor";
         button -label "Split select" -c splitSelect; 
    showWindow keyerUI;
    
    proc splitSelect()
    {
    //get first graphEditor panel name
    $firstGraph = `paneLayout -q -p2 myKeys`;
    //turn off updating
    toggleAutoLoad ($firstGraph + "OutlineEd") 0;
    //get selection
    string $listingObj[] = `ls -sl`;
    //work down to connected material
    string $myShapeNode[] = `listRelatives -children -shapes $listingObj[0]`;
    string $mySGs[] = `listConnections -type shadingEngine $myShapeNode[0]`;
    string $surfaceShader[] = `listConnections ($mySGs[0] + ".surfaceShader")`;
    
    select -r $surfaceShader[0];
    }
    Not sure if you can have two time sliders(?), although most of the time I just hold k and mouse drag in a viewport to control time.
    From the help:
    timeControl is undoable, queryable, and editable.
    This command creates a control that can be used for changing current time, displaying/editing keys, and displaying/scrubbing sound.
    Note: only one timeControl may be created. The one Maya creates on startup can be accessed from the global string variable $gPlayBackSlider. Also, it is not a good idea to delete it.
    Hope that helps you along a little
    Last edited by faux; 05-15-2015 at 03:27 AM.
    There is an exception to every rule, apart from this one.

  3. #3
    Join Date
    Apr 2011
    Posts
    103
    Ah I see, well all that makes sense I guess with the animCurveEditor….

    The scriptedPanel worked exactly like I was expecting the animCurveEditor to work, thanks for pointing it out.

    As for the time slider, yeah I read that too.

    The only question I have now is can you name the new graphEditor (and components) so if I wanted to call or edit them from script? Currently it just creates something like graphEdiorWindow2 or some other random number. Very inconsistent.

  4. #4
    Join Date
    Feb 2005
    Location
    /..
    Posts
    2,595
    I'll have to look into that (no maya here at the moment).If you can't directly name it maybe you could capture the name it gets given?
    There is an exception to every rule, apart from this one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •