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

    Reading values from a ByteSeq

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 527 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/10/2012 at 16:18, xxxxxxxx wrote:

      How can I read vectors, floats and ints from a ByteSeq?

      Rui Batista

      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 03/10/2012 at 16:26, xxxxxxxx wrote:

        Ok, I believe the struct is what I'm looking for.
        But if there is a special way to do it in Cinema's python, please 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 04/10/2012 at 01:27, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          Ok, I believe the struct is what I'm looking for.
          But if there is a special way to do it in Cinema's python, please let me know.

          What's the struct you're talking about? MemoryFileStruct is the struct to use in conjunction with HyperFile to read vector, long, bool etc. values. You can take a look at MemoryFileBitmap.py and MemoryFileData.py examples in the "scripts" folder of the Python documentation.

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

            I can't make this work, Yannick. I'm following the example from MemoryFileData.py and it fails at the SetMemoryReadMode of the MemoryFileStructure. It returns None 😞
            Anyway, I found a way to access data, using the struct library.
            Check it here:

            https://developers.maxon.net/forum/topic/6638/7212_get-the-standard-particles-information&PID;=30085#30085

            Now, I only need some more information about the way (and what) data is stored inside the ByteSeq buffer.
            For example, I need to know how to find out how many particles are currently alive. Also, I need to know what (and where) bits of information are there for particles.

            Rui Batista

            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/10/2012 at 03:34, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              I can't make this work, Yannick. I'm following the example from MemoryFileData.py and it fails at the SetMemoryReadMode of the MemoryFileStructure. It returns None 😞

              SetMemoryReadMode() always returns None (like a void method). But yes it fails because if we get back the assigned buffer calling GetData() we get None:

              def main() :
                  emitter=op.GetObject()
                  p_tag=emitter.GetTag(c4d.Tparticle)
                  if p_tag is None: return
                
                  buffer=p_tag.GetLowlevelDataAddressR()
                  
                  mfs=c4d.storage.MemoryFileStruct()
                  mfs.SetMemoryReadMode(buffer,len(buffer))
                  
                  print mfs.GetData()
              

              I'll try to find a workaround for this but struct.unpack() is easier than using CINEMA storage classes.

              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/10/2012 at 04:14, xxxxxxxx wrote:

                That is what I did, as you can see here:

                https://developers.maxon.net/forum/topic/6643/7217_here-is-how-to-read-standard-particle-values

                This was the struct I was talking about at the top.

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