Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20

Thread: VParm weirdness

  1. #16
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,300
    Jarno,


    I'll try with the dirty flag. I suppose I need to capture that change event with a LWEVNT_NOTIFY_PLUGIN_CHANGED in my master plugin?
    What you're describing as a problem is exactly how bullet is implemeted in LW. I just did a small simulation with some falling blocks. Open the envelope for density and on every click there is a resimulation happening.
    On top of that bullet is a lot of times slower.

    creacon

  2. #17
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,300
    The event I mentioned is probably for something else because it doesn't fire, could I make a commring and have the master call itself?

    creacon

  3. #18
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,300
    More testing:
    This event never fires: LWVPEC_ENVTRACK, and I am beginning to think that the LWVPEC_ENVUPDATE is fired instead.

    creacon

  4. #19
    LightWave Engineer Jarno's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    616
    The Bullet Dynamics is not re-evaluated from within the change callbacks. It sets a dirty flag and notifies Layout that the scene has been altered through LWInstUpdate. That primes Layout to re-evaluate the scene when it considers appropriate, typically when it is done processing whatever needed processing.

    That then triggers the evaluation functions of the motion or deformation plugins applying the simulation to the scene items. In the evaluation functions check for the dirty flag and call whatever internal function does the recalculation of the simulation. It is not actually the master plugin that does the recalculation.

    Master plugins, like other plugins, should be considered clients of Layout. Don't try to call a master plugin from another plugin directly. Calling a plugin at the wrong time (which is a lot of times) can cause all sorts of bad things to happen randomly.
    If something in the scene needs to be re-evaluated, tell Layout about it (through e.g. LWInstUpdate, or the Refresh command), and Layout will trigger the re-evaluation when it is safe to do so.

    ---JvdL---

  5. #20
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,300
    I am not calling a master plugin from within another plugin, everything happens in the master. The user changes a parameter, the simulation scene updates everything and fills in the cache.
    The other plugins are just dumb slaves that wait for a Layout refresh at the appropriate time and they "read" their new position when it's safe.

    When I change a non-enveloped parameter (e.g. tell a particle system if it needs to display its speed, density or just a base color), this happens:
    In the master:
    - Set the ColorNeedsUpdate flag
    - Update my simulation scene/cache
    - Issue a RedawNow command(after reading your answer it would be safer if I replaced it with a Refresh command)

    In the slaves (custom object plugin, motion plugin, displacement plugin, ....):
    - All "slave" plugins read their updated positions etc when layout tells them to.

    You say that Bullet sets a dirty flag and notifies layout.
    I can set a dirty flag but I need to notify my master plugin that it needs to update its simulation scene and then issue a refresh or redraw command for layout.

    If I get back to envelope editing in bullet:
    - I open the density envelope (or any other envelope for that matter) for an object.
    - I move a keyframe in the envelope, so there are probably hundreds of LWVPEC_ENVUPDATE events triggered.
    - Bullet immediately starts updating and you can't even move the keyframe around because it's constantly updating. Stopping at values the user doesn't even want because it interrupts the keyframe moving/dragging.

    So you have the exact same problem.

    What needs to happen is this:
    - User selects a keyframe
    - User starts moving the keyframe and the LWVPEC_ENVTRACK is triggered while moving, but you ignore that event.
    - User releases mouse (done editing), LWVPEC_ENVUPDATE is triggered , dirty flag is set, Refresh is called etc....

    There will still be a lot of recalculations going on but the user will understand that the simulation needs to be recalculated when he releases the mouse to set the key to its new position.
    What happens now in bullet are intrusive updates, interrupting the users workflow. This could all work if you only have 5 dynamic objects in your scene but I am testing with 216,000 and 1 million. Bullet starts getting unusable at 1,000 objects.

    I hope you're not taking this as criticism, but what bothers me is that there is an easy solution for this problem but I can't fix it because I don't have access to the source code.
    You already have everything in place to trigger events on VPARMs.
    You're already detecting the mouse up event in the envelope window, otherwise you'd never now when the user has finished.
    Fixing the current LWVPEC_ENVTRACK and the LWVPEC_ENVUPDATE to have them do what the docs say would probably break existing plugins but adding a new kind of event and deprecating the others for the next release wouldn't break anything.

    creacon




    Quote Originally Posted by Jarno View Post
    The Bullet Dynamics is not re-evaluated from within the change callbacks. It sets a dirty flag and notifies Layout that the scene has been altered through LWInstUpdate. That primes Layout to re-evaluate the scene when it considers appropriate, typically when it is done processing whatever needed processing.

    That then triggers the evaluation functions of the motion or deformation plugins applying the simulation to the scene items. In the evaluation functions check for the dirty flag and call whatever internal function does the recalculation of the simulation. It is not actually the master plugin that does the recalculation.

    Master plugins, like other plugins, should be considered clients of Layout. Don't try to call a master plugin from another plugin directly. Calling a plugin at the wrong time (which is a lot of times) can cause all sorts of bad things to happen randomly.
    If something in the scene needs to be re-evaluated, tell Layout about it (through e.g. LWInstUpdate, or the Refresh command), and Layout will trigger the re-evaluation when it is safe to do so.

    ---JvdL---

Page 2 of 2 FirstFirst 12

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
  •