Group Details Private

Global Moderators

Forum wide moderators

  • RE: How to merge 2(or more) objects?

    Hi @merkvilson; MCOMAND_JOIN have changed in R18, now objects have to be under the same hierarchy.
    See Behaviour of MCOMMAND_JOIN different in R18 or [Python] SendModelingCommand().


    posted in Cinema 4D Development
  • RE: Seperators in GetSubContainer

    Hi @Boony2000

    In a GetSubContainer, to insert a separator use InsData(0, "") The ID used should always be 0. As described in ShowPopupDialog Example.

    Which give us

        def GetSubContainer(self, doc, submenu) :
            menuItems = [["name1"], ["name2", "hasIcon"], ["name3"]]
            for i, data in enumerate(menuItems) :
                if len(data) > 1:
                    submenu.SetString(i+1000, data[0] + "&i" + str(c4d.IDM_KEY_NEXT) + "&")
                    submenu.InsData(0, "")
                    submenu.SetString(i+1000, data[0])
            return True


    posted in Cinema 4D Development
  • RE: What is the correct redraw code for the views, all flags considered?

    Hi Cairyn, thanks a lot for your complete description. First of all your issue might take longer than the others to be resolved, since it needs proper investigation.

    With that's said could you try to remove your CollieMouse plugin and try with the Cinema 4D built-in Space Mouse support to see if the issue also appear with our current implementation (in order to be sure it's an issue in your implementation, and not something more global)

    Thanks a lot.

    posted in Cinema 4D Development
  • RE: Filling vertex_color for SceneHook


    GeAllocTypeNC() was already removed from the API with version R15 (see API Change List in R15 and maybe more interesting for you Transition to Cinema 4D R15 API).

    You are already on the right track using NewMem(), now in R20, there's an additional change, which bites you here: The error handling.

    This indeed is quite an important topic and (of course no bragging involved at all) a really nice feature in the new MAXON API. But it's also the one thing that causes most needed changes for R20. The point is, here at MAXON we do not take error checking lightly. Actually quite the opposite, we enforce error handling where ever we can and our internal developers have no chance to get away without.

    So, before I provide the solution, here the recommendation to take the time to read the manuals about the Error System.
    Additionally I recommend the manuals about classic API Entity Creation and Destruction and its MAXON API sibling about Memory Allocation. The additional means you get provided with in the new MAXON API can really make your life easier.

    I apologize for writing so much before coming to your actual issue.

    In the end NewMemClear() now returns an Error Result, which basically encapsulates the actual return value and needs to be evaluated in order to get the actual return value. No worries, this is done in a highly optimized form, so it should not impede your code's performance in any way.
    If you take a look at our SDK examples, you will find quite a few places, where error handling in conjunction with NewMem is demonstrated in various ways.


    posted in Cinema 4D Development
  • RE: FILENAME attribute extension filter


    you could try to write an empty value into the BaseContainer when the suffix is wrong. Something like this:

      const maxon::String suffix = t_data.GetFilename().GetSuffix().ToLower();
      if (suffix != "abc"_s)
        BaseContainer& bc = static_cast<BaseList2D*>(node)->GetDataInstanceRef();
        bc.SetFilename(EXAMPLE_FILENAME_PARAM, Filename());
        flags |= DESCFLAGS_SET::PARAM_SET;
        return true;

    Please notice there is no "official" solution to this; just use what works for you.

    Best wishes,

    posted in Cinema 4D Development
  • RE: BaseContainer bc = NULL;


    actually I'm not aware of any change of the Cinema 4D R20 API, which forbids definition of a BaseContainer pointer and assigning nullptr to it.
    On the other hand the code you posted into the headline of this subject (I recommend to write code rather into the actual post, where can also use code tags), doesn't look like you are actually defining a pointer variable.

    BaseContainer bc = nullptr; // This line shouldn't compile

    To be honest I'm not sure why this would have compiled in the R19 or any previous SDK.
    It would rather need to look like so:

    BaseContainer *bc = nullptr;

    And maybe it's also not the safest approach at all, as it leads to unrecoverable errors (aka crashes) if you forget to implement the nullptr check somewhere. Instead you could unconditionally create the BaseContainer upon initialization and detect the validity of its content by writing a boolean value representing the state into the container itself. Just a suggestion.

    The BaseContainer API does not directly provide any means to detect if the container is empty. But you could for example use BrowseContainer to check, if there's content. See also the BaseContainer manual for a snippet on how to use it.

    And finally as you seem to be porting your code to R20 anyway, you may also want to take a look at the DataDictionaryInterface (and the DataDictionary manual). While not being a 1:1 replacement, it can be a way more powerful solution for most use-cases of a BaseContainer.


    posted in Cinema 4D Development
  • RE: 3D Mouse Slider Focus

    Hello Andre,

    no, our API does not provide means to access arbitrary dialogs, which you'd need to be able to influence the focus or call GeDialog.Activate(). Sorry.

    Being a user of a 3DConnexion device myself, I'd like to make you aware of CollieMouse. It's been developed by @Cairyn (who's also active over at CGTalk). Though I'm not sure he has an R20 port, yet, maybe it's worth looking into it. It has a bunch of nice features (it really puts a SpaceMouse to a whole new level) and maybe Cairyn is even willing to add a command, which enables you to achieve what you want without direct access to the dialog.


    posted in Cinema 4D Development
  • RE: INCLUDE user-defined res files


    no, you are not! ☺
    Really there are no stupid questions and please do not delete such posts. Especially not, if you already invested time in posting the correct answer. We'd rather see this as knowledge others might benefit from in the future.


    posted in Cinema 4D Development
  • RE: Using maxon::BaseList with a TreeView?

    Hi @Kuroyume0161, first of all, welcome back in the plugincafe community, I'm glad to see you here!

    Unfortunately, this is not possible to use directly a BaseList with a TreeView and as you already figured it out, you have to maintain this list yourself.

    While it's very nice that a TreeView offer this abstraction level, and allows to make a list from any kind of data, it has the overhead to builds this TreeView layer.


    posted in Cinema 4D Development
  • RE: Frame all

    Hi WickedP, thanks for reaching us.

    Can you please better explain the final intent of your request? Is the document displayed in viewport (which means it's the active document)? Or is it just a cloned document being hold in "memory"?

    That said, supposing that you've your document displayed in the editor, beside the option to invoke CallCommand, there's no built-in function or method to invoke, but rather, as already depicted by @fwilleke80 you can think of doing something like:

    for each object in all objects:
      get object bounding box center and radius
      evalute the bbox max and min and update the overall bbox
    reposition the editor camera target in the center of the overall bbox 
    for each overall bbox vertex:
      convert from world to screen space
      verify that's inside the frame of the editing camera 
      if not in frame:
       zoom out a little and recheck if vertex is now in frame
    posted in Cinema 4D Development