Plugin devvvv

hi, regarding dynamic plugins, i’ve cloned a template (EX9 texture) , then opened the csprj file, cos I needed to add some references and other stuff. I’m almost sure is not that the right way :) in fact I can compile correclty the dll, but if i drag it into a patch and right click, i can just see the cloned code, from where i stared coding, how is it working ?

btw, I did all this with beta 24

thank u all :D

ai hierro,

you should definitely use beta25 for such tasks. after cloning the template you can now add references via the project explorer (ctrl+j). and to add multiple instances of your new node just create them like any other node via doubleclick…typing its name… hope that helps.

yo man , gonna download beta25 and do the job for breakfast , thank u :)

well i couldn’t resist :) anyway, what if i have to add a reference to a dll not listed in projectExplorer ?

i copied my dll in _plugin_folder as well in bin and managed…u never know, but seems is not listed (btw a search will be a pleasure :)

the only way of adding a reference to an external dll is to drag the file & drop it onto the “References” of your project.

now what’s so nice in the new version vvvv25 is that you only need to keep in mind that we really focused on ease of use of addons. to achieve that we wanted that dynamic plugins will run from anywhere on your system, so users of contributions won’t need to change the vvvv app folder by copying into bin/managed or plugins. they typically only would need to drop a contribution on their desktop and open the help file.

so keep in mind to not change anything inside the vvvv app folder.

for you as a addon developer this means that you can create a folder where you want, where your own addons are located - which typically are unrelated to the vvvversion you use.
just enter that search path in the root and save the root.
place any file your plugin needs somewhere in the folder of that plugin. it can be a subdir called “thirdparty” or “used dlls”… drag & drop the files onto “References”.

aight, try dragdropping your .dll to the references in the project explorer. for now rightclick->add only allows you to add .dlls from the GAC. to be improved.

ok guys, sorry for trying to make dirty vvvv directory :D Kiddin, anyway, the first stuff i tried was dragging dll into projectManager, just now i get that first i have to open plugin code by rightclicking so PM can accept the dll dropping, using was succesfull, so i will keep on playing, thank you for support, finally i can have that breakfast ahahhaah :D

Just for reporting:

adding my dll, i have some ambiguity in definitions, something normal, just need to define full path for types, but when editor got the ambiguity error, I’m not able anymore to edit code, so i have to close it, reopen, comment the last using and describe full paths, now, i will find a way with some copy and past, but i qwas wondering which way this code can be edited into visual studio, if possible (i will not mark this post as solved just because hope my attempt can be useful for somebody else, especially devvvvs)

if i drag two template into patch, ost of times i can’t edit patch anymore.
render TTY log:

00:00:17 ERR : Error caught in the act: TApplication : Access violation at address 006186F3 in module ‘vvvv.exe’. Read of address 00000064

by the way, in a templateTexture clone, how can be set an init function ?

I tried to exectute init function into constructor but i get a vertex error, o i moved my init funtion in evaluate using an if statement.

Anyway for most errors i get i lost the plugin and i have to rewrite or clone it, look like im loosing the vvvv plugin cache.
It’s very curious that, if I open the patch i was using i got a red placeholder as i told , but i can hav listed my plugin in template list, if i open a new pathc that plugin doesnt exist at all , anyway i saved the code to try again one day :D

basically you should place your init code in the constructor of your plugin with the

[ImportingConstructor](ImportingConstructor)

attribute attached.

note that fields attributed with the

[Import](Import), [Input](Input), [Config](Config) or [Output](Output)

attributes can’t be accessed in your constructor, because they are not set yet. if you need access to such fields you need to move the import/input/output/… attributes into the constructor arguments of your plugin.
example:

// This will NOT work
[Input("Foo")](Input("Foo"))
ISpread<double> FFooIn;

[ImportingConstructor](ImportingConstructor)
public MyPlugin()
{
  var sliceCount = FFooIn.SliceCount; // Will result in null pointer exception
}

// -------------------
// This will work
ISpread<double> FFooIn;

[ImportingConstructor](ImportingConstructor)
public MyPlugin([Input("Foo")](Input("Foo")) fooIn)
{
  FFooIn = fooIn;
  var sliceCount = FFooIn.SliceCount;
}

to your first question:
you should be able to open a cloned plugin with visual studio or sharp develop, which will give you all the code intellisense power of these major development environments, but you’ll lose the compile on save provided by our code editor. so it’s up to you what you prefer.

btw. i can confirm the issues you have with dynamic plugins. thank you for reporting, we’ll certainly look into it and hopefully come up with a bugfix release soon. sorry for the inconvenience.

thank you very much, will keep on report, btw i suggest to all developers to copy the code everytime the code editor will be opened and use it as backup, so every possible crash you will have a backupPoint to rebuild the plugin, couldnt find another handy way to go on.

hierro, the init method in the texture template is:

code(lang=csharp):
protected override Texture CreateTexture(int Slice, Device device)
{…
}

there goes your initial code for the textures.
in the EX9 template it is:

code(lang=csharp):
protected override CustomDeviceData CreateDeviceData(Device device)
{…
}

these methods are called once a device needs is data. note, that it can be called multiple times, if you have the texture on two screens for example, then you need to create two data sets (unless you are in span mode).

Hello,

speaking about dynamic plugins, i also have a question regarding libraries. i am trying to write my own mysql connection plugin where i can have acess to 2 different databases. For this purpose i need the external library MySql.Data.dll. Since i am new with C# i learned that i first had to install the .Net environment in order to install the MySql connector.
http://dev.mysql.com/downloads/connector/net/ . This installer contains the dll. From the above postings i learned that i have to put the .dll into a folder right where my very special own plugin is living. After that i dragged and dropped the .dll into the “Preferences” inside the project explorer.
I now have the chance to write:

using MySql.Data.MySqlClient;

and all is fine. But when i try to use some classes from the linked .dll it gives me an error:

Der Typ "System.Data.Common.DbConnection" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.Data. Version=4.0.0.0 ............ hinzu"

Well i am German but still for me this makes no sense at all :-). What else do i have to do, to use an external library?

Another version i tried was to include the GAC MySql.Data reference into the “Preferences” by selecting the entry for MySql.Data from the List. But when i dothis, the whole vvvv app is crashing and dying. :-(

Any help on how to properly intergrate external .dll’s (especially the MySql thing) is very welcome.
Thanks in advance, r.

you added System.Data from GAC like it tells you to do?
and do not add more than one reference at once via the reference dialog, otherwise vvvv will crash. sorry, that’s a known bug in beta25.

on and please open up a new thread in future.

Hey Elias,

Nice! Thanks for the quick answer. And yes you are right, it works if i add the System.Data GAC reference (like the error message tells you :-o ). And yes i will open a new thread in future.
Thanks again, r.