add kcp
This commit is contained in:
26
Src/UnityPluginsSupport/MonkeyCommand/ExportPrefabPreview.cs
Normal file
26
Src/UnityPluginsSupport/MonkeyCommand/ExportPrefabPreview.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MonKey;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public partial class BITMonkeyCommands
|
||||
{
|
||||
[Command(nameof(ExportPrefabPreview), "导出已选的预制预览图", QuickName = "exp"), MenuItem("Tools/Instance Material")]
|
||||
private static void ExportPrefabPreview()
|
||||
{
|
||||
var exportPath = Path.Combine(Application.dataPath, "Temps");
|
||||
PathHelper.EnsureDirectoryCreated(exportPath);
|
||||
foreach (var image in Selection.objects.Select(AssetPreview.GetAssetPreview))
|
||||
{
|
||||
var path = Path.Combine(exportPath, GUID.Generate() + ".png");
|
||||
File.WriteAllBytes( path, image.EncodeToPNG());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df9e650e7c677814fa4ff4610be56de1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -8,10 +8,10 @@ using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class InstanceMaterial
|
||||
public partial class BITMonkeyCommands
|
||||
{
|
||||
[Command(nameof(InstanceRendererMaterial), "Instance Material From Selected GameObject", QuickName = "ins"), MenuItem("Tools/Instance Material")]
|
||||
static void InstanceRendererMaterial()
|
||||
private static void InstanceRendererMaterial()
|
||||
{
|
||||
if (Selection.activeTransform is null) return;
|
||||
if (Selection.activeTransform.TryGetComponent<Renderer>(out var renderer))
|
||||
|
Reference in New Issue
Block a user