X-Plane / XPlane2Blender

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

feat_import uses test framework set_materials to configure texture resulting in large numbers of redundant texture nodes #711

Open ian-m-carr opened 1 year ago

ian-m-carr commented 1 year ago

the feat_import branch uses the unit test code to create blender objects.

Currently create_material takes the texture input but does nothing with it, instead the texture is handled in set_material.

set_material creates the texture node and links it into the material on every call, this results in a redundant node in the material for every prior call.

Moving the texture initialization to the create_material method (where it is documented) and only runnning it if the material does not exist removes the redundant re-initialization of the texture node.

Note: this change may effect the unit tests, separating the code for the import and unit tests would mitigate this risk.

Change in my fork: https://github.com/X-Plane/XPlane2Blender/commit/5ba487c4621fa15b83440785fc91437311015787