function Delete?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/05/2004 at 12:32, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    is there any way to delete/destroy object from the scene using COFFEE command???



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/05/2004 at 15:46, xxxxxxxx wrote:

    Hi,

    the following example command plugin deletes the selected object. I hope it helps :)

    Ciao,
    Marcus

    ------------->8----------------
    <CODE>
    const var myID = 1000001;

    class DeleteObject : MenuPlugin
    {
        public:
          
            DeleteObject();
            GetID();
            GetName();
            GetHelp();
            GetState();
            Execute(curDocument);
    }

    DeleteObject::DeleteObject() { super(); }
    DeleteObject::GetID() { return myID; }
    DeleteObject::GetName() { return "DeleteObject"; }
    DeleteObject::GetHelp() { return "Deletes current object."; }

    DeleteObject::GetState()
    {
        var curDocument = GetActiveDocument();
        if (!instanceof(curDocument, BaseDocument)) {
            return 0;
        }
        var curObject = GetActiveObject(curDocument);
        if (!instanceof(curObject, BaseObject)) {
               return 0;
        }
        return CMD_ENABLED;
    }

    DeleteObject::Execute(curDocument)
    {
        var curObject = GetActiveObject(curDocument);
        if (!instanceof(curObject, BaseObject)) {
            return;
        }
        if (!curObject->Remove()) {
            println("Could not delete object.");
        }
        GeEventAdd(DOCUMENT_CHANGED);
        return;
    }

    main()
    {
        Register(DeleteObject);
    }
    [/CODE}



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/05/2004 at 03:00, xxxxxxxx wrote:

    thanks.


Log in to reply