Jump to content

[0.23.x] AdvancedAnimator - ModuleAnimateGeneric upgraded v1.1.1 | 2/04/14


stupid_chris

Recommended Posts

After seeing a short rant by stubbles on #kspmodders, I thought I might give this a go. This (very small) addon is a simple attempt at "upgrading" ModuleAnimateGeneric.

Obligatory pic:

ucbvigu.png

Download

"Upgraded" features:

  • The state of the animation is persistent through saves/loads, from the VAB to launch, and in the craft file
  • Animation rewinds smoothly if reverted while moving
  • Multiple action groups available, of which the name can be changed.
  • One shot animations are persistent through save/loads
  • Where the tooltip is visible is made tweakable
  • Animation playing from EVA is made tweakable
  • ModuleManager support to stock parts
  • Can trigger effects such as sounds or particles with the animations

Module documentation:

MODULE
{
name = ModuleAnimator
animationName = anAnimationName //Name of the animation from the model
guiEnableName = Deploy //Part tooltip name to display for deployment
guiDisableName = Retract //Part tooltip name to display for retraction
actionEnableName = Deploy //Action group name for deployment. If you don't include it, this action group won't appear.
actionDisableName = Retract //Action group name for retraction. If you don't include it, this action group won't appear.
actionToggleName = Toggle //Action group name for toggling. If you don't include it, this action group won't appear.
animationSpeed = 1 //Normalized speed of the animation (1 is usually good)

//The following values are optional, only declare them if you want to change them

oneShot = false //If the animation can only be played once
activeEditor = true //If the part toolitp is visible in the editor
activeFlight = true //If the part tooltip is visible in flight
activeUnfocused = true //If the part tooltip is visible from EVA
unfocusedRange = 5 //The range from which the part tooltip is visible from in EVA
}

//Effects node
EFFECTS
{
onAnimationDeploy //Is called when the "forward" animation plays
{
//Place your effects here
}

onAnimationRetract //Is called when the "rewind" animation plays
{
//Place your effects here
}
}

Changelog:

April 2nd 2014 (take two)
v1.1.1
-Added the ability to embed effects such as audio or particles to the animations

April 2nd 2014
v1.1
-Updated the plugin to KSP 0.23.5 (ARM)
-Added ModuleManager support for stock parts using ModuleAnimateGeneric (exception made of The Claw and science experiments which /need/ it)

March 21st 2014
v1.0
-Initial release

Really not much else to say :P

Source

88x31.png

Edited by stupid_chris
v1.1.1 update
Link to comment
Share on other sites

How about a layman's description, and whether these features are added on their own to all animated parts, or if it's just for modders?

It's for modder use right now, but I could probably include an MM file that implements behaviour in all stock parts.

Edited by stupid_chris
Link to comment
Share on other sites

  • 2 weeks later...

Alright, small update guys, changelog below :)

Changelog:

April 2nd 2014
v1.1
-Updated the plugin to KSP 0.23.5 (ARM)
-Added ModuleManager support for stock parts using ModuleAnimateGeneric (exception made of The Claw and science experiments which /need/ it)

For now ModuleManager only support stock parts, but eventually I'll try to integrate parts from other mods too.

Cheers!

Link to comment
Share on other sites

Changelog:

April 2nd 2014
v1.1
-Updated the plugin to KSP 0.23.5 (ARM)
-Added ModuleManager support for stock parts using ModuleAnimateGeneric (exception made of The Claw and science experiments which /need/ it)

This is a good idea, there are lots of things I don't like about ModuleAnimateGeneric.

I've been working on a replacement for ModuleScienceExperiment and ModuleAnimateGeneric for less dumb animation controls, among other things. It's basically what I'm using now in my mod, but I'll release an updated stand-alone version sometime soon.

From what I can see it functions similar to your module, which is probably good, as it keeps things fairly consistent.

Link to comment
Share on other sites

Could you add the ability to play sounds when an animation plays?

That sounds fairly easy, I'll try to get to that tomorrow :)

Actually this sounds very easy, I'll do that now, it should only take a few minutes.

Edited by stupid_chris
Link to comment
Share on other sites

Alright, another small update, this one is for frizzank :)

Changelog:

April 2nd 2014 (take two)
v1.1.1
-Added the ability to embed effects such as audio or particles to the animations

With the use of effects node, it's possible to assign any effect you feel like to the animations. Tested and it worked well over here.

Cheers!

Link to comment
Share on other sites

  • 2 weeks later...

I have run into a strange bug after installing this. Some of my craft began to disintegrate when they passed an altitude of 6km, and my debug window began to spam "Body::setMass: mass is 0.000000, should be positive!". After some experimentation, I narrowed the part that was causing my problem down the the shielded docking port. I also noticed that in the VAB, both the shielded docking port and the inline clamp-o-tron had nodes appearing at the docking attachment points now, where they previously did not (I don't know if that has anything to do with anything, but figured it was something different so I'd mention it). When I commented out the entries in the MM config included with the download that pertained to those parts, my craft stopped breaking and those new nodes disappeared as well.

Aside from that very small issue, I'm loving the improvement! I made up a MM config to replace the instances of moduleanimategeneric in the AIES antennas.

Link to comment
Share on other sites

Two comments:

- It has been confirmed that this mod causes my animated parts to lag terribly in the VAB until the animation has been cycled once. I haven't looked into your code, but I thought you'd like to know. I don't know if this is unique to my mod.

- Would you mind adding an option to play an animation if the part is occupied? I may do this one myself, but I thought it might be best to keep it simple and just roll it into your mod.

if ( playOnOccupy && part.protoModuleCrew.Count > 0 )

Although reversing the animation upon leaving the part might be a bit more tricky. Anyway I'll look into both of these but wanted to give you a heads up.

Link to comment
Share on other sites

- It has been confirmed that this mod causes my animated parts to lag terribly in the VAB until the animation has been cycled once. I haven't looked into your code, but I thought you'd like to know. I don't know if this is unique to my mod.

I'm guessing this has to do with the LateUpdate() method. The animations are being initiated in flight and in the editor, but they are only being stopped in flight, the LateUpdate code doesn't get run in the editor.

My question is, why is it necessary to initiate the animations? Why can't they just be played directly, or is this something to do with allowing for multiple animations?

Link to comment
Share on other sites

I'm guessing this has to do with the LateUpdate() method. The animations are being initiated in flight and in the editor, but they are only being stopped in flight, the LateUpdate code doesn't get run in the editor.

My question is, why is it necessary to initiate the animations? Why can't they just be played directly, or is this something to do with allowing for multiple animations?

This is basically to initiate the animation at a position other than the first frame. Once you set the animation time, you also need to play the animation so that it updates. However, if it is not stopped, it keeps on going, and some other stuff breaks, the status iirc. Essentially, all what the LateUpdate() does is stop the animation before the end of the frame.

Basically without this, the animation would not remember it's position.

Link to comment
Share on other sites

  • 2 weeks later...
I have run into a strange bug after installing this. Some of my craft began to disintegrate when they passed an altitude of 6km ...

FYI I experienced the same problem, and spent a little time identifying the precise circumstances - in my case it occurred when this animation module was loaded in conjunction with the tweakable docking node module from Toadicus' TweakableEverything add-on. With either module disabled on the animated docking ports, the 6km barrier could be crossed with impunity. Interestingly there have been a number of historical issues with crashes and anomalous physical effects occuring when passing that altitude on ascent. For my purposes I've disabled the advanced animator module for these docking ports as the tweakable mod provides more appropriate enhancements for my docking port needs, but in most cases it's a nice alternative to the stock animation.

Link to comment
Share on other sites

  • 2 weeks later...

Another odd bug here, I installed this a few days to try out Hollow Structures and Hulls, which is awesome, and hit the VAB lag that's been mentioned. A couple crashes later I decided to remove both HSH and the dependancies, this included. However the crashes persisted and I spent a couple days trying to pinpoint why, I never actually uncovered exactly why it was crashing, however the VAB lag that came with Advanced Animator had decided to stick around and overstay it's welcome. Double checked there was nothing left of the mod and there wasn't.

I couldn't figure out why the VAB lag had been left behind, but the only way I could get rid of it was to completely delete KSP and all mods so I could start from a fresh install

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...