Skip to content

Commit

Permalink
Fixed the parts finding the right animations. Thanks @DRVeyl !!!
Browse files Browse the repository at this point in the history
  • Loading branch information
pap1723 committed Dec 23, 2019
1 parent 027e982 commit f579dca
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 21 deletions.
Binary file modified GameData/ROLib/Plugins/ROLib.dll
Binary file not shown.
86 changes: 65 additions & 21 deletions Source/ROLib/Modules/ModuleROSolar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -577,16 +577,63 @@ private void UpdateModulePositions()
}
*/

ROLLog.debug("Setting the rotation information for the solar panel.");
ROLLog.debug("Setting the rotation and animation for the solar panel.");

this.animationName = coreModule.definition.animationName;
if (!this.animationName.Equals("fakeAnimation"))
{
ROLLog.debug("Get the animations");
FindAnimations();
this.anim[this.animationName].wrapMode = WrapMode.ClampForever;
switch (this.deployState)
{
case DeployState.RETRACTED:
this.anim[this.animationName].normalizedTime = 0.0f;
this.anim[this.animationName].enabled = true;
this.anim[this.animationName].weight = 1f;
this.anim.Stop(this.animationName);
this.Events["Retract"].active = false;
this.Events["Extend"].active = true;
break;
case DeployState.EXTENDED:
this.anim[this.animationName].normalizedTime = 1f;
this.anim[this.animationName].enabled = true;
this.anim[this.animationName].speed = 0.0f;
this.anim[this.animationName].weight = 1f;
this.Events["Extend"].active = false;
this.Events["Retract"].active = true;
break;
default:
break;
}
}

if (pivotName.Equals("sunPivot"))
{
ROLLog.debug("Set hasPivot to false");
this.hasPivot = false;
ROLLog.debug($"this.hasPivot: {this.hasPivot}");
}

this.pivotName = coreModule.GetPivotName();
this.panelRotationTransform = this.part.FindModelTransform(this.pivotName);
this.originalRotation = this.currentRotation = this.panelRotationTransform.localRotation;
this.secondaryTransformName = this.raycastTransformName = coreModule.GetSecondaryTransform();

/*
if (pivotName == "sunPivot")
{
ROLLog.debug("fakePivot");
ROLLog.debug("sunPivot");
this.deployState = DeployState.RETRACTED;
FindAnimations();
this.animationName = coreModule.definition.animationName;
this.anim[this.animationName].wrapMode = WrapMode.ClampForever;
//ROLLog.debug("Set pivotName to null");
//this.pivotName = null;
//ROLLog.debug($"this.pivotName: {this.pivotName}");
ROLLog.debug("Get the animationName");
this.animationName = coreModule.definition.animationName;
ROLLog.debug($"this.animationName: {this.animationName}");
//ROLLog.debug("Get the animationName");
//this.animationName = coreModule.definition.animationName;
//ROLLog.debug($"this.animationName: {this.animationName}");
ROLLog.debug("Set hasPivot to false");
this.hasPivot = false;
ROLLog.debug($"this.hasPivot: {this.hasPivot}");
Expand All @@ -596,26 +643,23 @@ private void UpdateModulePositions()
//ROLLog.debug("Set this.anim to this.animationName");
//this.anim.GetClip(this.animationName);
//ROLLog.debug($"this.anim: {this.anim}");
//this.pivotName = coreModule.GetPivotName();
//this.panelRotationTransform = this.part.FindModelTransform(this.pivotName);
//this.originalRotation = this.currentRotation = this.panelRotationTransform.localRotation;
FindAnimations();
ROLLog.debug($"this.anim: {this.anim}");
ROLLog.debug("Anim loop");
foreach (Animation a in this.GetComponentsInChildren<Animation>())
{
ROLLog.debug($"[AnimDebug] Animation: {a}");
}
ROLLog.debug("Anim loop done");
}
else
{
ROLLog.debug("notFakePivot");
this.pivotName = coreModule.GetPivotName();
this.panelRotationTransform = this.part.FindModelTransform(this.pivotName);
this.originalRotation = this.currentRotation = this.panelRotationTransform.localRotation;
}
//FindAnimations();
//ROLLog.debug($"this.anim: {this.anim}");
//ROLLog.debug("Anim loop");
//foreach (Animation a in this.GetComponentsInChildren<Animation>())
//{
// ROLLog.debug($"[AnimDebug] Animation: {a}");
//}
//ROLLog.debug("Anim loop done");
}
this.pivotName = coreModule.GetPivotName();
this.panelRotationTransform = this.part.FindModelTransform(this.pivotName);
this.originalRotation = this.currentRotation = this.panelRotationTransform.localRotation;
this.secondaryTransformName = this.raycastTransformName = coreModule.GetSecondaryTransform();
*/
}

private void UpdateMassAndCost()
Expand Down

0 comments on commit f579dca

Please sign in to comment.