» VL Dynamic instancing without Delegates
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

VL Dynamic instancing without Delegates

demo reflection vl

about

Hi!

I was wondering how to instance an arbitrary object based on its type name in VL for a while.

For now I offer this solution that uses the built-in Deserialize functionality, inspired by the arbitrary object spread demo in the VL Serialization help patch.

Although not perfect (any object you expect to instance has to be explicitly used in the patch (inspired by elias's LINK experience)), it's the closest solution I know of until this functionality gets native support. Is it better than Delegates with a Dictionary? You decide!

Any simplification tips appreciated.

Until next time!

Elias 21/01/2019 - 16:12

Hey Dominik,
nice to put this out there. I'll report back once I get to VL and dynamic instantiation again.

microdee 22/01/2019 - 11:26

Is there a limitation of why Activator.CreateInstance wouldn't work in vl? at least it should work in script region https://docs.microsoft.com/en-us/dotnet/api/system.activator.createinstance?view=netframework-4.7.2

also for more reflection goodies check out fasterflect https://github.com/buunguyen/fasterflect ;)

Elias 23/01/2019 - 11:31

CteateInstance should also work but maybe little tricky to know what values to feed for the arguments. Would be easier if a default ctor would be present in target code.

anonymous user login

Shoutbox

~1d ago

domj: Little vvvv robotics and light control in the Tschechisches Zentrum Berlin in few hours, just patching en route https://bit.ly/2V0FAb3 ;)

~1d ago

AKa-visuals: @polyrhythm Stunning!.. cant wait for ibl integration. Keep on!

~1d ago

catweasel: @polyrhythm looks lovely!

~1d ago

polyrhythm: i put a little love into my vvvv raytracer after some time not touching it. textured emissive lights! https://i.imgur.com/OVzp6d5.png

~2d ago

sinus: Yes, they did the kollabo with klf. Still a tornado in the club.

~2d ago

microdee: @sinus: hahaha maaan that's some amazing stuff :D

~2d ago

elektromeier: @sinus: the extreme noise terror which played at klf s exit gig at brits?

~2d ago

sinus: Ipswitch

~2d ago

sinus: @evvvvil: from ispwitch! noble men! https://extremenoiseterror.bandcamp.com/

~3d ago

evvvvil: Fuck Norfolk that's where every boring person in the world is from. Suffolk is also a shithole and their football team is worst. xx