Workbench项目中,优化了节点的复制、粘贴,加载。

This commit is contained in:
fengjiayi
2024-12-14 23:46:37 +08:00
parent c5e2abea96
commit 8d0258ebea
17 changed files with 396 additions and 298 deletions

View File

@@ -918,7 +918,7 @@ namespace Serein.NodeFlow.Env
else
{
// 加载方法节点
if (string.IsNullOrEmpty(nodeInfo.AssemblyName) && string.IsNullOrEmpty(nodeInfo.MethodName))
if (string.IsNullOrEmpty(nodeInfo.MethodName))
{
continue;
}

View File

@@ -65,7 +65,7 @@ namespace Serein.NodeFlow.Model
ArgDataSourceNodeGuid = string.Empty,
ArgDataSourceType = ConnectionArgSourceType.GetPreviousNodeData,
NodeModel = this,
Convertor = null,
//Convertor = null,
ExplicitTypeName = "Value",
Items = null,
};

View File

@@ -54,7 +54,7 @@ namespace Serein.NodeFlow.Model
ArgDataSourceNodeGuid = string.Empty,
ArgDataSourceType = ConnectionArgSourceType.GetPreviousNodeData,
NodeModel = this,
Convertor = null,
//Convertor = null,
ExplicitTypeName = "Value",
Items = null,
};

View File

@@ -215,13 +215,14 @@ public static class NodeMethodDetailsHelper
ConvertorInstance[key] = (instance, convertMethod);
}
object func(object enumValue)
{
(var obj, var methodInfo) = ConvertorInstance[key];
return methodInfo?.Invoke(obj, [enumValue]);
}
//object func(object enumValue)
//{
// (var obj, var methodInfo) = ConvertorInstance[key];
// return methodInfo?.Invoke(obj, [enumValue]);
//}
// 确保实例实现了所需接口
ParameterDetails ed = GetExplicitDataOfParameter(it, index, paremType, true, func); // 自定义的转换器 获取参数
ParameterDetails ed = GetExplicitDataOfParameter(it, index, paremType, true); // 自定义的转换器 获取参数
return ed;
}
@@ -242,8 +243,7 @@ public static class NodeMethodDetailsHelper
private static ParameterDetails GetExplicitDataOfParameter(ParameterInfo parameterInfo,
int index,
Type explicitParemType,
bool isExplicitData,
Func<object, object> func = null)
bool isExplicitData)
{
bool hasParams = parameterInfo.IsDefined(typeof(ParamArrayAttribute)); // 判断是否为可变参数
@@ -269,7 +269,7 @@ public static class NodeMethodDetailsHelper
Index = index, // 索引
ExplicitTypeName = explicitTypeName, // Select/Bool/Value
ExplicitType = explicitParemType,// 显示的入参类型
Convertor = func, // 转换器
//Convertor = func, // 转换器
DataType = dataType, // 实际的入参类型
Name = parameterInfo.Name,
DataValue = parameterInfo.HasDefaultValue ? parameterInfo?.DefaultValue?.ToString() : "", // 如果存在默认值,则使用默认值