Skip to content

Commit f4eacaa

Browse files
committed
Closes #528, removing the long outdated Composite Normal Textures function that doesn't do anything.
1 parent 00724dd commit f4eacaa

File tree

15 files changed

+1
-316
lines changed

15 files changed

+1
-316
lines changed

io_xplane2blender/xplane_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# The current data model version, incrementing every time xplane_constants, xplane_props, or xplane_updater
2020
# changes. Builds earlier than 3.4.0-beta.5 have and a version of 0.
2121
# When merging, take the higher data model version of the two branches and add one
22-
CURRENT_DATA_MODEL_VERSION = 103
22+
CURRENT_DATA_MODEL_VERSION = 104
2323

2424
# The build number, hardcoded by the build script when there is one, otherwise it is xplane_constants.BUILD_NUMBER_NONE
2525
CURRENT_BUILD_NUMBER = xplane_constants.BUILD_NUMBER_NONE

io_xplane2blender/xplane_image_composer.py

Lines changed: 0 additions & 106 deletions
This file was deleted.

io_xplane2blender/xplane_props.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,12 +1439,6 @@ class XPlaneSceneSettings(bpy.types.PropertyGroup):
14391439
]
14401440
)
14411441

1442-
compositeTextures: bpy.props.BoolProperty(
1443-
name = "Compile Normal-Textures",
1444-
description = "Will automatically create and use corrected normal textures",
1445-
default = True
1446-
)
1447-
14481442
# This list of version histories the .blend file has encountered,
14491443
# from the earliest
14501444
xplane2blender_ver_history: bpy.props.CollectionProperty(

io_xplane2blender/xplane_types/xplane_header.py

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
logger,
1818
resolveBlenderPath,
1919
)
20-
from ..xplane_image_composer import (
21-
combineSpecularAndNormal,
22-
getImageByFilepath,
23-
normalWithoutAlpha,
24-
specularToGrayscale,
25-
)
2620
from .xplane_attribute import XPlaneAttribute
2721
from .xplane_attributes import XPlaneAttributes
2822

@@ -508,88 +502,6 @@ def _init(self):
508502
for attr in self.xplaneFile.options.customAttributes:
509503
self.attributes.add(XPlaneAttribute(attr.name, attr.value))
510504

511-
def _compositeNormalTextureNeedsRecompile(self, compositePath, sourcePaths):
512-
compositePath = resolveBlenderPath(compositePath)
513-
514-
if not os.path.exists(compositePath):
515-
return True
516-
else:
517-
compositeTime = os.path.getmtime(compositePath)
518-
519-
for sourcePath in sourcePaths:
520-
sourcePath = resolveBlenderPath(sourcePath)
521-
522-
if os.path.exists(sourcePath):
523-
sourceTime = os.path.getmtime(sourcePath)
524-
525-
if sourceTime > compositeTime:
526-
return True
527-
528-
return False
529-
530-
def _getCompositeNormalTexture(self, textureNormal, textureSpecular):
531-
normalImage = None
532-
specularImage = None
533-
texture = None
534-
image = None
535-
filepath = None
536-
channels = 4
537-
538-
if textureNormal:
539-
normalImage = getImageByFilepath(textureNormal)
540-
541-
if textureSpecular:
542-
specularImage = getImageByFilepath(textureSpecular)
543-
544-
# only normals, no specular
545-
if normalImage and not specularImage:
546-
filename, extension = os.path.splitext(textureNormal)
547-
filepath = texture = filename + "_nm" + extension
548-
channels = 3
549-
550-
if self._compositeNormalTextureNeedsRecompile(filepath, (textureNormal)):
551-
image = normalWithoutAlpha(normalImage, normalImage.name + "_nm")
552-
553-
# normal + specular
554-
elif normalImage and specularImage:
555-
filename, extension = os.path.splitext(textureNormal)
556-
filepath = texture = filename + "_nm_spec" + extension
557-
channels = 4
558-
559-
if self._compositeNormalTextureNeedsRecompile(
560-
filepath, (textureNormal, textureSpecular)
561-
):
562-
image = combineSpecularAndNormal(
563-
specularImage, normalImage, normalImage.name + "_nm_spec"
564-
)
565-
566-
# specular only
567-
elif not normalImage and specularImage:
568-
filename, extension = os.path.splitext(textureSpecular)
569-
filepath = texture = filename + "_spec" + extension
570-
channels = 1
571-
572-
if self._compositeNormalTextureNeedsRecompile(filepath, (textureSpecular)):
573-
image = specularToGrayscale(specularImage, specularImage.name + "_spec")
574-
575-
if image:
576-
savepath = resolveBlenderPath(filepath)
577-
578-
color_mode = bpy.context.scene.render.image_settings.color_mode
579-
if channels == 4:
580-
bpy.context.scene.render.image_settings.color_mode = "RGBA"
581-
elif channels == 3:
582-
bpy.context.scene.render.image_settings.color_mode = "RGB"
583-
elif channels == 1:
584-
bpy.context.scene.render.image_settings.color_mode = "BW"
585-
image.save_render(savepath, bpy.context.scene)
586-
image.filepath = filepath
587-
588-
# restore color_mode
589-
bpy.context.scene.render.image_settings.color_mode = color_mode
590-
591-
return texture
592-
593505
def get_path_relative_to_dir(self, res_path: str, export_dir: str) -> str:
594506
"""
595507
Returns the resource path relative to the exported OBJ

io_xplane2blender/xplane_ui.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ def empty_layout(layout: bpy.types.UILayout, empty_obj: bpy.types.Object):
222222
def scene_layout(layout: bpy.types.UILayout, scene: bpy.types.Scene):
223223
layout.row().operator("scene.export_to_relative_dir", icon="EXPORT")
224224
layout.row().prop(scene.xplane, "version")
225-
layout.row().prop(scene.xplane, "compositeTextures")
226225

227226
xp2b_ver = xplane_helpers.VerStruct.current()
228227
if (

tests/features/tex/color.png

-2.19 KB
Binary file not shown.

tests/features/tex/draped.png

-25.2 KB
Binary file not shown.

tests/features/tex/draped_NML.png

-3.21 KB
Binary file not shown.

tests/features/tex/normal.png

-2.92 KB
Binary file not shown.
-3.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)