Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Ogers
    3. Topics
    O
    • Profile
    • Following 1
    • Followers 1
    • Topics 33
    • Posts 97
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by Ogers

    • O

      Create Gradient Attribute for Nodes Programmatically

      Cinema 4D SDK
      • c++ r25 • • Ogers
      12
      0
      Votes
      12
      Posts
      1.7k
      Views

      ManuelM

      hi,

      Sorry for the late reply, but this needed investigation and test from my side and communication between me and the dev.

      You can create the NodeTemplate that way. I am using the class GradientWorkaround to create the template.
      NodesLib::BuildNodeFromDescription must be called with false set to not create the dependency wires.

      NodeTemplate t = NodesLib::CreateLazyTemplate(firstNodeId, [firstNodeId]() -> Result<NodeTemplate> { iferr_scope; maxon::nodes::NodeTemplate templ = maxon::nodes::NodesLib::BuildNodeFromDescription(firstNodeId, CoreNodesNodeSystemClass(), false) iferr_return; templ = GradientWorkaround::CreateInit(templ) iferr_return; return templ; }, CoreNodesNodeSystemClass()) iferr_return;

      The class itself look like this. We can create a gradient node inside the usernode itself and connect the ports. This is done inside the function InstantiateImpl.

      class GradientWorkaround : public maxon::Component<GradientWorkaround, maxon::nodes::NodeTemplateInterface> { MAXON_COMPONENT(NORMAL, maxon::nodes::NodeTemplateBaseClass); public: maxon::ResultOk<void> Init(const maxon::nodes::NodeTemplate& templ) { _wrapped = templ; return maxon::OK; } MAXON_METHOD maxon::Result<Bool> SupportsImpl(const maxon::nodes::NodeSystemClass& cls) const { return cls.IsSubclassOf(CoreNodesNodeSystemClass()); } MAXON_METHOD maxon::Result<maxon::nodes::NodeSystem> InstantiateImpl(const maxon::nodes::InstantiationTrace& parent, const maxon::nodes::TemplateArguments& args) const { iferr_scope; maxon::nodes::NodeSystem sys = _wrapped.Instantiate(parent, args) iferr_return; maxon::nodes::MutableRoot root = sys.BeginInstantiationModification(self) iferr_return; // Asset ID : net.maxon.pattern.node.generator.gradient const AssetRepositoryRef& repository = AssetInterface::GetBuiltinRepository(); nodes::NodeTemplate gradient = nodes::NodesLib::LoadTemplate(repository, Id("net.maxon.pattern.node.generator.gradient")) iferr_return; MutableNode gradientNode = root.AddChild(Id("Gradient"), gradient) iferr_return; const maxon::nodes::MutablePort output = root.GetOutputs().FindPort(maxon::Id("testoutput")) iferr_return; const maxon::nodes::MutablePort gradientPort = root.GetInputs().FindPort(maxon::Id("gradient")) iferr_return; const maxon::nodes::MutablePort gradientResult = gradientNode.GetOutputs().FindPort(maxon::Id("result")) iferr_return; const maxon::nodes::MutablePort gradientGradient = gradientNode.GetInputs().FindPort(maxon::Id("gradient")) iferr_return; gradientResult.Connect(output) iferr_return; gradientPort.Connect(gradientGradient) iferr_return; sys = root.EndModification() iferr_return; return sys; } private: maxon::nodes::NodeTemplate _wrapped; }; MAXON_COMPONENT_CLASS_REGISTER(GradientWorkaround, "net.maxonexample.nodes.class.gradientworkaround");

      It is just like having a group of nodes and propagated ports.

      Cheers,
      Manuel

    • O

      Create custom menu category for nodes?

      Cinema 4D SDK
      • s24 c++ • • Ogers
      2
      0
      Votes
      2
      Posts
      568
      Views

      ManuelM

      Hi,

      Categories are also assets. You can use the CategoryAssetInterface to create a category asset.
      and you can "parent" this category to another category using SetAssetCategory.

      maxon::Result<maxon::AssetDescription> CreateCategoryAsset( const maxon::AssetRepositoryRef& repository, const maxon::String& name, const maxon::Id& category) { iferr_scope; if (name.IsEmpty()) return maxon::IllegalArgumentError(MAXON_SOURCE_LOCATION, "Invalid category name."_s); // Create and store a new category asset. maxon::CategoryAsset categoryAsset = maxon::CategoryAssetInterface::Create() iferr_return; maxon::Id categoryId = maxon::AssetInterface::MakeUuid("category", false) iferr_return; maxon::AssetDescription assetDescription = repository.StoreAsset( categoryId, categoryAsset) iferr_return; // Set the category name. maxon::LanguageRef language = maxon::Resource::GetCurrentLanguage(); assetDescription.StoreMetaString(maxon::OBJECT::BASE::NAME, name, language) iferr_return; // Set the category of the asset when the category is not the empty id. if (!category.IsEmpty()) { maxon::CategoryAssetInterface::SetAssetCategory(assetDescription, category) iferr_return; } ApplicationOutput("Created category asset with the id: '@'", assetDescription.GetId()); return assetDescription; }

      Cheers,
      Manuel

    • O

      Collapse/Fold groups by default in nodegraph UI

      Cinema 4D SDK
      • s24 c++ • • Ogers
      4
      0
      Votes
      4
      Posts
      844
      Views

      ManuelM

      This is already fixed now, but i can't say when the update will be available to public.

    • O

      Unique ID for maxon::nodes::Node

      Cinema 4D SDK
      • c++ s24 • • Ogers
      3
      0
      Votes
      3
      Posts
      550
      Views

      O

      Hello,
      When translating the nodes in our system we need each of them to have a unique ID or name. That's how we identify each node, e.g if I have two or more texture nodes (with the same ID) used on different materials and assigned to different objects, it would only show one texture rendered to all objects as all textures are assigned one similar ID.
      For now, I solved this by finding a uniqueID for the corresponding material and concatenating it with the node's ID.

      As for the error message it only says Error and nothing more. I will send the text via email.

      Thank you.

    • O

      Add values for enum data type (node graph)

      Cinema 4D SDK
      • c++ r25 • • Ogers
      9
      0
      Votes
      9
      Posts
      1.2k
      Views

      O

      Hello,

      Thanks for the code.
      Regarding the second one, I have tried it and also mentioned in the first message that the data does not get added and the array size still stays 0.
      I had forgotten to put iferr_return and now with your example, I am getting a critical error when trying to append those data.

      RefMemberType<S> CritStop() { CriticalOutput(static_cast<const typename S::ReferenceClass*>(this)->ToString()); return this->PrivateGetRefMember(); }
    • O

      Adding Node Descriptions Pragmatically

      Cinema 4D SDK
      • c++ r25 • • Ogers
      9
      0
      Votes
      9
      Posts
      1.4k
      Views

      O

      Thank you. I was getting a unique ID indeed but had declared it as a global (I don't know how I missed it after checking couple of times) and using it like that in the lambda function was causing the issue.

      All good now, thank you very much.

      Cheers,
      Ogers

    • O

      Save node created from resource editor as .json file

      Cinema 4D SDK
      • s24 sdk c++ • • Ogers
      3
      0
      Votes
      3
      Posts
      515
      Views

      O

      That's what I was looking for, thanks a lot!

    • O

      Get string value from long cycle.

      Cinema 4D SDK
      • c++ r21 • • Ogers
      3
      0
      Votes
      3
      Posts
      591
      Views

      O

      I came up with this solution which is working fine. Thanks for your help.

      std::string getDropDownName(Description* const description, Int32 group_id, Int32 SelectedItem) { const DescID* singleid = description->GetSingleDescID(); const DescID cid = DescLevel(group_id, DTYPE_LONG, 0); std::string selected_name = ""; if (!singleid || cid.IsPartOf(*singleid, nullptr)) { AutoAlloc<AtomArray> arr; BaseContainer* selectionParameter = description->GetParameterI(DescLevel(group_id, DTYPE_LONG, 0), arr); if (selectionParameter != nullptr) { BaseContainer* items = selectionParameter->GetContainerInstance(DESC_CYCLE); if (items != nullptr) { selected_name = items->GetData(SelectedItem).GetString().GetCStringCopy(); } } } return selected_name; }
    • O

      Can't apply shaders to a CUSTOMGUI_TEXBOX in iCustomGui

      Cinema 4D SDK
      • c++ r21 • • Ogers
      3
      0
      Votes
      3
      Posts
      513
      Views

      O

      I see, thank you for the answer.

      Cheers,
      Ogers.

    • O

      Setting node dirty does not trigger an update.

      Cinema 4D SDK
      • r21 c++ • • Ogers
      18
      0
      Votes
      18
      Posts
      2.3k
      Views

      ferdinandF

      Hello @Ogers,

      without any further questions, we will consider this topic as solved by Monday, the 25th and flag it accordingly.

      Thank you for your understanding,
      Ferdinand

    • O

      Hide description element using MessageData::CoreMessage() function

      Cinema 4D SDK
      • r21 • • Ogers
      5
      0
      Votes
      5
      Posts
      801
      Views

      ManuelM

      hi,

      I'm a bit surprised that your render can be triggered from a NodeData (but why not)
      But i don't understand why you can't use GetDDescription to update your node.

      That's what i did (in a probably too naive way) but you got the idea. I just got a boolean display_aboard on my ObjectData and i switch it as i needed.
      If i presse the button, i switch and i set dirty my node, if i receive the message that the render is finished (or stopped) i set my bool to false and i SetDirty my node.

      static const Int32 g_pc12584ButtonID = 1000; class pc12584_object : public ObjectData { INSTANCEOF(pc12584_object, ObjectData); public: static NodeData* Alloc() { return NewObjClear(pc12584_object); }; Bool Init(GeListNode* node) override { display_aboard = false; return true; } BaseObject* GetVirtualObjects(BaseObject* op, HierarchyHelp* hh) override { BaseObject* null = BaseObject::Alloc(Onull); return null; } Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags) override { if (!description->LoadDescription(Obase)) return false; const DescID* singleid = description->GetSingleDescID(); const Int32 ID = g_pc12584ButtonID; const DescID cid = DescLevel(ID, DTYPE_BUTTON, 0); if (!singleid || cid.IsPartOf(*singleid, nullptr)) { BaseContainer bc = GetCustomDataTypeDefault(DTYPE_BUTTON); bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BUTTON); if (display_aboard) bc.SetString(DESC_NAME, "Aboard Render"_s); else bc.SetString(DESC_NAME, "Render"_s); bc.SetInt32(DESC_ANIMATE, DESC_ANIMATE_OFF); bc.SetInt32(DESC_SCALEH, 1); description->SetParameter(cid, bc, DescLevel(ID_OBJECTPROPERTIES)); } flags |= DESCFLAGS_DESC::LOADED; return SUPER::GetDDescription(node, description, flags); } Bool Message(GeListNode* node, Int32 type, void* data) override { switch (type) { case MSG_DESCRIPTION_COMMAND: { DescriptionCommand* dc = (DescriptionCommand*)data; const Int32 id = dc->_descId[0].id; if (id == g_pc12584ButtonID) { display_aboard = !display_aboard; node->SetDirty(DIRTYFLAGS::DESCRIPTION); } break; } case g_pc12584Message: { display_aboard = false; node->SetDirty(DIRTYFLAGS::DESCRIPTION); break; } } return SUPER::Message(node, type, data); }; private: Bool display_aboard = false; }; // function to send a message to the ObjectData. static maxon::Result<void> PC12854_Message(BaseDocument* doc) { iferr_scope; // update the first object BaseObject* op = doc->GetFirstObject(); if (op == nullptr) return maxon::NullptrError(MAXON_SOURCE_LOCATION); op->Message(g_pc12584Message); return maxon::OK; }

      Cheers,
      Manuel

    • O

      Customgui for ShaderLink

      Cinema 4D SDK
      • maxon api r21 • • Ogers
      4
      0
      Votes
      4
      Posts
      642
      Views

      indexofrefractionI

      This is still missing in the Python SDK .....
      ☹

    • O

      Use existing data for DynamicDescription

      Cinema 4D SDK
      • c++ windows r21 • • Ogers
      3
      0
      Votes
      3
      Posts
      651
      Views

      O

      Thanks @s_bach
      This is very helpful.
      Best wishes.

    • O

      Align Group Parameters (Resource Files)

      Cinema 4D SDK
      • r21 c++ sdk • • Ogers
      4
      0
      Votes
      4
      Posts
      675
      Views

      O

      Thanks @zipit,
      Managed to solve it thanks to you.

    • O

      Add Child to description popup field.

      Cinema 4D SDK
      • c++ r21 • • Ogers
      5
      0
      Votes
      5
      Posts
      833
      Views

      ManuelM

      hello,

      So yes, you have to react to MSG_DESCRIPTION_POPUP, you can see an example on the nodedata manual

      I thought first you wanted to create a popup menu.

      Cheers,
      Manuel

    • O

      Default startup settings

      Cinema 4D SDK
      • r20 maxon api sdk windows c++ • • Ogers
      8
      0
      Votes
      8
      Posts
      1.6k
      Views

      O

      Thank you for the help @m_magalhaes

    • O

      Adding Custom Tree to TreeView.

      Cinema 4D SDK
      • r20 c++ windows • • Ogers
      8
      0
      Votes
      8
      Posts
      1.7k
      Views

      O

      @mp5gosu I have one last question.
      on the thread for custom nodes that you mentioned above there was a file which was posted from Niklas. https://raw2.github.com/PluginCafe/examples/master/treeview/custom-nodes/custom-nodes.cpp
      Since this file was not there anymore and most probably it was a full code of what I am asking for, can it be that you or someone else might have that file somehow?
      That would be a great help.
      Thank you.

    • O

      Disable SimpleListView Item

      Cinema 4D SDK
      • c++ r20 sdk • • Ogers
      2
      0
      Votes
      2
      Posts
      440
      Views

      r_giganteR

      Hi Ogers thanks for reaching out us.

      With regard to your request, I confirm that to deliver the desired functionality you've to stick to TreeView since it's not possible to disable items belonging to a SimpleListView.

      Cheers, Riccardo

    • O

      Change LONG_CYCLE selected Item.

      Cinema 4D SDK
      • c++ r20 windows • • Ogers
      11
      0
      Votes
      11
      Posts
      1.9k
      Views

      W

      Thanks for guiding

      Regards,
      Folexin

    • O

      LoadFile(Filename file) does not work for layouts.

      Cinema 4D SDK
      • c++ r20 windows • • Ogers
      8
      0
      Votes
      8
      Posts
      2.5k
      Views

      ManuelM

      Again sorry, I've tested with the Studio version.

      Using C4DPL_PROGRAM_STARTED case I can confirm this "bug" with a Educational version and a Demo version.
      Not with the Studio version.

      Maybe something with that extra "popup" windows on those both versions.

      Cheers
      Manuel.