MCOMMAND_JOIN bug?



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

    On 26/02/2011 at 10:48, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10+ 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Howdy,

    Is there a bug or something in the MCOMMAND_JOIN modeling command?

    It seems that if I try to connect 2 object with MCOMMAND_JOIN it fails if the 2 objects have different parent objects. So I tried creating a temporary document and copying the object to be joined into that document each one on the root level, then using the command on the temporary document, and bring the result back into the active document. The join failed. The resulting mesh is only one of the selected meshes.

    Here's my test code:

    Bool CDTestCommand::Execute(BaseDocument *doc)
    {
    	StopAllThreads(); // so the document can be safely modified
    	
    	AutoAlloc<AtomArray> objects; if (!objects) return FALSE;
    	doc->GetActiveObjects(objects,FALSE);
    	
    	// temporary storage
    	AutoAlloc<AtomArray> joinOps; if (!joinOps) return FALSE;
    	AutoAlloc<BaseDocument> tempDoc; if(!tempDoc) return FALSE;
    	
    	LONG i, oCnt = objects->GetCount();
    	if(oCnt > 1)
    	{
    		for(i=0; i<oCnt; i++)
    		{
    			BaseObject *mrg = static_cast<BaseObject*>(objects->GetIndex(i));
    			if(mrg)
    			{
    				BaseObject *cln = (BaseObject* )mrg->GetClone(COPY_NO_HIERARCHY|COPY_NO_ANIMATION,NULL);
    				if(cln)
    				{
    					tempDoc->InsertObject(cln,NULL,NULL);
    					cln->SetMg(mrg->GetMg());
    					joinOps->Append(cln);
    				}
    				else GePrint("GetClone() failed");
    			}
    			else GePrint("merge object "+LongToString(i)+" = NULL");
    		}
    		
    		doc->StartUndo();
    		
    		ModelingCommandData mcd;
    		mcd.doc = tempDoc;
    		mcd.arr = joinOps;
    		if(SendModelingCommand(MCOMMAND_JOIN, mcd))
    		{
    			BaseObject *newOp = static_cast<BaseObject*>(mcd.result->GetIndex(0));
    			if(newOp)
    			{
    				doc->StartUndo();
    				
    				doc->InsertObject(newOp,NULL,NULL);
    				newOp->SetName("Joined Objects");
    				doc->AddUndo(UNDO_NEW,newOp);
    				
    				newOp->SetMg(Matrix());
    				
    				doc->SetActiveObject(newOp);
    				
    				doc->EndUndo();
    			}
    		}
    		
    		EventAdd(EVENT_FORCEREDRAW);
    	}
    		
    	return TRUE;
    }
    

    Is something wrong with my code?

    Adios,
    Cactus Dan



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

    On 01/03/2011 at 08:07, xxxxxxxx wrote:

    Howdy,

    OK, never mind.

    I decided to use this instead:

    CallCommand(12144);
    

    Adios,
    Cactus Dan



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

    On 01/03/2011 at 10:19, xxxxxxxx wrote:

    I've posted a bug concerning the SMC and the Mirror tool here.
    But that's not the only SMC I've had problems with. Mostly in Coffee.

    I have a feeling that there are at least a few more of them in there that also don't work properly Dan.
    And someone needs to go through them and see what's broken.
    Probably a good job for an intern. If Maxon has coding interns.

    -ScottA



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

    On 16/03/2011 at 08:46, xxxxxxxx wrote:

    Does it work now in C++ ?
    I'm not a C++'er so I can't test it.

    Cheers, nux



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

    On 16/03/2011 at 10:33, xxxxxxxx wrote:

    These SMC bugs are based in C++.
    ASFAIK. Coffee and Python are derived from the C++ API. So if something is broken in C++ then they also won't work in Coffee & Python.

    -ScottA


Log in to reply