@ferdinand Thank you very much! I got the min and max distances also working with your input! I used the code example from the docs to traverse through the DeformCache and it worked instantly
Cankar001
@Cankar001
I am Can, 23 years old and currently working at Corsair as a graphics developer and studying computer science in germany.
Best posts made by Cankar001
-
RE: Rendering debug UI in the viewport via plugin
Latest posts made by Cankar001
-
RE: Error compiling S24 plugin
@ferdinand Thank you very much! I rewrote my code to your example provided, and now it works. I had another issue, where I tried to set the rendering config data right in the PluginStart method, but to that time no renderer interface seemed to be running already, so I moved this dependent code to another thread, that tries to retrieve the renderer instance from the hashmap and waits every time, when it failed to retrieve the instance and sets the data if it succeeded. This workflow seems to work very good now, the config data is always provided and now I have the ability to decide in the PluginStart() function already, which debug rendering features I want to enable
I only didn't understand, why the initial errors occurred, as I didn't include any typeinfo header directly (maybe caused by another std header then). But moving the code away from std seemed to help with that too.
-
Error compiling S24 plugin
Hello,
I have worked for some weeks now on my plugin for the S24 version, but suddenly I got some compile errors, pointing to the platform toolset of visual studio. Has this happened to someone else as well? I am using VS2022, but the generator for S24 generated a VS2019 solution (or at least the projects are using the platform toolset of VS2019). Is this a known issue and does someone have a quick fix for this?
This is the error message I am getting:1>main.cpp 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\typeinfo(39,18): error C3668: "std::bad_cast::_Doraise": Die Methode mit dem Überschreibungsspezifizierer "override" hat keine Basisklassenmethoden überschrieben. (Quelldatei wird kompiliert ..\source\SomeClass.cpp) 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\typeinfo(40,9): error C3861: "_RAISE": Bezeichner wurde nicht gefunden. (Quelldatei wird kompiliert ..\source\SomeClass.cpp) 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\typeinfo(51,18): error C3668: "std::bad_typeid::_Doraise": Die Methode mit dem Überschreibungsspezifizierer "override" hat keine Basisklassenmethoden überschrieben. (Quelldatei wird kompiliert ..\source\SomeClass.cpp) 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\typeinfo(52,9): error C3861: "_RAISE": Bezeichner wurde nicht gefunden. (Quelldatei wird kompiliert ..\source\SomeClass.cpp)
The class SomeClass looks like this:
#pragma once #include <unordered_map> class DebugRenderer; class SomeClass { public: static SomeClass *GetInstance(); void RegisterDebugRenderer(int inCommandId, DebugRenderer *inRenderer); void UnregisterDebugRenderer(int inCommandId, DebugRenderer *inRenderer); DebugRenderer *FindDebugRenderer(int inCommandId); private: std::unordered_map<int, DebugRenderer*> mDebugRenderers; };
The class DebugRenderer registers itself in this singleton when being constructed and unregisters when its destructor is called.
Thank you for your time!
All the best,
CanEdit: I just tried out to remove the source files for SomeClass.h and SomeClass.cpp from the project and comment out every usage, then everything compiles successfully again. I added the files normally into the source directory and re-generated the project solution after that, so that it shows up inside visual studio and wrote the code normally inside VS. So I am not sure why this doesn't compile, any guidance would be greatly appreciated!
-
RE: Rendering debug UI in the viewport via plugin
@ferdinand Thank you very much! I got the min and max distances also working with your input! I used the code example from the docs to traverse through the DeformCache and it worked instantly
-
RE: Rendering debug UI in the viewport via plugin
Hi @ferdinand,
thank you, I managed to get it working!
This is what I tried to achieve, basically showing the distances between the objects.I still have one question, is it also possible to extract the submeshes of a mesh? The next feature I wanted to implement is to also show the min and max distances between the objects and for that I wanted to extract the submesh data, from which I could calculate the distance more precisely than from the object transform. Basically I want to be able to calculate the distance between objects from any location on the surface. How would I retrieve the surface data?
I tried doing something like this:
// current and next are two BaseObject* if (current->IsInstanceOf(Opolygon) && next->IsInstanceOf(Opolygon)) { PolygonObject *currentPolygon = static_cast<PolygonObject*>(current); PolygonObject *nextPolygon = static_cast<PolygonObject*>(next); }
But this doesn't seem to work if I test it with cubes, is there any other conversion function maybe that lets me extract the mesh surface data? Maybe extracting the faces of the object would already work for my purpose.
Thank you again!
Cheers,
Can -
RE: Rendering debug UI in the viewport via plugin
Hi @ferdinand,
thank you for your detailed explanation! The first debug feature I planned is to draw lines between 3D objects, I think this use case then should work with the scene hooks draw method. But isn't there any other Draw method, that gets called per-frame? It seems a bit unnatural to me, that something basic like this seems to be missing. I come from a game engine background, so methods called per frame were always the first thing to implement
About the second question I had, is it possible to activate the plugin right after startup and draw the debug lines right away, without requiring the user to enable the plugin?
Thank you for your time and efforts!
Cheers,
Can -
Rendering debug UI in the viewport via plugin
Hello!
I am pretty new to plugin development in Cinema 4D and wanted to write a plugin to display additional debug information in the viewport. I read through the documentation, but I find it very confusing with all the different **Data base classes, I am not sure from which base class I should inherit, from my understanding, as I want the plugin to draw debug information in form of lines and other 2D objects, I wouldn't want to make them a part of the scene, so ObjectData would not fit here for example. Which base class would fit instead?Also another issue I saw is, that the code in the Draw methods only get executed, if the user selects the plugin in the extensions file menu entry, but I want the plugin to get called right after startup and toggle the state whether to show the debug information or not myself. I already found out how to hide the plugin from the file menu, but then the plugin code doesn't get executed at all.
I would be very happy if someone could point me into the right direction!
Thank you very much and all the best,
Can