Coffeetag: Global variables
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/01/2011 at 06:40, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform:
Language(s) :---------
Hi,my global variables get set to null when e.g. using the extrude tool on op.
Same thing when i undo a Change of the mesh of op.
How can i prevent from this ?thanks, nux
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/01/2011 at 05:25, xxxxxxxx wrote:
You can't prevent this for the COFFEE tag. You have to use a ExpressionPluginTag. There you can store the values in a member variable. To keep the data of the member variable intact you also need to override the Copy Save and Load methods of the base class.
Here is a simple example showing the concept. The variable text is my 'global' variable.
class MyExpressionPluginTag : ExpressionPluginTag { var text; public: MyExpressionPluginTag(); GetID(); MultipleAllowed(); DisplayAllowed(); GetHelpText(); UseMenu(); GetName(); Edit(); Execute(doc, op); Copy(dest); Save(hf); Load(hf); } MyExpressionPluginTag::MyExpressionPluginTag() { // Call the parent constructor super(); } MyExpressionPluginTag::GetID() { return 1025002; } MyExpressionPluginTag::MultipleAllowed() { return FALSE; } MyExpressionPluginTag::DisplayAllowed() { return TRUE; } MyExpressionPluginTag::GetHelpText() { return "test"; } MyExpressionPluginTag::UseMenu() { return TRUE; } MyExpressionPluginTag::GetName() { return "test"; } MyExpressionPluginTag::Edit() { } MyExpressionPluginTag::Execute(doc, op) { if (text == nil) text = "hello"; else text = "world"; println(text); } MyExpressionPluginTag::Copy(dest) { //copy variable to destination dest->text = text; } MyExpressionPluginTag::Load(hf) { if (text != nil) text = hf->ReadString(); } MyExpressionPluginTag::Save(hf) { if (text != nil) hf->WriteString(text); } main() { Register(MyExpressionPluginTag); }
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/01/2011 at 10:17, xxxxxxxx wrote:
I already thought about using a real Plugin, but i wanted to be able to use the Attributesmanager, and no dialog. Is it not possible to implement such functionality to COFFEE or does Maxon just not have the time for it ?