• Welcome to World Machine Community. Please login or sign up.
 
September 19, 2019, 09:07:47 pm

News:

Read the Development Diary for an inside look at World Machine's progress!


Param device questions

Started by skylerd, March 22, 2013, 11:44:47 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

skylerd

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

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

March 28, 2013, 01:25:27 pm #22 Last Edit: March 28, 2013, 02:05:10 pm by skylerd
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.

Stephen

March 28, 2013, 01:55:56 pm #23 Last Edit: March 28, 2013, 01:59:06 pm by Remnant
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().
-- Stephen Schmitt
- Creator of World Machine

skylerd

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.

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S save/post or ALT+P preview