Exemplo n.º 1
0
def save_decals_list(decals: List[TerryDecal], entities: Element):
    for terry_decal in decals:
        entity = create_entity_node(entities)
        ECDecal = SubElement(
            entity, "ECDecal", {
                "model_path":
                terry_decal.model_path,
                "parallax_scale":
                str(terry_decal.parallax_scale),
                "tiling":
                str(terry_decal.tiling),
                "normal_mode":
                terry_decal.normal_mode,
                "apply_to_terrain":
                s_bool(terry_decal.flags["apply_to_terrain"]),
                "apply_to_objects":
                s_bool(terry_decal.flags["apply_to_objects"]),
                "render_above_snow":
                s_bool(terry_decal.flags["render_above_snow"]),
            })
        ecterrainclamp_to_xml(entity, terry_decal.ecterrainclamp)
        ectransform_to_xml(entity, terry_decal.ectransform)
        ecbattleproperties_to_xml(entity, terry_decal.ecbattleproperties)

    return entities
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
def save_composite_scene_list(composite_scenes: List[TerryCompositeScene],
                              entities: Element):
    for composite_scene in composite_scenes:
        entity = create_entity_node(entities)
        ECCompositeScene = SubElement(
            entity, "ECCompositeScene", {
                "path": composite_scene.path,
                "autoplay": s_bool(composite_scene.autoplay),
            })
        ectransform_to_xml(entity, composite_scene.ectransform)
def save_light_probe_list(light_probes: List[TerryLightProbe],
                          entities: Element):
    for light_probe in light_probes:
        entity = create_entity_node(entities)
        ECLightProbe = SubElement(entity, "ECLightProbe", {
            "primary": s_bool(light_probe.is_primary),
        })
        ectransform_to_xml(entity, light_probe.ectransform)
        ECSphere = SubElement(entity, "ECSphere", {
            "radius": str(light_probe.radius),
        })
Exemplo n.º 6
0
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_buildings_list(buildings: List[TerryBuilding], entities: Element):
    for building in buildings:
        entity = create_entity_node(entities)
        ECBuilding = SubElement(
            entity, "ECBuilding", {
                "key":
                building.key,
                "damage":
                str(building.damage),
                "indestructible":
                s_bool(building.flags["indestructible"]),
                "toggleable":
                s_bool(building.flags["toggleable"]),
                "capture_location":
                "",
                "export_as_prop":
                s_bool(building.flags["export_as_prop"]),
                "allow_in_outfield_as_prop":
                s_bool(building.flags["allow_in_outfield_as_prop"]),
            })
        ecmeshrendersettings_to_xml(entity, building.ecmeshrendersettings)
        ectransform_to_xml(entity, building.ectransform)
        ecterrainclamp_to_xml(entity, building.ecterrainclamp)
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)