Skip to content

Commit

Permalink
fix interaction with stock ModulePartVariants
Browse files Browse the repository at this point in the history
  • Loading branch information
pellinor0 committed Mar 9, 2018
1 parent e80bf08 commit 0b9790c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GameData/TweakScale/TweakScale.version
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"VERSION":{
"MAJOR":2,
"MINOR":3,
"PATCH":8,
"PATCH":9,
"BUILD":0
},
"KSP_VERSION":{
Expand Down
Binary file modified GameData/TweakScale/plugins/Scale.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "2.3.8.0")]
[assembly: AssemblyFileVersion("2.3.8.0")]
[assembly: AssemblyVersion( "2.3.9.0")]
[assembly: AssemblyFileVersion("2.3.9.0")]
27 changes: 27 additions & 0 deletions Scale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,33 @@ private void ScalePart(bool moveParts, bool absolute)
}
}

try
{
// support for ModulePartVariants (the stock texture switch module)
if (_prefabPart.Modules.Contains("ModulePartVariants"))
{
var pm = _prefabPart.Modules["ModulePartVariants"] as ModulePartVariants;
var m = part.Modules["ModulePartVariants"] as ModulePartVariants;

var n = pm.variantList.Count;
for (int i = 0; i < n; i++)
{
var v = m.variantList[i];
var pv = pm.variantList[i];
for (int j = 0; j < v.AttachNodes.Count; j++)
{
// the module contains attachNodes, so we need to scale those
MoveNode(v.AttachNodes[j], pv.AttachNodes[j], false, true);
}
}
}
}
catch (Exception e)
{
Tools.LogWf("Exception during stockTextureSwitch interaction" + e.ToString());
}


if (part.srfAttachNode != null)
{
MoveNode(part.srfAttachNode, _prefabPart.srfAttachNode, moveParts, absolute);
Expand Down

0 comments on commit 0b9790c

Please sign in to comment.