From 8057e1f059c376ce4a4f6ac287b47533442ee566 Mon Sep 17 00:00:00 2001 From: ousnius Date: Wed, 15 Jul 2015 19:33:43 +0200 Subject: [PATCH] Fixed copying of shader controllers --- NifFile.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NifFile.cpp b/NifFile.cpp index 91a6e338..25c5b375 100644 --- a/NifFile.cpp +++ b/NifFile.cpp @@ -650,8 +650,8 @@ void NifFile::CopyShader(const string& shapeDest, BSLightingShaderProperty* srcS // Controller NiUnknown* srcController = dynamic_cast(srcNif.GetBlock(srcShader->controllerRef)); if (srcController) { - NiUnknown* destController = new NiUnknown((*srcController)); - destController->header = &hdr; + NiUnknown* destController = new NiUnknown(srcController->CalcBlockSize()); + destController->Clone(srcController); int controllerId = blocks.size(); blocks.push_back(destController); hdr.numBlocks++; @@ -797,8 +797,8 @@ void NifFile::CopyShaderPP(const string& shapeDest, BSShaderPPLightingProperty* // Controller NiUnknown* srcController = dynamic_cast(srcNif.GetBlock(srcShader->controllerRef)); if (srcController) { - NiUnknown* destController = new NiUnknown((*srcController)); - destController->header = &hdr; + NiUnknown* destController = new NiUnknown(srcController->CalcBlockSize()); + destController->Clone(srcController); int controllerId = blocks.size(); blocks.push_back(destController); hdr.numBlocks++; @@ -1048,8 +1048,8 @@ void NifFile::CopyStrips(const string& shapeDest, NifFile& srcNif, const string& NiUnknown* srcUnknown = dynamic_cast(srcNif.GetBlock(src->propertiesRef[i])); if (srcUnknown) { - NiUnknown* destUnknown = new NiUnknown((*srcUnknown)); - destUnknown->header = &hdr; + NiUnknown* destUnknown = new NiUnknown(srcUnknown->CalcBlockSize()); + destUnknown->Clone(srcUnknown); int unknownId = blocks.size(); blocks.push_back(destUnknown); hdr.numBlocks++; @@ -1271,8 +1271,8 @@ void NifFile::CopyShape(const string& shapeDest, NifFile& srcNif, const string& NiUnknown* srcUnknown = dynamic_cast(srcNif.GetBlock(src->propertiesRef[i])); if (srcUnknown) { - NiUnknown* destUnknown = new NiUnknown((*srcUnknown)); - destUnknown->header = &hdr; + NiUnknown* destUnknown = new NiUnknown(srcUnknown->CalcBlockSize()); + destUnknown->Clone(srcUnknown); int unknownId = blocks.size(); blocks.push_back(destUnknown); hdr.numBlocks++;