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 Born Position

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 518 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 03/03/2012 at 17:28, xxxxxxxx wrote:

      Hi all,
      I'm trying to storage the position of all particles of a group when were born.
      Here's my code:
          
          tp = doc.GetParticleSystem()
          
          TpGroupA = op[c4d.ID_USERDATA,1]
          
          cntGroupA = TpGroupA.NumParticles()
          PPGroupA = TpGroupA.GetParticles()
          
          PPGroupStart = c4d.Vector
          PPGroupStartPos = []
          
          for i in xrange (cntGroupA) :
              if tp.IsBorn(i)==True:
                  PPGroupStart = tp.Position(PPGroupA _)
                  tp.SetPData(i,0,PPGroupStart) # I  have created a Channels (vector) where storage the position
              PPGroupStartPos.append(tp.GetPData(i,0))

      But it works only when I play the scene from the first frame... If I jump from a frame to another the Channel value became "None"

      What's wrong in this code?
      There's another way retrive the born position of particle?

      Cheers

      Luther

      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 06/03/2012 at 17:35, xxxxxxxx wrote:

        not sure hat is going wrong, but the setup looks quite compilacted. why don't you use just a python node with a TpParticle input port and plug a PPass node into it ? the *code *would be :

        import c4d
          
        mycache = []
          
        def main() :
            if tp.IsBorn(pid) :
                tp.SetPData(pid, 0, tp.Position(pid)) 
                mycache.append(tp.Position(pid))
        

        can't see a reason to do the iteration stuff yourself 🙂 (ps : tp as the documents master particle system is predefined and pid is the name of my TpParticle input port)

        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 09/03/2012 at 05:44, xxxxxxxx wrote:

          Hi Little Devil,
          thank you so much for you reply. I'm a little bit confused, I think that I don't understand very well what do you suggest.
          I attach my c4d scene, so you can see what I really want to do:
          https://docs.google.com/open?id=0B4E_u8h_R81SSGdrX1BnZkdTRm1Nb0VLblM5VVZuUQ

          Another thing, in a older your post I read that if I want to generate all particles at frame 0 I have to cache first my particle. Can you write me a little example of this code?

          Cheers

          Luther

          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 09/03/2012 at 13:37, xxxxxxxx wrote:

            i think i am getting something wrong, it is very simple, i have attached an example.

            http://www.2shared.com/file/mpgLW-\_R/LineStartPGroup002.html

            to your second question : can't see a reason for this, please explain what you want to achieve. basicly it would be the same. check if it is frame 0, check if particle id is related to a born particle and then do something with this id.

            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 13/03/2012 at 06:02, xxxxxxxx wrote:

              Hi Little Devil,
              sorry for the late responce... Thank you so much for you reply, now I have understand.
              For the second question, never mind... I was confused 🙂

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