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
    • Register
    • Login
    1. Home
    2. Deyan
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 11
    • Posts 28
    • Best 1
    • Controversial 0
    • Groups 0

    Deyan

    @Deyan

    1
    Reputation
    45
    Profile views
    28
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Deyan Unfollow Follow

    Best posts made by Deyan

    • RE: Creating and initializing nested ObjectData

      I'm not sure which design decision would be best - Idea 2 and Idea 3 seem pretty much the same, with the small difference that Idea 2 would make this message usable from other places as well. If you would need the functionality only in Parent, then I suppose Idea 3 would be most "encapsulating".

      And for you SDK query about the data cast - this should do the trick. Usually when doing such node data queries, you should always check the type with GetType(), but since you create the object on the line above, the check would be redundant.

      BaseObject* child = BaseObject::Alloc(Ochild);
      if (child) {
        Child* castedChild = child->GetNodeData<Child>();
        castedChild->CreateNulls(childNullsCount, childNullsShape);
      }
      
      posted in Cinema 4D SDK
      D
      Deyan

    Latest posts made by Deyan

    • How to specify file type subdirectory for MSG_RENAMETEXTURES

      Hello, I have a problem with how the built-in asset management handles specific file types (e.g. when Save Project with Assets... is used or Consolidate Assets from the AssetManager). In particular, the problem is that some image assets are automatically copied to the tex subdirectory of the specified save directory, while other file assets are copied to the root directory. My question is, if it is possible and how to direct a custom file type to this tex subdirectory, in order to copy this custom file type to the subdirectory?

      posted in Cinema 4D SDK c++
      D
      Deyan
    • RE: Overriding `NodeData::GetAccessedObjects(..)` prevents cache generation of cloned hierarchy

      Thanks a lot for the clarification! It would be nice to include more usecase examples of GetAccessedObjects(..) implementation in the SDK examples in the future. I will try your suggestion once 2024.4 becomes available.

      posted in Cinema 4D SDK
      D
      Deyan
    • RE: Overriding `NodeData::GetAccessedObjects(..)` prevents cache generation of cloned hierarchy

      Thank you for you answer @o_kniemeyer . Just to be clear about the proper implementation once GetAccessedObjects(..) is implemented for the Connector - what are the minimal read and write flags for the hierarchy call, if GetVirtualObjects(..) calls GetAndCheckHierarchyClone(hierarchyHelp, firstChild, HIERARCHYCLONEFLAGS::ASIS, &dirtyInput, nullptr, true);. I'm asking because in my example I tried with ACCESSED_OBJECTS_MASK::ALL | ACCESSED_OBJECTS_MASK::GLOBAL_MATRIX for read and ACCESSED_OBJECTS_MASK::CACHE for write, but I have a suspicion this may not be optimal (the write flags even feel wrong).

      posted in Cinema 4D SDK
      D
      Deyan
    • Overriding `NodeData::GetAccessedObjects(..)` prevents cache generation of cloned hierarchy

      Hi, I'm currently trying to implement the new NodeData::GetAccessedObjects(..) as described in this post. But something is not right, because after derived for one particular object, the objects in the cache are left without their caches.

      To give a bit more details - I have an object generator implementation, which is effectively cloning its child hierarchy and putting it under a Connector object. But after adding an override of NodeData::GetAccessedObjects(..) for this generator object, the cache is missing. A simplified version of my code below:

      maxon::Result<Bool> MyGenerator::GetAccessedObjects(const BaseList2D *node, METHOD_ID method, AccessedObjectsCallback &access) const {
      	yield_scope;
      	switch (method) {
      		case METHOD_ID::GET_VIRTUAL_OBJECTS: {
      			node->GetAccessedObjectsOfFirstChildHierarchy(
      				ACCESSED_OBJECTS_MASK::ALL | ACCESSED_OBJECTS_MASK::GLOBAL_MATRIX,
      				ACCESSED_OBJECTS_MASK::CACHE, 
      				METHOD_ID::GET_VIRTUAL_OBJECTS_AND_MODIFY_OBJECT,
      				access
      			) yield_return;
      			return access.MayAccess(
      				node,
      				ACCESSED_OBJECTS_MASK::DATA | ACCESSED_OBJECTS_MASK::GLOBAL_MATRIX,
      				ACCESSED_OBJECTS_MASK::CACHE
      			);
      		}
      	}
      	return ObjectBase::GetAccessedObjects(node, method, access);
      }
      
      BaseObject* MyGenerator::GetVirtualObjects(BaseObject *object, const HierarchyHelp *hierarchyHelp) {
      	BaseObject *firstChild=object->GetDown();
      	if (!firstChild) {
      		return nullptr;
      	}
      	bool dirtyInput=false;
      	BaseObject *input=object->GetAndCheckHierarchyClone(hierarchyHelp, firstChild, HIERARCHYCLONEFLAGS::ASIS, &dirtyInput, nullptr, true);
      	if (input) {
      		if (!dirtyInput) {
      			return object->GetCache();
      		}
      		BaseObject *cacheRoot=BaseObject::Alloc(Oconnector);
      		if (!cacheRoot) {
      			return cacheRoot;
      		}
      		input->InsertUnder(cacheRoot);
      		return cacheRoot;
      	}
      	return nullptr;
      }
      

      I tried several different flags to be used in the GetAccessedObjects(..) implementation, but none seemed to work. Only using acess.MayAccessAnything() in the implementation results in the previous behavior, but that is not the point of actually using the function.

      Am I missing something obvious or there might be a problem with my approach as a whole?

      posted in Cinema 4D SDK 2024 c++
      D
      Deyan
    • RE: Creating and initializing nested ObjectData

      I'm not sure which design decision would be best - Idea 2 and Idea 3 seem pretty much the same, with the small difference that Idea 2 would make this message usable from other places as well. If you would need the functionality only in Parent, then I suppose Idea 3 would be most "encapsulating".

      And for you SDK query about the data cast - this should do the trick. Usually when doing such node data queries, you should always check the type with GetType(), but since you create the object on the line above, the check would be redundant.

      BaseObject* child = BaseObject::Alloc(Ochild);
      if (child) {
        Child* castedChild = child->GetNodeData<Child>();
        castedChild->CreateNulls(childNullsCount, childNullsShape);
      }
      
      posted in Cinema 4D SDK
      D
      Deyan
    • RE: Save Project with Assets not updating the maxon::Url of node textures in R26 and 2023

      Hi @Aaron, we had similar problem, but I didn't notice that it even worked in earlier versions. I'm writing just to note that the node material does get the MSG_RENAMETEXTURES message and you can implement the renaming there.

      posted in Cinema 4D SDK
      D
      Deyan
    • RE: Changing description of material nodes dynamically

      Another small question that came to mind - this registration function RegisterValueChangedMessage(..) seems to have been added in R26 SDK - is there an alternative for earlier SDK versions?

      posted in Cinema 4D SDK
      D
      Deyan
    • RE: Changing description of material nodes dynamically

      Hi @m_magalhaes, this is exactly what I was looking for. It works like a charm for my first usecase.

      But for the second part I encountered just a slight inconvenience. In my second usecase I actually don't want to change parameter name, I just want CreateC4DDescription(..) to be called again. From what I tested, if the name is set with the same value, the description creation is not triggered. I also tried changing another (seemingly irrelevant) attribute of the node, but that did not trigger a description change either (in particular I tried changing maxon::NODE::BASE::COMMENT).
      Finally, I tried adding a new hidden port, that is not actually used, just to change its name when the description change function should be called - and this seems to work as expected. I was just wondering if there is a better solution that may achieve the same result without a dummy port?

      Cheers,
      Deyan

      posted in Cinema 4D SDK
      D
      Deyan
    • Changing description of material nodes dynamically

      Hi,

      I have two questions regarding the descriptions of nodes.

      My first question is, if it is possible and how to change some description property of a node port, based on the value of another constant port. As an example, in a NodeData::GetDDescription(..) one can easily read a parameter and change the description of another parameter (e.g. change the name of one parameter based on a checkbox).
      Is something similar possible to do in material nodes (or nodes in general) and how?

      My second question is related to the first one in regards of dynamic changes of nodes. I tried using a custom GUI implementation based on the example.nodes plugin in the SDK. In particular I used the implementation in example.nodes/source/gui/customgui_string.cpp as a reference for using a custom GUI. I found that the getDataCallback parameter delegate can be used to actually get the GraphNode for a node in UiConversionCustomGuiString::CreateC4DDescription(..). But my question is if there is a way to trigger this function to be called again upon changes on the node, to allow dynamic updates on the node based on port value in the node?

      Thanks in advance 🙂

      posted in Cinema 4D SDK c++
      D
      Deyan
    • RE: Node description database versions

      Hi @m_magalhaes , thanks very much for the provided information.

      1. We are not modifying the database manually from an editor, but rather generate it on our own. That's why I was searching for an explicit documentation, because the process of adding nodes from the Resource Editor in C4D just to check an attribute may be tedious.
      2. Thanks we will consider doing that for version changes.
      3. Thanks again - I will take a look into this interface and ask again if I have questions for its proper usage.

      Cheers,
      Deyan

      posted in Cinema 4D SDK
      D
      Deyan