_Material.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rve_msgs/Material.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 
00009 class Material(genpy.Message):
00010   _md5sum = "f09dc0a0fdc0e473deed906ce64e957e"
00011   _type = "rve_msgs/Material"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """uint8 CULL_CLOCKWISE = 0
00014 uint8 CULL_COUNTERCLOCKWISE = 1
00015 uint8 CULL_NONE = 2
00016 
00017 UUID id
00018 
00019 float32 opacity
00020 
00021 bool has_color
00022 ColorRGB color
00023 
00024 bool has_texture
00025 string texture 
00026 
00027 bool has_normal_map
00028 string normal_map
00029 
00030 bool disable_shading
00031 
00032 uint8 cull_mode
00033 ================================================================================
00034 MSG: rve_msgs/UUID
00035 uint8[16] data
00036 
00037 ================================================================================
00038 MSG: rve_msgs/ColorRGB
00039 float32 r
00040 float32 g
00041 float32 b
00042 
00043 """
00044   # Pseudo-constants
00045   CULL_CLOCKWISE = 0
00046   CULL_COUNTERCLOCKWISE = 1
00047   CULL_NONE = 2
00048 
00049   __slots__ = ['id','opacity','has_color','color','has_texture','texture','has_normal_map','normal_map','disable_shading','cull_mode']
00050   _slot_types = ['rve_msgs/UUID','float32','bool','rve_msgs/ColorRGB','bool','string','bool','string','bool','uint8']
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        id,opacity,has_color,color,has_texture,texture,has_normal_map,normal_map,disable_shading,cull_mode
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(Material, self).__init__(*args, **kwds)
00068       #message fields cannot be None, assign default values for those that are
00069       if self.id is None:
00070         self.id = rve_msgs.msg.UUID()
00071       if self.opacity is None:
00072         self.opacity = 0.
00073       if self.has_color is None:
00074         self.has_color = False
00075       if self.color is None:
00076         self.color = rve_msgs.msg.ColorRGB()
00077       if self.has_texture is None:
00078         self.has_texture = False
00079       if self.texture is None:
00080         self.texture = ''
00081       if self.has_normal_map is None:
00082         self.has_normal_map = False
00083       if self.normal_map is None:
00084         self.normal_map = ''
00085       if self.disable_shading is None:
00086         self.disable_shading = False
00087       if self.cull_mode is None:
00088         self.cull_mode = 0
00089     else:
00090       self.id = rve_msgs.msg.UUID()
00091       self.opacity = 0.
00092       self.has_color = False
00093       self.color = rve_msgs.msg.ColorRGB()
00094       self.has_texture = False
00095       self.texture = ''
00096       self.has_normal_map = False
00097       self.normal_map = ''
00098       self.disable_shading = False
00099       self.cull_mode = 0
00100 
00101   def _get_types(self):
00102     """
00103     internal API method
00104     """
00105     return self._slot_types
00106 
00107   def serialize(self, buff):
00108     """
00109     serialize message into buffer
00110     :param buff: buffer, ``StringIO``
00111     """
00112     try:
00113       _x = self.id.data
00114       # - if encoded as a list instead, serialize as bytes instead of string
00115       if type(_x) in [list, tuple]:
00116         buff.write(_struct_16B.pack(*_x))
00117       else:
00118         buff.write(_struct_16s.pack(_x))
00119       _x = self
00120       buff.write(_struct_fB3fB.pack(_x.opacity, _x.has_color, _x.color.r, _x.color.g, _x.color.b, _x.has_texture))
00121       _x = self.texture
00122       length = len(_x)
00123       if python3 or type(_x) == unicode:
00124         _x = _x.encode('utf-8')
00125         length = len(_x)
00126       buff.write(struct.pack('<I%ss'%length, length, _x))
00127       buff.write(_struct_B.pack(self.has_normal_map))
00128       _x = self.normal_map
00129       length = len(_x)
00130       if python3 or type(_x) == unicode:
00131         _x = _x.encode('utf-8')
00132         length = len(_x)
00133       buff.write(struct.pack('<I%ss'%length, length, _x))
00134       _x = self
00135       buff.write(_struct_2B.pack(_x.disable_shading, _x.cull_mode))
00136     except struct.error as se: self._check_types(se)
00137     except TypeError as te: self._check_types(te)
00138 
00139   def deserialize(self, str):
00140     """
00141     unpack serialized message in str into this message instance
00142     :param str: byte array of serialized message, ``str``
00143     """
00144     try:
00145       if self.id is None:
00146         self.id = rve_msgs.msg.UUID()
00147       if self.color is None:
00148         self.color = rve_msgs.msg.ColorRGB()
00149       end = 0
00150       start = end
00151       end += 16
00152       self.id.data = str[start:end]
00153       _x = self
00154       start = end
00155       end += 18
00156       (_x.opacity, _x.has_color, _x.color.r, _x.color.g, _x.color.b, _x.has_texture,) = _struct_fB3fB.unpack(str[start:end])
00157       self.has_color = bool(self.has_color)
00158       self.has_texture = bool(self.has_texture)
00159       start = end
00160       end += 4
00161       (length,) = _struct_I.unpack(str[start:end])
00162       start = end
00163       end += length
00164       if python3:
00165         self.texture = str[start:end].decode('utf-8')
00166       else:
00167         self.texture = str[start:end]
00168       start = end
00169       end += 1
00170       (self.has_normal_map,) = _struct_B.unpack(str[start:end])
00171       self.has_normal_map = bool(self.has_normal_map)
00172       start = end
00173       end += 4
00174       (length,) = _struct_I.unpack(str[start:end])
00175       start = end
00176       end += length
00177       if python3:
00178         self.normal_map = str[start:end].decode('utf-8')
00179       else:
00180         self.normal_map = str[start:end]
00181       _x = self
00182       start = end
00183       end += 2
00184       (_x.disable_shading, _x.cull_mode,) = _struct_2B.unpack(str[start:end])
00185       self.disable_shading = bool(self.disable_shading)
00186       return self
00187     except struct.error as e:
00188       raise genpy.DeserializationError(e) #most likely buffer underfill
00189 
00190 
00191   def serialize_numpy(self, buff, numpy):
00192     """
00193     serialize message with numpy array types into buffer
00194     :param buff: buffer, ``StringIO``
00195     :param numpy: numpy python module
00196     """
00197     try:
00198       _x = self.id.data
00199       # - if encoded as a list instead, serialize as bytes instead of string
00200       if type(_x) in [list, tuple]:
00201         buff.write(_struct_16B.pack(*_x))
00202       else:
00203         buff.write(_struct_16s.pack(_x))
00204       _x = self
00205       buff.write(_struct_fB3fB.pack(_x.opacity, _x.has_color, _x.color.r, _x.color.g, _x.color.b, _x.has_texture))
00206       _x = self.texture
00207       length = len(_x)
00208       if python3 or type(_x) == unicode:
00209         _x = _x.encode('utf-8')
00210         length = len(_x)
00211       buff.write(struct.pack('<I%ss'%length, length, _x))
00212       buff.write(_struct_B.pack(self.has_normal_map))
00213       _x = self.normal_map
00214       length = len(_x)
00215       if python3 or type(_x) == unicode:
00216         _x = _x.encode('utf-8')
00217         length = len(_x)
00218       buff.write(struct.pack('<I%ss'%length, length, _x))
00219       _x = self
00220       buff.write(_struct_2B.pack(_x.disable_shading, _x.cull_mode))
00221     except struct.error as se: self._check_types(se)
00222     except TypeError as te: self._check_types(te)
00223 
00224   def deserialize_numpy(self, str, numpy):
00225     """
00226     unpack serialized message in str into this message instance using numpy for array types
00227     :param str: byte array of serialized message, ``str``
00228     :param numpy: numpy python module
00229     """
00230     try:
00231       if self.id is None:
00232         self.id = rve_msgs.msg.UUID()
00233       if self.color is None:
00234         self.color = rve_msgs.msg.ColorRGB()
00235       end = 0
00236       start = end
00237       end += 16
00238       self.id.data = str[start:end]
00239       _x = self
00240       start = end
00241       end += 18
00242       (_x.opacity, _x.has_color, _x.color.r, _x.color.g, _x.color.b, _x.has_texture,) = _struct_fB3fB.unpack(str[start:end])
00243       self.has_color = bool(self.has_color)
00244       self.has_texture = bool(self.has_texture)
00245       start = end
00246       end += 4
00247       (length,) = _struct_I.unpack(str[start:end])
00248       start = end
00249       end += length
00250       if python3:
00251         self.texture = str[start:end].decode('utf-8')
00252       else:
00253         self.texture = str[start:end]
00254       start = end
00255       end += 1
00256       (self.has_normal_map,) = _struct_B.unpack(str[start:end])
00257       self.has_normal_map = bool(self.has_normal_map)
00258       start = end
00259       end += 4
00260       (length,) = _struct_I.unpack(str[start:end])
00261       start = end
00262       end += length
00263       if python3:
00264         self.normal_map = str[start:end].decode('utf-8')
00265       else:
00266         self.normal_map = str[start:end]
00267       _x = self
00268       start = end
00269       end += 2
00270       (_x.disable_shading, _x.cull_mode,) = _struct_2B.unpack(str[start:end])
00271       self.disable_shading = bool(self.disable_shading)
00272       return self
00273     except struct.error as e:
00274       raise genpy.DeserializationError(e) #most likely buffer underfill
00275 
00276 _struct_I = genpy.struct_I
00277 _struct_fB3fB = struct.Struct("<fB3fB")
00278 _struct_B = struct.Struct("<B")
00279 _struct_2B = struct.Struct("<2B")
00280 _struct_16B = struct.Struct("<16B")
00281 _struct_16s = struct.Struct("<16s")


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