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

    TP master system crashes R13 immediately

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 337 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 21/04/2012 at 11:19, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R13.051 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I have no idea what's going on here, but every time I try and get the TP_MasterSystem of a scene, Cinema crashes straight away. This is my code and it's basically taken from the doc as is:

        
      TP_MasterSystem* TPPartioData::GetTpMasterSystem(BaseDocument* doc)
      {  
      	if (!doc) {  
      		GePrint("No TP Master found");  
      		return NULL;  
      		}
      BaseSceneHook* hook = doc->FindSceneHook(ID_THINKINGPARTICLES);  
      if(!hook || hook->GetType() != ID_THINKINGPARTICLES)  
      {  
      GePrint("No TP Master found");  
      return NULL;  
      }
      TP_MasterSystem *tp = (TP_MasterSystem* )(hook); // this is ok  
      tp->NumParticles(); // here it crashes with _any_ tp->.... related call  
      GePrint("I made it here"); // sadly, not so  
      return static_cast<TP_MasterSystem*>(hook);  
      }
      

      I'm compiling with VS2008 for 64bit.

      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/2012 at 11:27, xxxxxxxx wrote:

        Ok, I don't really understand why and what it does, but I found this in an old thread and after adding it before the tp calls, it works now?

        if (!CheckLib(ID_THINKINGPARTICLES, LIBOFFSET(C4DLibrary_TPOS, MSYS), reinterpret_cast<C4DLibrary\*\*>(&TPOS)))   
        

        {
        GePrint("Checklib failed");
        return FALSE;
        }

        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/2012 at 11:31, xxxxxxxx wrote:

          I wonder if you put

            
              
              
              TP_MasterSystem *tp = (TP_MasterSystem* )(hook); 
          if(!tp) return NULL;    
            
          

          if that would prevent the crash?

          give it a try and let me know.  🙂

          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/2012 at 15:01, xxxxxxxx wrote:

            See InitThinkingParticles() in the SDK. You need to call this before TP is used (I'm just repeating the SDK when I say that!). I do it and don't have any problems with getting the TP master system.

            Steve

            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/2012 at 15:07, xxxxxxxx wrote:

              I totally overlooked that! Thanks Steve

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