【Unity3D编辑器开发】Unity3D中实现Transform组件拓展,快速复制、粘贴、复原【非常实用】

推荐阅读

  • CSDN主页
  • GitHub开源地址
  • Unity3D插件分享
  • 简书地址
  • 我的个人博客

大家好,我是佛系工程师☆恬静的小魔龙☆,不定时更新Unity开发技巧,觉得有用记得一键三连哦。

一、前言

在开发中,常常会遇到频繁复制粘贴物体的坐标、旋转、缩放的操作。

使用Unity自带的组件复制粘贴比较麻烦:
复制:
在这里插入图片描述
粘贴:
在这里插入图片描述
还有一些需要复制位置、旋转、缩放的值到到代码中,如果一个一个复制粘贴非常麻烦,还要一些需要复制添加自定义文本,也很不方便。

所以,就开发了一个小工具,来提升开发效率。

二、正文

2-1、实现快速复制/粘贴,位置/旋转/缩放功能

效果图:
在这里插入图片描述
在Editor文件夹中新建脚本,随便命名,然后编辑代码:

using UnityEngine;
using UnityEditor;
using System.Text;
using static UnityEditor.IMGUI.Controls.PrimitiveBoundsHandle;
using static UnityEngine.UI.Image;[CanEditMultipleObjects]
[CustomEditor(typeof(Transform), true)]
public class TransformEditor : Editor
{static public TransformEditor instance;//当前的本地坐标SerializedProperty mPos;//当前的本地旋转SerializedProperty mRot;//当前的本地缩放SerializedProperty mScale;void OnEnable(){instance = this;if (this){try{var so = serializedObject;mPos = so.FindProperty("m_LocalPosition");mRot = so.FindProperty("m_LocalRotation");mScale = so.FindProperty("m_LocalScale");}catch { }}}void OnDestroy() { instance = null; }/// <summary>/// Draw the inspector widget.绘制inspector小部件。/// </summary>public override void OnInspectorGUI(){//设置label的宽度EditorGUIUtility.labelWidth = 15f;serializedObject.Update();DrawPosition();DrawRotation();DrawScale();DrawCopyAndPaste();serializedObject.ApplyModifiedProperties();}void DrawCopyAndPaste(){GUILayout.BeginHorizontal();bool reset = GUILayout.Button("Copy");bool reset2 = GUILayout.Button("Paste");GUILayout.EndHorizontal();if (reset){//把数值打印出来var select = Selection.activeGameObject;if (select == null)return;//Debug.Log(select.name+"("+ mPos.vector3Value.x.ToString()+ ","+ mPos.vector3Value.y.ToString() + ","+ mPos.vector3Value.z.ToString() + ")");//Debug.Log(select.name + mRot.quaternionValue);//Debug.Log(select.name + "(" + mScale.vector3Value.x.ToString() + "," + mScale.vector3Value.y.ToString() + "," + mScale.vector3Value.z.ToString() + ")");StringBuilder s = new StringBuilder();s.Append("TransformInspector_" + "(" + mPos.vector3Value.x.ToString() + "," + mPos.vector3Value.y.ToString() + "," + mPos.vector3Value.z.ToString() + ")" + "_");s.Append(mRot.quaternionValue + "_");s.Append("(" + mScale.vector3Value.x.ToString() + "," + mScale.vector3Value.y.ToString() + "," + mScale.vector3Value.z.ToString() + ")");//添加到剪贴板UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();}if (reset2){//把数值打印出来//Debug.Log(UnityEngine.GUIUtility.systemCopyBuffer);string s = UnityEngine.GUIUtility.systemCopyBuffer;string[] sArr = s.Split('_');if (sArr[0] != "TransformInspector"){Debug.LogError("未复制Transform组件内容!Transform component content not copied!");return;}//Debug.Log("Pos:" + sArr[1]);//Debug.Log("Rot:" + sArr[2]);//Debug.Log("Scale:" + sArr[3]);try{mPos.vector3Value = ParseV3(sArr[1]);mRot.quaternionValue = new Quaternion() { x = ParseV4(sArr[2]).x, y = ParseV4(sArr[2]).y, z = ParseV4(sArr[2]).z, w = ParseV4(sArr[2]).w };mScale.vector3Value = ParseV3(sArr[3]);}catch (System.Exception ex){Debug.LogError(ex);return;}}}/// <summary>/// String To Vector3/// </summary>/// <param name="strVector3"></param>/// <returns></returns>Vector3 ParseV3(string strVector3){strVector3 = strVector3.Replace("(", "").Replace(")", "");string[] s = strVector3.Split(',');return new Vector3(float.Parse(s[0]), float.Parse(s[1]), float.Parse(s[2]));}/// <summary>/// String To Vector4/// </summary>/// <param name="strVector4"></param>/// <returns></returns>Vector4 ParseV4(string strVector4){strVector4 = strVector4.Replace("(", "").Replace(")", "");string[] s = strVector4.Split(',');return new Vector4(float.Parse(s[0]), float.Parse(s[1]), float.Parse(s[2]), float.Parse(s[3]));}#region Position 位置void DrawPosition(){GUILayout.BeginHorizontal();EditorGUILayout.PropertyField(mPos.FindPropertyRelative("x"));EditorGUILayout.PropertyField(mPos.FindPropertyRelative("y"));EditorGUILayout.PropertyField(mPos.FindPropertyRelative("z"));bool reset = GUILayout.Button("P", GUILayout.Width(20f));GUILayout.EndHorizontal();if (reset) mPos.vector3Value = Vector3.zero;}#endregion#region Scale 缩放void DrawScale(){GUILayout.BeginHorizontal();{EditorGUILayout.PropertyField(mScale.FindPropertyRelative("x"));EditorGUILayout.PropertyField(mScale.FindPropertyRelative("y"));EditorGUILayout.PropertyField(mScale.FindPropertyRelative("z"));bool reset = GUILayout.Button("S", GUILayout.Width(20f));if (reset) mScale.vector3Value = Vector3.one;}GUILayout.EndHorizontal();}#endregion#region Rotation is ugly as hell... since there is no native support for quaternion property drawing 旋转是丑陋的地狱。。。因为四元数属性绘图没有本地支持enum Axes : int{None = 0,X = 1,Y = 2,Z = 4,All = 7,}Axes CheckDifference(Transform t, Vector3 original){Vector3 next = t.localEulerAngles;Axes axes = Axes.None;if (Differs(next.x, original.x)) axes |= Axes.X;if (Differs(next.y, original.y)) axes |= Axes.Y;if (Differs(next.z, original.z)) axes |= Axes.Z;return axes;}Axes CheckDifference(SerializedProperty property){Axes axes = Axes.None;if (property.hasMultipleDifferentValues){Vector3 original = property.quaternionValue.eulerAngles;foreach (Object obj in serializedObject.targetObjects){axes |= CheckDifference(obj as Transform, original);if (axes == Axes.All) break;}}return axes;}/// <summary>/// Draw an editable float field. 绘制可编辑的浮动字段。/// </summary>/// <param name="hidden">Whether to replace the value with a dash 是否将值替换为破折号</param>/// <param name="greyedOut">Whether the value should be greyed out or not 值是否应灰显</param>static bool FloatField(string name, ref float value, bool hidden, GUILayoutOption opt){float newValue = value;GUI.changed = false;if (!hidden){newValue = EditorGUILayout.FloatField(name, newValue, opt);}else{float.TryParse(EditorGUILayout.TextField(name, "--", opt), out newValue);}if (GUI.changed && Differs(newValue, value)){value = newValue;return true;}return false;}/// <summary>/// Because Mathf.Approximately is too sensitive.因为数学近似值太敏感了。/// </summary>static bool Differs(float a, float b) { return Mathf.Abs(a - b) > 0.0001f; }/// <summary>/// 注册Undo/// </summary>/// <param name="name"></param>/// <param name="objects"></param>static public void RegisterUndo(string name, params Object[] objects){if (objects != null && objects.Length > 0){UnityEditor.Undo.RecordObjects(objects, name);foreach (Object obj in objects){if (obj == null) continue;EditorUtility.SetDirty(obj);}}}/// <summary>/// 角度处理/// </summary>/// <param name="angle"></param>/// <returns></returns>static public float WrapAngle(float angle){while (angle > 180f) angle -= 360f;while (angle < -180f) angle += 360f;return angle;}void DrawRotation(){GUILayout.BeginHorizontal();{Vector3 visible = (serializedObject.targetObject as Transform).localEulerAngles;visible.x = WrapAngle(visible.x);visible.y = WrapAngle(visible.y);visible.z = WrapAngle(visible.z);Axes changed = CheckDifference(mRot);Axes altered = Axes.None;GUILayoutOption opt = GUILayout.MinWidth(30f);if (FloatField("X", ref visible.x, (changed & Axes.X) != 0, opt)) altered |= Axes.X;if (FloatField("Y", ref visible.y, (changed & Axes.Y) != 0, opt)) altered |= Axes.Y;if (FloatField("Z", ref visible.z, (changed & Axes.Z) != 0, opt)) altered |= Axes.Z;bool reset = GUILayout.Button("R", GUILayout.Width(20f));if (reset){mRot.quaternionValue = Quaternion.identity;}else if (altered != Axes.None){RegisterUndo("Change Rotation", serializedObject.targetObjects);foreach (Object obj in serializedObject.targetObjects){Transform t = obj as Transform;Vector3 v = t.localEulerAngles;if ((altered & Axes.X) != 0) v.x = visible.x;if ((altered & Axes.Y) != 0) v.y = visible.y;if ((altered & Axes.Z) != 0) v.z = visible.z;t.localEulerAngles = v;}}}GUILayout.EndHorizontal();}#endregion
}

运行结果:
在这里插入图片描述
这样就实现了基本的快速复制/粘贴,位置/旋转/缩放功能。

接下来,就实现单独的位置、旋转、缩放的复制和粘贴吧。

2-2、单独的位置、旋转、缩放的赋值粘贴功能

效果图:
在这里插入图片描述
示例代码:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEngine;public class ButtonHandler
{public string showDescription;public Action onClickCallBack;public ButtonHandler(string showDescription, Action onClickCallBack){this.showDescription = showDescription;this.onClickCallBack = onClickCallBack;}
}
[CanEditMultipleObjects]
[CustomEditor(typeof(Transform))]
public class TransformEditor2 : Editor
{static public Editor instance;private bool extensionBool;ButtonHandler[] buttonHandlerArray;//当前的本地坐标SerializedProperty mPos;//当前的本地旋转SerializedProperty mRot;//当前的本地缩放SerializedProperty mScale;private void OnEnable(){instance = this;var editorType = Assembly.GetAssembly(typeof(Editor)).GetTypes().FirstOrDefault(m => m.Name == "TransformInspector");instance = CreateEditor(targets, editorType);if (this){try{var so = serializedObject;mPos = so.FindProperty("m_LocalPosition");mRot = so.FindProperty("m_LocalRotation");mScale = so.FindProperty("m_LocalScale");}catch { }}extensionBool = EditorPrefs.GetBool("extensionBool");buttonHandlerArray = new ButtonHandler[9];buttonHandlerArray[0] = new ButtonHandler("Position Copy", () =>{var select = Selection.activeGameObject;if (select == null)return;StringBuilder s = new StringBuilder();// x,y,zs.Append(mPos.vector3Value.x.ToString() + "," + mPos.vector3Value.y.ToString() + "," + mPos.vector3Value.z.ToString());//添加到剪贴板UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();});buttonHandlerArray[1] = new ButtonHandler("Position Paste", () =>{//把数值打印出来string s = UnityEngine.GUIUtility.systemCopyBuffer;try{mPos.vector3Value = ParseV3(s);}catch (System.Exception ex){Debug.LogError(ex);return;}});buttonHandlerArray[2] = new ButtonHandler("Position Reset", () =>{mPos.vector3Value = Vector3.zero;});buttonHandlerArray[3] = new ButtonHandler("Rotation Copy", () =>{//把数值打印出来var select = Selection.activeGameObject;if (select == null)return;StringBuilder s = new StringBuilder();s.Append(mRot.quaternionValue.eulerAngles.x + "," + mRot.quaternionValue.eulerAngles.y + "," + mRot.quaternionValue.eulerAngles.z);//添加到剪贴板UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();});buttonHandlerArray[4] = new ButtonHandler("Rotation Paste", () =>{//把数值打印出来Debug.Log(UnityEngine.GUIUtility.systemCopyBuffer);string s = UnityEngine.GUIUtility.systemCopyBuffer;try{mRot.quaternionValue = Quaternion.Euler(ParseV3(s));}catch (System.Exception ex){Debug.LogError(ex);return;}});buttonHandlerArray[5] = new ButtonHandler("Rotation Reset", () =>{mRot.quaternionValue = Quaternion.identity;});buttonHandlerArray[6] = new ButtonHandler("Scale Copy", () =>{//把数值打印出来var select = Selection.activeGameObject;if (select == null)return;StringBuilder s = new StringBuilder();s.Append(mScale.vector3Value.x.ToString() + "," + mScale.vector3Value.y.ToString() + "," + mScale.vector3Value.z.ToString());//添加到剪贴板UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();});buttonHandlerArray[7] = new ButtonHandler("Scale Paste", () =>{//把数值打印出来Debug.Log(UnityEngine.GUIUtility.systemCopyBuffer);string s = UnityEngine.GUIUtility.systemCopyBuffer;try{mScale.vector3Value = ParseV3(s);}catch (System.Exception ex){Debug.LogError(ex);return;}});buttonHandlerArray[8] = new ButtonHandler("Scale Reset", () =>{mScale.vector3Value = Vector3.one;});}private void OnDisable(){EditorPrefs.SetBool("extensionBool", extensionBool);}public override void OnInspectorGUI(){instance.OnInspectorGUI();GUI.color = Color.cyan;extensionBool = EditorGUILayout.Foldout(extensionBool, "拓展功能");if (extensionBool){EditorGUILayout.BeginHorizontal();for (int i = 0; i < buttonHandlerArray.Length; i++){ButtonHandler temporaryButtonHandler = buttonHandlerArray[i];if (GUILayout.Button(temporaryButtonHandler.showDescription, "toolbarbutton"))//, GUILayout.MaxWidth(150){temporaryButtonHandler.onClickCallBack();}GUILayout.Space(5);if ((i + 1) % 3 == 0 || i + 1 == buttonHandlerArray.Length){EditorGUILayout.EndHorizontal();if (i + 1 < buttonHandlerArray.Length){GUILayout.Space(5);EditorGUILayout.BeginHorizontal();}}}}GUI.color = Color.white;serializedObject.ApplyModifiedProperties();}Vector3 ParseV3(string strVector3){string[] s = strVector3.Split(',');return new Vector3(float.Parse(s[0]), float.Parse(s[1]), float.Parse(s[2]));}
}

演示:
在这里插入图片描述
这样就实现了单独的位置/旋转/缩放复制/粘贴功能。

接下来,就实现单独的位置/旋转/缩放复制/粘贴功能以及位置/旋转/缩放一起复制和粘贴功能。

以及,自定义文本拼接的功能。

2-3、自定义文本拼接的功能

效果图:
在这里插入图片描述

参考代码:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEngine;
using static UnityEditor.IMGUI.Controls.PrimitiveBoundsHandle;
using static UnityEngine.GraphicsBuffer;
using static UnityEngine.UI.Image;[CanEditMultipleObjects]
[CustomEditor(typeof(Transform))]
public class TransformEditor : Editor
{static public Editor instance;Transform m_Transform;private bool extensionBool;string axisName = "Local";bool isAxis = false;bool isDefined = false;string row1;string row2;string row3;string row4;//当前的本地坐标SerializedProperty mPos;//当前的本地旋转SerializedProperty mRot;//当前的本地缩放SerializedProperty mScale;private void OnEnable(){instance = this;var editorType = Assembly.GetAssembly(typeof(Editor)).GetTypes().FirstOrDefault(m => m.Name == "TransformInspector");instance = CreateEditor(targets, editorType);isAxis = EditorPrefs.GetBool("isAxis");isDefined = EditorPrefs.GetBool("isDefined");m_Transform = this.target as Transform;if (this){try{var so = serializedObject;mPos = so.FindProperty("m_LocalPosition");mRot = so.FindProperty("m_LocalRotation");mScale = so.FindProperty("m_LocalScale");}catch { }}}private void OnDisable(){EditorPrefs.SetBool("extensionBool", extensionBool);EditorPrefs.SetBool("isDefined", isDefined);}public override void OnInspectorGUI(){instance.OnInspectorGUI();extensionBool = EditorPrefs.GetBool("extensionBool");extensionBool = EditorGUILayout.Foldout(extensionBool, "拓展功能");if (extensionBool){OnTopGUI();OnTransformGUI();OnPositionGUI();OnRotationGUI();OnScaleGUI();OnDefindGUI();}}void OnTopGUI(){EditorGUILayout.BeginHorizontal();GUILayout.Label("Name");if (GUILayout.Button("Local/Global")){isAxis = !isAxis;EditorPrefs.SetBool("isAxis", isAxis);}axisName = isAxis ? "Local" : "Global";GUILayout.Label("当前坐标轴:" + axisName);EditorGUILayout.EndHorizontal();}void OnTransformGUI(){EditorGUILayout.BeginHorizontal();GUILayout.Label("Transform");if (GUILayout.Button("Copy")){var select = Selection.activeGameObject;if (select == null)return;StringBuilder s = new StringBuilder();s.Append("Transform_");if (isAxis){s.Append(FormatVe3(m_Transform.localPosition) + "_");s.Append(FormatVe3(m_Transform.localRotation.eulerAngles) + "_");s.Append(FormatVe3(m_Transform.localScale));}else{s.Append(FormatVe3(m_Transform.position) + "_");s.Append(FormatVe3(m_Transform.rotation.eulerAngles) + "_");s.Append(FormatVe3(m_Transform.localScale));}UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();}if (GUILayout.Button("Paste")){if (isDefined){Debug.LogError("不支持自定义文本!");UnityEngine.GUIUtility.systemCopyBuffer = "";return;}string s = UnityEngine.GUIUtility.systemCopyBuffer;string[] sArr = s.Split('_');if (sArr[0] != "Transform" || s == ""){Debug.LogError("未复制Transform组件内容!");return;}try{m_Transform.position = ParseV3(sArr[1]);m_Transform.rotation = Quaternion.Euler(ParseV3(sArr[2]));m_Transform.localScale = ParseV3(sArr[3]);}catch (System.Exception ex){Debug.LogError(ex);return;}}if (GUILayout.Button("Reset")){m_Transform.position = Vector3.zero;m_Transform.rotation = Quaternion.identity;m_Transform.localScale = Vector3.one;}EditorGUILayout.EndHorizontal();}void OnPositionGUI(){EditorGUILayout.BeginHorizontal();GUILayout.Label("Position");if (GUILayout.Button("Copy")){var select = Selection.activeGameObject;if (select == null)return;StringBuilder s = new StringBuilder();if (isAxis){s.Append(FormatVe3(m_Transform.localPosition));}else{s.Append(FormatVe3(m_Transform.position));}UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();Debug.Log(s);}if (GUILayout.Button("Paste")){if (isDefined){Debug.LogError("不支持自定义文本!");UnityEngine.GUIUtility.systemCopyBuffer = "";return;}string s = UnityEngine.GUIUtility.systemCopyBuffer;if (s == ""){Debug.LogError("未复制Position内容!");return;}try{m_Transform.position = ParseV3(s);}catch (System.Exception ex){Debug.LogError(ex);return;}}if (GUILayout.Button("Reset")){m_Transform.position = Vector3.zero;}EditorGUILayout.EndHorizontal();}void OnRotationGUI(){EditorGUILayout.BeginHorizontal();GUILayout.Label("Rotation");if (GUILayout.Button("Copy")){var select = Selection.activeGameObject;if (select == null)return;StringBuilder s = new StringBuilder();if (isAxis){s.Append(FormatVe3(m_Transform.localRotation.eulerAngles));}else{s.Append(FormatVe3(m_Transform.rotation.eulerAngles));}UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();}if (GUILayout.Button("Paste")){if (isDefined){Debug.LogError("不支持自定义文本!");UnityEngine.GUIUtility.systemCopyBuffer = "";return;}string s = UnityEngine.GUIUtility.systemCopyBuffer;if (s == ""){Debug.LogError("未复制Rotation内容!");return;}try{m_Transform.rotation = Quaternion.Euler(ParseV3(s));}catch (System.Exception ex){Debug.LogError(ex);return;}}if (GUILayout.Button("Reset")){m_Transform.rotation = Quaternion.identity;}EditorGUILayout.EndHorizontal();}void OnScaleGUI(){EditorGUILayout.BeginHorizontal();GUILayout.Label("Scale");if (GUILayout.Button("Copy")){var select = Selection.activeGameObject;if (select == null)return;StringBuilder s = new StringBuilder();s.Append(FormatVe3(m_Transform.localScale));UnityEngine.GUIUtility.systemCopyBuffer = s.ToString();}if (GUILayout.Button("Paste")){if (isDefined){Debug.LogError("不支持自定义文本!");UnityEngine.GUIUtility.systemCopyBuffer = "";return;}string s = UnityEngine.GUIUtility.systemCopyBuffer;if (s == ""){Debug.LogError("未复制Scale内容!");return;}try{m_Transform.localScale = ParseV3(s);}catch (System.Exception ex){Debug.LogError(ex);return;}}if (GUILayout.Button("Reset")){m_Transform.localScale = Vector3.one;}EditorGUILayout.EndHorizontal();}void OnDefindGUI(){GUILayout.BeginVertical();isDefined = GUILayout.Toggle(isDefined, "启用自定义文本拼接");if (isDefined){GUILayout.BeginHorizontal();row1 = GUILayout.TextField(row1);GUILayout.Label("X");row2 = GUILayout.TextField(row2);GUILayout.Label("Y");row3 = GUILayout.TextField(row3);GUILayout.Label("Z");row4 = GUILayout.TextField(row4);GUILayout.EndHorizontal();}GUILayout.EndVertical();}// x,y,zVector3 ParseV3(string strVector3){string[] s = strVector3.Split(',');return new Vector3(float.Parse(s[0]), float.Parse(s[1]), float.Parse(s[2]));}// x,y,zstring FormatVe3(Vector3 ve3){string str;if (!isDefined){str = ve3.x + "," + ve3.y + "," + ve3.z;}else{str = row1 + ve3.x + row2 + ve3.y + row3 + ve3.z + row4;}return str;}
}

三、后记

如果觉得本篇文章有用别忘了点个关注,关注不迷路,持续分享更多Unity干货文章。


你的点赞就是对博主的支持,有问题记得留言:

博主主页有联系方式。

博主还有跟多宝藏文章等待你的发掘哦:

专栏方向简介
Unity3D开发小游戏小游戏开发教程分享一些使用Unity3D引擎开发的小游戏,分享一些制作小游戏的教程。
Unity3D从入门到进阶入门从自学Unity中获取灵感,总结从零开始学习Unity的路线,有C#和Unity的知识。
Unity3D之UGUIUGUIUnity的UI系统UGUI全解析,从UGUI的基础控件开始讲起,然后将UGUI的原理,UGUI的使用全面教学。
Unity3D之读取数据文件读取使用Unity3D读取txt文档、json文档、xml文档、csv文档、Excel文档。
Unity3D之数据集合数据集合数组集合:数组、List、字典、堆栈、链表等数据集合知识分享。
Unity3D之VR/AR(虚拟仿真)开发虚拟仿真总结博主工作常见的虚拟仿真需求进行案例讲解。
Unity3D之插件插件主要分享在Unity开发中用到的一些插件使用方法,插件介绍等
Unity3D之日常开发日常记录主要是博主日常开发中用到的,用到的方法技巧,开发思路,代码分享等
Unity3D之日常BUG日常记录记录在使用Unity3D编辑器开发项目过程中,遇到的BUG和坑,让后来人可以有些参考。

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

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

相关文章

ChatGPT对于留学生论文写作有哪些帮助?

2022年11月&#xff0c;OpenAI公司的智能聊天产品ChatGPT横空出世&#xff0c;并两个月之内吸引了超过1亿用户&#xff0c;打破了TikTok&#xff08;抖音国际版&#xff09;9个月用户破亿的纪录。 划时代的浪潮 ChatGPT的火爆立即引起了全球关注并成为热门话题&#xff0c;它…

性能测试需求分析

1、客户方提出 客户方能提出明确的性能需求&#xff0c;说明对方很重视性能测试&#xff0c;这样的企业一般是金融、电信、银行、医疗器械等&#xff1b;他们一般对系统的性能要求非常高&#xff0c;对性能也非常了解。提出需求也比较明确。 曾经有一个银行项目&#xff0c;已经…

VUE:可收缩工具栏

作者:CSDN @ _乐多_ 本文记录了一个vue可伸缩工具栏组件,代码即插即用。 只需要新增函数名并且填函数体就可以。 效果如下图所示, 文章目录 一、Vue代码一、Vue代码 <template><div class="ToolBar"><div class=

安防视频监控EasyCVR视频汇聚平台与萤石云平台的适配方案分析

随着科技的不断发展&#xff0c;互联网技术逐渐深入到我们生活的各个领域。其中&#xff0c;安防监控领域受益于互联网技术的发展&#xff0c;逐渐呈现出智能化、高清化、远程化的趋势。本文将介绍一种基于萤石云与EasyCVR平台的安防视频监控解决方案&#xff0c;以满足用户对安…

uniapp实现简单的九宫格抽奖(附源码)

效果展示 uniapp实现大转盘抽奖 实现步骤&#xff1a; 1.该页面可设置8个奖品&#xff0c;每个奖品可设置中奖机会的权重&#xff0c;如下chance越大&#xff0c;中奖概率越高&#xff08;大于0&#xff09; // 示例代码 prizeList: [{id: 1,image: "https://img.alicdn…

数据结构-----红黑树简介

目录 前言 1.什么是红黑树&#xff1f; 2.为什么需要红黑树&#xff1f;&#xff08;与AVL树对比&#xff09; 3.红黑树的特性 前言 在此之前我们学习过了二叉排序树和平衡二叉树&#xff08;AVL树&#xff09;&#xff0c;这两种树都是属于搜索树的一种&#xff0c;那么今天…

Go语言入门心法(九): 引入三方依赖

Go语言入门心法(一): 基础语法 Go语言入门心法(二): 结构体 Go语言入门心法(三): 接口 Go语言入门心法(四): 异常体系 Go语言入门心法(五): 函数 Go语言入门心法(六): HTTP面向客户端|服务端编程 Go语言入门心法(八): mysql驱动安装报错onnection failed Go语言入门心法(…

Kotlin中的字符串基本操作

字符串定义&#xff1a; val str: String "Hello World"val str1 "Hello World"获取字符串的长度&#xff1a; println(str.length)通过索引方式访问某个字符&#xff0c;索引从0开始&#xff1a; println(str[4])通过for循环迭代字符串&#xff1a; for…

远程开户身份证识别OCR技术:革新传统流程,实现高效身份验证

远程开户是指通过互联网或其他远程通信方式&#xff0c;不需要亲自前往银行、证券公司或其他金融机构的实体营业网点&#xff0c;即可完成开立账户和办理相关服务的过程。 相比传统柜台开户方式&#xff0c;远程开户具有更高的便利性和灵活性。它使得用户可以随时随地通过网络…

树的基本操作(数据结构)

树的创建 //结构结点 typedef struct Node {int data;struct Node *leftchild;struct Node *rightchild; }*Bitree,BitNode;//初始化树 void Create(Bitree &T) {int d;printf("输入结点(按0为空结点):");scanf("%d",&d);if(d!0){T (Bitree)ma…

python argparse解析参数

用法比较简单&#xff0c;直接看代码 import argparseargparser argparse.ArgumentParser(descriptionthis is a hello argparser program) argparser.add_argument(--arg1, -a, typestr, helparg1 has value) argparser.add_argument(--arg2, typestr, default"value2&q…

STL库——Vector常见使用接口

一、介绍 1. vector是表示可变大小数组的序列容器&#xff0c;就像数组一样&#xff0c;vector也采用的连续存储空间来存储元素。也就是意味着可以采用下标对vector的元素 进行访问&#xff0c;和数组一样高效。但是又不像数组&#xff0c;它的大小是可以动态改变的&#xff0…

全流量安全分析发现内部系统外联异常

内部系统外连监控的重要性在于保护企业的信息安全和预防数据泄露&#xff0c;以下是几个重要的理由&#xff1a; 1、检测异常活动&#xff1a;通过监控内部系统的外连连接&#xff0c;可以及时发现是否有未经授权或异常的链接尝试。这可能表示存在恶意软件、黑客攻击或内部员工…

vueday01——使用属性绑定+ref属性定位获取id

1.属性绑定&#xff08;Attribute 绑定&#xff09; 第一种写法 <div v-bind:id"refValue"> content </div> 第二种写法&#xff08;省略掉v-bind&#xff09; <div :id"refValue"> content </div> 2.代码展示 <template…

Linux常见指令及热键

文章目录 1. ls 指令语法实例 2. pwd 指令语法实例 3. cd 指令语法实例 4. touch 指令语法实例 5. mkdir语法实例 6. rmdir 指令语法实例 7. rm 指令语法实例 8. man 指令语法实例 9. cp 指令语法实例 10. mv 指令语法实例 11. cat 指令使用权限语法格式参数说明&#xff1a;实…

2023_Spark_实验十五:自定义法创建Dataframe及SQL操作

方式二&#xff1a;SQL方式操作 1.实例化SparkContext和SparkSession对象 2.创建case class Emp样例类&#xff0c;用于定义数据的结构信息 3.通过SparkContext对象读取文件&#xff0c;生成RDD[String] 4.将RDD[String]转换成RDD[Emp] 5.引入spark隐式转换函数&#xff08…

由浅入深学习nginx

nginx&#xff08;高性能的http和反向代理服务器&#xff09;的优点&#xff1a; &#xff08;1&#xff09;占有内存少 &#xff08;2&#xff09;并发能力强&#xff08;支持5万个&#xff09; &#xff08;3&#xff09;专为性能优化而开发 nginx主要可以实现的功能有这么几…

SD/SDIO(1):SD总线协议介绍

SD标准提供了很大的灵活性&#xff0c;除了作为存储卡外&#xff0c;还提供了SD卡槽的标准来扩展设备的功能。本篇文章就先来介绍一下SD总线的规范。对于SD/MMC协议的发展历史和概念介绍&#xff0c;可以参考我的这篇文章&#xff1a;SD、SDIO和MMC接口基础和规范介绍 文章目录…

C# 关于托管调试助手 “FatalExecutionEngineError“:“运行时遇到了错误。解决方案

托管调试助手 “FatalExecutionEngineError”:“运行时遇到了错误。此错误的地址为 0x740161f8&#xff0c;在线程 0x1174 上。错误代码为 0xc0000005。此错误可能是 CLR 中的 bug&#xff0c;或者是用户代码的不安全部分或不可验证部分中的 bug。此 bug 的常见来源包括用户对 …

回顾 | E³CI效能认知与改进论坛,助力企业研发效能度量和提升

2023年8月&#xff0c;TiD质量竞争力大会组委会和ECI专家委员会成功举办TiD大时段课程“度量驱动研发效能提升”与“ECI效能认知与改进论坛”。与会专家以《ECI软件研发效能度量规范》团体标准为要点&#xff0c;为企业研发效能度量和提升分享诸多实践成果与经验。 《ECI软件研…