GetAllHighlevelData vs. GetLowlevelDataAddressR

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


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  
def mGetAllHighlevelData(variableTag) :  
  #unpack 32 bit float  
  data = variableTag.GetLowlevelDataAddressR()  
  a = array.array('f')  
  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"  
if __name__=='__main__':  

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.

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


newdata = data.__add__(5)  

I receive an error message: "NotImplemented"

newdata = data + 5  

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

I assume it´s not supported, too.

Best wishes

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.

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

Hi Yannick,

thanks for the confirmation.

Best wishes