I’m working on a plugin, which is supposed to generate materials (amongst others) for Vray/C4D.
I’m using Vray 6.20.01.
All is nice and dandy in C4D 2023. But in 2024 my code fails to get the end node of a freshly created node material.
My code looks roughly like so (error checking removed just for this post):
id_nodespace = "com.chaos.class.vray_node_renderer_nodespace"
id_node_mat = "com.chaos.vray_node.brdfvraymtl"
id_node_output = "com.chaos.vray_node.Material" ### Did this change?
mat = c4d.BaseMaterial(c4d.Mmaterial)
ref_mat_node = mat.GetNodeMaterialReference()
graph = ref_mat_node.CreateDefaultGraph(id_nodespace)
result = []
maxon.GraphModelHelper.FindNodesByAssetId(graph, id_node_mat, True, result)
result = []
maxon.GraphModelHelper.FindNodesByAssetId(graph, id_node_output, True, result)
### Here I get an empty result list in C4D 2024, while it works as expected in C4D 2023
While I’m also considering this to be a Maxon issue (or change), I do not see this issue with any other render engine I need to support (Arnold, Corona, Octane, Redshift all do work fine in 2024).
Any help would be much appreciated.
Thanks in advance,
Andreas
Hi @andrew_price the asset id of our Material end node is “com.chaos.vray_node.mtlsinglebrdf” and should be the same across all V-Ray/Cinema4D versions. You can easily find the asset ids of ports and nodes in the node info by enabling it in preferences.
Hi @bozhidar_ivanov ,
thanks a ton. Not only for the provided ID, which is working nicely, but also for the hint that we can enable the ID to be shown in UI. Very helpful, I somehow missed that!
You can consider this case closed.
Thanks and cheers
i also start to manage node material with python, and actually i’m stuck with finding a way to get and set value for a material parameter like “Material Id Enabled” checkbox
When i drag and drop it in console i get parameter name: VRayMaterial[“com.chaos.material_options.base.material_id_enabled”]
But when i use this parameter name in my code i have this error: TypeError: GeListNode_mp_subscript expected Description identifier, not str.
I’m a bit disapointed with this new node materials
It seems that you are trying to use the old hierarchical material model to set up a new node material model, and you need to use maxon.GraphNode method to obtain new material models is much more complex than old materials.
If you want to use artists in a good way to modify, you can try using GraphDescription.