### Example: Starting a UDP Server Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_udp.html Demonstrates how to create and start a UDP server, with a callback function to handle incoming data. ```APIDOC ## Example: UDP Server Setup This example shows how to start an UDP server and define its behavior for handling incoming data using a callback function. ### Steps 1. **Create and Start AioServiceRef**: Initialize and start the asynchronous I/O service. 2. **Define Local Address**: Specify the IP address and port for the server to listen on. 3. **Create UDP Server**: Use `maxon::NetworkUdpInterface::CreateUdpServer` with the local address, a callback function, and the I/O service. 4. **Start UDP Server**: Call the `Start()` method on the created UDP server instance. ### Callback Function Example ```cpp static maxon::Result UDPCallback(maxon::Result result, maxon::AioBuffer receivedData, maxon::NetworkIpAddrPort sender) { iferr_scope; // print the remote address DiagnosticOutput("Sender: @", sender); // print the received data const maxon::String message { receivedData }; DiagnosticOutput("Message: @", message); return maxon::OK; } ``` ### Notes * `iferr_return` and `iferr_scope` are macros for error handling. * `DiagnosticOutput` is used for logging. ``` -------------------------------- ### Start a TCP Server Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_tcp.html This example demonstrates how to start a TCP server. The behavior for incoming connections is defined by the TCPServerCallback function. Ensure an AioService is created and started before creating the server. ```cpp // create AioService g_tcpIoService = maxon::AioServiceRef::Create() iferr_return; g_tcpIoService.Start() iferr_return; // create and start server auto localAddr = maxon::NetworkIpAddrPort(maxon::WILDCARD_IPV4_ADDRESS, 2000); g_tcpServer = maxon::NetworkTcpInterface::CreateServer(localAddr, TCPServerCallback, g_tcpIoService, maxon::JOBQUEUE_CURRENT) iferr_return; g_tcpServer.Start() iferr_return; ``` -------------------------------- ### Creating and Starting a Custom Thread Instance Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_manual_c4dthread.html This example demonstrates how to create and start a new custom thread instance. It includes logic to allocate the thread if it doesn't exist, stop it if it's already running, and then start it with the provided document clone and display bitmap. ```cpp // This example shows how to create and start a new custom thread instance. // allocate thread if needed if (g_renderThread == nullptr) { ifnoerr (g_renderThread = NewObj(RenderThread)) { if (g_renderThread == nullptr) return false; } } // check if the thread is running if (g_renderThread->IsRunning()) { // stop the thread g_renderThread->End(true); } // thread takes ownership of the document clone but not of the bitmap! g_renderThread->SetData(documentClone, g_displayBitmap); const Bool started = g_renderThread->Start(); ifnoerr ``` -------------------------------- ### Prepare and Invoke MoGraph Setup Command Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_command.html Prepares specific data for the MoGraph setup command, invokes it, and retrieves the modified data. This example requires a valid 'doc' object and assumes the MoGraphSetupData structure is defined. ```cpp // prepare mograph data // no object is set; the active object of the given document should be used MoGraphSetupData data; data._doc = doc; data._object = nullptr; const maxon::Int dataIndex = 0; // create data maxon::LegacyCommandDataRef legacyData = maxon::LegacyCommandDataClasses::MOGRAPHSETUPDATA().Create() iferr_return; legacyData.SetLegacyData(data, dataIndex) iferr_return; // invoke command const auto command = maxon::CommandClasses::MOGRAPHSETUP(); const maxon::COMMANDRESULT res = legacyData.Invoke(command, false) iferr_return; if (res != maxon::COMMANDRESULT::OK) return maxon::OK; // get result const MoGraphSetupData result = legacyData.GetLegacyData(dataIndex) iferr_return; result._cloner->SetName("The New Cloner"_s); ``` -------------------------------- ### Start Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_network_udp_server_interface.html Starts the UDP server. It returns an error if the server is already running or if socket setup fails. Once started, it can receive incoming packets. ```APIDOC ## Start() ### Description Starts the server. Returns an error if the server was already started, or if it failed to set up a listening socket. After the server is successfully started, it will receive incoming packets. ### Method MAXON_METHOD ### Parameters None ### Returns Result ``` -------------------------------- ### Start Cinema 4D with Custom Command Line Arguments Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_configuration.html This example demonstrates how to launch Cinema 4D with specific command-line arguments to enable custom settings and the console. ```batch "CINEMA 4D.exe" g_printErrors=true g_console=true ``` -------------------------------- ### Get Next File in Directory Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_browse_files.html Retrieves the next file or subdirectory in the browsed directory. Call GetNext() once to start retrieving from the first item. This example demonstrates iterating through files and printing their names. ```cpp Bool GetNext( ); ``` ```cpp AutoAlloc bf; if (bf == nullptr) return; bf->Init(dir, BROWSEFILES_CALCSIZE); while (bf->GetNext()) { GePrint(bf->GetFilename().GetString()); } ``` -------------------------------- ### Get GUID Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_instance_object.html Retrieves the globally unique identifier (GUID) of the object. ```APIDOC ## GetGUID ### Description Retrieves the globally unique identifier (GUID) of the object. ### Method `UInt64 | GetGUID () const` ### Returns - `UInt64`: The GUID of the object. ``` -------------------------------- ### Start a Simple Web Server Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_webserver.html This snippet demonstrates how to initialize, start, and configure a basic web server using the maxon::NetworkWebServerInterface. It also shows how to register a callback function to handle incoming requests. ```cpp // This example starts a simple web-server. The behaviour // of the sever is defined with the callback function. // create server instance g_server = maxon::NetworkWebServerClass().Create() iferr_return; const maxon::String name("ExampleServer"); // server name must pass maxon::IsAlphabetic() auto serverAddr = maxon::NetworkIpAddrPort(maxon::WILDCARD_IPV4_ADDRESS, maxon::WILDCARD_IP_PORT); const bool useSSL = false; // start server g_server.Init(useSSL, serverAddr, name) iferr_return; g_server.StartServer(true) iferr_return; DiagnosticOutput("WebServer started on port @", g_server.GetServerPort()); // define behaviour g_server.ObservableHandleRequest(true).AddObserver(WebServerCallback) iferr_return; ``` -------------------------------- ### Example projectdefinition.txt for a Foo Module Source: https://developers.maxon.net/docs/cpp/2026_1_0/manual_build_systems_configure.html This example demonstrates a typical `projectdefinition.txt` file for a plugin module, specifying platforms, type, APIs, C4D framework usage, style check level, and a unique module ID. ```plaintext // The supported platforms for the module Platform=Win64;OSX;Linux // The type of the module, for plugins this will be DLL. Type=DLL // The frameworks that can be used by this module. Not including a framework here means that source // files of this module will not be able to include files from such non-included framework. The three // frameworks shown here are a good baseline for most plugin modules. APIS=\ cinema.framework; \ cinema_hybrid.framework; \ core.framework // Must be set in all modules that use both the cinema.framework and the core.framework. Also disables // all style checks in this module. One must re-enable style checks after setting this argument when // the source processor shall style check code (which is strongly recommended). C4D=true // Set the style check rigidity, and by that re-enable style checks. stylecheck.level=3 // The resulting plugin binary will attempt to register this module with the here given module ID // with Cinema 4D on startup. This ID must be unique and follow the inverted company domain pattern. // DO NOT use module IDs that lie in the 'net.maxon...' domain, as your plugin will not load otherwise. ModuleId=com.company.plugins.foo ``` -------------------------------- ### Find (GUID) Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_item_tree_data-members.html Finds a node in the tree by its GUID. Optionally starts the search from a specific node. ```APIDOC ## Find (GUID) ### Description Finds a node in the tree by its GUID. Optionally starts the search from a specific node. ### Method Not specified (likely a class method) ### Parameters - **guid** (UInt64) - The GUID of the node to find. - **node** (ItemTreeNode *) - Optional. The starting node for the search. If nullptr, searches from the root. ``` -------------------------------- ### Init Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_virtual_machine_interface.html Initializes the virtual machine with runtime information and optional settings. ```APIDOC ## Init() ### Description Initializes the virtual machine with runtime information and optional settings. ### Method MAXON_METHOD ### Parameters #### Path Parameters - **runtimeInfo** (const LoadRuntime &) - Required - Information about the virtual machine, how to start it up. - **settings** (const DataDictionary &) - Optional - Optional settings which might be needed by the virtual machine. ### Returns #### Success Response - OK on success. ``` -------------------------------- ### GetSelectionStart() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_kerning_data.html Gets the index of the selection start. This method returns the starting index of the current selection. ```APIDOC ## GetSelectionStart() ### Description Gets the index of the selection start. ### Returns - **Int32**: The index of the selection start. ``` -------------------------------- ### GetCount() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides.html Gets the number of guides. ```APIDOC ## GetCount() ### Description Gets the number of guides. ### Method Int32 ### Returns - The guide count. ``` -------------------------------- ### Get Application Version and Build ID Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_application_manual.html This example retrieves the application's version number and build ID, printing them to the console. Error handling is included via `iferr_return`. ```cpp // This example prints the application version and build ID to the console. maxon::Int version; maxon::String buildID; maxon::Application::GetVersion(version, buildID) iferr_return; DiagnosticOutput("Application version @ (@)", version, buildID); ``` -------------------------------- ### Start Function Parameters Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_timer_interface.html Illustrates the parameters required for the Start function, including interval, delay, tolerance, job, and queue. ```cpp return Start ( interval. _GetSeconds_(), delay. _GetSeconds_(), tolerance. _GetSeconds_(), * _job , queue ) ``` -------------------------------- ### GetPoints Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets all points of the hair guides. ```APIDOC ## GetPoints ### Description Retrieves all points that define the hair guides. ### Method GetPoints ``` -------------------------------- ### GetGuidePointCount Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the number of points in a guide. ```APIDOC ## GetGuidePointCount ### Description Returns the number of points that make up a single hair guide. ### Method GetGuidePointCount ``` -------------------------------- ### Example: Setting Up and Editing User Data Source: https://developers.maxon.net/docs/cpp/2026_1_0/group__group__activeobjectmanagerlibrary.html Demonstrates how to create and configure a new user data element (an integer edit field) and then display the edit dialog for it. This involves getting the dynamic description, setting default container values, and calling EditDescription. ```cpp DynamicDescription* dd = op->GetDynamicDescription(); BaseContainer bc = GetCustomDataTypeDefault(DTYPE_LONG); bc.SetString(DESC_NAME,"test1"); bc.SetString(DESC_SHORT_NAME,"test1"); bc.SetInt32(DESC_CUSTOMGUI,CUSTOMGUI_LONG); bc.SetInt32(DESC_MIN,0); bc.SetInt32(DESC_MAX,100); bc.SetInt32(DESC_STEP,1); bc.SetInt32(DESC_ANIMATE, DESC_ANIMATE_ON); bc.SetBool(DESC_REMOVEABLE, true); EditDescription(op, dd->Alloc(bc)); ``` -------------------------------- ### StartServer() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_network_web_server_interface.html Starts the web server. Optionally, it can wait until the server is ready to accept connections. ```APIDOC ## StartServer() ### Description Starts the web server. This function can optionally block until the server is listening for connections. ### Method MAXON_METHOD ### Parameters #### Query Parameters - **waitForListener** (Bool) - in - If true, the function waits until the listener is open. Otherwise, it returns immediately. ### Returns Result: True if the function was successful. ``` -------------------------------- ### GetSelectedID Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_item_tree_data-members.html Gets the GUID of the currently selected node. ```APIDOC ## GetSelectedID ### Description Gets the GUID of the currently selected node. ### Method Not specified (likely a class method) ### Returns The GUID of the selected node. ``` -------------------------------- ### Create and Use ExampleClass Instance with NewObj Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_creation.html Demonstrates creating an instance of 'ExampleClass' using NewObj(), retrieving its value, and then deleting the object. Ensure error handling with 'iferr_return'. ```cpp // This example creates a new instance of the example class using NewObj(). // create the new object ExampleClass* exampleObject = NewObj(ExampleClass, 100) iferr_return; // use the object const maxon::Int number = exampleObject->GetNumber(); DiagnosticOutput("Number: @", number); // delete the object DeleteObj(exampleObject); ``` -------------------------------- ### GetTransformMatrix Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the transformation matrix of the hair guides. ```APIDOC ## GetTransformMatrix ### Description Retrieves the transformation matrix applied to the hair guides. ### Method GetTransformMatrix ``` -------------------------------- ### BPSetupWizardWithParameters Source: https://developers.maxon.net/docs/cpp/2026_1_0/c4d__painter_8h.html Sets up the BP wizard with specified parameters. ```APIDOC ## BPSetupWizardWithParameters ### Description Sets up the BP wizard with specified parameters. ### Signature `Bool BPSetupWizardWithParameters(BaseDocument *doc, const BaseContainer &settings, AtomArray &objects, AtomArray &material)` ### Parameters - **doc** (BaseDocument *) - Pointer to the BaseDocument. - **settings** (const BaseContainer &) - Const reference to a BaseContainer for settings. - **objects** (AtomArray &) - Reference to an AtomArray for objects. - **material** (AtomArray &) - Reference to an AtomArray for materials. ``` -------------------------------- ### begin() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_multi_index_1_1_iterator.html Returns a wrapper for the beginning of the sequence. ```APIDOC ## Wrapper begin() ### Description Returns a `Wrapper` object that represents the beginning of the sequence managed by the MultiIndex. This is typically used to start iteration. ### Method Iterator Accessor ### Returns - **Wrapper** - A wrapper object pointing to the first element. ``` -------------------------------- ### GetTangent Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the tangent at a specific point on a guide. ```APIDOC ## GetTangent ### Description Calculates and returns the tangent vector at a specific point along a hair guide. ### Method GetTangent ### Parameters - **guide** (Int32) - The index of the hair guide. - **segment** (Int32) - The index of the segment within the guide. - **t** (Float) - The parameter value along the segment (typically 0.0 to 1.0). ``` -------------------------------- ### Start with Parameters Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_service_bus_interface.html Starts the service bus with custom parameters. After successful startup, the bus broadcasts announcements and listens for subscriptions on the local network. ```APIDOC ## MAXON_METHOD Result< void > Start ### Description Starts the service bus with custom parameters. After it has been started successfully, the bus broadcasts announcements and listens for subscriptions on the local network. ### Method MAXON_METHOD ### Parameters #### Path Parameters - **_props** (const Parameters &) - Required - Custom parameters for starting the service bus. ``` -------------------------------- ### GetSelected() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides.html Gets the selection state of the hair guides. ```APIDOC ## GetSelected() ### Description Gets the selection state. ### Parameters - **mode** (Int32) - in - The selection mode: HAIR_MODE - **select** (BaseSelect *) - out - Assigned the selection. ### Returns - Bool - true if successful, otherwise false. ``` -------------------------------- ### QueryInt Example Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_configuration.html Demonstrates how to query an integer value from the configuration database. It shows how to handle potential errors and update a default value only if the query is successful. ```cpp Int g_cellSize = 3.0; // default value Int result; CONFIGURATIONENTRY_ORIGIN origin; CONFIGURATIONENTRY_STATE state; ifnoerr (Configuration::QueryInt("g_cellSize"_s, result, origin, state)) g_cellSize = result; // only set value if no error occured ``` -------------------------------- ### GetSegmentCount Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the number of segments in the hair guides. ```APIDOC ## GetSegmentCount ### Description Returns the total number of segments across all hair guides. ### Method GetSegmentCount ``` -------------------------------- ### GetRoot Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets a specific root of the hair guides. ```APIDOC ## GetRoot ### Description Retrieves a specific root of the hair guides by its index. ### Method GetRoot ### Parameters - **index** (Int32) - The index of the root to retrieve. ``` -------------------------------- ### WINDOWPIN Usage Example Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_dialog_resource__w_i_n_d_o_w_p_i_n.html Demonstrates how to use the WINDOWPIN resource to align a window pin to the left and top edges. ```c++ WINDOWPIN { ALIGN_LEFT; ALIGN_TOP; }; ``` -------------------------------- ### Get Static Method Source: https://developers.maxon.net/docs/cpp/2026_1_0/structmaxon_1_1reflection_1_1_container_info.html Retrieves a constant pointer to a ContainerInfo object associated with the given module. ```APIDOC ## Get(const ModuleInfo *module) ### Description Retrieves a static constant pointer to a ContainerInfo object for a given module. ### Method static ### Parameters * **module** (const ModuleInfo *) - A pointer to the module for which to retrieve ContainerInfo. ``` -------------------------------- ### Create and Invoke Example Command Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_command.html Creates an instance of example data, sets integer values, invokes the example command, and retrieves the integer result. Ensure the DiagnosticOutput macro is defined. ```cpp // create data maxon::CommandDataRef data = maxon::CommandDataClasses::EXAMPLEDATA().Create() iferr_return; data.Set(0, maxon::Int32(100)) iferr_return; data.Set(1, maxon::Int32(200)) iferr_return; // invoke command const auto command = maxon::CommandClasses::EXAMPLE(); const maxon::COMMANDRESULT res = data.Invoke(command, false) iferr_return; if (res != maxon::COMMANDRESULT::OK) return maxon::OK; // get result const maxon::Int32 resultValue = data.Get(2) iferr_return; DiagnosticOutput("Result: @", resultValue); ``` -------------------------------- ### GetObject Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the associated object for the hair guides. ```APIDOC ## GetObject ### Description Retrieves the base object associated with these hair guides. ### Method GetObject ``` -------------------------------- ### GetMg Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the transformation matrix of the hair guides. ```APIDOC ## GetMg ### Description Retrieves the current transformation matrix (local to world) of the hair guides. ### Method GetMg ``` -------------------------------- ### IterableBeginHelper< T[N]> Source: https://developers.maxon.net/docs/cpp/2026_1_0/structmaxon_1_1details_1_1_iterable_begin_helper_3_01_t_0f_n_0e_4.html Provides a way to get an iterator to the beginning of a C-style array of known size N. ```APIDOC ## IterableBeginHelper< T[N]> ### Description This specialization of `IterableBeginHelper` is designed to work with C-style arrays of a fixed size `N`. It allows you to obtain a pointer to the first element of the array, which can then be used with standard C++ iteration patterns. ### Method This is a template class, not a direct method call. The functionality is accessed through its static members or by instantiating helper functions that utilize it. ### Endpoint N/A (C++ Class Template) ### Parameters * **T** (type) - The type of elements in the array. * **N** (integer) - The compile-time known size of the array. ### Request Example ```cpp int arr[5] = {1, 2, 3, 4, 5}; auto begin_it = IterableBeginHelper::Begin(arr); // begin_it will point to the first element (1) ``` ### Response #### Success Response Returns an iterator (typically a pointer) to the beginning of the array. #### Response Example ```cpp // Example usage within a function returning the iterator int* get_array_begin(int (&arr)[5]) { return IterableBeginHelper::Begin(arr); } ``` ``` -------------------------------- ### GetCount Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the total number of hair guides. ```APIDOC ## GetCount ### Description Returns the total number of hair guides. ### Method GetCount ``` -------------------------------- ### TokenEntry Member: _example Source: https://developers.maxon.net/docs/cpp/2026_1_0/structcinema_1_1_token_entry.html Stores an optional example string for the Token. ```cpp String _example; ``` -------------------------------- ### Example: Implementing StringInterface Source: https://developers.maxon.net/docs/cpp/2026_1_0/group___s_y_s_t_e_m.html An example demonstrating the use of MAXON_IMPLEMENTATION and MAXON_IMPLEMENTATION_REGISTER for implementing the StringInterface. ```cpp class XStringImpl : private StringInterface { MAXON_IMPLEMENTATION(XStringImpl); public: XStringImpl() { } XStringImpl(const XStringImpl& str) { Insert(0, &str); } Int GetLength() const { return _txt.GetCount(); } ... }; MAXON_IMPLEMENTATION_REGISTER(XStringImpl); ``` -------------------------------- ### GetPointCount() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides.html Gets the total number of points for all guides. ```APIDOC ## GetPointCount() ### Description Gets the total number of points for all guides. ### Method Int32 ### Returns - The point count. ``` -------------------------------- ### Preparing a Memory Block for Reading Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_io_memory_interface.html Shows how to create a memory block, allocate a buffer, and prepare it for reading using `PrepareReadBuffer`. It also includes a callback for freeing the buffer when it's no longer needed. ```cpp IoMemoryRef mem = IoMemoryRef::Create() iferr_return; Char* buffer = NewMem(Char, size) iferr_return; mem.PrepareReadBuffer(ToBlock(buffer, size), [](const Char*& buffer) { DeleteMem(buffer); }) iferr_return; ``` -------------------------------- ### GetSegmentCount() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides.html Gets the number of segments per guide. ```APIDOC ## GetSegmentCount() ### Description Gets the number of segments per guide. ### Method Int32 ### Note The number of points is GetSegmentCount() + _1_. ### Returns - The segment count. ``` -------------------------------- ### Tool Sculpt Brush Grab Enumerations Source: https://developers.maxon.net/docs/cpp/2026_1_0/toolsculptbrushgrab_8h.html Defines the starting point and various direction modes for the sculpt brush grab tool. ```c++ enum { MDATA_TOOLSCULPTBRUSHGRAB_START, MDATA_TOOLSCULPTBRUSHGRAB_DIRMODE, MDATA_TOOLSCULPTBRUSHGRAB_DIRMODE_MOUSEDIR, MDATA_TOOLSCULPTBRUSHGRAB_DIRMODE_NORMAL, MDATA_TOOLSCULPTBRUSHGRAB_DIRMODE_X, MDATA_TOOLSCULPTBRUSHGRAB_DIRMODE_Y, MDATA_TOOLSCULPTBRUSHGRAB_DIRMODE_Z } ``` -------------------------------- ### Get Source: https://developers.maxon.net/docs/cpp/2026_1_0/structmaxon_1_1corenodes_1_1details_1_1_process_wrapper_3_01_result_3_01void_01_4_07_m_n_1_1_5_08c9fbdb17d2dc4ceb20b73a96ff4ef20.html Retrieves the process function associated with a micro-node's base. This static function allows access to the underlying process function. ```APIDOC ## Get() ### Description Retrieves the process function associated with a micro-node's base. This static function allows access to the underlying process function. ### Method `static` ### Parameters - `_node_` (MicroNode::Base &) - The base of the micro-node to get the process function from. ### Returns ProcessFunction - The process function associated with the node's base. ``` -------------------------------- ### CopyToUninitializedIf Source: https://developers.maxon.net/docs/cpp/2026_1_0/structmaxon_1_1details_1_1_copy_impl_selector_3_01false_01_4.html Copies elements from the range `[_first, _sentinel)` to the destination starting at `_dest` if the predicate `_pred` returns true for an element. The destination must have enough uninitialized space to hold the copied elements. Returns the end iterator of the destination range. ```APIDOC ## CopyToUninitializedIf() ### Description Copies elements from the range `[_first, _sentinel)` to the destination starting at `_dest` if the predicate `_pred` returns true for an element. The destination must have enough uninitialized space to hold the copied elements. Returns the end iterator of the destination range. ### Method static ### Signature `static auto CopyToUninitializedIf(ITERATOR _first, SENTINEL _sentinel, DEST_ITERATOR _dest, PREDICATE _pred) -> ResultOk` ### Parameters #### Source Range - **_first** (ITERATOR) - The beginning of the source range. - **_sentinel** (SENTINEL) - The end of the source range. #### Destination - **_dest** (DEST_ITERATOR) - The beginning of the destination range (must be uninitialized). #### Predicate - **_pred** (PREDICATE) - A function or callable object that takes an element from the source range and returns a boolean. If it returns true, the element is copied. ### Return Value - **ResultOk** - An object containing the end iterator of the destination range after the copy operation. ``` -------------------------------- ### GetMinTime() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_base_document.html Gets the starting time for the Timeline in the document. ```APIDOC ## GetMinTime() ### Description Gets the starting time for the Timeline in the document. ### Returns - BaseTime: The starting time of the document's Timeline. ``` -------------------------------- ### StartProcess Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_system_process_object_interface.html Executes the prepared process. This method can only be called once per instance. To restart the same executable, a new instance must be allocated with the same settings. ```APIDOC ## StartProcess() ### Description Executes the prepared process. This only works once. To start the same executable again you need to allocate another instance with the same settings. ### Method MAXON_METHOD ### Returns Result: OK on success. ``` -------------------------------- ### StartWebServer Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_network_web_socket_server_interface-members.html Starts the web server, making it listen for incoming connections on the specified address and port. It can optionally wait for the listener to be ready. ```APIDOC ## StartWebServer ### Description Starts the web server, making it listen for incoming connections on the specified address and port. It can optionally wait for the listener to be ready. ### Method (Not specified, likely internal or part of constructor) ### Parameters * **addressAndPort** (NetworkIpAddrPort) - The IP address and port to listen on. * **waitForListener** (Bool) - If true, the method will wait until the listener is ready. * **requestedProtocol** (String) - The protocol to be used for the server. ``` -------------------------------- ### Get Data Description Value Example Source: https://developers.maxon.net/docs/cpp/2026_1_0/group___d_a_t_a_t_y_p_e.html Example usage for retrieving minimum and maximum values of an attribute. Ensure 'iferr_return' is handled appropriately. ```cpp Int32 min = GetDataDescriptionValue(MACHINEINFO::NUMBEROFPROCESSORS, DESCRIPTION::DATA::BASE::MINVALUE) iferr_return; Int32 max = GetDataDescriptionValue(MACHINEINFO::NUMBEROFPROCESSORS, DESCRIPTION::DATA::BASE::MAXVALUE) iferr_return; ``` -------------------------------- ### ToolSculptBrushAmplify Enumeration Source: https://developers.maxon.net/docs/cpp/2026_1_0/toolsculptbrushamplify_8h.html Defines the possible modes for brush amplification, including start and various amplification types. ```cpp enum { ToolSculptBrushAmplify_Start, MDATA_SCULPTBRUSH_AMPLIFY_MODE, MDATA_SCULPTBRUSH_AMPLIFY_MODE_BOTH, MDATA_SCULPTBRUSH_AMPLIFY_MODE_CREVICE, MDATA_SCULPTBRUSH_AMPLIFY_MODE_RIDGE } ``` -------------------------------- ### GRADIENT Resource Example Usage Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_descriptionresource__g_r_a_d_i_e_n_t.html Demonstrates how to use the GRADIENT resource with specific IDs and color document settings. ```c++ GRADIENT TURBULENCESHADER_COLOR { ICC_BASEDOCUMENT; } ``` -------------------------------- ### Get Polygon Normals Example Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_normal_tag.html Retrieves the normal data for a specific polygon within a NormalTag. This example iterates through all polygons to access their normal data. ```cpp NormalStruct res; Int32 dataCount = normalTag->GetDataCount(); ConstNormalHandle data = normalTag->GetDataAddressR(); for (Int32 i=0; i LoadResources() { iferr_scope_handler { err.DiagOutput(); err.CritStop(); return err; }; // get plugin res folder const maxon::Url resDir = maxon::Application::GetUrl(maxon::APPLICATION_URLTYPE::CURRENT_MODULE_RESOURCE_DIR) iferr_return; // register database maxon::DataDescriptionDefinitionDatabaseInterface::RegisterDatabaseWithUrl(g_pluginDatabase, resDir) iferr_return; return maxon::OK; } // frees resources at the end static void FreeResources() { iferr_scope_handler { err.DiagOutput(); err.CritStop(); return; }; // Unregister all descriptions. maxon::DataDescriptionDefinitionDatabaseInterface::UnregisterDatabase(g_pluginDatabase) iferr_return; } MAXON_INITIALIZATION(LoadResources, FreeResources); ``` -------------------------------- ### Begin () const Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_asset_repository_interface.html Returns an iterator pointing to the beginning of the asset repository. ```APIDOC ## Begin () const ### Description Returns an iterator pointing to the beginning of the asset repository. ### Method MAXON_FUNCTION ### Response #### Success Response - **ConstIterator** - An iterator to the first element. ``` -------------------------------- ### GetPointCount Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_hair_guides-members.html Gets the total number of points across all hair guides. ```APIDOC ## GetPointCount ### Description Returns the total number of points across all hair guides. ### Method GetPointCount ``` -------------------------------- ### CopyToUninitializedIf Source: https://developers.maxon.net/docs/cpp/2026_1_0/structmaxon_1_1details_1_1_copy_impl_selector_3_01true_01_4.html Copies elements from a source range [first, sentinel) to a destination starting at _dest, but only if the predicate _pred returns true for that element. The function returns a Result containing the updated destination iterator. ```APIDOC ## CopyToUninitializedIf ### Description Copies elements from a source range to a destination range if a predicate is met. The copying stops when the sentinel is reached or when the predicate returns false for an element. ### Signature ```cpp static auto CopyToUninitializedIf(ITERATOR _first, SENTINEL _sentinel, DEST_ITERATOR _dest, PREDICATE _pred) -> Result ``` ### Parameters * `_first`: An iterator pointing to the beginning of the source range. * `_sentinel`: A sentinel value marking the end of the source range. * `_dest`: An iterator pointing to the beginning of the destination range. * `_pred`: A predicate function that takes an element from the source range and returns a boolean. If true, the element is copied. ### Return Value A `Result` containing the updated destination iterator after the copy operation. ``` -------------------------------- ### KerningData::GetSelectionStart Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_kerning_data-members.html Gets the start index of the current selection. This is a const method. ```APIDOC ## KerningData::GetSelectionStart ### Description Returns the index marking the start of the current selection. ### Method GetSelectionStart() const ### Parameters None ### Returns Int32 - The start index of the selection. ``` -------------------------------- ### Implement a Simple Dialog with File Loading Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_getting_started_application.html This example demonstrates a dialog window with a button to select and load a text file. The loaded content is then displayed in a multi-line text field. ```cpp Bool CreateLayout() { SetTitle("Example Dialog"_s); GroupBegin(100, BFH_SCALEFIT, 2, 0, ""_s, 0, 0, 300); const Int32 style = DR_MULTILINE_WORDWRAP; AddMultiLineEditText(g_textID, BFH_SCALEFIT | BFV_TOP, 0, 200, style); AddButton(g_buttonID, BFH_SCALEFIT | BFV_TOP, 0, 10, "Load Text File"_s); GroupEnd(); return true; } ``` ```cpp Bool Command(Int32 id, const BaseContainer& msg) { switch (id) { // the button was pressed case (g_buttonID): { ApplicationOutput("The button was pressed"); // select file Filename selectedFile; if (selectedFile.FileSelect(FILESELECTTYPE::ANYTHING, FILESELECT::LOAD, "Load File"_s) == false) return true; const String loadedText = LoadTextFromFile(selectedFile); SetString(g_textID, loadedText); break; } } return true; } ``` -------------------------------- ### Create and Configure an Instance Object Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_manual_instanceobject.html Creates an InstanceObject, sets its reference object, and configures it for multi-instance rendering with a given matrix. ```cpp // This example creates an intance object that uses the given reference object and matrix object. // create instance object InstanceObject* const instance = InstanceObject::Alloc(); if (instance == nullptr) return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION); // insert object into the scene doc->InsertObject(instance, nullptr, nullptr); // use the given reference object instance->SetReferenceObject(reference) iferr_return; // use position data provided by the given matrix object if (!instance->SetParameter(ConstDescID(DescLevel(INSTANCEOBJECT_MULTIPOSITIONINPUT)), matrix, DESCFLAGS_SET::NONE)) return maxon::UnexpectedError(MAXON_SOURCE_LOCATION); if (!instance->SetParameter(ConstDescID(DescLevel(INSTANCEOBJECT_RENDERINSTANCE_MODE)), INSTANCEOBJECT_RENDERINSTANCE_MODE_MULTIINSTANCE, DESCFLAGS_SET::NONE)) return maxon::UnexpectedError(MAXON_SOURCE_LOCATION); NONE NONE ``` -------------------------------- ### BackgroundHandler Callback Example Source: https://developers.maxon.net/docs/cpp/2026_1_0/group__operatingsystem__callbacks__handlers.html Example implementation of a background handler callback function. This handler manages states for material preview, checking if it's running, stopping it, or starting it. ```cpp Bool Handler_ActiveMaterial(void *data, Int32 command, Int32 flags) { switch (command) { case BACKGROUNDHANDLERCOMMAND::ISRUNNING: { return world->materialpreview && world->materialpreview->IsRunning(); } break; case BACKGROUNDHANDLERCOMMAND::STOP: { if (flags&BACKGROUNDHANDLERFLAGS::MATERIALPREVIEW) { if (world->materialpreview) world->materialpreview->End(); } } break; case BACKGROUNDHANDLERCOMMAND::START: { return CheckActiveMaterialPreview(world->GetActiveDocument()); } } return true; } ``` -------------------------------- ### StartProcess Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_system_process_object_interface-members.html Starts the system process. ```APIDOC ## StartProcess ### Description Starts the system process. ### Method N/A ### Endpoint N/A ### Parameters None ### Response #### Success Response - **success** (boolean) - Indicates if the process was successfully started. ``` -------------------------------- ### Using a Factory to Create and Use an Instance Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_factories.html Demonstrates how to use a registered factory to create a new instance and then utilize its methods. This is the typical usage pattern after a factory has been defined. ```cpp // This example creates a new instance of StringHashInterface using a factory. // create new instance const StringHashRef stringHash = StringHashFromStringFactory().Create(secretText) iferr_return; // use new instance const maxon::Bool equal = stringHash.IsStringEqual("Hello World"_s) iferr_return; if (equal) DiagnosticOutput("The given string is equal to the secret string."); ``` -------------------------------- ### Object Identification and Spline Data Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_polygon_object.html Methods for getting the object's GUID and real spline. ```APIDOC ## GetGUID ### Description Retrieves the unique global identifier (GUID) of the object. ### Method `UInt64 GetGUID() const` ## GetRealSpline (Overload 1) ### Description Retrieves the real spline object associated with this object. ### Method `SplineObject * GetRealSpline()` ## GetRealSpline (Overload 2) ### Description Retrieves the real spline object associated with this object (const version). ### Method `const SplineObject * GetRealSpline() const` ``` -------------------------------- ### GetLineW() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_line_object.html Gets the start of the writable array of lines. The Line object owns the pointed array. ```APIDOC ## GetLineW() ### Description Gets the start of the writable array of lines. The size of the array is found calling PointObject::GetPointCount(). ### Returns - The first element in the array of writable lines. The Line object owns the pointed array. ``` -------------------------------- ### QueryString Example Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_configuration.html Shows how to retrieve a string value from the configuration database. This method is versatile as all configuration values are stored as strings. ```cpp String g_cellName = "unknown"_s; // default value String result; CONFIGURATIONENTRY_ORIGIN origin; CONFIGURATIONENTRY_STATE state; ifnoerr (Configuration::QueryString("g_cellName"_s, result, origin, state)) g_cellName = result; // only set value if no error occured ``` -------------------------------- ### GetLineR() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_line_object.html Gets the start of the read-only array of lines. The Line object owns the pointed array. ```APIDOC ## GetLineR() ### Description Gets the start of the read-only array of lines. The size of the array is found calling PointObject::GetPointCount(). ### Returns - The first element in the array of read-only lines. The Line object owns the pointed array. ``` -------------------------------- ### Init() [2/2] Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_scene_color_converter.html Initializes the color converter using an OCIO configuration and color space names. ```APIDOC ## Init() [2/2] ### Description Initializes the color converter. ### Method maxon::Result Init ### Parameters - **config** (const maxon::OcioConfig &) - in - The ocio to be used for conversion. - **inputColorSpaceLowName** (const maxon::CString &) - in - Name of the new input color space. - **inputColorSpaceHighName** (const maxon::CString &) - in - Name of the new input color space. - **renderColorSpaceName** (const maxon::CString &) - in - Name of the new input color space. - **flags** (CONVERSION_FLAGS) - in - Conversion flags. Defaults to `CONVERSION_FLAGS::ADD_UNDO`. ``` -------------------------------- ### Start UDP Server with Callback Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_udp.html Starts a UDP server that listens on a specified port. Incoming data is handled by the provided callback function. Ensure the AioService is started before creating the server. ```cpp // create AioServiceRef g_ioService = maxon::AioServiceRef::Create() iferr_return; g_ioService.Start() iferr_return; // create and start server auto localAddr = maxon::NetworkIpAddrPort(maxon::WILDCARD_IPV4_ADDRESS, 1000); g_udpServer = maxon::NetworkUdpInterface::CreateUdpServer(localAddr, UDPCallback, g_ioService) iferr_return; g_udpServer.Start() iferr_return; ``` -------------------------------- ### GetSegmentW() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_line_object.html Gets the start of the writable segments array. The Line object owns the pointed array. ```APIDOC ## GetSegmentW() ### Description Gets the start of the writable segments array. ### Returns - The first element in the array of writable segments. The Line object owns the pointed array. ``` -------------------------------- ### Using Directives Example Source: https://developers.maxon.net/docs/cpp/2026_1_0/manual_migrating_to_2025.html Demonstrates the use of 'using namespace maxon;' and a basic plugin class structure. This is useful for simplifying type access in your project. ```cpp using namespace maxon; class MyPlugin : public ObjectData { INSTANCEOF(MyPlugin, ObjectData) public: virtual Bool Init(GeListNode* node, Bool isCloneInit) { return true; } Result MyMethod() { iferr_scope; return OK; } // Is now an unambiguous definition and the compiler will not throw an error. Result Foo(const maxon::Asset& asset) { iferr_scope; return OK; } }; ``` -------------------------------- ### GetSegmentR() Source: https://developers.maxon.net/docs/cpp/2026_1_0/classcinema_1_1_line_object.html Gets the start of the read-only segments array. The Line object owns the pointed array. ```APIDOC ## GetSegmentR() ### Description Gets the start of the read-only segments array. ### Returns - The first element in the array of read-only segments. The Line object owns the pointed array. ``` -------------------------------- ### Construct and Load Image File Path Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_manual_filename.html This example shows how to construct the Filename for an image file located in the plugin's 'res' folder, check for its existence, load it into a BaseBitmap, and display it. ```cpp // This example constructs the Filename for an image file // in the plugin's "res" folder and loads this image. // construct full file name const Filename imageFile = GeGetPluginPath() + Filename("res") + Filename("arbitrary_icon.tif"); // check if the file exists if (!GeFExist(imageFile)) return maxon::UnexpectedError(MAXON_SOURCE_LOCATION); AutoAlloc bitmap; if (bitmap == nullptr) return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION); // load image file into the given BaseBitmap if (bitmap->Init(imageFile) != IMAGERESULT::OK) return maxon::UnknownError(MAXON_SOURCE_LOCATION); // show BaseBitmap in the Picture Viewer ShowBitmap(bitmap); ``` -------------------------------- ### Get Material Textures for Export Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_exchangemapper_material_export.html Returns an empty map as this example does not handle texture exports. ```cpp maxon::Result> SimpleMaterialExport::GetTextures(const maxon::HashSet& texturedChannels) { maxon::HashMap textures; // No textures to declare. return textures; } ``` -------------------------------- ### Init (URL) Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_sql_database_interface.html Initializes the SQL database connection using a URL to a SQL file. ```APIDOC ## Init (URL) ### Description Initializes the SQL database connection using a URL pointing to a SQL file and the database name. ### Method MAXON_METHOD ### Parameters - **sqlFile** (const Url &) - The URL to the SQL file. - **sqlDatabase** (const String &) - The name of the SQL database. ### Return Value Result< void > ``` -------------------------------- ### GetPart with Positive Position Source: https://developers.maxon.net/docs/cpp/2026_1_0/classmaxon_1_1_string_position.html Example of using GetPart to copy a substring starting from an absolute position. ```cpp res = str.GetPart(4, 3); // copy from position 4 on 3 characters ``` -------------------------------- ### Instantiate Preset Asset Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_handbook_assetapi_implement_preset_asset_type.html Demonstrates how to instantiate a preset asset by packing data into `PresetSaveArgs` and then saving it. This example initializes random points and saves them as a 'Dots Preset' asset. ```cpp maxon::Result InstantiateDotsPresetAsset() { iferr_scope; // Allocate the data. DotsData dotsData = DotsData(); // Init a pseudo random generator and add ten random points to the DotsData. maxon::LinearCongruentialRandom random; random.Init(static_cast(maxon::UniversalDateTime::GetNow().GetUnixTimestamp())); for (maxon::Int32 i = 0; i < 10; i++) { const maxon::Float32 x = random.Get01() * maxon::Float32(dotsData.canvasSize); const maxon::Float32 y = random.Get01() * maxon::Float32(dotsData.canvasSize); dotsData.points.Append(maxon::Vector(x, y, 0)) iferr_return; } // Pack the DotsData into a PresetSaveArgs. The type of data that must be packed depends on the // Preset Asset type implementation. maxon::PresetSaveArgs data(&dotsData, 0); const maxon::String typeName = maxon::AssetTypes::DotsPresetAsset().GetName(); const maxon::String name ("Manually Instantiated Dots Preset"); // Save the data as a preset asset. maxon::AssetDescription asset = maxon::AssetCreationInterface::SaveBrowserPreset( maxon::AssetTypes::DotsPresetAsset(), data, typeName, name, false, false, false) iferr_return; return asset; } ``` -------------------------------- ### Create, Start, and Close Custom Thread Source: https://developers.maxon.net/docs/cpp/2026_1_0/page_maxonapi_threading_threads.html This example demonstrates the lifecycle of a custom thread: creating it, starting its execution, and handling its closure or cancellation. It includes error checking using 'iferr_return' and retrieving results. ```cpp // This example shows how the custom thread is created, started and closed. if (!g_calculatePiThread) { // create and start thread g_calculatePiThread = CalculatePiThread::Create() iferr_return; g_calculatePiThread.Start() iferr_return; } else { // cancel thread if it is still running g_calculatePiThread->CancelAndWait(); // get result const maxon::Float pi = g_calculatePiThread->GetPI() iferr_return; // print result with 20 digits after the comma DiagnosticOutput("PI: @", maxon::String::FloatToString(pi, 1, 20)); // clear thread g_calculatePiThread = nullptr; } ```