Tag Location in the Object Manager



  • On 30/05/2014 at 11:01, xxxxxxxx wrote:

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

    ---------
    Hello all,

    I'm trying to have Cinema display a specific  mouse icon while something is being dragged over a tag plugin in the Object Manager.  I only want my changed cursor  to be there while the cursor is over the tag and if the mouse is released while over the tag something happens.

      
    //while the left mouse button is held down  
    while (state.GetLong(BFM_INPUT_VALUE) == TRUE)  
    {  
          //get mouse state  
          if(!GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSELEFT, state)) return TRUE;  
           //change mouse cusor  
          GeShowMouse(MOUSE_QUESTION);  
          //if the left mouse bottom is let go  
          if (state.GetLong(BFM_INPUT_VALUE) == FALSE)  
         {  
               //Mouse released over tag  
         }  
    }  
    

    My current idea is to just break out of my while loop when the mouse moves off of the tag, but I don't know how to get the location of that.

      
    while (state.GetLong(BFM_INPUT_VALUE) == TRUE)  
    {  
          if(!GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSELEFT, state)) return TRUE;  
           // need to find the left, right, top, and bottom bounds of my tag  
          //idea  
          if ( !(left < state.GetLong(BFM_INPUT_X) < right)  and !(bottom < state.GetLong(BFM_INPUT_Y) < top)) break;  
      
          GeShowMouse(MOUSE_QUESTION);  
      
          if (state.GetLong(BFM_INPUT_VALUE) == FALSE)  
         {  
               //Mouse released over tag  
         }  
    }  
    

    Am I going about this the wrong way or is there a way to get the tag's position in the Object Manager?

    As always, thanks
    Dan



  • On 05/06/2014 at 10:50, xxxxxxxx wrote:

    Hi,

    I spent some more time on this and can't find a way to get it working along this trail of thought.

    Is there a way I can duplicate the type of functionality that a material being dragged onto an object has?

    When you drag the material over an object in the Object Manager the mouse cursor changes to show you can drop it there, when you're over a non texture tag though it shows that you can't drop it there.

    A scenehook plugin seems to be similar to what I need, but I need to change the cursor while in object manager and not in an editor window.

    Dan



  • On 05/06/2014 at 12:48, xxxxxxxx wrote:

    This is an example for a tag plugin.
    If you drag your custom tag around the OM with this code in it. It gets the names and ID#s of the things you're dragging over in the OM. And if you drag over a Cube object it will change the icon and it won't add the tag.
    NOTE : It's still possible for the user to add the tag to the Cube if they drag on the right side of the Cube's OM entry. We've been told it's not possible to restrict that behavior. So this is kind of a lost cause. And not really worth implementing IMHO.

    Bool SimpleTag::Message(GeListNode *node, LONG type, void *data)  
    {  
      BaseTag    *tag = (BaseTag* )node;                   //Get the tag and assign it to a variable  
        
      switch(type)                                     //Also commonly named "id" in some plugins  
      {    
          case MSG_DRAGANDDROP:  
          {  
              DragAndDrop *dd = (DragAndDrop* )data;    //Create an instance of the Drag & Drop class  
              if (dd)  
              {  
                  BaseList2D *bl = NULL;  
      
                  if(dd->flags & DRAGANDDROP_FLAG_SOURCE && dd->data!=NULL)  
                  {  
                      C4DAtom *atom = (C4DAtom* )dd->data; //Cast the tag object to a drag & drop type   
      
                      if(atom != NULL)  
                      {  
                          bl = (BaseList2D* )atom;  
                          GePrint(bl->GetName());  
                          GePrint(LongToString(dd->y));  
                          GePrint(LongToString(dd->x));  
                          if(bl->GetName() == "Cube") dd->flags = DRAGANDDROP_FLAG_FORBID;  //Don't allow to drop the tag on this object  
                      }  
                  }  
              }  
          }  
          break;  
      }  
      
      tag->SetDirty(DIRTYFLAGS_DATA); //Used to update a Tag's AM GUI items  
      return TRUE;  
    }
    

    -ScottA



  • On 05/06/2014 at 13:55, xxxxxxxx wrote:

    Hi Scott,

    I'm doing a bit different than dragging the tag onto an object, but the code you posted was exactly what I needed.  Thanks a ton!

    Dan


Log in to reply