Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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 SetPGroupHierarchy error

    PYTHON Development
    0
    7
    1.1k
    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 10/03/2011 at 11:36, xxxxxxxx wrote:

      Hi everyone,

      has anyone here managed to create a TP Group? I guess in theory it should be simple, but... well, this is what I tried:

        
      import c4d  
        
      def main() :  
        tpGroup = tp.AllocParticleGroup()  
        tpGroups = tp.GetParticleGroups(None,c4d.TP_GETPGROUP_ALL)  
        tpAllGroup = tpGroups[0]  
        tp.SetPGroupHierarchy(tpGroups[0],tpGroup,c4d.TP_INSERT_UNDERFIRST)  
        
      if __name__=='__main__':  
        main()  
      

      What I get is an error in PyTPGroup.cpp:341: bad argument to internal function

      Does this look familiar to anyone?

      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 11/03/2011 at 13:28, xxxxxxxx wrote:

        Is this working for anyone?

        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 12/03/2011 at 09:53, xxxxxxxx wrote:

          Hi ripclaw, I can confirm that the group handling at this point doesn't work.
          Here is an alternative way to insert a new group into the group list:

          import c4d
            
          def main() :
              root=tp.GetRootGroup() #get the root group "All"
              tpGroup = tp.AllocParticleGroup()
              tpGroup.SetName("TestGroup")
              tpGroup.InsertUnder(root) #insert new created group into group list
              c4d.EventAdd() #send global event message
            
          if __name__=='__main__':
              main()
          

          Cheers, Sebastian

          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 12/03/2011 at 10:20, xxxxxxxx wrote:

            Thanks Sebastien!

            I'll give it a try later.

            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 12/03/2011 at 11:26, xxxxxxxx wrote:

              Assigning the group worked that way, but finding it again via this:

              tpGroups = tp.GetParticleGroups(tproot,c4d.TP_GETPGROUP_ALL)

              throws the same error...

              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 12/03/2011 at 11:30, xxxxxxxx wrote:

                Unfortunately this error might occur in several situations when you handle tp groups.
                You can manually browse through the childs with tproot.GetDown().

                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 12/03/2011 at 12:06, xxxxxxxx wrote:

                  Thanks again Sebastien. This appears to work, for anyone else who's trying it:

                    
                  def findPGroup(self, root, searchname) :  
                        t = root.GetDown()  
                        if t == None:  
                            return None  
                        elif t.GetName() == searchname:  
                            return t  
                        else:  
                            self.findPGroup(t,searchname)  
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post