Results 1 to 3 of 3

Thread: [Mel] Waiting for part of script to finish?

  1. #1
    integer
    Join Date
    Mar 2012
    Location
    Boston
    Posts
    41

    Default [Mel] Waiting for part of script to finish?



    Hello.

    Im writing a script that will automatically do all of the following at once
    • create a spotlight,
    • create the RSL shadow attributes needed like deep shadows
    • put a variable in the shadowMap name so i can manage this in another place
    • attach a rsl uberLight shader to it and a custom viewport visualizer
    • move it to 0 10 0
    • look through it


    I am very close to doing this - however! I have to execute the code in two stages to get the RSL attributes to attach to the lightAttributes of the spotlight.


    I want to do it in one command. Probably an if statement?


    I'm using a proc
    Code:
    AE_reselectTabIndex
    that was included with 3delight which make me able to select the fourth tab in the AE and then i can get the name of it with the maya proc $gAECurrentTab and then filter it with startString.

    However, when I run this all at once it doesnt work and when I try to print the result of $currrentNode i just get $currentNode unless like I said I execute the the second part after the first I am probably going to have a lot of lights so I need it to be dynamic and depend on this variable. I figure that if I have more than 9 lights i can run an alternate version of the script that does

    Code:
    $currentNode = startString($gAECurrentTab, 21);
    instead of 20.

    I've done a lot of research, been working on it for 2 days now. Ive tried return arguments, eval deferred, timerX, splitting it up into (global) procs etc but they arent working.

    Any help is appreciated. Im sure this is a common question.


    Code:
    defaultSpotLight(1.5, 1,1,1, 0, 40, 0, 0, 0, 0,0,0, 1, 0) ;
    DL_shaderAssignmentPanelCreateNewAttribsNode delightLightAttribs object;
    dR_movePress;
    move -r -os -wd 0 10 0 ;
    AE_reselectTabIndex(4);
    ////////////////////////////////////
    //////////
    $currentNode = startString($gAECurrentTab, 20); 
    //////////
    
    DLA_generateShadowMapsCreateAttr ($currentNode);
    DLA_shadowMapNameCreateAttr($currentNode);
    DLA_shadowMapResolutionCreateAttr($currentNode);
    DLA_shadowMapShadingRateCreateAttr($currentNode);
    DLA_shadowDepthFilterCreateAttr($currentNode);
    DLA_shadowMapTypeCreateAttr($currentNode);
    DLA_shadowMapPixelSamplesCreateAttr($currentNode);
    DLA_nearClipPlaneCreateAttr($currentNode);
    DLA_farClipPlaneCreateAttr($currentNode);
    DLA_emitPhotonsCreateAttr($currentNode);
    DLA_generateWithMotionBlurCreateAttr($currentNode);
    DLA_generateCubeShadowMapCreateAttr($currentNode);
    DLA_volumeInterpretationCreateAttr($currentNode);
    DLA_transformationBlurCreateAttr($currentNode);
    setAttr ($currentNode +".generateShadowMaps") 1;
    setAttr ($currentNode +".shadowMapType") 6;
    //lookThru `ls -sl`;
    Last edited by bergj; 04-15-2012 at 05:56 PM.

  2. #2
    person.py Temujin's Avatar
    Join Date
    Apr 2009
    Location
    Santa Monica, CA
    Posts
    83

    Default

    Maybe try tossing in a refresh command? Seems like that AE reselect tab function does something in the UI which won't update until the script has finished.

  3. #3
    method btribble's Avatar
    Join Date
    Feb 2009
    Location
    SF Bay Area, US
    Posts
    250

    Default

    I can't remember the solution to this. I think it may be that you need to put the latter part of your script in an evalDeferred or a ScriptJob "onIdle". So that the Attribute Editor has a chance to do it's update stuff. Also, the attribute editor needs to actually be open for this stuff to work. I assume that is a given.

Bookmarks

Posting Permissions

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