KatsBits Community

AttributeError: 'MeshTexturePoly' object has no attribute 'use_twoside'

kat · 3 · 27471

0 Members and 3 Guests are viewing this topic.

Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3148
    • KatsBits
Problem
When exporting solid mesh objects (closed meshes) using Blenders idtech (Quake) *.map exporter the following error occurs;
Code: [Select]
AttributeError: 'MeshTexturePoly' object has no attribute 'use_twoside'
Cause
Primarily the "use_twoside" error occurs most often when attempting to export objects that are 'modelled' in the sense that they contain concave structures, i.e. elements that would otherwise require an inset, recess or other 'inner' structure as part of the whole (or are otherwise complex shapes not ordinarily possible with brush volumes).

A secondary cause for the "use_twoside" errors occurs when exporting mesh objects that have missing faces - these produce invalid structures forcing a halt in the script at their discovery.


Image above shows a small area with a depression bordered by two tiers of steps - this forms a convex shape that typically causes the 'use_twoside' error.

Solution
To ensure proper export of models to brush volumes to the *.map format, objects must only be comprised convex surfaces/structures only; they cannot contain 'insets', 'recesses' or other 'inward' oriented elements else the export process cannot determine the elements volume (especially when constructing using close meshes). Meshes that do contain such structures need to be broken down into convex volumes with all opening closed (closed meshes).


The image shown above show the corrected version of the same mesh in the first and how is has been broken down into a series of solid (closed) simple blocks

Alternatively, where the error occurs due to missing faces/open meshes gaps and openings should be closed and repaired for export.

Video
The below short video shows the model from the above in 'native' and 'fixed' format in Blender, and the result in GTKRadiant (1.4). Using the settings mentioned, i.e. "Brush Thickness:8" (should be a 'power of two' measurement - applies equally to volumes units as it does to textures) and "Scale:1" ensure exported volumes are correctly sized relative to the editor.


Additional Resources
Making BSP maps in Blender
Exporting models as maps (2.49)


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3148
    • KatsBits
Secondary cause
A secondary cause for the "use_twoside" errors occurs when exporting mesh objects that have missing faces, gaps or openings, i.e. meshes that are not essentially water-tight - because brushes are solid volumes these types of objects produce invalid structures forcing a halt in the script at their discovery.

Secondary fix
Where the "use_twoside" error occurs due to missing faces/open meshes,  gaps, openings or splits should be closed and repaired before export - mesh primitives needs to be completely water-tight to generate valid brush volumes.


Missing faces result in 'open' meshes that don't generate valid brush volumes. Fill ("F") or "Remove Doubles" to ensure individual meshes are closed (DO NOT do this for larger structures as it merges individual elements together causing greater problems).


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3148
    • KatsBits
Tertiary (third) cause
A third cause for the "use_twoside" error occurs when exporting plains, faces or single sided elements that are part of more substantial mesh objects (which will export correctly). When exporting, data is parsed and will halt at the surface that cannot be processed, resulting in an incomplete *.map file.

Tertiary fix
If a plain, face or surface is required to be exported, it should be done independently of other objects and elements so will need to be detached using "Separate" ("P" whilst selected in edit mode). If face or plain inclusion is a build error, delete before export.


Disassociated faces not part of a 'solid' object will cause the "use_twoside" error. Remove or detach to prevent/fix.