PluginTag



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

    On 07/01/2011 at 07:13, xxxxxxxx wrote:

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

    ---------
    Hello Guys, i want to write an ExpressionTagPlugin.
    Except of the Execute-Function everthing works fine, and i can't fingure out why .. :/

    var i;  
    class tPI : ExpressionPluginTag {  
    public:  
     tPI();  
     GetID();  
     MultipleAllowed();  
     DisplayAllowed();  
     GetIcon();  
     GetHelpText();  
     UseMenu();  
     GetName();  
       
      Execute(doc,op);  
    }  
    tPI::tPI() { super(); }  
    tPI::GetID() { return TAG_ID; }  
    tPI::MultipleAllowed() { return false; }  
    tPI::DisplayAllowed() { return true; }  
    tPI::GetIcon() { return icon; }  
    tPI::GetHelpText() { return "something..."; }  
    tPI::UseMenu() { return true; }  
    tPI::GetName() { return TAG_NAME; }  
    tPI::Execute(doc,op) {  
      i++;  
      println(i);  
    }
    

    Thanks in advance, nux



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

    On 07/01/2011 at 17:48, xxxxxxxx wrote:

    Nobody got an idea? 😢



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

    On 07/01/2011 at 19:32, xxxxxxxx wrote:

    Hello nux,
    I felt bad for you not getting any help. So I registered here so I could give you a hand.

    First - your i variable isn't declared with any data. So the program doesn't know what to do with when you ask it to increment it using i++.  It doesn't know if it is an integer type, string type , vector type, etc...

    Second- After you fix that problem with var i =0; You'll end up running an infinite loop the way it's written inside of your execute function.

    Here's a working example based on what you're trying to do.
    Name it  something like mytag.cof and put it in your plugins folder.
    Then open C4D--> open the console--> create an object-->Then add the tag.
    You should see the results of the execute function happen in the console:

    const var PLUGIN_ID = 1000009; //Testing ID ONLY!!!!
    var tagIcon;

    var i = 0; // Setting this to zero makes the program understand that this is a numeric value type
    class myTag : ExpressionPluginTag // the myTag's class
    {
    public:
      myTag();
      GetID();
      MultipleAllowed();
      DisplayAllowed();
      GetIcon();
      GetHelpText();
      UseMenu();
      GetName();
      Edit(); 
      Execute(doc, op);
    }

    myTag::myTag()
    {
      // Call parent constructor
      super();
    }

    myTag::GetID() { return PLUGIN_ID; }
    myTag::MultipleAllowed() { return TRUE; }
    myTag::DisplayAllowed() { return TRUE; }
    myTag::GetIcon() { return tagIcon; }
    myTag::GetHelpText() { return "This is my expression tag plugin"; } // Bubble help text. If option is turned on in the preferences
    myTag::UseMenu() { return TRUE; }
    myTag::GetName() { return "My Expression Tag"; } //The text displayed for the tag in the OM/ and lower right corner of UI

    myTag::Edit()
    {
     //put any initalization type of code in here.....
    }

    myTag::Execute(doc, op)
    {
    if(i<20) // This will stop once it reaches the value of 20..No infinite looping
     {
      i++;
      println(i);
     }

    EventAdd(); //This will make the code automatically run, without scrubbing the slider, until it reaches the value of 20
    return;           
    }

    /////////
    // Main

    main()
    {
      // Get the icon
      //var fn = GeGetRootFilename();
      //fn->RemoveLast();
      //fn->AddLast("xrayicon.tif");

    //tagIcon = new(BaseBitmap,1,1);
      //tagIcon->Load(fn);

    // Registers the tag
      Register(myTag);
    }

    I commented out the bitmap map stuff at the bottom so it will run.
    I have some more simple examples. If you want them send me an e-mail at scottasba@hotmail.com

    Hope this helps you out,
    -ScottA



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

    On 08/01/2011 at 03:44, xxxxxxxx wrote:

    I've rewritten the Plugin along your explanations, and it works, thanks man !!! 👏🙂👍❤
    Dunno where my Issue was, but most important is, it works !!
    *I'm glad* :D


Log in to reply