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?
Posts made by Deyan
-
How to specify file type subdirectory for MSG_RENAMETEXTURES
-
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. -
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, ifGetVirtualObjects(..)
callsGetAndCheckHierarchyClone(hierarchyHelp, firstChild, HIERARCHYCLONEFLAGS::ASIS, &dirtyInput, nullptr, true);
. I'm asking because in my example I tried withACCESSED_OBJECTS_MASK::ALL | ACCESSED_OBJECTS_MASK::GLOBAL_MATRIX
for read andACCESSED_OBJECTS_MASK::CACHE
for write, but I have a suspicion this may not be optimal (the write flags even feel wrong). -
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 usingacess.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?
-
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); }
-
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. -
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? -
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 changingmaxon::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 -
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 inexample.nodes/source/gui/customgui_string.cpp
as a reference for using a custom GUI. I found that thegetDataCallback
parameter delegate can be used to actually get the GraphNode for a node inUiConversionCustomGuiString::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
-
RE: Node description database versions
Hi @m_magalhaes , thanks very much for the provided information.
- 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.
- Thanks we will consider doing that for version changes.
- Thanks again - I will take a look into this interface and ask again if I have questions for its proper usage.
Cheers,
Deyan -
Node description database versions
Hi, I have several questions regarding material nodes, and mostly about their description database json files.
- Is there an extensive documentation about the format and expected properties?
- What is the proper way to make a new version of a database with new or changed entries? And by this I refer to the proper way to force the node cache regeneration of the data description of the node space?
- How can data between version changes be migrated in plugin implementations? For example, there is
NodeData::Read(..)
for classic plugins, but what is the proper way of implementing data migration of updated ports for nodes? I'm mostly concerned with material nodes for now, but I suppose this would apply in general.
Any help on those questions would be greatly appreciated.
Cheers,
Deyan -
RE: Connected user node to variadic port does not trigger dependent nodes preview updates
Hi,
I'm just creating the portbundles from the resource editor, without a custom bundle GUI.
So I guess you only need the database? I'll try to minimize the database to include only the necessary nodes and portbundle declarations and email it to [email protected]Cheers,
Deyan -
RE: Connected user node to variadic port does not trigger dependent nodes preview updates
Hi,
Could you be more specific what parts of the code are necessary - only the node space declaration, the preview image provider implementation or something else additionally?
Cheers,
Deyan -
Multiple end nodes of custom node space
Hi,
In the standard node space, when multiple end nodes are present in the node graph, they are visually marked as invalid to hint the user that multiple end nodes should not be used.
My question is how can this be achieved for a custom node space? I couldn't find anything related in the examples or the documentation.
Cheers,
Deyan -
RE: Creating node material presets for custom node space
OK, thanks for the answer.
About my second question - what is the proper way of creating a node material instance and modifying its graph to a "preset". I want to define several such presets as commands.
There is no example for this and there seems to be no direct function for getting a mutable graph instance. From browsing the interface ofNodeMaterial
it seems the steps for achieving this are:- Create a
NodeMaterial
instance. - Add the desired node space to the material.
- Get the immutable version of the graph for the node space with
NodeMaterial::GetGraph(..)
. - Get the mutable node system from the immutable graph with
NodesGraphModelInterface::GetMutableNodeSystem(..)
- Do modifications.
Is my assumption correct and is this the expected way of achieving this?
- Create a
-
RE: Connected user node to variadic port does not trigger dependent nodes preview updates
Upon some further investigation and testing I found this is reproducible only on R21, S22 and R23.
Is this a known issue that has been fixed for S24, and is there a workaround for earlier versions? -
Connected user node to variadic port does not trigger dependent nodes preview updates
Hi,
I have several user nodes declared in a custom user nodespace, very similar to the
example.nodes
project in the SDK examples.
Unfortunately I encountered a problem while declaring a node with variadic input attribute, that has a portbundle as data type. The exact problem I notice is that the previews of dependent nodes of the one with the variadic input are not updated when any connected nodes to the variadic portbundles are changed. As a detail here - I noticed this only happens if the connected nodes (as inputs) to the variadic portbundles are also user nodes and having the builtinColor
orValue
nodes used as inputs properly triggers preview updates.So from the above description I think I'm missing something in the declarations of my user nodes, that leads to this behavior. Can you assist me in what might be wrong in the user nodes setup or in the definition of the nodespace?
Thanks in advance,
Deyan -
Creating node material presets for custom node space
Hi, is it possible to define custom node material presets for a custom node space?
It seems that the node material presets are empty for the "Example" node space, and I couldn't find anything related to adding such presets in the SDK (or the examples).
If there is a way - is it also possible to instantiate such a preset with a command plugin? -
RE: Wrong editor preview of material plugins with TextureTag repetitions
Thanks for the investigation. At least now we are aware the problem is not on our side.
Cheers,
Deyan -
Wrong editor preview of material plugins with TextureTag repetitions
Hi,
In short - when material plugins are assigned on object and have non-zero
Repetitions U
orRepetitions V
in their texture tag assignment, the editor preview does not clip the preview image at all. I noticed this only for Cinema 4D S22 and above.Some details - I have a material plugin deriving from the
MaterialData
class, with an override forMaterialData::InitGLImage(..)
to generate a generic preview for the material in the editor. Until S22, the editor preview correctly showed the material with the specified repetitions in theTextureTag
. After that only the native materials seem to show this correctly.Is there a flag that we missed adding for S22 or something else that was introduced and is missing on our side, or this is a problem in Cinema 4D?
Thanks,
Deyan