creating custom tags

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

On 23/01/2003 at 08:57, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.012 
Platform:   Windows  ;   
Language(s) :   C.O.F.F.E.E  ;

---------
Hi,
my first post here...
I want to make a custom tag for an 3d-engine exporter.
To do this, I have to define a new tag class by extending the
BaseTag class, right?
This is a first test with no additional functions:
_

    
    
    _
    
    
    
    
     class zSortTag: BaseTag  
    {  
    public:  
    zSortTag();  
    }  
      
    zSortTag::zSortTag() {  
    return super();  
    }  
     _

_
Now, when I try to apply this to an object (via object->InsertTag ), I get FALSE as result. What´s wrong with my class?

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

On 23/01/2003 at 14:13, xxxxxxxx wrote:

I think you need to add Edit() as well and return TRUE. (Otherwise C4D thinks that the user pressed Cancel in your dialog, so it creates no tag.)

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

On 24/01/2003 at 09:37, xxxxxxxx wrote:

this doesn´t work:

  
class zSortTag : BaseTag  
{  
public:  
zSortTag();  
Edit();  
}  
  
zSortTag::zSortTag() {  
return super();  
}  
  
zSortTag::Edit() {  
return TRUE;  
}  

any clues?

thx,
Florian

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

On 26/01/2003 at 23:44, xxxxxxxx wrote:

Do Constructors need a return? I don't think so.

    
    
    
    
    zSortTag::zSortTag() {  
      super();  
    }
    
    
    

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

On 27/01/2003 at 13:54, xxxxxxxx wrote:

You also need a GetID() that returns a unique ID from PluginCafe.

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

On 28/01/2003 at 01:02, xxxxxxxx wrote:

added GetName() and GetID(),
but doesn´t help...

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

On 28/01/2003 at 11:47, xxxxxxxx wrote:

Hmm, that's really strange. I have tags running with C.O.F.F.E.E. in R8. Here's a simple example that works for me:

    
    
    const var MYTAG_ID = 1011203;  
    var mytag_icon;
    
    
    
    
    class MyTag : ExpressionPluginTag  
    {  
    public:  
      MyTag();  
        
      GetID();  
      GetIcon();  
      Edit();  
      GetName();  
      Execute(doc, op);  
      GetHelpText();  
        
      MultipleAllowed();  
      DisplayAllowed();  
      UseMenu();  
    }
    
    
    
    
    MyTag::MyTag() { println("MyTag"); super(); }  
    MyTag::GetID() { println("GetID"); return MYTAG_ID; }  
    MyTag::Edit() { println("Edit"); return TRUE; }  
    MyTag::GetName() { println("GetName"); return "My Tag"; }  
    MyTag::Execute(doc, op) { println("Execute"); return TRUE; }  
    MyTag::GetHelpText() { println("GetHelpText"); return "My Tag"; }  
    MyTag::MultipleAllowed()   { println("MultipleAllowed"); return TRUE; }  
    MyTag::DisplayAllowed()    { println("DisplayAllowed"); return TRUE; }  
    MyTag::GetIcon() { println("GetIcon()"); return mytag_icon; }  
    MyTag::UseMenu() { println("UseMenu"); return TRUE; }
    
    
    
    
    main()  
    {  
      mytag_icon = new(BaseBitmap, PLUGINTAG_ICON_SIZE, PLUGINTAG_ICON_SIZE);  
      mytag_icon->SetPen(vector(0.2, 0.3, 0.7));  
      mytag_icon->DrawRect(0,0,PLUGINTAG_ICON_SIZE,PLUGINTAG_ICON_SIZE);  
      println("main");  
      Register(MyTag);  
    }

(The culprit might have been UseMenu().)

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

On 29/01/2003 at 09:34, xxxxxxxx wrote:

great!
I should have tried ExpressionPluginTag instead of extending BaseTag! that probably doesn´t work.

Thanks a lot for your help!
I think it will be no problem now, to build the tag I need.

Florian

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

On 29/01/2003 at 14:44, xxxxxxxx wrote:

Doh, didn't see that. PluginTag should be fine as well if you want to show up in the Tag menu instead of Expressions menu.