KatsBits Community

Game Editing => idTech Editing Hints & Tips => Topic started by: kat on June 02, 2015, 02:49:24 AM

Title: AttributeError: 'MeshTexturePoly' object has no attribute 'use_twoside'
Post by: kat on June 02, 2015, 02:49:24 AM
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.

(https://www.katsbits.com/images/tutorials/brush-volumes/concave-structures_sml.jpg) (https://www.katsbits.com/images/tutorials/brush-volumes/concave-structures.jpg)
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).

(https://www.katsbits.com/images/tutorials/brush-volumes/convex-structures_sml.jpg) (https://www.katsbits.com/images/tutorials/brush-volumes/convex-structures.jpg)
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 (https://www.katsbits.com/tutorials/textures/make-better-textures-correct-size-and-power-of-two.php)' 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 (https://www.katsbits.com/tutorials/blender/map-basics-tutorial.php)
Exporting models as maps (2.49) (https://www.katsbits.com/tutorials/idtech/exporting-models-as-bsp-maps.php)
Title: Re: AttributeError: 'MeshTexturePoly' object has no attribute 'use_twoside'
Post by: kat on December 01, 2015, 03:44:55 PM
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.

(https://www.katsbits.com/images/tutorials/brush-volumes/use_twoside-second_sml.jpg) (https://www.katsbits.com/images/tutorials/brush-volumes/use_twoside-second.jpg)
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).
Title: Re: AttributeError: 'MeshTexturePoly' object has no attribute 'use_twoside'
Post by: kat on December 02, 2015, 03:42:39 AM
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.

(https://www.katsbits.com/images/tutorials/brush-volumes/use_twoside-third_sml.jpg) (https://www.katsbits.com/images/tutorials/brush-volumes/use_twoside-third.jpg)
Disassociated faces not part of a 'solid' object will cause the "use_twoside" error. Remove or detach to prevent/fix.