|
|
|
|
|
|
camera.gameObject.AddComponent<HDAdditionalCameraData>(); |
|
|
|
} |
|
|
|
} |
|
|
|
static void CheckOutFile(bool VSCEnabled, Material mat) |
|
|
|
{ |
|
|
|
if (VSCEnabled) |
|
|
|
{ |
|
|
|
UnityEditor.VersionControl.Task task = UnityEditor.VersionControl.Provider.Checkout(mat, UnityEditor.VersionControl.CheckoutMode.Both); |
|
|
|
|
|
|
|
if (!task.success) |
|
|
|
{ |
|
|
|
Debug.Log(task.text + " " + task.resultCode); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// This script is a helper for the artists to re-synchronize all layered materials
|
|
|
|
[MenuItem("Internal/HDRenderPipeline/Synchronize all Layered materials")] |
|
|
|
|
|
|
|
|
|
|
bool VSCEnabled = (UnityEditor.VersionControl.Provider.enabled && UnityEditor.VersionControl.Provider.isActive); |
|
|
|
|
|
|
|
CheckOutFile(VSCEnabled, mat); |
|
|
|
LayeredLitGUI.SynchronizeAllLayers(mat); |
|
|
|
EditorUtility.SetDirty(mat); |
|
|
|
} |
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
var materials = Resources.FindObjectsOfTypeAll<Material>(); |
|
|
|
|
|
|
|
bool VSCEnabled = (UnityEditor.VersionControl.Provider.enabled && UnityEditor.VersionControl.Provider.isActive); |
|
|
|
|
|
|
|
for (int i = 0, length = materials.Length; i < length; i++) |
|
|
|
{ |
|
|
|
|
|
|
i / (float)(length - 1)); |
|
|
|
|
|
|
|
CheckOutFile(VSCEnabled, materials[i]); |
|
|
|
HDEditorUtils.ResetMaterialKeywords(materials[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
var matIds = AssetDatabase.FindAssets("t:Material"); |
|
|
|
|
|
|
|
bool VSCEnabled = (UnityEditor.VersionControl.Provider.enabled && UnityEditor.VersionControl.Provider.isActive); |
|
|
|
|
|
|
|
for (int i = 0, length = matIds.Length; i < length; i++) |
|
|
|
{ |
|
|
|
|
|
|
string.Format("{0} / {1} materials cleaned.", i, length), |
|
|
|
i / (float)(length - 1)); |
|
|
|
|
|
|
|
CheckOutFile(VSCEnabled, mat); |
|
|
|
HDEditorUtils.ResetMaterialKeywords(mat); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void CheckOutFile(bool VSCEnabled, Material mat) |
|
|
|
{ |
|
|
|
if (VSCEnabled) |
|
|
|
{ |
|
|
|
UnityEditor.VersionControl.Task task = UnityEditor.VersionControl.Provider.Checkout(mat, UnityEditor.VersionControl.CheckoutMode.Both); |
|
|
|
|
|
|
|
if (!task.success) |
|
|
|
{ |
|
|
|
Debug.Log(task.text + " " + task.resultCode); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|