This commit is contained in:
CortexCore
2024-04-16 04:15:06 +08:00
parent b673a9438d
commit 0362b2c606
183 changed files with 5695 additions and 1453 deletions

View File

@@ -1,10 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BITKit;
using BITKit.StateMachine;
using Newtonsoft.Json;
using PaintIn3D;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
@@ -26,14 +29,9 @@ namespace BITFactory.Cutting
public override string Name => "点切削";
public override string Description => "按住鼠标左键进行画笔切削";
[BITKit.Export("切削半径")]
[Export("切削半径")]
public float Radius = 0;
public override unsafe void* GetExport(string name)
{
return name == nameof(Radius) ? UnsafeUtility.AddressOf(ref Radius) : base.GetExport(name);
}
public override void HandlePoint(bool isPreview, float3 normal, float3 point)
{
if (!isPreview) return;
@@ -84,15 +82,6 @@ namespace BITFactory.Cutting
private float3 _normal=Vector3.up;
private readonly IntervalUpdate _interrupt = new(0.1f);
public override unsafe void* GetExport(string name)
{
return name switch
{
nameof(snapDifference)=>UnsafeUtility.AddressOf(ref snapDifference),
_ => base.GetExport(name)
};
}
public override void OnStateExit(IState old, IState newState)
{
base.OnStateExit(old, newState);
@@ -183,7 +172,21 @@ namespace BITFactory.Cutting
{
[SerializeField] private Transform transform;
public override string Name => "填充切削";
public override string Description => "仅在该程序中使用,用于预览被裁剪的区域";
public override string Description => "仅在该程序中使用,用于预览被裁剪的区域\n事实上现在用于测试运行时序列化字段";
[Export(name:"字符串列表")] private List<string> stringList = new();
[Export(name:"单浮点列表")] private List<float> floatList = new();
[Export(name:"整数列表")] private List<int> intList = new();
[Export(name:"字符串数组")] private string[] stringArray = Array.Empty<string>();
[Export(name:"单浮点数组")] private float[] floatArray = Array.Empty<float>();
[Export(name:"整数数组")] private int[] intArray = Array.Empty<int>();
[Export(name:"float3数组")] private float3 position;
public override void ReleasePoint(float3 normal, float3 point)
{
base.ReleasePoint(normal, point);
stringList.Add(JsonConvert.SerializeObject((Vector3)point));
}
[Export(name:"自动填充")]
private void AutoFill()