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