How to modify python tags as generators first?
-
import c4d def main(): cloner = c4d.BaseObject(c4d.Omgcloner) python = c4d.BaseTag(c4d.Tpython) cloner.InsertTag(python) doc.InsertObject(cloner) c4d.EventAdd() if __name__ == '__main__': main()
-
Hello @treezw,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.
About your First Question
Please have a look at our forum guidelines. You must accompany your postings by a reasonable description of what you want. We cannot start deciphering screenshots. I understand that language can be a barrier but your title does not offer much meaning either.
I can read here between the lines but we expect you to provide a meaningful problem description in future postings. I assumed that your question is 'how to set the priority value of a Python programming tag?' You must use the parameter access syntax
myNode[ID_SOME_PARAM] = value
. To discover parameter values, you can use parameter drag and drop in the console. A little hurdle is here the data type of the parameter you want to write, c4d.PriorityData, which is a bit of an oddball.PS: You also posted in the wrong forum, this must go into
Cinema 4D SDK
since this is a question about this SDK. I have moved your topic.Cheers,
Ferdinandimport c4d from mxutils import CheckType doc: c4d.documents.BaseDocument # The active document. op: c4d.BaseObject | None # The active object, can be `None`. def main(): """ """ # Allocate a cloner. Object allocation can fail in the C++ backend when you run out of memory. # The constructor will return `None` in that case. One way to handle this is to ensure with # a `CheckType` call that the object is not `None`. cloner: c4d.BaseObject = CheckType(c4d.BaseObject(c4d.Omgcloner)) # Create a Python tag, insert it into the cloner and check for success in one line. tag: c4d.BaseTag = CheckType(cloner.MakeTag(c4d.Tpython)) # Get the priority data of the Python tag, change its value and write it back. Priority data # bundle up three values, the mode, the priority and the camera dependency which are all written # with the method `SetPriorityValue`. priority: c4d.PriorityData = tag[c4d.EXPRESSION_PRIORITY] priority.SetPriorityValue(c4d.PRIORITYVALUE_MODE, c4d.CYCLE_GENERATORS) priority.SetPriorityValue(c4d.PRIORITYVALUE_PRIORITY, -100) tag[c4d.EXPRESSION_PRIORITY] = priority # Insert the cloner into the document and invoke an update. doc.InsertObject(cloner) c4d.EventAdd() if __name__ == '__main__': main()
-