本文整理汇总了C#中Spine.SkeletonData.FindSkin方法的典型用法代码示例。如果您正苦于以下问题:C# SkeletonData.FindSkin方法的具体用法?C# SkeletonData.FindSkin怎么用?C# SkeletonData.FindSkin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spine.SkeletonData
的用法示例。
在下文中一共展示了SkeletonData.FindSkin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadAnimation
//.........这里部分代码省略.........
frameIndex++;
}
timelines.Add(timeline);
duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 3 - 3]);
} else
throw new Exception("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")");
}
}
}
if (map.ContainsKey("ik")) {
foreach (KeyValuePair<String, Object> ikMap in (Dictionary<String, Object>)map["ik"]) {
IkConstraintData ikConstraint = skeletonData.FindIkConstraint(ikMap.Key);
var values = (List<Object>)ikMap.Value;
var timeline = new IkConstraintTimeline(values.Count);
timeline.ikConstraintIndex = skeletonData.ikConstraints.IndexOf(ikConstraint);
int frameIndex = 0;
foreach (Dictionary<String, Object> valueMap in values) {
float time = (float)valueMap["time"];
float mix = valueMap.ContainsKey("mix") ? (float)valueMap["mix"] : 1;
bool bendPositive = valueMap.ContainsKey("bendPositive") ? (bool)valueMap["bendPositive"] : true;
timeline.SetFrame(frameIndex, time, mix, bendPositive ? 1 : -1);
ReadCurve(timeline, frameIndex, valueMap);
frameIndex++;
}
timelines.Add(timeline);
duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 3 - 3]);
}
}
if (map.ContainsKey("ffd")) {
foreach (KeyValuePair<String, Object> ffdMap in (Dictionary<String, Object>)map["ffd"]) {
Skin skin = skeletonData.FindSkin(ffdMap.Key);
foreach (KeyValuePair<String, Object> slotMap in (Dictionary<String, Object>)ffdMap.Value) {
int slotIndex = skeletonData.FindSlotIndex(slotMap.Key);
foreach (KeyValuePair<String, Object> meshMap in (Dictionary<String, Object>)slotMap.Value) {
var values = (List<Object>)meshMap.Value;
var timeline = new FFDTimeline(values.Count);
Attachment attachment = skin.GetAttachment(slotIndex, meshMap.Key);
if (attachment == null) throw new Exception("FFD attachment not found: " + meshMap.Key);
timeline.slotIndex = slotIndex;
timeline.attachment = attachment;
int vertexCount;
if (attachment is MeshAttachment)
vertexCount = ((MeshAttachment)attachment).vertices.Length;
else
vertexCount = ((WeightedMeshAttachment)attachment).Weights.Length / 3 * 2;
int frameIndex = 0;
foreach (Dictionary<String, Object> valueMap in values) {
float[] vertices;
if (!valueMap.ContainsKey("vertices")) {
if (attachment is MeshAttachment)
vertices = ((MeshAttachment)attachment).vertices;
else
vertices = new float[vertexCount];
} else {
var verticesValue = (List<Object>)valueMap["vertices"];
vertices = new float[vertexCount];
int start = GetInt(valueMap, "offset", 0);
if (scale == 1) {
for (int i = 0, n = verticesValue.Count; i < n; i++)
vertices[i + start] = (float)verticesValue[i];
} else {
示例2: ReadSkeletonData
//.........这里部分代码省略.........
data.shearMix = GetFloat(constraintMap, "shearMix", 1);
skeletonData.transformConstraints.Add(data);
}
}
// Path constraints.
if(root.ContainsKey("path")) {
foreach (Dictionary<String, Object> constraintMap in (List<Object>)root["path"]) {
PathConstraintData data = new PathConstraintData((String)constraintMap["name"]);
data.order = GetInt(constraintMap, "order", 0);
foreach (String boneName in (List<Object>)constraintMap["bones"]) {
BoneData bone = skeletonData.FindBone(boneName);
if (bone == null) throw new Exception("Path bone not found: " + boneName);
data.bones.Add(bone);
}
String targetName = (String)constraintMap["target"];
data.target = skeletonData.FindSlot(targetName);
if (data.target == null) throw new Exception("Target slot not found: " + targetName);
data.positionMode = (PositionMode)Enum.Parse(typeof(PositionMode), GetString(constraintMap, "positionMode", "percent"), true);
data.spacingMode = (SpacingMode)Enum.Parse(typeof(SpacingMode), GetString(constraintMap, "spacingMode", "length"), true);
data.rotateMode = (RotateMode)Enum.Parse(typeof(RotateMode), GetString(constraintMap, "rotateMode", "tangent"), true);
data.offsetRotation = GetFloat(constraintMap, "rotation", 0);
data.position = GetFloat(constraintMap, "position", 0);
if (data.positionMode == PositionMode.Fixed) data.position *= scale;
data.spacing = GetFloat(constraintMap, "spacing", 0);
if (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) data.spacing *= scale;
data.rotateMix = GetFloat(constraintMap, "rotateMix", 1);
data.translateMix = GetFloat(constraintMap, "translateMix", 1);
skeletonData.pathConstraints.Add(data);
}
}
// Skins.
if (root.ContainsKey("skins")) {
foreach (KeyValuePair<String, Object> skinMap in (Dictionary<String, Object>)root["skins"]) {
var skin = new Skin(skinMap.Key);
foreach (KeyValuePair<String, Object> slotEntry in (Dictionary<String, Object>)skinMap.Value) {
int slotIndex = skeletonData.FindSlotIndex(slotEntry.Key);
foreach (KeyValuePair<String, Object> entry in ((Dictionary<String, Object>)slotEntry.Value)) {
try {
Attachment attachment = ReadAttachment((Dictionary<String, Object>)entry.Value, skin, slotIndex, entry.Key);
if (attachment != null) skin.AddAttachment(slotIndex, entry.Key, attachment);
} catch (Exception e) {
throw new Exception("Error reading attachment: " + entry.Key + ", skin: " + skin, e);
}
}
}
skeletonData.skins.Add(skin);
if (skin.name == "default") skeletonData.defaultSkin = skin;
}
}
// Linked meshes.
for (int i = 0, n = linkedMeshes.Count; i < n; i++) {
LinkedMesh linkedMesh = linkedMeshes[i];
Skin skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.FindSkin(linkedMesh.skin);
if (skin == null) throw new Exception("Slot not found: " + linkedMesh.skin);
Attachment parent = skin.GetAttachment(linkedMesh.slotIndex, linkedMesh.parent);
if (parent == null) throw new Exception("Parent mesh not found: " + linkedMesh.parent);
linkedMesh.mesh.ParentMesh = (MeshAttachment)parent;
linkedMesh.mesh.UpdateUVs();
}
linkedMeshes.Clear();
// Events.
if (root.ContainsKey("events")) {
foreach (KeyValuePair<String, Object> entry in (Dictionary<String, Object>)root["events"]) {
var entryMap = (Dictionary<String, Object>)entry.Value;
var data = new EventData(entry.Key);
data.Int = GetInt(entryMap, "int", 0);
data.Float = GetFloat(entryMap, "float", 0);
data.String = GetString(entryMap, "string", string.Empty);
skeletonData.events.Add(data);
}
}
// Animations.
if (root.ContainsKey("animations")) {
foreach (KeyValuePair<String, Object> entry in (Dictionary<String, Object>)root["animations"]) {
try {
ReadAnimation((Dictionary<String, Object>)entry.Value, entry.Key, skeletonData);
} catch (Exception e) {
throw new Exception("Error reading animation: " + entry.Key, e);
}
}
}
skeletonData.bones.TrimExcess();
skeletonData.slots.TrimExcess();
skeletonData.skins.TrimExcess();
skeletonData.events.TrimExcess();
skeletonData.animations.TrimExcess();
skeletonData.ikConstraints.TrimExcess();
return skeletonData;
}
示例3: ReadAnimation
//.........这里部分代码省略.........
else {
timeline = new PathConstraintPositionTimeline(values.Count);
if (data.positionMode == PositionMode.Fixed) timelineScale = scale;
}
timeline.pathConstraintIndex = index;
int frameIndex = 0;
foreach (Dictionary<String, Object> valueMap in values) {
timeline.SetFrame(frameIndex, (float)valueMap["time"], GetFloat(valueMap, timelineName, 0) * timelineScale);
ReadCurve(valueMap, timeline, frameIndex);
frameIndex++;
}
timelines.Add(timeline);
duration = Math.Max(duration, timeline.frames[(timeline.FrameCount - 1) * PathConstraintPositionTimeline.ENTRIES]);
}
else if (timelineName == "mix") {
PathConstraintMixTimeline timeline = new PathConstraintMixTimeline(values.Count);
timeline.pathConstraintIndex = index;
int frameIndex = 0;
foreach (Dictionary<String, Object> valueMap in values) {
timeline.SetFrame(frameIndex, (float)valueMap["time"], GetFloat(valueMap, "rotateMix", 1), GetFloat(valueMap, "translateMix", 1));
ReadCurve(valueMap, timeline, frameIndex);
frameIndex++;
}
timelines.Add(timeline);
duration = Math.Max(duration, timeline.frames[(timeline.FrameCount - 1) * PathConstraintMixTimeline.ENTRIES]);
}
}
}
}
// Deform timelines.
if (map.ContainsKey("deform")) {
foreach (KeyValuePair<String, Object> deformMap in (Dictionary<String, Object>)map["deform"]) {
Skin skin = skeletonData.FindSkin(deformMap.Key);
foreach (KeyValuePair<String, Object> slotMap in (Dictionary<String, Object>)deformMap.Value) {
int slotIndex = skeletonData.FindSlotIndex(slotMap.Key);
if (slotIndex == -1) throw new Exception("Slot not found: " + slotMap.Key);
foreach (KeyValuePair<String, Object> timelineMap in (Dictionary<String, Object>)slotMap.Value) {
var values = (List<Object>)timelineMap.Value;
VertexAttachment attachment = (VertexAttachment)skin.GetAttachment(slotIndex, timelineMap.Key);
if (attachment == null) throw new Exception("Deform attachment not found: " + timelineMap.Key);
bool weighted = attachment.bones != null;
float[] vertices = attachment.vertices;
int deformLength = weighted ? vertices.Length / 3 * 2 : vertices.Length;
var timeline = new DeformTimeline(values.Count);
timeline.slotIndex = slotIndex;
timeline.attachment = attachment;
int frameIndex = 0;
foreach (Dictionary<String, Object> valueMap in values) {
float[] deform;
if (!valueMap.ContainsKey("vertices")) {
deform = weighted ? new float[deformLength] : vertices;
} else {
deform = new float[deformLength];
int start = GetInt(valueMap, "offset", 0);
float[] verticesValue = GetFloatArray(valueMap, "vertices", 1);
Array.Copy(verticesValue, 0, deform, start, verticesValue.Length);
if (scale != 1) {
for (int i = start, n = i + verticesValue.Length; i < n; i++)
deform[i] *= scale;
}
if (!weighted) {
for (int i = 0; i < deformLength; i++)
示例4: ReadSkeletonData
//.........这里部分代码省略.........
transformConstraintData.translateMix = GetFloat(transformMap, "translateMix", 1);
transformConstraintData.scaleMix = GetFloat(transformMap, "scaleMix", 1);
transformConstraintData.shearMix = GetFloat(transformMap, "shearMix", 1);
skeletonData.transformConstraints.Add(transformConstraintData);
}
}
// Slots.
if (root.ContainsKey("slots")) {
foreach (Dictionary<String, Object> slotMap in (List<Object>)root["slots"]) {
var slotName = (String)slotMap["name"];
var boneName = (String)slotMap["bone"];
BoneData boneData = skeletonData.FindBone(boneName);
if (boneData == null)
throw new Exception("Slot bone not found: " + boneName);
var slotData = new SlotData(slotName, boneData);
if (slotMap.ContainsKey("color")) {
var color = (String)slotMap["color"];
slotData.r = ToColor(color, 0);
slotData.g = ToColor(color, 1);
slotData.b = ToColor(color, 2);
slotData.a = ToColor(color, 3);
}
if (slotMap.ContainsKey("attachment"))
slotData.attachmentName = (String)slotMap["attachment"];
if (slotMap.ContainsKey("blend"))
slotData.blendMode = (BlendMode)Enum.Parse(typeof(BlendMode), (String)slotMap["blend"], false);
else
slotData.blendMode = BlendMode.normal;
skeletonData.slots.Add(slotData);
}
}
// Skins.
if (root.ContainsKey("skins")) {
foreach (KeyValuePair<String, Object> entry in (Dictionary<String, Object>)root["skins"]) {
var skin = new Skin(entry.Key);
foreach (KeyValuePair<String, Object> slotEntry in (Dictionary<String, Object>)entry.Value) {
int slotIndex = skeletonData.FindSlotIndex(slotEntry.Key);
foreach (KeyValuePair<String, Object> attachmentEntry in ((Dictionary<String, Object>)slotEntry.Value)) {
Attachment attachment = ReadAttachment(skin, slotIndex, attachmentEntry.Key, (Dictionary<String, Object>)attachmentEntry.Value);
if (attachment != null) skin.AddAttachment(slotIndex, attachmentEntry.Key, attachment);
}
}
skeletonData.skins.Add(skin);
if (skin.name == "default")
skeletonData.defaultSkin = skin;
}
}
// Linked meshes.
for (int i = 0, n = linkedMeshes.Count; i < n; i++) {
LinkedMesh linkedMesh = linkedMeshes[i];
Skin skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.FindSkin(linkedMesh.skin);
if (skin == null) throw new Exception("Slot not found: " + linkedMesh.skin);
Attachment parent = skin.GetAttachment(linkedMesh.slotIndex, linkedMesh.parent);
if (parent == null) throw new Exception("Parent mesh not found: " + linkedMesh.parent);
if (linkedMesh.mesh is MeshAttachment) {
MeshAttachment mesh = (MeshAttachment)linkedMesh.mesh;
mesh.ParentMesh = (MeshAttachment)parent;
mesh.UpdateUVs();
} else {
WeightedMeshAttachment mesh = (WeightedMeshAttachment)linkedMesh.mesh;
mesh.ParentMesh = (WeightedMeshAttachment)parent;
mesh.UpdateUVs();
}
}
linkedMeshes.Clear();
// Events.
if (root.ContainsKey("events")) {
foreach (KeyValuePair<String, Object> entry in (Dictionary<String, Object>)root["events"]) {
var entryMap = (Dictionary<String, Object>)entry.Value;
var eventData = new EventData(entry.Key);
eventData.Int = GetInt(entryMap, "int", 0);
eventData.Float = GetFloat(entryMap, "float", 0);
eventData.String = GetString(entryMap, "string", null);
skeletonData.events.Add(eventData);
}
}
// Animations.
if (root.ContainsKey("animations")) {
foreach (KeyValuePair<String, Object> entry in (Dictionary<String, Object>)root["animations"])
ReadAnimation(entry.Key, (Dictionary<String, Object>)entry.Value, skeletonData);
}
skeletonData.bones.TrimExcess();
skeletonData.slots.TrimExcess();
skeletonData.skins.TrimExcess();
skeletonData.events.TrimExcess();
skeletonData.animations.TrimExcess();
skeletonData.ikConstraints.TrimExcess();
return skeletonData;
}
示例5: ReadSkeletonData
//.........这里部分代码省略.........
skeletonData.slots.Add(slotData);
}
// IK constraints.
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
IkConstraintData data = new IkConstraintData(ReadString(input));
data.order = ReadVarint(input, true);
for (int ii = 0, nn = ReadVarint(input, true); ii < nn; ii++)
data.bones.Add(skeletonData.bones.Items[ReadVarint(input, true)]);
data.target = skeletonData.bones.Items[ReadVarint(input, true)];
data.mix = ReadFloat(input);
data.bendDirection = ReadSByte(input);
skeletonData.ikConstraints.Add(data);
}
// Transform constraints.
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
TransformConstraintData data = new TransformConstraintData(ReadString(input));
data.order = ReadVarint(input, true);
for (int ii = 0, nn = ReadVarint(input, true); ii < nn; ii++)
data.bones.Add(skeletonData.bones.Items[ReadVarint(input, true)]);
data.target = skeletonData.bones.Items[ReadVarint(input, true)];
data.offsetRotation = ReadFloat(input);
data.offsetX = ReadFloat(input) * scale;
data.offsetY = ReadFloat(input) * scale;
data.offsetScaleX = ReadFloat(input);
data.offsetScaleY = ReadFloat(input);
data.offsetShearY = ReadFloat(input);
data.rotateMix = ReadFloat(input);
data.translateMix = ReadFloat(input);
data.scaleMix = ReadFloat(input);
data.shearMix = ReadFloat(input);
skeletonData.transformConstraints.Add(data);
}
// Path constraints
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
PathConstraintData data = new PathConstraintData(ReadString(input));
data.order = ReadVarint(input, true);
for (int ii = 0, nn = ReadVarint(input, true); ii < nn; ii++)
data.bones.Add(skeletonData.bones.Items[ReadVarint(input, true)]);
data.target = skeletonData.slots.Items[ReadVarint(input, true)];
data.positionMode = (PositionMode)Enum.GetValues(typeof(PositionMode)).GetValue(ReadVarint(input, true));
data.spacingMode = (SpacingMode)Enum.GetValues(typeof(SpacingMode)).GetValue(ReadVarint(input, true));
data.rotateMode = (RotateMode)Enum.GetValues(typeof(RotateMode)).GetValue(ReadVarint(input, true));
data.offsetRotation = ReadFloat(input);
data.position = ReadFloat(input);
if (data.positionMode == PositionMode.Fixed) data.position *= scale;
data.spacing = ReadFloat(input);
if (data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed) data.spacing *= scale;
data.rotateMix = ReadFloat(input);
data.translateMix = ReadFloat(input);
skeletonData.pathConstraints.Add(data);
}
// Default skin.
Skin defaultSkin = ReadSkin(input, "default", nonessential);
if (defaultSkin != null) {
skeletonData.defaultSkin = defaultSkin;
skeletonData.skins.Add(defaultSkin);
}
// Skins.
for (int i = 0, n = ReadVarint(input, true); i < n; i++)
skeletonData.skins.Add(ReadSkin(input, ReadString(input), nonessential));
// Linked meshes.
for (int i = 0, n = linkedMeshes.Count; i < n; i++) {
SkeletonJson.LinkedMesh linkedMesh = linkedMeshes[i];
Skin skin = linkedMesh.skin == null ? skeletonData.DefaultSkin : skeletonData.FindSkin(linkedMesh.skin);
if (skin == null) throw new Exception("Skin not found: " + linkedMesh.skin);
Attachment parent = skin.GetAttachment(linkedMesh.slotIndex, linkedMesh.parent);
if (parent == null) throw new Exception("Parent mesh not found: " + linkedMesh.parent);
linkedMesh.mesh.ParentMesh = (MeshAttachment)parent;
linkedMesh.mesh.UpdateUVs();
}
linkedMeshes.Clear();
// Events.
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
EventData data = new EventData(ReadString(input));
data.Int = ReadVarint(input, false);
data.Float = ReadFloat(input);
data.String = ReadString(input);
skeletonData.events.Add(data);
}
// Animations.
for (int i = 0, n = ReadVarint(input, true); i < n; i++)
ReadAnimation(ReadString(input), input, skeletonData);
skeletonData.bones.TrimExcess();
skeletonData.slots.TrimExcess();
skeletonData.skins.TrimExcess();
skeletonData.events.TrimExcess();
skeletonData.animations.TrimExcess();
skeletonData.ikConstraints.TrimExcess();
skeletonData.pathConstraints.TrimExcess();
return skeletonData;
}
示例6: ReadSkeletonData
public SkeletonData ReadSkeletonData (Stream input) {
if (input == null) throw new ArgumentNullException("input");
float scale = Scale;
var skeletonData = new SkeletonData();
skeletonData.hash = ReadString(input);
if (skeletonData.hash.Length == 0) skeletonData.hash = null;
skeletonData.version = ReadString(input);
if (skeletonData.version.Length == 0) skeletonData.version = null;
skeletonData.width = ReadFloat(input);
skeletonData.height = ReadFloat(input);
bool nonessential = ReadBoolean(input);
if (nonessential) {
skeletonData.imagesPath = ReadString(input);
if (skeletonData.imagesPath.Length == 0) skeletonData.imagesPath = null;
}
// Bones.
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
String name = ReadString(input);
BoneData parent = i == 0 ? null : skeletonData.bones.Items[ReadVarint(input, true)];
BoneData boneData = new BoneData(name, parent);
boneData.x = ReadFloat(input) * scale;
boneData.y = ReadFloat(input) * scale;
boneData.scaleX = ReadFloat(input);
boneData.scaleY = ReadFloat(input);
boneData.rotation = ReadFloat(input);
boneData.length = ReadFloat(input) * scale;
boneData.inheritScale = ReadBoolean(input);
boneData.inheritRotation = ReadBoolean(input);
if (nonessential) ReadInt(input); // Skip bone color.
skeletonData.bones.Add(boneData);
}
// IK constraints.
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
IkConstraintData ikConstraintData = new IkConstraintData(ReadString(input));
for (int ii = 0, nn = ReadVarint(input, true); ii < nn; ii++)
ikConstraintData.bones.Add(skeletonData.bones.Items[ReadVarint(input, true)]);
ikConstraintData.target = skeletonData.bones.Items[ReadVarint(input, true)];
ikConstraintData.mix = ReadFloat(input);
ikConstraintData.bendDirection = ReadSByte(input);
skeletonData.ikConstraints.Add(ikConstraintData);
}
// Transform constraints.
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
TransformConstraintData transformConstraintData = new TransformConstraintData(ReadString(input));
transformConstraintData.bone = skeletonData.bones.Items[ReadVarint(input, true)];
transformConstraintData.target = skeletonData.bones.Items[ReadVarint(input, true)];
transformConstraintData.translateMix = ReadFloat(input);
transformConstraintData.x = ReadFloat(input) * scale;
transformConstraintData.y = ReadFloat(input) * scale;
skeletonData.transformConstraints.Add(transformConstraintData);
}
// Slots.
for (int i = 0, n = ReadVarint(input, true); i < n; i++) {
String slotName = ReadString(input);
BoneData boneData = skeletonData.bones.Items[ReadVarint(input, true)];
SlotData slotData = new SlotData(slotName, boneData);
int color = ReadInt(input);
slotData.r = ((color & 0xff000000) >> 24) / 255f;
slotData.g = ((color & 0x00ff0000) >> 16) / 255f;
slotData.b = ((color & 0x0000ff00) >> 8) / 255f;
slotData.a = ((color & 0x000000ff)) / 255f;
slotData.attachmentName = ReadString(input);
slotData.blendMode = (BlendMode)ReadVarint(input, true);
skeletonData.slots.Add(slotData);
}
// Default skin.
Skin defaultSkin = ReadSkin(input, "default", nonessential);
if (defaultSkin != null) {
skeletonData.defaultSkin = defaultSkin;
skeletonData.skins.Add(defaultSkin);
}
// Skins.
for (int i = 0, n = ReadVarint(input, true); i < n; i++)
skeletonData.skins.Add(ReadSkin(input, ReadString(input), nonessential));
// Linked meshes.
for (int i = 0, n = linkedMeshes.Count; i < n; i++) {
SkeletonJson.LinkedMesh linkedMesh = linkedMeshes[i];
Skin skin = linkedMesh.skin == null ? skeletonData.DefaultSkin : skeletonData.FindSkin(linkedMesh.skin);
if (skin == null) throw new Exception("Skin not found: " + linkedMesh.skin);
Attachment parent = skin.GetAttachment(linkedMesh.slotIndex, linkedMesh.parent);
if (parent == null) throw new Exception("Parent mesh not found: " + linkedMesh.parent);
if (linkedMesh.mesh is MeshAttachment) {
MeshAttachment mesh = (MeshAttachment)linkedMesh.mesh;
mesh.ParentMesh = (MeshAttachment)parent;
mesh.UpdateUVs();
} else {
WeightedMeshAttachment mesh = (WeightedMeshAttachment)linkedMesh.mesh;
mesh.ParentMesh = (WeightedMeshAttachment)parent;
mesh.UpdateUVs();
}
//.........这里部分代码省略.........