» code snippets
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

code snippets

Examples for declaring Pins using attributes

This is an Input Pin of type bool (ie. 0 or 1) with a hint to the GUI that it should be operated as a Bang. And it is Single which means it is not spreadeable.

[Input("Reset", IsBang = true, IsSingle = true)]
ISpread<bool> FReset;

This is an Input Pin with minimun value 0.0 and maximum value 1.0. The Order attribute specifies the position of the pin in the node 0 will be left most 1 will be second pin from the left ...

[Input("Friction", MinValue = 0.0, MaxValue = 1.0, Order = 0)]
ISpread<double> FFriction;

This is an Input pin called My Input with Variable name FInput of type int with a default value of 2. Remember that a pin can always be reset to its default using Alt+Rightclick on the pin.

[Input("My Input", DefaultValue = 2)]
IDiffSpread<int> FInput;

Using IDiffSpread instead of ISpread allows you to check if the pins data has changed using the .IsChanged property:

if (FInput.IsChanged) 
{
//do something 
}

This is a pin of type Vector2D whose x and y default values are both 0.0

[Input("Input", DefaultValues = new double[] {0.0, 0.0}]
ISpread<Vector2D> FInput;

PinGroup vs. BinSize

A PinGroup likge eg. used in Cons (Spreads) that allows you to specify the number of inputs via a configuration pin in the Inspektor can be specified like:

[Input("Input", IsPinGroup = true)]
ISpread<ISpread<double>> FInput;

If you do the same but leave out the IsPinGroup = true instead of the configuration pin that sets the pincount you'll get a BinSize pin:

[Input("Input")]
ISpread<ISpread<double>> FInput;

More info: pin attributes

Dealing with SliceCount

Examples for getting and setting SliceCount:

Get the Maximum spread count of any of the Input pins and set it to the Output pin.

FOutput.SliceCount = SpreadMax;

Get the SliceCount of a certain Pin

FInput.SliceCount

Get the maximum SliceCount of two Pins.

var count = FInput1.CombineWith(FInput);
FOutput.SliceCount = count;

Get the minimum SliceCount from two pins.

var count = Math.Min(FInput.SliceCount, FInput1.SliceCount);
FOutput.SliceCount = count;

Spreads

Playing with List&AssignFrom

List are a convinient way to play with dynamic spreads ,you can add , remove ,insert and much more...
you need to add this : using System.Collections.Generic; to your code .
There are many examples on the net you will find some nice ones in dotnetperls

// we make a new list and called it myList 
      List<int> myList = new List<int>();

We make some logic with it

// If the Pin Add is Bang the spread from the Input Pin gets in .
            if (FAdd[0])
            {
              myList.Clear();// We clear the List here to start all over otherwise we,ll add a new spread each time we bang .
 
             // Here we get the spread from Input Pin in 
             // so loop as many times as the size of the spread to get it
 
            for (int i = 0; i < FInput.SliceCount; i++)
              {
                myList.Add(FInput[i]);
              }
 
            //here we add some more logic ,If spread contains the value in the filter pin 
            //we remove all occurances in the spread of this value.
            if (myList.Contains(FFilter[0]))
              {
            myList.RemoveAll(item => item == FFilter[0]);
              }
 
            // some more we want to add a value on top of the list and at the end 
            myList.Insert(0,111);
                // To the begginig of the List
                //Note this is the whole list so if you add again another one will be place
            myList.Add(111);// to the end of the List
            }
// We clear the List if the Reset Pin is bang 
            if (FReset[0])
            {
                myList.Clear();
            }

We Assing the List to our Output Pin

// we set the SliceCount of our Output pin to be the same as size of the List .
            FOutput.SliceCount = myList.Count;
            //and Assign the data from our List to the Output Pin .
            FOutput.AssignFrom(myList);

This is the Patch&Code of it .

Note : In most occasions will be more effective to use already in ISpread(T) Extension Methods instead of creating new list like

FInput.Add(FInput[i]) or FInput.RemoveAll(item => item == FFilter[0]);

instead of creating the new List and do

myList.Add(FInput[i])
myList.RemoveAll(item => item == FFilter[0]);

anonymous user login

Shoutbox

~4d ago

cznickesz: @tonfilm thanks for the info. Can´t wait to give it a try!

~5d ago

tonfilm: @cznickesz #vvvv #vl #xenko integration is not ready for the public yet, it's still under heavy development... more updates soon.

~5d ago

cznickesz: Possibly dumb question: is there any release containing xenko-integration right now?

~6d ago

~7d ago

~8d ago

joreg: looking for latest #vvvv gamma preview? it is here: vvvv-gamma-2019.1-preview

~8d ago

udo2013: I just want to know why the camera does not work. should be easy to be answered.

~8d ago

udo2013: an answer, please. also there was a 4d julia set in dx9. that must have programmed one. haalllooo!!

~8d ago

udo2013: where are the people who have translated shadertoy's mandelbulb in hlsl ?? for vvvv