_SubMesh.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rve_msgs/SubMesh.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import rve_msgs.msg
00008 import std_msgs.msg
00009 
00010 class SubMesh(genpy.Message):
00011   _md5sum = "2231ad7f8ed5b42a3c400023b581b852"
00012   _type = "rve_msgs/SubMesh"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """int8 material_index
00015 uint32[] indices
00016 Vector3[] positions
00017 Vector3[] normals
00018 Vector3[] tangents
00019 Vector3[] binormals
00020 
00021 TexCoordChannel[] tex_coords
00022 ColorChannel[] colors
00023 ================================================================================
00024 MSG: rve_msgs/Vector3
00025 float32 x
00026 float32 y
00027 float32 z
00028 
00029 ================================================================================
00030 MSG: rve_msgs/TexCoordChannel
00031 uint8 dims
00032 TexCoord[] array
00033 
00034 ================================================================================
00035 MSG: rve_msgs/TexCoord
00036 float32[3] uvw
00037 ================================================================================
00038 MSG: rve_msgs/ColorChannel
00039 std_msgs/ColorRGBA[] array
00040 
00041 ================================================================================
00042 MSG: std_msgs/ColorRGBA
00043 float32 r
00044 float32 g
00045 float32 b
00046 float32 a
00047 
00048 """
00049   __slots__ = ['material_index','indices','positions','normals','tangents','binormals','tex_coords','colors']
00050   _slot_types = ['int8','uint32[]','rve_msgs/Vector3[]','rve_msgs/Vector3[]','rve_msgs/Vector3[]','rve_msgs/Vector3[]','rve_msgs/TexCoordChannel[]','rve_msgs/ColorChannel[]']
00051 
00052   def __init__(self, *args, **kwds):
00053     """
00054     Constructor. Any message fields that are implicitly/explicitly
00055     set to None will be assigned a default value. The recommend
00056     use is keyword arguments as this is more robust to future message
00057     changes.  You cannot mix in-order arguments and keyword arguments.
00058 
00059     The available fields are:
00060        material_index,indices,positions,normals,tangents,binormals,tex_coords,colors
00061 
00062     :param args: complete set of field values, in .msg order
00063     :param kwds: use keyword arguments corresponding to message field names
00064     to set specific fields.
00065     """
00066     if args or kwds:
00067       super(SubMesh, self).__init__(*args, **kwds)
00068       #message fields cannot be None, assign default values for those that are
00069       if self.material_index is None:
00070         self.material_index = 0
00071       if self.indices is None:
00072         self.indices = []
00073       if self.positions is None:
00074         self.positions = []
00075       if self.normals is None:
00076         self.normals = []
00077       if self.tangents is None:
00078         self.tangents = []
00079       if self.binormals is None:
00080         self.binormals = []
00081       if self.tex_coords is None:
00082         self.tex_coords = []
00083       if self.colors is None:
00084         self.colors = []
00085     else:
00086       self.material_index = 0
00087       self.indices = []
00088       self.positions = []
00089       self.normals = []
00090       self.tangents = []
00091       self.binormals = []
00092       self.tex_coords = []
00093       self.colors = []
00094 
00095   def _get_types(self):
00096     """
00097     internal API method
00098     """
00099     return self._slot_types
00100 
00101   def serialize(self, buff):
00102     """
00103     serialize message into buffer
00104     :param buff: buffer, ``StringIO``
00105     """
00106     try:
00107       buff.write(_struct_b.pack(self.material_index))
00108       length = len(self.indices)
00109       buff.write(_struct_I.pack(length))
00110       pattern = '<%sI'%length
00111       buff.write(struct.pack(pattern, *self.indices))
00112       length = len(self.positions)
00113       buff.write(_struct_I.pack(length))
00114       for val1 in self.positions:
00115         _x = val1
00116         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00117       length = len(self.normals)
00118       buff.write(_struct_I.pack(length))
00119       for val1 in self.normals:
00120         _x = val1
00121         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00122       length = len(self.tangents)
00123       buff.write(_struct_I.pack(length))
00124       for val1 in self.tangents:
00125         _x = val1
00126         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00127       length = len(self.binormals)
00128       buff.write(_struct_I.pack(length))
00129       for val1 in self.binormals:
00130         _x = val1
00131         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00132       length = len(self.tex_coords)
00133       buff.write(_struct_I.pack(length))
00134       for val1 in self.tex_coords:
00135         buff.write(_struct_B.pack(val1.dims))
00136         length = len(val1.array)
00137         buff.write(_struct_I.pack(length))
00138         for val2 in val1.array:
00139           buff.write(_struct_3f.pack(*val2.uvw))
00140       length = len(self.colors)
00141       buff.write(_struct_I.pack(length))
00142       for val1 in self.colors:
00143         length = len(val1.array)
00144         buff.write(_struct_I.pack(length))
00145         for val2 in val1.array:
00146           _x = val2
00147           buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00148     except struct.error as se: self._check_types(se)
00149     except TypeError as te: self._check_types(te)
00150 
00151   def deserialize(self, str):
00152     """
00153     unpack serialized message in str into this message instance
00154     :param str: byte array of serialized message, ``str``
00155     """
00156     try:
00157       if self.positions is None:
00158         self.positions = None
00159       if self.normals is None:
00160         self.normals = None
00161       if self.tangents is None:
00162         self.tangents = None
00163       if self.binormals is None:
00164         self.binormals = None
00165       if self.tex_coords is None:
00166         self.tex_coords = None
00167       if self.colors is None:
00168         self.colors = None
00169       end = 0
00170       start = end
00171       end += 1
00172       (self.material_index,) = _struct_b.unpack(str[start:end])
00173       start = end
00174       end += 4
00175       (length,) = _struct_I.unpack(str[start:end])
00176       pattern = '<%sI'%length
00177       start = end
00178       end += struct.calcsize(pattern)
00179       self.indices = struct.unpack(pattern, str[start:end])
00180       start = end
00181       end += 4
00182       (length,) = _struct_I.unpack(str[start:end])
00183       self.positions = []
00184       for i in range(0, length):
00185         val1 = rve_msgs.msg.Vector3()
00186         _x = val1
00187         start = end
00188         end += 12
00189         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00190         self.positions.append(val1)
00191       start = end
00192       end += 4
00193       (length,) = _struct_I.unpack(str[start:end])
00194       self.normals = []
00195       for i in range(0, length):
00196         val1 = rve_msgs.msg.Vector3()
00197         _x = val1
00198         start = end
00199         end += 12
00200         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00201         self.normals.append(val1)
00202       start = end
00203       end += 4
00204       (length,) = _struct_I.unpack(str[start:end])
00205       self.tangents = []
00206       for i in range(0, length):
00207         val1 = rve_msgs.msg.Vector3()
00208         _x = val1
00209         start = end
00210         end += 12
00211         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00212         self.tangents.append(val1)
00213       start = end
00214       end += 4
00215       (length,) = _struct_I.unpack(str[start:end])
00216       self.binormals = []
00217       for i in range(0, length):
00218         val1 = rve_msgs.msg.Vector3()
00219         _x = val1
00220         start = end
00221         end += 12
00222         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00223         self.binormals.append(val1)
00224       start = end
00225       end += 4
00226       (length,) = _struct_I.unpack(str[start:end])
00227       self.tex_coords = []
00228       for i in range(0, length):
00229         val1 = rve_msgs.msg.TexCoordChannel()
00230         start = end
00231         end += 1
00232         (val1.dims,) = _struct_B.unpack(str[start:end])
00233         start = end
00234         end += 4
00235         (length,) = _struct_I.unpack(str[start:end])
00236         val1.array = []
00237         for i in range(0, length):
00238           val2 = rve_msgs.msg.TexCoord()
00239           start = end
00240           end += 12
00241           val2.uvw = _struct_3f.unpack(str[start:end])
00242           val1.array.append(val2)
00243         self.tex_coords.append(val1)
00244       start = end
00245       end += 4
00246       (length,) = _struct_I.unpack(str[start:end])
00247       self.colors = []
00248       for i in range(0, length):
00249         val1 = rve_msgs.msg.ColorChannel()
00250         start = end
00251         end += 4
00252         (length,) = _struct_I.unpack(str[start:end])
00253         val1.array = []
00254         for i in range(0, length):
00255           val2 = std_msgs.msg.ColorRGBA()
00256           _x = val2
00257           start = end
00258           end += 16
00259           (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00260           val1.array.append(val2)
00261         self.colors.append(val1)
00262       return self
00263     except struct.error as e:
00264       raise genpy.DeserializationError(e) #most likely buffer underfill
00265 
00266 
00267   def serialize_numpy(self, buff, numpy):
00268     """
00269     serialize message with numpy array types into buffer
00270     :param buff: buffer, ``StringIO``
00271     :param numpy: numpy python module
00272     """
00273     try:
00274       buff.write(_struct_b.pack(self.material_index))
00275       length = len(self.indices)
00276       buff.write(_struct_I.pack(length))
00277       pattern = '<%sI'%length
00278       buff.write(self.indices.tostring())
00279       length = len(self.positions)
00280       buff.write(_struct_I.pack(length))
00281       for val1 in self.positions:
00282         _x = val1
00283         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00284       length = len(self.normals)
00285       buff.write(_struct_I.pack(length))
00286       for val1 in self.normals:
00287         _x = val1
00288         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00289       length = len(self.tangents)
00290       buff.write(_struct_I.pack(length))
00291       for val1 in self.tangents:
00292         _x = val1
00293         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00294       length = len(self.binormals)
00295       buff.write(_struct_I.pack(length))
00296       for val1 in self.binormals:
00297         _x = val1
00298         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00299       length = len(self.tex_coords)
00300       buff.write(_struct_I.pack(length))
00301       for val1 in self.tex_coords:
00302         buff.write(_struct_B.pack(val1.dims))
00303         length = len(val1.array)
00304         buff.write(_struct_I.pack(length))
00305         for val2 in val1.array:
00306           buff.write(val2.uvw.tostring())
00307       length = len(self.colors)
00308       buff.write(_struct_I.pack(length))
00309       for val1 in self.colors:
00310         length = len(val1.array)
00311         buff.write(_struct_I.pack(length))
00312         for val2 in val1.array:
00313           _x = val2
00314           buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00315     except struct.error as se: self._check_types(se)
00316     except TypeError as te: self._check_types(te)
00317 
00318   def deserialize_numpy(self, str, numpy):
00319     """
00320     unpack serialized message in str into this message instance using numpy for array types
00321     :param str: byte array of serialized message, ``str``
00322     :param numpy: numpy python module
00323     """
00324     try:
00325       if self.positions is None:
00326         self.positions = None
00327       if self.normals is None:
00328         self.normals = None
00329       if self.tangents is None:
00330         self.tangents = None
00331       if self.binormals is None:
00332         self.binormals = None
00333       if self.tex_coords is None:
00334         self.tex_coords = None
00335       if self.colors is None:
00336         self.colors = None
00337       end = 0
00338       start = end
00339       end += 1
00340       (self.material_index,) = _struct_b.unpack(str[start:end])
00341       start = end
00342       end += 4
00343       (length,) = _struct_I.unpack(str[start:end])
00344       pattern = '<%sI'%length
00345       start = end
00346       end += struct.calcsize(pattern)
00347       self.indices = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=length)
00348       start = end
00349       end += 4
00350       (length,) = _struct_I.unpack(str[start:end])
00351       self.positions = []
00352       for i in range(0, length):
00353         val1 = rve_msgs.msg.Vector3()
00354         _x = val1
00355         start = end
00356         end += 12
00357         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00358         self.positions.append(val1)
00359       start = end
00360       end += 4
00361       (length,) = _struct_I.unpack(str[start:end])
00362       self.normals = []
00363       for i in range(0, length):
00364         val1 = rve_msgs.msg.Vector3()
00365         _x = val1
00366         start = end
00367         end += 12
00368         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00369         self.normals.append(val1)
00370       start = end
00371       end += 4
00372       (length,) = _struct_I.unpack(str[start:end])
00373       self.tangents = []
00374       for i in range(0, length):
00375         val1 = rve_msgs.msg.Vector3()
00376         _x = val1
00377         start = end
00378         end += 12
00379         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00380         self.tangents.append(val1)
00381       start = end
00382       end += 4
00383       (length,) = _struct_I.unpack(str[start:end])
00384       self.binormals = []
00385       for i in range(0, length):
00386         val1 = rve_msgs.msg.Vector3()
00387         _x = val1
00388         start = end
00389         end += 12
00390         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00391         self.binormals.append(val1)
00392       start = end
00393       end += 4
00394       (length,) = _struct_I.unpack(str[start:end])
00395       self.tex_coords = []
00396       for i in range(0, length):
00397         val1 = rve_msgs.msg.TexCoordChannel()
00398         start = end
00399         end += 1
00400         (val1.dims,) = _struct_B.unpack(str[start:end])
00401         start = end
00402         end += 4
00403         (length,) = _struct_I.unpack(str[start:end])
00404         val1.array = []
00405         for i in range(0, length):
00406           val2 = rve_msgs.msg.TexCoord()
00407           start = end
00408           end += 12
00409           val2.uvw = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00410           val1.array.append(val2)
00411         self.tex_coords.append(val1)
00412       start = end
00413       end += 4
00414       (length,) = _struct_I.unpack(str[start:end])
00415       self.colors = []
00416       for i in range(0, length):
00417         val1 = rve_msgs.msg.ColorChannel()
00418         start = end
00419         end += 4
00420         (length,) = _struct_I.unpack(str[start:end])
00421         val1.array = []
00422         for i in range(0, length):
00423           val2 = std_msgs.msg.ColorRGBA()
00424           _x = val2
00425           start = end
00426           end += 16
00427           (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00428           val1.array.append(val2)
00429         self.colors.append(val1)
00430       return self
00431     except struct.error as e:
00432       raise genpy.DeserializationError(e) #most likely buffer underfill
00433 
00434 _struct_I = genpy.struct_I
00435 _struct_4f = struct.Struct("<4f")
00436 _struct_B = struct.Struct("<B")
00437 _struct_b = struct.Struct("<b")
00438 _struct_3f = struct.Struct("<3f")


rve_msgs
Author(s): Josh Faust
autogenerated on Wed Dec 11 2013 14:30:38