virtual internal void OnDeserialized() { GuiTransform.EnsureDefaultValues(); FpHandTransform.EnsureDefaultValues(); TpHandTransform.EnsureDefaultValues(); if (TpOffHandTransform == null) { TpOffHandTransform = TpHandTransform.Clone(); } TpOffHandTransform.EnsureDefaultValues(); GroundTransform.EnsureDefaultValues(); if (Texture != null) { if (Textures == null) { Textures = new Dictionary <string, CompositeTexture>(1); } Textures["all"] = Texture; } if (HeldOldTpIdleAnimation != null && HeldRightTpIdleAnimation == null) { HeldRightTpIdleAnimation = HeldOldTpIdleAnimation; } }
private static ModelTransform GetTransform(JsonObject json, ModelTransform baseTransform) { var trans = baseTransform.Clone(); if (TryGetVec3f(json, "translation", out var t)) { trans.Translation = t; } if (TryGetVec3f(json, "rotation", out var r)) { trans.Rotation = r; } if (TryGetVec3f(json, "origin", out var o)) { trans.Origin = o; } // Try to get scale both as a Vec3f and single float - for compatibility reasons. if (TryGetVec3f(json, "scale", out var sv)) { trans.ScaleXYZ = sv; } if (TryGetFloat(json, "scale", out var sf)) { trans.ScaleXYZ = new Vec3f(sf, sf, sf); } return(trans); }