Hi, Guys.
I have a small problem, actually 2 day evenings are spent during resolve this problem.
So.
I have method
private void InitializeAnimations()
{
for (int i = 0; i < MeshList.Count; i++)
{
TransGroupList = new List<Transform3DGroup>();
Console.WriteLine("Rotate item: {0}",i);
foreach (RotationAxiss item in Enum.GetValues(typeof(RotationAxiss)))
{
var TransGroup = new Transform3DGroup();
Console.WriteLine("Rotate By: {0} axe", item.ToString());
for (int i2 = 0; i2 < MeshList[i].Count; i2++)
{
if (MeshList[i].Count - 1 == i2)
TransforMeshmAngle(MeshList[i][i2], item, true, TransGroup);
else
TransforMeshmAngle(MeshList[i][i2], item, false, TransGroup);
}
TransGroupList.Add(TransGroup);
}
ListTransGroupList.Add(TransGroupList);
}
}
MeshList is a like List<list><geometrymodel3d>>
Foreach GeometryModel3D I am creating animation.
By using this method:
private void TransforMeshmAngle(GeometryModel3D input, RotationAxiss rotAxisEnum, bool isLastItem, Transform3DGroup group)
{
RotateTransform3D myRotateTransform3D = new RotateTransform3D();
AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
myRotateTransform3D.Rotation = myAxisAngleRotation3d;
input.Transform = myRotateTransform3D;
switch (rotAxisEnum)
{
case RotationAxiss.ByX:
myAxisAngleRotation3d.Axis = new Vector3D(1, 0, 0);
break;
case RotationAxiss.ByY:
myAxisAngleRotation3d.Axis = new Vector3D(0, 1, 0);
break;
case RotationAxiss.ByZ:
myAxisAngleRotation3d.Axis = new Vector3D(0, 0, 1);
break;
default:
break;
}
group.Children.Add(myRotateTransform3D);
}
All items are added to list like is should.
Everything seems very good :)
But....
When I try to run animation. Only Last item in " TransGroupList " can be animated.
foreach (RotateTransform3D item in ListTransGroupList[index][index2].Children)
{
item.Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, InitDoubleAnim(), HandoffBehavior.Compose);
}
Also i tried to change sequence of enum RotationAxiss.
And same. only Last item is animated.
I can run different animations, with rule that it is last item in TransGroupList.
So, Can someone tell me where is mistake?
Thanks.