1. 创建unity项目

error:

error CS0006: Metadata file 'Library/PackageCache/com.unity.collab-proxy@2.8.2/Lib/Editor/PlasticSCM/log4netPlastic.dll' could not be found


error CS0006: Metadata file 'Library/PackageCache/com.unity.collab-proxy@2.8.2/Lib/Editor/PlasticSCM/Unity.Plastic.Antlr3.Runtime.dll' could not be found


error CS0006: Metadata file 'Library/PackageCache/com.unity.collab-proxy@2.8.2/Lib/Editor/PlasticSCM/Unity.Plastic.Newtonsoft.Json.dll' could not be found

删除项目文件夹下的library,然后重新打开项目,解决错误

2. 根据文本生成动画代码

AnimationClipFromCSV.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEngine;
using Newtonsoft.Json.Linq;
using System.Text;
using static System.Net.Mime.MediaTypeNames;//[RequireComponent(typeof(Animation))]
public class AnimationClipFromCSV : MonoBehaviour
{AnimationClip animationClip;public List<List<string>> data;public List<LineData> fileData;private Regex fieldPattern = new Regex("(?:^|,)(\"(?:[^\"]+|\"\")*\"|[^,]*)");private Dictionary<string, string> field_mapping = new Dictionary<string, string>();public List<string> curve_names;public List<string> root_motion_curve_names;private int num_curves_on_single_joint;private int num_curves_root_motion;// legacyprivate int num_keys = 10; //number of keys to keep *in addition to* the initial keyprivate int num_meta_columns = 3;private string inputPath = "C:\\Bill\\temp/whale_excited2.txt";private string outputPath;private GameObject joint_hierarchy_root;[TextArea(10, 30)]private string object_JSON;private Animation anim;private string clip_name;//public GameObject obj;//public GameObject root_obj;void Awake(){num_curves_on_single_joint = curve_names.Count;num_curves_root_motion = root_motion_curve_names.Count;//anim = GetComponent<Animation>();define animation curve//animationClip = new AnimationClip();set animation clip to be legacy//animationClip.legacy = true;//ConfigurateAnimationCurvesTxt();post-processing for visual quality//animationClip.EnsureQuaternionContinuity();add clip to the animator//anim.AddClip(animationClip, clip_name);play it on loop//AnimationState state = anim[clip_name];//state.wrapMode = WrapMode.Loop;//anim.Play(clip_name);}List<LineData> ParseTxtFileToData(string animation_txt){List<LineData> data = new List<LineData>();string[] lines = animation_txt.Split('\n');// the first line is root motionstring root_motion_line = lines[0];data.Add(ParseRootMotionData(RemoveWhiteSpaces(root_motion_line)));// other animation curvesfor (int i = 1; i < lines.Length; i++){string line = lines[i];//data.Add(ParseString(line));data.Add(ParseString(RemoveWhiteSpaces(line)));}return data;}public AnimationClip GetClipFromTxt(string animation_txt){AnimationClip clip = new AnimationClip();clip.legacy = true;List<LineData> animation_data = ParseTxtFileToData(animation_txt);the first data is root motion//LineData root_motion_data = animation_data[0];//List<AnimationCurve> root_motion_curves = new List<AnimationCurve>();//string root_name = root_motion_data.name;//List<float[]> root_values = root_motion_data.values;//for (int k = 0; k < num_curves_root_motion; k++)//{//    AnimationCurve new_curve = new AnimationCurve();//    root_motion_curves.Add(new_curve);//}//for (int j = 0; j < root_values.Count; j++) // loop over keys at different times//{//    float[] key_values = root_values[j];//    for (int k = 0; k < num_curves_root_motion; k++) // loop over property curves//    {//        float key_time = key_values[0];//        float key_value = key_values[k + 1];//        root_motion_curves[k].AddKey(key_time, key_value);//        //print(root_name);//        //print(key_time);//        //print(key_value);//    }//}//for (int k = 0; k < num_curves_root_motion; k++)//{//    clip.SetCurve(root_name, typeof(Transform), root_motion_curve_names[k], root_motion_curves[k]);//}// other animation curvesfor (int i = 0; i < animation_data.Count; i++) // loop through gameObjects (different joints){LineData row = animation_data[i];string obj_name = row.name.Trim();List<float[]> values = row.values;// the same GO has many animation curvesList<AnimationCurve> ani_curves = new List<AnimationCurve>();int num_curves = (i == 0 ? num_curves_root_motion : num_curves_on_single_joint);List<string> property_curve_names = (i == 0 ? root_motion_curve_names : curve_names);for (int k = 0; k < num_curves; k++) // create all animation curves for this GO (ex: rotation in x,y,z){AnimationCurve new_curve = new AnimationCurve();ani_curves.Add(new_curve);}for (int j = 0; j < values.Count; j++) // loop over keys at different times{float[] key_values = values[j];for (int k = 0; k < num_curves; k++) // loop over property curves{//print(key_values.Length);float key_time = key_values[0];float key_value = key_values[k + 1];ani_curves[k].AddKey(key_time, key_value);}}for (int k = 0; k < num_curves; k++) // create all animation curves for this GO (ex: rotation in x,y,z){clip.SetCurve(obj_name, typeof(Transform), property_curve_names[k], ani_curves[k]); // first entry is GO name}}return clip;}A class to represent a node in the scene hierarchy//[System.Serializable]//public class ObjectNode//{//    public string name; // The name of the gameObject//    public string position;//    //public string scale;//    //public string rotation;//    public List<ObjectNode> children; // The list of child nodes//    // A constructor that takes a gameObject and recursively creates child nodes//    public ObjectNode(GameObject gameObject)//    {//        name = gameObject.name;//        position = gameObject.transform.localPosition.ToString("F4");//        //scale = gameObject.transform.localScale.ToString("F1");//        //rotation = gameObject.transform.rotation.ToString("F1");//        // recurse on its children//        children = new List<ObjectNode>();//        foreach (Transform child in gameObject.transform)//        {//            children.Add(new ObjectNode(child.gameObject));//        }//    }//}public string RemoveQuotesAndSpacesIgnoringSummary(string input){string pattern = @"Summary.*\n";var matches = Regex.Matches(input, pattern);// Use a string builder to append the matched parts and remove the quotes, spaces, and new lines from the restvar output = new StringBuilder();// Keep track of the last index of the matched partint lastIndex = 0;// Loop through the matchesforeach (Match match in matches){//print (match.Value);// Remove the quotes, spaces, and new lines from the substring before the matchoutput.Append(Regex.Replace(input.Substring(lastIndex, match.Index - lastIndex), @"[""\s]", ""));// Append the matched part, remove the new line at the end.output.Append(match.Value.Remove(match.Value.Length - 1, 1));//output.Append(match.Value);// Update the last indexlastIndex = match.Index + match.Length;}// Remove the quotes, spaces, and new lines from the remaining substringoutput.Append(Regex.Replace(input.Substring(lastIndex), @"[""\s]", ""));// Return the output stringreturn output.ToString();}public string RemoveEmptyChildren(string json){// Use regular expressions to match the patterns and replace them with empty strings or "}"string output = Regex.Replace(json, @",children:\[\]", "");return output;}public string RemoveBracesFromString(string input){// If the input is null or empty, return it as it isif (string.IsNullOrEmpty(input)){return input;}// Use a StringBuilder to store the output without bracesStringBuilder output = new StringBuilder();// Loop through each character in the inputforeach (char c in input){// If the character is not a brace, append it to the outputif (c != '{' && c != '}'){output.Append(c);}}// Return the output as a stringreturn output.ToString();}string GetRelativeGOName(GameObject obj, GameObject root_obj){string name = "";while (obj.transform.parent != null && obj != root_obj) {name = obj.name + "/" + name;obj = obj.transform.parent.gameObject;}// remove the last "/"name = name.Remove(name.Length-1, 1);return name;}void ProcessCSVFiles(){char separator = ',';string[] keepNames = { "Name", "ParentName", "HierarchyIndex" };// The substring to check for rotation columnsstring rotationSubstring = "Rotation";// Read the input file as an array of linesstring[] lines = File.ReadAllLines(inputPath);// Assume the first line is the header and split it by the separatorstring[] header = lines[0].Split(separator);// trim names with white spacesheader = header.Select(p => p.Trim()).ToArray();// Find the indices of the columns to keep by checking the names and the substringint[] keepIndices = header.Select((name, index) => new { name, index }).Where(x => keepNames.Contains(x.name) || x.name.Contains(rotationSubstring)).Select(x => x.index).ToArray();// downsample the frames//int startIdx = GetFirstSubstringIdx(header, rotationSubstring);//int endIdx = GetEndSubstringIdx(header, rotationSubstring);keepIndices = DownsampleFrames(keepIndices);// Create a new array of lines for the output filestring[] outputLines = new string[lines.Length];// For each line, keep only the values at the keep indices and join them by the separatorfor (int i = 0; i < lines.Length; i++){string[] values = lines[i].Split(separator);string[] outputValues = keepIndices.Select(index => values[index]).ToArray();outputLines[i] = string.Join(separator.ToString(), outputValues);}// Write the output lines to the output fileFile.WriteAllLines(outputPath, outputLines);}int[] DownsampleFrames(int[] indices){Calculate the interval to skip rotations//int interval = indices.Length / num_curves_on_single_joint / num_keys;Create a list to store the selected rotations//List<int> selected = new List<int>();Loop through the indices and add every interval-th rotation to the list//for (int i = num_meta_columns; i < indices.Length; i += num_curves_on_single_joint)//{//    if ((i-num_meta_columns) % (interval * num_curves_on_single_joint) == 0)//    {//        for (int j = 0; j < num_curves_on_single_joint; j++)//        {//            selected.Add(indices[i + j]);//        }//    }//}//return selected.ToArray();// Copy the first four elements (name, parent name, hier, and first rotation)List<int> idx_list = new List<int>(indices);List<int> output = new List<int>(idx_list.GetRange(0, num_meta_columns+1));// Calculate the interval between rotations to keepint interval = (idx_list.Count - num_meta_columns-1) / (num_curves_on_single_joint * num_keys);// Loop through the remaining rotations and add them to the output if they match the intervalfor (int i = num_meta_columns+1; i < idx_list.Count; i += num_curves_on_single_joint){if ((i - num_meta_columns-1) % (interval * num_curves_on_single_joint) == 0){output.AddRange(idx_list.GetRange(i, num_curves_on_single_joint-1));}}return output.ToArray();}int GetFirstSubstringIdx(string[] str_list, string sub_string){for (int i = 0; i < str_list.Length; i++){string s = str_list[i]; // Check if the current string contains "Rotation" as a substringif (s.Contains(sub_string)){// If yes, assign it to the result variable and break the loopreturn i;}}return -1;}void ConfigurateAnimationCurvesTxt(){ParseTxtFile();for (int i = 0; i < fileData.Count; i++) // loop through gameObjects (different joints){LineData row = fileData[i];string obj_name = row.name;List<float[]> values = row.values;// the same GO has many animation curvesList<AnimationCurve> ani_curves = new List<AnimationCurve>();for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){AnimationCurve new_curve = new AnimationCurve();ani_curves.Add(new_curve);}for (int j = 0; j < values.Count; j++) // loop over keys at different times{ float[] key_values = values[j];for (int k = 0; k < num_curves_on_single_joint; k++) // loop over property curves{float key_time = key_values[0];float key_value = key_values[k+1];ani_curves[k].AddKey(key_time, key_value);}}for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){//animationClip.SetCurve("", typeof(Transform), row[0], ani_curves[k]); // first entry is GO nameanimationClip.SetCurve(obj_name, typeof(Transform), curve_names[k], ani_curves[k]); // first entry is GO name}}}void ConfigurateAnimationCurves(){ParseCSV(inputPath);// loop through gameObjects (different joints)for (int i = 0; i < data.Count; i++) {List<string> row = data[i];// the same GO has many animation curves//Dictionary<string, AnimationCurve> ani_curves = new Dictionary<string, AnimationCurve>();List<AnimationCurve> ani_curves = new List<AnimationCurve>();for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){AnimationCurve new_curve = new AnimationCurve();ani_curves.Add(new_curve);}// loop through different frames for the same GO// skip the first few columns, which are metadataint j = num_meta_columns;while (j < row.Count - num_curves_on_single_joint){// assume the first entry in each block is the timefloat time_stamp = 0f;float.TryParse(row[j], out time_stamp);for (int k = 0; k < num_curves_on_single_joint; k++){float animation_key_value = 0f;float.TryParse(row[j + k], out animation_key_value);ani_curves[k].AddKey(time_stamp, animation_key_value);}j += num_curves_on_single_joint;}for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){//animationClip.SetCurve("", typeof(Transform), row[0], ani_curves[k]); // first entry is GO nameanimationClip.SetCurve(row[0], typeof(Transform), curve_names[k], ani_curves[k]); // first entry is GO name}}}void ConfigurateAnimationCurvesExample(){//AnimationCurve translateX = AnimationCurve.Linear(0.0f, 0.0f, 2.0f, 2.0f);AnimationCurve translateX = new AnimationCurve();translateX.AddKey(0f, 0f);translateX.AddKey(2f, 2f);translateX.AddKey(3f, -2f);animationClip.SetCurve("", typeof(Transform), "localPosition.x", translateX);}public string RemoveWhiteSpaces(string json){// Use a regular expression to match and replace any sequence of white space charactersreturn Regex.Replace(json, @"\s+", "");}public class LineData{public string name; // The first elementpublic List<float[]> values; // The rest of the elements as float arrayspublic LineData(string name, List<float[]> values){this.name = name;this.values = values;}}void ParseTxtFile(){fileData = new List<LineData>();using (StreamReader reader = new StreamReader(inputPath)){string line;while ((line = reader.ReadLine()) != null){// Split the line by commasfileData.Add(ParseString(line));}}}// A method to parse a single stringpublic LineData ParseString(string input){// Split the string by the first (, assuming it is the separator between the name and the valuesstring[] split = input.Split(new char[] { '(' }, 2);// If the split length is not 2, the input is invalidif (split.Length != 2){Debug.LogError("Invalid input: " + input);return null;}// Store the name as the first element of the splitstring name = split[0].TrimEnd(',');// Trim the trailing ) from the second element of the splitchar[] charsToTrim = { ')', ' ', '\n' };string valuesString = split[1].Trim().TrimEnd(charsToTrim);//foreach(char c in valuesString.ToCharArray()) { print(c); }// Split the values string by ),(, assuming they are the separators between the value groupsstring[] valueGroups = valuesString.Split(new string[] { "),(" }, StringSplitOptions.None);// Create a list to store the float arraysList<float[]> values = new List<float[]>();// Loop through each value groupforeach (string valueGroup in valueGroups){// Split the value group by ,, assuming they are the separators between the float valuesstring[] valueStrings = valueGroup.Split(',');// Create a float array to store the parsed valuesfloat[] valueArray = new float[valueStrings.Length];// Loop through each value stringfor (int i = 0; i < valueStrings.Length; i++){// Try to parse the value string as a float and store it in the array// If the parsing fails, log an error and return nullif (!float.TryParse(valueStrings[i], out valueArray[i])){Debug.LogError("Invalid value: " + valueStrings[i]);return null;}}//foreach(var v in valueArray) { print(v); }// Add the float array to the listvalues.Add(valueArray);}// Create and return a ParsedData object with the name and the valuesreturn new LineData(name, values);}// A method to parse multiple strings and store them in the listpublic void ParseStrings(string[] inputs){// Clear the listfileData.Clear();// Loop through each input stringforeach (string input in inputs){// Parse the string and add the result to the listLineData parsedData = ParseString(input);if (parsedData != null){fileData.Add(parsedData);}}}public LineData ParseRootMotionData(string input){// Split the string by the first (, assuming it is the separator between the name and the valuesstring[] split = input.Split(new char[] { '[' }, 2);// If the split length is not 2, the input is invalidif (split.Length != 2){Debug.LogError("Invalid input: " + input);return null;}// Store the name as the first element of the splitstring name = split[0].TrimEnd(',');// Trim the trailing ) from the second element of the splitchar[] charsToTrim = { ']', ' ', '\n' };string valuesString = split[1].Trim().TrimEnd(charsToTrim);//foreach(char c in valuesString.ToCharArray()) { print(c); }// Split the values string by ),(, assuming they are the separators between the value groupsstring[] valueGroups = valuesString.Split(new string[] { "],[" }, StringSplitOptions.None);// Create a list to store the float arraysList<float[]> values = new List<float[]>();// Loop through each value groupforeach (string valueGroup in valueGroups){// Split the value group by ,, assuming they are the separators between the float valuesstring[] valueStrings = valueGroup.Split(',');// Create a float array to store the parsed valuesfloat[] valueArray = new float[valueStrings.Length];// Loop through each value stringfor (int i = 0; i < valueStrings.Length; i++){// Try to parse the value string as a float and store it in the array// If the parsing fails, log an error and return nullif (!float.TryParse(valueStrings[i], out valueArray[i])){Debug.LogError("Invalid value: " + valueStrings[i]);return null;}}//foreach(var v in valueArray) { print(v); }// Add the float array to the listvalues.Add(valueArray);}// Create and return a ParsedData object with the name and the valuesreturn new LineData(name, values);}void ParseTxt(){// Initialize the file data listfileData = new List<LineData>();// Read the text file line by lineusing (StreamReader reader = new StreamReader(inputPath)){string line;while ((line = reader.ReadLine()) != null){// Split the line by commasstring[] elements = line.Split(',');// The first element is the namestring name = elements[0];// The rest of the elements are float arraysList<float[]> values = new List<float[]>();for (int i = 1; i < elements.Length; i++){// Remove the parentheses and split by spacesstring[] numbers = elements[i].Trim('(', ')').Split(' ');//print(string.Join(", ", numbers));// Parse the numbers as floats and store them in an arrayfloat[] value = new float[numbers.Length];for (int j = 0; j < numbers.Length; j++){value[j] = float.Parse(numbers[j]);}// Add the array to the values listvalues.Add(value);}// Create a new line data object and add it to the file data listLineData lineData = new LineData(name, values);fileData.Add(lineData);}}Print the file data for testing//foreach (LineData lineData in fileData)//{//    Debug.Log("Name: " + lineData.name);//    Debug.Log("Values: ");//    foreach (float[] value in lineData.values)//    {//        Debug.Log(string.Join(", ", value));//    }//}}// A method to load and parse a CSV file from a given pathpublic void ParseCSV(string path){// Initialize the data listdata = new List<List<string>>();// Try to open the file with a stream readertry{using (StreamReader reader = new StreamReader(path)){// Read each line until the end of the filewhile (!reader.EndOfStream){// Get the current linestring line = reader.ReadLine();// Initialize a list to store the fieldsList<string> fields = new List<string>();// Match the fields with the regular expressionMatchCollection matches = fieldPattern.Matches(line);// Loop through the matchesforeach (Match match in matches){// Get the field valuestring field = match.Value;// Trim the leading and trailing commasfield = field.TrimStart(',').TrimEnd(',');// Trim the leading and trailing quotesfield = field.TrimStart('"').TrimEnd('"');// Replace any escaped quotes with single quotesfield = field.Replace("\"\"", "\"");// Add the field to the listfields.Add(field);}// Add the list of fields to the data listdata.Add(fields);}}}// Catch any exceptions and log themcatch (Exception e){Debug.LogError("Error loading CSV file: " + e.Message);}}
}

ERROR:F:\desktop\Animation\Assets\Scripts\AnimationClipFromCSV.cs(10,7): error CS0246: 未能找到类型或命名空间名“Newtonsoft”(是否缺少 using 指令或程序集引用?)

solve: 使用 Unity 的 Package Manager 安装(如果可用)    - 打开 Package Manager (Window > Package Manager)    - 点击左上角的 "+" 号,选择 "Add package from git URL..."    - 输入:`com.unity.nuget.newtonsoft-json`

3.代码仔细阅读

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEngine;
using Newtonsoft.Json.Linq;
using System.Text;
using static System.Net.Mime.MediaTypeNames;//[RequireComponent(typeof(Animation))]
public class AnimationClipFromCSV : MonoBehaviour
{AnimationClip animationClip;public List<List<string>> data;public List<LineData> fileData;private Regex fieldPattern = new Regex("(?:^|,)(\"(?:[^\"]+|\"\")*\"|[^,]*)");private Dictionary<string, string> field_mapping = new Dictionary<string, string>();public List<string> curve_names;public List<string> root_motion_curve_names;private int num_curves_on_single_joint;private int num_curves_root_motion;// legacyprivate int num_keys = 10; //number of keys to keep *in addition to* the initial keyprivate int num_meta_columns = 3;private string inputPath = "C:\\Bill\\temp/whale_excited2.txt";private string outputPath;private GameObject joint_hierarchy_root;[TextArea(10, 30)]private string object_JSON;private Animation anim;private string clip_name;//public GameObject obj;//public GameObject root_obj;void Awake(){num_curves_on_single_joint = curve_names.Count;num_curves_root_motion = root_motion_curve_names.Count;//anim = GetComponent<Animation>();define animation curve//animationClip = new AnimationClip();set animation clip to be legacy//animationClip.legacy = true;//ConfigurateAnimationCurvesTxt();post-processing for visual quality//animationClip.EnsureQuaternionContinuity();add clip to the animator//anim.AddClip(animationClip, clip_name);play it on loop//AnimationState state = anim[clip_name];//state.wrapMode = WrapMode.Loop;//anim.Play(clip_name);}List<LineData> ParseTxtFileToData(string animation_txt){List<LineData> data = new List<LineData>();string[] lines = animation_txt.Split('\n');// the first line is root motionstring root_motion_line = lines[0];data.Add(ParseRootMotionData(RemoveWhiteSpaces(root_motion_line)));// other animation curvesfor (int i = 1; i < lines.Length; i++){string line = lines[i];//data.Add(ParseString(line));data.Add(ParseString(RemoveWhiteSpaces(line)));}return data;}public AnimationClip GetClipFromTxt(string animation_txt){AnimationClip clip = new AnimationClip();// 是Unity中表示动画数据的类(包含关键帧、曲线等)clip.legacy = true;List<LineData> animation_data = ParseTxtFileToData(animation_txt);the first data is root motion//LineData root_motion_data = animation_data[0];//List<AnimationCurve> root_motion_curves = new List<AnimationCurve>();//string root_name = root_motion_data.name;//List<float[]> root_values = root_motion_data.values;//for (int k = 0; k < num_curves_root_motion; k++)//{//    AnimationCurve new_curve = new AnimationCurve();//    root_motion_curves.Add(new_curve);//}//for (int j = 0; j < root_values.Count; j++) // loop over keys at different times//{//    float[] key_values = root_values[j];//    for (int k = 0; k < num_curves_root_motion; k++) // loop over property curves//    {//        float key_time = key_values[0];//        float key_value = key_values[k + 1];//        root_motion_curves[k].AddKey(key_time, key_value);//        //print(root_name);//        //print(key_time);//        //print(key_value);//    }//}//for (int k = 0; k < num_curves_root_motion; k++)//{//    clip.SetCurve(root_name, typeof(Transform), root_motion_curve_names[k], root_motion_curves[k]);//}/*整体功能动态创建骨骼动画:解析动画数据(如BVH、FBX等格式导出的数据)为每个关节创建动画曲线(位置、旋转等)将曲线绑定到动画片段(AnimationClip)支持根运动(root motion)和普通关节的差异化处理*/// other animation curvesfor (int i = 0; i < animation_data.Count; i++) // loop through gameObjects (different joints){LineData row = animation_data[i];string obj_name = row.name.Trim();//.Trim():移除名称首尾的空白字符(空格、制表符、换行符等)List<float[]> values = row.values;// the same GO has many animation curvesList<AnimationCurve> ani_curves = new List<AnimationCurve>();//创建了一个动画曲线(AnimationCurve)的集合容器int num_curves = (i == 0 ? num_curves_root_motion : num_curves_on_single_joint);List<string> property_curve_names = (i == 0 ? root_motion_curve_names : curve_names);for (int k = 0; k < num_curves; k++) // create all animation curves for this GO (ex: rotation in x,y,z){AnimationCurve new_curve = new AnimationCurve();//创建指定数量的空动画曲线ani_curves.Add(new_curve);}// 负责将原始动画数据填充到动画曲线for (int j = 0; j < values.Count; j++) // loop over keys at different times{float[] key_values = values[j];for (int k = 0; k < num_curves; k++) // loop over property curves{//print(key_values.Length);float key_time = key_values[0];float key_value = key_values[k + 1];ani_curves[k].AddKey(key_time, key_value);}}//绑定到动画片段for (int k = 0; k < num_curves; k++) // create all animation curves for this GO (ex: rotation in x,y,z){clip.SetCurve(obj_name, typeof(Transform), property_curve_names[k], ani_curves[k]); // first entry is GO name}}return clip;}A class to represent a node in the scene hierarchy//[System.Serializable]//public class ObjectNode//{//    public string name; // The name of the gameObject//    public string position;//    //public string scale;//    //public string rotation;//    public List<ObjectNode> children; // The list of child nodes//    // A constructor that takes a gameObject and recursively creates child nodes//    public ObjectNode(GameObject gameObject)//    {//        name = gameObject.name;//        position = gameObject.transform.localPosition.ToString("F4");//        //scale = gameObject.transform.localScale.ToString("F1");//        //rotation = gameObject.transform.rotation.ToString("F1");//        // recurse on its children//        children = new List<ObjectNode>();//        foreach (Transform child in gameObject.transform)//        {//            children.Add(new ObjectNode(child.gameObject));//        }//    }//}//用于处理特殊格式的文本,保留"Summary"段落内容的同时移除其他部分的引号、空格和换行符public string RemoveQuotesAndSpacesIgnoringSummary(string input){// 匹配所有"Summary"开头的段落(包括结尾换行符)string pattern = @"Summary.*\n";var matches = Regex.Matches(input, pattern);// Use a string builder to append the matched parts and remove the quotes, spaces, and new lines from the restvar output = new StringBuilder();// Keep track of the last index of the matched partint lastIndex = 0;// Loop through the matchesforeach (Match match in matches){//处理Summary之前的内容:移除引号、空格和换行符//print (match.Value);// Remove the quotes, spaces, and new lines from the substring before the matchoutput.Append(Regex.Replace(input.Substring(lastIndex, match.Index - lastIndex), @"[""\s]", ""));// 保留Summary内容,但移除结尾换行符// Append the matched part, remove the new line at the end.output.Append(match.Value.Remove(match.Value.Length - 1, 1));//output.Append(match.Value);// Update the last indexlastIndex = match.Index + match.Length;}// 处理最后一个Summary之后的内容// Remove the quotes, spaces, and new lines from the remaining substringoutput.Append(Regex.Replace(input.Substring(lastIndex), @"[""\s]", ""));// Return the output stringreturn output.ToString();}public string RemoveEmptyChildren(string json)//移除 JSON 字符串中空的 children 数组{// Use regular expressions to match the patterns and replace them with empty strings or "}"string output = Regex.Replace(json, @",children:\[\]", "");return output;}public string RemoveBracesFromString(string input) //移除输入字符串中的所有花括号({ 和 }),返回处理后的字符串{// If the input is null or empty, return it as it isif (string.IsNullOrEmpty(input)){return input;}// Use a StringBuilder to store the output without bracesStringBuilder output = new StringBuilder();// Loop through each character in the inputforeach (char c in input){// If the character is not a brace, append it to the outputif (c != '{' && c != '}'){output.Append(c);}}// Return the output as a stringreturn output.ToString();}string GetRelativeGOName(GameObject obj, GameObject root_obj)//获取一个 GameObject 相对于另一个 root_obj 的层级路径(用 / 分隔){string name = "";while (obj.transform.parent != null && obj != root_obj){name = obj.name + "/" + name;obj = obj.transform.parent.gameObject;}// remove the last "/"name = name.Remove(name.Length - 1, 1);return name;}void ProcessCSVFiles(){//处理 CSV 文件,提取指定列(如 "Name", "ParentName", "HierarchyIndex" 及包含 "Rotation" 的列),//并对列进行降采样(DownsampleFrames),最后输出新 CSV 文件char separator = ',';string[] keepNames = { "Name", "ParentName", "HierarchyIndex" };// The substring to check for rotation columnsstring rotationSubstring = "Rotation";// Read the input file as an array of linesstring[] lines = File.ReadAllLines(inputPath);// Assume the first line is the header and split it by the separatorstring[] header = lines[0].Split(separator);// trim names with white spacesheader = header.Select(p => p.Trim()).ToArray();// Find the indices of the columns to keep by checking the names and the substringint[] keepIndices = header.Select((name, index) => new { name, index }).Where(x => keepNames.Contains(x.name) || x.name.Contains(rotationSubstring)).Select(x => x.index).ToArray();// downsample the frames//int startIdx = GetFirstSubstringIdx(header, rotationSubstring);//int endIdx = GetEndSubstringIdx(header, rotationSubstring);keepIndices = DownsampleFrames(keepIndices);// Create a new array of lines for the output filestring[] outputLines = new string[lines.Length];// For each line, keep only the values at the keep indices and join them by the separatorfor (int i = 0; i < lines.Length; i++){string[] values = lines[i].Split(separator);string[] outputValues = keepIndices.Select(index => values[index]).ToArray();outputLines[i] = string.Join(separator.ToString(), outputValues);}// Write the output lines to the output fileFile.WriteAllLines(outputPath, outputLines);}int[] DownsampleFrames(int[] indices){Calculate the interval to skip rotations//int interval = indices.Length / num_curves_on_single_joint / num_keys;Create a list to store the selected rotations//List<int> selected = new List<int>();Loop through the indices and add every interval-th rotation to the list//for (int i = num_meta_columns; i < indices.Length; i += num_curves_on_single_joint)//{//    if ((i-num_meta_columns) % (interval * num_curves_on_single_joint) == 0)//    {//        for (int j = 0; j < num_curves_on_single_joint; j++)//        {//            selected.Add(indices[i + j]);//        }//    }//}//return selected.ToArray();// Copy the first four elements (name, parent name, hier, and first rotation)List<int> idx_list = new List<int>(indices);List<int> output = new List<int>(idx_list.GetRange(0, num_meta_columns + 1));// Calculate the interval between rotations to keepint interval = (idx_list.Count - num_meta_columns - 1) / (num_curves_on_single_joint * num_keys);// Loop through the remaining rotations and add them to the output if they match the intervalfor (int i = num_meta_columns + 1; i < idx_list.Count; i += num_curves_on_single_joint){if ((i - num_meta_columns - 1) % (interval * num_curves_on_single_joint) == 0){output.AddRange(idx_list.GetRange(i, num_curves_on_single_joint - 1));}}return output.ToArray();}int GetFirstSubstringIdx(string[] str_list, string sub_string){//在字符串数组 str_list 中查找第一个包含指定子字符串 sub_string 的元素,//并返回其索引。如果未找到,返回 -1。for (int i = 0; i < str_list.Length; i++){string s = str_list[i];// Check if the current string contains "Rotation" as a substringif (s.Contains(sub_string)){// If yes, assign it to the result variable and break the loopreturn i;}}return -1;}void ConfigurateAnimationCurvesTxt(){ParseTxtFile();for (int i = 0; i < fileData.Count; i++) // loop through gameObjects (different joints){LineData row = fileData[i];string obj_name = row.name;List<float[]> values = row.values;// the same GO has many animation curvesList<AnimationCurve> ani_curves = new List<AnimationCurve>();for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){AnimationCurve new_curve = new AnimationCurve();ani_curves.Add(new_curve);}for (int j = 0; j < values.Count; j++) // loop over keys at different times{float[] key_values = values[j];for (int k = 0; k < num_curves_on_single_joint; k++) // loop over property curves{float key_time = key_values[0];float key_value = key_values[k + 1];ani_curves[k].AddKey(key_time, key_value);}}for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){//animationClip.SetCurve("", typeof(Transform), row[0], ani_curves[k]); // first entry is GO nameanimationClip.SetCurve(obj_name, typeof(Transform), curve_names[k], ani_curves[k]); // first entry is GO name}}}void ConfigurateAnimationCurves(){ParseCSV(inputPath);// loop through gameObjects (different joints)for (int i = 0; i < data.Count; i++){List<string> row = data[i];// the same GO has many animation curves//Dictionary<string, AnimationCurve> ani_curves = new Dictionary<string, AnimationCurve>();List<AnimationCurve> ani_curves = new List<AnimationCurve>();for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){AnimationCurve new_curve = new AnimationCurve();ani_curves.Add(new_curve);}// loop through different frames for the same GO// skip the first few columns, which are metadataint j = num_meta_columns;while (j < row.Count - num_curves_on_single_joint){// assume the first entry in each block is the timefloat time_stamp = 0f;float.TryParse(row[j], out time_stamp);for (int k = 0; k < num_curves_on_single_joint; k++){float animation_key_value = 0f;float.TryParse(row[j + k], out animation_key_value);ani_curves[k].AddKey(time_stamp, animation_key_value);}j += num_curves_on_single_joint;}for (int k = 0; k < num_curves_on_single_joint; k++) // create all animation curves for this GO (ex: rotation in x,y,z){//animationClip.SetCurve("", typeof(Transform), row[0], ani_curves[k]); // first entry is GO nameanimationClip.SetCurve(row[0], typeof(Transform), curve_names[k], ani_curves[k]); // first entry is GO name}}}void ConfigurateAnimationCurvesExample(){//AnimationCurve translateX = AnimationCurve.Linear(0.0f, 0.0f, 2.0f, 2.0f);AnimationCurve translateX = new AnimationCurve();translateX.AddKey(0f, 0f);translateX.AddKey(2f, 2f);translateX.AddKey(3f, -2f);animationClip.SetCurve("", typeof(Transform), "localPosition.x", translateX);}public string RemoveWhiteSpaces(string json)//该方法用于从字符串中移除所有空白字符:{// Use a regular expression to match and replace any sequence of white space charactersreturn Regex.Replace(json, @"\s+", "");}public class LineData{public string name; // The first elementpublic List<float[]> values; // The rest of the elements as float arrayspublic LineData(string name, List<float[]> values){this.name = name;this.values = values;}}void ParseTxtFile(){fileData = new List<LineData>();using (StreamReader reader = new StreamReader(inputPath)){string line;while ((line = reader.ReadLine()) != null){// Split the line by commasfileData.Add(ParseString(line));}}}// A method to parse a single stringpublic LineData ParseString(string input){// Split the string by the first (, assuming it is the separator between the name and the valuesstring[] split = input.Split(new char[] { '(' }, 2);// If the split length is not 2, the input is invalidif (split.Length != 2){Debug.LogError("Invalid input: " + input);return null;}// Store the name as the first element of the splitstring name = split[0].TrimEnd(',');// Trim the trailing ) from the second element of the splitchar[] charsToTrim = { ')', ' ', '\n' };string valuesString = split[1].Trim().TrimEnd(charsToTrim);//移除首尾所有空白字符//foreach(char c in valuesString.ToCharArray()) { print(c); }// Split the values string by ),(, assuming they are the separators between the value groupsstring[] valueGroups = valuesString.Split(new string[] { "),(" }, StringSplitOptions.None);// Create a list to store the float arraysList<float[]> values = new List<float[]>();// Loop through each value groupforeach (string valueGroup in valueGroups){// Split the value group by ,, assuming they are the separators between the float valuesstring[] valueStrings = valueGroup.Split(',');// Create a float array to store the parsed valuesfloat[] valueArray = new float[valueStrings.Length];// Loop through each value stringfor (int i = 0; i < valueStrings.Length; i++){// Try to parse the value string as a float and store it in the array// If the parsing fails, log an error and return nullif (!float.TryParse(valueStrings[i], out valueArray[i])){Debug.LogError("Invalid value: " + valueStrings[i]);return null;}}//foreach(var v in valueArray) { print(v); }// Add the float array to the listvalues.Add(valueArray);}// Create and return a ParsedData object with the name and the valuesreturn new LineData(name, values);}// A method to parse multiple strings and store them in the listpublic void ParseStrings(string[] inputs){// Clear the listfileData.Clear();// Loop through each input stringforeach (string input in inputs){// Parse the string and add the result to the listLineData parsedData = ParseString(input);if (parsedData != null){fileData.Add(parsedData);}}}public LineData ParseRootMotionData(string input){// Split the string by the first (, assuming it is the separator between the name and the valuesstring[] split = input.Split(new char[] { '[' }, 2);// 将一个字符串(`input`)按照第一个出现的左方括号字符 `[` 进行分割,并且最多分割成两个子字符// If the split length is not 2, the input is invalidif (split.Length != 2){Debug.LogError("Invalid input: " + input);return null;}// Store the name as the first element of the splitstring name = split[0].TrimEnd(',');//移除字符串 末尾的逗号(,)// Trim the trailing ) from the second element of the splitchar[] charsToTrim = { ']', ' ', '\n' }; //创建待删除字符数组,包含三个字符:string valuesString = split[1].Trim().TrimEnd(charsToTrim);//foreach(char c in valuesString.ToCharArray()) { print(c); }// Split the values string by ),(, assuming they are the separators between the value groupsstring[] valueGroups = valuesString.Split(new string[] { "],[" }, StringSplitOptions.None);//StringSplitOptions.None):确保空字符串能被识别// Create a list to store the float arraysList<float[]> values = new List<float[]>();// Loop through each value groupforeach (string valueGroup in valueGroups){// Split the value group by ,, assuming they are the separators between the float valuesstring[] valueStrings = valueGroup.Split(','); //将一个包含逗号分隔值的字符串拆分成字符串数组// Create a float array to store the parsed valuesfloat[] valueArray = new float[valueStrings.Length];// Loop through each value stringfor (int i = 0; i < valueStrings.Length; i++){// Try to parse the value string as a float and store it in the array// If the parsing fails, log an error and return nullif (!float.TryParse(valueStrings[i], out valueArray[i])){Debug.LogError("Invalid value: " + valueStrings[i]);return null;}}//foreach(var v in valueArray) { print(v); }// Add the float array to the listvalues.Add(valueArray);}// Create and return a ParsedData object with the name and the valuesreturn new LineData(name, values);}void ParseTxt(){// Initialize the file data listfileData = new List<LineData>();// Read the text file line by lineusing (StreamReader reader = new StreamReader(inputPath)){string line;while ((line = reader.ReadLine()) != null){// Split the line by commasstring[] elements = line.Split(',');// The first element is the namestring name = elements[0];// The rest of the elements are float arraysList<float[]> values = new List<float[]>();for (int i = 1; i < elements.Length; i++){// Remove the parentheses and split by spacesstring[] numbers = elements[i].Trim('(', ')').Split(' ');//print(string.Join(", ", numbers));// Parse the numbers as floats and store them in an arrayfloat[] value = new float[numbers.Length];for (int j = 0; j < numbers.Length; j++){value[j] = float.Parse(numbers[j]);}// Add the array to the values listvalues.Add(value);}// Create a new line data object and add it to the file data listLineData lineData = new LineData(name, values);fileData.Add(lineData);}}Print the file data for testing//foreach (LineData lineData in fileData)//{//    Debug.Log("Name: " + lineData.name);//    Debug.Log("Values: ");//    foreach (float[] value in lineData.values)//    {//        Debug.Log(string.Join(", ", value));//    }//}}// A method to load and parse a CSV file from a given pathpublic void ParseCSV(string path){// Initialize the data listdata = new List<List<string>>();// Try to open the file with a stream readertry{using (StreamReader reader = new StreamReader(path)){// Read each line until the end of the filewhile (!reader.EndOfStream){// Get the current linestring line = reader.ReadLine();// Initialize a list to store the fieldsList<string> fields = new List<string>();// Match the fields with the regular expressionMatchCollection matches = fieldPattern.Matches(line);// Loop through the matchesforeach (Match match in matches){// Get the field valuestring field = match.Value;// Trim the leading and trailing commasfield = field.TrimStart(',').TrimEnd(',');// Trim the leading and trailing quotesfield = field.TrimStart('"').TrimEnd('"');// Replace any escaped quotes with single quotesfield = field.Replace("\"\"", "\"");// Add the field to the listfields.Add(field);}// Add the list of fields to the data listdata.Add(fields);}}}// Catch any exceptions and log themcatch (Exception e){Debug.LogError("Error loading CSV file: " + e.Message);}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/diannao/89929.shtml
繁体地址,请注明出处:http://hk.pswp.cn/diannao/89929.shtml
英文地址,请注明出处:http://en.pswp.cn/diannao/89929.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Centos系统及国产麒麟系统设置自己写的go服务的开机启动项完整教程

1、创建服务文件 在 /etc/systemd/system/ 下新建服务配置文件&#xff08;需sudo权限&#xff09;&#xff0c;例如&#xff1a; sudo nano /etc/systemd/system/mygo.service 如下图&#xff0c;创建的mygo.service 2、创建内容如下&#xff1a; DescriptionThe go HTTP a…

Java面试宝典: IO流

1. 下面哪个流类属于面向字符的输入流() 选项: A. BufferedWriter B. FileInputStream C. ObjectInputStream D. InputStreamReader 答案:D 详细分析: 字符流与字节流的本质区别: 字符流(Character Streams)以Unicode字符为单位操作数据,适用于文本处理字节流(Byte…

黑马python(二十五)

目录&#xff1a;1.数据输出-输出为Python对象2.数据输出-输出到文件中3.综合案例1.数据输出-输出为Python对象2.数据输出-输出到文件中移动文件到文件夹&#xff1a;生成了好多文件&#xff0c;因为Rdd是有分区的 &#xff0c;会把数据分散到各个分区去存储&#xff0c;因为电…

【LeetCode 热题 100】41. 缺失的第一个正数——(解法一)暴力解

Problem: 41. 缺失的第一个正数 题目&#xff1a;给你一个未排序的整数数组 nums &#xff0c;请你找出其中没有出现的最小的正整数。 请你实现时间复杂度为 O(n) 并且只使用常数级别额外空间的解决方案。 文章目录整体思路完整代码时空复杂度时间复杂度&#xff1a;O(N log N)…

在运行 Laravel Sail 前,需安装 Docker Desktop 并完成基础配置/具体步骤

一、安装 Docker Desktop&#xff08;必备环境&#xff09; Windows 系统 &#xff08;windows安装包 有两个版本&#xff09; 架构版本查看 1. Win R‌ 输入 ‌cmd‌ 打开命令提示符&#xff1b; 2. ‌输入命令‌&#xff1a; bash echo %PROCESSOR_ARCHITECTURE% 3. ‌结果…

AI 应用于进攻性安全

一、引言 大语言模型&#xff08;LLM&#xff09;和 AI 智能体的出现推动进攻性安全变革&#xff0c;其在侦察、扫描、漏洞分析、利用、报告五个阶段展现出数据分析、代码生成、攻击场景规划等能力&#xff0c;能提升安全团队效率与扩展性&#xff0c;但存在 “幻觉” 等局限性…

微控制器中的EXTI0(External Interrupt 0)中断是什么?

微控制器中的EXTI0(External Interrupt 0)中断是什么? EXTI0(External Interrupt 0) 是微控制器(如STM32等ARM Cortex-M系列芯片)中的一个外部中断线,专门用于处理来自特定GPIO引脚的外部信号触发中断。以下是详细说明: 1. 基本概念 EXTI(External Interrupt/Event …

EasyGBS平台内置AI算法了,算法成为了视频平台的标配

今年五一的时候立了个flag&#xff08;《国标GB28181平台EasyGBS未来研发方向在哪&#xff1f;》&#xff09;&#xff0c;我想不能再局限在只是满足于传统视频平台的功能&#xff0c;传统的EasyGBS也就是接入几种视频协议&#xff0c;什么RTSP、ONVIF、RTMP、GB28181这些&…

C# 常量与变量

在 C# 中&#xff0c;常量和变量是存储数据的基本方式&#xff1a; // 常量&#xff1a;使用 const 关键字声明&#xff0c;必须在声明时初始化&#xff0c;且值不能改变 const double Pi 3.14159; const string Message "Hello, World!"; ​ // 变量&#xff1a;…

TensorRT-LLM:大模型推理加速的核心技术与实践优势

大型语言模型推理就像让一头300公斤的大熊猫玩平衡木——显存消耗和计算效率这对双胞胎问题随时可能让表演翻车。以主流的7B参数模型为例&#xff0c;FP16精度下仅模型权重就吃掉14GB显存&#xff0c;这还没算上推理过程中不断膨胀的KV Cache——当处理2048长度的对话时&#x…

免费棱光 PDF:免安装 加水印 去水印 批量格式转换

各位办公小能手们&#xff0c;今天给大家介绍一款超棒的PDF处理工具——棱光PDF&#xff01;它完全免费&#xff0c;专门解决咱对PDF文件的常见操作需求。绿色免安装&#xff0c;体积小得跟颗花生米似的&#xff0c;打开就能用。它有三大核心功能&#xff0c;分别是水印管理、格…

(二)复习(Error Pattern/Result Pattern/)

文章目录 项目地址一、Error Pattern1.1 定义Error类1. ErrorType 可发生的错误类型2. Error类3. ValidataionError1.2 给每个实体创建Error类1. CategoryError类2. TicketErrror类3. EventErrror类二、Result Pattern1.1 自定义返回Result1. 泛型类2. 泛型方法1.2 Api层的Resu…

20250705-day6

NATO&#xff1a;北大西洋公约组织 Software Crisis&#xff1a;软件危机 Paradigm&#xff1a;设计范型 Waterfall Model&#xff1a;瀑布模型 Prototype Model&#xff1a;原型模型&#xff08;又称快速模型&#xff09; Spiral Model&#xff1a;螺旋模型 Agile&#xff1a;…

视频播放中时钟的概念及音视频同步概念

author: hjjdebug date: 2025年 07月 05日 星期六 18:20:45 CST descrip: 视频播放中时钟的概念及音视频同步概念 文章目录 1.前言: 视频播放:1. 固定延时时间2. 根据frame的duration来延时.3. 根据frame的PTS 来播放3.1. 时钟是什么?3.2. 时钟的用途. 2.音视频同步: 1.前言: …

Python基础之字符串操作全解析

在 Python 中&#xff0c;字符串是最常用的数据类型之一&#xff0c;掌握字符串的各种操作对于日常编程至关重要。本文将详细介绍 Python 字符串的类型特性、编码转换、常用运算符及方法&#xff0c;帮助你全面掌握字符串处理技巧。 一、字符串的基本类型 Python 中的字符串属…

【爬虫】逆向爬虫初体验之爬取音乐

寻找数据 打开F12中的网络页面&#xff0c;播放音乐后&#xff0c;筛选媒体&#xff0c;会发现当前这首歌曲音频链接地址&#xff0c;打开后&#xff0c;点击“标头”就能能看到请求URL 截取“.mp3”前面的一部分进行搜索&#xff0c;搜索出来了很多数据包&#xff0c;但都是…

CppCon 2018 学习:Fancy Pointers for Fun and Profit

“Fancy Pointers for Fun and Profit” 这个标题听起来像是在讨论**“高级指针用法”**&#xff0c;尤其是在C里&#xff0c;如何利用智能指针、定制指针类型&#xff0c;或者其他高级指针技巧来写更安全、更高效、更优雅的代码。 可能的理解和内容方向&#xff1a; 1. 什么是…

思辨场域丨数字信号技术重塑农林牧渔:从“靠天吃饭”到“靠数吃饭”

凌晨三点&#xff0c;山东莱芜的养猪户老李被手机震动惊醒。屏幕显示&#xff1a;3号猪舍&#xff0c;母猪即将分娩。他轻点屏幕启动远程监控&#xff0c;翻身继续入睡——而在几年前&#xff0c;这样的夜晚他只能在猪圈里守着。 清晨的茶园里&#xff0c;兴业县的茶农王大姐掏…

文心大模型及百度大模型内容安全平台齐获信通院大模型安全认证

近日&#xff0c;文心大模型与百度大模型内容安全平台——红线大模型双双荣获中国信息通信研究院泰尔认证中心颁发的“大规模预训练模型&#xff08;文本生成功能&#xff09;安全认证证书”&#xff0c;且二者的认证级别皆“增强级”的最高级别。 大规模预训练模型&#xff08…

香港服务器查询缓存禁用-性能优化关键技术解析

在香港服务器运维过程中&#xff0c;查询缓存禁用是提升数据库性能的关键操作。本文将深入解析禁用查询缓存的原理、操作步骤、适用场景及注意事项&#xff0c;帮助管理员优化MySQL服务器配置&#xff0c;解决高并发环境下的性能瓶颈问题。香港服务器查询缓存禁用-性能优化关键…