Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Havremunken
    3. Best
    H
    • Profile
    • Following 0
    • Followers 0
    • Topics 8
    • Posts 46
    • Best 6
    • Controversial 0
    • Groups 0

    Best posts made by Havremunken

    • Project management for C4D SDK projects

      Hi there,
      This is a question to the community of C4D developers as much as to the Maxon guys. I would love to get some feedback and/or discussion on some questions and topics that relate to C4D project management more than the actual SDK itself.

      I'm coming from a background of C# development - so I spend my day job in Visual Studio 2022 as it is, and have not regularly used C++ daily for many years, but I am relearning for a C4D plugin project I am doing. This context affects some of my perspectives.

      1. How are you typically doing source control for your project? In my case, git is used for more or less everything I do, and I will use that to keep track of this project as well. Do you usually put the whole sdk folder in there, or just the folder for your project in sdk/plugins? If you work on multiple different projects at one time, does this change how you approach source control? For instance, do you have multiple sdk folders with one project each, or do you put multiple projects in the same plugin folder and keep them in separate git repositories? Or do you simply have one large ΓΌber-git-repo?

      2. Slightly related to the above - if you support multiple different Cinema 4D versions, how do you do that? Multiple sdk folders (per version), same plugin code base with compiler directives to handle C4D version differences as necessary? I would think supporting different versions would be an argument for keeping only the plugin code in git, but I would love to get perspectives from people with more experience than me in this matter.

      3. I would like to do some unit testing using Google Test in my project. I know about the C4D unit testing support and will probably use that too for stuff that needs to touch C4D. However, for my own code that is just plain C++ code, I would like to get immediate feedback in VS / ReSharper each time I compile. I can probably run all my unit tests a hundered times in the time it takes to start C4D once. However, keeping this in a separate project like I am used to from dotnet was a bad idea - when I needed to re-run the Project Tool, it killed and removed my test project. Another option is to include the test code in my actual plugin project and make sure the test code is stripped out when I do a release build. Anyone else done something similar and want to share their experience?

      4. Another thing the Project Tool does when it runs is to basically overwrite the entire structure of my project. From dotnet I am used to creating folders in my solution (mapped to actual folders on disk) to keep related code together, and not to end up with one big mess of a thousand source files. When I did C++ last, Visual Studio wasn't invented yet, so I don't know how to do the same thing there - the concept of (disk) folders seems not to exist. To keep a minimum of organization I used the feature known as "Filters" to create virtual folders in my project. That works fine, but the Project Tool just kills this structure and I am back to one big folder of source files. I don't NEED to split my code into file-per-class or anything like that, but it helps me wrap my brain around things. How do people go about keeping their projects somewhat organized?

      Any input on any of these points is welcome - I am learning here, and if anyone is willing to share their experiences, I am sure that can be useful to other users too.

      Thanks in advance for any opinions, facts or other comments on these topics!

      posted in General Talk c++ 2024 macos windows
      H
      Havremunken
    • RE: How to properly load async data into C++ generator plugin?

      Hi Ferdinand,

      Once again, thank you so much! I did read the docs for SetDParameter after posting last night and realized the scope of it, so my code is already using it instead of the message notification. Not just to avoid crowded code either. πŸ˜‰ But I have some situations that require validation, adjusting one param based on another etc., so I will soon implement GetDParameter and add that as well.

      Considering that less than 24 hours ago I had never heard of Scene Hooks before, I am now confident I will have your suggestion about using it to handle data loading, parsing, caching etc. implemented in an elegant way shortly. I was afraid I would have to find a contrived way to get the data back to the generator plugin, but using the SceneHookData I should be able to have everything nice and cached, and just use this in GetVirtualObjects to construct the actual geometry from my data structures.

      THANK YOU a million once more, and if you see your boss, tell him hi from me and that you deserve a raise. πŸ™‚

      posted in Cinema 4D SDK
      H
      Havremunken
    • RE: Project management for C4D SDK projects

      One further point I wanted to ask about; At this early stage of building my plugin, I run C4D in the VS debugger a lot; If someone wasn't aware, you can actually change your plugin code while Cinema 4D is running and "hot compile/reload" (Alt+F10) changes without restarting C4D - huge time-saver!

      I do use ApplicationOutput() and DiagnosticOutput() for some things to check that my computations are correct. However, some times it is very useful to see things in the VS debugger as well. Is there a way of seeing the contents of a maxon::String in the VS debugger? I have tried but I can not find anything in the Watch-window or any other way. Since my plugin is dealing with a lot of string value manipulation, it would be very good to see the contents directly in the debugger; Especially since when you hit a breakpoint and look through your code, you can not easily go back to the C4D window (to see output) without resuming the application.

      posted in General Talk
      H
      Havremunken
    • RE: Unexpected "refresh" behavior when manipulating linked object

      Thanks again @ferdinand !

      First; I did confirm that I wasn't dreaming. This works properly when my object is above the text object in the Object Manager. When the text object is above, it doesn't work. We get the splines resizing, but not the cloned text objects (1-9 in my original example). My understanding of how C4D generally works (top down within the same priority group, basically) also says this should be the other way around. As long as the text object is changed first (when I change it's Height property), then creating my clones etc. should be good to go. Instead it is the opposite.

      Let us add some spice to that equation; I added AddToExecution (and after tearing some hair out - added the OBJECT_CALL_ADDEXECUTION to my registration, that wasn't trivial to find) :

      Bool mt::AddToExecution(BaseObject* op, PriorityList* list)
      {
      	list->Add(op, 2147483647, EXECUTIONFLAGS::NONE);
      
      	return true;
      }
      

      Note the very big number in there. Biggest I could find. πŸ˜‰ I tried setting it to everything from EXECUTIONPRIORITY_INITIAL to EXECUTIONPRIORITY_GENERATOR to EXECUTIONPRIORITY_GENERATOR + 500 to the max value. This did NOT change the way this behaves. Only the order of the objects in the Object Manager changes this behavior as far as I can find. And this is still "opposite" of what we would expect.

      One further thing to note - I did override CheckDirty as well, and made it as close as possible to the code in the start of GVO. However, CheckDirty is not passed a HierarchyHelp object (unlike GVO), so I can't really call op->CheckCache(). However, it seems like this is a moot point because according to my debugger, CheckDirty is never actually called by C4D. And unlike the case with OBJECT_CALL_ADDEXECUTION, I could not find a flag to set to register for it. Is there anything special I need to do in order to "activate" the CheckDirty() checking?

      I realize this probably means you need to take a look at my code - I am convinced I am doing something "bad" that causes this priority of the object orders to be the only way that works. I will try to clean up the code a bit - it is an unholy mess right now, obviously programmed by someone who learned C++ 25 years ago, didn't use it much since (spent my time in C#) AND is trying to learn the idiomatic way to do things in the C4D SDK at the same time. Perhaps this cleanup will even fix the problem for all I know.

      I will keep you posted and eventually send you the code if I can't figure out why it behaves this way!

      Thanks again for the help so far!

      posted in Cinema 4D SDK
      H
      Havremunken
    • RE: How to get FONT information and use it to create text objects in C++?

      I can confirm that you were right (nothing unexpected there!) - this is the second time in a couple of weeks where casting has bit me in the behind. I guess I was too spoiled by C# and need to keep my head turned on in the future..

      For anyone from the future reading this: The problem with the code above was READING the value, not WRITING it back to the object. That part was ok. Either passing on for instance op as a parameter or using Get() (if you're on the right object) to get at it is the right move.

      Thanks again!

      posted in Cinema 4D SDK
      H
      Havremunken
    • RE: Plugin does not appear in Expression on client's Cinema 4D

      One thing you could do is run a utility like procmon: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

      This will let you see what a process accesses on the file system, among other things. Hopefully it will also show you which paths are searched for these libraries, allowing you to identify how to get them in the right location for your customer. πŸ™‚

      posted in Cinema 4D SDK
      H
      Havremunken