Accessing HUD elements

  • On 29/06/2015 at 07:20, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   16 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;   PYTHON  ;

    Hi everyone,

    I was wondering if there is anything in the SDK for Python or C++ to access HUD elements. All I'm looking to do at this stage is have control of the positions of HUD objects like a user data slider or an info string.



  • On 30/06/2015 at 07:48, xxxxxxxx wrote:

    Hi Adam,

    It's currenly only possible to access the HUD elements (or controls) with the C++ API. Note the library lib_viewport.h that enables this access isn't documented and doesn't appear in the documentation. See this header to know its definitions.
    Here's a simple code snippet to access an existing HUD added to an integer user data with ID 1:

    AutoAlloc<ViewportHUD> viewHUD;
    if (!viewHUD)
      return false;
    ViewportHUDControl* control = viewHUD->FindControl(doc, doc->GetActiveBaseDraw(), op, DescID(DESCID_DYNAMICSUB, DescLevel(1, DTYPE_LONG, 0)));
    if (!control)
      return false;

    doc is the active document and op the active object.

    Then to control the position ViewportHUDControl has the method SetTopLeft().

  • On 30/06/2015 at 08:44, xxxxxxxx wrote:

    Amazing thanks, that looks like what I need.

Log in to reply