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
    • Recent
    • Tags
    • Users
    • Login

    GetAllHighlevelData vs. GetLowlevelDataAddressR

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 375 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

      On 31/05/2015 at 04:41, xxxxxxxx wrote:

      Hi All,

      regarding the softselection tag, trying to call GetAllHighlevelData() as stated at VariableTag.GetAllHighlevelData()
      I receive an error message:

      TypeError: Unknown data of variable tag type.

      I managed to work around with LowlevelData see code below:

      But I don´t understand the
      ByteSeq.\__add\_\_( other )
      function.
      What are we supposed to add at offset?
      It seems to have no influence on the buffer.
      Has anyone an idea how we should use it?

      Thanks in advance
      Martin

      LowlevelDataAddress:

        
      import c4d, array  
        
      def mSetAllHighlevelData(variableTag, values) :  
        #pack 32 bit float      
        b = array.array('f',values)      
        buff = b.tostring()    
        wdata = variableTag.GetLowlevelDataAddressW()  
        if len(wdata)==len(buff) :  
            wdata[0:len(buff)] = buff  
        return  
          
        
      def mGetAllHighlevelData(variableTag) :  
        #unpack 32 bit float  
        data = variableTag.GetLowlevelDataAddressR()  
        a = array.array('f')  
        a.fromstring(data)  
        weightarray = a.tolist()  
        return weightarray  
        
        
        
      def main() :  
        tags = op.GetTags()  
        for ta in tags:  
            if ta.GetType()== c4d.Tsoftselection:  
                print "____________________________"  
                print "Softselection"  
                      
                #set up a list  
                dcount =  ta.GetDataCount()  
                values = [1] * dcount  
                      
                weightarray = mGetAllHighlevelData(ta)   
                print weightarray, "before"     
                  
                mSetAllHighlevelData(ta, values)  
                weightarray = mGetAllHighlevelData(ta)  
        
                print weightarray, "after"  
                  
        
                          
        c4d.EventAdd()                  
                          
        
      if __name__=='__main__':  
        main()  
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 01/06/2015 at 07:58, xxxxxxxx wrote:

        Hi Martin,

        VariableTag.GetAllHighlevelData() doesn't support softselection tag (Tsoftselection). This is why you get the error "Unknown data of variable tag type."
        In fact, VariableTag.GetAllHighlevelData() is just a wrapper around VariableTag.GetLowlevelDataAddressR(). It currently supports Tpoint, Ttangent, Tline, Tpolygon, Tsegment, Tvertexmap, Tnormal and Tuvw tag types.

        ByteSeq.__add__() defines the "+" operator and does the same as ByteSeq.GetOffset():

        seq = data + 4
        seq = data.GetOffset(4)
        

        ByteSeq.__add__() doesn't modify the ByteSeq object, it returns a new ByteSeq object at the given offset.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 01/06/2015 at 11:43, xxxxxxxx wrote:

          Hi Yannick,

          Thanks for the reply !
          Still, it might be good to write a small note in brackets into the sdk "not implemented yet" or something else. It was a little confusing at the beginning.
          (I know it´s not supported yet, too, but it might be more consistent to write the sitckytexture tag data in 32 bit ,too, like the uv tag and not in double 64 bit, I´m not sure, there could be good reasons to do so.)

          For

            
          newdata = data.__add__(5)  
          

          I receive an error message: "NotImplemented"
          for

            
          newdata = data + 5  
          

          I receive an error message:
          TypeError: unsupported operand type(s) for +: 'c4d.storage.ByteSeq' and 'int'

          I assume it´s not supported, too.

          Best wishes
          Martin

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 02/06/2015 at 02:34, xxxxxxxx wrote:

            Hi Martin,

            There seem to have an issue with ByteSeq.__add__()/+ operator. Sorry I had not tested it before.
            ByteSeq.GetOffset() does exactly the same so please use it instead.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 09/06/2015 at 01:21, xxxxxxxx wrote:

              Hi Yannick,

              thanks for the confirmation.

              Best wishes
              Martin

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