-
Notifications
You must be signed in to change notification settings - Fork 858
Universal converter / upgrader framework #4103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 40 commits
a8b3c1c
0649efa
a6c66c9
fe60e22
9944ab2
6cf0c4b
f244127
4e8b454
d4b4c61
d4c1432
8c11fbe
38c9cb9
650b811
8d364aa
d8890e9
df2b186
de3165d
5f3b773
16f7d92
7986ca8
c02175e
6669e06
a5116c7
366d835
366210d
faca1ea
6437db9
b532a7e
0836acc
e2710cd
2a68e59
a46dee6
bfbb0ae
0c9fcd8
4ecc880
f88c9bf
e4230a6
43bf46a
3f7d115
689e1ee
b9198c1
a958cac
c1efeeb
ae5083c
2516c9d
a28bebe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| namespace UnityEditor.Rendering | ||
| { | ||
| /// <summary> | ||
| /// A structure holding the information for each Item that needs to be Converted. | ||
| /// Name = The Name of the asset that is being converted. | ||
| /// Info = Information that can be used to store some data. This will also be shown in the UI. | ||
| /// WarningMessage = If there are some issues with the converter that we already know about. | ||
| /// Example: If we know it is a custom shader, we can not convert it so we add the information here. | ||
| /// HelpLink = Link to the documentation of how to convert this asset. Useful if the conversion failed or if we know we can not convert this asset automatically. | ||
| /// </summary> | ||
| public struct ConverterItemDescriptor | ||
| { | ||
| /// <summary> Name of the asset being converted. This will be shown in the UI. </summary> | ||
| public string name; | ||
| /// <summary> Information that can be used to store some data. This will also be shown in the UI. </summary> | ||
| public string info; | ||
| /// <summary> If there are some issues with the converter that we already know about during init phase. This will be added as a tooltip on the warning icon. </summary> | ||
| public string warningMessage; | ||
| /// <summary> Link to the documentation of how to convert this asset. Useful if the conversion failed or if we know we can not convert this asset automatically. </summary> | ||
| public string helpLink; | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| namespace UnityEditor.Rendering | ||
| { | ||
| /// <summary> | ||
| /// A structure holding the information for each Item that needs to be Converted. | ||
| /// Descriptor = The ConverterItemDescriptor this item contain. | ||
| /// Index = The index for this item in the list of converter items. | ||
| /// </summary> | ||
| public struct ConverterItemInfo | ||
| { | ||
| /// <summary> The ConverterItemDescriptor this item contain. </summary> | ||
| public ConverterItemDescriptor descriptor { get; internal set; } | ||
martint-unity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> The index for this item in the list of converter items. </summary> | ||
| public int index { get; internal set; } | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace UnityEditor.Rendering | ||
| { | ||
| // Storing the index and message of the failed item so that we can show that in the UI. | ||
| internal struct FailedItem | ||
| { | ||
| public int index; | ||
| public string message; | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace UnityEditor.Rendering | ||
| { | ||
| /// <summary> | ||
| /// A structure needed for the initialization step of the converter. | ||
| /// Stores data to be visible in the UI. | ||
| /// </summary> | ||
| public struct InitializeConverterContext | ||
| { | ||
| /// <summary> | ||
| /// Stores the list of ConverterItemDescriptor that will be filled in during the initialization step. | ||
| /// </summary> | ||
| internal List<ConverterItemDescriptor> items; | ||
|
|
||
| /// <summary> | ||
| /// Add to the list of assets to be converted. | ||
| /// This will be used to display information to the user in the UI. | ||
| /// </summary> | ||
| /// <param name="item">The item to add to the list items to convert</param> | ||
| public void AddAssetToConvert(ConverterItemDescriptor item) | ||
| { | ||
| items.Add(item); | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| using System; | ||
|
|
||
| namespace UnityEditor.Rendering | ||
| { | ||
| // Might need to change this name before making it public | ||
| public abstract class RenderPipelineConverter | ||
| { | ||
| /// <summary> | ||
| /// Name of the converter. | ||
| /// </summary> | ||
| public abstract string name { get; } | ||
|
|
||
| /// <summary> | ||
| /// The information when hovering over the converter. | ||
| /// </summary> | ||
| public abstract string info { get; } | ||
|
|
||
| private bool m_IsEnabled = true; | ||
| /// <summary> | ||
| /// A check if the converter is enabled or not. Can be used to do a check if prerequisites are met to have it enabled or disabled. | ||
| /// </summary> | ||
| public virtual bool IsEnabled { get => m_IsEnabled; set => m_IsEnabled = value; } | ||
|
|
||
| /// <summary> | ||
| /// This method getting triggered when clicking the listview item in the UI. | ||
| /// </summary> | ||
| public virtual void OnClicked(int index) | ||
| { | ||
| } | ||
|
|
||
| // This is so that we can have different segment in our UI, example Unity converters, your custom converters etc.. | ||
| // This is not implemented yet | ||
| public virtual string category { get; } | ||
|
|
||
| // This is in which drop down item the converter belongs to. | ||
| // Not properly implemented yet | ||
| public abstract Type conversion { get; } | ||
|
|
||
| /// <summary> | ||
| /// This runs when initializing the converter. To gather data for the UI and also for the converter if needed. | ||
| /// </summary> | ||
| /// <param name="context">The context that will be used to initialize data for the converter.</param> | ||
| public abstract void OnInitialize(InitializeConverterContext context); | ||
|
|
||
| /// <summary> | ||
| /// The method that will be run when converting the assets. | ||
| /// </summary> | ||
| /// <param name="context">The context that will be used when executing converter.</param> | ||
| public abstract void OnRun(ref RunItemContext context); | ||
| //public abstract void OnRun(RunConverterContext context); | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| namespace UnityEditor.Rendering | ||
| { | ||
| /// <summary> | ||
| /// A class for different conversions. | ||
| /// </summary> | ||
| public abstract class RenderPipelineConverterContainer | ||
| { | ||
| /// <summary> | ||
| /// Name = The name of the conversion. | ||
| /// </summary> | ||
| public abstract string name { get; } | ||
|
|
||
| /// <summary> | ||
| /// Info = The information for this conversion. | ||
| /// </summary> | ||
| public abstract string info { get; } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.