1. #1
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default -SOLVED- Question: IModGet Erroring out

    Hi,

    got a weird little problem with the routine below.
    I am saving out the individual state of each Layer in the Layerlist into the global Array "gLayerVisibilityStatus()". It works just as you would expect it to -- as long as the Layers are called the default name "Untitled Layer". As soon as I have a custom named Layer it errors out, telling me that something is wrong with the [IModGet,tmpCurrentLayerState].
    I checked the Layerpath result that gets written into the Variable - looks fine to me. Any ideas ?




    [CODE]//-------------------------- Save current state of all Layers so it can be reset later into LayerVisbilityStatus Variable -----




    [RoutineDef,SaveLayerState,




    [VarSet,tmpCurrentScrollbarPosition,[IGetSecondary,Tool:Layers:Layers Scrollbar]]
    [VarSet,tmpScrollbarPosition,-1]
    [VarSet,tmpArrayCount,0]


    [ISet,Tool:Layers:Layers Scrollbar,0,0]




    // Loop1 going through Scrollbar


    [Loop,gnumberOfLayers,

    [VarSet,tmpScrollbarPosition, tmpScrollbarPosition+1]


    [If,
    (tmpScrollbarPosition==gnumberOfLayers), [LoopExit]


    ]


    //set scrollbar so that current Layer is at the top


    [ISet,Tool:Layers:Layers Scrollbar,0,tmpScrollbarPosition]


    // Storing Layer States:


    [ISet,Tool:Layers:Layers Scrollbar,0,tmpScrollbarPosition]


    [VarSet,tmpCurrentLayerState,[StrMerge,"Tool:Layers:",[IGetTitle,"Tool:Layers:Layer Intensity"]]]
    [VarSet,gLayerVisibilityStatus(tmpArrayCount),[IModGet,tmpCurrentLayerState]]
    [VarInc,tmpArrayCount]


    ] //End Loop




    [ISet,Tool:Layers:Layers Scrollbar,0,tmpCurrentScrollbarPosition]


    ] // end routine Turn Layers Off






    [/CODE]
    Last edited by campi; 09-16-12 at 04:25 AM.
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


  2. #2
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,526

    Default

    So how did you solve it? I'm sure it would be useful for others to know... (I have a solution but perhaps yours is different!)

  3. #3
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default

    Oh, turns out the routine is fine (although your phrasing is ominous ...) but I was running the IModGet in a different Routine as well in a conditional

    [If,([IModGet,tmplayerOnOffState]==2) ,
    [IClick,tmplayerPath,tmpwid-10,5]
    ]


    The above works -- I just had wrong brackets before
    [If,([IModGet,tmplayerOnOffState])==2

    I am assuming it didn't error out on the Untitled Layers before because there were multiple ones, all named the same but as soon as there was a unique one it messed up. Zbrush Layersystem - I swear it'll be the end of me.
    Last edited by campi; 09-17-12 at 02:03 AM.
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


  4. #4
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,526

    Default

    Well, you don't actually use a conditional in the code you posted at the start of the thread. That code will not run properly as it is, mainly because the title of the Layer Intensity slider doesn't change unless you actually select the layer - simply changing the scrollbar position is not enough. Then you have to make sure that the layer you want is
    (a) not hidden in the list
    (b) positioned at the top of the list

    If you do that the layer path got using [IGetTitle] on the Layer Intensity slider will be correct and you can use [IClick] on the layer, even if there are other layers with the same name. And [IModGet] won't get shirty.

    Yes, I have less hair as a result of scripting 3D layers.

  5. #5
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default

    Ooo. ok. But how do I select the layer without already knowing its layerpath ?
    Selecting via IClick is out I guess, because Iclick already needs the interface path to the layer -- which I would need to get after I selected the layer. Argh. My mind is in a loop
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


  6. #6
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,526

    Default

    There's no elegant way, as far as I know. You have to loop through the layers using 'Select Down' or 'Select Up', and store the layer paths etc. I've attached my solution.

    LayerStates.txt

  7. #7
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default

    I forgot about the Select up/down buttons. Definitely much easier.Thanks so much !
    Identifying and restoring the Rec State of a Layer is still tricky, since SelectUp/Down dows not work.
    Last edited by campi; 09-22-12 at 06:58 AM.
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


Posting Permissions

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