» creating and deleting pins at runtime
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

creating and deleting pins at runtime

there're situations were one needs to create pins at runtime depending on the value of some config pin. for example consider the Expr (Value) node. it creates input pins for each given variable name.

with beta28 coming up this kind of task got considerably easier to do with a new interface called IIOFactory.
it basically provides a method to create so called IO containers, containing the actual "view" on the pin data (such as ISpread) and controlling the lifetime of it.

say we want to create an ISpread<ISpread<T>> during runtime, we do something like this:

[Import] 
IIOFactory FIOFactory;
...
var inputAttribute = new InputAttribute("Input Foo");
var inputFooContainer = FIOFactory.CreateIOContainer<ISpread<ISpread<T>>>(inputAttribute);
var inputFooSpread = inputFooContainer.IOObject;
...

in case we decide to get rid of those two pins which are used by inputFooSpread we simply call Dispose on the associated IO container:

...
inputFooContainer.Dispose();
...

for details and as a starting point have a look at the new dynamic plugin template contained in beta28, which creates inputs and outputs on the fly, when changing the associated config pins.

Elias, Tuesday, Aug 7th 2012 Digg | Tweet | Delicious 0 comments  
  • 1

anonymous user login

Shoutbox

~2d ago

skyliner: wanna do drone shows or applications? then check this super cool project of our man e1n

~7d ago

NoseBleedIndustries: Thanks Joreg! The few minutes I was able to see, very good workshops!

~7d ago

joreg: @NoseBleedIndustries please give us some days, we'll have an announcement soon...

~7d ago

NoseBleedIndustries: I could not assist the Node20 (workshops ) Any Idea when we will have access to the links of the recordings?

~8d ago

bjoern: unity has c# bindings for usd, under apache license: https://github.com/Unity-Technologies/usd-unity-sdk

~17d ago

ravazquez: @synth yes they are being recorded and will be available for future consumption

~17d ago

synth: Another stupid question: Are all #NODE20 sessions recorded and accessible for later viewing in case someone missed something?

~19d ago

joreg: Get a fresh drink and some snacks: Live in 45 minutes: #NODE20 opening: https://youtu.be/SlKKyEUihhY