Best practice for Plugin Developers

slacer

Active member
Hi all,
I want to create a custom renderer for LW and started with the samplerenderer project from lwsdk.
Currently it is a kind of Info Shader because it just retrieves all LWItemInfos and writes some info about the items into a text file.

My workflow is:
- Stop Layout
- Build plugin with Visual Studio on Windows
- Launch Layout
- Load Scene
- Go to Render Properties and switch from VPR to Dark Renderer and Render Options from Random to Info
- Press F9 to render the scene

For the next roundtrip after changing Code, I have to repeat every step.

Any ideas how to automate this?

Do you use Unit Tests for plugin development?
 

creacon

creacon
you can instruct visual studio to launch layout and you could probably also add the name of a scene at the end so LW launches with your scene immediately. Clipboard-1.jpg
 

slacer

Active member
Thank you, I did this just a minute ago and it really helps debugging as well.
Also if you stop debugging it will end Layout as well :D
 

Sensei

TrueArt Support

just out of curiosity really (no programmer)


is it possible to use C# to make LW plugins ?


LightWave plugin is DLL (dynamic link library). C# could be used to generate DLL:
https://stackoverflow.com/questions/15567893/creating-a-dll-file-in-c-net
But entire LWSDK is C/C++ includes.
Conversion of LWSDK functions to special wrappers between external DLL and C# would be tremendous amount of work.
https://stackoverflow.com/questions/13232449/calling-dll-method-using-c-sharp/13232500
 

slacer

Active member
If you don't, you'll pay for it in the long run.

What is your setup for Unit Tests for LightWave plugins, if I may ask? How much of LW can you mock away and where do you switch to integration tests?
Could you suggest a unit testing framework for c++ on Windows? I use dotnet and angular ts at work and I am familiar with multiple unit testing frameworks for these areas.
The only c++ unit tests I did in the past where on a mac with xcode.
 

jwiede

Electron wrangler
Could you suggest a unit testing framework for c++ on Windows?

I'd recommend customizing Catch + FakeIt, or see if you can get Google Test working -- a LOT depends on precisely what aspects of C/C++ you're actually using, as well. Some frameworks support most, others are pickier.

Your plugin type(s) will determine how involved your framework constraints and mocking needs wind up being. How difficult it is to unit test areas of functionality within your plugin code also depends highly on how you structure your code overall, handle config lifecycles, etc.
 
Last edited:

slacer

Active member
Thank you, I will give it a try.
Do you have any experience with cross platform unit tests, like for windows and mac?
The renderer will be a windows only project, because I have no nvidia GPU in my old macbook pro. But the possibility to use a given unit test framework on multiple platforms would be great.
 

creacon

creacon
You probably noticed I added a specific debug config at the end, this config references the debug version of the plugin.
When I launch my "normal" Layout it uses another config, so it uses the release version of the plugin.

Thank you, I did this just a minute ago and it really helps debugging as well.
Also if you stop debugging it will end Layout as well :D
 
Top Bottom