1. #1

    Default Dynamesh value

    Hi,

    How do i get the current dynamesh value for the currently selected subtool?
    I'm not sure how you go about extracting values that appear in the UI elements.

    Cheers

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,040

    Default

    Not sure what you mean by the Dynamesh value? Do you mean the resolution?

  3. #3

    Default

    Yup, the resolution value that gets applied. It may also be prudent at this point to ask how to work out if a UI (dynamesh) button has been applied or not. Similar sort of thing, once you know, I'd imagine.

    Thanks for moving the post from the wrong place.

  4. #4
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,040

    Default

    You can find what the Resolution slider is set to by using:

    [IGet,Tool:Geometry:Resolution]

    So, to set a variable to that amount you could write:

    [VarSet,dynaRes,[IGet,Tool:Geometry:Resolution]]

    You can also find out if the DynaMesh button is active or not by using:

    [IGet,Tool:Geometry:Dynamesh]

    which will return 1 if it is on, and 0 if it is off.

    That's really the only way you can tell if DynaMesh has been used, so if the user has turned the button off again then you can't know.

  5. #5

    Default

    Thanks Marcus,

    The code now picks up the dynamesh resolution, but I can seem to increment it on the button press. A the dynamesh resolution doesn't actually change value so the script is pretty useless. ;) And B the value only increases once, which wasn't what I was after. Any chance you could look and spot the deliberate mistake?


    // Dynamesh button
    [IButton, "Dynamesh resolution", "Dynamesh button",


    [VarSet, inc, 100]


    // get dynamesh resolution
    [VarDef,dynaStr,"-"]


    // get dynamesh resolution
    [VarSet,dynaRes,[IGet,Tool:Geometry:Resolution]]


    // is it switched on?
    [VarSet,dynaBool,[IGet,Tool:Geometry: Dynamesh]]


    [If, dynaBool == 1
    , // then..
    [VarSet, dynaStr, "on"]


    // increase by ammount
    [VarSet, dynaRes, dynaRes+=inc]

    [ISet,Tool:Geometry:Dynamesh, dynaRes]

    , // else..
    [VarSet, dynaStr, "off"]
    ]

    // set a string
    [VarDef, msg, [StrMerge, "Dynamesh resolution: ", dynaRes, "\nPoly count: " , polyCount, "\nDynamesh is switched ", dynaStr]]


    // Set a note; for a second
    [Note, msg, 2]

    ] // end button
    // eos



  6. #6
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,040

    Default

    You need to watch your use of VarDef because it's for declaring the variable and won't update (such as the msg variable). If you use number variables in StrMerge then wrap them in [Val]. And you were trying to set the DynaMesh button with your incremented resolution!


    // Dynamesh button
    [IButton, "Dynamesh resolution", "Dynamesh button",


    [VarSet, inc, 100]


    // get dynamesh resolution
    [VarDef,dynaStr,"-"]


    // get dynamesh resolution
    [VarSet,dynaRes,[IGet,Tool:Geometry:Resolution]]


    // is it switched on?
    [VarSet,dynaBool,[IGet,Tool:Geometry: Dynamesh]]


    [If, (dynaBool == 1),
    // then..
    [VarSet, dynaStr, "on"]


    // increase by ammount
    //[VarSet, dynaRes, dynaRes+=inc]
    [VarAdd,dynaRes,inc]

    [ISet,Tool:Geometry:Resolution, dynaRes]

    , // else..
    [VarSet, dynaStr, "off"]
    ]

    [VarSet,polyCount,0]
    [Mesh3DGet,1,,,polyCount]


    // set a string
    [VarSet, msg, [StrMerge, "Dynamesh resolution: ", [Val,dynaRes], "\nPoly count: " , [Val,polyCount], "\nDynamesh is switched ", dynaStr]]


    // Set a note; for a second
    [Note, msg, 2]

    ] // end button
    // eos

Tags for this Thread

Posting Permissions

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