BaseContainer::SetLink with cloned object



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

    On 06/06/2004 at 08:51, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.206 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi,
     
    Having a bit of trouble inserting an cloned object into a BaseContainer.
    Im doing a simple CurrentStateToObject command, and want to add the returned object into the BC.

        
        
        
        
           ModelingCommandData cd;  
           cd.doc = GetActiveDocument();  
           cd.op = op;  
           if(!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT,cd)) return FALSE;  
            
           BaseObject *oClone = (BaseObject* )cd.result1;  
           BaseContainer *bctag = tag->GetDataInstance();
        
        
        
        
         
        
        
        
        
           bctag->SetLink(DUMMY, oClone);
        
        
        
        
         
        
        
        
        
           BaseObject *object = bctag->GetObjectLink(DUMMY,GetActiveDocument());  
        
    

    As you can see, I directly read the link back again, but object variable is always NULL.
    What confuses me is

        
        
        
        
        bctag->SetLink(DUMMY,op)
        
        
        
    

    works. Both op and oClone are of type BaseObject* so I can't see why one works and the other don't



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

    On 06/06/2004 at 09:33, xxxxxxxx wrote:

    the returned object is not in the document that the tag is in I guess. Well, then it won´t work. At least that would be my spontaneous assumption.
    You cannot buy buns when there´s no baker or mall near you either! ;o)



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

    On 06/06/2004 at 09:34, xxxxxxxx wrote:

    Or: are you sure that the returned object is valid, so not NULL?



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

    On 06/06/2004 at 09:35, xxxxxxxx wrote:

    yea, everything not NULL. first thing I checked.



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

    On 06/06/2004 at 09:57, xxxxxxxx wrote:

    Ok, you was right 3D Designer.
    If I insert the clone object into the document then it works.
     
    but, I dont want to add the clone into the document.



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

    On 06/06/2004 at 10:04, xxxxxxxx wrote:

    But what reason do you have to link it then when it´s not in the document anyway?



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

    On 07/06/2004 at 02:45, xxxxxxxx wrote:

    The reason is purely for a quick shortcut.  I want a tag to hold information about a few objects in my scene. I want the tag to hold things like polygon array, object matrix, color properties, the GetName() of multiple objects.
     
    But I dont want to hold information of the actual object, so I made a clone so I can modify the contents without distrupting the real objects in the scene.
     
    I thought I would add the object into a basecontainer to save me the agony of creating a custom datatype to save the information I need.
    It was just for a quick hack as I don't have experience creating custom data types and wanted to see results quickly.
     
    But I should know that nothing is  as easy as you expect :)
     
    So time to learn about custom data types


Log in to reply