Reading values from a ByteSeq
-
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
-
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. -
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.
-
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: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
-
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.
-
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.