Protect objects against removing

On 01/09/2017 at 14:28, xxxxxxxx wrote:


what would be the best way to make objects unremovable? I have an ObjectData with some children in it. I need the children to get input from positions, rotations etc. So it is important to be able to activate them. But I want them to be not removable from the document.

Ive tried 2 ways.

1. Checking if the children still exist, if not do Undo with doc.DoUndo(). But I didnt get it to work. I think it isn´t possible to call DoUndo() from ObjectData. EDIT: It is possible anyhow, but I think doing undo isn´t the smartest way.

2. Storing clones of active children (with parent and pred) in a class member and if a child doesn´t exist anylonger the clone will be inserted. Works, but I have troubles with undos.

So how can I protect objects against removing from OM, scene, document?

Thx and greetings

On 03/09/2017 at 08:15, xxxxxxxx wrote:

Ok, the behavior I´d like to get is equal to the hidden objects in the character object. In adjust mode I´m allowed to activate them, but deleting isn´t possible. I´ve wrote a little script to remove them with selectedlittlehiddenobject.Remove() and it removes. So I think I need to block the delete command if object abc is active to get the solution.

I hope python isn´t limited as regards that. I´ll take a look.

On 03/09/2017 at 08:51, xxxxxxxx wrote:

It's very weird to don't allow user to remove an object. Should this object is a children of your generator? How do you control this object? If there is nothing secret.

Anyway you could do this. So user will not be able to remove it. (op.Remove() will still wrok, but who gonna do it excepted user frustated to not be able to delete it? :p)

    op.ChangeNBit(c4d.NBIT_OHIDE, c4d.NBITCONTROL_SET)

On 03/09/2017 at 09:05, xxxxxxxx wrote:

Hi gr4phOs,

thx for your reply, but as far as I can see setting NBIT_OHIDE to true only hide the object in OM. But the object will stay removable.

Of course, it seems to be weired, but for children of an ObjectData it makes sense to me. The character object works in the same way.

On 03/09/2017 at 09:18, xxxxxxxx wrote:

Ok found it ! :)

    op.ChangeNBit(c4d.NBIT_NO_DELETE , c4d.NBITCONTROL_SET)
    op.ChangeNBit(c4d.NBIT_NO_DD , c4d.NBITCONTROL_SET) #No drag and drop

R18+ only  regarding

For before version I guess your best bet is to deal with Clone(), and order your undo issue.

On 03/09/2017 at 09:21, xxxxxxxx wrote:

There are some NBITs, which are not documented in PySDK, e.g. c4d.NBIT_NO_DELETE. Set true and the object isn´t deletable from the OM, but from the viewport :( and with Edit/Delete.

EDIT: Thx again ... same idea ;)

On 04/09/2017 at 05:07, xxxxxxxx wrote:


Character Components cannot be deleted because of special code in the Cinema 4D core. The resulting behaviour cannot be reproduced. It seems the next best thing is indeed to set NBIT_NO_DELETE.

best wishes,

On 04/09/2017 at 05:38, xxxxxxxx wrote:


thx for the information :)
So Ive to work with what I got.

Thx again