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 [email protected]
Hope this helps you out,
-ScottA