Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
csdjk committed Mar 8, 2024
1 parent ccc263c commit 5a47689
Show file tree
Hide file tree
Showing 27 changed files with 345 additions and 103 deletions.
111 changes: 38 additions & 73 deletions Editor/JaveLin_RDC_CSV2FBX/JaveLin_RDC_CSV2FBX.cs

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion Editor/LcLProfilerToolsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,12 @@ public override void OnInspectorGUI()
serializedObject.ApplyModifiedProperties();
}

[MenuItem("GameObject/LcLTools/Add LcLDebugTools", false, 0)]
static void AddLcLDebugTools()
{
var go = new GameObject("LcLDebugTools", typeof(LcLDebugTools), typeof(LcLProfiler));
Selection.activeObject = go;
Undo.RegisterCreatedObjectUndo(go, "AddLcLDebugTools");
}
}
}
}
109 changes: 100 additions & 9 deletions Editor/Libs/LcLElements.cs/UIElementsExtend.uss
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,144 @@ Label {
height: 25px;
font-size: 13px;
}

.table-button:checked {
background-color: #0087e0;
font-size: 15px;
}

.table-button-child {
justify-content: center;
}
/* -----------------End-----------------*/

/* -----------------TextFieldList-----------------*/
.text-field-list-container {
flex-direction: row;
align-items: center;
align-self: center;
/* justify-content: space-around; */
justify-content: space-between;
padding-left: 20px;
padding-right: 20px;
margin-top: 5px;
margin-bottom: 5px;
min-height: 20px;
width: 100%;
}

.text-field-list-title {
margin-top: 10px;
margin-bottom: 10px;
}

.text-field-list-item {
margin-left: 10px;
margin-right: 10px;
min-width: 50px;
}

.text-field-list-button-container {
flex-direction: row;
align-items: center;
margin-left: 5px;
margin-right: 5px;
min-width: 56px;
}

.text-field-list-button {
height: 15px;
width: 20px;
margin-left: 5px;
}
/* -----------------End-----------------*/


/* -----------------ObjectFieldList-----------------*/
.object-field-list-container {
flex-direction: row;
align-items: center;
align-self: center;
justify-content: space-between;
padding-left: 20px;
padding-right: 20px;
margin-top: 5px;
margin-bottom: 5px;
min-height: 20px;
width: 100%;
}

.object-field-list-title {
margin-top: 10px;
margin-bottom: 10px;
}
.object-field-list-item {
margin-left: 10px;
margin-right: 10px;
min-width: 50px;
max-width: 200px;
}

.object-field-list-button-container {
flex-direction: row;
align-items: center;
margin-left: 5px;
margin-right: 5px;
min-width: 56px;
}

.object-field-list-button {
height: 15px;
width: 20px;
margin-left: 5px;
}
/* -----------------End-----------------*/

/* -----------------Resizable Box-----------------*/
.resizable-box-resize-handle-horizontal {
cursor: resize-horizontal;
background-color: black;
position: absolute;
}
.resizable-box-resize-handle-vertical {
cursor: resize-vertical;
background-color: black;
position: absolute;
}

/* --------------------Grid View--------------------- */
.grid-container {
width: 100%;
height: 100%;
margin: 2px;
}

.grid-foldout-content {
width: 100%;
height: 100%;
}
.grid-scrollview {
padding: 2px;
border-color: #202020;
border-width: 1px;
border-radius: 3px;
width: 100%;
height: 100%;
}
.grid-scrollview-content-container {
flex-direction: row;
flex-wrap: wrap;
}

.grid-size-field{
position: absolute;
min-width: 30px;
right: 0;
}
.grid-item:hover {
background-color: #383838;
}

.grid-item:focus{
background-color: #006eb8;
}


Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public class ShaderCollectionWindow : EditorWindow
private const string shaderCollectButtonClass = "shader-collect-button";
// shader item box

//
//
private const string shaderVariantCollectionName = "AllShaders.shadervariants";
private const string defaultShaderVariantCollectionPath = "Assets/Resources/Shaders/" + shaderVariantCollectionName;
string[] sortTypes = new string[] { "ShaderName", "VariantCount" };
private ObjectField m_ShaderVariantCollectionField;
private VisualElement m_LeftContainer;
private TwoPaneSplitView m_RightContainer;
Expand Down Expand Up @@ -186,7 +185,7 @@ public void RefreshShaderList()
private void DrawLeftContainer()
{
m_LeftContainer?.RemoveFromHierarchy();
// create scroll view
// create scroll view
m_LeftContainer = new ScrollView();
m_LeftContainer.AddToClassList(leftContainerClass);
m_MainContainer.Add(m_LeftContainer);
Expand Down Expand Up @@ -360,7 +359,7 @@ private void OnRemoveShaderClicked(EventBase evt)

private void OnAddShaderClicked(EventBase evt)
{
// 弹窗ObjectField选择shader,添加到shader list中
// 弹窗ObjectField选择shader,添加到shader list中
var shader = m_NewShaderField.value as Shader;
if (shader)
{
Expand Down Expand Up @@ -542,7 +541,7 @@ private void UpdateShaderVariantCountLabel()
variantCount.text = variants.Count.ToString();
}

// remove shader variant
// remove shader variant
private bool RemoveShaderVariant(ShaderVariant shaderVariant)
{
collectionMapper.RemoveVariant(shaderVariant);
Expand Down Expand Up @@ -580,4 +579,4 @@ private void OnDisable()
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ public class ShaderVariantAddWindow : EditorWindow
GridView m_SelectedShaderKeywordsGridView;
ListView m_VariantListView;
Button m_AddVariantButton;

private string mMessage;
Label m_MessageLabel;
int m_MaxVisibleVariants = 256;
List<int> m_FilteredVariantTypes = new List<int>();
List<string[]> m_FilteredVariantKeywords = new List<string[]>();
int m_NumFilteredVariants;
List<int> m_SelectedVariants = new List<int>();

// static ShaderVariantAddWindow Instance = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class ShaderStripperWindow : EditorWindow
private VisualElement m_ConfigContainerBox;

[SerializeField]
private ShaderVariantCollectionMapper mCollectionMapper;

// [MenuItem("LcLTools/Shader变体剔除")]
private static void ShowWindow()
Expand All @@ -42,7 +41,6 @@ private static void ShowWindow()

private void OnEnable()
{
mCollectionMapper = null;
VisualElement root = rootVisualElement;
root.styleSheets.Add(styleSheet);

Expand Down Expand Up @@ -126,4 +124,4 @@ private void UpdateShaderCollectionAssetsUI(ScriptableObject shaderCollectionAss
}


}
}
123 changes: 116 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# LcL-Tools-Unity

Unity Tools

## LcLShaderGUI
![1709892033153](image/README/1709892033153.png)

Unity个人常用工具。

一部分由自己开发,一部分来源于其他开发者开发(这里只作为收集,会标明来源)。


## 自己开发的工具:

### LcLShaderGUI

自定义ShaderGUI。

Feature:

Expand All @@ -14,12 +24,111 @@ Feature:

![1709521640412](image/README/1709521640412.png)

Shader变体收集
### Shader变体收集工具

创建配置文件:
![1709885366011](image/README/1709885366011.png)

#### Shader变体收集界面:

![1709883622784](image/README/1709883622784.png)

![1709884816981](image/README/1709884816981.png)

#### Shader变体剔除工具面板:

通过IPreprocessShaders接口实现,Build的时候会根据条件剔除掉冗余的变体。

![1709883925163](image/README/1709883925163.png)

### LcLProfiler

性能分析工具,方便打包后查看一些渲染信息,方便分析性能。

Feature:
- 显示GC Memory
- 显示Memory
- 显示SetPassCalls
- 显示DrawCalls
- 显示Triangles
- 显示Vertices
- 显示GPU、CPU Info
- 显示SRP Batch 相关信息
- 显示电量消耗

![1709891102504](image/README/1709891102504.png)

![1709891416999](image/README/1709891416999.png)

### LcLDebugTools

自制Debug工具,方便打包后测试各种功能,例如切换材质,方便分析某个材质的消耗,配合。

Feature:

- 单选开关
- 多选开关
- 自定义方法调用按钮
- 场景跳转
- Shader LOD切换

![1709890530139](image/README/1709890530139.png)

![1709890996361](image/README/1709890996361.gif)



### 截图工具

通过Camera渲染图片并保存下来。

![1709885049417](image/README/1709885049417.png)

### Unity SVN Tools

在Unity中直接使用SVN命令,快速提交、更新、回退文件等操作。

![1709889523690](image/README/1709889523690.png)

### Unity 文件拷贝工具

最初是方便自己同步不同项目工程的文件,实现文件一键Copy同步到不同的工程。

比如在美术工程修改了Shader,那么需要把修改的Shader文件同步到客户端工程。那么就可以使用该工具一键同步。
需要修改手动脚本里的路径。

![1709889616602](image/README/1709889616602.png)


## 非本人开发的工具:

### Unity内置Icon查看器

工具来源:[https://github.com/nukadelic/UnityEditorIcons](https://github.com/nukadelic/UnityEditorIcons)

![1709885812807](image/README/1709885812807.png)

### Unity内置GUI Style查看器

工具来源忘了...有点久远了。

![1709885992355](image/README/1709885992355.png)


### RenderDoc CSV Convert To FBX Tool

工具来源:[https://github.com/javelinlin/Testing_CSV2Mesh_Tool](https://github.com/javelinlin/Testing_CSV2Mesh_Tool)

将RenderDoc导出的csv文件转换成FBX,在原作者基础上新增了自动映射所有字段、修改字段时候自动应用所有分量。

![1709888519062](image/README/1709888519062.gif)

![1709888858620](image/README/1709888858620.gif)

Built-In Shader Convert To URP Tool
### Built-In Shader Convert To URP Tool

RenderDoc CSV Convert To FBX Tool
工具具体来源忘了,我在此基础上优化了下,大部分代码片段能正常转换,部分可能需要手动转。

LcLDebugTools
Built In Shader转换为URP Shader工具。

....
![1709888965140](image/README/1709888965140.png)
Loading

0 comments on commit 5a47689

Please sign in to comment.