Instances of utils patches

Can I get all instances of operations in main vl document, which I used for nodes in vvvv?
I want to know it’s possible to create vl-nodes in vvvv to collect or change values from all of them?

And I’m sorry for possible improper use a terms, I’m just learning.

hm…i’m afraid i don’t understand what you want to do. please try to rephrase your question.

btw: you don’t have to start your topic with [VL] as we have the vl tag for that

I think I realized that I want to do. I want to create the node and then attach them value in vvvv, the values passed through. These nodes will collect and process values in vl-document. It is something like the S / R, only in a modern way with the ability to enable and disable the change. When creating a node in vvvv, an object is created and stored within the array in the main document. I did not realize that I could use for this class.

In other words, can I do so that when an object (vvvv node from vl document) is created, it is immediately added to the array (property of another object, spread or collection)? Can I create some kind of manager of added nodes from vl-document?

hi yar!

there is nothing like a static class in VL. It sounds like you know that concept from C# and want to try it in VL. please tell me if i am right here.
So what this would give you is just one static instance of your class “manager” without the need of creating a node “manager”… As i said: this is not possible.

However you could try to hack that into VL by creating a node set with C# that internally works with a static class…

using System;
using VL.Core;

namespace VL.Lib.Experimental
{
    [Type]
    public static class StaticNodes<T>
    {
        [Node]
        public static T StaticField { get; set; }
    }
}

with this hack you can do primitive send & receive of whatever data you want. So you could send a float or you could also send and receive an instance of your datatype that you patched with VL, which could be a manager of s/r channels …

@yar here is a quick guide on how to get the Type and Node attributes:

@joreg, @gregsn it’s very interesting, but I don’t understand is it answer or not?)

Is it possible to process these nodes in one place? Is it possible to get all the values of these nodes inside the other (in VL)? Can I change values of this nodes from another? Where these nodes are stored? In vvvv i see only instances of these nodes, right? Can I get access to their list? I know, maybe it’s some kind of “noob question”, but i think it’s important to understand.

hey yar!

I just put an example into the latest alpha.
It’s located in girlpower\VL\_Experimental\Singleton.

It shows how you can use the Experimental vl node “Singleton (OfPatch)”.
This node is rather magic: it’s generic, but as soon as you connect to it, it tries to create one instance of the connected data type for you, so that you just can work on it wherever you want. So no need to explicitly create it. It’s done for you before you can access it.

Note that this node is only available after setting a dependency to package VL.CoreLib.Experimental. It currently is implemented as an operation that you also can call in stateless contexts, like delegates or operation definitions. This might change in the future. Also note that patching within the connected type results in a complete reinitialization of that globally available single instance of the data type (e.g. MyManager). So in order to rescue state of that instance in these rare cases we might implement it as process node later on. Also note that order of evaluation is not defined, as all your singleton accessing nodes are not connected to each other. Also note that the used patch in the example is a class in order to be able to mutate, we don’t write back new snapshots of the singleton. But you could also try a Record and write back the new snapshot with “SetSingleton (OfPatch)”…

Just play with it for a while and tell me what you think.

1 Like

Yeah! It’s works, amazing! Thanks a lot.
I have yet to play with it, but it looks very cool.

I played with it a little bit and I can output the content of dictionary in the spread. But it’s possible to delete values from dictionary if instances of operation was deleted? Or reload the dictionary every time I add new node-operation?
Singleton.zip (7.7 KB)

no. i guess not. but you could try a different approach where your manager doesn’t work with a dictionary at all. it could have fields for your channels directly. With that approach you could have statically typed channels and also nodes that are named by channel. It wouldn’t be dynamic and more work to establish a new channel, but using the channel would feel better in the end, since it is just typed the way you need it. (e.g. one channel is string, next is color (RGBA))…

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.