Hi @i_mazlov ,
Unfortunately, the python node approach is not effective for my use case, so I may have to emulate the error conditions on my own for each node.
In any case, thank you for your answer.
Hi @i_mazlov ,
Unfortunately, the python node approach is not effective for my use case, so I may have to emulate the error conditions on my own for each node.
In any case, thank you for your answer.
Hi,
I am trying to write a python script that detects error-occuring nodes in XPresso.
It seems that there is a method GvNodeMaster.Execute() for checking if the node master is including error node, and returns the type of error.
However, I tried with an xpresso network with a Math node that divides by zero and an unlinked Obejct node and did not get the expected results.
Code:
import c4d
def main() -> None:
xpresso_tag = op.GetTag(c4d.Texpresso)
master = xpresso_tag.GetNodeMaster()
print(master.Execute())
if __name__ == '__main__':
main()
Result:
0
I was expecting c4d.GV_CALC_ERR_DIVISION_BY_ZERO
which is 10 or c4d.GV_CALC_ERR_UNDEFINED
which is 2.
Am I doing something wrong? Any help would be appreciated.
Thanks for the clarification and the C++ example!
I'll try to think of other ways.
Hi,
I am working on drag and drop operation of UserArea.
What I would like to do is replicate the behavior of adding a node in the XPresso Editor: drag the text of the node name in the X-Pool and drop it into the node graph, and a new node will be created.
For UserArea, there is GetDragObject() to get the dragged information, and an example of its use is shown in this thread.
However, using this method to drag an xpresso node name from X-Pool to the UserArea returns the following results.
{'type': 400007002, 'object': None}
400007002 is c4d.DRAGTYPE_GVNODE_STORE, so we know that something related to the XPresso node is being dragged, but 'object' is None, so we cannot identify which node is being dragged.
Hopefully there is a way to get the specific value of the dragged node (e.g. c4d.ID_OPERATOR_BITMAP).
Any help would be greatly appreciated.
Hi,
These can be used for doing so.
CKey.ChangeNBit(c4d.NBIT_CKEY_AUTO, False)
CKey.ChangeNBit(c4d.NBIT_CKEY_REMOVEOVERSHOOT, False)
By the way, if you want to get correct value of tangents, CCurve.GetTangents() should work correctly, instead of using CKey.GetTimeLeft, etc.
Hi @ferdinand ,
Thanks as always for your clear answers, It solved the problem for me!
Hi,
I am trying to access some nodes in Scene Nodes graph with python.
For node-based objects like Nodes Modifier, I can use BaseList2D.GetNimbusRef() to access the graph, but I don't know how to get into the "root" Scene Nodes graph. Is there an invisible BaseList2D that holds the root Scene Nodes graph and I can use the same way from that object?
The code below is how I did it for node-based objects to access their nodes. I hope there is a way to access the root Scene Nodes graph in a similar way.
import maxon
def main():
nbr = op.GetNimbusRef("net.maxon.neutron.nodespace")
graph = nbr.GetGraph()
root = graph.GetRoot()
# Iterate over the direct children of the graph root.
nodesList = []
root.GetChildren(nodesList, maxon.NODE_KIND.NODE)
for node in nodesList:
print(node)
if __name__ == '__main__':
main()
I would appreciate any examples or tips you could give me. Thank you.
Hi @ferdinand ,
Thank you for clarifying. I needed a solution for my tool to determine which track/key is displayed&selected.
But if I can't do that in user mode, I'll make sure my tools don't work when the timeline is in user mode.
Hi,
I would like to know how to check if CTrack is shown/hidden in User Mode of timeline.
I usually use GeListNode.GetNBit() to check the status of CTrack on timeline, such as selected or hidden.
NBIT_TL1_HIDE is the one for checking if the element is hidden on the main timeline, but not for tracks that are hidden on the User Mode timeline.
Does anyone know of any way to do this?
Hi,
I found some unfamiliar commands in the Extensions menu of 2024.1.0. Are they displayed unintentionally?
If they are for users, I would like to know how they work.
hi @i_mazlov ,
I understand that it is not supported, so I will use Scene Nodes to generate the spline this time.
No other questions, thank you very much.
Hi,
I have a Python Generator Object that returns a Spline Object. I want to use this spline for the distribution of a Cloner Object, but it does not generate any clones on the spline.
The spline works fine when used for Generators such as Sweep, Extrude, Loft etc.
The Python Generator Code:
import c4d
def main():
spline = c4d.SplineObject(pcnt=4, type=c4d.SPLINETYPE_LINEAR)
spline.ResizeObject(pcnt=4, scnt=1)
spline.SetPoint(id=0, pos=c4d.Vector(0, 0, 0))
spline.SetPoint(id=1, pos=c4d.Vector(100, 100, 100))
spline.SetPoint(id=2, pos=c4d.Vector(200, 200, 200))
spline.SetPoint(id=3, pos=c4d.Vector(300, 300, 300))
spline.SetSegment(id=0, cnt=4, closed=False)
spline.Message(type=c4d.MSG_UPDATE)
return spline
The Scene File:
PyGenSplineAndCloner.c4d
I would appriciate it if you could check to see if it is a bug or I am missing somthing in the code.
Hi @m_adam,
Sorry for the delay in responding.
Yes, the problem has been resolved.
Hi,
I am drawing an object as a node in UserArea and I want to drag that object only to the InExclude list (Attribute Manager).
The problem is that when I use HandleMouseDrag(), I can also drag to the Object Manager and that object will be duplicated unintentionally.
So I need to know how to restrict dragging to the object manager and only allow dragging to the Attribute Manager.
Any help would be appreciated.
Hi,
I am trying to control which parameters of ObjectPlugin are shown/hidden depending on the values of another parameter.
For example, the Cloner object switches which parameters it displays depending on its "mode" parameter.
From the other threads I see that overriding GetDDescription() is the key to achieving this, but I just can't get it to work.
Any help would be appreciated.
Hi @Manuel ,
Sorry for asking a question that has already been resolved in another thread.
That thread solved my question. Thank you.
Hi,
I tried to get the weight values from a Vertex Map tag in the documented way.
It workd for editable polygon objects, but not for uneditable obejcts.
The .c4d file:
VertexMapWeightsFromUneditableObjects.c4d
The code:
import c4d
def main():
tag = op.GetFirstTag()
weight = tag.GetAllHighlevelData()
print(weight)
if __name__ == '__main__':
main()
The result for uneditalble cube:
Traceback (most recent call last):
File "scriptmanager", line 9, in <module>
File "scriptmanager", line 5, in main
SystemError: <method 'GetAllHighlevelData' of 'c4d.VariableTag' objects> returned NULL without setting an error
The result for editalble cube:
[0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0]
Is there any way to get the weight values for uneditable objects? Thank you.
Hi @ferdinand,
So the normal direction of the generated polygons was the point!
Thank you for answering my curiosity and explaining how to reproduce the behavior.
Hi,
Out of curiosity, I would like to know under what conditions the inner segment of a spline behaves as a hole.
If possible, I would like to reproduce this behavior in Python Generator.
Any hints would be appreciated.
Hi @ferdinand,
Thank you for the detailed explanation and the code.
It works perfectly and the problem is solved!