Skip to content

Commit 149a14f

Browse files
committed
Turns out we forgot the resetter code! Sure am glad we double triple checked that!
1 parent ddd8d19 commit 149a14f

4 files changed

Lines changed: 3519 additions & 13 deletions

File tree

io_xplane2blender/xplane_types/xplane_commands.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __init__(self, xplaneFile) -> None:
8585

8686
self.reseters = {
8787
"ATTR_light_level": "ATTR_light_level_reset",
88-
"ATTR_cockpit|ATTR_cockpit_region": "ATTR_no_cockpit",
88+
"ATTR_cockpit(_lit_only|_region)?": "ATTR_no_cockpit",
8989
"ATTR_manip_(?!none)(?!wheel)(.*)": "ATTR_manip_none",
9090
"ATTR_no_shadow": "ATTR_shadow",
9191
"ATTR_draw_disable": "ATTR_draw_enable",
@@ -329,6 +329,7 @@ def writeReseters(self, xplaneObject: xplane_object.XPlaneObject) -> str:
329329
"ATTR_light_level",
330330
"ATTR_light_level_reset",
331331
"ATTR_cockpit",
332+
"ATTR_cockpit_lit_only",
332333
"ATTR_cockpit_region",
333334
"ATTR_no_cockpit",
334335
"ATTR_draw_disable",
@@ -357,20 +358,12 @@ def writeReseters(self, xplaneObject: xplane_object.XPlaneObject) -> str:
357358
# manips) to the attributes.
358359
#
359360
# This way the resetter thinks it doesn't have to reset
360-
# because the next object "has" it already.
361+
# because the next XPlaneObject passed in "has" it already.
362+
#
363+
# *
361364
for attr in WHITE_LIST:
362365
attributes.add(xplane_attribute.XPlaneAttribute(attr))
363366

364-
# This is the attributes that the next object will have.
365-
#
366-
# Comment about the comment: Remember "next object",
367-
# can mean self if that is what you passed in. Don't confuse
368-
# the comment's sense of tense with how this is currently used in
369-
# the exporter. Just remember who xplaneObject is and you'll be fine.
370-
#
371-
# Comment about the comment about the comment:
372-
# The resetter system is so confusing its
373-
# good comments also need good comments. Ugh.
374367
attributeNames = sorted(attributes.keys())
375368

376369
# This is the attributes we have already stated that MIGHT need to be reset.
@@ -384,7 +377,7 @@ def writeReseters(self, xplaneObject: xplane_object.XPlaneObject) -> str:
384377

385378
# Now that the added white list trick is in place,
386379
# we'll nearly always have 2 matching attributes
387-
if len(matchingAttribute) > 2:
380+
if len(matchingAttribute) > 3:
388381
print(
389382
"WARNING: multiple incoming attributes matched %s" % setterPattern
390383
)
124 KB
Binary file not shown.

tests/features/cockpit_lit_only.test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def test_Scene_1110(self) -> None:
3535
"test_01_cockpit_lit_only_exported",
3636
"test_03_cockpit_lit_only_no_export_regions",
3737
"test_04_cockpit_lit_no_export_panel_mode_default",
38+
"test_07_cockpit_lit_only_resets",
3839
]:
3940
with self.subTest(f"Testing fixture {filename}", filename=filename):
4041
self.assertExportableRootExportEqualsFixture(

0 commit comments

Comments
 (0)