Copy link object



  • Hi.

    I copied the object of link field in the virtual object with GetClone ().

    However, if the type of the linked object is a generator type such as instance, it can not be displayed properly below the linked object on the object manager.

    I checked past posts and found that they have priority issues.
    But I do not know how to solve it.

    https://plugincafe.maxon.net/topic/6250/6615_clone-of-a-linked-object

    Please let me know if anyone knows who you are.



  • Hi @anoano.

    I will need more information.
    I'm not sure in which context you are, when you say virtual object I think you refer to be inside of a Generator and the GetVirtualObjects method isn't?

    Moreover, when you say a link, you refer to a LinkBox parameter, so the linked object can be anywhere and not necessary a Child of the current Generator, isn't?

    Last stuff, please make sure to mark your topic as a question. I've done it for this time (don't worry you are new, no issue at all), see Q&A New Functionality.

    Cheers,
    Maxime.



  • Re: Copy link object

    This is the code I wrote.

    BaseObject *HyperINS::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)
    {
            BaseContainer* bc = op->GetDataInstance();
    	BaseObject* main = BaseObject::Alloc(Onull);
    	if (!main) return nullptr;
    	
    	BaseObject    *link= (BaseObject*)bc->GetLink(ID_LINK, hh->GetDocument());
    	if (!link) return main;
    		
    	AutoAlloc<AliasTrans> aliastrans;
            if (!aliastrans || !aliastrans->Init(hh->GetDocument())) return main;
            
            BaseObject* ref = static_cast<BaseObject*>(link->GetClone(COPYFLAGS::NONE, nullptr));
    
            aliastrans->Translate(true);
    
            ref->InsertUnder(main);
    		
    	return main;
    }
    

    It will not work at the manager's position.

    alt text
    alt text



  • Hi, the topic is now marked as solved, did you solve your issue?

    The only workaround I was able to find is to make use of AddToExecution and define it to GENERATOR+1, here you retrieve and clone the cache of the linked object in a member variable of your instance, then in the next GVO you make use of this cache, but this has the application that you work always on a mesh that has been generated in a previous SceneExecution call, which may be an issue in case of animation.

    Cheers,
    Maxime.


Log in to reply