Results 1 to 7 of 7

Thread: terminate master script on requester close

  1. #1
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781

    terminate master script on requester close

    how do I do this with lscript?

    I have a simple IKFK Switcher script that needs to listen to Layout to update controller visibility during Scrubbing, so it is a master script.

    It has a little requester that is basically just one button that lets you swap between FK and IK. The whole thing works like a charm, but with lots of controls it can make scrubbing slightly less responsive.

    So, I would like to be able to kill the script completely when I close the requester, instead of having to go in and turn it off in the list of master plugins.

    How do I suicide a Master script?

    Also, as a related note how do people go about adding a master script as a master plugin using a button in the menu? they don't appear in the Command list like generic plugins.
    Last edited by hypersuperduper; 03-15-2020 at 09:58 AM.

  2. #2
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,584
    I would have thought that doing this as a generic would be the simpler route, but as I obviously don't have all the information available...

    Try here... There is a remove server lscript command that should do the trick... http://www.mikegreen.name/Lscript/So...ata.htm#server
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  3. #3
    LightWave Engineer Jarno's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    622
    Trying to remove yourself is very likely to cause bad things to happen. It is not safe to remove a plugin or script from a scene while it is executing.

    ---JvdL---

  4. #4
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781
    those server functions seem to be a good start, thanks!

    i appear to be able to open or close a defined master plugin requester with a generic script, and add or remove it.

    that's a start good place to start. can a requester be setup to have no close button? or can clicking the close button be an event?

    what I want to avoid is the situation where the plugin is running but you can't see the requester.

    ideally, if you see the requester the master plugin is applied but if you don't its not. 3rd powers Weight Paint works this way for example, but I imagine it is a C plugin. can I do this with lscript?

    also, I want this master script to be as lightweight as possible. currently the process() function is probably about as simple as it can be. it just checks a channel array and sets visibility based on the results. I do the heavy lifting of setting up the arrays in another function which is only called when the plugin starts and when i press the switch ikfk button. what I would like to do the array setups in a separate generic script and use the storeGlobal() and recallGlobal() functions to read them in the master script, but this doesn't appear to work. is it supposed to work?
    Last edited by hypersuperduper; 03-17-2020 at 03:47 AM.

  5. #5
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781
    thanks guys, with your help I figured out how to do it. I use a generic script to add and remove the master script, and in the process() function of the master script I check to see if the requester is open, and if it isn't I run the options() function again to relaunch the requester. so now, if you close the requester it just comes right back as soon as you do anything. pretty foolproof.

  6. #6
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781
    Quote Originally Posted by Kryslin View Post
    I would have thought that doing this as a generic would be the simpler route, but as I obviously don't have all the information available...

    Try here... There is a remove server lscript command that should do the trick... http://www.mikegreen.name/Lscript/So...ata.htm#server
    the purpose of this script is twofold: 1. to enable one button ikfk pose matching on a properly setup rig, not just blending, and 2. to reduce controller clutter in the viewport.

    I had a version that was generic, and it worked great for the first purpose, and it could set the visibility, but i quickly realized the visibility feature was pretty useless unless it could update the visibility when you moved to a different frame where the ikfk state may be different.

    a master plugin allows you to track layout changes in real time so the visibility can track the ikfk state.

    I am quite happy with this solution. as I have it now, when you click the button on the requester whatever IK or FK chain you have selected immediately switches mode and the pose remains the same and if you switch from IK mode tries to select an appropriate FK controller for you. you literally only have the controllers in front of you that actually do something.

    one of the hurdles with lightwave is that you can't animate visibility. you can animate the dissolve, but that doesn't affect selectability so you wind up having a bunch of invisible controllers that you can accidentally select, which is arguably worse than having clutter.
    Last edited by hypersuperduper; 03-17-2020 at 06:58 AM.

  7. #7
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781
    Quote Originally Posted by Jarno View Post
    Trying to remove yourself is very likely to cause bad things to happen. It is not safe to remove a plugin or script from a scene while it is executing.

    ---JvdL---
    Good to know. there are enough bad things happening in the world without me adding more.

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
  •