Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Loosing Data when undo

    SDK Help
    0
    6
    492
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 07/04/2004 at 06:12, xxxxxxxx wrote:

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

      ---------
      Hi
      I've experienced some bad data lost when using big array variables in a tag.
      It is worst in 8.5 but also happens in 7.3, when I undo some kind of change done to the object using the tag.
      It doesn't happen always, and is confusing me a lot.

      Here's a testing Code I made (long)
      Its a simple plugin that creates an expression tag.
      The tag stores a 500 items array.
      A button increases by one the last item in the array.
      The value of the last item in the array is printed in the console every redraw for testing.

      So if you make a big sphere (100 segments). Then click the button till the last item in the array is very high (100).
      Then you select a bunch of points in the sphere and move them arround several times (arround 50 for testing 8.5 and 3 for testing 7.3) and then just start clicking undo...
      In 8.5 suddenly the array will loose the data and get the default values. ie(console will show: 100,100,100,100,0,0,0).
      In 7.3 the data is lost when it starts undoing the data change after undoing some point movments, so it jumps (ie, console prints: 100,100,100,99,98,87,0,0,0,0,0).

      Am I doing something wrong or is it a COFFEE or C4d issue? or does it just happen in my puter?
      Could that BackupTags class help in anyway?
      If is COFFEE, can it be fixed porting it to C++?

      Also, why it behaves exactly the same weather I have or not the start,add,end undo lines?

      Thanks
      eago

        
        
        
      //////////  
      ///arraysdial.col  
        
      class Dial : GeDialog  
      {  
           public:  
                Dial();  
                CreateLayout();  
                Command(id,msg);  
                GetTag();  
                var op;  
      }  
        
      Dial::Dial()  
      {  
           super(1000001);  
      }  
        
      Dial::CreateLayout()  
      {  
           AddButton(10,0,120,10,"click a lot");  
      }  
        
      Dial::Command(id,msg)  
      {  
           var tag=GetTag();  
           if(id==10)  
           {  
                if(tag)  
                     tag->AddOne();  
           }  
      }  
        
      Dial::GetTag()  
      {  
           var ob=GetActiveDocument()->FindObject(op);  
           if(!ob)  
                return NULL;  
           var tag=ob->GetFirstTag();  
           while(tag)  
           {  
                if(tostring(getclass(tag))=="[Class-TestArray]")  
                     break;  
                tag=tag->GetNext();  
           }  
           return tag;  
      }  
        
        
        
      //////////////////////////  
      // arrays.cof  
        
      include "arraysdial.col"  
        
      var dlg;  
        
      class TestArray : ExpressionPluginTag  
      {  
      public:  
      TestArray();  
        
      GetID();  
        
      MultipleAllowed();  
      DisplayAllowed();  
        
      GetIcon();  
      GetHelpText();  
        
      UseMenu();  
      GetName();  
        
      Edit();  
        
      Copy(dest);  
      Save(hf);  
      Load(hf);  
        
      //Message(type, data);  
        
      Execute(doc, op);  
      //Speedup(doc, op);  
        
      AddOne();  
        
      var arr;  
      }  
        
      TestArray::TestArray()   
      {  
      super();   
      arr=new(array,500);  
      var i=0;  
      for(i=0;i<sizeof(arr);i++)  
           arr _=0;  
      }  
        
      TestArray::GetID()      {     return 1000001;          }  
      TestArray::MultipleAllowed()     {     return FALSE;     }  
      TestArray::DisplayAllowed()          {     return TRUE;     }  
      TestArray::GetIcon()       
      {       
           var bm = new(BaseBitmap,1,1);  
           var fn= new(Filename);  
           fn=GeGetRootFilename();  
           fn->RemoveLast();  
           fn->AddLast("ico.tif");  
           bm->Load(fn);  
        
           return bm;  
      }  
      TestArray::GetHelpText()     {     return "ArrayTest";     }  
      TestArray::UseMenu()     {     return TRUE;     }  
      TestArray::GetName()     {     return "ArrayTest";     }  
        
      TestArray::Edit()  
      {  
           dlg->op=GetObject()->GetName();  
           dlg->Open(TRUE,-1,-1);  
           return TRUE;  
      }  
        
      TestArray::Copy(dest)  
      {  
      var i=0;  
      for(i=0;i<sizeof(arr);i++)  
            dest->arr _=arr _;  
      return TRUE;  
      }  
        
      TestArray::Save(hf)  
      {  
           var i=0;  
           for(i=0;i<sizeof(arr);i++)  
                hf->WriteInt(arr _);  
           return TRUE;  
      }  
        
      TestArray::Load(hf)  
      {  
           var i=0;  
           for(i=0;i<sizeof(arr);i++)  
                arr _=hf- >ReadInt();   
           return TRUE;        
      }  
        
      //TestArray::Message(type, data)     {   TODO     }  
        
      TestArray::Execute(doc, op)  
      {  
           println(arr[499]);  
      }  
        
      //TestArray::Speedup(doc, op)          {     TODO     }  
        
      TestArray::AddOne()  
      {  
           var doc=GetActiveDocument();  
           doc->StartUndo();  
           doc->AddUndo(UNDO_TAG_DATA,this);  
           arr[499]=arr[499]+1;  
           doc->EndUndo();  
           println(arr[499]);  
      }  
        
      /////////  
      // Main  
        
      main()  
      {  
      // Registers the tag  
      dlg=new(Dial);  
      Register(TestArray);  
      }  
        
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 07/04/2004 at 14:56, xxxxxxxx wrote:

        Hi
        Sorry about that missing _in the constructor, dunno why I deleted it before posting the previous message.
        Really hope you can help me with this

        eago

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 13/04/2004 at 15:42, xxxxxxxx wrote:

          Meta hint: "[" + "i" + "]" is the forum code for italics... 🙂
          Please enclose posted code within code tags, as described above the post form.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 14/04/2004 at 16:33, xxxxxxxx wrote:

            ooops
            Sorry, didn't see that, thought the code tags were for long code only.
            Anyway, I think this is a bug
            All I have to do to make C4d loose the data is create an array in the copy funtion. So basically the plug can't have arrays, wich is sad.

            Santiago

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              On 19/04/2004 at 16:59, xxxxxxxx wrote:

              Confirmed. Definitely seems to be a C.O.F.F.E.E. bug. (I will report it as such.) Moving to C++ would probably help. Or you could store the data in the BaseContainer instead if feasible.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

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

                On 19/04/2004 at 20:08, xxxxxxxx wrote:

                Ok
                Thanks a lot for confirming it.
                For now I'm using a dummy PLA track in a null to store the data. I beleve is too much data for a Container.
                I'll move to C++ anyway, but I would love to see coffee back some day.

                eago

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post