BadDogSkyrim / PyNifly

Export/Import tools between Blender and the Nif format, using Bodyslide/Outfit Studio's Nifly layer. Supports Skyrim LE, Skyrim SE, Fallout 4, Fallout New Vegas, Fallout 76, and Fallout 3.
GNU General Public License v3.0
179 stars 16 forks source link

Vertex color flag on export if vertices have color data #139

Closed megapatato closed 1 year ago

megapatato commented 1 year ago

Issue: BSTriShape object with color data on vertices, does not get the "vertex colors" flag set (in Blender, the Object has Object Data with colors for vertices).

To recreate: 1) Import an object that uses vertex colors e.g. Skyrim - Meshes0.bsa/meshes/dungeons/caves/green/smallhall/caveghall1way01.nif 2) Duplicate via Ctrl+D and place somewhere 3) Select all, export to NIF 4) Open in NifSkope to view

image In the attached, the BSTriShape at index 32, it's Vertex Desc. field, does not have the Colors flag.

Desired outcome: the resulting NIF's BSTriShapes have the vertex color flag enabled when the vertices have color data.

BadDogSkyrim commented 1 year ago

I just hassled with this myself. IIRC the issue was that Blender has a very confusing way of deciding whether there are vertex colors and even though I could see the color layer in the Blender UI (Color Attributes), I (and the exporter) couldn't see it through the python interface. Eventually I went into vertex paint and that created a layer that worked. I might have had to delete the not-working layer first.

It might be that I'm not creating the layer properly on import. I'll look at that.

megapatato commented 1 year ago

If this is an import problem, https://github.com/BadDogSkyrim/PyNifly/issues/140 may be related. Assuming the incoming NIF declares a BSTriShape to use vertex colors & alphas, then the shader should be using that information too, point at which the plugin can proceed knowing this vertex metadata is present.

BadDogSkyrim commented 1 year ago

Fixed in latest.