コード例 #1
0
ファイル: light.py プロジェクト: Rigborn4/PyMdlxConverter
 def write_mdl(self, stream: TokenStream, version=None):
     stream.start_object_block('Light', self.name)
     self.write_generic_header(stream)
     if self.type == 0:
         stream.write_flag('Omnidirectional')
     elif self.type == 1:
         stream.write_flag('Directional')
     elif self.type == 2:
         stream.write_flag('Ambient')
     if not self.write_animation(stream, 'KLAS'):
         stream.write_number_attrib('static AttenuationStart',
                                    self.attenuation[0])
     if not self.write_animation(stream, 'KLAE'):
         stream.write_number_attrib('static AttenuationEnd',
                                    self.attenuation[1])
     if not self.write_animation(stream, 'KLAI'):
         stream.write_number_attrib('static Intensity', self.intensity)
     if not self.write_animation(stream, 'KLAC'):
         stream.write_color('static Color', self.color)
     if not self.write_animation(stream, 'KLBI'):
         stream.write_number_attrib('static AmbIntensity',
                                    self.ambient_intensity)
     if not self.write_animation(stream, 'KLBC'):
         stream.write_color('static AmbColor', self.ambient_color)
     self.write_animation(stream, 'KLAV')
     self.write_generic_animations(stream)
     stream.end_block()
コード例 #2
0
 def write_mdl(self, stream: TokenStream, version=None):
     stream.start_block('GeosetAnim', None)
     if self.flags & 0x1:
         stream.write_flag('DropShadow')
     if not self.write_animation(stream, 'KGAO'):
         stream.write_number_attrib('static Alpha', self.alpha)
     if self.flags & 0x2:
         if not self.write_animation(stream, 'KGAC') and (
                 self.color[0] != 1 or self.color[1] != 1
                 or self.color[2] != 1):
             stream.write_color('static Color ', self.color)
     stream.write_number_attrib('GeosetId', self.geoset_id)
     stream.end_block()
コード例 #3
0
 def write_mdl(self, stream: TokenStream, version=None):
     stream.start_object_block('RibbonEmitter', self.name)
     self.write_generic_header(stream)
     if not self.write_animation(stream, 'KRHA'):
         stream.write_number_attrib('static HeightAbove', self.height_above)
     if not self.write_animation(stream, 'KRHB'):
         stream.write_number_attrib('static HeightBelow', self.height_below)
     if not self.write_animation(stream, 'KRAL'):
         stream.write_number_attrib('static Alpha', self.alpha)
     if not self.write_animation(stream, 'KRCO'):
         stream.write_color('static Color', self.color)
     if not self.write_animation(stream, 'KRTX'):
         stream.write_number_attrib('static TextureSlot', self.texture_slot)
     self.write_animation(stream, 'KRVS')
     stream.write_number_attrib('EmissionRate', self.emission_rate)
     stream.write_number_attrib('LifeSpan', self.lifespan)
     if self.gravity != 0:
         stream.write_number_attrib('Gravity', self.gravity)
     stream.write_number_attrib('Rows', self.rows)
     stream.write_number_attrib('Columns', self.columns)
     stream.write_number_attrib('MaterialID', self.material_id)
     self.write_generic_animations(stream)
     stream.end_block()
コード例 #4
0
 def write_mdl(self, stream: TokenStream, version=None):
     stream.start_object_block('ParticleEmitter2', self.name)
     self.write_generic_header(stream)
     if self.flags == 0x10000:
         stream.write_flag('SortPrimsFarZ')
     if self.flags == 0x8000:
         stream.write_flag('Unshaded')
     if self.flags == 0x20000:
         stream.write_flag('LineEmitter')
     if self.flags == 0x40000:
         stream.write_flag('Unfogged')
     if self.flags == 0x80000:
         stream.write_flag('ModelSpace')
     if self.flags == 0x100000:
         stream.write_flag('XYQuad')
     if not self.write_animation(stream, 'KP2S'):
         stream.write_number_attrib('static Speed', self.speed)
     if not self.write_animation(stream, 'KP2R'):
         stream.write_number_attrib('static Variation', self.variation)
     if not self.write_animation(stream, 'KP2L'):
         stream.write_number_attrib('static Latitude', self.latitude)
     if not self.write_animation(stream, 'KP2G'):
         stream.write_number_attrib('static Gravity', self.gravity)
     self.write_animation(stream, 'KP2V')
     if self.squirt:
         stream.write_flag('Squirt')
     stream.write_number_attrib('LifeSpan', self.life_span)
     if not self.write_animation(stream, 'KP2E'):
         stream.write_number_attrib('static EmissionRate',
                                    self.emission_rate)
     if not self.write_animation(stream, 'KP2N'):
         stream.write_number_attrib('static Width', self.width)
     if not self.write_animation(stream, 'KP2W'):
         stream.write_number_attrib('static Length', self.length)
     if self.filter_mode == 0:
         stream.write_flag('Blend')
     elif self.filter_mode == 1:
         stream.write_flag('Additive')
     elif self.filter_mode == 2:
         stream.write_flag('Modulate')
     elif self.filter_mode == 3:
         stream.write_flag('Modulate2x')
     elif self.filter_mode == 4:
         stream.write_flag('AlphaKey')
     stream.write_number_attrib('Rows', self.rows)
     stream.write_number_attrib('Columns', self.columns)
     if self.head_or_tail == 0:
         stream.write_flag('Head')
     elif self.head_or_tail == 1:
         stream.write_flag('Tail')
     elif self.head_or_tail == 2:
         stream.write_flag('Both')
     stream.write_number_attrib('TailLength', self.tail_length)
     stream.write_number_attrib('Time', self.time_middle)
     stream.start_block('SegmentColor', None)
     stream.write_color('Color', self.segment_colors[0])
     stream.write_color('Color', self.segment_colors[1])
     stream.write_color('Color', self.segment_colors[2])
     stream.end_block_comma()
     stream.write_vector_attrib('Alpha', self.segment_alphas)
     stream.write_vector_attrib('ParticleScaling', self.segment_scaling)
     stream.write_vector_attrib('LifeSpanUVAnim', self.head_intervals[0])
     stream.write_vector_attrib('DecayUVAnim', self.head_intervals[1])
     stream.write_vector_attrib('TailUVAnim', self.tail_intervals[0])
     stream.write_vector_attrib('TailDecayUVAnim', self.tail_intervals[1])
     stream.write_number_attrib('TextureID', self.texture_id)
     if self.replaceable_id != 0:
         stream.write_number_attrib('ReplaceableId', self.replaceable_id)
     if self.priority_plane != 0:
         stream.write_number_attrib('PriorityPlane', self.priority_plane)
     self.write_generic_animations(stream)
     stream.end_block()