diff --git a/plugins/example.assets/project/projectdefinition.txt b/plugins/example.assets/project/projectdefinition.txt index 9cd931e..52f3432 100644 --- a/plugins/example.assets/project/projectdefinition.txt +++ b/plugins/example.assets/project/projectdefinition.txt @@ -1,7 +1,11 @@ -Platform=Win64;OSX +// The platforms this project is targeting - can be [Win64;OSX;Linux]. +Platform=Win64;OSX;Linux + +// Type of project - can be [Lib;DLL;App]. Type=DLL -// API dependencies +// The frameworks dependencies of this project as shipped in the frameworks folder of an SDK. You can only include +// header files from frameworks that are listed here. APIS=\ asset.framework;\ cinema.framework;\ @@ -13,12 +17,14 @@ graph.framework;\ image.framework;\ neutron.framework;\ nodes.framework;\ -nodespace.framework;\ +nodespace.framework -// C4D component +// If this is a classic API plugin, enabling some classic API features and disabling automatic style checks. C4D=true stylecheck.level=3 -// Custom ID +// The ID of the module/plugin which is being compiled. You should use here the "net.mycompany.myplugin" format. +// You cannot use a module ID of the format "net.maxon.myplugin" as this domain is reserved for Maxon and plugins +// ignoring this will not be loaded. ModuleId=net.maxonexample.assets diff --git a/plugins/example.assets/source/asset_api_examples/examples_databases.cpp b/plugins/example.assets/source/asset_api_examples/examples_databases.cpp index 824c81f..f68f420 100644 --- a/plugins/example.assets/source/asset_api_examples/examples_databases.cpp +++ b/plugins/example.assets/source/asset_api_examples/examples_databases.cpp @@ -178,7 +178,7 @@ maxon::Result AddOrGetDatabase(const maxon::Url& url if (GeIsMainThread()) EventAdd(); - return std::move(newDatabase); + return newDatabase; } //! [add_database] @@ -466,7 +466,7 @@ maxon::Result CopyAsset(const maxon::AssetRepositoryRef maxon::CategoryAssetInterface::SetAssetCategory(assetCopy, categoryId) iferr_return; } - return std::move(assetCopy); + return assetCopy; } //! [copy_asset] diff --git a/plugins/example.assets/source/asset_api_examples/examples_metadata.cpp b/plugins/example.assets/source/asset_api_examples/examples_metadata.cpp index 2d9ebe0..3411d0c 100644 --- a/plugins/example.assets/source/asset_api_examples/examples_metadata.cpp +++ b/plugins/example.assets/source/asset_api_examples/examples_metadata.cpp @@ -171,7 +171,7 @@ maxon::Result AddAssetVersion( ApplicationOutput("Original asset: @", asset); ApplicationOutput("Added asset version: @", assetVersion); - return std::move(assetVersion); + return assetVersion; } //! [add_asset_version] diff --git a/plugins/example.assets/source/dots_preset_asset_impl/dots_preset_asset.cpp b/plugins/example.assets/source/dots_preset_asset_impl/dots_preset_asset.cpp index 4d54731..f792cbe 100644 --- a/plugins/example.assets/source/dots_preset_asset_impl/dots_preset_asset.cpp +++ b/plugins/example.assets/source/dots_preset_asset_impl/dots_preset_asset.cpp @@ -279,7 +279,7 @@ MAXON_METHOD maxon::Result DotsPresetAssetTypeImpl::Load( // Making use of the Init() implementation provided above in DotsPresetAssetImpl to load an // asset from its asset description and url. maxon::Asset asset = DotsPresetAssetImpl::CreateInit(assetDescription, url) iferr_return; - return std::move(asset); + return asset; } MAXON_METHOD maxon::Bool DotsPresetAssetTypeImpl::LoadPreset( diff --git a/plugins/example.assets/source/dots_preset_asset_impl/examples_dots.cpp b/plugins/example.assets/source/dots_preset_asset_impl/examples_dots.cpp index 46a9fe2..7586f65 100644 --- a/plugins/example.assets/source/dots_preset_asset_impl/examples_dots.cpp +++ b/plugins/example.assets/source/dots_preset_asset_impl/examples_dots.cpp @@ -104,7 +104,7 @@ maxon::Result InstantiateDotsPresetAsset() maxon::AssetDescription asset = maxon::AssetCreationInterface::SaveBrowserPreset( maxon::AssetTypes::DotsPresetAsset(), data, typeName, name, false, false, false) iferr_return; - return std::move(asset); + return asset; } //! [instantiate_dots_preset_asset] diff --git a/plugins/example.image/project/projectdefinition.txt b/plugins/example.image/project/projectdefinition.txt index e2c029a..9ddbd13 100644 --- a/plugins/example.image/project/projectdefinition.txt +++ b/plugins/example.image/project/projectdefinition.txt @@ -1,6 +1,11 @@ -Platform=Win64;OSX +// The platforms this project is targeting - can be [Win64;OSX;Linux]. +Platform=Win64;OSX;Linux + +// Type of project - can be [Lib;DLL;App]. Type=DLL +// The frameworks dependencies of this project as shipped in the frameworks folder of an SDK. You can only include +// header files from frameworks that are listed here. // API dependencies APIS=\ asset.framework;\ @@ -13,12 +18,14 @@ graph.framework;\ image.framework;\ neutron.framework;\ nodes.framework;\ -nodespace.framework;\ +nodespace.framework -// C4D component +// If this is a classic API plugin, enabling some classic API features and disabling automatic style checks. C4D=true stylecheck.level=3 -// Custom ID +// The ID of the module/plugin which is being compiled. You should use here the "net.mycompany.myplugin" format. +// You cannot use a module ID of the format "net.maxon.myplugin" as this domain is reserved for Maxon and plugins +// ignoring this will not be loaded. ModuleId=net.maxonexample.image diff --git a/plugins/example.main/project/projectdefinition.txt b/plugins/example.main/project/projectdefinition.txt index bde7491..0939043 100644 --- a/plugins/example.main/project/projectdefinition.txt +++ b/plugins/example.main/project/projectdefinition.txt @@ -1,10 +1,11 @@ -// Supported platforms - can be [Win64;OSX] -Platform=Win64;OSX +// The platforms this project is targeting - can be [Win64;OSX;Linux]. +Platform=Win64;OSX;Linux -// Type of project - can be [Lib;DLL;App] +// Type of project - can be [Lib;DLL;App]. Type=DLL -// API dependencies +// The frameworks dependencies of this project as shipped in the frameworks folder of an SDK. You can only include +// header files from frameworks that are listed here. APIS=\ asset.framework;\ cinema.framework;\ @@ -17,14 +18,16 @@ image.framework; \ math.framework; \ misc.framework; \ mesh_misc.framework; \ -python.framework; +python.framework -// C4D component +// If this is a classic API plugin, enabling some classic API features and disabling automatic style checks. C4D=true stylecheck.level=3 // must be set after c4d=true stylecheck.enum-registration=false stylecheck.enum-class=false -// Custom ID -ModuleId=net.maxonexample.main +// The ID of the module/plugin which is being compiled. You should use here the "net.mycompany.myplugin" format. +// You cannot use a module ID of the format "net.maxon.myplugin" as this domain is reserved for Maxon and plugins +// ignoring this will not be loaded. +ModuleId=net.maxonexample.main \ No newline at end of file diff --git a/plugins/example.main/source/gui/activeobject.cpp b/plugins/example.main/source/gui/activeobject.cpp index d28572b..3d68963 100644 --- a/plugins/example.main/source/gui/activeobject.cpp +++ b/plugins/example.main/source/gui/activeobject.cpp @@ -3,9 +3,7 @@ // be sure to use a unique ID obtained from www.plugincafe.com #define ID_ACTIVEOBJECT 1000472 -#include "c4d.h" -#include "c4d_symbols.h" -#include "main.h" +#include "activeobject.h" #include "maxon/sortedarray.h" #include "maxon/utilities/sprintf_safe.h" #include "maxon/weakrawptr.h" @@ -769,16 +767,23 @@ class Function2 : public TreeViewFunctions switch (lColumn) { case 'tree': - if (link && link->GetType() == ID_LISTHEAD) + if (link) { - bc->InsData(REFRESH_TREE, GeData("Refresh Tree")); - } - else if (link && link->IsInstanceOf(Obase)) - { - bc->InsData(SHOW_OBJECT_INFORMATION, GeData("Show object information...")); - bc->InsData(EXTRACT_OBJECT_TO_SCENE, GeData("Extract to scene")); + if (link->GetType() == ID_LISTHEAD) + { + bc->InsData(REFRESH_TREE, GeData("Refresh Tree")); + } + else if (link->IsInstanceOf(Obase)) + { + bc->InsData(SHOW_OBJECT_INFORMATION, GeData("Show object information...")); + bc->InsData(EXTRACT_OBJECT_TO_SCENE, GeData("Extract to scene")); + } + else if (link->IsInstanceOf(Tvariable)) + { + bc->InsData(SHOW_VARIABLE_TAG_DATA, GeData("Show variable tag dat")); + } } - + if (node->ptr) { bc->InsData(COPY_ADDRESS, GeData("Copy Address")); @@ -859,6 +864,15 @@ class Function2 : public TreeViewFunctions break; } + case SHOW_VARIABLE_TAG_DATA: + { + if (link && link->IsInstanceOf(Tvariable)) + { + const VariableTag* tag = static_cast(link); + ShowVariableTagDataDialog(tag); + } + break; + } } return true; @@ -869,6 +883,7 @@ class Function2 : public TreeViewFunctions static const Int32 SHOW_OBJECT_INFORMATION = ID_TREEVIEW_FIRST_NEW_ID + 2; static const Int32 EXTRACT_OBJECT_TO_SCENE = ID_TREEVIEW_FIRST_NEW_ID + 3; static const Int32 COPY_ADDRESS = ID_TREEVIEW_FIRST_NEW_ID + 4; + static const Int32 SHOW_VARIABLE_TAG_DATA = ID_TREEVIEW_FIRST_NEW_ID + 5; }; Function2 g_functable; diff --git a/plugins/example.main/source/gui/activeobject.h b/plugins/example.main/source/gui/activeobject.h new file mode 100644 index 0000000..17195fb --- /dev/null +++ b/plugins/example.main/source/gui/activeobject.h @@ -0,0 +1,10 @@ +#ifndef ACTIVEOBJECT_H__ +#define ACTIVEOBJECT_H__ + +#include "c4d.h" +#include "c4d_symbols.h" +#include "main.h" + +void ShowVariableTagDataDialog(const VariableTag* tag); + +#endif // ACTIVEOBJECT_H__ \ No newline at end of file diff --git a/plugins/example.main/source/gui/activeobject_variabletag.cpp b/plugins/example.main/source/gui/activeobject_variabletag.cpp new file mode 100644 index 0000000..0b5d737 --- /dev/null +++ b/plugins/example.main/source/gui/activeobject_variabletag.cpp @@ -0,0 +1,498 @@ +// example code for a menu/manager plugin + +// be sure to use a unique ID obtained from www.plugincafe.com +#define ID_VARIABLE_TAG_DIALOG 450000282 + +#include +#include "activeobject.h" + +enum +{ + IDC_VARIABLE_TAG_INFO1 = 1000, + IDC_VARIABLE_TAG_INFO2, + IDC_VARIABLE_TAG_NUM_COLS, + IDC_VARIABLE_TAG_NUM_ROWS, + IDC_VARIABLE_TAG_NUM_ROW_OFFSET, + IDC_VARIABLE_TAG_DATA_FORMAT, + IDC_VARIABLE_TAG_FLOAT_PRECISION, + IDC_VARIABLE_TAG_DATA_TREE, + IDC_VARIABLE_TAG_COLUMN_WIDTH, + + IDC_MEMORY_STAT_ +}; + +class VariableTagDataTreeViewFunctions : public TreeViewFunctions +{ +public: + enum class DATA_TYPE + { + NONE = 0, + FLOAT32 = 1 << 0, + INT32 = 1 << 1, + UINT32 = 1 << 2, + HEX32 = 1 << 3, + VECTOR32 = 1 << 4, + VECTOR64 = 1 << 5, + POLYGON = 1 << 6, + GENERIC_HEX = 1 << 7 + } MAXON_ENUM_FLAGS_CLASS(DATA_TYPE); + + struct TagData + { + const VariableTag* tag = nullptr; + Int32 type = 0; + Int32 dataCount = 0; + Int32 dataSize = 0; + const void* data = nullptr; + + Int32 columnWidth = 50; + Int32 numRows = 1; + Int32 numColumns = 1; + Int32 rowOffset = 0; + DATA_TYPE dataType = DATA_TYPE::FLOAT32; + DATA_TYPE allowedDataType = DATA_TYPE::NONE; + + char floatLayout[10]; + }; + + inline void* LineIndexToVoid(Int32 index) { return (void*)((Int)(index + 1)); } + inline Int32 VoidToLineIndex(const void* p) { return (Int32)(((Int)p) - 1); } + + virtual void* GetFirst(void* root, void* userdata) + { + const TagData* tagData = static_cast(root); + return tagData->data ? LineIndexToVoid(tagData->rowOffset) : nullptr; + } + + virtual void* GetNext(void* root, void* userdata, void* obj) + { + const TagData* tagData = static_cast(root); + Int32 lineIndex = VoidToLineIndex(obj); + if (lineIndex < Min((tagData->dataCount + tagData->numColumns) / tagData->numColumns, tagData->rowOffset + tagData->numRows) - 1) + return LineIndexToVoid(lineIndex + 1); + return nullptr; + } + + virtual void* GetPred(void* root, void* userdata, void* obj) + { + Int32 lineIndex = VoidToLineIndex(obj); + if (lineIndex > 0) + return LineIndexToVoid(lineIndex - 1); + return nullptr; + } + + virtual void* GetDown(void* root, void* userdata, void* obj) + { + return nullptr; + } + + virtual Bool IsSelected(void* root, void* userdata, void* obj) + { + return false; + } + + virtual String GetName(void* root, void* userdata, void* obj) + { + const TagData* tagData = static_cast(root); + Int32 lineIndex = VoidToLineIndex(obj); + + return FormatString("@", lineIndex * tagData->numColumns); + } + + virtual Int GetId(void* root, void* userdata, void* obj) + { + return (Int)obj; + } + + virtual Bool IsOpened(void* root, void* userdata, void* obj) + { + return false; + } + + virtual void Open(void* root, void* userdata, void* obj, Bool onoff) + { + } + + virtual void Select(void* root, void* userdata, void* obj, Int32 mode) + { + } + + virtual Int32 AcceptDragObject(void* root, void* userdata, void* obj, Int32 dragtype, void* dragobject, Bool& bAllowCopy) + { + return 0; + } + + virtual void InsertObject(void* root, void* userdata, void* obj, Int32 dragtype, void* dragobject, Int32 insertmode, Bool bCopy) + { + } + + virtual Int32 GetDragType(void* root, void* userdata, void* obj) + { + return NOTOK; + } + + virtual Int32 DoubleClick(void* root, void* userdata, void* obj, Int32 col, MouseInfo* mouseinfo) + { + return false; + } + + virtual Bool MouseDown(void* root, void* userdata, void* obj, Int32 col, MouseInfo* mouseinfo, Bool rightButton) + { + return false; + } + + virtual Int32 GetHeaderColumnWidth(void* root, void* userdata, Int32 col, GeUserArea* ua) + { + const TagData* tagData = static_cast(root); + if (col == 'tree') + return ua ? ua->DrawGetTextWidth("wwwww"_s) : 100; + return tagData->columnWidth; + } + + virtual Int32 GetColumnWidth(void* root, void* userdata, void* obj, Int32 col, GeUserArea* pArea) + { + const TagData* tagData = static_cast(root); + if (col == 'tree') + return pArea ? pArea->DrawGetTextWidth("wwwww"_s) : 100; + return tagData->columnWidth; + } + + virtual Int32 GetLineHeight(void* root, void* userdata, void* obj, Int32 col, GeUserArea* pArea) + { + return pArea->DrawGetFontHeight(); + } + + Bool DrawHeaderCell(void* root, void* userdata, Int32 col, DrawInfo* drawinfo) + { + String name; + drawinfo->frame->DrawSetPen(COLOR_BG); + drawinfo->frame->DrawRectangle(drawinfo->xpos, drawinfo->ypos, drawinfo->xpos + drawinfo->width - 1, drawinfo->ypos + drawinfo->height - 1); + drawinfo->frame->DrawSetFont(FONT_STANDARD); + + if (col == 'tree') + name = "Offset"_s; + else + name = FormatString("@", col); + + drawinfo->frame->DrawSetTextCol(COLOR_TEXT, COLOR_BG); + drawinfo->frame->DrawText(name, drawinfo->xpos + 4, drawinfo->ypos); + + drawinfo->frame->DrawSetPen(COLOR_EDGEWH); + drawinfo->frame->DrawLine(drawinfo->xpos, drawinfo->ypos, drawinfo->xpos + drawinfo->width - 1, drawinfo->ypos); + drawinfo->frame->DrawLine(drawinfo->xpos, drawinfo->ypos, drawinfo->xpos, drawinfo->ypos + drawinfo->height - 1); + + drawinfo->frame->DrawSetPen(COLOR_EDGEDK); + drawinfo->frame->DrawLine(drawinfo->xpos + drawinfo->width - 1, drawinfo->ypos, drawinfo->xpos + drawinfo->width - 1, drawinfo->ypos + drawinfo->height - 1); + drawinfo->frame->DrawLine(drawinfo->xpos, drawinfo->ypos + drawinfo->height - 1, drawinfo->xpos + drawinfo->width - 1, drawinfo->ypos + drawinfo->height - 1); + + return true; + } + + virtual void DrawCell(void* root, void* userdata, void* obj, Int32 col, DrawInfo* drawinfo, const GeData& bgColor) + { + const TagData* tagData = static_cast(root); + Int32 lineIndex = VoidToLineIndex(obj); + Int32 dataIndex = lineIndex * tagData->numColumns + col; + if (dataIndex >= 0 && dataIndex < tagData->dataCount) + { + Int32 wx, wy, wh, ww; + wx = drawinfo->xpos; + wy = drawinfo->ypos; + ww = drawinfo->width; + wh = drawinfo->height; + + const void* data = (const void*)((UInt)(tagData->data) + dataIndex * tagData->dataSize); + drawinfo->frame->DrawSetTextCol(COLOR_TEXT, bgColor); + String t; + switch (tagData->dataType) + { + case DATA_TYPE::FLOAT32: + t = FormatString(tagData->floatLayout, *static_cast(data)); + break; + case DATA_TYPE::INT32: + t = FormatString("@", *static_cast(data)); + break; + case DATA_TYPE::UINT32: + t = FormatString("@", *static_cast(data)); + break; + case DATA_TYPE::HEX32: + t = FormatString("@{x}", *static_cast(data)); + break; + case DATA_TYPE::VECTOR32: + { + const Vector32& p = *static_cast(data); + t += FormatString(tagData->floatLayout, p.x); + t += ", "; + t += FormatString(tagData->floatLayout, p.y); + t += ", "; + t += FormatString(tagData->floatLayout, p.z); + break; + } + case DATA_TYPE::VECTOR64: + { + const Vector64& p = *static_cast(data); + t += FormatString(tagData->floatLayout, p.x); + t += ", "; + t += FormatString(tagData->floatLayout, p.y); + t += ", "; + t += FormatString(tagData->floatLayout, p.z); + break; + } + case DATA_TYPE::POLYGON: + { + const CPolygon& p = *static_cast(data); + if (p.c == p.d) + t = FormatString("@, @, @", p.a, p.b, p.c); + else + t = FormatString("@, @, @, @", p.a, p.b, p.c, p.d); + break; + } + case DATA_TYPE::GENERIC_HEX: + { + const UChar* c = static_cast(data); + for (Int32 i = 0; i < tagData->dataSize; ++i) + t += FormatString("@{x}", c[i]); + break; + } + default: + t = "??"_s; + break; + } + drawinfo->frame->SetClippingRegion(wx, wy, ww, wh); + drawinfo->frame->DrawText(t, wx, wy); + drawinfo->frame->ClearClippingRegion(); + } + } + + virtual void CreateContextMenu(void* root, void* userdata, void* obj, Int32 lColumn, BaseContainer* bc) + { + } + + Bool ContextMenuCall(void* root, void* userdata, void* obj, Int32 lColumn, Int32 lCommand) + { + return false; + } +}; + +static VariableTagDataTreeViewFunctions g_variableTagDataFunctable; + +class VariableTagDataDialog : public GeDialog +{ +public: + explicit VariableTagDataDialog(const VariableTag* tag); + virtual Bool CreateLayout(); + + virtual Bool InitValues(); + virtual Bool Command(Int32 id, const BaseContainer& msg); + virtual Int32 Message(const BaseContainer& msg, BaseContainer& result); + virtual Bool CoreMessage (Int32 id, const BaseContainer& msg); + +private: + void SetTreeLayout(); + + const VariableTag* _tag; + VariableTagDataTreeViewFunctions::TagData _tagData; + TreeViewCustomGui* _tree = nullptr; + VariableTagDataTreeViewFunctions::DATA_TYPE _preferredDataType = VariableTagDataTreeViewFunctions::DATA_TYPE::NONE; +}; + +VariableTagDataDialog::VariableTagDataDialog(const VariableTag* tag) : + _tag(tag) +{ + _tagData.tag = tag; + _tagData.type = tag->GetType(); + _tagData.dataCount = tag->GetDataCount(); + _tagData.dataSize = tag->GetDataSize(); + _tagData.data = tag->GetLowlevelDataAddressR(); + + if (_tagData.dataSize == 4) + _tagData.allowedDataType |= VariableTagDataTreeViewFunctions::DATA_TYPE::FLOAT32 | VariableTagDataTreeViewFunctions::DATA_TYPE::INT32 | + VariableTagDataTreeViewFunctions::DATA_TYPE::UINT32 | VariableTagDataTreeViewFunctions::DATA_TYPE::HEX32; + else if (_tagData.dataSize == 12) + _tagData.allowedDataType |= VariableTagDataTreeViewFunctions::DATA_TYPE::VECTOR32; + else if (_tagData.dataSize == 24) + _tagData.allowedDataType |= VariableTagDataTreeViewFunctions::DATA_TYPE::VECTOR64; + else if (_tagData.dataSize == 16) + _tagData.allowedDataType |= VariableTagDataTreeViewFunctions::DATA_TYPE::POLYGON; + + _tagData.allowedDataType |= VariableTagDataTreeViewFunctions::DATA_TYPE::GENERIC_HEX; +} + +Bool VariableTagDataDialog::CreateLayout() +{ + // First call the parent instance. + Bool res = GeDialog::CreateLayout(); + + SetTitle("Variable tag data"_s); + AddStaticText(IDC_VARIABLE_TAG_INFO1, BFH_SCALEFIT, 0, 0, ""_s, 0); + AddStaticText(IDC_VARIABLE_TAG_INFO2, BFH_SCALEFIT, 0, 0, ""_s, 0); + GroupBegin(0, BFH_SCALEFIT, 6, 0, String(), 0); + { + AddStaticText(0, BFH_FIT, 0, 0, "Colums:"_s, 0); + AddEditNumberArrows(IDC_VARIABLE_TAG_NUM_COLS, 0); + AddStaticText(0, BFH_FIT, 0, 0, "Rows:"_s, 0); + AddEditNumberArrows(IDC_VARIABLE_TAG_NUM_ROWS, 0); + AddStaticText(0, BFH_FIT, 0, 0, "Row Offset:"_s, 0); + AddEditNumberArrows(IDC_VARIABLE_TAG_NUM_ROW_OFFSET, 0); + } + GroupEnd(); + + GroupBegin(0, BFH_SCALEFIT, 3, 0, String(), 0); + { + GroupBegin(0, BFH_LEFT, 2, 0, String(), 0); + { + AddStaticText(0, BFH_LEFT, 0, 0, "Show data as:"_s, 0); + AddComboBox(IDC_VARIABLE_TAG_DATA_FORMAT, BFH_FIT); + #define ADD_IF_ALLOWED(type, s) \ + if (_tagData.allowedDataType & VariableTagDataTreeViewFunctions::DATA_TYPE::type) { \ + AddChild(IDC_VARIABLE_TAG_DATA_FORMAT, (Int32)VariableTagDataTreeViewFunctions::DATA_TYPE::type, s); \ + if (_preferredDataType == VariableTagDataTreeViewFunctions::DATA_TYPE::NONE) _preferredDataType = VariableTagDataTreeViewFunctions::DATA_TYPE::type; } + + ADD_IF_ALLOWED(FLOAT32, "Float32"_s); + ADD_IF_ALLOWED(INT32, "Int32"_s); + ADD_IF_ALLOWED(UINT32, "UInt32"_s); + ADD_IF_ALLOWED(HEX32, "32 bit hex"_s); + ADD_IF_ALLOWED(VECTOR32, "Vector32"_s); + ADD_IF_ALLOWED(VECTOR64, "Vector64"_s); + ADD_IF_ALLOWED(POLYGON, "Polygon"_s); + ADD_IF_ALLOWED(GENERIC_HEX, "Generic hex"_s); + } + GroupEnd(); + + GroupBegin(0, BFH_SCALEFIT, 2, 0, String(), 0); + { + AddStaticText(0, BFH_LEFT, 0, 0, "Float precision:"_s, 0); + AddEditNumberArrows(IDC_VARIABLE_TAG_FLOAT_PRECISION, 0); + } + GroupEnd(); + + GroupBegin(0, BFH_RIGHT, 2, 0, String(), 0); + { + AddStaticText(0, BFH_FIT, 0, 0, "Column width:"_s, 0); + AddEditNumberArrows(IDC_VARIABLE_TAG_COLUMN_WIDTH, 0); + } + GroupEnd(); + } + GroupEnd(); + + BaseContainer treedata; + treedata.SetBool(TREEVIEW_BORDER, true); + treedata.SetBool(TREEVIEW_HAS_HEADER, true); + treedata.SetBool(TREEVIEW_RESIZE_HEADER, true); + treedata.SetBool(TREEVIEW_FIXED_LAYOUT, true); + treedata.SetBool(TREEVIEW_ALTERNATE_BG, true); + _tree = (TreeViewCustomGui*)AddCustomGui(IDC_VARIABLE_TAG_DATA_TREE, CUSTOMGUI_TREEVIEW, String(), BFH_SCALEFIT | BFV_SCALEFIT, 0, 0, treedata); + if (!_tree) + return false; + + SetTreeLayout(); + + return res; +} + +Bool VariableTagDataDialog::InitValues() +{ + // First call the parent instance. + if (!GeDialog::InitValues()) + return false; + + const int defaultFloatPrecision = 2; + _tagData.numColumns = 16; + _tagData.numRows = 16; + _tagData.rowOffset = 0; + _tagData.columnWidth = 50; + _tagData.dataType = _preferredDataType; + snprintf(_tagData.floatLayout, SIZEOF(_tagData.floatLayout), "@{.%d}", defaultFloatPrecision); + + SetString(IDC_VARIABLE_TAG_INFO1, FormatString("Tag Name: \"@\", Type: @, Address: 0x@", _tagData.tag->GetName(), _tagData.type, (void*)_tagData.tag)); + SetString(IDC_VARIABLE_TAG_INFO2, FormatString("Data address: 0x@, Count: @, Size: @", _tagData.data, _tagData.dataCount, _tagData.dataSize)); + SetInt32(IDC_VARIABLE_TAG_NUM_COLS, _tagData.numColumns, 1, 32); + SetInt32(IDC_VARIABLE_TAG_NUM_ROWS, _tagData.numRows, 1, LIMIT::MAX); + SetInt32(IDC_VARIABLE_TAG_NUM_ROW_OFFSET, _tagData.rowOffset, 0, LIMIT::MAX); + SetInt32(IDC_VARIABLE_TAG_DATA_FORMAT, (Int32)_preferredDataType); + SetInt32(IDC_VARIABLE_TAG_COLUMN_WIDTH, _tagData.columnWidth, 30); + SetInt32(IDC_VARIABLE_TAG_FLOAT_PRECISION, defaultFloatPrecision, 0, 20); + + SetTreeLayout(); + + _tree->SetRoot(&_tagData, &g_variableTagDataFunctable, this); + _tree->Refresh(); + + return true; +} + +void VariableTagDataDialog::SetTreeLayout() +{ + BaseContainer layout; + Int32 numColumns = 16; + GetInt32(IDC_VARIABLE_TAG_NUM_COLS, numColumns); + + layout.SetInt32('tree', LV_TREE); + for (Int32 c = 0; c < numColumns; ++c) + layout.SetInt32(c, LV_USER); + _tree->SetLayout(1 + numColumns, layout); +} + +Bool VariableTagDataDialog::Command(Int32 id, const BaseContainer& msg) +{ + switch (id) + { + case IDC_VARIABLE_TAG_NUM_COLS: + GetInt32(IDC_VARIABLE_TAG_NUM_COLS, _tagData.numColumns); + SetTreeLayout(); + _tree->SetRoot(&_tagData, &g_variableTagDataFunctable, this); + _tree->Refresh(); + break; + + case IDC_VARIABLE_TAG_NUM_ROWS: + GetInt32(IDC_VARIABLE_TAG_NUM_ROWS, _tagData.numRows); + _tree->Refresh(); + break; + + case IDC_VARIABLE_TAG_NUM_ROW_OFFSET: + GetInt32(IDC_VARIABLE_TAG_NUM_ROW_OFFSET, _tagData.rowOffset); + _tree->Refresh(); + break; + + case IDC_VARIABLE_TAG_DATA_FORMAT: + { + Int32 dataType = 0; + GetInt32(IDC_VARIABLE_TAG_DATA_FORMAT, dataType); + _tagData.dataType = (VariableTagDataTreeViewFunctions::DATA_TYPE)dataType; + _tree->Refresh(); + break; + } + + case IDC_VARIABLE_TAG_COLUMN_WIDTH: + GetInt32(IDC_VARIABLE_TAG_COLUMN_WIDTH, _tagData.columnWidth); + _tree->Refresh(); + break; + + case IDC_VARIABLE_TAG_FLOAT_PRECISION: + { + Int32 precision = 0; + GetInt32(IDC_VARIABLE_TAG_FLOAT_PRECISION, precision); + snprintf(_tagData.floatLayout, SIZEOF(_tagData.floatLayout), "@{.%d}", precision); + _tree->Redraw(); + break; + } + } + + return true; +} + +Int32 VariableTagDataDialog::Message(const BaseContainer& msg, BaseContainer& result) +{ + return GeDialog::Message(msg, result); +} + +Bool VariableTagDataDialog::CoreMessage(Int32 id, const BaseContainer& msg) +{ + return GeDialog::CoreMessage(id, msg); +} + +void ShowVariableTagDataDialog(const VariableTag* tag) +{ + VariableTagDataDialog dlg(tag); + dlg.Open(DLG_TYPE::MODAL_RESIZEABLE, ID_VARIABLE_TAG_DIALOG); +} diff --git a/plugins/example.main/source/gui/gedialog_gadgets.cpp b/plugins/example.main/source/gui/gedialog_gadgets.cpp index b538067..8dcb605 100644 --- a/plugins/example.main/source/gui/gedialog_gadgets.cpp +++ b/plugins/example.main/source/gui/gedialog_gadgets.cpp @@ -752,7 +752,7 @@ void ExampleDialog::AddDynamicElement(const int selection) if (bitmapButtonGUI != nullptr) { IconData data; - GetIcon(RESOURCEIMAGE_BROWSER_PLAY, &data); + GetIcon(5159, &data); // set Icon bitmapButtonGUI->SetImage(&data); diff --git a/plugins/example.main/source/gui/memstat.cpp b/plugins/example.main/source/gui/memstat.cpp index d067eb5..87d5bee 100644 --- a/plugins/example.main/source/gui/memstat.cpp +++ b/plugins/example.main/source/gui/memstat.cpp @@ -4,6 +4,7 @@ #include "c4d.h" #include "main.h" #include "maxon/memoizationcache.h" +#include "maxon/dll.h" class MemStatDialog : public GeDialog { diff --git a/plugins/example.main/source/tool/pickobject.cpp b/plugins/example.main/source/tool/pickobject.cpp index 96e4456..b7cddf0 100644 --- a/plugins/example.main/source/tool/pickobject.cpp +++ b/plugins/example.main/source/tool/pickobject.cpp @@ -94,6 +94,11 @@ Bool PickObjectTool::MouseInput(BaseDocument* doc, BaseContainer& data, BaseDraw snprintf(ch, sizeof(ch), "|Time: %.2f us", float(timer) * 1000.0f); str += ch; + // Enable the following code for an example of GetFrameScreen. + /*Float cl, ct, cr, cb, scale; + bd->GetFrameScreen(&cl, &ct, &cr, &cb, &scale); + DiagnosticOutput("BaseDraw coordinates in screen space: (@, @, @, @), scale=@ -> (@, @, @, @)", cl, ct, cr, cb, scale, cl * scale, ct * scale, cr * scale, cb * scale);*/ + DeleteMem(pix); GeOutString(str, GEMB::OK); diff --git a/plugins/example.migration_2024/project/projectdefinition.txt b/plugins/example.migration_2024/project/projectdefinition.txt index 53e0718..0343790 100644 --- a/plugins/example.migration_2024/project/projectdefinition.txt +++ b/plugins/example.migration_2024/project/projectdefinition.txt @@ -1,16 +1,22 @@ -Platform=Win64;OSX +// The platforms this project is targeting - can be [Win64;OSX;Linux]. +Platform=Win64;OSX;Linux + +// Type of project - can be [Lib;DLL;App]. Type=DLL -// API dependencies +// The frameworks dependencies of this project as shipped in the frameworks folder of an SDK. You can only include +// header files from frameworks that are listed here. APIS=\ cinema.framework;\ cinema_hybrid.framework;\ -core.framework; +core.framework -// C4D component +// If this is a classic API plugin, enabling some classic API features and disabling automatic style checks. C4D=true stylecheck.level=3 -// Custom ID -ModuleId=net.maxonexample.migration_2024 \ No newline at end of file +// The ID of the module/plugin which is being compiled. You should use here the "net.mycompany.myplugin" format. +// You cannot use a module ID of the format "net.maxon.myplugin" as this domain is reserved for Maxon and plugins +// ignoring this will not be loaded. +ModuleId=net.maxonexample.migration_2024 diff --git a/plugins/example.migration_2024/source/oboundingbox.cpp b/plugins/example.migration_2024/source/oboundingbox.cpp index bf2d179..78b4a3b 100644 --- a/plugins/example.migration_2024/source/oboundingbox.cpp +++ b/plugins/example.migration_2024/source/oboundingbox.cpp @@ -80,7 +80,7 @@ class BoundingBoxObject: public ObjectData virtual Bool Message(GeListNode* node, Int32 type, void* t_data); /// @brief Called by Cinema 4D to gather dependency information on scene elements. - /// @details This method realizes the new decency information system of the classic API. + /// @details This method realizes the new dependency information system of the classic API. virtual maxon::Result GetAccessedObjects( const BaseList2D* node, METHOD_ID method, AccessedObjectsCallback& access) const; }; @@ -383,8 +383,8 @@ maxon::Result BoundingBoxObject::GetAccessedObjects( // In cases where a node relies on whole hierarchies, we can use one of the convenience methods // on BaseList2D such as ::GetAccessedObjectsRec or ::GetAccessedObjectsOfHierarchy to build // all access information in one call, passing in our #access object. - static const Bool dependsOnFullHierachy = false && firstChild; - if (MAXON_UNLIKELY(dependsOnFullHierachy)) + static const Bool dependsOnFullHierarchy = false && firstChild; + if (MAXON_UNLIKELY(dependsOnFullHierarchy)) { const Bool result = firstChild->GetAccessedObjectsOfHierarchy( ACCESSED_OBJECTS_MASK::MATRIX | ACCESSED_OBJECTS_MASK::CACHE, diff --git a/plugins/example.migration_2024/source/obundingbox_legacy.cpp b/plugins/example.migration_2024/source/obundingbox_legacy.cpp index d7f2094..86be6e0 100644 --- a/plugins/example.migration_2024/source/obundingbox_legacy.cpp +++ b/plugins/example.migration_2024/source/obundingbox_legacy.cpp @@ -10,7 +10,7 @@ Should be read in contrast to the 2024.0 API code in oboundingbox.cpp. */ -#include "maxon/apibase.h" +#include "maxon/apibase_version.h" #if MAXON_API_ABI_VERSION <= 2023200 // Guarded so that it can be part of the SDK. #include "c4d_basebitmap.h" diff --git a/plugins/example.nodes/project/projectdefinition.txt b/plugins/example.nodes/project/projectdefinition.txt index f04536a..09ee02b 100644 --- a/plugins/example.nodes/project/projectdefinition.txt +++ b/plugins/example.nodes/project/projectdefinition.txt @@ -1,16 +1,31 @@ -// Supported platforms -Platform=Win64;OSX +// The platforms this project is targeting - can be [Win64;OSX;Linux]. +Platform=Win64;OSX;Linux -// Type of project - can be [Lib;DLL;App] +// Type of project - can be [Lib;DLL;App]. Type=DLL -// API dependencies -APIS=cinema.framework;cinema_hybrid.framework;image.framework;misc.framework;core.framework;crypt.framework;math.framework;command.framework;corenodes.framework;nodes.framework;nodespace.framework;exchange.framework; +// The frameworks dependencies of this project as shipped in the frameworks folder of an SDK. You can only include +// header files from frameworks that are listed here. +APIS=\ +cinema.framework;\ +cinema_hybrid.framework;\ +image.framework;\ +misc.framework;\ +core.framework;\ +crypt.framework;\ +math.framework;\ +command.framework;\ +corenodes.framework;\ +nodes.framework;\ +nodespace.framework;\ +exchange.framework -// C4D component +// If this is a classic API plugin, enabling some classic API features and disabling automatic style checks. C4D=true stylecheck.level=3 -// Custom ID +// The ID of the module/plugin which is being compiled. You should use here the "net.mycompany.myplugin" format. +// You cannot use a module ID of the format "net.maxon.myplugin" as this domain is reserved for Maxon and plugins +// ignoring this will not be loaded. ModuleId=net.maxonexample.nodes diff --git a/plugins/example.nodes/source/command/create_node_material.cpp b/plugins/example.nodes/source/command/create_node_material.cpp index 76aeb75..318db2a 100644 --- a/plugins/example.nodes/source/command/create_node_material.cpp +++ b/plugins/example.nodes/source/command/create_node_material.cpp @@ -91,7 +91,7 @@ static maxon::Result Bool @@ -204,7 +204,7 @@ static maxon::Result ManipulatingNodeMaterial(maxon::Tuple BundleGui::CollectNodeData(const NodeDataContext& contex data._attributes.Append(std::move(attribute)) iferr_return; } - return std::move(data); + return data; } maxon::Result BundleGui::CreateDebugGUI(NodeData& data, const NodeDataContext& context, iBaseCustomGui& gui) diff --git a/plugins/example.nodes/source/gui/customgui_helpers.cpp b/plugins/example.nodes/source/gui/customgui_helpers.cpp index 5b66eed..f7d0a80 100644 --- a/plugins/example.nodes/source/gui/customgui_helpers.cpp +++ b/plugins/example.nodes/source/gui/customgui_helpers.cpp @@ -21,7 +21,7 @@ maxon::Result> CustomGuiHelpers::GetIdArray( maxon::NodePath::ParsePath(eid.ToBlock(), dataArray) iferr_return; } - return std::move(dataArray); + return dataArray; } const DescID& CustomGuiHelpers::GetRealGroupId(const DescID& groupIdA, const maxon::DataDictionary& guiEntry, maxon::DescTranslation& translateIds) diff --git a/plugins/example.nodes/source/space/compile_time_evaluation.cpp b/plugins/example.nodes/source/space/compile_time_evaluation.cpp index 50c9629..f257312 100644 --- a/plugins/example.nodes/source/space/compile_time_evaluation.cpp +++ b/plugins/example.nodes/source/space/compile_time_evaluation.cpp @@ -47,7 +47,7 @@ class ColorInvertNode : public maxon::Component> ExampleNodeMateria maxon::Result> ExampleNodeMaterialExport::GetTextures(const maxon::HashSet& texturedChannels) { maxon::HashMap textures; - return std::move(textures); + return textures; } } // namespace maxonsdk diff --git a/plugins/example.nodes/source/space/nodesystemclass_impl.cpp b/plugins/example.nodes/source/space/nodesystemclass_impl.cpp index 39d7df1..34c05b1 100644 --- a/plugins/example.nodes/source/space/nodesystemclass_impl.cpp +++ b/plugins/example.nodes/source/space/nodesystemclass_impl.cpp @@ -25,7 +25,7 @@ MAXON_METHOD maxon::Result NodeSystemClassExample::Ins if (id == Id("net.maxon.node.arithmetic")) { MutableRoot root = sys.BeginModification(parent.GetLookupRepository()) iferr_return; - root.SetTemplate(parent, templ, args) iferr_return; + root.SetTemplate(templ, args) iferr_return; Tuple enumerators[2]; enumerators[0].first = Id("float"); enumerators[0].second.Set(enumerators[0].first) iferr_return; diff --git a/plugins/project/projectdefinition.txt b/plugins/project/projectdefinition.txt index 2e872d7..43ca341 100644 --- a/plugins/project/projectdefinition.txt +++ b/plugins/project/projectdefinition.txt @@ -1,8 +1,14 @@ -Platform=Win64;OSX +// The platforms this solution is targeting - can be [Win64;OSX;Linux]. +Platform=Win64;OSX;Linux + +// The type of this definition. Type=Solution + +// The /projects/plugins/ projects that are part of this solution. Each of them will be compiled into its own +// binary and corresponds to a folder in /plugins/, each with its own projectdefinition.txt file. Solution=\ plugins/example.main;\ plugins/example.migration_2024;\ plugins/example.assets;\ plugins/example.nodes;\ - plugins/example.image \ No newline at end of file + plugins/example.image