diff --git a/.gitignore b/.gitignore index 9fcf1e5..8cb4d00 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ Build/Debug _UpgradeReport_Files x64 Debug +/Build +/ipch/nifplugins_vc2008-4447fb5f +/NifPlugins_VC2010.sdf diff --git a/NifCommon/niutils.cpp b/NifCommon/niutils.cpp index 6114ec7..b90620f 100644 --- a/NifCommon/niutils.cpp +++ b/NifCommon/niutils.cpp @@ -804,13 +804,16 @@ Modifier *GetOrCreateSkin(INode *node) Modifier *skinMod = GetSkin(node); if (skinMod) return skinMod; - - IDerivedObject *dobj = CreateDerivedObject(node->GetObjectRef()); + Object *pObj = node->GetObjectRef(); + IDerivedObject *pDerObj = NULL; + if (pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID) + pDerObj = static_cast(pObj); + else pDerObj = CreateDerivedObject(pObj); //create a skin modifier and add it skinMod = (Modifier*) CreateInstance(OSM_CLASS_ID, SKIN_CLASSID); - dobj->SetAFlag(A_LOCK_TARGET); - dobj->AddModifier(skinMod); - dobj->ClearAFlag(A_LOCK_TARGET); + pDerObj->SetAFlag(A_LOCK_TARGET); + pDerObj->AddModifier(skinMod); + pDerObj->ClearAFlag(A_LOCK_TARGET); node->SetObjectRef(dobj); return skinMod; } diff --git a/NifProps/Modifier/BSDismemberSkin.cpp b/NifProps/Modifier/BSDismemberSkin.cpp index 8246459..a3edb06 100644 --- a/NifProps/Modifier/BSDismemberSkin.cpp +++ b/NifProps/Modifier/BSDismemberSkin.cpp @@ -2510,19 +2510,24 @@ void BSDSModifier::SelectUnused() ip->RedrawViews(ip->GetTime()); } -// Get or Create the Skin Modifier +// Get or Create the BSDismember Modifier Modifier *GetOrCreateBSDismemberSkin(INode *node) { Modifier *skinMod = GetBSDismemberSkin(node); if (skinMod) return skinMod; - - IDerivedObject *dobj = CreateDerivedObject(node->GetObjectRef()); - //create a skin modifier and add it + Object *pObj = node->GetObjectRef(); + IDerivedObject *pDerObj = NULL; + if (pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID) + pDerObj = static_cast(pObj); + else { + pDerObj = CreateDerivedObject(pObj); + } + //create a BSDismember modifier and add it skinMod = (Modifier*) CreateInstance(OSM_CLASS_ID, BSDSMODIFIER_CLASS_ID); - dobj->SetAFlag(A_LOCK_TARGET); - dobj->AddModifier(skinMod); - dobj->ClearAFlag(A_LOCK_TARGET); + pDerObj->SetAFlag(A_LOCK_TARGET); + pDerObj->AddModifier(skinMod); + pDerObj->ClearAFlag(A_LOCK_TARGET); node->SetObjectRef(dobj); return skinMod; }