def save_point_light_list(point_lights: List[TerryPointLight], entities: Element): for point_light in point_lights: entity = create_entity_node(entities) ECPointLight = SubElement( entity, "ECPointLight", { "colour": str(point_light.colour.red) + " " + str(point_light.colour.green) + " " + str(point_light.colour.blue) + " " + "255", "colour_scale": s_float(point_light.colour_scale), "radius": s_float(point_light.radius), "animation_type": point_light.animation_type, "animation_speed_scale": " ".join(map(str, point_light.animation_speed_scale)), "colour_min": s_float(point_light.colour_min), "random_offset": s_float(point_light.random_offset), "falloff_type": point_light.falloff_type, "for_light_probes_only": s_bool(point_light.for_light_probes_only), }) ectransform_to_xml(entity, point_light.ectransform)
def save_spot_light_list(spot_lights: List[TerrySpotLight], entities: Element): for spot_light in spot_lights: entity = create_entity_node(entities) ECSpotLight = SubElement( entity, "ECSpotLight", { "colour": str(spot_light.colour.red) + " " + str(spot_light.colour.green) + " " + str(spot_light.colour.blue) + " " + str(spot_light.colour.alpha), "intensity": s_float(spot_light.intensity), "length": s_float(spot_light.length), "inner_angle": s_float(spot_light.inner_angle), "outer_angle": s_float(spot_light.outer_angle), "falloff": s_float(spot_light.falloff), "volumetric": s_bool(spot_light.volumetric), "gobo": spot_light.gobo, }) ectransform_to_xml(entity, spot_light.ectransform)
def save_relative_scale3d(relative_scale_3d: RelativeScale3D) -> str: scale_x = relative_scale_3d.X scale_y = relative_scale_3d.Y scale_z = relative_scale_3d.Z content = '\tRelativeScale3D = (X={0}, Y={1}, Z={2})\n'.format( s_float(scale_x), s_float(scale_y), s_float(scale_z)) return content
def save_relative_location(relative_location: RelativeLocation) -> str: x = relative_location.X y = relative_location.Y z = relative_location.Z content = '\tRelativeLocation=(X={0},Y={1},Z={2})\n'.format( s_float(x), s_float(y), s_float(z)) return content
def save_relative_rotation(relative_rotation: RelativeRotation) -> str: pitch = relative_rotation.X yaw = relative_rotation.Y roll = relative_rotation.Z # pitch = relative_rotation.Pitch # yaw = relative_rotation.Yaw # roll = relative_rotation.Roll content = '\tRelativeRotation=(Pitch={0},Yaw={1},Roll={2})\n'.format( s_float(pitch), s_float(yaw), s_float(roll)) return content
def save_sound_shape_point_cloud(sound_shape: TerrySoundShape, entity): ectransform_to_xml(entity, sound_shape.ectransform) ECPointCloud = SubElement(entity, "ECSphere", { }) point_cloud = SubElement(ECPointCloud, "point_cloud", { }) for i in sound_shape.points_cloud: point = SubElement(point_cloud, "point", { "x": s_float(i.x), "y": s_float(i.y), "z": s_float(i.z), })
def save_zone_template_list(zone_templates: List[TerryZoneTemplate], entities: Element): for zone_template in zone_templates: entity = create_entity_node(entities) ECBattlefieldZone = SubElement(entity, "ECBattlefieldZone", { }) ECTerryBattlefieldZone = SubElement(entity, "ECTerryBattlefieldZone", { "locked": s_bool(zone_template.locked), "rank_distance": s_float(zone_template.rank_distance), "zone_skirt_distance": s_float(zone_template.zone_skirt_distance), }) ectransform_to_xml(entity, zone_template.ectransform) ECTransform2D = SubElement(entity, "ECTransform2D", { }) ecpolyline_to_xml(entity, zone_template.polyline)
def save_sound_shape_polyline(sound_shape: TerrySoundShape, entity): ectransform_to_xml(entity, sound_shape.ectransform) ECPolyline = SubElement(entity, "ECPolyline", { }) polyline = SubElement(ECPolyline, "polyline", { "closed": "true" }) for i in sound_shape.points: point = SubElement(polyline, "point", { "x": s_float(i.x), "y": s_float(i.y), }) ECTransform2D = SubElement(entity, "ECTransform2D", { })
def save_custom_material_mesh_list( custom_material_meshes: List[TerryCustomMaterialMesh], entities: Element): for mesh in custom_material_meshes: entity = create_entity_node(entities) ECPolygonMesh = SubElement(entity, "ECPolygonMesh", { "material": mesh.material, "affects_protection_map": "false", }) ectransform_to_xml(entity, mesh.ectransform) ECPolyline = SubElement(entity, "ECPolyline", {}) polyline = SubElement(ECPolyline, "polyline", {"closed": "true"}) for i in mesh.polyline: point = SubElement(polyline, "point", { "x": s_float(i.x), "y": s_float(i.y), })
def save_decal(decal: UnrealDecalCopy) -> str: content = 'Begin Object Class=/Script/Engine.ChildActorComponent ' content += 'Name="{0}"\n'.format(decal.name) content += 'Begin Object Class=/Game/Environment/DEcals/wh_decal_bp.wh_decal_bp_C ' content += 'Name="{0}_wh_decal_bp_C_CAT"\n'.format(decal.name) content += 'End Object\n' content += 'Begin Object Name="{0}_wh_decal_bp_C_CAT"\n'.format(decal.name) content += 'Decal_Material=MaterialInstanceConstant' "{0}" '\n'.format( decal.material) content += 'Tiling={0}\n'.format(s_float(decal.tiling)) content += 'Parallax Scale={0}\n'.format(s_float(decal.parallax_scale)) content += 'End Object\n' content += 'ChildActorClass=BlueprintGeneratedClass\'"/Game/Environment/DEcals/wh_decal_bp.wh_decal_bp_C"\'\n' content += save_relative_location(decal.relative_location) content += save_relative_rotation(decal.relative_rotation) content += save_relative_scale3d(decal.relative_scale_3d) content += 'End Object\n' return content
def save_spline(entity: Element, terry_river: TerryRiver): ECRiverSpline = SubElement(entity, "ECRiverSpline", { "spline_step_size": s_float(terry_river.spline_step_size), "terrain_relative": s_bool(terry_river.terrain_relative), "reverse_direction": s_bool(terry_river.reverse_direction) }) spline = SubElement(ECRiverSpline, "spline", { "closed": s_bool(terry_river.spline_closed) }) for point in terry_river.spline: point = SubElement(spline, "point", { "position": "{0} {1} {2}".format(s_float(point.position.x), s_float(point.position.y), s_float(point.position.z)), "tangent_in": "{0} {1} {2}".format(s_float(point.tangent_in[0]), s_float(point.tangent_in[1]), s_float(point.tangent_in[2])), "tangent_out": "{0} {1} {2}".format(s_float(point.tangent_out[0]), s_float(point.tangent_out[1]), s_float(point.tangent_out[2])), "width": s_float(point.width), "terrain_offset": s_float(point.terrain_offset), "alpha_fade": s_float(point.alpha_fade), "flow_speed": s_float(point.flow_speed), "foam_amount": s_float(point.foam_amount), })
def save_sound_shape_sphere(sound_shape: TerrySoundShape, entity): ectransform_to_xml(entity, sound_shape.ectransform) ECSphere = SubElement(entity, "ECSphere", { "radius": s_float(sound_shape.radius), })