X-Plane / XPlane2Blender

Scenery & Aircraft export addon for Blender and X-Plane
GNU General Public License v3.0
190 stars 67 forks source link

RAIN_SCALE does not export #723

Closed Sp33dM closed 2 months ago

Sp33dM commented 1 year ago

Setting the rain scale value in the x-plane export properties panel (in scene) does not export to the final xplane object. Which in turn does not affect the scale of the rain on glass objects in sim.

fredconex commented 1 year ago

As asked by Ben, this is the fix I did for it, on left is the original code and on right modification I did, I've changed the condition so it export if rain_scale is lower than 1.0, before it was looking for the has_rain_system conditions

image

`def rain_header_attrs(): rain_props = self.xplaneFile.options.rain has_wipers = any( getattr(rainprops, f"wiper{i}_enabled") for i in range(1, 5) ) has_wiper_system = rain_props.wiper_texture and has_wipers

        has_thermal_sources = any(
            getattr(rain_props, f"thermal_source_{i}_enabled") for i in range(1, 5)
        )
        has_thermal_system = rain_props.thermal_texture and has_thermal_sources
        has_rain_system = has_wiper_system or has_thermal_system
        if xplane_version >= 1200 and (isAircraft or isCockpit):
            if round(rain_props.rain_scale, PRECISION_OBJ_FLOAT) < 1.0:
                self.attributes["RAIN_scale"].setValue(
                rain_props.rain_scale
                )
            if has_thermal_sources and not rain_props.thermal_texture:
                logger.warn(
                    f"{filename}: Must have Thermal Texture to use Thermal Sources"
                )
            if has_wipers and not rain_props.wiper_texture:
                logger.warn(f"{filename}: Must have Wiper Texture to use Wipers")

        if (
            xplane_version >= 1200 and (isAircraft or isCockpit) and has_rain_system
        ):
            v = {
                "THERMAL_texture": self.get_path_relative_to_dir(
                    rain_props.thermal_texture, exportdir
                )
                if rain_props.thermal_texture
                else None,
                "WIPER_texture": self.get_path_relative_to_dir(
                    rain_props.wiper_texture, exportdir
                )
                if rain_props.wiper_texture
                else None,
            }`
bsupnik commented 1 year ago

Confirmed bug. The bug is that the rain system set of data only exports if one of wipers or thermals are used, but there is lots of ACF glass that has neither. Something like the proposed edit should fix it.

FarukEroglu2048 commented 2 months ago

Fixed on master as per @fredconex's recommendation