Closed gavrant closed 2 years ago
@gavrant There already is a function bool GetColorsForShape(NiShape* shape, std::vector<Color4>& outColors) const;
EDIT: It seems only SetColorsForShape
is missing a pointer version.
@ousnius Unfortunately for me, my code is a derivative of PyNifly, and PyNifly does this:
const std::vector<Color4>* theColors = nif->GetColorsForShape(shape->name.get());
That is, uses the last remaining "named" method that got no pointer version with your commit. I guess I still need to rewrite that code to drop that rather shady shape->name.get()
(especially with a .nif file with empty shape names I saw today).
@ousnius Unfortunately for me, my code is a derivative of PyNifly, and PyNifly does this:
const std::vector<Color4>* theColors = nif->GetColorsForShape(shape->name.get());
That is, uses the last remaining "named" method that got no pointer version with your commit. I guess I still need to rewrite that code to drop that rather shadyshape->name.get()
(especially with a .nif file with empty shape names I saw today).
nifly has all the functions you need (it did already for "Get", and does now for "Set"). You or someone else needs to update PyNifly to use the pointer versions as well.
Yes, I know about the other version of GetColorsForShape that accepts a pointer instead of a string. It's just my inner perfectionist complaining about the sole remaining 'named" Get..ForShape in that block of code.
Almost all "Get/Set...ForShape" methods of NifFile class identify the shape by its pointer:
But a couple of "Colors" methods go with the name of the shape instead:
And this is a bit confusing. I would suggest adding
NiShape* shape
overloads of these two for consistency and predictability.