本文整理汇总了C#中Bone.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Bone.AddChild方法的具体用法?C# Bone.AddChild怎么用?C# Bone.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bone
的用法示例。
在下文中一共展示了Bone.AddChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTagPointOnBone
public TagPoint CreateTagPointOnBone( Bone bone, Quaternion offsetOrientation, Vector3 offsetPosition )
{
var tagPoint = new TagPoint( ++this.nextTagPointAutoHandle, this );
this.tagPointList[ this.nextTagPointAutoHandle ] = tagPoint;
tagPoint.Translate( offsetPosition );
tagPoint.Rotate( offsetOrientation );
tagPoint.SetBindingPose();
bone.AddChild( tagPoint );
return tagPoint;
}
示例2: BuildArmature
//.........这里部分代码省略.........
else
{
armature.AddBone(bone);
}
}
if(animationName!=null && animationName != armatureName)
{
animationArmatureData = data.GetArmatureData(animationName);
if(animationArmatureData == null)
{
foreach (KeyValuePair<string, SkeletonData> skeleton in _dataDic)
{
data = _dataDic[skeleton.Key];
animationArmatureData = data.GetArmatureData(animationName);
if(animationArmatureData!=null)
{
break;
}
}
}
}
if(animationArmatureData!=null)
{
armature.Animation.AnimationDataList = animationArmatureData.AnimationDataList;
}
else
{
armature.Animation.AnimationDataList = armatureData.AnimationDataList;
}
SkinData skinData = armatureData.GetSkinData(skinName);
if(skinData == null)
{
throw new ArgumentException();
}
Slot slot;
DisplayData displayData;
Armature childArmature;
int i;
List<object> helpArray = new List<object>();
foreach(SlotData slotData in skinData.SlotDataList)
{
bone = armature.GetBone(slotData.Parent);
if(bone == null)
{
continue;
}
slot = generateSlot();
slot.Name = slotData.Name;
slot.BlendMode = slotData.BlendMode;
slot._originZOrder = slotData.ZOrder;
slot._dislayDataList = slotData.DisplayDataList;
helpArray.Clear();
i = slotData.DisplayDataList.Count;
while(i -- >0)
{
displayData = slotData.DisplayDataList[i];
switch(displayData.Type)
{
case DisplayData.ARMATURE:
childArmature = BuildArmature(displayData.Name, null, _currentDataName, _currentTextureAtlasName);
if(childArmature!=null)
{
helpArray.Insert(0, childArmature);
}
break;
case DisplayData.IMAGE:
default:
helpArray.Insert(0, generateDisplay(_textureAtlasDic[_currentTextureAtlasName], displayData.Name, displayData.Pivot.X, displayData.Pivot.Y));
break;
}
}
slot.DisplayList = helpArray;
slot.changeDisplay(0);
bone.AddChild(slot);
}
//
i = armature._boneList.Count;
while(i -- >0)
{
armature._boneList[i].update();
}
i = armature._slotList.Count;
while(i -- >0)
{
slot = armature._slotList[i];
slot.update();
}
armature.UpdateSlotsZOrder();
return armature;
}
示例3: CloneBoneAndChildren
/// <summary>
/// Clones bones, for use in cloning the master skeleton to make this a unique
/// skeleton instance.
/// </summary>
/// <param name="source"></param>
/// <param name="parent"></param>
protected void CloneBoneAndChildren( Bone source, Bone parent )
{
Bone newBone;
if ( source.Name == "" )
{
newBone = CreateBone( source.Handle );
}
else
{
newBone = CreateBone( source.Name, source.Handle );
}
newBone.Orientation = source.Orientation;
newBone.Position = source.Position;
newBone.Scale = source.Scale;
if ( parent == null )
{
rootBones.Add( newBone );
}
else
{
parent.AddChild( newBone );
}
// process children
foreach ( Bone child in source.Children )
{
CloneBoneAndChildren( child, newBone );
}
}
示例4: ProcessBones
/// <summary>
/// Set up the skeleton based on the information in the
/// invBindMatrices dictionary.
/// </summary>
/// <param name="invBindMatrices">Dictionary of inverse matrices for
/// each of the joints</param>
/// <param name="skeleton">Skeleton to build</param>
/// <param name="parentBone">Bone for which we are building children (or null to build the root)</param>
protected void ProcessBones( Dictionary<string, Matrix4> invBindMatrices,
Skeleton skeleton, Bone parentBone )
{
string parentName = (parentBone == null) ? null : parentBone.Name;
Quaternion rotate;
Vector3 translate, scale;
foreach( string boneName in GetChildBones( parentName ) )
{
// Get the relative transform by this bone in transformed space
Matrix4 boneTransform = GetLocalBindMatrix( invBindMatrices, boneName, parentName );
Matrix4.DecomposeMatrix( ref boneTransform, out translate, out rotate, out scale );
Bone bone = skeleton.CreateBone( boneName );
m_Log.DebugFormat( "Bone Transform for {0}:\n{1}", boneName, boneTransform );
if( parentBone != null )
parentBone.AddChild( bone );
// Apply the inverse of the parent transform
bone.Orientation = rotate;
bone.Position = translate;
ProcessBones( invBindMatrices, skeleton, bone );
}
}