f38fba6506
fix: DisplayPath 所有层级加#N去重 + 移除旧格式兼容
...
- BuildNode 不再剥离父路径#N后缀
- FromModelItem 对每层祖先计算 siblingIndex 追加#N,与树加载一致
- 解决复制子树中节点别名泄露给其他子树的问题
- FromKey 移除纯 DisplayPath 旧格式兼容
2026-06-06 10:05:35 +08:00
337ccbb43b
fix: OnTreeViewSelected NRE + 日志清理
...
- _isInternalSelection 为 true 时 OnTreeViewSelected 直接 return,阻断 NW→树→NW 循环
- 调试日志降为 Debug 级别
- doc.CurrentSelection 加空检查
2026-06-02 12:58:38 +08:00
f8319438e9
fix: 无 DisplayName 的几何体节点显示为「几何对象」而非空字符
2026-06-01 10:39:57 +08:00
a5f9e4da24
feat: MaxFullDisplayDepth 改为从配置文件读取,支持实时生效
...
- SystemConfig 新增 AliasTreeConfig,含 MaxFullDisplayDepth 属性(默认 2)
- ConfigManager 添加 [alias_tree] 段的 TOML 解析和写入
- default_config.toml 添加 [alias_tree] 配置项
- AliasTreeControl 构造时读取配置 + 订阅 CategoryConfigurationChanged 实时重建
2026-06-01 10:30:21 +08:00
d670ae5c3c
perf: BuildNode 延迟 CreatePathId + DisplayPath 同名去重修复
...
- BuildNode 不再调 FromModelItem/CreatePathId,改用父节点 DisplayPath 拼接
- CreatePathId 只在保存别名时通过 EnsureFullNodeKey 触发
- LazyLoadChildren 用 nameCount 字典计算 siblingIndex,BuildNode 追加 #N 去重
- 子节点 DisplayPath 拼接时剥离父路径中的 ||前缀和#N后缀,与 FromModelItem 一致
- LazyLoadChildren 直接用 parentNode.ModelItem,不再调 FindModelItemByNodeKey
- 别名匹配去掉 fallback,精确到#N
- _dataStore.LoadAll() 提升到循环外
2026-06-01 10:21:02 +08:00
fddefde1ed
docs: 更新别名树实施方案 — 新增显示原则 + 修正标识/定位/联动描述
...
- 新增第7节「别名树显示原则」:二条件OR逻辑、深度限制、别名特殊规则、按需加载生命周期
- 第4节:标识改为 CreatePathId格式,定位改为 Models.ResolvePathId
- 第10节:JSON导出格式改为 key 字段
- 第11节:双向联动改为 ModelItem.Parent链 + ExpandAndSelect
- 清理 CleanupOnDemandNodes 逻辑文档化
2026-06-01 09:10:47 +08:00
6260c175d4
fix: 别名树 IndexPath 改用 Navisworks 官方 API CreatePathId/ResolvePathId
...
- AliasNodeIdentity.FromModelItem: 用 doc.Models.CreatePathId 替代 GetModelItemIndexPaths
- 存储格式统一为 'modelIndex:PathId'(冒号分隔,PathId 为斜杠分隔)
- FindModelItemByNodeKey: 用 Models.ResolvePathId 替代手写 LocateByIndexPath
- 删除 LocateByIndexPath、LocateByDisplayPath、LoadPathChild、EnsureChildLoaded
- 与 PathAnimationManager/BatchQueueManager 使用完全一致的 PathId 格式
2026-05-31 23:26:54 +08:00
f7544a2095
fix: 别名树深度超限节点导航 — 改用 ModelItem.Parent 链替代 IndexPath
...
- 移除 IndexPath 解析/偏移量等易错逻辑
- ExpandAndSelect 改为沿 ModelItem.Parent 链回溯,ModelItem.Equals 匹配
- 深层节点通过 BuildNode 直接创建,不依赖占位/懒加载通道
- 删除 LoadPathChild、EnsureChildLoaded 等废弃方法
- 清理约 10 行净代码
2026-05-31 22:30:54 +08:00
ea49774f39
fix: no silent catch - log all exceptions
2026-05-31 18:14:09 +08:00
6a3be184a6
fix: crash from VisualTreeHelper.GetParent during rapid clicks
...
- OnTreeViewItemLeftClick: use e.OriginalSource.DataContext directly,
not visual tree traversal (FindAncestor)
- _isProgrammaticExpand prevents Expanded event from triggering bulk
LazyLoadChildren during ExpandAndSelect
- OnNavisSelectionChanged: synchronous processing with _isInternalSelection
guard prevents feedback loop
- Try-catch wrappers on all COM API call sites (FromModelItem, BuildNode)
2026-05-31 18:12:34 +08:00
cba8e3f3b7
feat: depth-limited tree display for performance
...
- MaxFullDisplayDepth=2: only show full tree up to level 2
- Beyond max depth, nodes only expand if they have an alias
- AliasNodeViewModel.Depth tracks tree depth
- Reduces loaded nodes for large models with deep unaliased branches
2026-05-31 17:28:05 +08:00
7418fe28aa
feat: JSON import/export for aliases + crash protection
...
- Export: JavaScriptSerializer, .alias.json format matching path data pattern
- Import: merge mode (overwrites existing keys, adds new)
- Try-catch wraps on SetAlias, RefreshAliases, NW selection operations
- Prevents crashes from database inconsistency or API exceptions
2026-05-31 17:10:32 +08:00
4da6669707
refactor: lazy database creation - match path planning pattern
...
- TryConnectToDatabase: createIfMissing=false (only connect, don't create)
- New BeforeSaveAlias event + EnsureDatabaseCreated: creates DB on first save
- Matches MainPlugin.TryConnectPathDatabase pattern
2026-05-31 16:56:57 +08:00
af7099d682
fix: alias persistence - trigger DatabaseInitialize on connect
...
- TryConnectToDatabase calls DatabaseInitialize(createIfMissing:true)
- Alias saving now creates .db file if it doesn't exist
- Removed delayed retry code (no longer needed)
- Added diagnostic logging for SetDataStore/RefreshAliases
2026-05-31 16:40:54 +08:00
903ed856e3
feat: display alias with [original name] suffix, fix false alias detection
...
- Two stacked TextBlocks: alias (red, bold) + [原文] (black, bold)
- [原文] suffix only visible when HasAlias=true
- CommitEdit/toolbar: treat unchanged text as no alias (set to null)
- Fixes: nodes edited without actual changes no longer show false [原文] suffix
2026-05-31 16:29:17 +08:00
d358c31a7d
feat: inline editing with click-to-edit, TextBox overlay, Focus+SelectAll
...
- Grid overlay: TextBox covers TextBlock when editing (no more dual display)
- EditValue property: auto-initialized to DisplayName on edit start
- Click on already-selected node enters inline edit (PreviewMouseLeftButtonDown)
- Right-click auto-selects node before context menu
- TextBox IsVisibleChanged: Focus + SelectAll on Loaded priority
- XAML Visibility moved to Style setter (fix DataTrigger precedence)
- Light yellow background (#FFFFFDE6)
2026-05-31 15:52:03 +08:00
ad398652a7
feat: alias persistence via PathDatabase SQLite
...
- AliasTreePlugin 监听文档生命周期,连接 PathDatabase
- AliasDataStore 写入 PathDatabase.SQLiteConnection
- 编辑别名实时持久化,重启后自动恢复
- 修复 _isInternalSelection 阻塞 _currentSelectionItem 更新导致编辑写错节点
2026-05-31 14:59:54 +08:00
b42cf02710
fix: bidirectional sync working for deep nodes + scroll-into-view
...
- 关掉 VirtualizingPanel 虚拟化(树是懒加载,虚拟化收益小但导致 ContainerFromItem 失败)
- ExpandAndSelect 重写为 IndexPath 纯 ViewModel 导航,不依赖 TreeViewItem
- 新增 GetTreeViewItemForNode:从 TreeView 根沿 parent 链找 Tvi
- IndexPath -1 修正(COM 路径从 1 开始计数,.NET Children 从 0)
- BringIntoView 延迟到 Dispatcher.Background
- 清理无用代码(ExpandAndSelectRecursive)
2026-05-31 14:21:50 +08:00
c002feee51
fix: ExpandAndSelect uses ModelItem.Equals for precise sibling matching
...
- 新增 AliasNodeViewModel.ModelItem 属性(持有 Navisworks 原生引用)
- BuildNode 中存储 ModelItem
- ExpandAndSelect 重写为 DFS 递归,用 ModelItem.Equals 精确匹配
(同 ModelItemAnalysisHelper.ModelItemEquals 逻辑,底层原生对象比较)
- 不再依赖 IndexPath 或 _nodeMap 做选中同步
2026-05-31 13:17:52 +08:00
4feb12f6b9
refactor: AliasNodeIdentity dual-field + reuse ModelItemAnalysisHelper
...
- 新增 IndexPath(COM 树索引路径),复用 ModelItemAnalysisHelper.GetModelItemIndexPaths
- 保留 DisplayPath(父链 DisplayName 拼接)作为降级匹配
- 序列化格式:"IndexPath||DisplayPath",向后兼容纯 DisplayPath
- FindModelItemByNodeKey: IndexPath 优先定位,DisplayPath 降级
- BuildNode: 新增旧格式兼容查找
- 单元测试全面更新覆盖新/旧格式、双字段解析、前缀匹配
2026-05-31 12:52:26 +08:00
f3392ddbf6
phase 2: VM + TreeView skeleton for alias tree
...
- AliasNodeViewModel: INotifyPropertyChanged, alias/display/editing state
- AliasTreeIcons.xaml: vector icon geometry + toolbar/button styles
- AliasTreeControl.xaml: TreeView with icon toolbar, status bar, context menu
- AliasTreeControl.xaml.cs: tree building, lazy loading, bidir selection sync,
inline editing, alias highlight (via ModelHighlightHelper)
- Both projects compile successfully
2026-05-31 12:49:14 +08:00