Author Topic: Param device questions  (Read 6366 times)

0 Members and 1 Guest are viewing this topic.

skylerd

  • World Machine Veteran
  • ***
  • Posts: 23
    • View Profile
Re: Param device questions
« Reply #20 on: March 28, 2013, 07:01:12 AM »
Is there a way to know, other than checking for an immediate activate call, whether or not an instance of my device is actually being instantiated in the world or is the preview for placing instances in the world?

skylerd

  • World Machine Veteran
  • ***
  • Posts: 23
    • View Profile
Re: Param device questions
« Reply #21 on: March 28, 2013, 10:59:07 AM »
I'm looking to store the values out now in my activate function. Where should I be getting a ParamPacket from? Do I need to grab it from the targetted device? Do I create a new one?

skylerd

  • World Machine Veteran
  • ***
  • Posts: 23
    • View Profile
Re: Param device questions
« Reply #22 on: March 28, 2013, 01:25:27 PM »
And another question - calling falsify toggles all the icons beside the items to red, but doesn't actually trigger a build of those items. Any further suggestions for triggering the update of them?

EDIT: I'm ignoring thread safety for now (I know, it's bad), and mainly looking for anything that will cause a re-trigger of the graph preview without any user input. PreviewWorld also doesn't seem to update the display properly; I have to manually enable/disable the device to get the changes propagated through the graph.
« Last Edit: March 28, 2013, 02:05:10 PM by skylerd »

Remnant

  • Author
  • World Machine Guru
  • *****
  • Posts: 2311
    • View Profile
    • http://www.world-machine.com/
Re: Param device questions
« Reply #23 on: March 28, 2013, 01:55:56 PM »
2.3 Final is imminent -- planning on releasing it later today -- so there is no possibility of getting a callback handler implemented in that. Looking further along, there are a few things that I want to do that will require an asynchronous mechanism -- so this is something that will be on the table soon.

How to tell if your device is actually in the world: Check your GetWorld() member function return; if its null, the device has not actually been placed into the world. Note that all devices are first created then placed into a world.

To send a parameter packet you'll have to create one:

Both ScalarPacket and ParamPacket are defined in ParamPacket.h.

To create one call:

ParamPointer val = PARAM(WMGetPacket(WMP_parameter));

And store it just like any other packet in your output function.


Finally, regarding falsify/preview:

Typically, the WM graph changes only from either world events or device UI changes. When a device UI is showing, WM will generate single-device previews as you change parameters -- this is done by calling Device::Preview(). If your changes are accepted, the framework then falsifies the network from that device, then rebuilds the whole world.

To replicate this at other times, do the same: 1) Call Falsify() to mark this and all following devices as needing a rebuild, then 2) call WorldMachine::core->app->PreviewWorld(world) where world is the world returned from your device's GetWorld().
« Last Edit: March 28, 2013, 01:59:06 PM by Remnant »
-- Stephen Schmitt
- Creator of World Machine

skylerd

  • World Machine Veteran
  • ***
  • Posts: 23
    • View Profile
Re: Param device questions
« Reply #24 on: March 28, 2013, 02:09:44 PM »
Thank you so much Stephen! Hopefully I haven't annoyed you too much with all these questions. The Falsify + PreviewWorld works a dream (for now, I'm ignoring thread safety and will be telling my users that they can only update values in WM when they're not doing something in its UI/building). My project is working great, so I'm very thankful for all your help.