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
    • Recent
    • Tags
    • Users
    • Register
    • Login

    AutoAddSequence returns NULL. Why?

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 303 Views
    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 Offline
      Helper
      last edited by

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

      On 17/04/2005 at 04:42, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.1 Demo 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello...

      I have a problem with the AutoAddSequence method. I want to check if there is still a sequence. If not, the program should add a sequence to the track. I use the CreateKey method which I have found in the MorphMixer.cpp example. Now, in some cases, this method returns NULL because no sequence could be added.
      See this:

        
      static AnimValue* CreateKey(BaseDocument *doc, BaseObject *op, const BaseTime &time;, LONG index, LONG sid, Real value)  
      {  
           // check if track exists  
           BaseTrack *track = op->FindTrack(DescID(DescLevel(index), DescLevel(sid, DTYPE_REAL,0)));  
           if (!track)  
           {  
                track = AllocValueTrack(op,DescID(DescLevel(index), DescLevel(sid, DTYPE_REAL,0))); if (!track) {return NULL;}  
                op->InsertTrackLast(track);  
           }  
        
           // check for sequence  
           BaseSequence *seq=NULL;  
           for (seq = track->GetFirstSequence(); seq; seq=seq->GetNext())  
                if (time>=seq->GetT1() && time<=seq->GetT2())  
                     break;  
        
           if (!seq)  
           {  
                seq = track->AutoAddSequence(doc,time);   
                if (!seq) {/*MessageDialog("no seq" + RealToString(time.Get()));*/return NULL;}  
           }  
        
           BaseKey *key = BaseKey::Alloc(seq->GetType()); if (!key) {return NULL;}  
           AnimValue *av = GetKeyValue(key); if (!av) {return NULL;}  
        
           av->value = value;  
             
        
           key->SetTime(time);  
           seq->InsertKey(key);  
           return av;  
      }  
      

      Why doesn't AutoAddSequence() work? Why isn't a sequence added?

      Can you help me?

      Regards,

      jacqui.

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

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

        On 21/04/2005 at 13:33, xxxxxxxx wrote:

        Any special sequence configurations that cause this error, or is it totally random?

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

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

          On 05/07/2005 at 10:55, xxxxxxxx wrote:

          When I open an empty project in Cinema4D and call this plugin, which generates a new animation sequence, I get this error, that means this method returns NULL.

          When I again call this plugin (i.e. this method) while the same Cinema4D project is open, it works...!?

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

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

            On 05/07/2005 at 11:28, xxxxxxxx wrote:

            I'm surprised it doesn't crash! It is entirely possible for 'op' to be NULL. Unless you are ensuring that before calling CreateKey(). Has 'op' been BaseDocument->InsertObject(op,etc.)'d before calling the method?

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