### Register and Run 2024 Migration Examples Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Contains boilerplate code for registering and running the 2024 migration examples within Cinema 4D. This is essential for executing the provided examples. ```cpp #include // Boilerplate code for plugin registration and example execution. // This file (_migration_example_plugin.cpp) is not a direct example of API usage, // but rather the setup for running other examples. ``` -------------------------------- ### Casting Style Recommendations Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Outlines the slightly changed style recommendations for casting between data types in C++. Follow these guidelines for consistent and modern C++ code. ```cpp // Example of recommended casting style (e.g., using static_cast, reinterpret_cast): // int intValue = 10; // float floatValue = static_cast(intValue); // Avoid C-style casts where possible: // float floatValue = (float)intValue; // Less preferred ``` -------------------------------- ### Construct DescID Identifiers (Compile-time and Runtime) Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates how to construct DescID identifiers, both at compile-time and runtime. Use this when referencing parameters or attributes. ```cpp // Example of constructing DescID at compile-time: const DescID id_compile_time = DescLevel(ID_MY_PARAMETER, 0, DESC_NONE); // Example of constructing DescID at runtime: DescID id_runtime; id_runtime.idFromInt(12345); // Using an integer ID ``` -------------------------------- ### Access Scene Element Data Container Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates how to access the data container of scene elements. This is useful for retrieving or modifying element properties. ```cpp // Assuming 'node' is a pointer to a scene element (e.g., BaseObject*) // Accessing the data container: maxon::DataContainer dataContainer = node->GetDataContainer(); ``` -------------------------------- ### Access Node Branches (Changed Syntax) Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates the slightly changed syntax for accessing node branches in the 2024 API. Use this when navigating node hierarchies. ```cpp // Example of accessing a node branch (syntax may have minor changes in 2024): // Assuming 'node' is a BaseNode* and 'branchName' is the name of the branch. // maxon::NodeBranch branch = node->GetBranch(branchName); ``` -------------------------------- ### Use AttributeTuple for Performant Data Storage Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates the new and performant type `maxon::AttributeTuple` for storing and indexing data with compile-time known `MAXON_ATTRIBUTE` keys. This is a more efficient alternative to dictionaries for certain use cases. ```cpp #include // Example of using AttributeTuple: maxon::AttributeTuple tuple; // Define an attribute key (must be known at compile-time) MAXON_ATTRIBUTE(MyAttribute, Int32); tuple.Set(123); Int32 value = tuple.Get(); ``` -------------------------------- ### Copy-on-Write for VariableTag and BaseSelect Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates the copy-on-write changes made to VariableTag and BaseSelect in the 2024 API. This affects how these objects are modified. ```cpp // Example illustrating copy-on-write behavior: // VariableTag tag = ...; // BaseSelect selection = ...; // When modifying 'tag' or 'selection', a copy might be created internally // if the object is shared, ensuring the original remains unchanged. // Specific usage will depend on the API calls made. ``` -------------------------------- ### Legacy NodeData Plugin (Pre-2024.0) Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Exemplifies a NodeData derived plugin in a pre-2024.0 API state, intended for conversion. This serves as a reference for what needs updating. ```cpp #include // ... NodeData derived plugin code (pre-2024.0 API) ... ``` -------------------------------- ### Access Custom Data Type Fields Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates how to access custom data type fields within BaseContainer and GeData instances. Use this when working with custom data structures. ```cpp // Accessing custom data in BaseContainer: BaseContainer bc; // bc.SetCustom(...); // MyCustomType customData = bc.GetCustom(); // Accessing custom data in GeData: GeData gd; // gd.SetCustom(...); // MyCustomType customData = gd.GetCustom(); ``` -------------------------------- ### Gradient Sampling Changes Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates the changes made to Gradient sampling in the 2024 API. This affects how gradient colors and alpha values are retrieved over time. ```cpp // Example of gradient sampling (API may have changed): // Gradient gradient = ...; // Float time = 0.5; // Vector color = gradient.SampleColor(time); // Float alpha = gradient.SampleAlpha(time); ``` -------------------------------- ### Migrate NodeData Plugin to 2024 API Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates common changes for a NodeData derived plugin migrated to the 2024 API. Use this when updating existing NodeData plugins. ```cpp #include // ... NodeData derived plugin code ... // Example of a change that might be needed: // Old: BaseContainer* data = GetNodeData(node); // New: maxon::DataContainer data = GetNodeData(node); ``` -------------------------------- ### Field Object Sampling Changes Source: https://github.com/maxon-computer/cinema-4d-cpp-api-examples/blob/master/plugins/example.migration_2024/README.md Demonstrates the changes made to FieldObject sampling in the 2024 API. This affects how field values are queried at specific points. ```cpp // Example of field object sampling (API may have changed): // FieldObject field = ...; // Vector position = Vector(10.0, 20.0, 30.0); // Float strength = field.Sample(position); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.