chore(build): 更新构建脚本并优化操作历史日志
- 修改 runClient任务组和描述信息 - 添加多个 2D 模型测试任务 (test2DModelLayerPanel, testModelRenderLightingTest 等) - 替换 System.out.println 日志为 SLF4J Logger 实现 - 移除冗余的日志打印和注释代码 - 统一使用占位符方式记录日志信息 - 注册和注销操作类型时增加日志跟踪 - 完善操作监听器添加与移除的日志提示 -优化异常处理中的错误日志输出
This commit is contained in:
44
build.gradle
44
build.gradle
@@ -191,8 +191,8 @@ application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task runClient(type: JavaExec) {
|
task runClient(type: JavaExec) {
|
||||||
group = "application"
|
group = "run-toolboxProgram"
|
||||||
description = "运行 com.axis.innovators.box.Main"
|
description = "执行工具箱程序"
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
mainClass = "com.axis.innovators.box.Main"
|
mainClass = "com.axis.innovators.box.Main"
|
||||||
jvmArgs = [
|
jvmArgs = [
|
||||||
@@ -200,3 +200,43 @@ task runClient(type: JavaExec) {
|
|||||||
"-Djava.system.class.loader=com.axis.innovators.box.plugins.BoxClassLoader"
|
"-Djava.system.class.loader=com.axis.innovators.box.plugins.BoxClassLoader"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task test2DModelLayerPanel(type: JavaExec) {
|
||||||
|
group = "test-model"
|
||||||
|
description = "运行 2D Model Layer Panel 测试"
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
mainClass = "com.chuangzhou.vivid2D.test.ModelLayerPanelTest"
|
||||||
|
jvmArgs = [
|
||||||
|
"-Dfile.encoding=UTF-8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
task testModelRenderLightingTest(type: JavaExec) {
|
||||||
|
group = "test-model"
|
||||||
|
description = "运行 2D Model 高亮灯光测试"
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
mainClass = "com.chuangzhou.vivid2D.test.ModelRenderLightingTest"
|
||||||
|
jvmArgs = [
|
||||||
|
"-Dfile.encoding=UTF-8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
task testModelTest(type: JavaExec) {
|
||||||
|
group = "test-model"
|
||||||
|
description = "运行 2D Model 保存和完整性测试"
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
mainClass = "com.chuangzhou.vivid2D.test.ModelTest"
|
||||||
|
jvmArgs = [
|
||||||
|
"-Dfile.encoding=UTF-8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
task testModelTest2(type: JavaExec) {
|
||||||
|
group = "test-model"
|
||||||
|
description = "运行 2D Model 物理基准测试"
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
mainClass = "com.chuangzhou.vivid2D.test.ModelTest2"
|
||||||
|
jvmArgs = [
|
||||||
|
"-Dfile.encoding=UTF-8"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.chuangzhou.vivid2D.render.awt.util;
|
|||||||
import com.chuangzhou.vivid2D.render.model.ModelPart;
|
import com.chuangzhou.vivid2D.render.model.ModelPart;
|
||||||
import com.chuangzhou.vivid2D.render.model.util.Mesh2D;
|
import com.chuangzhou.vivid2D.render.model.util.Mesh2D;
|
||||||
import org.joml.Vector2f;
|
import org.joml.Vector2f;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@@ -15,6 +17,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||||||
*/
|
*/
|
||||||
public class OperationHistoryGlobal {
|
public class OperationHistoryGlobal {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(OperationHistoryGlobal.class);
|
||||||
|
|
||||||
// 单例实例
|
// 单例实例
|
||||||
private static final OperationHistoryGlobal INSTANCE = new OperationHistoryGlobal();
|
private static final OperationHistoryGlobal INSTANCE = new OperationHistoryGlobal();
|
||||||
|
|
||||||
@@ -58,7 +62,7 @@ public class OperationHistoryGlobal {
|
|||||||
* 初始化基础操作记录器
|
* 初始化基础操作记录器
|
||||||
*/
|
*/
|
||||||
private void initializeBasicRecorders() {
|
private void initializeBasicRecorders() {
|
||||||
System.out.println("开始初始化基础操作记录器...");
|
LOGGER.debug("开始初始化基础操作记录器...");
|
||||||
|
|
||||||
// 基础变换操作
|
// 基础变换操作
|
||||||
registerOperationRecorder("SET_POSITION", new OperationRecorder() {
|
registerOperationRecorder("SET_POSITION", new OperationRecorder() {
|
||||||
@@ -442,7 +446,7 @@ public class OperationHistoryGlobal {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
System.out.println("基础操作记录器初始化完成,共注册 " + registeredOperations.size() + " 个操作类型");
|
LOGGER.info("基础操作记录器初始化完成,共注册 {} 个操作类型", registeredOperations.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -484,12 +488,6 @@ public class OperationHistoryGlobal {
|
|||||||
|
|
||||||
// 标记已处理的操作类型
|
// 标记已处理的操作类型
|
||||||
handledOperations.add(operationType);
|
handledOperations.add(operationType);
|
||||||
|
|
||||||
// 输出调试信息
|
|
||||||
if (isDebugEnabled()) {
|
|
||||||
System.out.printf("默认监听器处理: %s - %s (参数数: %d)%n",
|
|
||||||
operationType, action, params != null ? params.length : 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRecordEvent(String operationType, Object... params) {
|
private void handleRecordEvent(String operationType, Object... params) {
|
||||||
@@ -550,7 +548,7 @@ public class OperationHistoryGlobal {
|
|||||||
handleBatchTransformRecord(params);
|
handleBatchTransformRecord(params);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println("记录操作: " + operationType);
|
LOGGER.debug("记录操作: {}", operationType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,7 +590,7 @@ public class OperationHistoryGlobal {
|
|||||||
executeBatchTransform(params);
|
executeBatchTransform(params);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println("执行操作: " + operationType);
|
LOGGER.debug("执行操作: {}", operationType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -646,8 +644,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
Object[] oldValues = (Object[]) params[1];
|
Object[] oldValues = (Object[]) params[1];
|
||||||
Object[] newValues = (Object[]) params[2];
|
Object[] newValues = (Object[]) params[2];
|
||||||
|
|
||||||
System.out.printf("记录批量变换: %s (位置、旋转、缩放、中心点)%n", part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,7 +665,7 @@ public class OperationHistoryGlobal {
|
|||||||
part.setPivot(newPivot.x, newPivot.y);
|
part.setPivot(newPivot.x, newPivot.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("重做批量变换: " + part.getName());
|
LOGGER.debug("重做批量变换: {}", part.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -691,7 +687,7 @@ public class OperationHistoryGlobal {
|
|||||||
part.setPivot(oldPivot.x, oldPivot.y);
|
part.setPivot(oldPivot.x, oldPivot.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("撤回批量变换: " + part.getName());
|
LOGGER.debug("撤回批量变换: {}", part.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,11 +701,11 @@ public class OperationHistoryGlobal {
|
|||||||
operationCounts.clear();
|
operationCounts.clear();
|
||||||
handledOperations.clear();
|
handledOperations.clear();
|
||||||
operationContext.clear();
|
operationContext.clear();
|
||||||
System.out.println("操作历史已清空");
|
LOGGER.debug("操作历史已清空");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUnknownEvent(String operationType, String action, Object... params) {
|
private void handleUnknownEvent(String operationType, String action, Object... params) {
|
||||||
System.out.println("未知操作事件: " + operationType + " - " + action);
|
LOGGER.debug("未知操作事件: {} - {}", operationType, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============ 新增的拖拽结束操作方法 ============
|
// ============ 新增的拖拽结束操作方法 ============
|
||||||
@@ -733,45 +729,19 @@ public class OperationHistoryGlobal {
|
|||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
List<ModelPart> parts = (List<ModelPart>) params[0];
|
List<ModelPart> parts = (List<ModelPart>) params[0];
|
||||||
Map<ModelPart, Vector2f> startScales = (Map<ModelPart, Vector2f>) params[1];
|
Map<ModelPart, Vector2f> startScales = (Map<ModelPart, Vector2f>) params[1];
|
||||||
|
|
||||||
System.out.printf("记录调整大小结束: %d 个部件从起始缩放调整%n", parts.size());
|
|
||||||
for (ModelPart part : parts) {
|
for (ModelPart part : parts) {
|
||||||
Vector2f startScale = startScales.get(part);
|
Vector2f startScale = startScales.get(part);
|
||||||
Vector2f currentScale = part.getScale();
|
Vector2f currentScale = part.getScale();
|
||||||
System.out.printf(" 部件 %s: (%.2f,%.2f) -> (%.2f,%.2f)%n",
|
LOGGER.debug(" 部件 %s: (%.2f,%.2f) -> (%.2f,%.2f)%n",
|
||||||
part.getName(), startScale.x, startScale.y, currentScale.x, currentScale.y);
|
part.getName(), startScale.x, startScale.y, currentScale.x, currentScale.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRotatePartEndRecord(Object... params) {
|
private void handleRotatePartEndRecord(Object... params) {
|
||||||
if (params.length >= 2) {
|
|
||||||
List<ModelPart> parts = (List<ModelPart>) params[0];
|
|
||||||
Map<ModelPart, Float> startRotations = (Map<ModelPart, Float>) params[1];
|
|
||||||
|
|
||||||
System.out.printf("记录旋转结束: %d 个部件从起始旋转角度调整%n", parts.size());
|
|
||||||
for (ModelPart part : parts) {
|
|
||||||
float startRotation = startRotations.get(part);
|
|
||||||
float currentRotation = part.getRotation();
|
|
||||||
System.out.printf(" 部件 %s: %.1f° -> %.1f°%n",
|
|
||||||
part.getName(), Math.toDegrees(startRotation), Math.toDegrees(currentRotation));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMovePivotEndRecord(Object... params) {
|
private void handleMovePivotEndRecord(Object... params) {
|
||||||
if (params.length >= 2) {
|
|
||||||
List<ModelPart> parts = (List<ModelPart>) params[0];
|
|
||||||
Map<ModelPart, Vector2f> startPivots = (Map<ModelPart, Vector2f>) params[1];
|
|
||||||
|
|
||||||
System.out.printf("记录移动中心点结束: %d 个部件从起始中心点移动%n", parts.size());
|
|
||||||
for (ModelPart part : parts) {
|
|
||||||
Vector2f startPivot = startPivots.get(part);
|
|
||||||
Vector2f currentPivot = part.getPivot();
|
|
||||||
System.out.printf(" 部件 %s: (%.1f,%.1f) -> (%.1f,%.1f)%n",
|
|
||||||
part.getName(), startPivot.x, startPivot.y, currentPivot.x, currentPivot.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeDragPartEnd(Object... params) {
|
private void executeDragPartEnd(Object... params) {
|
||||||
@@ -786,7 +756,7 @@ public class OperationHistoryGlobal {
|
|||||||
paramIndex++;
|
paramIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("重做拖拽结束操作");
|
LOGGER.debug("重做拖拽结束操作");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,7 +772,7 @@ public class OperationHistoryGlobal {
|
|||||||
paramIndex++;
|
paramIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("重做调整大小结束操作");
|
LOGGER.debug("重做调整大小结束操作");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,7 +788,7 @@ public class OperationHistoryGlobal {
|
|||||||
paramIndex++;
|
paramIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("重做旋转结束操作");
|
LOGGER.debug("重做旋转结束操作");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,7 +804,7 @@ public class OperationHistoryGlobal {
|
|||||||
paramIndex++;
|
paramIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("重做移动中心点结束操作");
|
LOGGER.debug("重做移动中心点结束操作");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -864,7 +834,7 @@ public class OperationHistoryGlobal {
|
|||||||
part.setScale(startScale.x, startScale.y);
|
part.setScale(startScale.x, startScale.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("撤回调整大小结束操作");
|
LOGGER.debug("撤回调整大小结束操作");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,7 +849,7 @@ public class OperationHistoryGlobal {
|
|||||||
part.setRotation(startRotation);
|
part.setRotation(startRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("撤回旋转结束操作");
|
LOGGER.debug("撤回旋转结束操作");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -894,7 +864,7 @@ public class OperationHistoryGlobal {
|
|||||||
part.setPivot(startPivot.x, startPivot.y);
|
part.setPivot(startPivot.x, startPivot.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("撤回移动中心点结束操作");
|
LOGGER.debug("撤回移动中心点结束操作");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -910,9 +880,6 @@ public class OperationHistoryGlobal {
|
|||||||
// 保存撤回信息
|
// 保存撤回信息
|
||||||
String key = "position_undo_" + part.getName();
|
String key = "position_undo_" + part.getName();
|
||||||
operationContext.put(key, oldPosition);
|
operationContext.put(key, oldPosition);
|
||||||
|
|
||||||
System.out.printf("记录位置变化: %s (%.1f,%.1f) -> (%.1f,%.1f)%n",
|
|
||||||
part.getName(), oldPosition.x, oldPosition.y, newPosition.x, newPosition.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,7 +888,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
Vector2f newPosition = (Vector2f) params[2];
|
Vector2f newPosition = (Vector2f) params[2];
|
||||||
part.setPosition(newPosition.x, newPosition.y);
|
part.setPosition(newPosition.x, newPosition.y);
|
||||||
System.out.println("重做位置变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -930,7 +896,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
Vector2f oldPosition = (Vector2f) params[1];
|
Vector2f oldPosition = (Vector2f) params[1];
|
||||||
part.setPosition(oldPosition.x, oldPosition.y);
|
part.setPosition(oldPosition.x, oldPosition.y);
|
||||||
System.out.println("撤回位置变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -942,9 +907,6 @@ public class OperationHistoryGlobal {
|
|||||||
|
|
||||||
String key = "rotation_undo_" + part.getName();
|
String key = "rotation_undo_" + part.getName();
|
||||||
operationContext.put(key, oldRotation);
|
operationContext.put(key, oldRotation);
|
||||||
|
|
||||||
System.out.printf("记录旋转变化: %s %.1f° -> %.1f°%n",
|
|
||||||
part.getName(), Math.toDegrees(oldRotation), Math.toDegrees(newRotation));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -953,7 +915,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
float newRotation = (Float) params[2];
|
float newRotation = (Float) params[2];
|
||||||
part.setRotation(newRotation);
|
part.setRotation(newRotation);
|
||||||
System.out.println("重做旋转变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -962,7 +923,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
float oldRotation = (Float) params[1];
|
float oldRotation = (Float) params[1];
|
||||||
part.setRotation(oldRotation);
|
part.setRotation(oldRotation);
|
||||||
System.out.println("撤回旋转变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -974,9 +934,6 @@ public class OperationHistoryGlobal {
|
|||||||
|
|
||||||
String key = "scale_undo_" + part.getName();
|
String key = "scale_undo_" + part.getName();
|
||||||
operationContext.put(key, oldScale);
|
operationContext.put(key, oldScale);
|
||||||
|
|
||||||
System.out.printf("记录缩放变化: %s (%.2f,%.2f) -> (%.2f,%.2f)%n",
|
|
||||||
part.getName(), oldScale.x, oldScale.y, newScale.x, newScale.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,7 +942,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
Vector2f newScale = (Vector2f) params[2];
|
Vector2f newScale = (Vector2f) params[2];
|
||||||
part.setScale(newScale.x, newScale.y);
|
part.setScale(newScale.x, newScale.y);
|
||||||
System.out.println("重做缩放变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -994,7 +950,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
Vector2f oldScale = (Vector2f) params[1];
|
Vector2f oldScale = (Vector2f) params[1];
|
||||||
part.setScale(oldScale.x, oldScale.y);
|
part.setScale(oldScale.x, oldScale.y);
|
||||||
System.out.println("撤回缩放变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,9 +961,6 @@ public class OperationHistoryGlobal {
|
|||||||
|
|
||||||
String key = "opacity_undo_" + part.getName();
|
String key = "opacity_undo_" + part.getName();
|
||||||
operationContext.put(key, oldOpacity);
|
operationContext.put(key, oldOpacity);
|
||||||
|
|
||||||
System.out.printf("记录不透明度变化: %s %.1f -> %.1f%n",
|
|
||||||
part.getName(), oldOpacity, newOpacity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1017,7 +969,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
float newOpacity = (Float) params[2];
|
float newOpacity = (Float) params[2];
|
||||||
part.setOpacity(newOpacity);
|
part.setOpacity(newOpacity);
|
||||||
System.out.println("重做不透明度变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +977,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
float oldOpacity = (Float) params[1];
|
float oldOpacity = (Float) params[1];
|
||||||
part.setOpacity(oldOpacity);
|
part.setOpacity(oldOpacity);
|
||||||
System.out.println("撤回不透明度变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1038,9 +988,6 @@ public class OperationHistoryGlobal {
|
|||||||
|
|
||||||
String key = "visible_undo_" + part.getName();
|
String key = "visible_undo_" + part.getName();
|
||||||
operationContext.put(key, oldVisible);
|
operationContext.put(key, oldVisible);
|
||||||
|
|
||||||
System.out.printf("记录可见性变化: %s %s -> %s%n",
|
|
||||||
part.getName(), oldVisible ? "显示" : "隐藏", newVisible ? "显示" : "隐藏");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,7 +996,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
boolean newVisible = (Boolean) params[2];
|
boolean newVisible = (Boolean) params[2];
|
||||||
part.setVisible(newVisible);
|
part.setVisible(newVisible);
|
||||||
System.out.println("重做可见性变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1058,7 +1004,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
boolean oldVisible = (Boolean) params[1];
|
boolean oldVisible = (Boolean) params[1];
|
||||||
part.setVisible(oldVisible);
|
part.setVisible(oldVisible);
|
||||||
System.out.println("撤回可见性变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1070,9 +1015,6 @@ public class OperationHistoryGlobal {
|
|||||||
|
|
||||||
String key = "pivot_undo_" + part.getName();
|
String key = "pivot_undo_" + part.getName();
|
||||||
operationContext.put(key, oldPivot);
|
operationContext.put(key, oldPivot);
|
||||||
|
|
||||||
System.out.printf("记录中心点变化: %s (%.1f,%.1f) -> (%.1f,%.1f)%n",
|
|
||||||
part.getName(), oldPivot.x, oldPivot.y, newPivot.x, newPivot.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1081,7 +1023,6 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
Vector2f newPivot = (Vector2f) params[2];
|
Vector2f newPivot = (Vector2f) params[2];
|
||||||
part.setPivot(newPivot.x, newPivot.y);
|
part.setPivot(newPivot.x, newPivot.y);
|
||||||
System.out.println("重做中心点变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1090,63 +1031,28 @@ public class OperationHistoryGlobal {
|
|||||||
ModelPart part = (ModelPart) params[0];
|
ModelPart part = (ModelPart) params[0];
|
||||||
Vector2f oldPivot = (Vector2f) params[1];
|
Vector2f oldPivot = (Vector2f) params[1];
|
||||||
part.setPivot(oldPivot.x, oldPivot.y);
|
part.setPivot(oldPivot.x, oldPivot.y);
|
||||||
System.out.println("撤回中心点变化: " + part.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleAddPartRecord(Object... params) {
|
private void handleAddPartRecord(Object... params) {
|
||||||
if (params.length >= 1 && params[0] instanceof ModelPart) {
|
|
||||||
ModelPart part = (ModelPart) params[0];
|
|
||||||
System.out.println("记录添加图层: " + part.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRemovePartRecord(Object... params) {
|
private void handleRemovePartRecord(Object... params) {
|
||||||
if (params.length >= 1 && params[0] instanceof MeshState) {
|
|
||||||
MeshState state = (MeshState) params[0];
|
|
||||||
System.out.println("记录删除图层: " + state.name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRenamePartRecord(Object... params) {
|
private void handleRenamePartRecord(Object... params) {
|
||||||
if (params.length >= 3 && params[0] instanceof ModelPart) {
|
|
||||||
ModelPart part = (ModelPart) params[0];
|
|
||||||
String oldName = (String) params[1];
|
|
||||||
String newName = (String) params[2];
|
|
||||||
System.out.printf("记录重命名: %s -> %s%n", oldName, newName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDragPartRecord(Object... params) {
|
private void handleDragPartRecord(Object... params) {
|
||||||
if (params.length >= 3 && params[0] instanceof ModelPart) {
|
|
||||||
ModelPart part = (ModelPart) params[0];
|
|
||||||
Vector2f startPos = (Vector2f) params[1];
|
|
||||||
Vector2f endPos = (Vector2f) params[2];
|
|
||||||
System.out.printf("记录拖拽: %s (%.1f,%.1f) -> (%.1f,%.1f)%n",
|
|
||||||
part.getName(), startPos.x, startPos.y, endPos.x, endPos.y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleAddMeshRecord(Object... params) {
|
private void handleAddMeshRecord(Object... params) {
|
||||||
if (params.length >= 1 && params[0] instanceof Mesh2D) {
|
|
||||||
Mesh2D mesh = (Mesh2D) params[0];
|
|
||||||
System.out.println("记录添加网格: " + mesh.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRemoveMeshRecord(Object... params) {
|
private void handleRemoveMeshRecord(Object... params) {
|
||||||
if (params.length >= 1 && params[0] instanceof MeshState) {
|
|
||||||
MeshState state = (MeshState) params[0];
|
|
||||||
System.out.println("记录删除网格: " + state.name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleBindTextureRecord(Object... params) {
|
private void handleBindTextureRecord(Object... params) {
|
||||||
System.out.println("记录绑定纹理操作");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isDebugEnabled() {
|
|
||||||
return Boolean.getBoolean("operation.history.debug");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1252,7 +1158,7 @@ public class OperationHistoryGlobal {
|
|||||||
historyManager.registerRecorder(operationType, recorder);
|
historyManager.registerRecorder(operationType, recorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("已注册操作类型: " + operationType);
|
LOGGER.debug("已注册操作类型: {}", operationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1262,9 +1168,7 @@ public class OperationHistoryGlobal {
|
|||||||
if (operationType != null) {
|
if (operationType != null) {
|
||||||
registeredOperations.remove(operationType);
|
registeredOperations.remove(operationType);
|
||||||
recorderMap.remove(operationType);
|
recorderMap.remove(operationType);
|
||||||
|
LOGGER.debug("已注销操作类型: {}", operationType);
|
||||||
// 注意:这里不从历史管理器中移除,因为历史管理器可能需要处理已有的操作记录
|
|
||||||
System.out.println("已注销操作类型: " + operationType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1273,7 +1177,7 @@ public class OperationHistoryGlobal {
|
|||||||
*/
|
*/
|
||||||
public void recordOperation(String operationType, Object... params) {
|
public void recordOperation(String operationType, Object... params) {
|
||||||
if (!isOperationRegistered(operationType)) {
|
if (!isOperationRegistered(operationType)) {
|
||||||
System.err.println("未注册的操作类型: " + operationType);
|
LOGGER.warn("未注册的操作类型: {}", operationType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,7 +1212,7 @@ public class OperationHistoryGlobal {
|
|||||||
if (success) {
|
if (success) {
|
||||||
String description = historyManager.getRedoDescription();
|
String description = historyManager.getRedoDescription();
|
||||||
notifyListeners("SYSTEM", "redo", description);
|
notifyListeners("SYSTEM", "redo", description);
|
||||||
System.out.println("重做操作: " + description);
|
LOGGER.debug("重做操作: {}", description);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -1321,7 +1225,7 @@ public class OperationHistoryGlobal {
|
|||||||
public void addOperationListener(OperationListener listener) {
|
public void addOperationListener(OperationListener listener) {
|
||||||
if (listener != null && !listeners.contains(listener)) {
|
if (listener != null && !listeners.contains(listener)) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
System.out.println("已添加操作监听器: " + listener.getClass().getSimpleName());
|
LOGGER.debug("已添加操作监听器: {}", listener.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1330,7 +1234,7 @@ public class OperationHistoryGlobal {
|
|||||||
*/
|
*/
|
||||||
public void removeOperationListener(OperationListener listener) {
|
public void removeOperationListener(OperationListener listener) {
|
||||||
if (listeners.remove(listener)) {
|
if (listeners.remove(listener)) {
|
||||||
System.out.println("已移除操作监听器: " + listener.getClass().getSimpleName());
|
LOGGER.debug("已移除操作监听器: {}", listener.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1349,7 +1253,7 @@ public class OperationHistoryGlobal {
|
|||||||
try {
|
try {
|
||||||
listener.onOperationEvent(operationType, action, params);
|
listener.onOperationEvent(operationType, action, params);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("操作监听器执行失败: " + e.getMessage());
|
LOGGER.error("操作监听器执行失败: {}", e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,11 +126,11 @@ public class ModelLayerPanelTest {
|
|||||||
@Override
|
@Override
|
||||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||||
// 先释放渲染面板相关 GL 资源与线程
|
// 先释放渲染面板相关 GL 资源与线程
|
||||||
try {
|
//try {
|
||||||
renderPanel.dispose();
|
// renderPanel.dispose();
|
||||||
} catch (Throwable t) {
|
//} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
// t.printStackTrace();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user