TP SetPGroupHierarchy error



  • 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?



  • 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?



  • 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



  • 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.



  • 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...



  • 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().



  • 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)  
    

Log in to reply