undo-steps for inserting objects have to be added after the the object has been inserted; the appropriate flag is then
c4d.UNDOTYPE_NEW. Could you describe in more detail what is not working?
@m_magalhaes I see, but how do you create a script that generates a python tag with that code already in it?
I think @m_magalhaes was referring to
plugins.TagData the base class for python plugins that implement a tag. This is different from the Python Scripting Tag as it appears in the C4D desktop application. For your question: Yes it possible, but I am not sure if things are what you expect them to be. Building dynamic interfaces is always quite a hassle and Cinema4D is certainty no exception to that rule.
The first bit of information is that the Python Scripting Tag also supports implementing a
message function which will allow you to listen for button clicks. The second piece would be that
c4d.BaseList2D implements methods for adding and removing user data. Here is a short snippet which shows how to manipulate user data sitting on a Python Scripting Tag with that tags python code:
import c4d #Welcome to the world of Python def main(): pass #put in your code here def message(mid, data): """ """ # Check if the message data contain a UserData event if isinstance(data, dict) and "id" in data: if data["id"].id == c4d.ID_USERDATA: # Here you have to check for the ID of the Add/Remove button IDs as they appear in # your user data editor. For me it was the IDs 1(Add) and 2(Remove). # Add button adds a UserData element to the tag. Code as in SDK example code of # BaseList2D.AddUserData(). if data["id"].id == 1: bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG) # Create default container bc[c4d.DESC_NAME] = "Test" # Rename the entry element = op.AddUserData(bc) # Add userdata container op[element] = 30 # Assign a value c4d.EventAdd() # Update # Remove button removes the last element of your user data. For details see # BaseList2D.RemoveUserData() int the SDK. elif data["id"].id == 2: _desc_id_last_item = op.GetUserDataContainer()[-1] op.RemoveUserData(_desc_id_last_item) c4d.EventAdd()
These are the viewport rendering options attached to a
BaseDraw which you can adjust either globally or per viewport locally. The visibility flags of objects are stored in the in objects itself (check out N-Bit Handler in
c4d.GeListNode for details).
The only way I could think of would be to do it sort of manually.
BaseDrawyou want the object to appear in.
BaseDrawto be passed to the
BaseDrawyour object manually.
This does not seem to be a very practical approach unless you absolutely have to achieve your desired functionality.
Ok, thank you. I was a bit unsure what "one ring points" are supposed to be and if this is actually a bug and not a feature ;)
I was probably a bit unclear about my intentions in the initial posting. I am aware that retrieving the connected points with other methods of the
Neighborclass is trivial. This posting should be read as either a bug report or at least my opinion that the SDK documentation is very ambiguous about the purpose of the method
I am not looking for a technical solution. The whole flag your posting thing here confuses me a bit ;)
Environment: R20, Win
is it possible that the method
c4d.utils.Neighbor.GetPointOneRingPoints() is (currently) bugged? The documentation states that it will return "the points that are attached through one edge to the given point". The problem occurs on points which are either edge or corner cases of a non-closed surface. Below is a simple example to illustrate the problem. The orange points are the inputs for the method, the green points are the output, and red points are points not included in the output - but I would expect them to be included:
One can reproduce the behavior in the console on a similar topology (and different point IDs) with the following code:
>>> from c4d import utils >>> nbr = utils.Neighbor() >>> nbr.Init(op) True >>> nbr.GetPointOneRingPoints(26) #edge case [52, 27] >>> nbr.GetPointOneRingPoints(39) #default case [65, 38, 40, 13] >>> nbr.GetPointOneRingPoints(25) #corner case 
Thank you for your attention,