instanceof() clears BaseObject pointer

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

On 04/01/2005 at 10:28, xxxxxxxx wrote:

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

---------
I've received a valid bug report for one of my COFFEE plugins that only occurs in R9.012 (no problems in earlier supported versions). Here is the code:

  
     var oc, op;  
     if (!(op = GetActiveObject(doc))) return;  
  
     // Process active Object  
     // - Make editable if necessary  
     if (!instanceof(op, PointObject))  
     {  
          var bc = new(BaseContainer);  
          doc->StartUndo();  
          doc->AddUndo(UNDO_OBJECT_REC, op);  
          SendModelingCommand(MCOMMAND_MAKEEDITABLE, doc, op, bc, MODIFY_ALL);  
          doc->EndUndo();  
          op = GetActiveObject(doc);  
          undos = TRUE;  
     }  
// This line prints!  
     if (!op) println("That ain't right!");  

And, yes, there is an active object in the first call. This could be related to SendModelingCommand()?

Any work arounds for this - like an update to COFFEE, finally? 😉

Thanks,
Robert

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

On 04/01/2005 at 11:27, xxxxxxxx wrote:

Worked it out. Definitely a difference in SendModelingCommand() causing the issue. The workaround is not to try to do it to a Nullobject grouped set in R9. What did you guys do in R9?! 😉

Thanks,
Robert