Prevent object plugin from being copied



  • On 20/02/2015 at 12:45, xxxxxxxx wrote:

    I have a custom object and it has an issue when cloning by holding CMD and dragging a axis. Usually that just clones the object, but it's making some of items in my plugin act strange. Is there a message call in a plugin when a clone happens? If not, can I just disable copying an object that way?

    Thanks, 
    Joe



  • On 23/02/2015 at 08:31, xxxxxxxx wrote:

    Hello,

    as far as I can tell it is not possible to prevent an object from being copied. But if there are any problems when your object is copied you should fix that problems.

    You can implement NodeData.CopyTo() which will be called when the object is copied. Please notice that the object will also be copied when it is changed in any way to create the undo stack.

    Best wishes,
    Sebastian



  • On 09/03/2015 at 01:28, xxxxxxxx wrote:

    Hello Joe,

    was your question answered?

    Best wishes,
    Sebastian



  • On 21/04/2015 at 09:17, xxxxxxxx wrote:

    Sorry for delay. This somewhat helps. But heres the main issue. I'm changing NBits of children so they are hidden. If I copy and paste an object, everything is fine. But if I hold CMD and drag (to copy the object), all NBits stay the same except on the original object, the NBIT_EHIDE gets reset.

    I've tried listening to different flags on the NodeData.CopyTo() and reset the NBit on a flag, but I've had no luck.

    This seems to be a bug because it's only that NBit that gets reset. Can anyone confirm?



  • On 22/04/2015 at 00:15, xxxxxxxx wrote:

    Hello,

    could you provide us with the necessary code to reproduce the described behavior?

    Best wishes,
    Sebastian



  • On 23/04/2015 at 08:16, xxxxxxxx wrote:

    https://www.dropbox.com/sh/89oxeizqegm9cr2/AABZOkUbbBPZrgEUZvG0aiLYa?dl=0

    I put this together as a test. To see what I'm explaining. Add a cube as a child to the object. Press the Hide button. Now, CMD-Drag to copy it, it will remain hidden in the object manager, but visible in the editor.

    If you were to copy-paste, it would retain it's NBits.

    Ideas?



  • On 27/04/2015 at 09:18, xxxxxxxx wrote:

    Hello,

    I looked into the issue and I'm afraid there is no simple solution. The NBIT_EHIDE is restored on purpose and it is only possible in C++ to react properly to that event.

    So the only hack to handle this that I can think of right now is to catch a frequently sent message to re-set the bit of the child objects. Such a message could be MSG_GETCUSTOMICON.

    It is actually possible to prevent that an object can be copied in the viewport. One can add a Protection Tag; if "Allow Viewport Dublication" is disabled, it is not possible.

    Best wishes,
    Sebastian


Log in to reply