how to use DESC_ACCEPT / DESC_REFUSE [SOLVED]



  • On 23/05/2015 at 22:18, xxxxxxxx wrote:

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

    ---------
    I'm creating a link box dynamically, inside a tag, in GetDDescription()

      
    cid = DescLevel(MATERIAL_LINK, DTYPE_BASELISTLINK, 0);
    if (!singleid || cid.IsPartOf(*singleid, nullptr)) // important to check for speedup c4d!
    {
        BaseContainer slink = GetCustomDataTypeDefault(DTYPE_BASELISTLINK);
        slink.SetString(DESC_SHORT_NAME, "Material");
        slink.SetString(DESC_NAME, "Material");
        slink.SetContainer(DESC_ACCEPT, MY_MATERIAL_PLUGIN_ID);
        if (!description->SetParameter(cid, slink, DescLevel(TAG_GROUP)))
            return true;
    }  
    

    I want to accept only my MaterialData plugin.



  • On 24/05/2015 at 10:41, xxxxxxxx wrote:

    There seems to be some confusion about them and not much information.

    https://plugincafe.maxon.net/topic/2094/1444_descrefuse--descaccept&KW=DESC_ACCEPT

    If you can't get it working, another approach is to check for the MSG_DESCRIPTION_CHECKDRAGANDDROP message.  There you can accept/refuse programmatically:

    // NodeData.Message
    //*---------------------------------------------------------------------------*
    Bool GCBInfoTag::Message(GeListNode* node, LONG type, void* data)
    //*---------------------------------------------------------------------------*
    {
    	if (!node)	return FALSE;
    	if (type == MSG_DESCRIPTION_CHECKDRAGANDDROP)
    		return MsgCheckDragAndDrop(static_cast<DescriptionCheckDragAndDrop*>(data), static_cast<BaseTag*>(node));
    	return SUPER::Message(node,type,data);
    }
    // GCBInfoTag.MsgCheckDragAndDrop - Message MSG_DESCRIPTION_CHECKDRAGANDDROP
    //*---------------------------------------------------------------------------*
    Bool GCBInfoTag::MsgCheckDragAndDrop(DescriptionCheckDragAndDrop* dcdd, BaseTag* tag)
    //*---------------------------------------------------------------------------*
    {
    	// Accept/Decline
    	if (!dcdd)					return TRUE;
    	// GreeblerObj/Tag LinkBox
    	if (dcdd->id[0].id == TGCBINFO_LINK)
    	{
    		BaseObject*		orig =		tag->GetObject();
    		if (!orig)					return FALSE;
    		BaseList2D*		element =	static_cast<BaseList2D*>(dcdd->element);
    		if (!element)				return FALSE;
    		// ----------				Must be GreeblerObject or GreeblerTag
    		dcdd->result =				element->IsInstanceOf(ID_GREEBLEROBJ) || element->IsInstanceOf(ID_GREEBLERTAG);
    	}
    	return TRUE;
    }
    


  • On 25/05/2015 at 03:59, xxxxxxxx wrote:

    Hi Mohamed,

    Originally posted by xxxxxxxx

    slink.SetContainer(DESC_ACCEPT, MY_MATERIAL_PLUGIN_ID);
    

    A container isn't set there as MY_MATERIAL_PLUGIN_ID seems to be an integer value.
    Here's how you can simply set the DESC_ACCEPT container:

    BaseContainer accept;
    accept.SetInt32(MY_MATERIAL_PLUGIN_ID, 1);
    slink.SetContainer(DESC_ACCEPT, ac);
    


  • On 25/05/2015 at 07:50, xxxxxxxx wrote:

    thanks Robert, and Yannick, this is quite simple  and straight forward "I encourage to put this example in the SDK documentation".



  • On 25/05/2015 at 08:25, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I encourage to put this example in the SDK documentation.

    That's a good idea. I'll add a short code snippet to DESC_ACCEPT and DESC_REFUSE.


Log in to reply