Changes to llkeyframemotionparam.cpp as result of audit.

These changes were the result of my Motion leak audit.
However, there is a serious problem with LLKeyframeMotionParam
in that it stores plain pointers to objects that can and will be deleted
by other objects. Its the classicial LL example of coding
non-Object-Oriented badly maintainable and instable code.

I cannot make sure this won't go wrong for the simple fact
that LLKeyframeMotionParam is not used at ALL in our code.
Hence, the next commit will rather delete this file.
This commit is merely to have a record of this finding.
Get rid of unused and irrepairable code.
Add AIDebugInstanceCounter

Prints number of instances upon construction and destruction.
Usage:

class LLSomething : public AIDebugInstanceCounter<LLSomething>
...
Auto clean up motion cache.

Conflicts:
	indra/llcharacter/llkeyframemotion.cpp
	indra/llcharacter/llkeyframemotion.h
	indra/newview/llfloaterbvhpreview.cpp
Speed up of particular inefficient part related to motions.

For these standard motions, the viewer likes to very frequently
flood-call startMotion/stopMotion sometimes, which at the very
least needs a LLUUID lookup in a std::map. In particular, this
is done for two of them for every avatar in the sim every frame.
This code makes it possible to test if that makes sense by
merely doing a bit test.

Conflicts:
	indra/llcharacter/llkeyframemotion.h
Fix lookat and pointat shared experience.

There was a bug that when people turned off sending viewer effects,
they'd also turn off sending LookAt, while there is a seperate
checkbox to turn THAT off, while still seeing their own avatar
happily look around, breaking shared experience (most notably, most
people will be complete oblivious of the fact that they look like
zombies to others and that their friends do not see the same thing
on their screen).

This patch fixes this: both parties now see the same thing. Lookat
and PointAt are only turned off by their respective checkboxes,
and no longer silently influenced by turning off other viewer
effects.
Add AISyncClient<> (and AISyncServer).

A tool to synchronize objects:
Objects derived from AISyncClient can signal that they are
'ready' or 'not ready' for up to 4 events (using a bitmask)
at a time. Clients that signal to be ready for anything
at roughly the same time as other clients, and which return
the same 'hash' (a virtual function returning a 64bit value)
will be grouped together and receive events (by means of
virtual functions being called) to notify them of all clients
being ready or not for one of the events (syncevent1).
The other three events can be polled.

The memory usage is low (one pointer per client that points
to its AISyncServer object), servers are released to a cache
after about 100 ms (unless there is actual need for synchronization),
so there aren't much of those either.

The CPU usage is extremely low: all events are handled in
parallel in a 32 bit value (6 bits per event to count the
number of registered clients and the number of ready clients
for each event, and the remaining 8 bits to count the
number of reference pointers (which should only be a constant
higher, so that is overkill). To signal to a server that
a client has become ready or not is mostly a function call,
which then takes 1 clock cycle or so before returning.
Registration of a client is slightly more expensive as it
requires a pointer to be added to the end of a std::list.
This tool could easily be used as part of the graphics engine
(not that I intend to do that :p).
Removed this again...
Add LLMotionController* LLMotion::mMotionController

This is needed for synchronization: motions will have to start
(with a specific start time offset) from a point in the code where
only the motion object is available.

I added/used LLMotionController& in a previous commit, this was
now changed into a pointer. There is (obviously) not much reason
for that, but also no disadvantage: the diff relative to LLs code
doesn't get larger since the references where already added, too.

Conflicts:
	indra/llcharacter/llkeyframemotion.cpp
	indra/llcharacter/llkeyframemotion.h
Version 2 of AISyncClient et al.

A tool to synchronize objects:
Objects derived from AISyncClient can signal that they are
'ready' or 'not ready' for up to 32 events (using a bitmask)
at a time. Clients that are created at roughly the same time
as other clients, and which return the same 'key' (a virtual
function returning an AISyncKey object) will be grouped together
and receive events (by means of virtual functions being called)
to notify them of all clients being ready or not for one of the
events (the least significant bit)). The other events can be polled.

This new version does away with all the templates and explicitly
remembers what events each client is ready for instead of just
updating a counter of the number of clients. This was necessary
because a client is removed then the server needs to know if it
was ready or not when it has to be able to update those counters.
This time I chose to just run over all stored clients and AND
and OR the per-client-ready-masks because 1) that information
is available now and 2) the lists will normally contain only
one or two clients, so it's fast enough.
The new version also allows for real key comparison (and derived
keys) instead of just using "hash" value that is compared.
Synchronize looping animations that start at the same moment.
Compile fix for Release
Freeze also synchronized avatars when editing an attachment.

On the removal of permYouOwner():

Calling permYouOwner() to determine if an attachment is yours is
not correct: grid gods (and that includes BEFORE requesting admin
status) are marked as owner of everything in their sim.

The reason for that is that otherwise,
  <Melanie_T> if they only had it when actually godding u, the viewer
  would have to have an option to either show the proper menus (it
  doesn't) or allow the sim to refresh the object flags without full
  object updates (it hasn't).
  <Melanie_T> gods often have to act fast, for instance with griefers.
  Having transition to god mode take as long as a full rez just isn't an
  option, apart from the sim load caused by resending all objects.
  <Melanie_T> Then i tried resending only the object that was selected
  but there the arriving object update would close the pie menu.
  So you right-click a prim and the pie menu would close again.

The result has always been that if you are on your own sim, in opensim,
and select an attachment on another avatar, then YOU would freeze, not
the selected avatar. This patch fixes that "opensim related" bug as
well.
Fix floating point round off error bug that caused mAnimTime to be decreased in value.

Conflicts:
	indra/llcharacter/llmotioncontroller.cpp
Compile fix for motions backport.