commit
d4546922cd
10076 changed files with 1118813 additions and 0 deletions
-
125Packages/.editorconfig
-
401Packages/.gitattributes
-
52Packages/.gitignore
-
7Packages/com.unity.render-pipelines.core/.npmignore
-
707Packages/com.unity.render-pipelines.core/CHANGELOG.md
-
7Packages/com.unity.render-pipelines.core/CHANGELOG.md.meta
-
8Packages/com.unity.render-pipelines.core/Editor-PrivateShared.meta
-
113Packages/com.unity.render-pipelines.core/Editor-PrivateShared/AssemblyInfo.cs
-
11Packages/com.unity.render-pipelines.core/Editor-PrivateShared/AssemblyInfo.cs.meta
-
18Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Unity.RenderPipelines.Core.Editor.Shared.asmdef
-
7Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Unity.RenderPipelines.Core.Editor.Shared.asmdef.meta
-
9Packages/com.unity.render-pipelines.core/Editor.meta
-
8Packages/com.unity.render-pipelines.core/Editor/Analytics.meta
-
369Packages/com.unity.render-pipelines.core/Editor/Analytics/AnalyticsUtils.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Analytics/AnalyticsUtils.cs.meta
-
66Packages/com.unity.render-pipelines.core/Editor/Analytics/BuildTargetAnalytic.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Analytics/BuildTargetAnalytic.cs.meta
-
67Packages/com.unity.render-pipelines.core/Editor/Analytics/RenderPipelineGraphicsSettingsAnalytics.cs
-
2Packages/com.unity.render-pipelines.core/Editor/Analytics/RenderPipelineGraphicsSettingsAnalytics.cs.meta
-
66Packages/com.unity.render-pipelines.core/Editor/Analytics/VolumePriorityUsageAnalytic.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Analytics/VolumePriorityUsageAnalytic.cs.meta
-
95Packages/com.unity.render-pipelines.core/Editor/Analytics/VolumeProfileOverridesAnalytic.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Analytics/VolumeProfileOverridesAnalytic.cs.meta
-
55Packages/com.unity.render-pipelines.core/Editor/Analytics/VolumeProfileUsageAnalytic.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Analytics/VolumeProfileUsageAnalytic.cs.meta
-
5Packages/com.unity.render-pipelines.core/Editor/AssemblyInfo.cs
-
11Packages/com.unity.render-pipelines.core/Editor/AssemblyInfo.cs.meta
-
54Packages/com.unity.render-pipelines.core/Editor/AssetDatabaseHelper.cs
-
3Packages/com.unity.render-pipelines.core/Editor/AssetDatabaseHelper.cs.meta
-
8Packages/com.unity.render-pipelines.core/Editor/BuildProcessors.meta
-
97Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CoreBuildData.cs
-
2Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CoreBuildData.cs.meta
-
25Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CorePreprocessBuild.cs
-
2Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CorePreprocessBuild.cs.meta
-
8Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/SettingsStrippers.meta
-
11Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/SettingsStrippers/GPUResidentDrawerResourcesStripper.cs
-
2Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/SettingsStrippers/GPUResidentDrawerResourcesStripper.cs.meta
-
8Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/ShaderStrippers.meta
-
13Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/ShaderStrippers/SRPDisabledComputeShaderVariantStripper.cs
-
2Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/ShaderStrippers/SRPDisabledComputeShaderVariantStripper.cs.meta
-
111Packages/com.unity.render-pipelines.core/Editor/BuildTargetExtensions.cs
-
11Packages/com.unity.render-pipelines.core/Editor/BuildTargetExtensions.cs.meta
-
8Packages/com.unity.render-pipelines.core/Editor/Camera.meta
-
171Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs.meta
-
19Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs.meta
-
26Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs.meta
-
47Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs.meta
-
43Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs.meta
-
286Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs.meta
-
116Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs.meta
-
40Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs.meta
-
59Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs.meta
-
63Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs.meta
-
42Packages/com.unity.render-pipelines.core/Editor/Camera/ISerializedCamera.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Camera/ISerializedCamera.cs.meta
-
123Packages/com.unity.render-pipelines.core/Editor/CameraEditorUtils.cs
-
11Packages/com.unity.render-pipelines.core/Editor/CameraEditorUtils.cs.meta
-
8Packages/com.unity.render-pipelines.core/Editor/CommandBuffers.meta
-
8Packages/com.unity.render-pipelines.core/Editor/CommandBuffers/CommandBufferGenerator.meta
-
455Packages/com.unity.render-pipelines.core/Editor/CommandBuffers/CommandBufferGenerator/CommandBufferGenerator.cs
-
11Packages/com.unity.render-pipelines.core/Editor/CommandBuffers/CommandBufferGenerator/CommandBufferGenerator.cs.meta
-
18Packages/com.unity.render-pipelines.core/Editor/ContextualMenuDispatcher.cs
-
11Packages/com.unity.render-pipelines.core/Editor/ContextualMenuDispatcher.cs.meta
-
1002Packages/com.unity.render-pipelines.core/Editor/CoreEditorDrawers.cs
-
11Packages/com.unity.render-pipelines.core/Editor/CoreEditorDrawers.cs.meta
-
240Packages/com.unity.render-pipelines.core/Editor/CoreEditorStyles.cs
-
11Packages/com.unity.render-pipelines.core/Editor/CoreEditorStyles.cs.meta
-
1417Packages/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs
-
13Packages/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs.meta
-
81Packages/com.unity.render-pipelines.core/Editor/CoreRenderPipelinePreferences.cs
-
11Packages/com.unity.render-pipelines.core/Editor/CoreRenderPipelinePreferences.cs.meta
-
8Packages/com.unity.render-pipelines.core/Editor/CustomRenderTexture.meta
-
14Packages/com.unity.render-pipelines.core/Editor/CustomRenderTexture/CustomRenderTextureMenuItem.cs
-
11Packages/com.unity.render-pipelines.core/Editor/CustomRenderTexture/CustomRenderTextureMenuItem.cs.meta
-
38Packages/com.unity.render-pipelines.core/Editor/CustomRenderTexture/CustomRenderTextureShader.template
-
7Packages/com.unity.render-pipelines.core/Editor/CustomRenderTexture/CustomRenderTextureShader.template.meta
-
8Packages/com.unity.render-pipelines.core/Editor/Debugging.meta
-
272Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs.meta
-
926Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.Builtins.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.Builtins.cs.meta
-
261Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.cs.meta
-
79Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugUIHandlerCanvasEditor.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugUIHandlerCanvasEditor.cs.meta
-
684Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs.meta
-
34Packages/com.unity.render-pipelines.core/Editor/Debugging/UIFoldoutEditor.cs
-
11Packages/com.unity.render-pipelines.core/Editor/Debugging/UIFoldoutEditor.cs.meta
-
161Packages/com.unity.render-pipelines.core/Editor/Deprecated.cs
@ -0,0 +1,125 @@ |
|||
# see http://editorconfig.org/ for docs on this file |
|||
|
|||
root = true |
|||
|
|||
[*] |
|||
# help with sharing files across os's (i.e. network share or through local vm) |
|||
end_of_line = lf |
|||
charset = utf-8 |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = true |
|||
|
|||
# formattable file extensions (keep in sync with format.ini from unity-meta repo) |
|||
# |
|||
# Note: We need to split the formattable files configs into shorter duplicate entries (logically grouped) |
|||
# due to known issue in VS editorconfig extension where there is a limit of 51 characters (empirically determined). |
|||
# see: https://github.com/editorconfig/editorconfig-visualstudio/issues/21 |
|||
# |
|||
## uncrustify |
|||
[*.{c,h,cpp,hpp,m,mm,cc,cs}] |
|||
indent_style = space |
|||
indent_size = 4 |
|||
|
|||
## generic formatter (shaders) |
|||
[*.{cg,cginc,glslinc,hlsl,shader,y,ypp,yy}] |
|||
indent_style = space |
|||
indent_size = 4 |
|||
|
|||
## generic formatter (misc) |
|||
[*.{asm,s,S,pch,pchmm,java,sh,uss}] |
|||
indent_style = space |
|||
indent_size = 4 |
|||
|
|||
## perltidy |
|||
[*.{pl,pm,t,it}] |
|||
indent_style = space |
|||
indent_size = 4 |
|||
|
|||
## unity special |
|||
[*.{bindings,mem.xml}] |
|||
indent_style = space |
|||
indent_size = 4 |
|||
|
|||
# other filetypes we want to overwrite default configuration to preserve the standard |
|||
[{Makefile,makefile}] |
|||
# TAB characters are part of the Makefile format |
|||
indent_style = tab |
|||
|
|||
[*.{md,markdown}] |
|||
# trailing whitespace is significant in markdown (bad choice, bad!) |
|||
trim_trailing_whitespace = false |
|||
|
|||
[*.{json,asmdef}] |
|||
indent_style = space |
|||
# seems to be more common |
|||
indent_size = 2 |
|||
|
|||
# keep these and the VS stuff below in sync with .hgeol's CRLF extensions |
|||
[*.{vcproj,bat,cmd,xaml,tt,t4,ttinclude}] |
|||
end_of_line = crlf |
|||
|
|||
# this VS-specific stuff is based on experiments to see how VS will modify a file after it has been manually edited. |
|||
# the settings are meant to closely match what VS does to minimize unnecessary diffs. this duplicates some settings in * |
|||
# but let's be explicit here to be safe (in case someone wants to copy-paste this out to another .editorconfig). |
|||
[*.{vcxproj,vcxproj.filters,csproj,props,targets}] |
|||
indent_style = space |
|||
indent_size = 2 |
|||
end_of_line = crlf |
|||
charset = utf-8-bom |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = false |
|||
[*.{sln,sln.template}] |
|||
indent_style = tab |
|||
indent_size = 4 |
|||
end_of_line = crlf |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = false |
|||
|
|||
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules |
|||
[*.cs] |
|||
csharp_new_line_before_open_brace = all |
|||
csharp_new_line_before_else = true |
|||
csharp_new_line_before_catch = true |
|||
csharp_new_line_before_finally = true |
|||
csharp_new_line_before_members_in_object_initializers = true |
|||
csharp_new_line_before_members_in_anonymous_types = true |
|||
csharp_new_line_between_query_expression_clauses = true |
|||
# indentation options |
|||
csharp_indent_case_contents = true |
|||
csharp_indent_switch_labels = true |
|||
csharp_indent_labels = one_less_than_current |
|||
csharp_indent_block_contents = true |
|||
csharp_indent_braces = false |
|||
csharp_indent_case_contents_when_block = false |
|||
# spacing |
|||
csharp_space_after_cast = false |
|||
csharp_space_after_keywords_in_control_flow_statements = true |
|||
#csharp_space_between_parentheses = control_flow_statements, type_casts, expressions |
|||
csharp_space_before_colon_in_inheritance_clause = true |
|||
csharp_space_after_colon_in_inheritance_clause = true |
|||
csharp_space_around_binary_operators = before_and_after |
|||
csharp_space_between_method_declaration_parameter_list_parentheses = false |
|||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
|||
csharp_space_between_method_declaration_name_and_open_parenthesis = false |
|||
csharp_space_between_method_call_parameter_list_parentheses = false |
|||
csharp_space_between_method_call_empty_parameter_list_parentheses = false |
|||
csharp_space_between_method_call_name_and_opening_parenthesis = false |
|||
csharp_space_after_comma = true |
|||
csharp_space_before_comma = false |
|||
csharp_space_after_dot = false |
|||
csharp_space_before_dot = false |
|||
csharp_space_after_semicolon_in_for_statement = true |
|||
csharp_space_before_semicolon_in_for_statement = false |
|||
csharp_space_around_declaration_statements = false |
|||
csharp_space_before_open_square_brackets = false |
|||
csharp_space_between_empty_square_brackets = false |
|||
csharp_space_between_square_brackets = false |
|||
# wrap options |
|||
csharp_preserve_single_line_statements = true |
|||
csharp_preserve_single_line_blocks = true |
|||
# using directives |
|||
#csharp_using_directive_placement = outside_namespace |
|||
# dotnet options |
|||
#dotnet_sort_system_directives_first = true |
|||
|
|||
#dotnet_separate_import_directive_groups = false |
|||
@ -0,0 +1,401 @@ |
|||
* text=auto eol=lf |
|||
|
|||
# EOL |
|||
|
|||
*.py eol=lf |
|||
*.pl eol=lf |
|||
*.pm eol=lf |
|||
*.t eol=lf |
|||
*.it eol=lf |
|||
*.h eol=lf |
|||
*.cpp eol=lf |
|||
*.cs eol=lf |
|||
*.c eol=lf |
|||
*.txt eol=lf |
|||
*.bindings eol=lf |
|||
*.sh eol=lf |
|||
*.jam eol=lf |
|||
*.as eol=lf |
|||
*.boo eol=lf |
|||
*.java eol=lf |
|||
*.js eol=lf |
|||
Makefile eol=lf |
|||
*.shader eol=lf |
|||
*.cginc eol=lf |
|||
*.glslinc eol=lf |
|||
*.meta eol=lf |
|||
*.mm eol=lf |
|||
*.md eol=lf |
|||
Runtime/Export/common_* eol=lf |
|||
Repositories.ini eol=lf |
|||
.hgignore eol=lf |
|||
|
|||
# vs can handle these as lf, but really wants them as crlf |
|||
*.vcproj eol=crlf |
|||
*.vcxproj eol=crlf |
|||
*.vcxproj.filters eol=crlf |
|||
*.csproj eol=crlf |
|||
*.props eol=crlf |
|||
*.targets eol=crlf |
|||
*.sln eol=crlf |
|||
*.sln.template eol=crlf |
|||
*.bat eol=crlf |
|||
*.cmd eol=crlf |
|||
*.xaml eol=crlf |
|||
|
|||
# the templating parser will actually fail on lf, inexplicably setting every #line directive as '1' |
|||
*.tt eol=crlf |
|||
*.t4 eol=crlf |
|||
*.ttinclude eol=crlf |
|||
|
|||
# LFS |
|||
|
|||
# archives and well-known binary formats |
|||
*.[zZ][iI][pP] filter=lfs diff=lfs merge=lfs -text |
|||
*.7[zZ] filter=lfs diff=lfs merge=lfs -text |
|||
*.[zZ]7 filter=lfs diff=lfs merge=lfs -text |
|||
*.[tT][gG][zZ] filter=lfs diff=lfs merge=lfs -text |
|||
*.[tT][aA][rR].[zZ][sS][tT] filter=lfs diff=lfs merge=lfs -text |
|||
*.[gG][zZ] filter=lfs diff=lfs merge=lfs -text |
|||
*.[jJ][aA][rR] filter=lfs diff=lfs merge=lfs -text |
|||
*.[nN][uU][pP][kK][gG] filter=lfs diff=lfs merge=lfs -text |
|||
*.[eE][gG][gG] filter=lfs diff=lfs merge=lfs -text |
|||
*.[aA][pP][kK] filter=lfs diff=lfs merge=lfs -text |
|||
*.[mM][sS][iI] filter=lfs diff=lfs merge=lfs -text |
|||
*.[aA][rR][cC] filter=lfs diff=lfs merge=lfs -text |
|||
|
|||
# executables and libraries |
|||
*.[aA] filter=lfs diff=lfs merge=lfs -text |
|||
*.[oO] filter=lfs diff=lfs merge=lfs -text |
|||
*.[sS][oO] filter=lfs diff=lfs merge=lfs -text |
|||
*.[bB][iI][nN] filter=lfs diff=lfs merge=lfs -text |
|||
*.[dD][lL][lL] filter=lfs diff=lfs merge=lfs -text |
|||
*.[oO][bB][jJ] filter=lfs diff=lfs merge=lfs -text |
|||
*.[dD][yY][lL][iI][bB] filter=lfs diff=lfs merge=lfs -text |
|||
*.[lL][iI][bB] filter=lfs diff=lfs merge=lfs -text |
|||
*.[eE][xX][eE] filter=lfs diff=lfs merge=lfs -text |
|||
|
|||
# specific binaries in the unity codebase |
|||
js filter=lfs diff=lfs merge=lfs -text |
|||
p4 filter=lfs diff=lfs merge=lfs -text |
|||
p4d filter=lfs diff=lfs merge=lfs -text |
|||
flex filter=lfs diff=lfs merge=lfs -text |
|||
bison filter=lfs diff=lfs merge=lfs -text |
|||
distcc filter=lfs diff=lfs merge=lfs -text |
|||
distccd filter=lfs diff=lfs merge=lfs -text |
|||
gdbserver filter=lfs diff=lfs merge=lfs -text |
|||
fastzip_darwin filter=lfs diff=lfs merge=lfs -text |
|||
ProxyServer filter=lfs diff=lfs merge=lfs -text |
|||
node filter=lfs diff=lfs merge=lfs -text |
|||
usymtool filter=lfs diff=lfs merge=lfs -text |
|||
libtool filter=lfs diff=lfs merge=lfs -text |
|||
optool filter=lfs diff=lfs merge=lfs -text |
|||
Cg filter=lfs diff=lfs merge=lfs -text |
|||
PVRTexTool filter=lfs diff=lfs merge=lfs -text |
|||
PVRTexToolCL filter=lfs diff=lfs merge=lfs -text |
|||
PVRTexToolCLI filter=lfs diff=lfs merge=lfs -text |
|||
iproxy filter=lfs diff=lfs merge=lfs -text |
|||
7za filter=lfs diff=lfs merge=lfs -text |
|||
yasm filter=lfs diff=lfs merge=lfs -text |
|||
nasm filter=lfs diff=lfs merge=lfs -text |
|||
lzma filter=lfs diff=lfs merge=lfs -text |
|||
lzma-linux32 filter=lfs diff=lfs merge=lfs -text |
|||
unity_web_d3d filter=lfs diff=lfs merge=lfs -text |
|||
unity_web_gl filter=lfs diff=lfs merge=lfs -text |
|||
Everyplay filter=lfs diff=lfs merge=lfs -text |
|||
UnityAds filter=lfs diff=lfs merge=lfs -text |
|||
usym_upload filter=lfs diff=lfs merge=lfs -text |
|||
eng.cube.size filter=lfs diff=lfs merge=lfs -text |
|||
eng.cube.nn filter=lfs diff=lfs merge=lfs -text |
|||
ispc_osx filter=lfs diff=lfs merge=lfs -text |
|||
dump_syms filter=lfs diff=lfs merge=lfs -text |
|||
astcenc_linux filter=lfs diff=lfs merge=lfs -text |
|||
astcenc_osx filter=lfs diff=lfs merge=lfs -text |
|||
convert filter=lfs diff=lfs merge=lfs -text |
|||
convert_linux filter=lfs diff=lfs merge=lfs -text |
|||
etcpack2_linux filter=lfs diff=lfs merge=lfs -text |
|||
arm-eabi-gdb.dist filter=lfs diff=lfs merge=lfs -text |
|||
arm-eabi-gdb filter=lfs diff=lfs merge=lfs -text |
|||
build-wrapper-linux-x86-64 filter=lfs diff=lfs merge=lfs -text |
|||
build-wrapper-linux-x86-32 filter=lfs diff=lfs merge=lfs -text |
|||
build-wrapper-macosx-x86 filter=lfs diff=lfs merge=lfs -text |
|||
AudioPluginDemo filter=lfs diff=lfs merge=lfs -text |
|||
re2c filter=lfs diff=lfs merge=lfs -text |
|||
ios-deploy filter=lfs diff=lfs merge=lfs -text |
|||
mobiledevice filter=lfs diff=lfs merge=lfs -text |
|||
AssetBundles filter=lfs diff=lfs merge=lfs -text |
|||
Unity4XC filter=lfs diff=lfs merge=lfs -text |
|||
lemon filter=lfs diff=lfs merge=lfs -text |
|||
etcpack filter=lfs diff=lfs merge=lfs -text |
|||
etcpack2 filter=lfs diff=lfs merge=lfs -text |
|||
enabundle filter=lfs diff=lfs merge=lfs -text |
|||
assetDatabase3 filter=lfs diff=lfs merge=lfs -text |
|||
MasterServer filter=lfs diff=lfs merge=lfs -text |
|||
Facilitator filter=lfs diff=lfs merge=lfs -text |
|||
RenderingPlugin filter=lfs diff=lfs merge=lfs -text |
|||
Unitron filter=lfs diff=lfs merge=lfs -text |
|||
DotMacKit filter=lfs diff=lfs merge=lfs -text |
|||
ImageComparer filter=lfs diff=lfs merge=lfs -text |
|||
GameKit filter=lfs diff=lfs merge=lfs -text |
|||
OgreKit filter=lfs diff=lfs merge=lfs -text |
|||
*.test-cache filter=lfs diff=lfs merge=lfs -text |
|||
*.unitypackage filter=lfs diff=lfs merge=lfs -text |
|||
Projects/VisualStudio/ipch/middleman-2afd44a3/unitywebpluginax-eba8f4d1.ipch filter=lfs diff=lfs merge=lfs -text |
|||
Editor/Resources/Common/unity[[:space:]]editor[[:space:]]resources filter=lfs diff=lfs merge=lfs -text |
|||
Editor/Resources/unity[[:space:]]editor[[:space:]]resources filter=lfs diff=lfs merge=lfs -text |
|||
|
|||
#SRP |
|||
**/BatchRendererGroup_HDRP/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_HDRP/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/BatchRendererGroup_URP/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/BuildInGraphicsTest_Foundation/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Foundation/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/BuiltInGraphicsTest_Lighting/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp-upgrade/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.urp/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/com.unity.testing.xr/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_DXR_Tests/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/PostProcessing_Tests/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/SRP_SmokeTest/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalGfxTestStereo/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.bytes filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.cube filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.dds filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.exp filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.FBX filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.fbx filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.hdr filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.jpeg filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.jpg filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.png filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.psd filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.tga filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.tif filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.tiff filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.ttf filter=lfs diff=lfs merge=lfs -text |
|||
**/UniversalUpgradeTest/**/*.vfx filter=lfs diff=lfs merge=lfs -text |
|||
|
|||
**/com.unity.template-hd/Assets/Scenes/SampleScene/LightingData.asset filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_PerformanceTests/Assets/Scenes/Lighting/Cloud.asset filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/Assets/Scenes/002-HDMaterials/cloud2.asset filter=lfs diff=lfs merge=lfs -text |
|||
**/HDRP_RuntimeTests/Assets/Scenes/002-HDMaterials/perlin.asset filter=lfs diff=lfs merge=lfs -text |
|||
|
|||
#GfxTests |
|||
**/GfxTestProjectFolder/**/*.[hH][dD][rR] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[tT][gG][aA] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[pP][nN][gG] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[bB][mM][pP] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[tT][iI][fF] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[tT][tT][fF] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[jJ][pP][gG] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[jJ][pP][eE][gG] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[aA][sS][sS][eE][tT] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[fF][bB][xX] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[pP][sS][dD] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[sS][pP][mM] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[aA][aa][rR] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[cC][uU][bB][eE][mM][aA][pP] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[pP][rR][xX] filter=lfs diff=lfs merge=lfs -text |
|||
**/GfxTestProjectFolder/**/*.[dD][fF][oO][nN][tT] filter=lfs diff=lfs merge=lfs -text |
|||
|
|||
# memoryprofiler test snapshots |
|||
**/com.unity.memoryprofiler.tests/**/*.[sS][nN][aA][pP] filter=lfs diff=lfs merge=lfs -text |
|||
|
|||
|
|||
# buginfo tools |
|||
/Tools/Unity.BugInfo.Coverage/bin/* filter=lfs diff=lfs merge=lfs -text |
|||
@ -0,0 +1,52 @@ |
|||
|
|||
[Aa]rtifacts/ |
|||
[Bb]uild/ |
|||
[Ll]ibrary/ |
|||
[Oo]bj/ |
|||
[Tt]emp/ |
|||
[Ss]treaming[Aa]ssets/ |
|||
[Aa]ctual[Ii]mages/ |
|||
[Ll]og/ |
|||
[Ll]ogs/ |
|||
[Aa]ctual[Ii]mages.meta |
|||
[Ss]treaming[Aa]ssets.meta |
|||
.vs |
|||
.vscode |
|||
.idea |
|||
.DS_Store |
|||
*.aspx |
|||
*.browser |
|||
*.csproj |
|||
*.exe |
|||
*.ini |
|||
*.log |
|||
*.map |
|||
*.mdb |
|||
*.npmrc |
|||
*.pyc |
|||
*.resS |
|||
*.sdf |
|||
*.sln |
|||
*.sublime-project |
|||
*.sublime-workspace |
|||
*.suo |
|||
*.userprefs |
|||
*.orig |
|||
*.orig.meta |
|||
*.bak |
|||
.npmrc |
|||
ShaderGraph/DebugOutput.meta |
|||
ShaderGraph/DebugOutput/** |
|||
ShaderGraph/Testing/IntegrationTests/.Failed |
|||
TestProjects/*/ProjectSettings/ProjectVersion.txt |
|||
TestProjects/VisualEffectGraph_HDRP/GraphViz/ |
|||
|
|||
*/manifest-updater.py |
|||
node_modules |
|||
|
|||
.yamato/script/path.config |
|||
manifest-updater.py |
|||
TestProjects/UniversalGraphicsTest_Lighting/UserSettings/EditorUserSettings.asset |
|||
TestProjects/UniversalGraphicsTest_Lighting/Packages/packages-lock.json |
|||
com.unity.template-hd/InitCodeMarker |
|||
gfx-sdet-tools |
|||
@ -0,0 +1,7 @@ |
|||
sub-package.* |
|||
upm-ci~/** |
|||
.Editor/** |
|||
.yamato/** |
|||
*.zip* |
|||
TestRunnerOptions.json |
|||
.idea/** |
|||
@ -0,0 +1,707 @@ |
|||
# Changelog |
|||
|
|||
All notable changes to this package will be documented in this file. |
|||
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) |
|||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). |
|||
|
|||
## [Unreleased] |
|||
|
|||
Version Updated |
|||
The version number for this package has increased due to a version update of a related graphics package. |
|||
|
|||
## [17.0.2] - 2024-04-02 |
|||
|
|||
This version is compatible with Unity 6000.0.0b15. |
|||
|
|||
### Changed |
|||
- Improved Render Graph Viewer UI to allow jumping to pass definitions in C# IDE. |
|||
- Replaced the overlays inside the RenderGraph Viewer with a fixed side panel. |
|||
- Small optimization, frame allocation checks of the Render Graph resource pool are now enabled through Validation checks. |
|||
- Improved and unified render graph profiling markers. |
|||
- Improved execution performance with Render Graph. |
|||
- Improved the resource pooling system in Render Graph. |
|||
- Improved `BeginRenderPass` CPU performance in the Native Render Pass Render Graph (URP). |
|||
- Made various improvements to Render Graph Viewer UX. |
|||
|
|||
### Fixed |
|||
- Improve reliability of shader variance list regex parser. Current parser includes time stamps which cause duplicates to not be parsed correctly. Changes improve regex parsing and sanitize the liens from the log (which include time stamps). |
|||
- Fixed amemory leak from NativeList in RenderGraph. |
|||
- Fixed some leaks / missing calls to Dispose() in GI probe baking code. |
|||
- Fixed an issue where Screen Space UI Overlay would not rendered again without a camera in URP/HDRP. |
|||
- Fixed issue where using BiRP-only Camera APIs with active SRP didn't display a warning as expected. |
|||
- Fixed issue where errors could be thrown by debug action registration if deleting all axes in Input Manager. |
|||
- Tier0 rendering ignores the scene visibility toggle. |
|||
- Rendering Debugger - Fixed Render Graph Debug Display Reset behaviour. |
|||
- Added CreateSkyboxRendererList in Render Graph API. |
|||
- Fixed `PackFloat2To8` in `packing.hlsl`. |
|||
- Fixed `DebugUI.Button` not working in Rendering Debugger runtime UI. |
|||
- Fix Render Graph Viewer generating warnings when RenderGraph.Begin/EndProfilingSampler functions are used |
|||
- Fixed Render Graph Viewer becoming empty on URP when selecting Project Settings > Graphics |
|||
- Fix Render Graph Viewer displaying incorrect store action reasoning for MSAA textures |
|||
|
|||
## [17.0.1] - 2023-12-21 |
|||
|
|||
This version is compatible with Unity 2023.3.0b2. |
|||
|
|||
### Added |
|||
|
|||
- API to manage global textures |
|||
- New useDynamicScaleExplicit flag to render graph's TextureDesc which can be used to control the underlying RenderTexture's dynamic scaling behavior |
|||
- Added `TEMPLATE_X_HALF` shader macros that define functions using `min16float` only. |
|||
- Added `TEMPLATE_X_FLT_HALF` shader macros that defines functions with both `min16float` and `float`. |
|||
- Foveated rendering API to fix FSR rendering |
|||
- new API that allows users to execute Scalable Temporal Post-Processing (STP) upscaling in a render graph. |
|||
|
|||
### Changed |
|||
|
|||
- Replaced DynamicArray with NativeList in NativeRenderPassCompiler to improve performance |
|||
- Improved CPU performance of Native Render Pass Render Graph compiler by 15-40% (combined with NativeList PR and other optimization) depending on the complexity of the rendering and the runtime device |
|||
- Merged rendergraph native render passes that have different depths. |
|||
- Added GPU Resident Drawer debug panel to display culling stats when Instanced Drawing is enabled. |
|||
- Added icons and fixed bugs in Render Graph Viewer. |
|||
- Prevented the unnecessary store op of MSAA buffers in URP when using Native Render Pass Render Graph. |
|||
- RenderGraphObjectPool is now 3x faster with RasterRenderRenderGraphPass objects by using UnityEngine.Pool |
|||
- Reducing AddRaster/Compute/UnsafeRenderPass Render Graph API CPU cost by not clearing anymore internal arrays. Now relying on handle IsValid() API instead. |
|||
- Validation checks of Render Graph can be enabled/disabled from the Editor. Enabled by default, disabling them slightly improves Render Graph performance. |
|||
|
|||
### Fixed |
|||
|
|||
- Bump MaxReaders |
|||
- Fixed CurrentPipelineHelpURLAttribute.URL returning null when render no pipeline is active, causing errors. |
|||
- Fix volume profile reset action in graphics settings |
|||
- Fix Remove All context action for Volume Profile not working in VolumeEditor |
|||
- Add XR for Lens Flare Data Driven |
|||
- Fixed left eye's Lens Flare light in XR |
|||
|
|||
## [17.0.0] - 2023-09-26 |
|||
|
|||
This version is compatible with Unity 2023.3.0a8. |
|||
|
|||
### Changed |
|||
|
|||
- Dumping in the temp folder the stripping of IRenderPipelineGraphicsSettings |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed an issue in the Rendering Debugger where APV was not shown on editor when `Strip runtime debug shaders` was enabled in the global settings. |
|||
- Fixed Stripping.meta corrupted metal file. |
|||
- When changing the _Global Settings_ asset, the UI was not being refreshed to and the old asset was being displayed. |
|||
- Allowing buffer read through NRP RenderGraph API. |
|||
|
|||
## [16.0.3] - 2023-07-04 |
|||
|
|||
This version is compatible with Unity 2023.3.0a1. |
|||
|
|||
### Added |
|||
|
|||
- RenderPipelineGraphicsSettings container. That allows stripping of IRenderPipelineGraphicsSettings. |
|||
|
|||
### Changed |
|||
|
|||
- Improved VolumeEditor UI |
|||
|
|||
### Fixed |
|||
|
|||
- Fix console errors when debug actions are removed from Input Manager during play mode |
|||
|
|||
## [16.0.2] - 2023-06-28 |
|||
|
|||
This version is compatible with Unity 2023.2.0a22. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed Rendering Debugger runtime UI getting occluded by user UI with sorting order larger than 0. |
|||
- Fixed potentially broken rendering and errors after renaming a VolumeProfile asset. |
|||
- Removed some unexpected SRP changed callback invocations. |
|||
- Fixed HDRP FrameSettings object changes getting lost during editing. |
|||
|
|||
## [16.0.1] - 2023-05-23 |
|||
|
|||
This version is compatible with Unity 2023.2.0a17. |
|||
|
|||
### Added |
|||
|
|||
- ObjectID Render Request that provides a render texture with the ObjectId of each pixel. |
|||
- Exposed VolumeProfileEditor as public. |
|||
- Added RenderPipelineGlobalSettingsUI::DrawVolumeProfileAssetField. |
|||
- Added VolumeComponentListEditor::SetIsGlobalDefaultVolumeProfile. |
|||
|
|||
### Changed |
|||
|
|||
- Added optimizations to Static APV for Mobile Devices. |
|||
|
|||
### Fixed |
|||
|
|||
- Rendering Debugger - Foldouts - Right Click anywhere on the foldout opens the context menu. |
|||
- Rendering Debugger - Foldouts - Left click on context menu collapsed/expand the foldout. |
|||
- Rendering Debugger - HotKeys- Fixed regression to open the Rendering Debugger with Ctrl + Backspace on standalone/player modes. |
|||
- Fixed SerializedBitArray behavior when editing multiple objects or values. (e.g. HDRP Frame Settings toggles working inconsistently) |
|||
- Fixed a crash on `keywords::LocalKeywordState::ResetWithSpace` when shader contains Grab Pass. |
|||
|
|||
## [16.0.0] - 2023-03-22 |
|||
|
|||
This version is compatible with Unity 2023.2.0a9. |
|||
|
|||
### Added |
|||
|
|||
- Common C# & Shader Code for Scalable Temporal Post-Processing Upscaler. |
|||
|
|||
### Changed |
|||
|
|||
- Unified the Create, Clone and Ensure workflows for RenderPipelineGlobalSettings. |
|||
|
|||
### Fixed |
|||
|
|||
- Updated the Render Graph documentation to reflect API changes. |
|||
- Fixed an IES Importer issue producing incorrect results. |
|||
- Fixed the Revert Property for animation curves on Volume Components so it now works correctly. |
|||
- Fixed Decal Projector Editor fields so they are now saved when editing a prefab. |
|||
|
|||
## [15.0.3] - 2022-12-02 |
|||
|
|||
This version is compatible with Unity 2023.2.0a1. |
|||
|
|||
### Added |
|||
|
|||
- Added HDR output utilities to handle keywords and shader stripping. |
|||
|
|||
### Changed |
|||
|
|||
- Deprecated the VolumeComponentMenuForRenderPipeline. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed volume profile field state when asset is removed. |
|||
- Fixed ColorCurves volume leaking Texture2D objects under certain circumstances. |
|||
- Fixed virtual offset pushing probes outside of geometry. |
|||
- Added Local mode to fit Probe Volumes to scene. |
|||
- Fixed APV so it is now present in the light explorer. |
|||
- Fixed reset of APV debug. |
|||
|
|||
## [15.0.2] - 2022-11-04 |
|||
|
|||
This version is compatible with Unity 2023.1.0a23. |
|||
|
|||
### Added |
|||
|
|||
- Extended RendererList to handle UI, WireFrame, CameraSetup and Gizmo draw. |
|||
- Added bigQuery Nested columns extensions. |
|||
|
|||
### Changed |
|||
|
|||
- Restructured the APV indirection buffer to decrease the amount of memory required when an high number of subdivision levels is used. |
|||
- Allow setting order for panels on the rendering debugger. |
|||
- Enabled VolumeComponent BoolParameter UI to display enabled/disabled dropdown instead of checkboxes. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed a FreeCamera printing an error when using old InputSystem. |
|||
- Fixed an issue where shaders from any SRP not are completely stripped when building for Built-in renderer. |
|||
- Fixed dropdowns for multiple editors. |
|||
- Fixed the behaviour preventing the bake to restart if probe volumes are changed while a bake has started. |
|||
- Fixed global probe volumes not fitting to all objects. |
|||
- Fixed shadow cascade editor so the snatches now appear and the gradient appearance is improved. |
|||
- Fixed missing subdivision label when looking at APV realtime subdivision preview. |
|||
- Updated the Volumes when the Volume Info is collapsed. |
|||
- Fixed changing current value by mouse click on DebugUI.ObjectFields on the runtime UI. |
|||
- Fixed missing documentation and documentation links on Rendering-Debugger and components used for the Runtime UI. |
|||
- Fixed popup showing multiple time when trying to remove additional data while in multi selection. |
|||
- Fixed VolumeComponent visibility without additional attributes. |
|||
- Fixed null exception while selecting a camera on the Rendering Debugger > Volumes > Camera. |
|||
|
|||
## [15.0.1] - 2022-08-04 |
|||
|
|||
This version is compatible with Unity 2023.1.0a19. |
|||
|
|||
### Added |
|||
|
|||
- An extension method to fetch the Render Pipeline assets from a BuildTarget. |
|||
- Added new XRSystem API to allow SRPs override the XR built-in stereo matrices. |
|||
|
|||
### Changed |
|||
|
|||
- Tooltips improvement across SRPs. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed a Volume Component Editor issue where Foldouts states were stored by position instead of state. |
|||
- Fixed a SerializedObjectNotCreatableException on Volume Component Editors. |
|||
- Fixed a null reference exception when settings null Render Pipeline Global settings on the Settings provider. |
|||
- Fixed a swaping Volume Component issue in a Volume profile when there was mixed pipeline Volume Components did not override correctly. |
|||
- Fixed a serialization error when Recovering Default Volume Profile after it was deleted from the project folder. |
|||
- Fixed an editor drawer for Value tuples in the Rendering Debugger. |
|||
- Fixed an issue where Asset Icons and MonoBehaviour for SRP's where not unified. |
|||
|
|||
## [15.0.0] - 2022-06-13 |
|||
|
|||
This version is compatible with Unity 2023.1.0a6. |
|||
|
|||
### Added |
|||
|
|||
- Extension method to fetch the Render Pipeline assets from a BuildTarget. |
|||
- New XRSystem API to allow SRPs override the XR built-in stereo matrices. |
|||
|
|||
### Changed |
|||
|
|||
- Improved performance of APV baking. |
|||
- Allow setting order for panels on the rendering debugger. |
|||
- Allow VolumeComponent BoolParameter UI to display enabled/disabled dropdown instead of checkboxes. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed the reset of APV volume placement when using multi selection. |
|||
- Fixed an issue so that APV dilated data not being written back to disk. |
|||
- Fixed realtime subdivision so it culls empty cells. |
|||
- Hid the warning on the reflection probe if you disable APV. |
|||
- Fixed so that data isn't cleared for probes to be dilated into, to avoid bright colored splotches. |
|||
- Fixed probes so that the max distance between then are respected. |
|||
- Fixed uninitialized memory for virtual offset. |
|||
- Fixed NaN when you bake high intensity lights. |
|||
- Fixed the APV touchup volume test so it uses OBB instead of AABB. |
|||
- Fixed null reference when you enable the Camera in a project with multiple SRPs installed. |
|||
- Volume Component Editor Foldouts states are now stored by type instead of by position. |
|||
- Fixed SerializedObjectNotCreatableException on Volume Component Editors. |
|||
- Fixed null reference exception when settings null Render Pipeline Global settings on the Settings provider. |
|||
- Fixed swapping Volume Component in a Volume profile with mixed pipeline Volume Components. |
|||
- Default Volume Profile can now be recovered when it is being deleted from the project folder. |
|||
- Fixed editor drawer for Value tuples in the Rendering Debugger. |
|||
- Fixed an issue where FreeCamera would print an error when using old InputSystem. |
|||
- Fixed missing subdivision label when looking at APV realtime subdivision preview. |
|||
- Fixed shadow cascade editor so the snatches now appear and the gradient appearance is improved. |
|||
- Fixed the behaviour preventing the bake to restart if probe volumes are changed while a bake has started. |
|||
- Fixed global probe volumes not fitting to all objects. |
|||
- Fixed dropdowns for multiple editors. |
|||
- Fixed Light Editor didn't apply changes to SerializedObject. |
|||
|
|||
## [14.0.3] - 2021-05-09 |
|||
|
|||
### Fixed |
|||
|
|||
- Added Shader Stripping Watcher so you get notifications when a Shader Variant is stripped. |
|||
|
|||
## [14.0.2] - 2021-02-04 |
|||
|
|||
### Added |
|||
|
|||
- Added new extension `TryRemoveElementsInRange` to remove a range of elements from a `IList`. |
|||
- Added error on ResourceReloader when attempting to use [ReloadGroup] on ScriptableObject. |
|||
- Added Screen Coordinates Override shader utilities. |
|||
- Added API to blend between baking states for Probe Volumes. |
|||
- Aded explicit control over scenario blending factor and a debug mode for visualization. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed texture gather macros for GLCore and moved them from target 4.6 to target 4.5. |
|||
- Fixed cubemap array macros for GLCore. |
|||
- Fixed regression on ResourceReloader due to change for supporting built-in resources. |
|||
- Fixed issue with debug markers in Unity Profiler in deep profiler mode |
|||
|
|||
## [14.0.1] - 2021-12-07 |
|||
|
|||
### Added |
|||
|
|||
- Linear version of function that sets FSR RCAS shader constants |
|||
- `DebugUI.ObjectPopupField` to render a list of `UnityEngine.Objects` as a popup on the Rendering Debugger. |
|||
- Add probe volume influence weight parameter |
|||
- Added support for multiple Baking States to Prove Volumes. |
|||
- Hidding Volume Components not available for the current pipeline on the Volume Profile Inspector. |
|||
|
|||
### Changed |
|||
|
|||
- Volume Component editor are now specified by `CustomEditorAttribute` instead of `VolumeComponentEditorAttribute`. |
|||
|
|||
### Fixed |
|||
|
|||
- The Volume Panel on the Rendering Debugger was not corretly showing cameras when they were added or deleted. |
|||
- Fixed issue in DynamicResolutionHandler when camera request was turned off at runtime, the ScalableBufferManager would leak state and not unset DRS state (case 1383093). |
|||
- Fixed undo in for `DebugUI.EnumFields` on the rendering debugger. (case 1386964) |
|||
- Fixed `DebugUI.Enum` fields collapsing their parent `DebugUI.Foldout` |
|||
- Fixed IES profile importer handling of overflow (outside 0-1 range) of attenutation splines values. |
|||
- Fixed issue with Probe Volume Baking window incorrectly displaying the icon for probe volumes in scenes that don't contain probe volumes. |
|||
- Fixed unnecessary memory allocation inside FSR's RCAS shader constants helper function. |
|||
- Fixed the issue with the special Turkish i, when looking for the m_IsGlobal property in VolumeEditor. (case 1276892) |
|||
|
|||
## [14.0.0] - 2021-11-17 |
|||
|
|||
### Added |
|||
|
|||
- Context menu on Volume Parameters to restore them to their default values. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed XR support in CoreUtils.DrawFullscreen function. |
|||
|
|||
### Changed |
|||
|
|||
- Removed FSR_ENABLE_16BIT option from FSRCommon.hlsl. The 16-bit FSR implementation is now automatically enabled when supported by the target platform. |
|||
|
|||
## [13.1.2] - 2021-11-05 |
|||
|
|||
### Added |
|||
|
|||
- Added function to allocate RTHandles using `RenderTextureDescriptor`. |
|||
- Added `vrUsage` support for RTHandles allocation. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed issue when changing volume profiles at runtime with a script (case 1364256). |
|||
- Fixed XR support in CoreUtils.DrawFullscreen function. |
|||
- Fixed an issue causing Render Graph execution errors after a random amount of time. |
|||
|
|||
## [13.1.1] - 2021-10-04 |
|||
|
|||
### Added |
|||
|
|||
- Added support for high performant unsafe (uint only) Radix, Merge and Insertion sort algorithms on CoreUnsafeUtils. |
|||
- Added DebugFrameTiming class that can be used by render pipelines to display CPU/GPU frame timings and bottlenecks in Rendering Debugger. |
|||
- Added new DebugUI widget types: ProgressBarValue and ValueTuple |
|||
- Added common support code for FSR. |
|||
- Added new `RenderPipelineGlobalSettingsProvider` to help adding a settings panel for editing global settings. |
|||
- Added blending for curves in post processing volumes. |
|||
- New extension for Render Pipeline Global Settings for shader variants settings -> `IShaderVariantsSettings`. |
|||
|
|||
## [13.1.0] - 2021-09-24 |
|||
|
|||
### Added |
|||
|
|||
- Debug Panels Framework See `IDebugDisplaySettingsQuery`. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed keyword and float property upgrading in SpeedTree8MaterialUpgrader |
|||
|
|||
## [13.0.0] - 2021-09-01 |
|||
|
|||
Version Updated |
|||
The version number for this package has increased due to a version update of a related graphics package. |
|||
|
|||
### Added |
|||
|
|||
- New `IVolumeDebugSettings` interface and `VolumeDebugSettings<T>` class that stores the information for the Volumes Debug Panel. |
|||
- Added AMD FidelityFX shaders which were originally in HDRP |
|||
- Added support for high performant unsafe (uint only) Radix, Merge and Insertion sort algorithms on CoreUnsafeUtils. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed black pixel issue in AMD FidelityFX RCAS implementation |
|||
- Fixed a critical issue on android devices & lens flares. Accidentally creating a 16 bit texture was causing gpus not supporting them to fail. |
|||
- Fixed serialization of DebugStateFlags, the internal Enum was not being serialized. |
|||
|
|||
## [12.0.0] - 2021-01-11 |
|||
|
|||
### Added |
|||
|
|||
- Support for the PlayStation 5 platform has been added. |
|||
- Support for additional properties for Volume Components without custom editor |
|||
- Added VolumeComponentMenuForRenderPipelineAttribute to specify a volume component only for certain RenderPipelines. |
|||
- Calculating correct rtHandleScale by considering the possible pixel rounding when DRS is on |
|||
- Support for the PlayStation 5 platform has been added. |
|||
- Support for the XboxSeries platform has been added. |
|||
- Added Editor window that allow showing an icon to browse the documentation |
|||
- New method DrawHeaders for VolumeComponentsEditors |
|||
- Unification of Material Editor Headers Scopes |
|||
- New API functions with no side effects in DynamicResolutionHandler, to retrieve resolved drs scale and to apply DRS on a size. |
|||
- Added helper for Volumes (Enable All Overrides, Disable All Overrides, Remove All Overrides). |
|||
- Added a blitter utility class. Moved from HDRP to RP core. |
|||
- Added a realtime 2D texture atlas utility classes. Moved from HDRP to RP core. |
|||
- New methods on CoreEditorDrawers, to allow adding a label on a group before rendering the internal drawers |
|||
- Method to generate a Texture2D of 1x1 with a plain color |
|||
- Red, Green, Blue Texture2D on CoreEditorStyles |
|||
- New API in DynamicResolutionHandler to handle multicamera rendering for hardware mode. Changing cameras and resetting scaling per camera should be safe. |
|||
- Added SpeedTree8MaterialUpgrader, which provides utilities for upgrading and importing SpeedTree 8 assets to scriptable render pipelines. |
|||
- Adding documentation links to Light Sections |
|||
- Support for Lens Flare Data Driven (from images and Procedural shapes), on HDRP |
|||
- New SRPLensFlareData Asset |
|||
- Adding documentation links to Light Sections. |
|||
- Added sampling noise to probe volume sampling position to hide seams between subdivision levels. |
|||
- Added DebugUI.Foldout.isHeader property to allow creating full-width header foldouts in Rendering Debugger. |
|||
- Added DebugUI.Flags.IsHidden to allow conditional display of widgets in Rendering Debugger. |
|||
- Added "Expand/Collapse All" buttons to Rendering Debugger window menu. |
|||
- Added mouse & touch input support for Rendering Debugger runtime UI, and fix problems when InputSystem package is used. |
|||
- Add automatic spaces to enum display names used in Rendering Debugger and add support for InspectorNameAttribute. |
|||
- Adding new API functions inside DynamicResolutionHandler to get mip bias. This allows dynamic resolution scaling applying a bias on the frame to improve on texture sampling detail. |
|||
- Added a reminder if the data of probe volume might be obsolete. |
|||
- Added new API function inside DynamicResolutionHandler and new settings in GlobalDynamicResolutionSettings to control low res transparency thresholds. This should help visuals when the screen percentage is too low. |
|||
- Added common include file for meta pass functionality (case 1211436) |
|||
- Added OverridablePropertyScope (for VolumeComponentEditor child class only) to handle the Additional Property, the override checkbox and disable display and decorator attributes in one scope. |
|||
- Added IndentLevelScope (for VolumeComponentEditor child class only) to handle indentation of the field and the checkbox. |
|||
- Added an option to change the visibilty of the Volumes Gizmos (Solid, Wireframe, Everything), available at Preferences > Core Render Pipeline |
|||
- Added class for drawing shadow cascades `UnityEditor.Rendering.ShadowCascadeGUI.DrawShadowCascades`. |
|||
- Added UNITY_PREV_MATRIX_M and UNITY_PREV_MATRIX_I_M shader macros to support instanced motion vector rendering |
|||
- Added new API to customize the rtHandleProperties of a particular RTHandle. This is a temporary work around to assist with viewport setup of Custom post process when dealing with DLSS or TAAU |
|||
- Added `IAdditionalData` interface to identify the additional datas on the core package. |
|||
- Added new API to draw color temperature for Lights. |
|||
|
|||
### Fixed |
|||
|
|||
- Help boxes with fix buttons do not crop the label. |
|||
- Fixed missing warning UI about Projector component being unsupported (case 1300327). |
|||
- Fixed the display name of a Volume Parameter when is defined the attribute InspectorName |
|||
- Calculating correct rtHandleScale by considering the possible pixel rounding when DRS is on |
|||
- Problem on domain reload of Volume Parameter Ranges and UI values |
|||
- Fixed Right Align of additional properties on Volume Components Editors |
|||
- Fixed normal bias field of reference volume being wrong until the profile UI was displayed. |
|||
- Fixed L2 for Probe Volumes. |
|||
- When adding Overrides to the Volume Profile, only show Volume Components from the current Pipeline. |
|||
- Fixed assertion on compression of L1 coefficients for Probe Volume. |
|||
- Explicit half precision not working even when Unified Shader Precision Model is enabled. |
|||
- Fixed ACES filter artefact due to half float error on some mobile platforms. |
|||
- Fixed issue displaying a warning of different probe reference volume profiles even when they are equivalent. |
|||
- Fixed missing increment/decrement controls from DebugUIIntField & DebugUIUIntField widget prefabs. |
|||
- Fixed IES Importer related to new API on core. |
|||
- Fixed a large, visible stretch ratio in a LensFlare Image thumbnail. |
|||
- Fixed Undo from script refreshing thumbnail. |
|||
- Fixed cropped thumbnail for Image with non-uniform scale and rotation |
|||
- Skip wind calculations for Speed Tree 8 when wind vector is zero (case 1343002) |
|||
- Fixed memory leak when changing SRP pipeline settings, and having the player in pause mode. |
|||
- Fixed alignment in Volume Components |
|||
- Virtual Texturing fallback texture sampling code correctly honors the enableGlobalMipBias when virtual texturing is disabled. |
|||
- Fixed LightAnchor too much error message, became a HelpBox on the Inspector. |
|||
- Fixed library function SurfaceGradientFromTriplanarProjection to match the mapping convention used in SampleUVMappingNormalInternal.hlsl and fix its description. |
|||
- Fixed Volume Gizmo size when rescaling parent GameObject |
|||
- Fixed rotation issue now all flare rotate on positive direction (1348570) |
|||
- Fixed error when change Lens Flare Element Count followed by undo (1346894) |
|||
- Fixed Lens Flare Thumbnails |
|||
- Fixed Lens Flare 'radialScreenAttenuationCurve invisible' |
|||
- Fixed Lens Flare rotation for Curve Distribution |
|||
- Fixed potentially conflicting runtime Rendering Debugger UI command by adding an option to disable runtime UI altogether (1345783). |
|||
- Fixed Lens Flare position for celestial at very far camera distances. It now locks correctly into the celestial position regardless of camera distance (1363291) |
|||
- Fixed issues caused by automatically added EventSystem component, required to support Rendering Debugger Runtime UI input. (1361901) |
|||
|
|||
### Changed |
|||
|
|||
- Improved the warning messages for Volumes and their Colliders. |
|||
- Changed Window/Render Pipeline/Render Pipeline Debug to Window/Analysis/Rendering Debugger |
|||
- Changed Window/Render Pipeline/Look Dev to Window/Analysis/Look Dev |
|||
- Changed Window/Render Pipeline/Render Graph Viewer to Window/Analysis/Render Graph Viewer |
|||
- Changed Window/Render Pipeline/Graphics Compositor to Window/Rendering/Graphics Compositor |
|||
- Volume Gizmo Color setting is now under Colors->Scene->Volume Gizmo |
|||
- Volume Gizmo alpha changed from 0.5 to 0.125 |
|||
- Moved Edit/Render Pipeline/Generate Shader Includes to Edit/Rendering/Generate Shader Includes |
|||
- Moved Assets/Create/LookDev/Environment Library to Assets/Create/Rendering/Environment Library (Look Dev) |
|||
- Changed Nintendo Switch specific half float fixes in color conversion routines to all platforms. |
|||
- Improved load asset time for probe volumes. |
|||
- ClearFlag.Depth does not implicitely clear stencil anymore. ClearFlag.Stencil added. |
|||
- The RTHandleSystem no longer requires a specific number of sample for MSAA textures. Number of samples can be chosen independently for all textures. |
|||
- Platform ShaderLibrary API headers now have a new macro layer for 2d texture sampling macros. This layer starts with PLATFORM_SAMPLE2D definition, and it gives the possibility of injecting sampling behavior on a render pipeline level. For example: being able to a global mip bias for temporal upscalers. |
|||
- Update icon for IES, LightAnchor and LensFlare |
|||
- LensFlare (SRP) can be now disabled per element |
|||
- LensFlare (SRP) tooltips now refer to meters. |
|||
- Serialize the Probe Volume asset as binary to improve footprint on disk and loading speed. |
|||
- LensFlare Element editor now have Thumbnail preview |
|||
- Improved IntegrateLDCharlie() to use uniform stratified sampling for faster convergence towards the ground truth |
|||
- DynamicResolutionHandler.GetScaledSize function now clamps, and never allows to return a size greater than its input. |
|||
- Removed DYNAMIC_RESOLUTION snippet on lens flare common shader. Its not necessary any more on HDRP, which simplifies the shader. |
|||
- Made occlusion Radius for lens flares in directional lights, be independant of the camera's far plane. |
|||
|
|||
## [11.0.0] - 2020-10-21 |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed the default background color for previews to use the original color. |
|||
- Fixed spacing between property fields on the Volume Component Editors. |
|||
- Fixed ALL/NONE to maintain the state on the Volume Component Editors. |
|||
- Fixed the selection of the Additional properties from ALL/NONE when the option "Show additional properties" is disabled |
|||
- Fixed ACES tonemaping for Nintendo Switch by forcing some shader color conversion functions to full float precision. |
|||
- Fixed a bug in FreeCamera which would only provide a speed boost for the first frame when pressing the Shfit key. |
|||
|
|||
### Added |
|||
|
|||
- New View Lighting Tool, a component which allow to setup light in the camera space |
|||
- New function in GeometryTools.hlsl to calculate triangle edge and full triangle culling. |
|||
- Several utils functions to access SphericalHarmonicsL2 in a more verbose and intuitive fashion. |
|||
|
|||
## [10.2.0] - 2020-10-19 |
|||
|
|||
Version Updated |
|||
The version number for this package has increased due to a version update of a related graphics package. |
|||
|
|||
## [10.1.0] - 2020-10-12 |
|||
|
|||
### Added |
|||
|
|||
- Added context options "Move to Top", "Move to Bottom", "Expand All" and "Collapse All" for volume components. |
|||
- Added the support of input system V2 |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed the scene view to scale correctly when hardware dynamic resolution is enabled (case 1158661) |
|||
- Fixed game view artifacts on resizing when hardware dynamic resolution was enabled |
|||
- Fixed issue that caused `UNITY_REVERSED_Z` and `UNITY_UV_STARTS_AT_TOP` being defined in platforms that don't support it. |
|||
|
|||
### Changed |
|||
|
|||
- LookDev menu item entry is now disabled if the current pipeline does not support it. |
|||
|
|||
## [10.0.0] - 2019-06-10 |
|||
|
|||
### Added |
|||
|
|||
- Add rough version of ContextualMenuDispatcher to solve conflict amongst SRP. |
|||
- Add api documentation for TextureCombiner. |
|||
- Add tooltips in LookDev's toolbar. |
|||
- Add XRGraphicsAutomatedTests helper class. |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed compile errors for platforms with no VR support |
|||
- Replaced reference to Lightweight Render Pipeline by Universal Render Pipeline in the package description |
|||
- Fixed LighProbes when using LookDev. |
|||
- Fix LookDev minimal window size. |
|||
- Fix object rotation at instentiation to keep the one in prefab or used in hierarchy. |
|||
- Fixed shader compile errors when trying to use tessellation shaders with PlayStation VR on PS4. |
|||
- Fixed shader compile errors about LODDitheringTransition not being supported in GLES2. |
|||
- Fix `WaveIsFirstLane()` to ignore helper lanes in fragment shaders on PS4. |
|||
- Fixed a bug where Unity would crash if you tried to remove a Camera component from a GameObject using the Inspector window, while other components dependended on the Camera component. |
|||
- Fixed errors due to the debug menu when enabling the new input system. |
|||
- Fix LookDev FPS manipulation in view |
|||
- Fix LookDev zoom being stuck when going near camera pivot position |
|||
- Fix LookDev manipulation in view non responsive if directly using an HDRI |
|||
- Fix LookDev behaviour when user delete the EnvironmentLibrary asset |
|||
- Fix LookDev SunPosition button position |
|||
- Fix LookDev EnvironmentLibrary tab when asset is deleted |
|||
- Fix LookDev used Cubemap when asset is deleted |
|||
- Fixed the definition of `rcp()` for GLES2. |
|||
- Fixed copy/pasting of Volume Components when loading a new scene |
|||
- Fix LookDev issue when adding a GameObject containing a Volume into the LookDev's view. |
|||
- Fixed duplicated entry for com.unity.modules.xr in the runtime asmdef file |
|||
- Fixed the texture curve being destroyed from another thread than main (case 1211754) |
|||
- Fixed unreachable code in TextureXR.useTexArray |
|||
- Fixed GC pressure caused by `VolumeParameter<T>.GetHashCode()` |
|||
- Fixed issue when LookDev window is opened and the CoreRP Package is updated to a newer version. |
|||
- Fix LookDev's camera button layout. |
|||
- Fix LookDev's layout vanishing on domain reload. |
|||
- Fixed issue with the shader TransformWorldToHClipDir function computing the wrong result. |
|||
- Fixed division by zero in `V_SmithJointGGX` function. |
|||
- Fixed null reference exception in LookDev when setting the SRP to one not implementing LookDev (case 1245086) |
|||
- Fix LookDev's undo/redo on EnvironmentLibrary (case 1234725) |
|||
- Fix a compil error on OpenGL ES2 in directional lightmap sampling shader code |
|||
- Fix hierarchicalbox gizmo outside facing check in symetry or homothety mode no longer move the center |
|||
- Fix artifacts on Adreno 630 GPUs when using ACES Tonemapping |
|||
- Fixed a null ref in the volume component list when there is no volume components in the project. |
|||
- Fixed issue with volume manager trying to access a null volume. |
|||
- HLSL codegen will work with C# file using both the `GenerateHLSL` and C# 7 features. |
|||
|
|||
### Changed |
|||
|
|||
- Restored usage of ENABLE_VR to fix compilation errors on some platforms. |
|||
- Only call SetDirty on an object when actually modifying it in SRP updater utility |
|||
- Set depthSlice to -1 by default on SetRenderTarget() to clear all slices of Texture2DArray by default. |
|||
- ResourceReloader will now add additional InvalidImport check while it cannot load due to AssetDatabase not available. |
|||
- Replaced calls to deprecated PlayerSettings.virtualRealitySupported property. |
|||
- Enable RWTexture2D, RWTexture2DArray, RWTexture3D in gles 3.1 |
|||
- Updated macros to be compatible with the new shader preprocessor. |
|||
- Updated shaders to be compatible with Microsoft's DXC. |
|||
- Changed CommandBufferPool.Get() to create an unnamed CommandBuffer. (No profiling markers) |
|||
- Deprecating VolumeComponentDeprecad, using HideInInspector or Obsolete instead |
|||
|
|||
## [7.1.1] - 2019-09-05 |
|||
|
|||
### Added |
|||
|
|||
- Add separated debug mode in LookDev. |
|||
|
|||
### Changed |
|||
|
|||
- Replaced usage of ENABLE_VR in XRGraphics.cs by a version define (ENABLE_VR_MODULE) based on the presence of the built-in VR module |
|||
- `ResourceReloader` now works on non-public fields. |
|||
- Removed `normalize` from `UnpackNormalRGB` to match `UnpackNormalAG`. |
|||
- Fixed shadow routines compilation errors when "real" type is a typedef on "half". |
|||
- Removed debug menu in non development build. |
|||
|
|||
## [7.0.1] - 2019-07-25 |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed a precision issue with the ACES tonemapper on mobile platforms. |
|||
|
|||
## [7.0.0] - 2019-07-17 |
|||
|
|||
### Added |
|||
|
|||
- First experimental version of the LookDev. Works with all SRP. Only branched on HDRP at the moment. |
|||
- LookDev out of experimental |
|||
|
|||
## [6.7.0-preview] - 2019-05-16 |
|||
|
|||
## [6.6.0] - 2019-04-01 |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed compile errors in XRGraphics.cs when ENABLE_VR is not defined |
|||
|
|||
## [6.5.0] - 2019-03-07 |
|||
|
|||
## [6.4.0] - 2019-02-21 |
|||
|
|||
### Added |
|||
|
|||
- Enabled support for CBUFFER on OpenGL Core and OpenGL ES 3 backends. |
|||
|
|||
## [6.3.0] - 2019-02-18 |
|||
|
|||
## [6.2.0] - 2019-02-15 |
|||
|
|||
## [6.1.0] - 2019-02-13 |
|||
|
|||
## [6.0.0] - 2019-02-23 |
|||
|
|||
### Fixed |
|||
|
|||
- Fixed a typo in ERROR_ON_UNSUPPORTED_FUNCTION() that was causing the shader compiler to run out of memory in GLES2. [Case 1104271] (https://issuetracker.unity3d.com/issues/mobile-os-restarts-because-of-high-memory-usage-when-compiling-shaders-for-opengles2) |
|||
|
|||
## [5.2.0] - 2018-11-27 |
|||
|
|||
## [5.1.0] - 2018-11-19 |
|||
|
|||
### Added |
|||
|
|||
- Added a define for determining if any instancing path is taken. |
|||
|
|||
### Changed |
|||
|
|||
- The Core SRP package is no longer in preview. |
|||
|
|||
## [5.0.0-preview] - 2018-10-18 |
|||
|
|||
### Changed |
|||
|
|||
- XRGraphicConfig has been changed from a read-write control of XRSettings to XRGraphics, a read-only accessor to XRSettings. This improves consistency of XR behavior between the legacy render pipeline and SRP. |
|||
- XRGraphics members have been renamed to match XRSettings, and XRGraphics has been modified to only contain accessors potentially useful to SRP |
|||
- You can now have up to 16 additional shadow-casting lights. |
|||
|
|||
### Fixed |
|||
|
|||
- LWRP no longer executes shadow passes when there are no visible shadow casters in a Scene. Previously, this made the Scene render as too dark, overall. |
|||
|
|||
## [4.0.0-preview] - 2018-09-28 |
|||
|
|||
### Added |
|||
|
|||
- Space transform functions are now defined in `ShaderLibrary/SpaceTransforms.hlsl`. |
|||
|
|||
### Changed |
|||
|
|||
- Removed setting shader inclue path via old API, use package shader include paths |
|||
|
|||
## [3.3.0] - 2018-01-01 |
|||
|
|||
## [3.2.0] - 2018-01-01 |
|||
|
|||
## [3.1.0] - 2018-01-01 |
|||
|
|||
### Added |
|||
|
|||
- Add PCSS shadow filter |
|||
- Added Core EditMode tests |
|||
- Added Core unsafe utilities |
|||
|
|||
### Improvements |
|||
|
|||
- Improved volume UI & styling |
|||
- Fixed CoreUtils.QuickSort infinite loop when two elements in the list are equals. |
|||
|
|||
### Changed |
|||
|
|||
- Moved root files into folders for easier maintenance |
|||
@ -0,0 +1,7 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 20456a2cc8a214f9d9846725cff9fea4 |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 50e0a64c6fdb90f48a1dbcfa7af69056 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,113 @@ |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
[assembly: InternalsVisibleTo("Unity.RenderPipelines.HighDefinition.Editor")] |
|||
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Universal.Editor")] |
|||
|
|||
|
|||
//WARNING:
|
|||
// Remember to only use this shared API to cherry pick the code part that you want to
|
|||
// share but not go directly in user codebase project.
|
|||
// Every new entry here should be discussed. It is always better to have good public API.
|
|||
// Don't add logic in this assemblie. It is only to share private methods. Only redirection allowed.
|
|||
|
|||
|
|||
/*EXAMPLE: |
|||
//In Unity.RenderPipeline.Core.Editor:
|
|||
namespace TestNamespace |
|||
{ |
|||
public class PublicType |
|||
{ |
|||
internal static void StaticDoSomething() { } |
|||
internal void InstanceDoSomething() { } |
|||
} |
|||
|
|||
internal class InternalType |
|||
{ |
|||
internal static void StaticDoSomething() { } |
|||
internal void InstanceDoSomething() { } |
|||
} |
|||
} |
|||
|
|||
|
|||
//In Unity.RenderPipeline.Core.Editor.Shared:
|
|||
namespace TestNamespace.Shared |
|||
{ |
|||
internal static class PublicType |
|||
{ |
|||
public static void StaticDoSomething() |
|||
=> TestNamespace.PublicType.StaticDoSomething(); |
|||
|
|||
public static void InstanceDoSomething(TestNamespace.PublicType publicType) |
|||
=> publicType.InstanceDoSomething(); |
|||
|
|||
internal struct Wrapper |
|||
{ |
|||
TestNamespace.PublicType m_wrapped; |
|||
|
|||
public Wrapper(TestNamespace.PublicType publicTypeInstance) |
|||
=> m_wrapped = publicTypeInstance; |
|||
|
|||
public void InstanceDoSomething() |
|||
=> m_wrapped.InstanceDoSomething(); |
|||
} |
|||
} |
|||
|
|||
|
|||
internal static class InternalType |
|||
{ |
|||
public static void StaticDoSomething() |
|||
=> TestNamespace.InternalType.StaticDoSomething(); |
|||
|
|||
public static void InstanceDoSomething(object objectCastedInternalType) |
|||
=> (objectCastedInternalType as TestNamespace.InternalType).InstanceDoSomething(); |
|||
|
|||
internal struct Wrapper |
|||
{ |
|||
TestNamespace.InternalType m_wrapped; |
|||
|
|||
public Wrapper(object objectCastedInternalType) |
|||
=> m_wrapped = objectCastedInternalType as TestNamespace.InternalType; |
|||
|
|||
public void InstanceDoSomething() |
|||
=> m_wrapped.InstanceDoSomething(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
//In Unity.RenderPipeline.Universal.Editor:
|
|||
class TestPrivateAPIShared |
|||
{ |
|||
void CallStaticMethodOfPublicType() |
|||
=> TestNamespace.Shared.PublicType.StaticDoSomething(); |
|||
|
|||
void CallInstanceMethodOfPublicTypeThroughStatic() |
|||
{ |
|||
var instance = new TestNamespace.PublicType(); |
|||
TestNamespace.Shared.PublicType.InstanceDoSomething(instance); |
|||
} |
|||
|
|||
void CallInstanceMethodOfPublicTypeThroughWrapper() |
|||
{ |
|||
var instance = new TestNamespace.PublicType(); |
|||
var wrapper = new TestNamespace.Shared.PublicType.Wrapper(instance); |
|||
wrapper.InstanceDoSomething(); |
|||
} |
|||
|
|||
void CallStaticMethodOfInternalType() |
|||
=> TestNamespace.Shared.InternalType.StaticDoSomething(); |
|||
|
|||
void CallInstanceMethodOfInternalTypeThroughStatic() |
|||
{ |
|||
var instance = new object(); //get the object via an API instead
|
|||
TestNamespace.Shared.InternalType.InstanceDoSomething(instance); |
|||
} |
|||
|
|||
void CallInstanceMethodOfInternalTypeThroughWrapper() |
|||
{ |
|||
var instance = new object(); //get the object via an API instead
|
|||
var wrapper = new TestNamespace.Shared.InternalType.Wrapper(instance); |
|||
wrapper.InstanceDoSomething(); |
|||
} |
|||
} |
|||
*/ |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 18baba7656dce1149bf3937e025993fa |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,18 @@ |
|||
{ |
|||
"name": "Unity.RenderPipelines.Core.Editor.Shared", |
|||
"rootNamespace": "", |
|||
"references": [ |
|||
"GUID:3eae0364be2026648bf74846acb8a731" |
|||
], |
|||
"includePlatforms": [ |
|||
"Editor" |
|||
], |
|||
"excludePlatforms": [], |
|||
"allowUnsafeCode": true, |
|||
"overrideReferences": false, |
|||
"precompiledReferences": [], |
|||
"autoReferenced": true, |
|||
"defineConstraints": [], |
|||
"versionDefines": [], |
|||
"noEngineReferences": false |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 2a69708d171a17043a9d0ad45f205cfe |
|||
AssemblyDefinitionImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,9 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 74ae8146f4a01491ba1306f3db78139d |
|||
folderAsset: yes |
|||
timeCreated: 1479851675 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: d51fac0e1a1a7074ab4397427e551ea5 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,369 @@ |
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using System.Globalization; |
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEngine.Analytics; |
|||
using UnityEngine.Pool; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Set of utilities for analytics
|
|||
/// </summary>
|
|||
public static class AnalyticsUtils |
|||
{ |
|||
const string k_VendorKey = "unity.srp"; |
|||
|
|||
internal static void SendData(IAnalytic analytic) |
|||
{ |
|||
EditorAnalytics.SendAnalytic(analytic); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets a list of the serializable fields of the given type
|
|||
/// </summary>
|
|||
/// <param name="type">The type to get fields that are serialized.</param>
|
|||
/// <param name="removeObsolete">If obsolete fields are taken into account</param>
|
|||
/// <returns>The collection of <see cref="FieldInfo"/> that are serialized for this type</returns>
|
|||
public static IEnumerable<FieldInfo> GetSerializableFields(this Type type, bool removeObsolete = false) |
|||
{ |
|||
var members = type.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); |
|||
|
|||
if (type.BaseType != null && type.BaseType != typeof(object)) |
|||
{ |
|||
foreach (FieldInfo field in type.BaseType.GetSerializableFields()) |
|||
{ |
|||
yield return field; |
|||
} |
|||
} |
|||
|
|||
foreach (var member in members) |
|||
{ |
|||
if (member.MemberType != MemberTypes.Field && member.MemberType != MemberTypes.Property) |
|||
{ |
|||
continue; |
|||
} |
|||
|
|||
if (member.DeclaringType != type || member is not FieldInfo field) |
|||
{ |
|||
continue; |
|||
} |
|||
|
|||
if (removeObsolete && member.GetCustomAttribute<ObsoleteAttribute>() != null) |
|||
continue; |
|||
|
|||
if (field.IsPublic) |
|||
{ |
|||
if (member.GetCustomAttribute<NonSerializedAttribute>() != null) |
|||
continue; |
|||
|
|||
yield return field; |
|||
} |
|||
else |
|||
{ |
|||
if (member.GetCustomAttribute<SerializeField>() != null) |
|||
yield return field; |
|||
} |
|||
} |
|||
} |
|||
|
|||
static bool AreArraysDifferent(IList a, IList b) |
|||
{ |
|||
if ((a == null) && (b == null)) |
|||
return false; |
|||
|
|||
if ((a == null) ^ (b == null)) |
|||
return true; |
|||
|
|||
if (a.Count != b.Count) |
|||
return true; |
|||
for (int i = 0; i < a.Count; i++) |
|||
{ |
|||
if (!a[i].Equals(b[i])) |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
static string DumpValues(this IList list) |
|||
{ |
|||
using (ListPool<string>.Get(out var tempList)) |
|||
{ |
|||
for (int i = 0; i < list.Count; i++) |
|||
{ |
|||
tempList.Add(list[i] != null ? list[i].ToString() : "null"); |
|||
} |
|||
|
|||
var arrayValues = string.Join(",", tempList); |
|||
return $"[{arrayValues}]"; |
|||
} |
|||
} |
|||
|
|||
static Dictionary<string, string> DumpValues(Type type, object current) |
|||
{ |
|||
var diff = new Dictionary<string, string>(); |
|||
|
|||
foreach (var field in type.GetSerializableFields(removeObsolete: true)) |
|||
{ |
|||
var t = field.FieldType; |
|||
try |
|||
{ |
|||
if (typeof(ScriptableObject).IsAssignableFrom(t)) |
|||
continue; |
|||
|
|||
var valueCurrent = current != null ? field.GetValue(current) : null; |
|||
|
|||
if (t == typeof(string)) |
|||
{ |
|||
var stringCurrent = (string)valueCurrent; |
|||
diff[field.Name] = stringCurrent; |
|||
} |
|||
else if (t.IsPrimitive || t.IsEnum) |
|||
{ |
|||
diff[field.Name] = ConvertPrimitiveWithInvariants(valueCurrent); |
|||
} |
|||
else if (t.IsArray && valueCurrent is IList valueCurrentList) |
|||
{ |
|||
diff[field.Name] = valueCurrentList.DumpValues(); |
|||
} |
|||
else if (t.IsClass || t.IsValueType) |
|||
{ |
|||
if (valueCurrent is IEnumerable ea) |
|||
continue; // List<T> not supported
|
|||
|
|||
var subDiff = DumpValues(t, valueCurrent); |
|||
foreach (var d in subDiff) |
|||
{ |
|||
diff[field.Name + "." + d.Key] = d.Value; |
|||
} |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Debug.LogError($"Exception found while parsing {field}, {ex}"); |
|||
} |
|||
} |
|||
|
|||
return diff; |
|||
} |
|||
|
|||
static Dictionary<string, string> GetDiffAsDictionary(Type type, object current, object defaults) |
|||
{ |
|||
var diff = new Dictionary<string, string>(); |
|||
|
|||
foreach (var field in type.GetSerializableFields()) |
|||
{ |
|||
var fieldType = field.FieldType; |
|||
if (!IsFieldIgnored(fieldType)) |
|||
AddDiff(current, defaults, field, fieldType, diff); |
|||
} |
|||
|
|||
return diff; |
|||
} |
|||
|
|||
private static void AddDiff(object current, object defaults, FieldInfo field, Type fieldType, Dictionary<string, string> diff) |
|||
{ |
|||
try |
|||
{ |
|||
var valueCurrent = current != null ? field.GetValue(current) : null; |
|||
var valueDefault = defaults != null ? field.GetValue(defaults) : null; |
|||
AddIfDifferent(field, fieldType, diff, valueCurrent, valueDefault); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Debug.LogError($"Exception found while parsing {field}, {ex}"); |
|||
} |
|||
} |
|||
|
|||
private static void AddIfDifferent(FieldInfo field, Type fieldType, Dictionary<string, string> diff, object valueCurrent, object valueDefault) |
|||
{ |
|||
if (!AreValuesEqual(fieldType, valueCurrent, valueDefault)) |
|||
{ |
|||
if (IsComplexType(fieldType)) |
|||
{ |
|||
var subDiff = GetDiffAsDictionary(fieldType, valueCurrent, valueDefault); |
|||
foreach (var d in subDiff) |
|||
{ |
|||
diff[$"{field.Name}.{d.Key}"] = d.Value; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
diff[field.Name] = ConvertValueToString(valueCurrent); |
|||
} |
|||
} |
|||
} |
|||
|
|||
static bool IsFieldIgnored(Type fieldType) |
|||
{ |
|||
return fieldType.GetCustomAttribute<ObsoleteAttribute>() != null || typeof(ScriptableObject).IsAssignableFrom(fieldType); |
|||
} |
|||
|
|||
internal static bool AreValuesEqual(Type fieldType, object valueCurrent, object valueDefault) |
|||
{ |
|||
if (fieldType == typeof(string)) |
|||
return (string)valueCurrent == (string)valueDefault; |
|||
|
|||
if (fieldType.IsPrimitive || fieldType.IsEnum) |
|||
return valueCurrent.Equals(valueDefault); |
|||
|
|||
if (fieldType.IsArray && valueCurrent is IList currentList) |
|||
return !AreArraysDifferent(currentList, valueDefault as IList); |
|||
|
|||
if (valueCurrent == null && valueDefault == null) |
|||
return true; |
|||
|
|||
return valueDefault?.Equals(valueCurrent) ?? valueCurrent?.Equals(null) ?? false; |
|||
} |
|||
|
|||
internal static bool IsComplexType(Type fieldType) |
|||
{ |
|||
// Primitive types and enums are not considered complex
|
|||
if (fieldType.IsPrimitive || fieldType.IsEnum) |
|||
return false; |
|||
|
|||
// String is considered a primitive type for our purposes
|
|||
if (fieldType == typeof(string)) |
|||
return false; |
|||
|
|||
// Arrays can be converted to string easy without sub-elements
|
|||
if (fieldType.IsArray) |
|||
return false; |
|||
|
|||
// Value types (structs) that are not primitive are considered complex
|
|||
// Classes are considered complex types
|
|||
return fieldType.IsValueType || fieldType.IsClass; |
|||
} |
|||
|
|||
static string ConvertValueToString(object value) |
|||
{ |
|||
if (value == null) return null; |
|||
if (value is IList list) return list.DumpValues(); |
|||
return ConvertPrimitiveWithInvariants(value); |
|||
} |
|||
|
|||
static string ConvertPrimitiveWithInvariants(object obj) |
|||
{ |
|||
if (obj is IConvertible convertible) |
|||
return convertible.ToString(CultureInfo.InvariantCulture); |
|||
return obj.ToString(); |
|||
} |
|||
|
|||
static string[] ToStringArray(Dictionary<string, string> diff, string format = null) |
|||
{ |
|||
var changedSettings = new string[diff.Count]; |
|||
|
|||
if (string.IsNullOrEmpty(format)) |
|||
format = @"{{""{0}"":""{1}""}}"; |
|||
|
|||
int i = 0; |
|||
foreach (var d in diff) |
|||
changedSettings[i++] = string.Format(format, d.Key, d.Value); |
|||
|
|||
return changedSettings; |
|||
} |
|||
|
|||
private static string[] EnumerableToNestedColumn<T>([DisallowNull] this IEnumerable collection) |
|||
{ |
|||
using (ListPool<string>.Get(out var tmp)) |
|||
{ |
|||
foreach (var element in collection) |
|||
{ |
|||
string[] elementColumns = ToStringArray(DumpValues(element.GetType(), element), @"""{0}"":""{1}"""); |
|||
tmp.Add("{" + string.Join(", ", elementColumns) + "}"); |
|||
} |
|||
|
|||
return tmp.ToArray(); |
|||
} |
|||
} |
|||
|
|||
private static string[] ToNestedColumnSimplify<T>([DisallowNull] this T current) |
|||
where T : new() |
|||
{ |
|||
var type = current.GetType(); |
|||
|
|||
if (typeof(UnityEngine.Object).IsAssignableFrom(typeof(T))) |
|||
{ |
|||
var instance = ScriptableObject.CreateInstance(type); |
|||
ToStringArray(GetDiffAsDictionary(type, current, instance)); |
|||
ScriptableObject.DestroyImmediate(instance); |
|||
} |
|||
|
|||
return ToStringArray(GetDiffAsDictionary(type, current, new T())); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Obtains the Serialized fields and values in form of nested columns for BigQuery
|
|||
/// https://cloud.google.com/bigquery/docs/nested-repeated
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The given type</typeparam>
|
|||
/// <param name="current">The current object to obtain the fields and values.</param>
|
|||
/// <param name="compareAndSimplifyWithDefault">If a comparison against the default value must be done.</param>
|
|||
/// <returns>The nested columns in form of {key.nestedKey : value} </returns>
|
|||
/// <exception cref="ArgumentNullException">Throws an exception if current parameter is null.</exception>
|
|||
public static string[] ToNestedColumn<T>([DisallowNull] this T current, bool compareAndSimplifyWithDefault = false) |
|||
where T : new() |
|||
{ |
|||
if (current == null) |
|||
throw new ArgumentNullException(nameof(current)); |
|||
|
|||
if (current is IEnumerable currentAsEnumerable) |
|||
return EnumerableToNestedColumn<T>(currentAsEnumerable); |
|||
|
|||
if (compareAndSimplifyWithDefault) |
|||
return ToNestedColumnSimplify(current); |
|||
|
|||
return ToStringArray(DumpValues(current.GetType(), current)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Obtains the Serialized fields and values in form of nested columns for BigQuery
|
|||
/// https://cloud.google.com/bigquery/docs/nested-repeated
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The given type</typeparam>
|
|||
/// <param name="current">The current object to obtain the fields and values.</param>
|
|||
/// <param name="defaultInstance">The default instance to compare values</param>
|
|||
/// <returns>The nested columns in form of {key.nestedKey : value} </returns>
|
|||
/// <exception cref="ArgumentNullException">Throws an exception if the current or defaultInstance parameters are null.</exception>
|
|||
public static string[] ToNestedColumn<T>([DisallowNull] this T current, T defaultInstance) |
|||
{ |
|||
if (current == null) |
|||
throw new ArgumentNullException(nameof(current)); |
|||
|
|||
if (defaultInstance == null) |
|||
throw new ArgumentNullException(nameof(defaultInstance)); |
|||
|
|||
var type = current.GetType(); |
|||
|
|||
Dictionary<string, string> diff = GetDiffAsDictionary(type, current, defaultInstance); |
|||
return ToStringArray(diff); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Obtains the Serialized fields and values in form of nested columns for BigQuery
|
|||
/// https://cloud.google.com/bigquery/docs/nested-repeated
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The given type</typeparam>
|
|||
/// <param name="current">The current object to obtain the fields and values.</param>
|
|||
/// <param name="defaultObject">The default object</param>
|
|||
/// <param name="compareAndSimplifyWithDefault">If a comparison against the default value must be done.</param>
|
|||
/// <returns>The nested columns in form of {key.nestedKey : value} </returns>
|
|||
/// <exception cref="ArgumentNullException">Throws an exception if the current parameter is null.</exception>
|
|||
public static string[] ToNestedColumnWithDefault<T>([DisallowNull] this T current, [DisallowNull] T defaultObject, bool compareAndSimplifyWithDefault = false) |
|||
{ |
|||
if (current == null) |
|||
throw new ArgumentNullException(nameof(current)); |
|||
|
|||
var type = current.GetType(); |
|||
|
|||
Dictionary<string, string> diff = (compareAndSimplifyWithDefault) ? |
|||
GetDiffAsDictionary(type, current, defaultObject) : DumpValues(type, current); |
|||
|
|||
return ToStringArray(diff); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: ed711ee78a4b6e74896cbc8dbf636441 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,66 @@ |
|||
using JetBrains.Annotations; |
|||
using System; |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using UnityEditor.Build; |
|||
using UnityEditor.Build.Reporting; |
|||
using UnityEngine; |
|||
using UnityEngine.Analytics; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering.Analytics |
|||
{ |
|||
internal class BuildTargetAnalytic : IPostprocessBuildWithReport |
|||
{ |
|||
public int callbackOrder => int.MaxValue; |
|||
|
|||
[AnalyticInfo(eventName: "uBuildTargetAnalytic", vendorKey: "unity.srp", maxEventsPerHour: 10, maxNumberOfElements: 1000)] |
|||
internal class Analytic : IAnalytic |
|||
{ |
|||
|
|||
[MustUseReturnValue] |
|||
public bool TryGatherData([NotNullWhen(true)] out IAnalytic.IData data, [NotNullWhen(false)] out Exception error) |
|||
{ |
|||
var activeBuildTarget = EditorUserBuildSettings.activeBuildTarget; |
|||
var activeBuildTargetGroup = BuildPipeline.GetBuildTargetGroup(activeBuildTarget); |
|||
var activeBuildTargetGroupName = NamedBuildTarget.FromBuildTargetGroup(activeBuildTargetGroup).TargetName; |
|||
|
|||
error = null; |
|||
|
|||
var assetType = GraphicsSettings.currentRenderPipeline == null ? "Built-In Render Pipeline" : GraphicsSettings.currentRenderPipeline.GetType().ToString(); |
|||
|
|||
data = new BuildTargetAnalyticData() |
|||
{ |
|||
build_target = activeBuildTarget.ToString(), |
|||
quality_levels = QualitySettings.GetActiveQualityLevelsForPlatformCount(activeBuildTargetGroupName), |
|||
render_pipeline_asset_type = assetType, |
|||
total_quality_levels_on_project = QualitySettings.count |
|||
}; |
|||
return true; |
|||
} |
|||
}; |
|||
|
|||
[System.Diagnostics.DebuggerDisplay("{render_pipeline_asset_type} - {quality_levels}/{total_quality_levels_on_project}")] |
|||
[Serializable] |
|||
internal struct BuildTargetAnalyticData : IAnalytic.IData |
|||
{ |
|||
// Naming convention for analytics data
|
|||
public string build_target; |
|||
public string render_pipeline_asset_type; |
|||
public int quality_levels; |
|||
public int total_quality_levels_on_project; |
|||
}; |
|||
|
|||
void IPostprocessBuildWithReport.OnPostprocessBuild(BuildReport _) |
|||
{ |
|||
SendAnalytic(); |
|||
} |
|||
|
|||
[MenuItem("internal:Edit/Rendering/Analytics/Send BuildTargetAnalytic ", priority = 0)] |
|||
static void SendAnalytic() |
|||
{ |
|||
Analytic analytic = new Analytic(); |
|||
EditorAnalytics.SendAnalytic(analytic); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 9f249a7110f8dd14ca061023fb8aa6e5 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,67 @@ |
|||
using System; |
|||
using UnityEditor.Build; |
|||
using UnityEditor.Build.Reporting; |
|||
using UnityEngine.Analytics; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
class RenderPipelineGraphicsSettingsAnalytics : IPostprocessBuildWithReport |
|||
{ |
|||
const int k_MaxEventsPerHour = 1000; |
|||
const int k_MaxNumberOfElements = 1000; |
|||
const string k_VendorKey = "unity.srp"; |
|||
const string k_EventName = "uRenderPipelineGraphicsSettingsUsage"; |
|||
|
|||
[AnalyticInfo(eventName: k_EventName, vendorKey: k_VendorKey, maxEventsPerHour: k_MaxEventsPerHour, maxNumberOfElements: k_MaxNumberOfElements)] |
|||
public class Analytic : IAnalytic |
|||
{ |
|||
[Serializable] |
|||
public struct AnalyticsData : IAnalytic.IData |
|||
{ |
|||
public string settings; |
|||
public string[] usage; |
|||
} |
|||
|
|||
public bool TryGatherData(out IAnalytic.IData data, out Exception error) |
|||
{ |
|||
data = GatherDataToBeSent(); |
|||
error = null; |
|||
return true; |
|||
} |
|||
|
|||
public static IAnalytic.DataList<AnalyticsData> GatherDataToBeSent() |
|||
{ |
|||
using (ListPool<AnalyticsData>.Get(out var tmp)) |
|||
{ |
|||
GraphicsSettings.ForEach(settings => |
|||
{ |
|||
var settingsType = settings.GetType(); |
|||
var usage = settings.ToNestedColumn(Activator.CreateInstance(settingsType)); |
|||
if (usage.Length != 0) |
|||
tmp.Add(new AnalyticsData() { settings = settingsType.FullName, usage = usage }); |
|||
}); |
|||
|
|||
return new IAnalytic.DataList<AnalyticsData>(tmp.ToArray()); |
|||
} |
|||
} |
|||
} |
|||
|
|||
static void SendUniversalEvent() |
|||
{ |
|||
//The event shouldn't be able to report if this is disabled but if we know we're not going to report
|
|||
//Lets early out and not waste time gathering all the data
|
|||
if (!EditorAnalytics.enabled) |
|||
return; |
|||
|
|||
Analytic analytic = new Analytic(); |
|||
EditorAnalytics.SendAnalytic(analytic); |
|||
} |
|||
|
|||
public int callbackOrder { get; } |
|||
public void OnPostprocessBuild(BuildReport report) |
|||
{ |
|||
SendUniversalEvent(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 24edf9d94fc418047a951393fca40966 |
|||
@ -0,0 +1,66 @@ |
|||
using System; |
|||
using UnityEditor.SceneManagement; |
|||
using UnityEngine; |
|||
using UnityEngine.Analytics; |
|||
using UnityEngine.Rendering; |
|||
using static UnityEngine.Analytics.IAnalytic; |
|||
using Scene = UnityEditor.SearchService.SceneSearch; |
|||
|
|||
namespace UnityEditor.Rendering.Analytics |
|||
{ |
|||
// schema = com.unity3d.data.schemas.editor.analytics.uVolumePriorityUsageAnalyticData_v2
|
|||
// taxonomy = editor.analytics.uVolumePriorityUsageAnalyticData.v2
|
|||
internal class VolumePriorityUsageAnalytic |
|||
{ |
|||
|
|||
[AnalyticInfo(eventName: "uVolumePriorityUsageAnalyticData", version: 2, vendorKey: "unity.srp")] |
|||
class Analytic : IAnalytic |
|||
{ |
|||
public Analytic(Volume volume, string guid) |
|||
{ |
|||
using (GenericPool<Data>.Get(out var data)) |
|||
{ |
|||
data.volume_name = Hash128.Compute(volume.name).ToString(); |
|||
data.scene_name = guid; |
|||
data.priority = volume.priority; |
|||
m_Data = data; |
|||
} |
|||
} |
|||
|
|||
[System.Diagnostics.DebuggerDisplay("{volume_name} - {scene_name} - {priority}")] |
|||
[Serializable] |
|||
class Data : IAnalytic.IData |
|||
{ |
|||
// Naming convention for analytics data
|
|||
public string volume_name; |
|||
public string scene_name; |
|||
public float priority; |
|||
} |
|||
|
|||
public bool TryGatherData(out IAnalytic.IData data, out Exception error) |
|||
{ |
|||
data = m_Data; |
|||
error = null; |
|||
return true; |
|||
} |
|||
|
|||
Data m_Data; |
|||
}; |
|||
|
|||
|
|||
public static void Send(Volume volume) |
|||
{ |
|||
if (volume == null) |
|||
return; |
|||
|
|||
var sceneGUID = EditorSceneManager.GetActiveScene().GetGUID(); |
|||
GUID guid = new GUID(sceneGUID); |
|||
if (guid.Empty()) |
|||
return; |
|||
|
|||
Analytic analytic = new Analytic(volume, sceneGUID); |
|||
AnalyticsUtils.SendData(analytic); |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: b29e0569eca4bc54da7a07d64b33e1b2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,95 @@ |
|||
using System.Collections.Generic; |
|||
using JetBrains.Annotations; |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using UnityEditor.Build; |
|||
using UnityEditor.Build.Reporting; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
using UnityEngine.Analytics; |
|||
using System; |
|||
|
|||
namespace UnityEditor.Rendering.Analytics |
|||
{ |
|||
// schema = com.unity3d.data.schemas.editor.analytics.uVolumeProfileOverridesAnalytic_v2
|
|||
// taxonomy = editor.analytics.uVolumeProfileOverridesAnalytic.v2
|
|||
internal class VolumeProfileOverridesAnalytic : IPostprocessBuildWithReport |
|||
{ |
|||
public int callbackOrder => int.MaxValue; |
|||
|
|||
|
|||
[AnalyticInfo(eventName: "uVolumeProfileOverridesAnalytic", version: 2, maxEventsPerHour:1000, vendorKey: "unity.srp")] |
|||
public class Analytic : IAnalytic |
|||
{ |
|||
public Analytic(string asset_guid, string type, string[] p) |
|||
{ |
|||
m_Data = new Data |
|||
{ |
|||
volume_profile_asset_guid = asset_guid, |
|||
component_type = type, |
|||
overrided_parameters = p |
|||
}; |
|||
} |
|||
|
|||
[System.Diagnostics.DebuggerDisplay("{volume_profile_asset_guid} - {component_type} - {overrided_parameters.Length}")] |
|||
[Serializable] |
|||
struct Data : IAnalytic.IData |
|||
{ |
|||
// Naming convention for analytics data
|
|||
public string volume_profile_asset_guid; |
|||
public string component_type; |
|||
public string[] overrided_parameters; |
|||
} |
|||
public bool TryGatherData(out IAnalytic.IData data, out Exception error) |
|||
{ |
|||
data = m_Data; |
|||
error = null; |
|||
return true; |
|||
} |
|||
Data m_Data; |
|||
} |
|||
|
|||
void IPostprocessBuildWithReport.OnPostprocessBuild(BuildReport _) |
|||
{ |
|||
SendAnalytic(); |
|||
} |
|||
|
|||
private static readonly string[] k_SearchFolders = new[] { "Assets" }; |
|||
|
|||
[MustUseReturnValue] |
|||
static bool TryGatherData([NotNullWhen(true)] out List<IAnalytic> datas, [NotNullWhen(false)] out string warning) |
|||
{ |
|||
warning = string.Empty; |
|||
|
|||
datas = new List<IAnalytic>(); |
|||
|
|||
var volumeProfileGUIDs = AssetDatabase.FindAssets($"t:{nameof(VolumeProfile)} glob:\"**/*.asset\"", k_SearchFolders); |
|||
foreach (var guid in volumeProfileGUIDs) |
|||
{ |
|||
var volumeProfile = AssetDatabase.LoadAssetAtPath<VolumeProfile>(AssetDatabase.GUIDToAssetPath(guid)); |
|||
if (volumeProfile == null) |
|||
continue; |
|||
|
|||
foreach (var volumeComponent in volumeProfile.components) |
|||
{ |
|||
var volumeComponentType = volumeComponent.GetType(); |
|||
var defaultVolumeComponent = (VolumeComponent) ScriptableObject.CreateInstance(volumeComponentType); |
|||
var overrideParameters = volumeComponent.ToNestedColumnWithDefault(defaultVolumeComponent, true); |
|||
if (overrideParameters.Length == 0) |
|||
continue; |
|||
datas.Add(new Analytic(guid, volumeComponent.GetType().Name, overrideParameters)); |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
[MenuItem("internal:Edit/Rendering/Analytics/Send VolumeProfileOverridesAnalytic ", priority = 1)] |
|||
static void SendAnalytic() |
|||
{ |
|||
if (!TryGatherData(out var data, out var warning)) |
|||
Debug.Log(warning); |
|||
|
|||
data.ForEach(d => AnalyticsUtils.SendData(d)); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 3e30261210b9c0040baf9d684f0b3e8d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,55 @@ |
|||
using System; |
|||
using UnityEditor.SceneManagement; |
|||
using UnityEngine; |
|||
using UnityEngine.Analytics; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering.Analytics |
|||
{ |
|||
// schema = com.unity3d.data.schemas.editor.analytics.uVolumeProfileUsageAnalytic_v4
|
|||
// taxonomy = editor.analytics.uVolumeProfileUsageAnalytic.v4
|
|||
internal class VolumeProfileUsageAnalytic |
|||
{ |
|||
[AnalyticInfo(eventName: "uVolumeProfileUsageAnalytic", version: 4, vendorKey: "unity.srp" )] |
|||
class Analytic : IAnalytic |
|||
{ |
|||
public Analytic(Volume volume, VolumeProfile volumeProfile) |
|||
{ |
|||
using (GenericPool<Data>.Get(out var data)) |
|||
{ |
|||
data.volume_name = Hash128.Compute(volume.name).ToString(); |
|||
data.scene_name = EditorSceneManager.GetActiveScene().GetGUID(); |
|||
data.volume_profile_asset_guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(volumeProfile.GetInstanceID())); |
|||
m_Data = data; |
|||
} |
|||
} |
|||
|
|||
[System.Diagnostics.DebuggerDisplay("{volume_name} - {scene_name}- {volume_profile_asset_guid}")] |
|||
[Serializable] |
|||
class Data : IAnalytic.IData |
|||
{ |
|||
// Naming convention for analytics data
|
|||
public string volume_name; |
|||
public string scene_name; |
|||
public string volume_profile_asset_guid; |
|||
} |
|||
public bool TryGatherData(out IAnalytic.IData data, out Exception error) |
|||
{ |
|||
data = m_Data; |
|||
error = null; |
|||
return true; |
|||
} |
|||
Data m_Data; |
|||
}; |
|||
|
|||
public static void Send(Volume volume, VolumeProfile volumeProfile) |
|||
{ |
|||
if (volume == null || volumeProfile == null) |
|||
return; |
|||
|
|||
Analytic analytic = new Analytic(volume, volumeProfile); |
|||
|
|||
AnalyticsUtils.SendData(analytic); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: e7e0182f8c41fea4aaebcffa2915a381 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,5 @@ |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Shared")] |
|||
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Tests")] |
|||
[assembly: InternalsVisibleTo("Unity.RenderPipelines.HighDefinition.Editor.Tests")] |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: bfa722e189cafe743b7884ff1953f0b9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,54 @@ |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary> Set of helpers for AssetDatabase operations. </summary>
|
|||
public static class AssetDatabaseHelper |
|||
{ |
|||
/// <summary>
|
|||
/// Finds all assets of type T in the project.
|
|||
/// </summary>
|
|||
/// <param name="extension">Asset type extension i.e ".mat" for materials. Specifying extension make this faster.</param>
|
|||
/// <typeparam name="T">The type of asset you are looking for</typeparam>
|
|||
/// <returns>An IEnumerable off all assets found.</returns>
|
|||
public static IEnumerable<T> FindAssets<T>(string extension = null) |
|||
where T : Object |
|||
{ |
|||
string query = BuildQueryToFindAssets<T>(extension); |
|||
foreach (var guid in AssetDatabase.FindAssets(query)) |
|||
{ |
|||
var asset = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(guid)); |
|||
if (asset is T castAsset) |
|||
yield return castAsset; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Finds all assets paths of type T in the project.
|
|||
/// </summary>
|
|||
/// <param name="extension">Asset type extension i.e ".mat" for materials. Specifying extension make this faster.</param>
|
|||
/// <typeparam name="T">The type of asset you are looking for</typeparam>
|
|||
/// <returns>An IEnumerable off all assets paths found.</returns>
|
|||
public static IEnumerable<string> FindAssetPaths<T>(string extension = null) |
|||
where T : Object |
|||
{ |
|||
string query = BuildQueryToFindAssets<T>(extension); |
|||
foreach (var guid in AssetDatabase.FindAssets(query)) |
|||
yield return AssetDatabase.GUIDToAssetPath(guid); |
|||
} |
|||
|
|||
static string BuildQueryToFindAssets<T>(string extension = null) |
|||
where T : Object |
|||
{ |
|||
string typeName = typeof(T).ToString(); |
|||
int i = typeName.LastIndexOf('.'); |
|||
if (i != -1) |
|||
{ |
|||
typeName = typeName.Substring(i+1, typeName.Length - i-1); |
|||
} |
|||
|
|||
return string.IsNullOrEmpty(extension) ? $"t:{typeName}" : $"t:{typeName} glob:\"**/*{extension}\""; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
fileFormatVersion: 2 |
|||
guid: ecc2633973414f6d8bbab97cf0c937b4 |
|||
timeCreated: 1693402114 |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: d846ae44708583940a0e44aa66cff1c9 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,97 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Build; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Contains a set of needed data for building.
|
|||
/// This might also being called when building Asset Bundles
|
|||
/// </summary>
|
|||
public class CoreBuildData : IDisposable |
|||
{ |
|||
static CoreBuildData m_Instance = null; |
|||
|
|||
/// <summary>
|
|||
/// Instance to the current <see cref="CoreBuildData"/>.
|
|||
/// </summary>
|
|||
public static CoreBuildData instance => m_Instance ??= CreateInstance(); |
|||
|
|||
/// <summary>
|
|||
/// If the target build has an SRP configured
|
|||
/// </summary>
|
|||
public bool buildingPlayerForRenderPipeline { get; private set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// A valid type of <see cref="RenderPipelineAsset"/>, that the build is targeting,
|
|||
/// </summary>
|
|||
public Type currentRenderPipelineAssetType { get; private set; } = null; |
|||
|
|||
/// <summary>
|
|||
/// A list of <see cref="RenderPipelineAsset"/>, all of them of the same type.
|
|||
/// </summary>
|
|||
public List<RenderPipelineAsset> renderPipelineAssets { get; private set; } = new(); |
|||
|
|||
internal Dictionary<int, ComputeShader> computeShaderCache { get; private set; } = new(); |
|||
|
|||
internal bool pipelineSupportGPUResidentDrawer { get; private set; } = false; |
|||
internal bool playerNeedGPUResidentDrawer { get; private set; } = false; |
|||
|
|||
private CoreBuildData(BuildTarget buildTarget) |
|||
{ |
|||
m_Instance = this; |
|||
|
|||
if (!buildTarget.TryGetRenderPipelineAssets(renderPipelineAssets)) |
|||
return; |
|||
|
|||
buildingPlayerForRenderPipeline = true; |
|||
|
|||
//We can check only the first as we don't support multiple pipeline type in player
|
|||
var asset = renderPipelineAssets[0]; |
|||
currentRenderPipelineAssetType = asset.GetType(); |
|||
|
|||
CheckGPUResidentDrawerUsage(); |
|||
} |
|||
|
|||
private static CoreBuildData CreateInstance() |
|||
=> new(EditorUserBuildSettings.activeBuildTarget); |
|||
|
|||
private void CheckGPUResidentDrawerUsage() |
|||
{ |
|||
foreach (var renderPipelineAsset in renderPipelineAssets) |
|||
{ |
|||
if (renderPipelineAsset is IGPUResidentRenderPipeline gpuResidentPipelineAsset |
|||
&& gpuResidentPipelineAsset.IsGPUResidentDrawerSupportedBySRP()) |
|||
{ |
|||
// Record if any pipeline supports the GPU resident drawer
|
|||
pipelineSupportGPUResidentDrawer = true; |
|||
|
|||
// If any pipeline already has GPU resident drawer enabled, then record this and also early out
|
|||
if (gpuResidentPipelineAsset.gpuResidentDrawerSettings.mode != GPUResidentDrawerMode.Disabled) |
|||
{ |
|||
playerNeedGPUResidentDrawer = true; |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (!playerNeedGPUResidentDrawer) |
|||
return; |
|||
|
|||
GraphicsSettings.GetRenderPipelineSettings<GPUResidentDrawerResources>() |
|||
.ForEachFieldOfType<ComputeShader>(computeShader => computeShaderCache.Add(computeShader.GetInstanceID(), computeShader)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Dispose all the gathered data for building
|
|||
/// </summary>
|
|||
public void Dispose() |
|||
{ |
|||
renderPipelineAssets?.Clear(); |
|||
computeShaderCache?.Clear(); |
|||
m_Instance = null; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 77db4492d35e8db4fb0fe2936a0879e2 |
|||
@ -0,0 +1,25 @@ |
|||
using UnityEditor.Build; |
|||
using UnityEditor.Build.Reporting; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
//Make CoreBuildData constructed and kept till end of build
|
|||
class CorePreprocessBuild : IPreprocessBuildWithReport, IPostprocessBuildWithReport |
|||
{ |
|||
int IOrderedCallback.callbackOrder => int.MinValue + 50; |
|||
|
|||
private static CoreBuildData m_BuildData = null; |
|||
|
|||
void IPreprocessBuildWithReport.OnPreprocessBuild(BuildReport report) |
|||
{ |
|||
m_BuildData?.Dispose(); |
|||
m_BuildData = CoreBuildData.instance; |
|||
} |
|||
|
|||
void IPostprocessBuildWithReport.OnPostprocessBuild(BuildReport report) |
|||
{ |
|||
m_BuildData?.Dispose(); |
|||
m_BuildData = null; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 2ae707d91841f5849935209a93425289 |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: f9e0abec186274f4f8a49394c1fef24b |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,11 @@ |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
class GPUResidentDrawerResourcesStripper : IRenderPipelineGraphicsSettingsStripper<GPUResidentDrawerResources> |
|||
{ |
|||
public bool active => true; |
|||
|
|||
public bool CanRemoveSettings(GPUResidentDrawerResources settings) => !CoreBuildData.instance.pipelineSupportGPUResidentDrawer || !CoreBuildData.instance.playerNeedGPUResidentDrawer; |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
fileFormatVersion: 2 |
|||
guid: efeaffd0d0bd818459953697384fc1d9 |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: b0efad93b2507274daeaf8cc7306a312 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,13 @@ |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
class SRPDisabledComputeShaderVariantStripper : IComputeShaderVariantStripper |
|||
{ |
|||
public bool active => !CoreBuildData.instance.buildingPlayerForRenderPipeline; |
|||
|
|||
public bool CanRemoveVariant([DisallowNull] ComputeShader shader, string _, ShaderCompilerData __) |
|||
=> CoreBuildData.instance.computeShaderCache.ContainsKey(shader.GetInstanceID()); |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 9f2d47f6376246d49bf978c4dbbe3686 |
|||
@ -0,0 +1,111 @@ |
|||
using JetBrains.Annotations; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using UnityEditor.Build; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Extensions for <see cref="BuildTarget"/>
|
|||
/// </summary>
|
|||
public static class BuildTargetExtensions |
|||
{ |
|||
static bool NeedsToBeIncludedInBuildBylabel(RenderPipelineAsset asset, string label) |
|||
{ |
|||
var labelList = AssetDatabase.GetLabels(asset); |
|||
foreach (string item in labelList) |
|||
{ |
|||
if (item == label) |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
static void AddAdditionalRenderPipelineAssetsIncludedForBuild<T>(HashSet<T> assetsList) |
|||
where T : RenderPipelineAsset |
|||
{ |
|||
var includer = GraphicsSettings.GetRenderPipelineSettings<IncludeAdditionalRPAssets>(); |
|||
if (includer == null) |
|||
return; |
|||
|
|||
bool includeSceneDependencies = includer.includeReferencedInScenes; |
|||
bool includeAssetsWithLabel = includer.includeAssetsByLabel; |
|||
string labelToInclude = includer.labelToInclude; |
|||
|
|||
if (!includeSceneDependencies && !includeAssetsWithLabel) |
|||
return; |
|||
|
|||
using (ListPool<string>.Get(out var assetsPaths)) |
|||
{ |
|||
assetsPaths.AddRange(AssetDatabaseHelper.FindAssetPaths<T>(".asset")); |
|||
|
|||
if (includeSceneDependencies) |
|||
{ |
|||
using (ListPool<string>.Get(out var scenesPaths)) |
|||
{ |
|||
foreach (var scene in EditorBuildSettings.scenes) |
|||
if (scene.enabled) |
|||
scenesPaths.Add(scene.path); |
|||
|
|||
// Get all enabled scenes path in the build settings.
|
|||
HashSet<string> depsHash = new HashSet<string>(AssetDatabase.GetDependencies(scenesPaths.ToArray())); |
|||
for (int i = 0; i < assetsPaths.Count; ++i) |
|||
{ |
|||
var assetPath = assetsPaths[i]; |
|||
if (depsHash.Contains(assetPath)) |
|||
assetsList.Add(AssetDatabase.LoadAssetAtPath<T>(assetPath)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (includeAssetsWithLabel) |
|||
{ |
|||
for (int i = 0; i < assetsPaths.Count; ++i) |
|||
{ |
|||
// Add the assets that are labeled to be included
|
|||
var asset = AssetDatabase.LoadAssetAtPath<T>(assetsPaths[i]); |
|||
if (NeedsToBeIncludedInBuildBylabel(asset, labelToInclude)) |
|||
assetsList.Add(asset); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Obtains a list of the <see cref="RenderPipelineAsset"/> that are references into the settings either on <see cref="QualitySettings"/> or in <see cref="GraphicsSettings"/>
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of <see cref="RenderPipelineAsset"/></typeparam>
|
|||
/// <param name="buildTarget">The <see cref="BuildTarget"/> to obtain the assets.</param>
|
|||
/// <param name="srpAssets">The output list of <see cref="RenderPipelineAsset"/> that are referenced by the platform.</param>
|
|||
/// <returns>false if there was an error fetching the <see cref="RenderPipelineAsset"/> for this <see cref="BuildTarget"/></returns>
|
|||
[MustUseReturnValue] |
|||
public static bool TryGetRenderPipelineAssets<T>([DisallowNull] this BuildTarget buildTarget, List<T> srpAssets) |
|||
where T : RenderPipelineAsset |
|||
{ |
|||
if (srpAssets == null) |
|||
return false; |
|||
|
|||
var activeBuildTargetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget); |
|||
var namedBuildTarget = NamedBuildTarget.FromBuildTargetGroup(activeBuildTargetGroup); |
|||
|
|||
QualitySettings.GetRenderPipelineAssetsForPlatform<T>(namedBuildTarget.TargetName, out var buildPipelineAssets, out var allQualityLevelsAreOverriden); |
|||
|
|||
bool noQualityLevels = QualitySettings.GetActiveQualityLevelsForPlatformCount(namedBuildTarget.TargetName) == 0; |
|||
if (noQualityLevels || !allQualityLevelsAreOverriden) |
|||
{ |
|||
// We need to check the fallback cases
|
|||
if (GraphicsSettings.defaultRenderPipeline is T srpAsset) |
|||
buildPipelineAssets.Add(srpAsset); |
|||
} |
|||
|
|||
if (buildPipelineAssets.Count != 0) |
|||
AddAdditionalRenderPipelineAssetsIncludedForBuild(buildPipelineAssets); |
|||
|
|||
srpAssets.AddRange(buildPipelineAssets); |
|||
return srpAssets.Count != 0; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 2e78621c9df5d0b4d884d48b1ded36c8 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 234fa6c8645c73d4e8857414e1823942 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,171 @@ |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary> Camera UI Shared Properties among SRP</summary>
|
|||
public static partial class CameraUI |
|||
{ |
|||
/// <summary>Camera Projection type</summary>
|
|||
public enum ProjectionType |
|||
{ |
|||
/// <summary> Perspective</summary>
|
|||
Perspective, |
|||
/// <summary> Orthographic</summary>
|
|||
Orthographic |
|||
} |
|||
|
|||
/// <summary>Camera Projection matrix mode</summary>
|
|||
public enum ProjectionMatrixMode |
|||
{ |
|||
/// <summary> Explicit</summary>
|
|||
Explicit, |
|||
/// <summary> Implicit</summary>
|
|||
Implicit, |
|||
/// <summary> PhysicalPropertiesBased</summary>
|
|||
PhysicalPropertiesBased, |
|||
} |
|||
|
|||
static bool s_FovChanged; |
|||
static float s_FovLastValue; |
|||
|
|||
static ProjectionType DrawerProjectionType(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
|
|||
ProjectionType projectionType; |
|||
|
|||
Rect perspectiveRect = EditorGUILayout.GetControlRect(); |
|||
EditorGUI.BeginProperty(perspectiveRect, Styles.projectionContent, cam.orthographic); |
|||
{ |
|||
projectionType = cam.orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective; |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
projectionType = (ProjectionType)EditorGUI.EnumPopup(perspectiveRect, Styles.projectionContent, projectionType); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
cam.orthographic.boolValue = (projectionType == ProjectionType.Orthographic); |
|||
} |
|||
EditorGUI.EndProperty(); |
|||
|
|||
return projectionType; |
|||
} |
|||
|
|||
static void DrawerOrthographicType(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.baseCameraSettings.orthographicSize, Styles.sizeContent); |
|||
Drawer_FieldClippingPlanes(p, owner); |
|||
} |
|||
|
|||
static void DrawerPerspectiveType(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
|
|||
var targets = p.serializedObject.targetObjects; |
|||
var camera0 = targets[0] as Camera; |
|||
|
|||
float fovCurrentValue; |
|||
bool multipleDifferentFovValues = false; |
|||
bool isPhysicalCamera = p.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased; |
|||
|
|||
var rect = EditorGUILayout.GetControlRect(); |
|||
|
|||
var guiContent = EditorGUI.BeginProperty(rect, Styles.FOVAxisModeContent, cam.fovAxisMode); |
|||
EditorGUI.showMixedValue = cam.fovAxisMode.hasMultipleDifferentValues; |
|||
|
|||
CoreEditorUtils.DrawEnumPopup<Camera.FieldOfViewAxis>(rect, guiContent, cam.fovAxisMode); |
|||
|
|||
bool fovAxisVertical = cam.fovAxisMode.intValue == 0; |
|||
|
|||
if (!fovAxisVertical && !cam.fovAxisMode.hasMultipleDifferentValues) |
|||
{ |
|||
float aspectRatio = isPhysicalCamera ? cam.sensorSize.vector2Value.x / cam.sensorSize.vector2Value.y : camera0.aspect; |
|||
// camera.aspect is not serialized so we have to check all targets.
|
|||
fovCurrentValue = Camera.VerticalToHorizontalFieldOfView(camera0.fieldOfView, aspectRatio); |
|||
if (targets.Cast<Camera>().Any(camera => camera.fieldOfView != fovCurrentValue)) |
|||
multipleDifferentFovValues = true; |
|||
} |
|||
else |
|||
{ |
|||
fovCurrentValue = cam.verticalFOV.floatValue; |
|||
multipleDifferentFovValues = cam.fovAxisMode.hasMultipleDifferentValues; |
|||
} |
|||
|
|||
EditorGUI.showMixedValue = multipleDifferentFovValues; |
|||
var content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.fieldOfViewContent, cam.verticalFOV); |
|||
EditorGUI.BeginDisabledGroup(p.projectionMatrixMode.hasMultipleDifferentValues || isPhysicalCamera && (cam.sensorSize.hasMultipleDifferentValues || cam.fovAxisMode.hasMultipleDifferentValues)); |
|||
EditorGUI.BeginChangeCheck(); |
|||
s_FovLastValue = EditorGUILayout.Slider(content, fovCurrentValue, 0.00001f, 179f); |
|||
s_FovChanged = EditorGUI.EndChangeCheck(); |
|||
EditorGUI.EndDisabledGroup(); |
|||
EditorGUILayout.EndHorizontal(); |
|||
EditorGUI.EndProperty(); |
|||
EditorGUI.showMixedValue = false; |
|||
|
|||
Drawer_FieldClippingPlanes(p, owner); |
|||
|
|||
content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.physicalCameraContent, p.projectionMatrixMode); |
|||
EditorGUI.showMixedValue = p.projectionMatrixMode.hasMultipleDifferentValues; |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
isPhysicalCamera = EditorGUILayout.Toggle(content, isPhysicalCamera); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
p.projectionMatrixMode.intValue = isPhysicalCamera ? (int)ProjectionMatrixMode.PhysicalPropertiesBased : (int)ProjectionMatrixMode.Implicit; |
|||
s_FovChanged = true; |
|||
} |
|||
EditorGUILayout.EndHorizontal(); |
|||
EditorGUI.EndProperty(); |
|||
|
|||
EditorGUI.showMixedValue = false; |
|||
if (s_FovChanged) |
|||
{ |
|||
if (!isPhysicalCamera || p.projectionMatrixMode.hasMultipleDifferentValues) |
|||
{ |
|||
cam.verticalFOV.floatValue = fovAxisVertical |
|||
? s_FovLastValue |
|||
: Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, camera0.aspect); |
|||
} |
|||
else if (!p.projectionMatrixMode.hasMultipleDifferentValues) |
|||
{ |
|||
cam.verticalFOV.floatValue = fovAxisVertical |
|||
? s_FovLastValue |
|||
: Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, camera0.aspect); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>Draws projection related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Projection(ISerializedCamera p, Editor owner) |
|||
{ |
|||
// Most of this is replicated from CameraEditor.DrawProjection as we don't want to draw
|
|||
// it the same way it's done in non-SRP cameras. Unfortunately, because a lot of the
|
|||
// code is internal, we have to copy/paste some stuff from the editor code :(
|
|||
var projectionType = DrawerProjectionType(p, owner); |
|||
|
|||
if (p.baseCameraSettings.orthographic.hasMultipleDifferentValues) |
|||
return; |
|||
|
|||
using (new EditorGUI.IndentLevelScope()) |
|||
{ |
|||
if (projectionType == ProjectionType.Orthographic) |
|||
{ |
|||
DrawerOrthographicType(p, owner); |
|||
} |
|||
else |
|||
{ |
|||
DrawerPerspectiveType(p, owner); |
|||
} |
|||
} |
|||
} |
|||
|
|||
static void Drawer_FieldClippingPlanes(ISerializedCamera p, Editor owner) |
|||
{ |
|||
CoreEditorUtils.DrawMultipleFields( |
|||
Styles.clippingPlaneMultiFieldTitle, |
|||
new[] { p.baseCameraSettings.nearClippingPlane, p.baseCameraSettings.farClippingPlane }, |
|||
new[] { Styles.nearPlaneContent, Styles.farPlaneContent }); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: a0d2633fc585aec4a8a89a6014bd7640 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,19 @@ |
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
/// <summary>
|
|||
/// Environment Section
|
|||
/// </summary>
|
|||
public static partial class Environment |
|||
{ |
|||
/// <summary>Draws layer mask planes related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Environment_VolumeLayerMask(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.volumeLayerMask, Styles.volumeLayerMask); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 40b2b7ce6c436184b91d2d7ea4ef35ce |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,26 @@ |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
public static partial class Environment |
|||
{ |
|||
/// <summary>
|
|||
/// Styles
|
|||
/// </summary>
|
|||
public static class Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Header of the section
|
|||
/// </summary>
|
|||
public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Environment", "These settings control what the camera background looks like."); |
|||
|
|||
/// <summary>
|
|||
/// Volume layer mask content
|
|||
/// </summary>
|
|||
public static readonly GUIContent volumeLayerMask = EditorGUIUtility.TrTextContent("Volume Mask", "This camera will only be affected by volumes in the selected scene-layers."); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: c94bc25276e67ea429b40e3228a39b05 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,47 @@ |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
/// <summary>
|
|||
/// Output Section
|
|||
/// </summary>
|
|||
public static partial class Output |
|||
{ |
|||
/// <summary>Draws Allow Dynamic Resolution related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
/// <param name="customLabel">Override property name</param>
|
|||
public static void Drawer_Output_AllowDynamicResolution(ISerializedCamera p, Editor owner, GUIContent customLabel = null) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.allowDynamicResolution, customLabel ?? Styles.allowDynamicResolution); |
|||
p.baseCameraSettings.allowDynamicResolution.boolValue = p.allowDynamicResolution.boolValue; |
|||
} |
|||
|
|||
/// <summary>Draws Normalized ViewPort related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Output_NormalizedViewPort(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.baseCameraSettings.normalizedViewPortRect, Styles.viewport); |
|||
} |
|||
|
|||
/// <summary>Draws Depth related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Output_Depth(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.baseCameraSettings.depth, Styles.depth); |
|||
} |
|||
|
|||
/// <summary>Draws Render Target related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Output_RenderTarget(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.baseCameraSettings.targetTexture); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: c77d1122a4e2ed448966b1535f9f1130 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,43 @@ |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
public static partial class Output |
|||
{ |
|||
/// <summary>
|
|||
/// Styles
|
|||
/// </summary>
|
|||
public static class Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Header of the section
|
|||
/// </summary>
|
|||
public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Output", "These settings control how the camera output is formatted."); |
|||
|
|||
#if ENABLE_MULTIPLE_DISPLAYS
|
|||
/// <summary>
|
|||
/// Target display content
|
|||
/// </summary>
|
|||
public static readonly GUIContent targetDisplay = EditorGUIUtility.TrTextContent("Target Display"); |
|||
#endif
|
|||
|
|||
/// <summary>
|
|||
/// Viewport
|
|||
/// </summary>
|
|||
public static readonly GUIContent viewport = EditorGUIUtility.TrTextContent("Viewport Rect", "Four values that indicate where on the screen HDRP draws this Camera view. Measured in Viewport Coordinates (values in the range of [0, 1])."); |
|||
|
|||
/// <summary>
|
|||
/// Allow dynamic resolution content
|
|||
/// </summary>
|
|||
public static readonly GUIContent allowDynamicResolution = EditorGUIUtility.TrTextContent("Allow Dynamic Resolution", "Whether to support dynamic resolution."); |
|||
|
|||
/// <summary>
|
|||
/// Depth content
|
|||
/// </summary>
|
|||
public static readonly GUIContent depth = EditorGUIUtility.TrTextContent("Depth"); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: f82f0aee4a6afa04f86310b233ea3d66 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,286 @@ |
|||
using System; |
|||
using System.Runtime.CompilerServices; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
/// <summary>
|
|||
/// Physical camera related drawers
|
|||
/// </summary>
|
|||
public static partial class PhysicalCamera |
|||
{ |
|||
// Saves the value of the sensor size when the user switches from "custom" size to a preset per camera.
|
|||
// We use a ConditionalWeakTable instead of a Dictionary to avoid keeping alive (with strong references) deleted cameras
|
|||
static ConditionalWeakTable<Camera, object> s_PerCameraSensorSizeHistory = new ConditionalWeakTable<Camera, object>(); |
|||
|
|||
/// <summary>Draws Body Sensor related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_CameraBody_Sensor(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
EditorGUI.BeginChangeCheck(); |
|||
|
|||
int oldFilmGateIndex = Array.IndexOf(Styles.apertureFormatValues, new Vector2((float)Math.Round(cam.sensorSize.vector2Value.x, 3), (float)Math.Round(cam.sensorSize.vector2Value.y, 3))); |
|||
|
|||
// If it is not one of the preset sizes, set it to custom
|
|||
oldFilmGateIndex = (oldFilmGateIndex == -1) ? Styles.customPresetIndex : oldFilmGateIndex; |
|||
|
|||
// Get the new user selection
|
|||
int newFilmGateIndex = EditorGUILayout.Popup(Styles.sensorType, oldFilmGateIndex, Styles.apertureFormatNames); |
|||
|
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
// Retrieve the previous custom size value, if one exists for this camera
|
|||
object previousCustomValue; |
|||
s_PerCameraSensorSizeHistory.TryGetValue((Camera)p.serializedObject.targetObject, out previousCustomValue); |
|||
|
|||
// When switching from custom to a preset, update the last custom value (to display again, in case the user switches back to custom)
|
|||
if (oldFilmGateIndex == Styles.customPresetIndex) |
|||
{ |
|||
if (previousCustomValue == null) |
|||
{ |
|||
s_PerCameraSensorSizeHistory.Add((Camera)p.serializedObject.targetObject, cam.sensorSize.vector2Value); |
|||
} |
|||
else |
|||
{ |
|||
previousCustomValue = cam.sensorSize.vector2Value; |
|||
} |
|||
} |
|||
|
|||
if (newFilmGateIndex < Styles.customPresetIndex) |
|||
{ |
|||
cam.sensorSize.vector2Value = Styles.apertureFormatValues[newFilmGateIndex]; |
|||
} |
|||
else |
|||
{ |
|||
// The user switched back to custom, so display by deafulr the previous custom value
|
|||
if (previousCustomValue != null) |
|||
{ |
|||
cam.sensorSize.vector2Value = (Vector2)previousCustomValue; |
|||
} |
|||
else |
|||
{ |
|||
cam.sensorSize.vector2Value = new Vector2(36.0f, 24.0f); // this is the value new cameras are created with
|
|||
} |
|||
} |
|||
} |
|||
|
|||
EditorGUILayout.PropertyField(cam.sensorSize, Styles.sensorSize); |
|||
} |
|||
|
|||
/// <summary>Draws Gate fit related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_CameraBody_GateFit(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
|
|||
using (var horizontal = new EditorGUILayout.HorizontalScope()) |
|||
using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.gateFit, cam.gateFit)) |
|||
using (var checkScope = new EditorGUI.ChangeCheckScope()) |
|||
{ |
|||
int gateValue = (int)(Camera.GateFitMode)EditorGUILayout.EnumPopup(propertyScope.content, (Camera.GateFitMode)cam.gateFit.intValue); |
|||
if (checkScope.changed) |
|||
cam.gateFit.intValue = gateValue; |
|||
} |
|||
} |
|||
|
|||
/// <summary>Draws Focal Length related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_Lens_FocalLength(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
|
|||
using (var horizontal = new EditorGUILayout.HorizontalScope()) |
|||
using (new EditorGUI.PropertyScope(horizontal.rect, Styles.focalLength, cam.focalLength)) |
|||
using (var checkScope = new EditorGUI.ChangeCheckScope()) |
|||
{ |
|||
bool isPhysical = p.projectionMatrixMode.intValue == (int)CameraUI.ProjectionMatrixMode.PhysicalPropertiesBased; |
|||
// We need to update the focal length if the camera is physical and the FoV has changed.
|
|||
bool focalLengthIsDirty = (s_FovChanged && isPhysical); |
|||
|
|||
float sensorLength = cam.fovAxisMode.intValue == 0 ? cam.sensorSize.vector2Value.y : cam.sensorSize.vector2Value.x; |
|||
float focalLengthVal = focalLengthIsDirty ? Camera.FieldOfViewToFocalLength(s_FovLastValue, sensorLength) : cam.focalLength.floatValue; |
|||
focalLengthVal = EditorGUILayout.FloatField(Styles.focalLength, focalLengthVal); |
|||
if (checkScope.changed || focalLengthIsDirty) |
|||
cam.focalLength.floatValue = focalLengthVal; |
|||
} |
|||
} |
|||
|
|||
/// <summary>Draws Lens Shift related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_Lens_Shift(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.baseCameraSettings.lensShift, Styles.shift); |
|||
} |
|||
|
|||
|
|||
/// <summary>Draws Focus Distance related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_FocusDistance(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
EditorGUILayout.PropertyField(cam.focusDistance, Styles.focusDistance); |
|||
} |
|||
|
|||
/// <summary>Draws ISO related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_CameraBody_ISO(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
EditorGUILayout.PropertyField(cam.iso, Styles.ISO); |
|||
} |
|||
|
|||
static EditorPrefBoolFlags<ShutterSpeedUnit> m_ShutterSpeedState = new EditorPrefBoolFlags<ShutterSpeedUnit>($"HDRP:{nameof(CameraUI)}:ShutterSpeedState"); |
|||
|
|||
enum ShutterSpeedUnit |
|||
{ |
|||
[InspectorName("Second")] |
|||
Second, |
|||
[InspectorName("1 \u2215 Second")] // Don't use a slash here else Unity will auto-create a submenu...
|
|||
OneOverSecond |
|||
} |
|||
|
|||
/// <summary>Draws Shutter Speed related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_CameraBody_ShutterSpeed(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
|
|||
// Custom layout for shutter speed
|
|||
const int k_UnitMenuWidth = 90; |
|||
const int k_OffsetPerIndent = 15; |
|||
const int k_LabelFieldSeparator = 2; |
|||
const int k_Offset = 1; |
|||
int oldIndentLevel = EditorGUI.indentLevel; |
|||
|
|||
// Don't take into account the indentLevel when rendering the units field
|
|||
EditorGUI.indentLevel = 0; |
|||
|
|||
var lineRect = EditorGUILayout.GetControlRect(); |
|||
var fieldRect = new Rect(k_OffsetPerIndent + k_LabelFieldSeparator + k_Offset, lineRect.y, lineRect.width - k_UnitMenuWidth, lineRect.height); |
|||
var unitMenu = new Rect(fieldRect.xMax + k_LabelFieldSeparator, lineRect.y, k_UnitMenuWidth - k_LabelFieldSeparator, lineRect.height); |
|||
|
|||
// We cannot had the shutterSpeedState as this is not a serialized property but a global edition mode.
|
|||
// This imply that it will never go bold nor can be reverted in prefab overrides
|
|||
|
|||
m_ShutterSpeedState.value = (ShutterSpeedUnit)EditorGUI.EnumPopup(unitMenu, m_ShutterSpeedState.value); |
|||
// Reset the indent level
|
|||
EditorGUI.indentLevel = oldIndentLevel; |
|||
|
|||
EditorGUI.BeginProperty(fieldRect, Styles.shutterSpeed, cam.shutterSpeed); |
|||
{ |
|||
// if we we use (1 / second) units, then change the value for the display and then revert it back
|
|||
if (m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond && cam.shutterSpeed.floatValue > 0) |
|||
cam.shutterSpeed.floatValue = 1.0f / cam.shutterSpeed.floatValue; |
|||
EditorGUI.PropertyField(fieldRect, cam.shutterSpeed, Styles.shutterSpeed); |
|||
if (m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond && cam.shutterSpeed.floatValue > 0) |
|||
cam.shutterSpeed.floatValue = 1.0f / cam.shutterSpeed.floatValue; |
|||
} |
|||
EditorGUI.EndProperty(); |
|||
} |
|||
|
|||
/// <summary>Draws Lens Aperture related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_Lens_Aperture(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
|
|||
// Custom layout for aperture
|
|||
var rect = EditorGUILayout.BeginHorizontal(); |
|||
{ |
|||
// Magic values/offsets to get the UI look consistent
|
|||
const float textRectSize = 80; |
|||
const float textRectPaddingRight = 62; |
|||
const float unitRectPaddingRight = 97; |
|||
const float sliderPaddingLeft = 2; |
|||
const float sliderPaddingRight = 77; |
|||
|
|||
var labelRect = rect; |
|||
labelRect.width = EditorGUIUtility.labelWidth; |
|||
labelRect.height = EditorGUIUtility.singleLineHeight; |
|||
EditorGUI.LabelField(labelRect, Styles.aperture); |
|||
|
|||
GUI.SetNextControlName("ApertureSlider"); |
|||
var sliderRect = rect; |
|||
sliderRect.x += labelRect.width + sliderPaddingLeft; |
|||
sliderRect.width = rect.width - labelRect.width - sliderPaddingRight; |
|||
float newVal = GUI.HorizontalSlider(sliderRect, cam.aperture.floatValue, Camera.kMinAperture, Camera.kMaxAperture); |
|||
|
|||
// keep only 2 digits of precision, like the otehr editor fields
|
|||
newVal = Mathf.Floor(100 * newVal) / 100.0f; |
|||
|
|||
if (cam.aperture.floatValue != newVal) |
|||
{ |
|||
cam.aperture.floatValue = newVal; |
|||
// Note: We need to move the focus when the slider changes, otherwise the textField will not update
|
|||
GUI.FocusControl("ApertureSlider"); |
|||
} |
|||
|
|||
var unitRect = rect; |
|||
unitRect.x += rect.width - unitRectPaddingRight; |
|||
unitRect.width = textRectSize; |
|||
unitRect.height = EditorGUIUtility.singleLineHeight; |
|||
EditorGUI.LabelField(unitRect, "f /", EditorStyles.label); |
|||
|
|||
var textRect = rect; |
|||
textRect.x = rect.width - textRectPaddingRight; |
|||
textRect.width = textRectSize; |
|||
textRect.height = EditorGUIUtility.singleLineHeight; |
|||
string newAperture = EditorGUI.TextField(textRect, cam.aperture.floatValue.ToString()); |
|||
if (float.TryParse(newAperture, out float parsedValue)) |
|||
cam.aperture.floatValue = Mathf.Clamp(parsedValue, Camera.kMinAperture, Camera.kMaxAperture); |
|||
} |
|||
|
|||
EditorGUILayout.EndHorizontal(); |
|||
EditorGUILayout.Space(EditorGUIUtility.singleLineHeight); |
|||
} |
|||
|
|||
/// <summary>Draws Aperture Shape related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_PhysicalCamera_ApertureShape(ISerializedCamera p, Editor owner) |
|||
{ |
|||
var cam = p.baseCameraSettings; |
|||
|
|||
EditorGUILayout.PropertyField(cam.bladeCount, Styles.bladeCount); |
|||
|
|||
using (var horizontal = new EditorGUILayout.HorizontalScope()) |
|||
using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.curvature, cam.curvature)) |
|||
{ |
|||
var v = cam.curvature.vector2Value; |
|||
|
|||
// The layout system breaks alignment when mixing inspector fields with custom layout'd
|
|||
// fields as soon as a scrollbar is needed in the inspector, so we'll do the layout
|
|||
// manually instead
|
|||
const int kFloatFieldWidth = 50; |
|||
const int kSeparatorWidth = 5; |
|||
float indentOffset = EditorGUI.indentLevel * 15f; |
|||
var lineRect = EditorGUILayout.GetControlRect(); |
|||
var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height); |
|||
var floatFieldLeft = new Rect(labelRect.xMax, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); |
|||
var sliderRect = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height); |
|||
var floatFieldRight = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); |
|||
|
|||
EditorGUI.PrefixLabel(labelRect, propertyScope.content); |
|||
v.x = EditorGUI.FloatField(floatFieldLeft, v.x); |
|||
EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, Camera.kMinAperture, Camera.kMaxAperture); |
|||
v.y = EditorGUI.FloatField(floatFieldRight, v.y); |
|||
cam.curvature.vector2Value = v; |
|||
} |
|||
|
|||
EditorGUILayout.PropertyField(cam.barrelClipping, Styles.barrelClipping); |
|||
EditorGUILayout.PropertyField(cam.anamorphism, Styles.anamorphism); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: b7fbad490dc4ecc46b2936be42e9c71f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,116 @@ |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
public static partial class PhysicalCamera |
|||
{ |
|||
/// <summary>
|
|||
/// Styles
|
|||
/// </summary>
|
|||
public static class Styles |
|||
{ |
|||
// Camera Body
|
|||
/// <summary>
|
|||
/// Camera Body content
|
|||
/// </summary>
|
|||
public static readonly GUIContent cameraBody = EditorGUIUtility.TrTextContent("Camera Body"); |
|||
|
|||
/// <summary>
|
|||
/// Sensor type content
|
|||
/// </summary>
|
|||
public static readonly GUIContent sensorType = EditorGUIUtility.TrTextContent("Sensor Type", "Common sensor sizes. Choose an item to set Sensor Size, or edit Sensor Size for your custom settings."); |
|||
|
|||
/// <summary>
|
|||
/// Aperture format names
|
|||
/// </summary>
|
|||
public static readonly string[] apertureFormatNames = CameraEditor.Settings.ApertureFormatNames.ToArray(); |
|||
|
|||
/// <summary>
|
|||
/// Aperture format values
|
|||
/// </summary>
|
|||
public static readonly Vector2[] apertureFormatValues = CameraEditor.Settings.ApertureFormatValues.ToArray(); |
|||
|
|||
/// <summary>
|
|||
/// Custom preset index
|
|||
/// </summary>
|
|||
public static readonly int customPresetIndex = apertureFormatNames.Length - 1; |
|||
|
|||
/// <summary>
|
|||
/// Sensor size
|
|||
/// </summary>
|
|||
public static readonly GUIContent sensorSize = EditorGUIUtility.TrTextContent("Sensor Size", "The size of the camera sensor in millimeters."); |
|||
|
|||
/// <summary>
|
|||
/// Gate Fit
|
|||
/// </summary>
|
|||
public static readonly GUIContent gateFit = EditorGUIUtility.TrTextContent("Gate Fit", "Determines how the rendered area (resolution gate) fits into the sensor area (film gate)."); |
|||
|
|||
// Lens
|
|||
/// <summary>
|
|||
/// Lens content
|
|||
/// </summary>
|
|||
public static readonly GUIContent lens = EditorGUIUtility.TrTextContent("Lens"); |
|||
|
|||
/// <summary>
|
|||
/// Focal Length content
|
|||
/// </summary>
|
|||
public static readonly GUIContent focalLength = EditorGUIUtility.TrTextContent("Focal Length", "The simulated distance between the lens and the sensor of the physical camera. Larger values give a narrower field of view."); |
|||
|
|||
/// <summary>
|
|||
/// Shift content
|
|||
/// </summary>
|
|||
public static readonly GUIContent shift = EditorGUIUtility.TrTextContent("Shift", "Offset from the camera sensor. Use these properties to simulate a shift lens. Measured as a multiple of the sensor size."); |
|||
|
|||
/// <summary>
|
|||
/// ISO content
|
|||
/// </summary>
|
|||
public static readonly GUIContent ISO = EditorGUIUtility.TrTextContent("ISO", "Sets the light sensitivity of the Camera sensor. This property affects Exposure if you set its Mode to Use Physical Camera."); |
|||
|
|||
/// <summary>
|
|||
/// Shutter Speed content
|
|||
/// </summary>
|
|||
public static readonly GUIContent shutterSpeed = EditorGUIUtility.TrTextContent("Shutter Speed", "The amount of time the Camera sensor is capturing light."); |
|||
|
|||
/// <summary>
|
|||
/// Aperture content
|
|||
/// </summary>
|
|||
public static readonly GUIContent aperture = EditorGUIUtility.TrTextContent("Aperture", "The f-stop (f-number) of the lens. Lower values give a wider lens aperture."); |
|||
|
|||
/// <summary>
|
|||
/// Focus Distance content
|
|||
/// </summary>
|
|||
public static readonly GUIContent focusDistance = EditorGUIUtility.TrTextContent("Focus Distance", "The distance from the camera where objects appear sharp when Depth Of Field is enabled."); |
|||
|
|||
// Aperture Shape
|
|||
|
|||
/// <summary>
|
|||
/// Aperture Shape content
|
|||
/// </summary>
|
|||
public static readonly GUIContent apertureShape = EditorGUIUtility.TrTextContent("Aperture Shape", "Common sensor sizes. Choose an item to set Sensor Size, or edit Sensor Size for your custom settings."); |
|||
|
|||
/// <summary>
|
|||
/// Blade Count content
|
|||
/// </summary>
|
|||
public static readonly GUIContent bladeCount = EditorGUIUtility.TrTextContent("Blade Count", "The number of blades in the lens aperture. Higher values give a rounder aperture shape."); |
|||
|
|||
/// <summary>
|
|||
/// Curvature content
|
|||
/// </summary>
|
|||
public static readonly GUIContent curvature = EditorGUIUtility.TrTextContent("Curvature", "Controls the curvature of the lens aperture blades. The minimum value results in fully-curved, perfectly-circular bokeh, and the maximum value results in visible aperture blades."); |
|||
|
|||
/// <summary>
|
|||
/// Barrel Clipping content
|
|||
/// </summary>
|
|||
public static readonly GUIContent barrelClipping = EditorGUIUtility.TrTextContent("Barrel Clipping", "Controls the self-occlusion of the lens, creating a cat's eye effect."); |
|||
|
|||
/// <summary>
|
|||
/// Anamorphism content
|
|||
/// </summary>
|
|||
public static readonly GUIContent anamorphism = EditorGUIUtility.TrTextContent("Anamorphism", "Use the slider to stretch the sensor to simulate an anamorphic look."); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 7e978521b37d51146b2cc9750ebfa16c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,40 @@ |
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
public static partial class Rendering |
|||
{ |
|||
/// <summary>Draws Stop NaNs related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Rendering_StopNaNs(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.stopNaNs, Styles.stopNaNs); |
|||
} |
|||
|
|||
/// <summary>Draws Dithering related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Rendering_Dithering(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.dithering, Styles.dithering); |
|||
} |
|||
|
|||
/// <summary>Draws Culling mask related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Rendering_CullingMask(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.baseCameraSettings.cullingMask, Styles.cullingMask); |
|||
} |
|||
|
|||
/// <summary>Draws occlusion Culling related fields on the inspector</summary>
|
|||
/// <param name="p"><see cref="ISerializedCamera"/> The serialized camera</param>
|
|||
/// <param name="owner"><see cref="Editor"/> The editor owner calling this drawer</param>
|
|||
public static void Drawer_Rendering_OcclusionCulling(ISerializedCamera p, Editor owner) |
|||
{ |
|||
EditorGUILayout.PropertyField(p.baseCameraSettings.occlusionCulling, Styles.occlusionCulling); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 6cf20b5e989565749903509e13e351f6 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,59 @@ |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
/// <summary>
|
|||
/// Rendering section
|
|||
/// </summary>
|
|||
public static partial class Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Styles
|
|||
/// </summary>
|
|||
public static class Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Header of the section
|
|||
/// </summary>
|
|||
public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Rendering", "These settings control for the specific rendering features for this camera."); |
|||
|
|||
/// <summary>
|
|||
/// antialiasing content
|
|||
/// </summary>
|
|||
public static readonly GUIContent antialiasing = EditorGUIUtility.TrTextContent("Post Anti-aliasing", "The postprocess anti-aliasing method to use."); |
|||
|
|||
/// <summary>
|
|||
/// dithering content
|
|||
/// </summary>
|
|||
public static readonly GUIContent dithering = EditorGUIUtility.TrTextContent("Dithering", "Applies 8-bit dithering to the final render to reduce color banding."); |
|||
|
|||
/// <summary>
|
|||
/// stopNaNs content
|
|||
/// </summary>
|
|||
public static readonly GUIContent stopNaNs = EditorGUIUtility.TrTextContent("Stop NaNs", "Automatically replaces NaN/Inf in shaders by a black pixel to avoid breaking some effects. This will slightly affect performances and should only be used if you experience NaN issues that you can't fix."); |
|||
|
|||
/// <summary>
|
|||
/// cullingMask content
|
|||
/// </summary>
|
|||
public static readonly GUIContent cullingMask = EditorGUIUtility.TrTextContent("Culling Mask"); |
|||
|
|||
/// <summary>
|
|||
/// occlusionCulling content
|
|||
/// </summary>
|
|||
public static readonly GUIContent occlusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling"); |
|||
|
|||
/// <summary>
|
|||
/// renderingPath content
|
|||
/// </summary>
|
|||
public static readonly GUIContent renderingPath = EditorGUIUtility.TrTextContent("Custom Frame Settings", "Define the custom Frame Settings for this Camera to use."); |
|||
|
|||
/// <summary>
|
|||
/// exposureTarget content
|
|||
/// </summary>
|
|||
public static readonly GUIContent exposureTarget = EditorGUIUtility.TrTextContent("Exposure Target", "The object used as a target for centering the Exposure's Procedural Mask metering mode when target object option is set (See Exposure Volume Component)."); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 96acda4e859ca224986250b52266e0c9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,63 @@ |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
public static partial class CameraUI |
|||
{ |
|||
/// <summary>
|
|||
/// Styles
|
|||
/// </summary>
|
|||
public static class Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Projection section header
|
|||
/// </summary>
|
|||
public static GUIContent projectionSettingsHeaderContent { get; } = EditorGUIUtility.TrTextContent("Projection"); |
|||
|
|||
/// <summary>
|
|||
/// Clipping planes content
|
|||
/// </summary>
|
|||
public static GUIContent clippingPlaneMultiFieldTitle = EditorGUIUtility.TrTextContent("Clipping Planes"); |
|||
|
|||
/// <summary>
|
|||
/// Projection Content
|
|||
/// </summary>
|
|||
public static readonly GUIContent projectionContent = EditorGUIUtility.TrTextContent("Projection", "How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective."); |
|||
|
|||
/// <summary>
|
|||
/// Size content
|
|||
/// </summary>
|
|||
public static readonly GUIContent sizeContent = EditorGUIUtility.TrTextContent("Size"); |
|||
|
|||
/// <summary>
|
|||
/// FOV content
|
|||
/// </summary>
|
|||
public static readonly GUIContent fieldOfViewContent = EditorGUIUtility.TrTextContent("Field of View", "The height of the Camera's view angle, measured in degrees along the specified axis."); |
|||
|
|||
/// <summary>
|
|||
/// FOV Axis content
|
|||
/// </summary>
|
|||
public static readonly GUIContent FOVAxisModeContent = EditorGUIUtility.TrTextContent("Field of View Axis", "The axis the Camera's view angle is measured along."); |
|||
|
|||
/// <summary>
|
|||
/// Physical camera content
|
|||
/// </summary>
|
|||
public static readonly GUIContent physicalCameraContent = EditorGUIUtility.TrTextContent("Physical Camera", "Enables Physical camera mode for FOV calculation. When checked, the field of view is calculated from properties for simulating physical attributes (focal length, sensor size, and lens shift)."); |
|||
|
|||
/// <summary>
|
|||
/// Near plane content
|
|||
/// </summary>
|
|||
public static readonly GUIContent nearPlaneContent = EditorGUIUtility.TrTextContent("Near", "The closest point relative to the camera that drawing occurs."); |
|||
|
|||
/// <summary>
|
|||
/// Far plane content
|
|||
/// </summary>
|
|||
public static readonly GUIContent farPlaneContent = EditorGUIUtility.TrTextContent("Far", "The furthest point relative to the camera that drawing occurs."); |
|||
|
|||
/// <summary>
|
|||
/// Message displayed about unsupported fields for Camera Presets
|
|||
/// </summary>
|
|||
public static readonly string unsupportedPresetPropertiesMessage = L10n.Tr("When using Preset of Camera Component, only a subset of properties are supported. Unsupported properties are hidden."); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: e26c221569d1d284a9d21434b3a4b277 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,42 @@ |
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Interface to be implemented by each pipeline to hold the <see cref="SerializedObject"/> for a Camera Editor
|
|||
/// </summary>
|
|||
public interface ISerializedCamera |
|||
{ |
|||
/// <summary>The camera serialized</summary>
|
|||
SerializedObject serializedObject { get; } |
|||
/// <summary>The additional camera data serialized</summary>
|
|||
SerializedObject serializedAdditionalDataObject { get; } |
|||
/// <summary>The base camera settings</summary>
|
|||
CameraEditor.Settings baseCameraSettings { get; } |
|||
|
|||
// This one is internal in UnityEditor for whatever reason...
|
|||
/// <summary>The projection matrix mode</summary>
|
|||
SerializedProperty projectionMatrixMode { get; } |
|||
|
|||
// Common properties
|
|||
/// <summary>Dithering property</summary>
|
|||
SerializedProperty dithering { get; } |
|||
/// <summary>Stop NaNs property</summary>
|
|||
SerializedProperty stopNaNs { get; } |
|||
/// <summary>Allow Dynamic resolution property</summary>
|
|||
SerializedProperty allowDynamicResolution { get; } |
|||
/// <summary>Volume layer mask property</summary>
|
|||
SerializedProperty volumeLayerMask { get; } |
|||
/// <summary>Clear Depth property property</summary>
|
|||
SerializedProperty clearDepth { get; } |
|||
/// <summary>Anti aliasing property</summary>
|
|||
SerializedProperty antialiasing { get; } |
|||
|
|||
/// <summary>Method that updates the <see cref="SerializedObject"/> of the Camera and the Additional Camera Data</summary>
|
|||
void Update(); |
|||
|
|||
/// <summary>Applies the modified properties to the <see cref="SerializedObject"/> of the Camera and the Additional Camera Data</summary>
|
|||
void Apply(); |
|||
|
|||
/// <summary>Refreshes the <see cref="SerializedProperty"/> of the <see cref="SerializedObject"/> of the Camera and the Additional Camera Data</summary>
|
|||
void Refresh(); |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 55ef358f023224145a079dd70d4692b5 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,123 @@ |
|||
using UnityEngine; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Utility functions for cameras in the editor.
|
|||
/// </summary>
|
|||
public static class CameraEditorUtils |
|||
{ |
|||
/// <summary>Delegate that must give an initialized preview camera</summary>
|
|||
/// <param name="sourceCamera">The initial Camera we want a preview from</param>
|
|||
/// <param name="previewSize">The size of the preview</param>
|
|||
/// <returns>The Preview camera, initialized</returns>
|
|||
public delegate Camera GetPreviewCamera(Camera sourceCamera, Vector2 previewSize); |
|||
|
|||
const float k_PreviewNormalizedSize = 0.2f; |
|||
|
|||
internal static Material s_GUITextureBlit2SRGBMaterial; |
|||
|
|||
/// <summary>
|
|||
/// The material used to display a texture into SRGB
|
|||
/// </summary>
|
|||
public static Material GUITextureBlit2SRGBMaterial |
|||
{ |
|||
get |
|||
{ |
|||
if (!s_GUITextureBlit2SRGBMaterial) |
|||
{ |
|||
Shader shader = EditorGUIUtility.LoadRequired("SceneView/GUITextureBlit2SRGB.shader") as Shader; |
|||
s_GUITextureBlit2SRGBMaterial = new Material(shader); |
|||
s_GUITextureBlit2SRGBMaterial.hideFlags = HideFlags.HideAndDontSave; |
|||
} |
|||
s_GUITextureBlit2SRGBMaterial.SetFloat("_ManualTex2SRGB", QualitySettings.activeColorSpace == ColorSpace.Linear ? 1.0f : 0.0f); |
|||
return s_GUITextureBlit2SRGBMaterial; |
|||
} |
|||
} |
|||
/// <summary>
|
|||
/// Draw the overlay of a Camera
|
|||
/// </summary>
|
|||
/// <param name="target">The Camera that we want a preview</param>
|
|||
/// <param name="sceneView">The scene view where to draw it</param>
|
|||
/// <param name="previewCameraGetter">The way to get the preview camera corresponding to the target</param>
|
|||
|
|||
public static void DrawCameraSceneViewOverlay(Object target, SceneView sceneView, GetPreviewCamera previewCameraGetter) |
|||
{ |
|||
if (target == null) return; |
|||
|
|||
// cache some deep values
|
|||
var c = (Camera)target; |
|||
|
|||
var previewSize = Handles.GetMainGameViewSize(); |
|||
if (previewSize.x < 0f) |
|||
{ |
|||
// Fallback to Scene View of not a valid game view size
|
|||
previewSize.x = sceneView.position.width; |
|||
previewSize.y = sceneView.position.height; |
|||
} |
|||
// Apply normalizedviewport rect of camera
|
|||
var normalizedViewPortRect = c.rect; |
|||
previewSize.x *= Mathf.Max(normalizedViewPortRect.width, 0f); |
|||
previewSize.y *= Mathf.Max(normalizedViewPortRect.height, 0f); |
|||
|
|||
// Prevent using invalid previewSize
|
|||
if (previewSize.x <= 0f || previewSize.y <= 0f) |
|||
return; |
|||
|
|||
var aspect = previewSize.x / previewSize.y; |
|||
|
|||
// Scale down (fit to scene view)
|
|||
previewSize.y = k_PreviewNormalizedSize * sceneView.position.height; |
|||
previewSize.x = previewSize.y * aspect; |
|||
if (previewSize.y > sceneView.position.height * 0.5f) |
|||
{ |
|||
previewSize.y = sceneView.position.height * 0.5f; |
|||
previewSize.x = previewSize.y * aspect; |
|||
} |
|||
if (previewSize.x > sceneView.position.width * 0.5f) |
|||
{ |
|||
previewSize.x = sceneView.position.width * 0.5f; |
|||
previewSize.y = previewSize.x / aspect; |
|||
} |
|||
|
|||
// Get and reserve rect
|
|||
Rect cameraRect = GUILayoutUtility.GetRect(previewSize.x, previewSize.y); |
|||
|
|||
if (Event.current.type == EventType.Repaint) |
|||
{ |
|||
var previewCamera = previewCameraGetter(c, previewSize); |
|||
if (previewCamera.targetTexture == null) |
|||
{ |
|||
Debug.LogError("The preview camera must render in a render target"); |
|||
return; |
|||
} |
|||
|
|||
bool drawGizmo = sceneView.drawGizmos; |
|||
sceneView.drawGizmos = false; |
|||
previewCamera.Render(); |
|||
sceneView.drawGizmos = drawGizmo; |
|||
Graphics.DrawTexture(cameraRect, previewCamera.targetTexture, new Rect(0, 0, 1, 1), 0, 0, 0, 0, GUI.color, GUITextureBlit2SRGBMaterial); |
|||
// We set target texture to null after this call otherwise if both sceneview and gameview are visible and we have a preview camera wwe
|
|||
// get this error: "Releasing render texture that is set as Camera.targetTexture!"
|
|||
previewCamera.targetTexture = null; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Check if the view port rect have a positive size
|
|||
/// </summary>
|
|||
/// <param name="normalizedViewPortRect">The rect to check</param>
|
|||
/// <returns>True: the rect have positive size</returns>
|
|||
public static bool IsViewPortRectValidToRender(Rect normalizedViewPortRect) |
|||
{ |
|||
if (normalizedViewPortRect.width <= 0f || normalizedViewPortRect.height <= 0f) |
|||
return false; |
|||
if (normalizedViewPortRect.x >= 1f || normalizedViewPortRect.xMax <= 0f) |
|||
return false; |
|||
if (normalizedViewPortRect.y >= 1f || normalizedViewPortRect.yMax <= 0f) |
|||
return false; |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: c9fabbcdc8ab50c44a8112c70c67735c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: ef6e93ebaf391ed43a0bdcc1aa77ee74 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 9ee4775791ff6f8448490ba9f74d2f5b |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,455 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
class CommandBufferGenerator |
|||
{ |
|||
// When adding new functions to the core command buffer and you want to expose them to the rendergraph command buffers please
|
|||
// add them to the appropriate lists below.
|
|||
|
|||
// Functions going in all command buffers
|
|||
static List<FunctionInfo> baseFunctions = new List<FunctionInfo> { |
|||
new FunctionInfo("SetGlobalFloat", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalInt", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalInteger", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalVector", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalColor", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalMatrix", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalFloatArray", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalVectorArray", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalMatrixArray", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalTexture", textureArg: "value", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalBuffer", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetGlobalConstantBuffer", textureArg: "", modifiesGlobalState: true), |
|||
"SetLateLatchProjectionMatrices", |
|||
"MarkLateLatchMatrixShaderPropertyID", |
|||
"UnmarkLateLatchMatrix", |
|||
new FunctionInfo("EnableShaderKeyword", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("EnableKeyword", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("DisableShaderKeyword", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("DisableKeyword", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetKeyword", textureArg: "", modifiesGlobalState: true), |
|||
"SetShadowSamplingMode", |
|||
"SetSinglePassStereo", |
|||
"IssuePluginEvent", |
|||
"IssuePluginEventAndData", |
|||
"IssuePluginCustomBlit", |
|||
"IssuePluginCustomTextureUpdateV2", |
|||
"SetInvertCulling", |
|||
"EnableScissorRect", |
|||
"DisableScissorRect", |
|||
"SetViewport", |
|||
"SetGlobalDepthBias", |
|||
"BeginSample", |
|||
"EndSample", |
|||
"IncrementUpdateCount", |
|||
"SetViewProjectionMatrices", |
|||
"SetupCameraProperties", |
|||
"InvokeOnRenderObjectCallbacks" |
|||
}; |
|||
|
|||
// Functions for compute only
|
|||
static List<FunctionInfo> computeFunctions = new List<FunctionInfo> { |
|||
"SetComputeFloatParam", |
|||
"SetComputeIntParam", |
|||
"SetComputeVectorArrayParam", |
|||
"SetComputeMatrixParam", |
|||
"SetComputeMatrixArrayParam", |
|||
"SetComputeFloatParams", |
|||
"SetComputeIntParams", |
|||
new FunctionInfo("SetComputeTextureParam", textureArg: "rt"), |
|||
"SetComputeBufferParam", |
|||
"SetComputeConstantBufferParam", |
|||
"SetComputeFloatParam", |
|||
"SetComputeIntParam", |
|||
"SetComputeVectorParam", |
|||
"SetComputeVectorArrayParam", |
|||
"SetComputeMatrixParam", |
|||
"DispatchCompute", |
|||
"BuildRayTracingAccelerationStructure", |
|||
"SetRayTracingAccelerationStructure", |
|||
"SetRayTracingBufferParam", |
|||
"SetRayTracingConstantBufferParam", |
|||
new FunctionInfo("SetRayTracingTextureParam", textureArg: "rt"), |
|||
"SetRayTracingFloatParam", |
|||
"SetRayTracingFloatParams", |
|||
"SetRayTracingIntParam", |
|||
"SetRayTracingIntParams", |
|||
"SetRayTracingVectorParam", |
|||
"SetRayTracingVectorArrayParam", |
|||
"SetRayTracingMatrixParam", |
|||
"SetRayTracingMatrixArrayParam", |
|||
"DispatchRays", |
|||
"SetBufferData", |
|||
"SetBufferCounterValue", |
|||
"CopyCounterValue" |
|||
}; |
|||
|
|||
// Functions for raster (native render passes) only
|
|||
static List<FunctionInfo> rasterFunctions = new List<FunctionInfo> { |
|||
new FunctionInfo("DrawMesh", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawMultipleMeshes", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawRenderer", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawRendererList", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawProcedural", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawProceduralIndirect", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawMeshInstanced", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawMeshInstancedProcedural", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawMeshInstancedIndirect", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("DrawOcclusionMesh", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("SetInstanceMultiplier", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("ClearRenderTarget", textureArg : "", modifiesGlobalState : false, triggersRasterization: true), |
|||
new FunctionInfo("SetFoveatedRenderingMode", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("ConfigureFoveatedRendering", textureArg: "", modifiesGlobalState: true), |
|||
new FunctionInfo("SetWireframe", textureArg: "", modifiesGlobalState: true), |
|||
}; |
|||
|
|||
// Functions for unsafe (wrapper around Commandbuffer) only
|
|||
static List<FunctionInfo> unsafeFunctions = new List<FunctionInfo> { |
|||
"SetRenderTarget", |
|||
"Clear", |
|||
"RequestAsyncReadbackIntoNativeArray", |
|||
}; |
|||
// Generated file header
|
|||
static string preamble = |
|||
@"
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.Collections; |
|||
using UnityEngine.Profiling; |
|||
using Unity.Profiling; |
|||
using UnityEngine.Rendering.RenderGraphModule; |
|||
|
|||
// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
|||
//
|
|||
// This file is automatically generated by reflection on the UnityEngine.Rendering.CommandBuffer type.
|
|||
// If you changed the command buffer and want to expose the changes here please open and SRP project
|
|||
// ""Edit/Rendering/Generate Core CommandBuffers"" menu option.
|
|||
// This will generate the new command buffer C# files in the project root.
|
|||
//
|
|||
// Note that while automated,this doesn't mean you won't have to think. Please consider any new methods on the command
|
|||
// buffer if they are safe to be executed on the async compute queue or not, if they can be executed inside a
|
|||
// native render pass or not,... and add the function to the appropriate lists in CommandBufferGenerator.cs in the
|
|||
// com.unity.render-pipelines.core\Editor\CommandBuffers\CommandBufferGenerator\CommandBufferGenerator.cs.
|
|||
// If you are unsure please ask the RenderGraph package owners for advise.
|
|||
//
|
|||
// Once generated, review the generated file and move the approved files into:
|
|||
// <unity root>\Packages\com.unity.render-pipelines.core\Runtime\CommandBuffers\
|
|||
//
|
|||
// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
|||
namespace UnityEngine.Rendering |
|||
{ |
|||
";
|
|||
|
|||
// Generated class header
|
|||
static string classPreamble = |
|||
@"
|
|||
/// <summary>
|
|||
/// @docString@
|
|||
/// </summary>
|
|||
public class @type_name@ : @base_type@ |
|||
{ |
|||
// @type_name@ is not created by users. The render graph creates them and passes them to the execute callback of the graph pass.
|
|||
internal @type_name@(CommandBuffer wrapped, RenderGraphPass executingPass, bool isAsync) : base(wrapped, executingPass, isAsync) { } |
|||
";
|
|||
|
|||
|
|||
// Generated interface header
|
|||
static string interfacePeamble = |
|||
@"
|
|||
/// <summary>
|
|||
/// @docString@
|
|||
/// </summary>
|
|||
public interface @type_name@ @base_type@ |
|||
{ |
|||
";
|
|||
|
|||
// Generated file footer
|
|||
static string postamble = |
|||
@"
|
|||
} |
|||
} |
|||
";
|
|||
|
|||
// Generated individual function template
|
|||
static string functionTemplate = |
|||
@"
|
|||
/// <summary>Wraps [{0}](https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.{0}.html) on a CommandBuffer.</summary>
|
|||
{1} |
|||
public void {0}{5}({2}) {6} {{ {4} m_WrappedCommandBuffer.{0}({3}); }} |
|||
";
|
|||
|
|||
// Generated individual function template
|
|||
static string interfaceFunctionTemplate = |
|||
@"
|
|||
/// <summary>Wraps [{0}](https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.{0}.html) on a CommandBuffer.</summary>
|
|||
{1} |
|||
public void {0}{5}({2}) {6}; |
|||
";
|
|||
|
|||
static string paramDocTemplate = |
|||
@" /// <param name=""{0}"">[See CommandBuffer documentation](https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.{1}.html)</param>"; |
|||
|
|||
static string typeParamDocTemplate = |
|||
@" /// <typeparam name=""{0}"">[See CommandBuffer documentation](https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.{1}.html)</typeparam>"; |
|||
|
|||
struct FunctionInfo |
|||
{ |
|||
public FunctionInfo(string name, string textureArg, bool modifiesGlobalState = false, bool triggersRasterization = false) |
|||
{ |
|||
this.name = name; |
|||
this.textureArgs = textureArg; |
|||
this.modifiesGlobalState = modifiesGlobalState; |
|||
this.triggersRasterization = triggersRasterization; |
|||
} |
|||
|
|||
public static implicit operator FunctionInfo(string value) |
|||
{ |
|||
return new FunctionInfo(value, "", false); |
|||
} |
|||
|
|||
// Name of the function to expose, all overloads are exposed with it.
|
|||
public string name; |
|||
// Name of a texture pointer argument. This will receive extra validation for the Rendergraph.
|
|||
public string textureArgs; |
|||
// Indicate if the function modifies global render state.
|
|||
public bool modifiesGlobalState; |
|||
// Indicate if the function actually triggers rasterization and may thus cause pixel shader invocations.
|
|||
public bool triggersRasterization; |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// Generate a commandbuffer type exposing only certain methods of the base commandbuffer class
|
|||
/// </summary>
|
|||
/// <param name="className">Name of the new class</param>
|
|||
/// <param name="docString">Description of the class</param>
|
|||
/// <param name="baseType">Classes from which this new class inherits</param>
|
|||
/// <param name="isInterface">Whether or not the new class is an interface</param>
|
|||
/// <param name="validateRaster">Whether or not the functions in this class should validate that a raster commandbuffer has any render targets</param>
|
|||
/// <param name="functionList">List of functions on commandbuffer to expose</param>
|
|||
static void GenerateCommandBufferType(string className, string docString, string baseType, bool isInterface, bool validateRaster, IEnumerable<FunctionInfo> functionList) |
|||
{ |
|||
StringBuilder result = new StringBuilder(); |
|||
result.Append(preamble); |
|||
|
|||
var str = (isInterface) ? interfacePeamble : classPreamble; |
|||
str = str.Replace("@type_name@", className); |
|||
str = str.Replace("@base_type@", baseType); |
|||
str = str.Replace("@docString@", docString); |
|||
result.Append(str); |
|||
|
|||
Type commandBufferType = typeof(CommandBuffer); |
|||
//To restrict return properties. If all properties are required don't provide flag.
|
|||
BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; |
|||
var methods = commandBufferType.GetMethods(flags); |
|||
|
|||
foreach (var method in methods) |
|||
{ |
|||
bool allowed = false; |
|||
FunctionInfo info = new FunctionInfo(); |
|||
foreach (var fn in functionList) |
|||
{ |
|||
if (fn.name == method.Name) |
|||
{ |
|||
allowed = true; |
|||
info = fn; |
|||
break; |
|||
} |
|||
} |
|||
if (!allowed) continue; |
|||
|
|||
StringBuilder argList = new StringBuilder(); |
|||
StringBuilder typedArgList = new StringBuilder(); |
|||
StringBuilder argDocList = new StringBuilder(); |
|||
StringBuilder validationCode = new StringBuilder(); |
|||
StringBuilder genericArgList = new StringBuilder(); |
|||
StringBuilder genericConstraints = new StringBuilder(); |
|||
|
|||
if (info.modifiesGlobalState) |
|||
{ |
|||
validationCode.Append("ThrowIfGlobalStateNotAllowed(); "); |
|||
} |
|||
|
|||
if (validateRaster && info.triggersRasterization) |
|||
{ |
|||
validationCode.Append("ThrowIfRasterNotAllowed(); "); |
|||
} |
|||
|
|||
var arguments = method.GetParameters(); |
|||
bool separator = false; |
|||
foreach (var arg in arguments) |
|||
{ |
|||
if (separator) |
|||
{ |
|||
argList.Append(", "); |
|||
typedArgList.Append(", "); |
|||
argDocList.Append("\n"); |
|||
} |
|||
separator = true; |
|||
|
|||
// Comma separated argument lists
|
|||
argList.Append(arg.Name); |
|||
|
|||
// Typed, comma separated argument lists
|
|||
// Texture args are replace to take a texture handle so we can do extra validation on them
|
|||
if (arg.Name == info.textureArgs) |
|||
{ |
|||
typedArgList.Append("TextureHandle"); |
|||
} |
|||
else |
|||
{ |
|||
typedArgList.Append(DecorateArgumentTypeString(arg)); |
|||
} |
|||
typedArgList.Append(" "); |
|||
typedArgList.Append(arg.Name); |
|||
|
|||
// Parameter docs
|
|||
argDocList.AppendFormat(paramDocTemplate, arg.Name, method.Name); |
|||
|
|||
if (arg.Name == info.textureArgs) |
|||
{ |
|||
validationCode.Append("ValidateTextureHandle(" + arg.Name + "); "); |
|||
} |
|||
} |
|||
|
|||
if (method.ContainsGenericParameters) |
|||
{ |
|||
// Hack: The current command buffer only inclues very simple single generic functions. We just hard code these but in the future we might need reflection on the generic arguments if needed.
|
|||
genericArgList.Append("<T>"); |
|||
genericConstraints.Append("where T : struct"); |
|||
argDocList.Append("\n"); |
|||
argDocList.AppendFormat(typeParamDocTemplate, "T", method.Name); |
|||
} |
|||
|
|||
result.AppendFormat((isInterface) ? interfaceFunctionTemplate : functionTemplate, method.Name, argDocList.ToString(), typedArgList.ToString(), argList.ToString(), validationCode.ToString(), genericArgList.ToString(), genericConstraints.ToString()); |
|||
} |
|||
|
|||
result.Append(postamble); |
|||
var outputFile = className + ".cs"; |
|||
File.WriteAllText(outputFile, result.ToString()); |
|||
Debug.Log("Wrote generated file to: " + Path.GetFullPath(outputFile) + " please review it, and if approved, move it to the 'com.unity.render-pipelines.core/Runtime/CommandBuffers/' folder."); |
|||
} |
|||
|
|||
// Replace CLI types with c# shorthands for cleaner code...
|
|||
static string CSharpFlavour(Type type) |
|||
{ |
|||
if (type == typeof(int)) |
|||
{ |
|||
return "int"; |
|||
} |
|||
else if (type == typeof(uint)) |
|||
{ |
|||
return "uint"; |
|||
} |
|||
else if (type == typeof(float)) |
|||
{ |
|||
return "float"; |
|||
} |
|||
else if (type == typeof(string)) |
|||
{ |
|||
return "string"; |
|||
} |
|||
else if (type == typeof(float)) |
|||
{ |
|||
return "float"; |
|||
} |
|||
else if (type == typeof(byte)) |
|||
{ |
|||
return "byte"; |
|||
} |
|||
else if (type == typeof(char)) |
|||
{ |
|||
return "float"; |
|||
} |
|||
else if (type == typeof(bool)) |
|||
{ |
|||
return "bool"; |
|||
} |
|||
return type.Name; |
|||
} |
|||
|
|||
// Return A c# code string for a given parameter. Works for most common cases
|
|||
// and simple generics.
|
|||
static string DecorateArgumentTypeString(ParameterInfo arg) |
|||
{ |
|||
var t = arg.ParameterType; |
|||
if (t.HasElementType) |
|||
{ |
|||
|
|||
// Determine whether the type is an array.
|
|||
if (t.IsArray) |
|||
{ |
|||
string prefix = ""; |
|||
if (arg.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0) |
|||
{ |
|||
prefix = "params "; |
|||
} |
|||
|
|||
return prefix + CSharpFlavour(t.GetElementType()) + "[]"; |
|||
} |
|||
|
|||
// Determine whether the type is an 'in' argument,
|
|||
else if (arg.IsIn) |
|||
{ |
|||
return "in " + CSharpFlavour(t.GetElementType()); |
|||
} |
|||
|
|||
// Determine whether the type is a reference. 'in' is also a reference but this was already handled above.
|
|||
else if (t.IsByRef) |
|||
{ |
|||
return "ref " + CSharpFlavour(t.GetElementType()); |
|||
} |
|||
else |
|||
{ |
|||
throw new NotImplementedException("Implement special type handling for " + t.Name); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
// Is this an undefined generic
|
|||
if (t.ContainsGenericParameters) |
|||
{ |
|||
//The current command buffer only includes very simple single generic functions. We just hard code these but in the future we might need reflection on the generic arguments if needed.
|
|||
// We strip the last two chars at the name is normally something like MyClass`1 for generics.
|
|||
var types = t.GenericTypeArguments; |
|||
if (types.Length > 1) throw new NotImplementedException("Implement generic handling for more than 1 argument"); |
|||
return t.Name.Substring(0, t.Name.Length - 2) + "<T>"; |
|||
} |
|||
// This is a defined generic like List<int>
|
|||
else if (t.IsConstructedGenericType) |
|||
{ |
|||
var types = t.GenericTypeArguments; |
|||
if (types.Length > 1) throw new NotImplementedException("Implement generic handling for more than 1 argument"); |
|||
return t.Name.Substring(0, t.Name.Length - 2) + "<" + CSharpFlavour(types[0]) + ">"; |
|||
} |
|||
else |
|||
{ |
|||
return CSharpFlavour(t); |
|||
} |
|||
} |
|||
} |
|||
|
|||
[MenuItem("Edit/Rendering/Generate Core CommandBuffers")] |
|||
static void GenerateCommandBufferTypes() |
|||
{ |
|||
GenerateCommandBufferType("IBaseCommandBuffer", "This interface declares functions shared by several command buffer types.", "", true, false, baseFunctions); |
|||
GenerateCommandBufferType("IRasterCommandBuffer", "This interface declares functions that are specific to a rasterization command buffer.", ": IBaseCommandBuffer", true, false, rasterFunctions); |
|||
GenerateCommandBufferType("IComputeCommandBuffer", "This interface declares functions that are specific to a compute command buffer.", ": IBaseCommandBuffer", true, false, computeFunctions); |
|||
GenerateCommandBufferType("IUnsafeCommandBuffer", "This interface declares functions that are specific to an unsafe command buffer.", ": IBaseCommandBuffer, IRasterCommandBuffer, IComputeCommandBuffer", true, false, unsafeFunctions); |
|||
|
|||
GenerateCommandBufferType("RasterCommandBuffer", "A command buffer that is used with a rasterization render graph pass.", "BaseCommandBuffer, IRasterCommandBuffer", false, true, baseFunctions.Concat(rasterFunctions)); |
|||
GenerateCommandBufferType("ComputeCommandBuffer", "A command buffer that is used with a compute render graph pass.", "BaseCommandBuffer, IComputeCommandBuffer", false, false, baseFunctions.Concat(computeFunctions)); |
|||
GenerateCommandBufferType("UnsafeCommandBuffer", "A command buffer that is used with an unsafe render graph pass.", "BaseCommandBuffer, IUnsafeCommandBuffer", false, false, baseFunctions.Concat(unsafeFunctions).Concat(rasterFunctions).Concat(computeFunctions)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 8a059bee53a757a408e35c70e82ac2fb |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,18 @@ |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Helper methods for overriding contextual menus
|
|||
/// </summary>
|
|||
static class ContextualMenuDispatcher |
|||
{ |
|||
[MenuItem("CONTEXT/ReflectionProbe/Remove Component")] |
|||
[MenuItem("CONTEXT/Light/Remove Component")] |
|||
[MenuItem("CONTEXT/Camera/Remove Component")] |
|||
static void RemoveComponentWithAdditionalData(MenuCommand command) |
|||
{ |
|||
RemoveComponentUtils.RemoveComponent(command.context as Component); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: b55ea781ffec78245a85c7b70fefee48 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
1002
Packages/com.unity.render-pipelines.core/Editor/CoreEditorDrawers.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 7e9fe0ff34cd022408422f6b92ad7df6 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,240 @@ |
|||
using System; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>Class containing constants</summary>
|
|||
public static class CoreEditorConstants |
|||
{ |
|||
/// <summary>Speed of additional properties highlight.</summary>
|
|||
public static readonly float additionalPropertiesHightLightSpeed = 0.3f; |
|||
|
|||
/// <summary>Standard UI spacing</summary>
|
|||
public static float standardHorizontalSpacing => 5f; |
|||
} |
|||
|
|||
/// <summary>Class containing style definition</summary>
|
|||
public static class CoreEditorStyles |
|||
{ |
|||
#region Styles
|
|||
|
|||
static System.Lazy<GUIStyle> m_SmallTickbox = new(() => new GUIStyle("ShurikenToggle")); |
|||
/// <summary>Style for a small checkbox</summary>
|
|||
public static GUIStyle smallTickbox => m_SmallTickbox.Value; |
|||
|
|||
static System.Lazy<GUIStyle> m_SmallMixedTickbox = new(() => new GUIStyle("ShurikenToggleMixed")); |
|||
/// <summary>Style for a small checkbox in mixed state</summary>
|
|||
public static GUIStyle smallMixedTickbox => m_SmallMixedTickbox.Value; |
|||
|
|||
static GUIStyle m_MiniLabelButton; |
|||
/// <summary>Style for a minilabel button</summary>
|
|||
public static GUIStyle miniLabelButton |
|||
{ |
|||
get |
|||
{ |
|||
if (m_MiniLabelButton == null) |
|||
{ |
|||
m_MiniLabelButton = new GUIStyle(EditorStyles.miniLabel) |
|||
{ |
|||
normal = new GUIStyleState |
|||
{ |
|||
background = m_TransparentTexture, |
|||
scaledBackgrounds = null, |
|||
textColor = Color.grey |
|||
} |
|||
}; |
|||
var activeState = new GUIStyleState |
|||
{ |
|||
background = m_TransparentTexture, |
|||
scaledBackgrounds = null, |
|||
textColor = Color.white |
|||
}; |
|||
m_MiniLabelButton.active = activeState; |
|||
m_MiniLabelButton.onNormal = activeState; |
|||
m_MiniLabelButton.onActive = activeState; |
|||
return m_MiniLabelButton; |
|||
} |
|||
|
|||
return m_MiniLabelButton; |
|||
} |
|||
} |
|||
|
|||
static System.Lazy<GUIStyle> m_ContextMenuStyle = new(() => new GUIStyle("IconButton")); |
|||
/// <summary>Context Menu button style</summary>
|
|||
public static GUIStyle contextMenuStyle => m_ContextMenuStyle.Value; |
|||
|
|||
static System.Lazy<GUIStyle> m_AdditionalPropertiesHighlightStyle = new(() => new GUIStyle { normal = { background = Texture2D.whiteTexture } }); |
|||
/// <summary>Style of a additional properties highlighted background.</summary>
|
|||
public static GUIStyle additionalPropertiesHighlightStyle => m_AdditionalPropertiesHighlightStyle.Value; |
|||
|
|||
/// <summary>Help icon style</summary>
|
|||
public static GUIStyle iconHelpStyle => GUI.skin.FindStyle("IconButton") ?? EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("IconButton"); |
|||
|
|||
static System.Lazy<GUIStyle> m_SectionHeaderStyle = new(() => new GUIStyle(EditorStyles.largeLabel) { richText = true, fontSize = 18, fixedHeight = 42 }); |
|||
/// <summary>Style of Section Headers.</summary>
|
|||
public static GUIStyle sectionHeaderStyle => m_SectionHeaderStyle.Value; |
|||
|
|||
static System.Lazy<GUIStyle> m_SubSectionHeaderStyle = new(() => new GUIStyle(EditorStyles.boldLabel)); |
|||
/// <summary>Style of Sub-Section Headers.</summary>
|
|||
public static GUIStyle subSectionHeaderStyle => m_SubSectionHeaderStyle.Value; |
|||
|
|||
|
|||
static System.Lazy<GUIStyle> m_HelpBox = new(() => |
|||
{ |
|||
var style = new GUIStyle() |
|||
{ |
|||
imagePosition = ImagePosition.ImageLeft, |
|||
fontSize = 10, |
|||
wordWrap = true, |
|||
alignment = TextAnchor.MiddleLeft |
|||
}; |
|||
style.normal.textColor = EditorStyles.helpBox.normal.textColor; |
|||
return style; |
|||
}); |
|||
internal static GUIStyle helpBox => m_HelpBox.Value; |
|||
|
|||
#endregion
|
|||
|
|||
#region Textures 2D
|
|||
|
|||
static Texture2D m_TransparentTexture; |
|||
|
|||
/// <summary><see cref="Texture2D"/> 1x1 pixel with red color</summary>
|
|||
public static readonly Texture2D redTexture; |
|||
/// <summary><see cref="Texture2D"/> 1x1 pixel with green color</summary>
|
|||
public static readonly Texture2D greenTexture; |
|||
/// <summary><see cref="Texture2D"/> 1x1 pixel with blue color</summary>
|
|||
public static readonly Texture2D blueTexture; |
|||
|
|||
/// <summary> PaneOption icon for dark skin</summary>
|
|||
static readonly Texture2D paneOptionsIconDark; |
|||
/// <summary> PaneOption icon for light skin</summary>
|
|||
static readonly Texture2D paneOptionsIconLight; |
|||
|
|||
/// <summary> PaneOption icon </summary>
|
|||
public static Texture2D paneOptionsIcon => EditorGUIUtility.isProSkin ? paneOptionsIconDark : paneOptionsIconLight; |
|||
|
|||
/// <summary> Warning icon </summary>
|
|||
public static readonly Texture2D iconWarn; |
|||
/// <summary> Help icon </summary>
|
|||
public static readonly Texture2D iconHelp; |
|||
/// <summary> Fail icon </summary>
|
|||
public static readonly Texture2D iconFail; |
|||
/// <summary> Success icon </summary>
|
|||
public static readonly Texture2D iconSuccess; |
|||
/// <summary> Complete icon </summary>
|
|||
public static readonly Texture2D iconComplete; |
|||
/// <summary> Pending icon </summary>
|
|||
public static readonly Texture2D iconPending; |
|||
|
|||
/// <summary>RenderPipeline Global Settings icon</summary>
|
|||
public static readonly Texture2D globalSettingsIcon; |
|||
|
|||
/// <summary>
|
|||
/// Gets the icon that describes the <see cref="MessageType"/>
|
|||
/// </summary>
|
|||
/// <param name="messageType">The <see cref="MessageType"/> to obtain the icon from</param>
|
|||
/// <returns>a <see cref="Texture2D"/> with the icon for the <see cref="MessageType"/></returns>
|
|||
internal static Texture2D GetMessageTypeIcon(MessageType messageType) |
|||
{ |
|||
switch (messageType) |
|||
{ |
|||
case MessageType.None: |
|||
return null; |
|||
case MessageType.Info: |
|||
return iconHelp; |
|||
case MessageType.Warning: |
|||
return iconWarn; |
|||
case MessageType.Error: |
|||
return iconFail; |
|||
default: |
|||
throw new ArgumentOutOfRangeException(nameof(messageType), messageType, null); |
|||
} |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region Colors
|
|||
|
|||
static readonly Color m_LightThemeBackgroundColor; |
|||
static readonly Color m_LightThemeBackgroundHighlightColor; |
|||
static readonly Color m_DarkThemeBackgroundColor; |
|||
static readonly Color m_DarkThemeBackgroundHighlightColor; |
|||
|
|||
/// <summary>Regular background color.</summary>
|
|||
public static Color backgroundColor => EditorGUIUtility.isProSkin ? m_DarkThemeBackgroundColor : m_LightThemeBackgroundColor; |
|||
|
|||
/// <summary>Hightlited background color.</summary>
|
|||
public static Color backgroundHighlightColor => EditorGUIUtility.isProSkin ? m_DarkThemeBackgroundHighlightColor : m_LightThemeBackgroundHighlightColor; |
|||
|
|||
#endregion
|
|||
|
|||
#region GUIContents
|
|||
|
|||
/// <summary>Context Menu button icon</summary>
|
|||
public static readonly GUIContent contextMenuIcon; |
|||
|
|||
/// <summary>Reset Content</summary>
|
|||
public static readonly GUIContent resetButtonLabel = EditorGUIUtility.TrTextContent("Reset"); |
|||
|
|||
/// <summary>Reset All content</summary>
|
|||
public static readonly GUIContent resetAllButtonLabel = EditorGUIUtility.TrTextContent("Reset All"); |
|||
|
|||
/// <summary>
|
|||
/// Empty space content in case that you want to keep the indentation but have nothing to write
|
|||
/// </summary>
|
|||
public static readonly GUIContent empty = EditorGUIUtility.TrTextContent(" "); |
|||
|
|||
#endregion
|
|||
|
|||
static CoreEditorStyles() |
|||
{ |
|||
m_TransparentTexture = new Texture2D(1, 1, GraphicsFormat.R8G8B8A8_SRGB, TextureCreationFlags.None) |
|||
{ |
|||
name = "transparent" |
|||
}; |
|||
m_TransparentTexture.SetPixel(0, 0, Color.clear); |
|||
m_TransparentTexture.Apply(); |
|||
|
|||
paneOptionsIconDark = CoreEditorUtils.LoadIcon("Builtin Skins/DarkSkin/Images", "pane options", ".png"); |
|||
paneOptionsIconDark.name = "pane options dark skin"; |
|||
paneOptionsIconLight = CoreEditorUtils.LoadIcon("Builtin Skins/LightSkin/Images", "pane options", ".png"); |
|||
paneOptionsIconLight.name = "pane options light skin"; |
|||
|
|||
m_LightThemeBackgroundColor = new Color(0.7843138f, 0.7843138f, 0.7843138f, 1.0f); |
|||
m_LightThemeBackgroundHighlightColor = new Color32(174, 174, 174, 255); |
|||
m_DarkThemeBackgroundColor = new Color(0.2196079f, 0.2196079f, 0.2196079f, 1.0f); |
|||
m_DarkThemeBackgroundHighlightColor = new Color32(77, 77, 77, 255); |
|||
|
|||
const string contextTooltip = ""; // To be defined (see with UX)
|
|||
contextMenuIcon = new GUIContent(paneOptionsIcon, contextTooltip); |
|||
|
|||
redTexture = CoreEditorUtils.CreateColoredTexture2D(Color.red, "Red 1x1"); |
|||
greenTexture = CoreEditorUtils.CreateColoredTexture2D(Color.green, "Green 1x1"); |
|||
blueTexture = CoreEditorUtils.CreateColoredTexture2D(Color.blue, "Blue 1x1"); |
|||
|
|||
iconHelp = CoreEditorUtils.FindTexture("_Help"); |
|||
iconWarn = CoreEditorUtils.LoadIcon("icons", "console.warnicon", ".png"); |
|||
iconFail = CoreEditorUtils.LoadIcon("icons", "console.erroricon", ".png"); |
|||
iconSuccess = EditorGUIUtility.FindTexture("TestPassed"); |
|||
iconComplete = CoreEditorUtils.LoadIcon("icons", "GreenCheckmark", ".png"); |
|||
iconPending = EditorGUIUtility.FindTexture("Toolbar Minus"); |
|||
|
|||
globalSettingsIcon = EditorGUIUtility.FindTexture("ScriptableObject Icon"); |
|||
|
|||
// Make sure that textures are unloaded on domain reloads.
|
|||
void OnBeforeAssemblyReload() |
|||
{ |
|||
Object.DestroyImmediate(redTexture); |
|||
Object.DestroyImmediate(greenTexture); |
|||
Object.DestroyImmediate(blueTexture); |
|||
Object.DestroyImmediate(m_TransparentTexture); |
|||
AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload; |
|||
} |
|||
|
|||
AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 106fd77ef6b30234597e56c849578bad |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
1417
Packages/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,13 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 744ceabda269e6c469964dda8c490d0d |
|||
timeCreated: 1507109827 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,81 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Reflection; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Core Render Pipeline preferences.
|
|||
/// </summary>
|
|||
public static class CoreRenderPipelinePreferences |
|||
{ |
|||
/// <summary>
|
|||
/// Path to the Render Pipeline Preferences
|
|||
/// </summary>
|
|||
public static readonly string corePreferencePath = "Preferences/Graphics"; |
|||
|
|||
private static readonly List<ICoreRenderPipelinePreferencesProvider> s_Providers = new(); |
|||
|
|||
[InitializeOnLoadMethod] |
|||
static void InitPreferenceProviders() |
|||
{ |
|||
foreach (var provider in TypeCache.GetTypesDerivedFrom<ICoreRenderPipelinePreferencesProvider>()) |
|||
{ |
|||
if (provider.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null) == null) |
|||
continue; |
|||
s_Providers.Add(Activator.CreateInstance(provider) as ICoreRenderPipelinePreferencesProvider); |
|||
} |
|||
|
|||
s_Providers.Sort((x, y) => GetDisplayInfoOrder(x.GetType()).CompareTo(GetDisplayInfoOrder(y.GetType()))); |
|||
} |
|||
|
|||
static int GetDisplayInfoOrder(Type type) |
|||
{ |
|||
var attribute = type.GetCustomAttribute<DisplayInfoAttribute>(); |
|||
return attribute?.order ?? int.MaxValue; |
|||
} |
|||
|
|||
[SettingsProvider] |
|||
static SettingsProvider PreferenceGUI() |
|||
{ |
|||
var provider = new SettingsProvider(corePreferencePath, SettingsScope.User) |
|||
{ |
|||
guiHandler = searchContext => |
|||
{ |
|||
using (new SettingsProviderGUIScope()) |
|||
{ |
|||
foreach (var providers in s_Providers) |
|||
{ |
|||
if (providers.header != null) |
|||
{ |
|||
EditorGUILayout.LabelField(providers.header, EditorStyles.boldLabel); |
|||
providers.PreferenceGUI(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
FillKeywords(provider); |
|||
|
|||
return provider; |
|||
} |
|||
|
|||
private static void FillKeywords(SettingsProvider provider) |
|||
{ |
|||
List<string> keywords = new List<string>(); |
|||
foreach (var providers in s_Providers) |
|||
keywords.AddRange(providers.keywords); |
|||
provider.keywords = keywords; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Open the Core Rendering Pipeline preference window.
|
|||
/// </summary>
|
|||
public static void Open() |
|||
{ |
|||
SettingsService.OpenUserPreferences(corePreferencePath); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 1c13e3f9217a6854ebb4d5d716b60103 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: f5415ef8821c020469ee7e810da8b3ff |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,14 @@ |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
static class CoreMenuItems |
|||
{ |
|||
[MenuItem("Assets/Create/Shader/Custom Render Texture", priority = CoreUtils.Priorities.assetsCreateShaderMenuPriority + 2)] |
|||
static void MenuCreateCustomRenderTextureShader() |
|||
{ |
|||
string templatePath = $"{CoreUtils.GetCorePath()}/Editor/CustomRenderTexture/CustomRenderTextureShader.template"; |
|||
ProjectWindowUtil.CreateScriptAssetFromTemplateFile(templatePath, "New Custom Render Texture.shader"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 7e2d77127041cd24faf2847015043c6f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,38 @@ |
|||
Shader "CustomRenderTexture/#NAME#" |
|||
{ |
|||
Properties |
|||
{ |
|||
_Color ("Color", Color) = (1,1,1,1) |
|||
_MainTex("InputTex", 2D) = "white" {} |
|||
} |
|||
|
|||
SubShader |
|||
{ |
|||
Blend One Zero |
|||
|
|||
Pass |
|||
{ |
|||
Name "#NAME#" |
|||
|
|||
CGPROGRAM |
|||
#include "UnityCustomRenderTexture.cginc" |
|||
#pragma vertex CustomRenderTextureVertexShader |
|||
#pragma fragment frag |
|||
#pragma target 3.0 |
|||
|
|||
float4 _Color; |
|||
sampler2D _MainTex; |
|||
|
|||
float4 frag(v2f_customrendertexture IN) : SV_Target |
|||
{ |
|||
float2 uv = IN.localTexcoord.xy; |
|||
float4 color = tex2D(_MainTex, uv) * _Color; |
|||
|
|||
// TODO: Replace this by actual code! |
|||
uint2 p = uv.xy * 256; |
|||
return countbits(~(p.x & p.y) + 1) % 2 * float4(uv, 1, 1) * color; |
|||
} |
|||
ENDCG |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 6e1b69fb677bd95439f31bff8ca1c431 |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: dca094a63ee8e4df7b043d29c2c100e4 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,272 @@ |
|||
using System; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Serialized state of a Debug Item.
|
|||
/// </summary>
|
|||
[Serializable] |
|||
public abstract class DebugState : ScriptableObject |
|||
{ |
|||
/// <summary>
|
|||
/// Path of the Debug Item.
|
|||
/// </summary>
|
|||
[SerializeField] |
|||
protected string m_QueryPath; |
|||
|
|||
// We need this to keep track of the state modified in the current frame.
|
|||
// This helps reduces the cost of re-applying states to original widgets and is also needed
|
|||
// when two states point to the same value (e.g. when using split enums like HDRP does for
|
|||
// the `fullscreenDebugMode`.
|
|||
internal static DebugState m_CurrentDirtyState; |
|||
|
|||
/// <summary>
|
|||
/// Path of the Debug Item.
|
|||
/// </summary>
|
|||
public string queryPath |
|||
{ |
|||
get { return m_QueryPath; } |
|||
internal set { m_QueryPath = value; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the value of the Debug Item.
|
|||
/// </summary>
|
|||
/// <returns>Value of the Debug Item.</returns>
|
|||
public abstract object GetValue(); |
|||
|
|||
/// <summary>
|
|||
/// Set the value of the Debug Item.
|
|||
/// </summary>
|
|||
/// <param name="value">Input value.</param>
|
|||
/// <param name="field">Debug Item field.</param>
|
|||
public abstract void SetValue(object value, DebugUI.IValueField field); |
|||
|
|||
/// <summary>
|
|||
/// OnEnable implementation.
|
|||
/// </summary>
|
|||
public virtual void OnEnable() |
|||
{ |
|||
hideFlags = HideFlags.HideAndDontSave; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Generic serialized state of a Debug Item.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of the Debug Item.</typeparam>
|
|||
[Serializable] |
|||
public class DebugState<T> : DebugState |
|||
{ |
|||
/// <summary>
|
|||
/// Value of the Debug Item.
|
|||
/// </summary>
|
|||
[SerializeField] |
|||
protected T m_Value; |
|||
|
|||
/// <summary>
|
|||
/// Value of the Debug Item
|
|||
/// </summary>
|
|||
public virtual T value |
|||
{ |
|||
get { return m_Value; } |
|||
set { m_Value = value; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the value of the Debug Item.
|
|||
/// </summary>
|
|||
/// <returns>Value of the Debug Item.</returns>
|
|||
public override object GetValue() |
|||
{ |
|||
return value; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Set the value of the Debug Item.
|
|||
/// </summary>
|
|||
/// <param name="value">Input value.</param>
|
|||
/// <param name="field">Debug Item field.</param>
|
|||
public override void SetValue(object value, DebugUI.IValueField field) |
|||
{ |
|||
this.value = (T)field.ValidateValue(value); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the hash code of the Debug Item.
|
|||
/// </summary>
|
|||
/// <returns>Hash code of the Debug Item</returns>
|
|||
public override int GetHashCode() |
|||
{ |
|||
unchecked |
|||
{ |
|||
int hash = 13; |
|||
hash = hash * 23 + m_QueryPath.GetHashCode(); |
|||
if (value != null) |
|||
hash = hash * 23 + value.GetHashCode(); |
|||
|
|||
return hash; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Attribute specifying which types should be save as this Debug State.
|
|||
/// </summary>
|
|||
public sealed class DebugStateAttribute : Attribute |
|||
{ |
|||
internal readonly Type[] types; |
|||
|
|||
/// <summary>
|
|||
/// Debug State Attribute constructor
|
|||
/// </summary>
|
|||
/// <param name="types">List of types of the Debug State.</param>
|
|||
public DebugStateAttribute(params Type[] types) |
|||
{ |
|||
this.types = types; |
|||
} |
|||
} |
|||
|
|||
// Builtins
|
|||
/// <summary>
|
|||
/// Boolean Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.BoolField), typeof(DebugUI.Foldout), typeof(DebugUI.HistoryBoolField))] |
|||
public sealed class DebugStateBool : DebugState<bool> { } |
|||
|
|||
/// <summary>
|
|||
/// Enums Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.EnumField), typeof(DebugUI.HistoryEnumField))] |
|||
public sealed class DebugStateEnum : DebugState<int> |
|||
{ |
|||
DebugUI.EnumField m_EnumField; |
|||
|
|||
/// <summary>
|
|||
/// Set the value of the Debug Item.
|
|||
/// </summary>
|
|||
/// <param name="value">Input value.</param>
|
|||
/// <param name="field">Debug Item field.</param>
|
|||
public override void SetValue(object value, DebugUI.IValueField field) |
|||
{ |
|||
m_EnumField = field as DebugUI.EnumField; |
|||
base.SetValue(value, field); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// On Enable method from <see cref="ScriptableObject"/>
|
|||
/// </summary>
|
|||
public override void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
|
|||
if (m_EnumField == null) |
|||
return; |
|||
|
|||
m_EnumField.SetValue(value); |
|||
base.SetValue(value, m_EnumField); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Integer Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.IntField))] |
|||
public sealed class DebugStateInt : DebugState<int> { } |
|||
|
|||
/// <summary>
|
|||
/// Object Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.ObjectPopupField))] |
|||
public sealed class DebugStateObject : DebugState<UnityEngine.Object> |
|||
{ |
|||
/// <summary>
|
|||
/// Returns the hash code of the Debug Item.
|
|||
/// </summary>
|
|||
/// <returns>Hash code of the Debug Item</returns>
|
|||
public override int GetHashCode() |
|||
{ |
|||
unchecked |
|||
{ |
|||
int hash = 13; |
|||
hash = hash * 23 + m_QueryPath.GetHashCode(); |
|||
|
|||
if (value != null) |
|||
{ |
|||
hash = hash * 23 + value.GetHashCode(); |
|||
} |
|||
|
|||
return hash; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Flags Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.BitField))] |
|||
public sealed class DebugStateFlags : DebugState<Enum> |
|||
{ |
|||
[SerializeField] |
|||
private SerializableEnum m_SerializableEnum; |
|||
|
|||
/// <summary>
|
|||
/// Value of the Debug Item
|
|||
/// </summary>
|
|||
public override Enum value |
|||
{ |
|||
get => m_SerializableEnum?.value ?? default; |
|||
set => m_SerializableEnum.value = value; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Set the value of the Debug Item.
|
|||
/// </summary>
|
|||
/// <param name="value">Input value.</param>
|
|||
/// <param name="field">Debug Item field.</param>
|
|||
public override void SetValue(object value, DebugUI.IValueField field) |
|||
{ |
|||
if (m_SerializableEnum == null) |
|||
m_SerializableEnum = new SerializableEnum((field as DebugUI.BitField).enumType); |
|||
base.SetValue(value, field); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Unsigned Integer Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.UIntField), typeof(DebugUI.MaskField))] |
|||
public sealed class DebugStateUInt : DebugState<uint> { } |
|||
|
|||
/// <summary>
|
|||
/// Float Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.FloatField))] |
|||
public sealed class DebugStateFloat : DebugState<float> { } |
|||
|
|||
/// <summary>
|
|||
/// Color Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.ColorField))] |
|||
public sealed class DebugStateColor : DebugState<Color> { } |
|||
|
|||
/// <summary>
|
|||
/// Vector2 Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.Vector2Field))] |
|||
public sealed class DebugStateVector2 : DebugState<Vector2> { } |
|||
|
|||
/// <summary>
|
|||
/// Vector3 Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.Vector3Field))] |
|||
public sealed class DebugStateVector3 : DebugState<Vector3> { } |
|||
|
|||
/// <summary>
|
|||
/// Vector4 Debug State.
|
|||
/// </summary>
|
|||
[Serializable, DebugState(typeof(DebugUI.Vector4Field))] |
|||
public sealed class DebugStateVector4 : DebugState<Vector4> { } |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 7270f3dffc138834da5642e5943f5072 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,926 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Builtin Drawer for Value Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Value))] |
|||
public sealed class DebugUIDrawerValue : DebugUIWidgetDrawer<DebugUI.Value> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The widget</param>
|
|||
protected override void DoGUI(Rect rect, GUIContent label, DebugUI.Value field) |
|||
{ |
|||
EditorGUI.LabelField(rect, label, EditorGUIUtility.TrTextContent(field.FormatString(field.GetValue()))); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for ValueTuple Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.ValueTuple))] |
|||
public sealed class DebugUIDrawerValueTuple : DebugUIWidgetDrawer<DebugUI.ValueTuple> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The widget</param>
|
|||
protected override void DoGUI(Rect rect, GUIContent label, DebugUI.ValueTuple field) |
|||
{ |
|||
EditorGUI.PrefixLabel(rect, label); |
|||
|
|||
// Following layout should match DebugUIDrawerFoldout to make column labels align
|
|||
Rect drawRect = GUILayoutUtility.GetLastRect(); |
|||
|
|||
int indent = EditorGUI.indentLevel; |
|||
EditorGUI.indentLevel = 0; //be at left of rects
|
|||
for (int i = 0; i < field.numElements; i++) |
|||
{ |
|||
var columnRect = drawRect; |
|||
columnRect.x += EditorGUIUtility.labelWidth + i * DebugWindow.Styles.foldoutColumnWidth; |
|||
columnRect.width = DebugWindow.Styles.foldoutColumnWidth; |
|||
var value = field.values[i].GetValue(); |
|||
|
|||
var style = EditorStyles.label; |
|||
if (Convert.ToSingle(value) == 0) |
|||
style = DebugWindow.Styles.labelWithZeroValueStyle; |
|||
|
|||
EditorGUI.LabelField(columnRect, field.values[i].FormatString(value), style); |
|||
} |
|||
EditorGUI.indentLevel = indent; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for ProgressBarValue Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.ProgressBarValue))] |
|||
public sealed class DebugUIDrawerProgressBarValue : DebugUIWidgetDrawer<DebugUI.ProgressBarValue> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The widget</param>
|
|||
protected override void DoGUI(Rect rect, GUIContent label, DebugUI.ProgressBarValue field) |
|||
{ |
|||
var progressBarRect = EditorGUI.PrefixLabel(rect, label); |
|||
float value = (float)field.GetValue(); |
|||
EditorGUI.ProgressBar(progressBarRect, value, field.FormatString(value)); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Button Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Button))] |
|||
public sealed class DebugUIDrawerButton : DebugUIWidgetDrawer<DebugUI.Button> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The widget</param>
|
|||
protected override void DoGUI(Rect rect, GUIContent label, DebugUI.Button field) |
|||
{ |
|||
rect = EditorGUI.IndentedRect(rect); |
|||
if (GUI.Button(rect, label, EditorStyles.miniButton)) |
|||
{ |
|||
if (field.action != null) |
|||
field.action(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Boolean Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.BoolField))] |
|||
public sealed class DebugUIDrawerBoolField : DebugUIFieldDrawer<bool, DebugUI.BoolField, DebugStateBool> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The value</returns>
|
|||
protected override bool DoGUI(Rect rect, GUIContent label, DebugUI.BoolField field, DebugStateBool state) |
|||
{ |
|||
return EditorGUI.Toggle(rect, label, field.GetValue()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for History Boolean Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.HistoryBoolField))] |
|||
public sealed class DebugUIDrawerHistoryBoolField : DebugUIFieldDrawer<bool, DebugUI.HistoryBoolField, DebugStateBool> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override bool DoGUI(Rect rect, GUIContent label, DebugUI.HistoryBoolField field, DebugStateBool state) |
|||
{ |
|||
var labelRect = rect; |
|||
labelRect.width = EditorGUIUtility.labelWidth; |
|||
const int oneValueWidth = 70; |
|||
var valueRects = new Rect[field.historyDepth + 1]; |
|||
for (int i = 0; i < field.historyDepth + 1; i++) |
|||
{ |
|||
valueRects[i] = rect; |
|||
valueRects[i].x += EditorGUIUtility.labelWidth + i * oneValueWidth; |
|||
valueRects[i].width = oneValueWidth; |
|||
} |
|||
EditorGUI.LabelField(labelRect, label); |
|||
int indent = EditorGUI.indentLevel; |
|||
EditorGUI.indentLevel = 0; //be at left of rects
|
|||
bool value = EditorGUI.Toggle(valueRects[0], field.GetValue()); |
|||
using (new EditorGUI.DisabledScope(true)) |
|||
{ |
|||
for (int i = 0; i < field.historyDepth; i++) |
|||
EditorGUI.Toggle(valueRects[i + 1], field.GetHistoryValue(i)); |
|||
} |
|||
EditorGUI.indentLevel = indent; |
|||
return value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Integer Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.IntField))] |
|||
public sealed class DebugUIDrawerIntField : DebugUIFieldDrawer<int, DebugUI.IntField, DebugStateInt> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override int DoGUI(Rect rect, GUIContent label, DebugUI.IntField field, DebugStateInt state) |
|||
{ |
|||
return field.min != null && field.max != null |
|||
? EditorGUI.IntSlider(rect, label, field.GetValue(), field.min(), field.max()) |
|||
: EditorGUI.IntField(rect, label, field.GetValue()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Unsigned Integer Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.UIntField))] |
|||
public sealed class DebugUIDrawerUIntField : DebugUIFieldDrawer<uint, DebugUI.UIntField, DebugStateUInt> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override uint DoGUI(Rect rect, GUIContent label, DebugUI.UIntField field, DebugStateUInt state) |
|||
{ |
|||
// No UIntField so we need to max to 0 ourselves or the value will wrap around
|
|||
int tmp = field.min != null && field.max != null |
|||
? EditorGUI.IntSlider(rect, label, Mathf.Max(0, (int)field.GetValue()), Mathf.Max(0, (int)field.min()), Mathf.Max(0, (int)field.max())) |
|||
: EditorGUI.IntField(rect, label, Mathf.Max(0, (int)field.GetValue())); |
|||
|
|||
return (uint)Mathf.Max(0, tmp); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Float Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.FloatField))] |
|||
public sealed class DebugUIDrawerFloatField : DebugUIFieldDrawer<float, DebugUI.FloatField, DebugStateFloat> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override float DoGUI(Rect rect, GUIContent label, DebugUI.FloatField field, DebugStateFloat state) |
|||
{ |
|||
return field.min != null && field.max != null |
|||
? EditorGUI.Slider(rect, label, field.GetValue(), field.min(), field.max()) |
|||
: EditorGUI.FloatField(rect, label, field.GetValue()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Enum Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.EnumField))] |
|||
public sealed class DebugUIDrawerEnumField : DebugUIFieldDrawer<int, DebugUI.EnumField, DebugStateEnum> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override int DoGUI(Rect rect, GUIContent label, DebugUI.EnumField field, DebugStateEnum state) |
|||
{ |
|||
int index = Mathf.Max(0, field.currentIndex); // Fallback just in case, we may be handling sub/sectioned enums here
|
|||
int value = field.GetValue(); |
|||
|
|||
if (field.enumNames == null || field.enumValues == null) |
|||
{ |
|||
EditorGUI.LabelField(rect, label, "Can't draw an empty enumeration."); |
|||
} |
|||
else if (field.enumNames.Length != field.enumValues.Length) |
|||
{ |
|||
EditorGUI.LabelField(rect, label, "Invalid data"); |
|||
} |
|||
else |
|||
{ |
|||
index = EditorGUI.IntPopup(rect, label, index, field.enumNames, field.indexes); |
|||
value = field.enumValues[index]; |
|||
} |
|||
|
|||
return value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Object Popup Fields Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.ObjectPopupField))] |
|||
public sealed class DebugUIDrawerObjectPopupField : DebugUIFieldDrawer<UnityEngine.Object, DebugUI.ObjectPopupField, DebugStateObject> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override UnityEngine.Object DoGUI(Rect rect, GUIContent label, DebugUI.ObjectPopupField field, DebugStateObject state) |
|||
{ |
|||
var selectedValue = field.GetValue(); |
|||
|
|||
rect = EditorGUI.PrefixLabel(rect, label); |
|||
|
|||
var elements = field.getObjects(); |
|||
if (elements?.Any() ?? false) |
|||
{ |
|||
var elementsArrayNames = elements.Select(e => e.name).ToArray(); |
|||
var elementsArrayIndices = Enumerable.Range(0, elementsArrayNames.Length).ToArray(); |
|||
var selectedIndex = selectedValue != null ? Array.IndexOf(elementsArrayNames, selectedValue.name) : 0; |
|||
var newSelectedIndex = EditorGUI.IntPopup(rect, selectedIndex, elementsArrayNames, elementsArrayIndices); |
|||
if (selectedIndex != newSelectedIndex) |
|||
selectedValue = elements.ElementAt(newSelectedIndex); |
|||
} |
|||
else |
|||
{ |
|||
EditorGUI.LabelField(rect, "Can't draw an empty enumeration."); |
|||
} |
|||
|
|||
return selectedValue; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for History Enum Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.HistoryEnumField))] |
|||
public sealed class DebugUIDrawerHistoryEnumField : DebugUIFieldDrawer<int, DebugUI.HistoryEnumField, DebugStateEnum> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override int DoGUI(Rect rect, GUIContent label, DebugUI.HistoryEnumField field, DebugStateEnum state) |
|||
{ |
|||
int index = -1; |
|||
int value = field.GetValue(); |
|||
if (field.enumNames == null || field.enumValues == null) |
|||
{ |
|||
EditorGUILayout.LabelField("Can't draw an empty enumeration."); |
|||
} |
|||
else |
|||
{ |
|||
index = field.currentIndex; |
|||
|
|||
// Fallback just in case, we may be handling sub/sectionned enums here
|
|||
if (index < 0) |
|||
index = 0; |
|||
|
|||
var labelRect = rect; |
|||
labelRect.width = EditorGUIUtility.labelWidth; |
|||
const int oneValueWidth = 70; |
|||
var valueRects = new Rect[field.historyDepth + 1]; |
|||
for (int i = 0; i < field.historyDepth + 1; i++) |
|||
{ |
|||
valueRects[i] = rect; |
|||
valueRects[i].x += EditorGUIUtility.labelWidth + i * oneValueWidth; |
|||
valueRects[i].width = oneValueWidth; |
|||
} |
|||
EditorGUI.LabelField(labelRect, label); |
|||
int indent = EditorGUI.indentLevel; |
|||
EditorGUI.indentLevel = 0; //be at left of rects
|
|||
index = EditorGUI.IntPopup(valueRects[0], index, field.enumNames, field.indexes); |
|||
value = field.enumValues[index]; |
|||
using (new EditorGUI.DisabledScope(true)) |
|||
{ |
|||
for (int i = 0; i < field.historyDepth; i++) |
|||
EditorGUI.IntPopup(valueRects[i + 1], field.GetHistoryValue(i), field.enumNames, field.indexes); |
|||
} |
|||
EditorGUI.indentLevel = indent; |
|||
|
|||
value = field.enumValues[index]; |
|||
} |
|||
|
|||
return value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Bitfield Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.BitField))] |
|||
public sealed class DebugUIDrawerBitField : DebugUIFieldDrawer<Enum, DebugUI.BitField, DebugStateFlags> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override Enum DoGUI(Rect rect, GUIContent label, DebugUI.BitField field, DebugStateFlags state) |
|||
{ |
|||
Enum value = field.GetValue(); |
|||
|
|||
// Skip first element (with value 0) because EditorGUI.MaskField adds a 'Nothing' field anyway
|
|||
var enumNames = new string[field.enumNames.Length - 1]; |
|||
for (int i = 0; i < enumNames.Length; i++) |
|||
enumNames[i] = field.enumNames[i + 1].text; |
|||
var index = EditorGUI.MaskField(rect, label, (int)Convert.ToInt32(value), enumNames); |
|||
value = Enum.Parse(value.GetType(), index.ToString()) as Enum; |
|||
|
|||
return value; |
|||
} |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Maskfield Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.MaskField))] |
|||
public sealed class DebugUIDrawerMaskField : DebugUIFieldDrawer<uint, DebugUI.MaskField, DebugStateUInt> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override uint DoGUI(Rect rect, GUIContent label, DebugUI.MaskField field, DebugStateUInt state) |
|||
{ |
|||
uint value = field.GetValue(); |
|||
|
|||
var enumNames = new string[field.enumNames.Length]; |
|||
for (int i = 0; i < enumNames.Length; i++) |
|||
enumNames[i] = field.enumNames[i].text; |
|||
var mask = EditorGUI.MaskField(rect, label, (int)value, enumNames); |
|||
|
|||
return (uint)mask; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Foldout Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Foldout))] |
|||
public sealed class DebugUIDrawerFoldout : DebugUIDrawer |
|||
{ |
|||
const int k_HeaderVerticalMargin = 2; |
|||
static void DisplayColumns(Rect drawRect, List<GUIContent> rowContents) |
|||
{ |
|||
drawRect.x += EditorGUIUtility.labelWidth; |
|||
drawRect.width = DebugWindow.Styles.foldoutColumnWidth; |
|||
|
|||
int indent = EditorGUI.indentLevel; |
|||
EditorGUI.indentLevel = 0; //be at left of rects
|
|||
for (int i = 0; i < rowContents.Count; i++) |
|||
{ |
|||
EditorGUI.LabelField(drawRect, rowContents[i], EditorStyles.miniBoldLabel); |
|||
|
|||
// Offset the rect to the next possible column
|
|||
drawRect.x += DebugWindow.Styles.foldoutColumnWidth; |
|||
} |
|||
EditorGUI.indentLevel = indent; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute processing before UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void Begin(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
var w = Cast<DebugUI.Foldout>(widget); |
|||
var s = Cast<DebugStateBool>(state); |
|||
|
|||
var title = EditorGUIUtility.TrTextContent(w.displayName, w.tooltip); |
|||
|
|||
Action<GenericMenu> fillContextMenuAction = null; |
|||
|
|||
if (w.contextMenuItems != null) |
|||
{ |
|||
fillContextMenuAction = menu => |
|||
{ |
|||
foreach (var item in w.contextMenuItems) |
|||
{ |
|||
menu.AddItem(EditorGUIUtility.TrTextContent(item.displayName), false, () => item.action.Invoke()); |
|||
} |
|||
}; |
|||
} |
|||
|
|||
bool previousValue = (bool)w.GetValue(); |
|||
bool value = CoreEditorUtils.DrawHeaderFoldout(title, previousValue, isTitleHeader: w.isHeader, customMenuContextAction: fillContextMenuAction); |
|||
if (previousValue != value) |
|||
Apply(w, s, value); |
|||
|
|||
EditorGUI.indentLevel++; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// OnGUI implementation for Foldout DebugUIDrawer.
|
|||
/// </summary>
|
|||
/// <param name="widget">DebugUI Widget.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
/// <returns>The state of the widget.</returns>
|
|||
public override bool OnGUI(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
var w = Cast<DebugUI.Foldout>(widget); |
|||
if (w.opened && w.columnLabels != null) |
|||
{ |
|||
var drawRect = PrepareControlRect(EditorGUIUtility.singleLineHeight); |
|||
drawRect.x = 0; |
|||
DisplayColumns(drawRect, w.rowContents); |
|||
} |
|||
return w.opened; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// End implementation for Foldout DebugUIDrawer.
|
|||
/// </summary>
|
|||
/// <param name="widget">DebugUI Widget.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void End(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
EditorGUI.indentLevel--; |
|||
var w = Cast<DebugUI.Foldout>(widget); |
|||
if (w.isHeader) |
|||
GUILayout.Space(k_HeaderVerticalMargin); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Color Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.ColorField))] |
|||
public sealed class DebugUIDrawerColorField : DebugUIFieldDrawer<Color, DebugUI.ColorField, DebugStateColor> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override Color DoGUI(Rect rect, GUIContent label, DebugUI.ColorField field, DebugStateColor state) |
|||
{ |
|||
return EditorGUI.ColorField(rect, label, field.GetValue(), field.showPicker, field.showAlpha, field.hdr); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Vector2 Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Vector2Field))] |
|||
public sealed class DebugUIDrawerVector2Field : DebugUIFieldDrawer<Vector2, DebugUI.Vector2Field, DebugStateVector2> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override Vector2 DoGUI(Rect rect, GUIContent label, DebugUI.Vector2Field field, DebugStateVector2 state) |
|||
{ |
|||
return EditorGUILayout.Vector2Field(label, field.GetValue()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Vector3 Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Vector3Field))] |
|||
public sealed class DebugUIDrawerVector3Field : DebugUIFieldDrawer<Vector3, DebugUI.Vector3Field, DebugStateVector3> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override Vector3 DoGUI(Rect rect, GUIContent label, DebugUI.Vector3Field field, DebugStateVector3 state) |
|||
{ |
|||
return EditorGUILayout.Vector3Field(label, field.GetValue()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Vector4 Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Vector4Field))] |
|||
public sealed class DebugUIDrawerVector4Field : DebugUIFieldDrawer<Vector4, DebugUI.Vector4Field, DebugStateVector4> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override Vector4 DoGUI(Rect rect, GUIContent label, DebugUI.Vector4Field field, DebugStateVector4 state) |
|||
{ |
|||
return EditorGUILayout.Vector4Field(label, field.GetValue()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for <see cref="DebugUI.ObjectField"/> items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.ObjectField))] |
|||
public sealed class DebugUIDrawerObjectField : DebugUIFieldDrawer<UnityEngine.Object, DebugUI.ObjectField, DebugStateObject> |
|||
{ |
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected override UnityEngine.Object DoGUI(Rect rect, GUIContent label, DebugUI.ObjectField field, DebugStateObject state) |
|||
{ |
|||
return EditorGUI.ObjectField(rect, label, field.GetValue(), field.type, true); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for <see cref="DebugUI.ObjectListField"/> Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.ObjectListField))] |
|||
public sealed class DebugUIDrawerObjectListField : DebugUIDrawer |
|||
{ |
|||
/// <summary>
|
|||
/// Implement this to execute UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
/// <returns>Returns the state of the widget.</returns>
|
|||
public override bool OnGUI(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
var w = Cast<DebugUI.ObjectListField>(widget); |
|||
var objects = w.GetValue(); |
|||
|
|||
float height = Math.Max(objects != null ? objects.Length : 0, 1) * DebugWindow.Styles.singleRowHeight; |
|||
var rect = PrepareControlRect(height); |
|||
|
|||
rect = EditorGUI.PrefixLabel(rect, EditorGUIUtility.TrTextContent(widget.displayName)); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
DoObjectList(rect, w, objects); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
Apply(w, state, objects); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
internal static void DoObjectList(Rect rect, DebugUI.ObjectListField widget, UnityEngine.Object[] objects) |
|||
{ |
|||
if (objects == null || objects.Length == 0) |
|||
{ |
|||
EditorGUI.LabelField(rect, GUIContent.none, EditorGUIUtility.TrTextContent("Empty")); |
|||
return; |
|||
} |
|||
|
|||
rect.height = EditorGUIUtility.singleLineHeight; |
|||
for (int i = 0; i < objects.Length; i++) |
|||
{ |
|||
objects[i] = EditorGUI.ObjectField(rect, GUIContent.none, objects[i], widget.type, true); |
|||
rect.y += DebugWindow.Styles.singleRowHeight; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for MessageBox Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.MessageBox))] |
|||
public sealed class DebugUIDrawerMessageBox : DebugUIDrawer |
|||
{ |
|||
/// <summary>
|
|||
/// Implement this to execute UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
/// <returns>Returns the state of the widget.</returns>
|
|||
public override bool OnGUI(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
var w = Cast<DebugUI.MessageBox>(widget); |
|||
|
|||
var type = w.style switch |
|||
{ |
|||
DebugUI.MessageBox.Style.Info => MessageType.Info, |
|||
DebugUI.MessageBox.Style.Warning => MessageType.Warning, |
|||
DebugUI.MessageBox.Style.Error => MessageType.Error, |
|||
_ => MessageType.None |
|||
}; |
|||
|
|||
EditorGUILayout.HelpBox(w.message, type); |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Container Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Container))] |
|||
public sealed class DebugUIDrawerContainer : DebugUIDrawer |
|||
{ |
|||
/// <summary>
|
|||
/// Implement this to execute processing before UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void Begin(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
var w = Cast<DebugUI.Container>(widget); |
|||
if (!w.hideDisplayName) |
|||
EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent(widget.displayName, widget.tooltip), EditorStyles.boldLabel); |
|||
|
|||
EditorGUI.indentLevel++; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute processing after UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void End(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
EditorGUI.indentLevel--; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Horizontal Box Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.HBox))] |
|||
public sealed class DebugUIDrawerHBox : DebugUIDrawer |
|||
{ |
|||
/// <summary>
|
|||
/// Implement this to execute processing before UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void Begin(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
EditorGUILayout.BeginHorizontal(); |
|||
} |
|||
/// <summary>
|
|||
/// Implement this to execute processing after UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void End(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
EditorGUILayout.EndHorizontal(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Vertical Box Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.VBox))] |
|||
public sealed class DebugUIDrawerVBox : DebugUIDrawer |
|||
{ |
|||
/// <summary>
|
|||
/// Implement this to execute processing before UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void Begin(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
EditorGUILayout.BeginVertical(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute processing after UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void End(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
EditorGUILayout.EndVertical(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Builtin Drawer for Table Debug Items.
|
|||
/// </summary>
|
|||
[DebugUIDrawer(typeof(DebugUI.Table))] |
|||
public sealed class DebugUIDrawerTable : DebugUIDrawer |
|||
{ |
|||
/// <summary>
|
|||
/// Implement this to execute UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
/// <returns>Returns the state of the widget.</returns>
|
|||
public override bool OnGUI(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
const float k_ScrollBarHeight = 15; |
|||
|
|||
var w = Cast<DebugUI.Table>(widget); |
|||
var header = w.Header; |
|||
var visible = header.state.visibleColumns; |
|||
|
|||
float contentHeight = 0.0f; |
|||
foreach (DebugUI.Table.Row row in w.children) |
|||
contentHeight += row != null ? GetRowHeight(row, visible) : EditorGUIUtility.singleLineHeight; |
|||
|
|||
// Put some space before the array
|
|||
PrepareControlRect(EditorGUIUtility.singleLineHeight * 0.5f); |
|||
|
|||
// Draw an outline around the table
|
|||
var rect = EditorGUI.IndentedRect(PrepareControlRect(header.height + contentHeight + k_ScrollBarHeight)); |
|||
rect = DrawOutline(rect); |
|||
|
|||
// Compute rects
|
|||
var headerRect = new Rect(rect.x, rect.y, rect.width, header.height); |
|||
var contentRect = new Rect(rect.x, headerRect.yMax, rect.width, rect.height - headerRect.height); |
|||
var viewRect = new Rect(contentRect.x, contentRect.y, header.state.widthOfAllVisibleColumns, contentRect.height); |
|||
var rowRect = contentRect; |
|||
viewRect.height -= k_ScrollBarHeight; |
|||
|
|||
// Show header
|
|||
header.OnGUI(headerRect, Mathf.Max(w.scroll.x, 0f)); |
|||
|
|||
// Show array content
|
|||
w.scroll = GUI.BeginScrollView(contentRect, w.scroll, viewRect); |
|||
{ |
|||
var columns = header.state.columns; |
|||
for (int r = 0; r < w.children.Count; r++) |
|||
{ |
|||
var row = Cast<DebugUI.Container>(w.children[r]); |
|||
rowRect.x = contentRect.x; |
|||
rowRect.width = columns[0].width; |
|||
rowRect.height = (row is DebugUI.Table.Row tableRow) ? GetRowHeight(tableRow, visible) : EditorGUIUtility.singleLineHeight; |
|||
|
|||
rowRect.xMin += 2; |
|||
rowRect.xMax -= 2; |
|||
EditorGUI.LabelField(rowRect, GUIContent.none, EditorGUIUtility.TrTextContent(row.displayName), DebugWindow.Styles.centeredLeft); |
|||
rowRect.xMin -= 2; |
|||
rowRect.xMax += 2; |
|||
|
|||
using (new EditorGUI.DisabledScope(w.isReadOnly)) |
|||
{ |
|||
for (int c = 1; c < visible.Length; c++) |
|||
{ |
|||
rowRect.x += rowRect.width; |
|||
rowRect.width = columns[visible[c]].width; |
|||
if (!row.isHidden) |
|||
DisplayChild(rowRect, row.children[visible[c] - 1]); |
|||
} |
|||
rowRect.y += rowRect.height; |
|||
} |
|||
} |
|||
} |
|||
GUI.EndScrollView(false); |
|||
|
|||
return false; |
|||
} |
|||
|
|||
internal float GetRowHeight(DebugUI.Table.Row row, int[] visibleColumns) |
|||
{ |
|||
float height = EditorGUIUtility.singleLineHeight; |
|||
for (int c = 1; c < visibleColumns.Length; c++) |
|||
{ |
|||
var child = row.children[visibleColumns[c] - 1] as DebugUI.ObjectListField; |
|||
if (child == null || child.GetValue() == null) |
|||
continue; |
|||
height = Mathf.Max(height, child.GetValue().Length * DebugWindow.Styles.singleRowHeight); |
|||
} |
|||
return height; |
|||
} |
|||
|
|||
internal Rect DrawOutline(Rect rect) |
|||
{ |
|||
if (Event.current.type != EventType.Repaint) |
|||
return rect; |
|||
|
|||
float size = 1.0f; |
|||
var color = EditorGUIUtility.isProSkin ? new Color(0.12f, 0.12f, 0.12f, 1.333f) : new Color(0.6f, 0.6f, 0.6f, 1.333f); |
|||
|
|||
Color orgColor = GUI.color; |
|||
GUI.color = GUI.color * color; |
|||
GUI.DrawTexture(new Rect(rect.x, rect.y, rect.width, size), EditorGUIUtility.whiteTexture); |
|||
GUI.DrawTexture(new Rect(rect.x, rect.yMax - size, rect.width, size), EditorGUIUtility.whiteTexture); |
|||
GUI.DrawTexture(new Rect(rect.x, rect.y + 1, size, rect.height - 2 * size), EditorGUIUtility.whiteTexture); |
|||
GUI.DrawTexture(new Rect(rect.xMax - size, rect.y + 1, size, rect.height - 2 * size), EditorGUIUtility.whiteTexture); |
|||
|
|||
GUI.color = orgColor; |
|||
return new Rect(rect.x + size, rect.y + size, rect.width - 2 * size, rect.height - 2 * size); |
|||
} |
|||
|
|||
internal void DisplayChild(Rect rect, DebugUI.Widget child) |
|||
{ |
|||
rect.xMin += 2; |
|||
rect.xMax -= 2; |
|||
|
|||
if (child.isHidden) |
|||
{ |
|||
EditorGUI.LabelField(rect, "-"); |
|||
} |
|||
else |
|||
{ |
|||
if (child.GetType() == typeof(DebugUI.Value)) |
|||
{ |
|||
var widget = Cast<DebugUI.Value>(child); |
|||
EditorGUI.LabelField(rect, GUIContent.none, EditorGUIUtility.TrTextContent(widget.GetValue().ToString())); |
|||
} |
|||
else if (child.GetType() == typeof(DebugUI.ColorField)) |
|||
{ |
|||
var widget = Cast<DebugUI.ColorField>(child); |
|||
EditorGUI.ColorField(rect, GUIContent.none, widget.GetValue(), false, widget.showAlpha, widget.hdr); |
|||
} |
|||
else if (child.GetType() == typeof(DebugUI.BoolField)) |
|||
{ |
|||
var widget = Cast<DebugUI.BoolField>(child); |
|||
EditorGUI.Toggle(rect, GUIContent.none, widget.GetValue()); |
|||
} |
|||
else if (child.GetType() == typeof(DebugUI.ObjectField)) |
|||
{ |
|||
var widget = Cast<DebugUI.ObjectField>(child); |
|||
EditorGUI.ObjectField(rect, GUIContent.none, widget.GetValue(), widget.type, true); |
|||
} |
|||
else if (child.GetType() == typeof(DebugUI.ObjectListField)) |
|||
{ |
|||
var widget = Cast<DebugUI.ObjectListField>(child); |
|||
DebugUIDrawerObjectListField.DoObjectList(rect, widget, widget.GetValue()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 7f9e548e5e2920b47987881c21171ef6 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,261 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using UnityEditor.Rendering.Analytics; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Attribute specifying wich type of Debug Item should this drawer be used with.
|
|||
/// </summary>
|
|||
public class DebugUIDrawerAttribute : Attribute |
|||
{ |
|||
internal readonly Type type; |
|||
|
|||
/// <summary>
|
|||
/// Constructor for DebugUIDraw Attribute
|
|||
/// </summary>
|
|||
/// <param name="type">Type of Debug Item this draw should be used with.</param>
|
|||
public DebugUIDrawerAttribute(Type type) |
|||
{ |
|||
this.type = type; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Debug Item Drawer
|
|||
/// </summary>
|
|||
public class DebugUIDrawer |
|||
{ |
|||
/// <summary>
|
|||
/// Cast into the proper type.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">Type of the drawer</typeparam>
|
|||
/// <param name="o">Object to be cast</param>
|
|||
/// <returns>Returns o cast to type T</returns>
|
|||
protected T Cast<T>(object o) |
|||
where T : class |
|||
{ |
|||
if (o == null) return null; |
|||
|
|||
if (o is T casted) |
|||
return casted; |
|||
|
|||
StringBuilder info = new StringBuilder("Cast Exception:"); |
|||
switch (o) |
|||
{ |
|||
case DebugUI.Widget value: |
|||
info.AppendLine($"Query Path : {value.queryPath}"); |
|||
break; |
|||
case DebugState state: |
|||
info.AppendLine($"Query Path : {state.queryPath}"); |
|||
break; |
|||
} |
|||
info.AppendLine($"Object to Cast Type : {o.GetType().AssemblyQualifiedName}"); |
|||
info.AppendLine($"Target Cast Type : {typeof(T).AssemblyQualifiedName}"); |
|||
|
|||
throw new InvalidCastException(info.ToString()); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute processing before UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public virtual void Begin(DebugUI.Widget widget, DebugState state) |
|||
{ } |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
/// <returns>Returns the state of the widget.</returns>
|
|||
public virtual bool OnGUI(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute processing after UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public virtual void End(DebugUI.Widget widget, DebugState state) |
|||
{ } |
|||
|
|||
/// <summary>
|
|||
/// Applies a value to the widget and the Debug State of the Debug Item.
|
|||
/// </summary>
|
|||
/// <param name="widget">Debug Item widget.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item</param>
|
|||
/// <param name="value">Input value.</param>
|
|||
protected void Apply(DebugUI.IValueField widget, DebugState state, object value) |
|||
{ |
|||
Undo.RegisterCompleteObjectUndo(state, $"Modified Value '{state.queryPath}'"); |
|||
state.SetValue(value, widget); |
|||
widget.SetValue(value); |
|||
EditorUtility.SetDirty(state); |
|||
DebugState.m_CurrentDirtyState = state; |
|||
UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Prepares the rendering Rect of the Drawer.
|
|||
/// </summary>
|
|||
/// <param name="height">Height of the rect.</param>
|
|||
/// <param name="fullWidth">Whether to reserve full width for the element.</param>
|
|||
/// <returns>Appropriate Rect for drawing.</returns>
|
|||
protected Rect PrepareControlRect(float height = -1, bool fullWidth = false) |
|||
{ |
|||
if (height < 0) |
|||
height = EditorGUIUtility.singleLineHeight; |
|||
var rect = GUILayoutUtility.GetRect(1f, 1f, height, height); |
|||
|
|||
const float paddingLeft = 4f; |
|||
rect.width -= paddingLeft; |
|||
rect.xMin += paddingLeft; |
|||
|
|||
EditorGUIUtility.labelWidth = fullWidth ? rect.width : rect.width / 2f; |
|||
|
|||
return rect; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Common class to help drawing fields
|
|||
/// </summary>
|
|||
/// <typeparam name="TValue">The internal value of the field</typeparam>
|
|||
/// <typeparam name="TField">The type of the field widget</typeparam>
|
|||
/// <typeparam name="TState">The state of the field</typeparam>
|
|||
public abstract class DebugUIFieldDrawer<TValue, TField, TState> : DebugUIDrawer |
|||
where TField : DebugUI.Field<TValue> |
|||
where TState : DebugState |
|||
{ |
|||
private TValue value { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute processing before UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void Begin(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
EditorGUI.BeginChangeCheck(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
/// <returns>Returns the state of the widget.</returns>
|
|||
public override bool OnGUI(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
value = DoGUI( |
|||
PrepareControlRect(), |
|||
EditorGUIUtility.TrTextContent(widget.displayName, widget.tooltip), |
|||
Cast<TField>(widget), |
|||
Cast<TState>(state) |
|||
); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="field">The field</param>
|
|||
/// <param name="state">The state</param>
|
|||
/// <returns>The current value from the UI</returns>
|
|||
protected abstract TValue DoGUI(Rect rect, GUIContent label, TField field, TState state); |
|||
|
|||
struct WidgetChangedAction |
|||
{ |
|||
public string query_path; |
|||
public TValue previous_value; |
|||
public TValue new_value; |
|||
} |
|||
|
|||
static List<WidgetChangedAction> s_Analytic = new List<WidgetChangedAction>(); |
|||
/// <summary>
|
|||
/// Implement this to execute processing after UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void End(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
var w = Cast<TField>(widget); |
|||
var s = Cast<TState>(state); |
|||
|
|||
s_Analytic.Clear(); |
|||
s_Analytic.Add(new() |
|||
{ |
|||
query_path = widget.queryPath, |
|||
previous_value = w.GetValue(), |
|||
new_value = value |
|||
}); |
|||
|
|||
Apply(w, s, value); |
|||
GraphicsToolUsageAnalytic.ActionPerformed<DebugWindow>("Widget Value Changed", s_Analytic.ToNestedColumn()); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Common class to help drawing widgets
|
|||
/// </summary>
|
|||
/// <typeparam name="TWidget">The widget</typeparam>
|
|||
public abstract class DebugUIWidgetDrawer<TWidget> : DebugUIDrawer |
|||
where TWidget : DebugUI.Widget |
|||
{ |
|||
/// <summary>
|
|||
/// Implement this to execute processing before UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void Begin(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
/// <returns>Returns the state of the widget.</returns>
|
|||
public override bool OnGUI(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
DoGUI( |
|||
PrepareControlRect(), |
|||
EditorGUIUtility.TrTextContent(widget.displayName, widget.tooltip), |
|||
Cast<TWidget>(widget) |
|||
); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Does the field of the given type
|
|||
/// </summary>
|
|||
/// <param name="rect">The rect to draw the field</param>
|
|||
/// <param name="label">The label for the field</param>
|
|||
/// <param name="w">The widget</param>
|
|||
protected abstract void DoGUI(Rect rect, GUIContent label, TWidget w); |
|||
|
|||
/// <summary>
|
|||
/// Implement this to execute processing after UI rendering.
|
|||
/// </summary>
|
|||
/// <param name="widget">Widget that is going to be rendered.</param>
|
|||
/// <param name="state">Debug State associated with the Debug Item.</param>
|
|||
public override void End(DebugUI.Widget widget, DebugState state) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 3581d3ff7a65eee458feb865b7f29154 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,79 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using UnityEditor; |
|||
using UnityEditor.Rendering; |
|||
using UnityEditorInternal; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Rendering.UI |
|||
{ |
|||
[CustomEditor(typeof(DebugUIHandlerCanvas))] |
|||
sealed class DebugUIHandlerCanvasEditor : Editor |
|||
{ |
|||
SerializedProperty m_PanelPrefab; |
|||
SerializedProperty m_Prefabs; |
|||
ReorderableList m_PrefabList; |
|||
|
|||
static string[] s_Types; // Assembly qualified names
|
|||
static string[] s_DisplayTypes; // Pretty names
|
|||
|
|||
static DebugUIHandlerCanvasEditor() |
|||
{ |
|||
s_Types = CoreUtils.GetAllTypesDerivedFrom<DebugUI.Widget>() |
|||
.Where(t => !t.IsAbstract) |
|||
.Select(t => t.AssemblyQualifiedName) |
|||
.ToArray(); |
|||
|
|||
s_DisplayTypes = new string[s_Types.Length]; |
|||
for (int i = 0; i < s_Types.Length; i++) |
|||
s_DisplayTypes[i] = Type.GetType(s_Types[i]).Name; |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var o = new PropertyFetcher<DebugUIHandlerCanvas>(serializedObject); |
|||
m_PanelPrefab = o.Find(x => x.panelPrefab); |
|||
m_Prefabs = o.Find(x => x.prefabs); |
|||
|
|||
m_PrefabList = new ReorderableList(serializedObject, m_Prefabs, true, true, true, true) |
|||
{ |
|||
drawHeaderCallback = rect => EditorGUI.LabelField(rect, "Widget Prefabs"), |
|||
drawElementCallback = (rect, index, isActive, isFocused) => |
|||
{ |
|||
var element = m_PrefabList.serializedProperty.GetArrayElementAtIndex(index); |
|||
rect.y += 2f; |
|||
const float kTypeWidth = 100f; |
|||
|
|||
// Type selector
|
|||
var typeProp = element.FindPropertyRelative("type"); |
|||
int typeIndex = ArrayUtility.IndexOf(s_Types, typeProp.stringValue); |
|||
typeIndex = Mathf.Max(typeIndex, 0); |
|||
typeIndex = EditorGUI.Popup(new Rect(rect.x, rect.y, kTypeWidth, EditorGUIUtility.singleLineHeight), typeIndex, s_DisplayTypes); |
|||
typeProp.stringValue = s_Types[typeIndex]; |
|||
|
|||
// Prefab
|
|||
EditorGUI.PropertyField( |
|||
new Rect(rect.x + kTypeWidth + 2f, rect.y, rect.width - kTypeWidth - 2f, EditorGUIUtility.singleLineHeight), |
|||
element.FindPropertyRelative("prefab"), GUIContent.none); |
|||
}, |
|||
onSelectCallback = list => |
|||
{ |
|||
var prefab = list.serializedProperty.GetArrayElementAtIndex(list.index).FindPropertyRelative("prefab").objectReferenceValue as GameObject; |
|||
if (prefab) |
|||
EditorGUIUtility.PingObject(prefab.gameObject); |
|||
} |
|||
}; |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
serializedObject.Update(); |
|||
|
|||
EditorGUILayout.PropertyField(m_PanelPrefab); |
|||
EditorGUILayout.Space(); |
|||
m_PrefabList.DoLayoutList(); |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: f1d41f85c15ac6048a850b51ff36c098 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,684 @@ |
|||
#if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE
|
|||
#define USE_INPUT_SYSTEM
|
|||
#endif
|
|||
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEditor.Callbacks; |
|||
using UnityEditor.Rendering.Analytics; |
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
using UnityEngine.Assertions; |
|||
using UnityEngine.Rendering; |
|||
|
|||
using PackageInfo = UnityEditor.PackageManager.PackageInfo; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
#pragma warning disable 414
|
|||
|
|||
[Serializable] |
|||
sealed class WidgetStateDictionary : SerializedDictionary<string, DebugState> { } |
|||
|
|||
sealed class DebugWindowSettings : ScriptableObject |
|||
{ |
|||
// Keep these settings in a separate scriptable object so we can handle undo/redo on them
|
|||
// without the rest of the debug window interfering
|
|||
public int currentStateHash; |
|||
|
|||
public int selectedPanel |
|||
{ |
|||
get => Mathf.Max(0, DebugManager.instance.PanelIndex(selectedPanelDisplayName)); |
|||
set |
|||
{ |
|||
var displayName = DebugManager.instance.PanelDiplayName(value); |
|||
if (!string.IsNullOrEmpty(displayName)) |
|||
selectedPanelDisplayName = displayName; |
|||
} |
|||
} |
|||
|
|||
public string selectedPanelDisplayName; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
hideFlags = HideFlags.HideAndDontSave; |
|||
} |
|||
} |
|||
|
|||
sealed class DebugWindow : EditorWindowWithHelpButton, IHasCustomMenu |
|||
{ |
|||
static Styles s_Styles; |
|||
static GUIStyle s_SplitterLeft; |
|||
|
|||
static float splitterPos = 150f; |
|||
const float minSideBarWidth = 100; |
|||
const float minContentWidth = 100; |
|||
bool dragging = false; |
|||
|
|||
[SerializeField] |
|||
WidgetStateDictionary m_WidgetStates; |
|||
|
|||
[SerializeField] |
|||
DebugWindowSettings m_Settings; |
|||
|
|||
bool m_IsDirty; |
|||
|
|||
Vector2 m_PanelScroll; |
|||
Vector2 m_ContentScroll; |
|||
|
|||
static bool s_TypeMapDirty; |
|||
static Dictionary<Type, Type> s_WidgetStateMap; // DebugUI.Widget type -> DebugState type
|
|||
static Dictionary<Type, DebugUIDrawer> s_WidgetDrawerMap; // DebugUI.Widget type -> DebugUIDrawer
|
|||
|
|||
public static bool open |
|||
{ |
|||
get => DebugManager.instance.displayEditorUI; |
|||
private set => DebugManager.instance.displayEditorUI = value; |
|||
} |
|||
|
|||
protected override void OnHelpButtonClicked() |
|||
{ |
|||
//Deduce documentation url and open it in browser
|
|||
var url = GetSpecificURL() ?? GetDefaultURL(); |
|||
Application.OpenURL(url); |
|||
} |
|||
|
|||
string GetDefaultURL() |
|||
{ |
|||
//Find package info of the current CoreRP package
|
|||
return $"https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@{DocumentationInfo.version}/manual/Rendering-Debugger.html"; |
|||
} |
|||
|
|||
string GetSpecificURL() |
|||
{ |
|||
//Find package info of the current RenderPipeline
|
|||
var currentPipeline = GraphicsSettings.currentRenderPipeline; |
|||
if (currentPipeline == null) |
|||
return null; |
|||
|
|||
if (!DocumentationUtils.TryGetPackageInfoForType(currentPipeline.GetType(), out var packageName, out var version)) |
|||
return null; |
|||
|
|||
return packageName switch |
|||
{ |
|||
"com.unity.render-pipelines.universal" => $"https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@{version}/manual/features/rendering-debugger.html", |
|||
"com.unity.render-pipelines.high-definition" => $"https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@{version}/manual/Render-Pipeline-Debug-Window.html", |
|||
_ => null |
|||
}; |
|||
} |
|||
|
|||
[DidReloadScripts] |
|||
static void OnEditorReload() |
|||
{ |
|||
s_TypeMapDirty = true; |
|||
|
|||
//find if it where open, relink static event end propagate the info
|
|||
open = (Resources.FindObjectsOfTypeAll<DebugWindow>()?.Length ?? 0) > 0; |
|||
} |
|||
|
|||
static void RebuildTypeMaps() |
|||
{ |
|||
// Map states to widget (a single state can map to several widget types if the value to
|
|||
// serialize is the same)
|
|||
var attrType = typeof(DebugStateAttribute); |
|||
var stateTypes = CoreUtils.GetAllTypesDerivedFrom<DebugState>() |
|||
.Where( |
|||
t => t.IsDefined(attrType, false) |
|||
&& !t.IsAbstract |
|||
); |
|||
|
|||
s_WidgetStateMap = new Dictionary<Type, Type>(); |
|||
|
|||
foreach (var stateType in stateTypes) |
|||
{ |
|||
var attr = (DebugStateAttribute)stateType.GetCustomAttributes(attrType, false)[0]; |
|||
|
|||
foreach (var t in attr.types) |
|||
s_WidgetStateMap.Add(t, stateType); |
|||
} |
|||
|
|||
// Drawers
|
|||
attrType = typeof(DebugUIDrawerAttribute); |
|||
var types = CoreUtils.GetAllTypesDerivedFrom<DebugUIDrawer>() |
|||
.Where( |
|||
t => t.IsDefined(attrType, false) |
|||
&& !t.IsAbstract |
|||
); |
|||
|
|||
s_WidgetDrawerMap = new Dictionary<Type, DebugUIDrawer>(); |
|||
|
|||
foreach (var t in types) |
|||
{ |
|||
var attr = (DebugUIDrawerAttribute)t.GetCustomAttributes(attrType, false)[0]; |
|||
var inst = (DebugUIDrawer)Activator.CreateInstance(t); |
|||
s_WidgetDrawerMap.Add(attr.type, inst); |
|||
} |
|||
|
|||
// Done
|
|||
s_TypeMapDirty = false; |
|||
} |
|||
|
|||
[MenuItem("Window/Analysis/Rendering Debugger", priority = 10005)] |
|||
static void Init() |
|||
{ |
|||
var window = GetWindow<DebugWindow>(); |
|||
window.titleContent = Styles.windowTitle; |
|||
} |
|||
|
|||
[MenuItem("Window/Analysis/Rendering Debugger", validate = true)] |
|||
static bool ValidateMenuItem() |
|||
{ |
|||
return RenderPipelineManager.currentPipeline != null; |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
open = true; |
|||
|
|||
DebugManager.instance.refreshEditorRequested = false; |
|||
|
|||
hideFlags = HideFlags.HideAndDontSave; |
|||
autoRepaintOnSceneChange = true; |
|||
|
|||
if (m_Settings == null) |
|||
m_Settings = CreateInstance<DebugWindowSettings>(); |
|||
|
|||
// States are ScriptableObjects (necessary for Undo/Redo) but are not saved on disk so when the editor is closed then reopened, any existing debug window will have its states set to null
|
|||
// Since we don't care about persistence in this case, we just re-init everything.
|
|||
if (m_WidgetStates == null || !AreWidgetStatesValid()) |
|||
m_WidgetStates = new WidgetStateDictionary(); |
|||
|
|||
if (s_WidgetStateMap == null || s_WidgetDrawerMap == null || s_TypeMapDirty) |
|||
RebuildTypeMaps(); |
|||
|
|||
Undo.undoRedoPerformed += OnUndoRedoPerformed; |
|||
DebugManager.instance.onSetDirty += MarkDirty; |
|||
|
|||
// First init
|
|||
UpdateWidgetStates(); |
|||
|
|||
EditorApplication.update -= Repaint; |
|||
var panels = DebugManager.instance.panels; |
|||
var selectedPanelIndex = m_Settings.selectedPanel; |
|||
if (selectedPanelIndex >= 0 |
|||
&& selectedPanelIndex < panels.Count |
|||
&& panels[selectedPanelIndex].editorForceUpdate) |
|||
EditorApplication.update += Repaint; |
|||
|
|||
GraphicsToolLifetimeAnalytic.WindowOpened<DebugWindow>(); |
|||
} |
|||
|
|||
// Note: this won't get called if the window is opened when the editor itself is closed
|
|||
void OnDestroy() |
|||
{ |
|||
open = false; |
|||
DebugManager.instance.onSetDirty -= MarkDirty; |
|||
Undo.ClearUndo(m_Settings); |
|||
|
|||
DestroyWidgetStates(); |
|||
} |
|||
|
|||
private void OnDisable() |
|||
{ |
|||
GraphicsToolLifetimeAnalytic.WindowClosed<DebugWindow>(); |
|||
} |
|||
|
|||
public void DestroyWidgetStates() |
|||
{ |
|||
if (m_WidgetStates == null) |
|||
return; |
|||
|
|||
// Clear all the states from memory
|
|||
foreach (var state in m_WidgetStates) |
|||
{ |
|||
var s = state.Value; |
|||
Undo.ClearUndo(s); // Don't leave dangling states in the global undo/redo stack
|
|||
DestroyImmediate(s); |
|||
} |
|||
|
|||
m_WidgetStates.Clear(); |
|||
} |
|||
|
|||
public void ReloadWidgetStates() |
|||
{ |
|||
if (m_WidgetStates == null) |
|||
return; |
|||
|
|||
// Clear states from memory that don't have a corresponding widget
|
|||
List<string> keysToRemove = new (); |
|||
foreach (var state in m_WidgetStates) |
|||
{ |
|||
var widget = DebugManager.instance.GetItem(state.Key); |
|||
if (widget == null) |
|||
{ |
|||
var s = state.Value; |
|||
Undo.ClearUndo(s); // Don't leave dangling states in the global undo/redo stack
|
|||
DestroyImmediate(s); |
|||
keysToRemove.Add(state.Key); |
|||
} |
|||
} |
|||
|
|||
// Cleanup null entries because they can break the dictionary serialization
|
|||
foreach (var key in keysToRemove) |
|||
{ |
|||
m_WidgetStates.Remove(key); |
|||
} |
|||
|
|||
UpdateWidgetStates(); |
|||
} |
|||
|
|||
bool AreWidgetStatesValid() |
|||
{ |
|||
foreach (var state in m_WidgetStates) |
|||
{ |
|||
if (state.Value == null) |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
void MarkDirty() |
|||
{ |
|||
m_IsDirty = true; |
|||
} |
|||
|
|||
// We use item states to keep a cached value of each serializable debug items in order to
|
|||
// handle domain reloads, play mode entering/exiting and undo/redo
|
|||
// Note: no removal of orphan states
|
|||
void UpdateWidgetStates() |
|||
{ |
|||
foreach (var panel in DebugManager.instance.panels) |
|||
UpdateWidgetStates(panel); |
|||
} |
|||
|
|||
void UpdateWidgetStates(DebugUI.IContainer container) |
|||
{ |
|||
// Skip runtime only containers, we won't draw them so no need to serialize them either
|
|||
if (container is DebugUI.Widget actualWidget && actualWidget.isInactiveInEditor) |
|||
return; |
|||
|
|||
// Recursively update widget states
|
|||
foreach (var widget in container.children) |
|||
{ |
|||
// Skip non-serializable widgets but still traverse them in case one of their
|
|||
// children needs serialization support
|
|||
if (widget is DebugUI.IValueField valueField) |
|||
{ |
|||
// Skip runtime & readonly only items
|
|||
if (widget.isInactiveInEditor) |
|||
return; |
|||
|
|||
string guid = widget.queryPath; |
|||
if (!m_WidgetStates.TryGetValue(guid, out var state) || state == null) |
|||
{ |
|||
var widgetType = widget.GetType(); |
|||
if (s_WidgetStateMap.TryGetValue(widgetType, out Type stateType)) |
|||
{ |
|||
Assert.IsNotNull(stateType); |
|||
var inst = (DebugState)CreateInstance(stateType); |
|||
inst.queryPath = guid; |
|||
inst.SetValue(valueField.GetValue(), valueField); |
|||
m_WidgetStates[guid] = inst; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Recurse if the widget is a container
|
|||
if (widget is DebugUI.IContainer containerField) |
|||
UpdateWidgetStates(containerField); |
|||
} |
|||
} |
|||
|
|||
public void ApplyStates(bool forceApplyAll = false) |
|||
{ |
|||
if (!forceApplyAll && DebugState.m_CurrentDirtyState != null) |
|||
{ |
|||
ApplyState(DebugState.m_CurrentDirtyState.queryPath, DebugState.m_CurrentDirtyState); |
|||
DebugState.m_CurrentDirtyState = null; |
|||
return; |
|||
} |
|||
|
|||
foreach (var state in m_WidgetStates) |
|||
ApplyState(state.Key, state.Value); |
|||
|
|||
DebugState.m_CurrentDirtyState = null; |
|||
} |
|||
|
|||
void ApplyState(string queryPath, DebugState state) |
|||
{ |
|||
if (!(DebugManager.instance.GetItem(queryPath) is DebugUI.IValueField widget)) |
|||
return; |
|||
|
|||
widget.SetValue(state.GetValue()); |
|||
} |
|||
|
|||
void OnUndoRedoPerformed() |
|||
{ |
|||
int stateHash = ComputeStateHash(); |
|||
|
|||
// Something has been undone / redone, re-apply states to the debug tree
|
|||
if (stateHash != m_Settings.currentStateHash) |
|||
{ |
|||
ApplyStates(true); |
|||
m_Settings.currentStateHash = stateHash; |
|||
} |
|||
|
|||
Repaint(); |
|||
} |
|||
|
|||
int ComputeStateHash() |
|||
{ |
|||
unchecked |
|||
{ |
|||
int hash = 13; |
|||
|
|||
foreach (var state in m_WidgetStates) |
|||
hash = hash * 23 + state.Value.GetHashCode(); |
|||
|
|||
return hash; |
|||
} |
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
// If the render pipeline asset has been reloaded we force-refresh widget states in case
|
|||
// some debug values need to be refresh/recreated as well (e.g. frame settings on HD)
|
|||
if (DebugManager.instance.refreshEditorRequested) |
|||
{ |
|||
ReloadWidgetStates(); |
|||
m_IsDirty = true; |
|||
DebugManager.instance.refreshEditorRequested = false; |
|||
} |
|||
|
|||
int? requestedPanelIndex = DebugManager.instance.GetRequestedEditorWindowPanelIndex(); |
|||
if (requestedPanelIndex != null) |
|||
{ |
|||
m_Settings.selectedPanel = requestedPanelIndex.Value; |
|||
} |
|||
|
|||
if (m_IsDirty) |
|||
{ |
|||
UpdateWidgetStates(); |
|||
ApplyStates(); |
|||
m_IsDirty = false; |
|||
} |
|||
} |
|||
|
|||
void OnGUI() |
|||
{ |
|||
if (s_Styles == null) |
|||
{ |
|||
s_Styles = new Styles(); |
|||
s_SplitterLeft = new GUIStyle(); |
|||
} |
|||
|
|||
var panels = DebugManager.instance.panels; |
|||
int itemCount = panels.Count(x => !x.isInactiveInEditor && x.children.Count(w => !w.isInactiveInEditor) > 0); |
|||
|
|||
if (itemCount == 0) |
|||
{ |
|||
EditorGUILayout.HelpBox("No debug item found.", MessageType.Info); |
|||
return; |
|||
} |
|||
|
|||
// Background color
|
|||
var wrect = position; |
|||
wrect.x = 0; |
|||
wrect.y = 0; |
|||
var oldColor = GUI.color; |
|||
GUI.color = s_Styles.skinBackgroundColor; |
|||
GUI.DrawTexture(wrect, EditorGUIUtility.whiteTexture); |
|||
GUI.color = oldColor; |
|||
|
|||
|
|||
GUILayout.BeginHorizontal(EditorStyles.toolbar); |
|||
GUILayout.FlexibleSpace(); |
|||
if (GUILayout.Button(Styles.resetButtonContent, EditorStyles.toolbarButton)) |
|||
{ |
|||
DebugManager.instance.Reset(); |
|||
DestroyWidgetStates(); |
|||
UpdateWidgetStates(); |
|||
InternalEditorUtility.RepaintAllViews(); |
|||
} |
|||
|
|||
GUILayout.EndHorizontal(); |
|||
|
|||
using (new EditorGUILayout.HorizontalScope()) |
|||
{ |
|||
// Side bar
|
|||
using (var scrollScope = new EditorGUILayout.ScrollViewScope(m_PanelScroll, s_Styles.sectionScrollView, GUILayout.Width(splitterPos))) |
|||
{ |
|||
if (m_Settings.selectedPanel >= panels.Count) |
|||
m_Settings.selectedPanel = 0; |
|||
|
|||
// Validate container id
|
|||
while (panels[m_Settings.selectedPanel].isInactiveInEditor || panels[m_Settings.selectedPanel].children.Count(x => !x.isInactiveInEditor) == 0) |
|||
{ |
|||
m_Settings.selectedPanel++; |
|||
|
|||
if (m_Settings.selectedPanel >= panels.Count) |
|||
m_Settings.selectedPanel = 0; |
|||
} |
|||
|
|||
// Root children are containers
|
|||
for (int i = 0; i < panels.Count; i++) |
|||
{ |
|||
var panel = panels[i]; |
|||
|
|||
if (panel.isInactiveInEditor) |
|||
continue; |
|||
|
|||
if (panel.children.Count(x => !x.isInactiveInEditor) == 0) |
|||
continue; |
|||
|
|||
var elementRect = GUILayoutUtility.GetRect(EditorGUIUtility.TrTextContent(panel.displayName), s_Styles.sectionElement, GUILayout.ExpandWidth(true)); |
|||
|
|||
if (m_Settings.selectedPanel == i && Event.current.type == EventType.Repaint) |
|||
s_Styles.selected.Draw(elementRect, false, false, false, false); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
GUI.Toggle(elementRect, m_Settings.selectedPanel == i, panel.displayName, s_Styles.sectionElement); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
Undo.RegisterCompleteObjectUndo(m_Settings, $"Debug Panel '{panel.displayName}' Selection"); |
|||
var previousPanel = m_Settings.selectedPanel >= 0 && m_Settings.selectedPanel < panels.Count |
|||
? panels[m_Settings.selectedPanel] |
|||
: null; |
|||
if (previousPanel != null && previousPanel.editorForceUpdate && !panel.editorForceUpdate) |
|||
EditorApplication.update -= Repaint; |
|||
else if ((previousPanel == null || !previousPanel.editorForceUpdate) && panel.editorForceUpdate) |
|||
EditorApplication.update += Repaint; |
|||
m_Settings.selectedPanel = i; |
|||
} |
|||
} |
|||
|
|||
m_PanelScroll = scrollScope.scrollPosition; |
|||
} |
|||
|
|||
Rect splitterRect = new Rect(splitterPos - 3, 0, 6, Screen.height); |
|||
GUI.Box(splitterRect, "", s_SplitterLeft); |
|||
|
|||
const float topMargin = 2f; |
|||
GUILayout.Space(topMargin); |
|||
|
|||
// Main section - traverse current container
|
|||
using (var changedScope = new EditorGUI.ChangeCheckScope()) |
|||
{ |
|||
using (new EditorGUILayout.VerticalScope()) |
|||
{ |
|||
const float leftMargin = 4f; |
|||
GUILayout.Space(leftMargin); |
|||
var selectedPanel = panels[m_Settings.selectedPanel]; |
|||
|
|||
using (var scrollScope = new EditorGUILayout.ScrollViewScope(m_ContentScroll)) |
|||
{ |
|||
TraverseContainerGUI(selectedPanel); |
|||
m_ContentScroll = scrollScope.scrollPosition; |
|||
} |
|||
} |
|||
|
|||
if (changedScope.changed) |
|||
{ |
|||
m_Settings.currentStateHash = ComputeStateHash(); |
|||
DebugManager.instance.ReDrawOnScreenDebug(); |
|||
} |
|||
} |
|||
|
|||
// Splitter events
|
|||
if (Event.current != null) |
|||
{ |
|||
switch (Event.current.rawType) |
|||
{ |
|||
case EventType.MouseDown: |
|||
if (splitterRect.Contains(Event.current.mousePosition)) |
|||
{ |
|||
dragging = true; |
|||
} |
|||
break; |
|||
case EventType.MouseDrag: |
|||
if (dragging) |
|||
{ |
|||
splitterPos += Event.current.delta.x; |
|||
splitterPos = Mathf.Clamp(splitterPos, minSideBarWidth, Screen.width - minContentWidth); |
|||
Repaint(); |
|||
} |
|||
break; |
|||
case EventType.MouseUp: |
|||
if (dragging) |
|||
{ |
|||
dragging = false; |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
EditorGUIUtility.AddCursorRect(splitterRect, MouseCursor.ResizeHorizontal); |
|||
} |
|||
} |
|||
|
|||
void OnWidgetGUI(DebugUI.Widget widget) |
|||
{ |
|||
if (widget.isInactiveInEditor || widget.isHidden) |
|||
return; |
|||
|
|||
// State will be null for stateless widget
|
|||
m_WidgetStates.TryGetValue(widget.queryPath, out DebugState state); |
|||
|
|||
GUILayout.Space(4); |
|||
|
|||
if (!s_WidgetDrawerMap.TryGetValue(widget.GetType(), out DebugUIDrawer drawer)) |
|||
{ |
|||
EditorGUILayout.LabelField("Drawer not found (" + widget.GetType() + ")."); |
|||
} |
|||
else |
|||
{ |
|||
drawer.Begin(widget, state); |
|||
|
|||
if (drawer.OnGUI(widget, state)) |
|||
{ |
|||
if (widget is DebugUI.IContainer container) |
|||
TraverseContainerGUI(container); |
|||
} |
|||
|
|||
drawer.End(widget, state); |
|||
} |
|||
} |
|||
|
|||
void TraverseContainerGUI(DebugUI.IContainer container) |
|||
{ |
|||
// /!\ SHAAAAAAAME ALERT /!\
|
|||
// A container can change at runtime because of the way IMGUI works and how we handle
|
|||
// onValueChanged on widget so we have to take this into account while iterating
|
|||
try |
|||
{ |
|||
foreach (var widget in container.children) |
|||
OnWidgetGUI(widget); |
|||
} |
|||
catch (InvalidOperationException) |
|||
{ |
|||
Repaint(); |
|||
} |
|||
} |
|||
|
|||
public class Styles |
|||
{ |
|||
public static float s_DefaultLabelWidth = 0.5f; |
|||
|
|||
public static GUIContent windowTitle { get; } = EditorGUIUtility.TrTextContent("Rendering Debugger"); |
|||
|
|||
public static GUIContent resetButtonContent { get; } = EditorGUIUtility.TrTextContent("Reset"); |
|||
|
|||
public static GUIStyle foldoutHeaderStyle { get; } = new GUIStyle(EditorStyles.foldoutHeader) |
|||
{ |
|||
fixedHeight = 20, |
|||
fontStyle = FontStyle.Bold, |
|||
margin = new RectOffset(0, 0, 0, 0) |
|||
}; |
|||
|
|||
public static GUIStyle labelWithZeroValueStyle { get; } = new GUIStyle(EditorStyles.label); |
|||
|
|||
public readonly GUIStyle sectionScrollView = "PreferencesSectionBox"; |
|||
public readonly GUIStyle sectionElement = new GUIStyle("PreferencesSection"); |
|||
public readonly GUIStyle selected = "OL SelectedRow"; |
|||
public readonly GUIStyle sectionHeader = new GUIStyle(EditorStyles.largeLabel); |
|||
public readonly Color skinBackgroundColor; |
|||
|
|||
public static GUIStyle centeredLeft = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleLeft }; |
|||
public static float singleRowHeight = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; |
|||
|
|||
public static int foldoutColumnWidth = 70; |
|||
|
|||
public Styles() |
|||
{ |
|||
Color textColorDarkSkin = new Color32(210, 210, 210, 255); |
|||
Color textColorLightSkin = new Color32(102, 102, 102, 255); |
|||
Color backgroundColorDarkSkin = new Color32(38, 38, 38, 128); |
|||
Color backgroundColorLightSkin = new Color32(128, 128, 128, 96); |
|||
|
|||
sectionScrollView = new GUIStyle(sectionScrollView); |
|||
sectionScrollView.overflow.bottom += 1; |
|||
|
|||
sectionElement.alignment = TextAnchor.MiddleLeft; |
|||
|
|||
sectionHeader.fontStyle = FontStyle.Bold; |
|||
sectionHeader.fontSize = 18; |
|||
sectionHeader.margin.top = 10; |
|||
sectionHeader.margin.left += 1; |
|||
sectionHeader.normal.textColor = EditorGUIUtility.isProSkin ? textColorDarkSkin : textColorLightSkin; |
|||
skinBackgroundColor = EditorGUIUtility.isProSkin ? backgroundColorDarkSkin : backgroundColorLightSkin; |
|||
|
|||
labelWithZeroValueStyle.normal.textColor = Color.gray; |
|||
} |
|||
} |
|||
|
|||
public void AddItemsToMenu(GenericMenu menu) |
|||
{ |
|||
menu.AddItem(EditorGUIUtility.TrTextContent("Expand All"), false, () => SetExpanded(true)); |
|||
menu.AddItem(EditorGUIUtility.TrTextContent("Collapse All"), false, () => SetExpanded(false)); |
|||
} |
|||
|
|||
void SetExpanded(bool value) |
|||
{ |
|||
var panels = DebugManager.instance.panels; |
|||
foreach (var p in panels) |
|||
{ |
|||
foreach (var w in p.children) |
|||
{ |
|||
if (w.GetType() == typeof(DebugUI.Foldout)) |
|||
{ |
|||
if (m_WidgetStates.TryGetValue(w.queryPath, out DebugState state)) |
|||
{ |
|||
var foldout = (DebugUI.Foldout)w; |
|||
state.SetValue(value, foldout); |
|||
foldout.SetValue(value); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
#pragma warning restore 414
|
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 41147144ff556e246b736135eb26f185 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,34 @@ |
|||
using UnityEngine.Rendering.UI; |
|||
|
|||
namespace UnityEditor.Rendering.UI |
|||
{ |
|||
[CustomEditor(typeof(UIFoldout), true)] |
|||
sealed class UIFoldoutEditor : Editor |
|||
{ |
|||
SerializedProperty m_IsOn; |
|||
SerializedProperty m_Content; |
|||
SerializedProperty m_ArrowClosed; |
|||
SerializedProperty m_ArrowOpened; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var o = new PropertyFetcher<UIFoldout>(serializedObject); |
|||
m_IsOn = o.Find("m_IsOn"); |
|||
m_Content = o.Find(x => x.content); |
|||
m_ArrowClosed = o.Find(x => x.arrowClosed); |
|||
m_ArrowOpened = o.Find(x => x.arrowOpened); |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
serializedObject.Update(); |
|||
|
|||
EditorGUILayout.PropertyField(m_IsOn); |
|||
EditorGUILayout.PropertyField(m_Content); |
|||
EditorGUILayout.PropertyField(m_ArrowClosed); |
|||
EditorGUILayout.PropertyField(m_ArrowOpened); |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: e89075dc59755d8479f34df9e20926e1 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -0,0 +1,161 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEditor.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Callback method that will be called when the Global Preferences for Additional Properties is changed
|
|||
/// </summary>
|
|||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|||
[Obsolete("This attribute is not handled anymore. Use Advanced Properties. #from(6000.0)", false)] |
|||
public sealed class SetAdditionalPropertiesVisibilityAttribute : Attribute |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// This attributes tells a <see cref="VolumeComponentEditor"/> class which type of
|
|||
/// <see cref="VolumeComponent"/> it's an editor for.
|
|||
/// When you make a custom editor for a component, you need put this attribute on the editor
|
|||
/// class.
|
|||
/// </summary>
|
|||
/// <seealso cref="VolumeComponentEditor"/>
|
|||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] |
|||
[Obsolete("VolumeComponentEditor property has been deprecated. Please use CustomEditor. #from(2022.2)")] |
|||
public sealed class VolumeComponentEditorAttribute : CustomEditor |
|||
{ |
|||
/// <summary>
|
|||
/// A type derived from <see cref="VolumeComponent"/>.
|
|||
/// </summary>
|
|||
public readonly Type componentType; |
|||
|
|||
/// <summary>
|
|||
/// Creates a new <see cref="VolumeComponentEditorAttribute"/> instance.
|
|||
/// </summary>
|
|||
/// <param name="componentType">A type derived from <see cref="VolumeComponent"/></param>
|
|||
public VolumeComponentEditorAttribute(Type componentType) |
|||
: base(componentType, true) |
|||
{ |
|||
this.componentType = componentType; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Interface that should be used with [ScriptableRenderPipelineExtension(type))] attribute to dispatch ContextualMenu calls on the different SRPs
|
|||
/// </summary>
|
|||
/// <typeparam name="T">This must be a component that require AdditionalData in your SRP</typeparam>
|
|||
[Obsolete("The menu items are handled automatically for components with the AdditionalComponentData attribute. #from(2022.2)", false)] |
|||
public interface IRemoveAdditionalDataContextualMenu<T> |
|||
where T : Component |
|||
{ |
|||
/// <summary>
|
|||
/// Remove the given component
|
|||
/// </summary>
|
|||
/// <param name="component">The component to remove</param>
|
|||
/// <param name="dependencies">Dependencies.</param>
|
|||
void RemoveComponent(T component, IEnumerable<Component> dependencies); |
|||
} |
|||
|
|||
public static partial class RenderPipelineGlobalSettingsUI |
|||
{ |
|||
/// <summary>A collection of GUIContent for use in the inspector</summary>
|
|||
[Obsolete("Use ShaderStrippingSettings instead. #from(23.2).")] |
|||
public static class Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Global label width
|
|||
/// </summary>
|
|||
public const int labelWidth = 250; |
|||
|
|||
/// <summary>
|
|||
/// Shader Stripping
|
|||
/// </summary>
|
|||
public static readonly GUIContent shaderStrippingSettingsLabel = EditorGUIUtility.TrTextContent("Shader Stripping", "Shader Stripping settings"); |
|||
|
|||
/// <summary>
|
|||
/// Shader Variant Log Level
|
|||
/// </summary>
|
|||
public static readonly GUIContent shaderVariantLogLevelLabel = EditorGUIUtility.TrTextContent("Shader Variant Log Level", "Controls the level of logging of shader variant information outputted during the build process. Information appears in the Unity Console when the build finishes."); |
|||
|
|||
/// <summary>
|
|||
/// Export Shader Variants
|
|||
/// </summary>
|
|||
public static readonly GUIContent exportShaderVariantsLabel = EditorGUIUtility.TrTextContent("Export Shader Variants", "Controls whether to output shader variant information to a file."); |
|||
|
|||
/// <summary>
|
|||
/// Stripping Of Rendering Debugger Shader Variants is enabled
|
|||
/// </summary>
|
|||
public static readonly GUIContent stripRuntimeDebugShadersLabel = EditorGUIUtility.TrTextContent("Strip Runtime Debug Shaders", "When enabled, all debug display shader variants are removed when you build for the Unity Player. This decreases build time, but disables some features of Rendering Debugger in Player builds."); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the shader stripping settinsg
|
|||
/// </summary>
|
|||
/// <param name="serialized">The serialized global settings</param>
|
|||
/// <param name="owner">The owner editor</param>
|
|||
/// <param name="additionalShaderStrippingSettings">Pass another drawer if you want to specify additional shader stripping settings</param>
|
|||
[Obsolete("Use ShaderStrippingSettings instead. #from(23.2).")] |
|||
public static void DrawShaderStrippingSettings(ISerializedRenderPipelineGlobalSettings serialized, Editor owner, CoreEditorDrawer<ISerializedRenderPipelineGlobalSettings>.IDrawer additionalShaderStrippingSettings = null) |
|||
{ |
|||
CoreEditorUtils.DrawSectionHeader(Styles.shaderStrippingSettingsLabel); |
|||
|
|||
var oldWidth = EditorGUIUtility.labelWidth; |
|||
EditorGUIUtility.labelWidth = Styles.labelWidth; |
|||
|
|||
EditorGUILayout.Space(); |
|||
using (new EditorGUI.IndentLevelScope()) |
|||
{ |
|||
EditorGUILayout.PropertyField(serialized.shaderVariantLogLevel, Styles.shaderVariantLogLevelLabel); |
|||
EditorGUILayout.PropertyField(serialized.exportShaderVariants, Styles.exportShaderVariantsLabel); |
|||
EditorGUILayout.PropertyField(serialized.stripDebugVariants, Styles.stripRuntimeDebugShadersLabel); |
|||
|
|||
additionalShaderStrippingSettings?.Draw(serialized, owner); |
|||
} |
|||
EditorGUILayout.Space(); |
|||
EditorGUIUtility.labelWidth = oldWidth; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Public interface for handling a serialized object of <see cref="UnityEngine.Rendering.RenderPipelineGlobalSettings"/>
|
|||
/// </summary>
|
|||
[Obsolete("Use ShaderStrippingSettings instead. #from(23.2).")] |
|||
public interface ISerializedRenderPipelineGlobalSettings |
|||
{ |
|||
/// <summary>
|
|||
/// The <see cref="SerializedObject"/>
|
|||
/// </summary>
|
|||
SerializedObject serializedObject { get; } |
|||
|
|||
/// <summary>
|
|||
/// The shader variant log level
|
|||
/// </summary>
|
|||
SerializedProperty shaderVariantLogLevel { get; } |
|||
|
|||
/// <summary>
|
|||
/// If the shader variants needs to be exported
|
|||
/// </summary>
|
|||
SerializedProperty exportShaderVariants { get; } |
|||
|
|||
/// <summary>
|
|||
/// If the Runtime Rendering Debugger Debug Variants should be stripped
|
|||
/// </summary>
|
|||
SerializedProperty stripDebugVariants { get => null; } |
|||
} |
|||
|
|||
public sealed partial class DefaultVolumeProfileEditor |
|||
{ |
|||
/// <summary>
|
|||
/// Constructor
|
|||
/// </summary>
|
|||
/// <param name="baseEditor">Editor that displays the content of this class</param>
|
|||
/// <param name="profile">VolumeProfile to display</param>
|
|||
[Obsolete("Use DefaultVolumeProfileEditor(VolumeProfile, SerializedObject) instead. #from(23.3)")] |
|||
public DefaultVolumeProfileEditor(Editor baseEditor, VolumeProfile profile) |
|||
{ |
|||
m_Profile = profile; |
|||
m_TargetSerializedObject = baseEditor.serializedObject; |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue