This commit is contained in:
CortexCore
2024-03-05 15:27:29 +08:00
parent 7766082e9d
commit 2c8dfd3c86
45 changed files with 6760 additions and 138 deletions

View File

@@ -2352,7 +2352,6 @@ MonoBehaviour:
- rid: 3736623274279305216
- rid: 3736623274279305217
- rid: 3736623274279305218
- rid: 3736623274279305219
- rid: 3736623274279305220
loadLocalPackageOnStart: 1
references:
@@ -2390,10 +2389,6 @@ MonoBehaviour:
type: {class: Reference, ns: BITKit, asm: BITKit}
data:
value: System.dll
- rid: 3736623274279305219
type: {class: Reference, ns: BITKit, asm: BITKit}
data:
value: System.Linq.dll
- rid: 3736623274279305220
type: {class: Reference, ns: BITKit, asm: BITKit}
data:
@@ -9746,6 +9741,7 @@ Transform:
m_Children:
- {fileID: 1198269870}
- {fileID: 324953849}
- {fileID: 495300441}
- {fileID: 2087774128}
- {fileID: 1237214210}
- {fileID: 1228132877}
@@ -10246,6 +10242,68 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4489127147763580709, guid: d14be1a56b99bf544873c5036097bd21, type: 3}
m_PrefabInstance: {fileID: 493196758}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &495300440
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 475671028}
m_Modifications:
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4133803532130016016, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
propertyPath: m_Name
value: UXContextMenu
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
--- !u!4 &495300441 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3097860720836592501, guid: c1713b68ecd4afe42a625ebb0d0638d6, type: 3}
m_PrefabInstance: {fileID: 495300440}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &496017006
PrefabInstance:
m_ObjectHideFlags: 0
@@ -24410,6 +24468,7 @@ GameObject:
- component: {fileID: 1237214214}
- component: {fileID: 1237214215}
- component: {fileID: 1237214216}
- component: {fileID: 1237214217}
m_Layer: 0
m_Name: CuttingPanel
m_TagString: Untagged
@@ -24603,6 +24662,20 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
document: {fileID: 1237214209}
--- !u!114 &1237214217
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1237214207}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f42749e7d8caa64c8db10aa8554e974, type: 3}
m_Name:
m_EditorClassIdentifier:
defaultTexture: {fileID: 0}
worldImage: {fileID: 1354611256}
--- !u!1 &1238623440
GameObject:
m_ObjectHideFlags: 0
@@ -26429,6 +26502,78 @@ Transform:
m_CorrespondingSourceObject: {fileID: 775197342873461764, guid: db2d086fe2ffee04dbb1f233c83f567a, type: 3}
m_PrefabInstance: {fileID: 1351894160}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1354611254
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1354611255}
- component: {fileID: 1354611257}
- component: {fileID: 1354611256}
m_Layer: 5
m_Name: RawImage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1354611255
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354611254}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.02}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1538010304}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -0}
m_SizeDelta: {x: 1, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1354611256
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354611254}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 2800000, guid: 83d6032243d653847999ca08250080a1, type: 3}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!222 &1354611257
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354611254}
m_CullTransparentMesh: 1
--- !u!1001 &1363149856
PrefabInstance:
m_ObjectHideFlags: 0
@@ -29382,6 +29527,66 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8599469349454154211, guid: 9f0beeaea1b73af4095c93b67341a366, type: 3}
m_PrefabInstance: {fileID: 1523455616}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1538010302
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1538010304}
- component: {fileID: 1538010303}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!223 &1538010303
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1538010302}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 420814444}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &1538010304
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1538010302}
m_LocalRotation: {x: 0.70710576, y: -0, z: -0, w: 0.7071079}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1354611255}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 1}
m_SizeDelta: {x: 2, y: 2}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1001 &1541124407
PrefabInstance:
m_ObjectHideFlags: 0
@@ -42525,6 +42730,7 @@ SceneRoots:
- {fileID: 123695859}
- {fileID: 1460504354}
- {fileID: 1859425352}
- {fileID: 1538010304}
- {fileID: 375808614}
- {fileID: 1548654985}
- {fileID: 2104798764}

View File

@@ -0,0 +1,78 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using AnotherFileBrowser.Windows;
using BITKit;
using BITKit.IO;
using BITKit.UX;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using Button = UnityEngine.UIElements.Button;
using Image = UnityEngine.UI.Image;
using Slider = UnityEngine.UIElements.Slider;
namespace BITFactory.Cutting.UX
{
public class UXReferenceImage : MonoBehaviour
{
[SerializeField] private Texture2D defaultTexture;
[SerializeField] private RawImage worldImage;
[UXBindPath("pick-image-button")] private Button pickImageButton;
[UXBindPath("reference-image")] private VisualElement referenceImage;
[UXBindPath("2d-opacity-slider")] private Slider opacitySlider;
[UXBindPath("3d-opacity-slider")] private Slider worldOpacitySlider;
private void Start()
{
UXUtils.Inject(this);
opacitySlider.RegisterValueChangedCallback(x => { referenceImage.SetOpacity(x.newValue); });
worldOpacitySlider.RegisterValueChangedCallback(x =>
{
worldImage.color = new Color(1, 1, 1, x.newValue);
});
referenceImage.SetOpacity(0);
worldImage.color = new Color(1, 1, 1, 0);
opacitySlider.SetValueWithoutNotify(0);
worldOpacitySlider.SetValueWithoutNotify(0);
if (defaultTexture)
{
worldImage.texture = defaultTexture;
referenceImage.style.backgroundImage = defaultTexture;
}
pickImageButton.clicked += PickImage;
}
private void PickImage()
{
new Thread(() =>
{
new FileBrowser().OpenFileBrowser(new BrowserProperties(),PickImage);
}).Start();
}
private async void PickImage(string path)
{
await UniTask.SwitchToMainThread();
if (destroyCancellationToken.IsCancellationRequested) return;
var texture = new Texture2D(2, 2);
if (texture.LoadImage(await System.IO.File.ReadAllBytesAsync(path)) is false)
{
Alert.Print("无法加载图片", "请检查选择的文件是否为图片");
return;
}
worldImage.texture = texture;
referenceImage.style.backgroundImage = texture;
}
}
}

View File

@@ -16,7 +16,8 @@
"GUID:90b448749ba9be04ebf2eb5953b53caf",
"GUID:2846c2d80db507f4485a0387d75322e4",
"GUID:f602b6f914f91d4499383d874af1decd",
"GUID:a0d51f691919122479ddf08b0a310ccc"
"GUID:a0d51f691919122479ddf08b0a310ccc",
"GUID:a11ff146d38b27a44af87b4b4d9c4ecb"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -3,9 +3,18 @@
<ui:Template name="Template_MaterialBoard" src="project://database/Assets/Artists/UX/Template_MaterialBoard.uxml?fileID=9197481963319205126&amp;guid=9aa61a4d8ecb80547b4e57b7e4d01500&amp;type=3#Template_MaterialBoard" />
<Style src="project://database/Assets/BITKit/Unity/UX/Common/Common.uss?fileID=7433441132597879392&amp;guid=a3a69d3518fd02b489e721f3c5b0b539&amp;type=3#Common" />
<Style src="project://database/Assets/Artists/UX/CuttingPanel.uss?fileID=7433441132597879392&amp;guid=114425baa6f9b77488ae3597936f2944&amp;type=3#CuttingPanel" />
<ui:VisualElement picking-mode="Ignore" class="root">
<ui:VisualElement name="reference-image" picking-mode="Ignore" class="flex-center" style="width: 256px; height: 256px; background-image: url(&quot;project://database/Assets/BITKit/Unity/Art/Icons/Icon_Settings.png?fileID=2800000&amp;guid=83d6032243d653847999ca08250080a1&amp;type=3#Icon_Settings&quot;);" />
</ui:VisualElement>
<ui:VisualElement name="bg" picking-mode="Ignore" class="photo-mode" style="flex-grow: 1;">
<ui:VisualElement picking-mode="Ignore" style="background-image: url(&apos;project://database/Assets/BITKit/Unity/Art/Backgrounds/BG_Gradient_Half.png?fileID=2800000&amp;guid=901684d8a74b397439bb9c11b92d0cc7&amp;type=3#BG_Gradient_Half&apos;); -unity-background-image-tint-color: rgb(0, 0, 0); position: absolute; left: 0; top: 0; bottom: 0; right: 82%;" />
<ui:VisualElement picking-mode="Ignore" style="background-image: url(&apos;project://database/Assets/BITKit/Unity/Art/Backgrounds/BG_Gradient_Half.png?fileID=2800000&amp;guid=901684d8a74b397439bb9c11b92d0cc7&amp;type=3#BG_Gradient_Half&apos;); -unity-background-image-tint-color: rgb(0, 0, 0); position: absolute; left: 82%; top: 0; bottom: 0; right: 0; rotate: 180deg;" />
<ui:VisualElement picking-mode="Ignore" style="background-image: url(&quot;project://database/Assets/BITKit/Unity/Art/Backgrounds/BG_Gradient_Half.png?fileID=2800000&amp;guid=901684d8a74b397439bb9c11b92d0cc7&amp;type=3#BG_Gradient_Half&quot;); -unity-background-image-tint-color: rgb(0, 0, 0); position: absolute; left: 0; top: 0; bottom: 0; right: 82%;" />
<ui:VisualElement picking-mode="Ignore" style="background-image: url(&quot;project://database/Assets/BITKit/Unity/Art/Backgrounds/BG_Gradient_Half.png?fileID=2800000&amp;guid=901684d8a74b397439bb9c11b92d0cc7&amp;type=3#BG_Gradient_Half&quot;); -unity-background-image-tint-color: rgb(0, 0, 0); position: absolute; left: 82%; top: 0; bottom: 0; right: 0; rotate: 180deg;" />
</ui:VisualElement>
<ui:VisualElement name="LB" picking-mode="Ignore" class="root" style="top: 0; left: 64px; bottom: 64px; align-items: flex-start; justify-content: flex-end;">
<ui:VisualElement picking-mode="Ignore" style="flex-direction: row; border-bottom-width: 1px; border-left-color: rgba(255, 255, 255, 0.5); border-right-color: rgba(255, 255, 255, 0.5); border-top-color: rgba(255, 255, 255, 0.5); border-bottom-color: rgba(255, 255, 255, 0.5);">
<ui:Label tabindex="-1" text="[按住 鼠标中键]&#10;[鼠标左键]&#10;[Shift+WASD]" parse-escape-sequences="true" display-tooltip-when-elided="true" picking-mode="Ignore" />
<ui:Label tabindex="-1" text="旋转视角&#10;使用笔刷操作&#10;移动视角" parse-escape-sequences="true" display-tooltip-when-elided="true" picking-mode="Ignore" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement picking-mode="Ignore" name="L" class="root theme-dark photo-mode">
<ui:VisualElement picking-mode="Ignore" style="margin-top: auto; margin-right: auto; margin-bottom: auto; margin-left: 64px; min-width: 64px; flex-direction: row; align-items: center;">
@@ -66,6 +75,15 @@
</ui:VisualElement>
<ui:VisualElement picking-mode="Ignore" name="R" class="root theme-dark photo-mode">
<ui:VisualElement picking-mode="Ignore" style="margin-top: auto; margin-right: 64px; margin-bottom: auto; margin-left: auto; flex-direction: row; align-items: stretch; width: auto; height: 512px; min-width: 256px;">
<ui:VisualElement>
<ui:Label tabindex="-1" text="辅助功能" parse-escape-sequences="true" display-tooltip-when-elided="true" class="tl" />
<ui:Label tabindex="-1" text="参考图形" parse-escape-sequences="true" display-tooltip-when-elided="true" class="tm" />
<ui:Button text="选择图像" parse-escape-sequences="true" display-tooltip-when-elided="true" name="pick-image-button" tooltip="复制到剪贴板" />
<ui:Label tabindex="-1" text="屏幕空间不透明度" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Slider high-value="1" name="2d-opacity-slider" style="width: 128px;" />
<ui:Label tabindex="-1" text="3D空间不透明度" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Slider high-value="1" name="3d-opacity-slider" style="width: 128px;" />
</ui:VisualElement>
<ui:VisualElement picking-mode="Ignore">
<ui:Label tabindex="-1" text="用户指令" parse-escape-sequences="true" display-tooltip-when-elided="true" class="tl" />
<ui:Button text="导出切割数据" parse-escape-sequences="true" display-tooltip-when-elided="true" name="export-button" tooltip="复制到剪贴板" />
@@ -116,7 +134,7 @@
<ui:VisualElement picking-mode="Ignore">
<ui:VisualElement picking-mode="Ignore" style="flex-direction: row;">
<ui:VisualElement name="VisualElement" style="width: 48px; height: 48px; background-color: rgba(32, 32, 32, 0);">
<ui:VisualElement name="VisualElement" class="root" style="background-image: url(&apos;project://database/Assets/BITKit/Unity/Art/Icons/EditorIcons/processed/d_Prefab%20Icon.png?fileID=2800000&amp;guid=4bf02adfc0d27c542bc29a373f850f5f&amp;type=3#d_Prefab Icon&apos;); margin-top: 8px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px;" />
<ui:VisualElement name="VisualElement" class="root" style="background-image: url(&quot;project://database/Assets/BITKit/Unity/Art/Icons/EditorIcons/processed/d_Prefab%20Icon.png?fileID=2800000&amp;guid=4bf02adfc0d27c542bc29a373f850f5f&amp;type=3#d_Prefab Icon&quot;); margin-top: 8px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px;" />
</ui:VisualElement>
<ui:Label tabindex="-1" text="更换切削板" parse-escape-sequences="true" display-tooltip-when-elided="true" class="tl" />
</ui:VisualElement>