(Editor editor, AssetItem item)
| 215 | |
| 216 | /// <inheritdoc /> |
| 217 | public ModelWindow(Editor editor, AssetItem item) |
| 218 | : base(editor, item) |
| 219 | { |
| 220 | // Try to restore SDF options from project cache (not saved in the asset) |
| 221 | if (Editor.ProjectCache.TryGetCustomData(JsonSerializer.GetStringID(Item.ID) + ".SDF", out string sdOptionsStr)) |
| 222 | _sdfOptions = JsonSerializer.Deserialize<ModelSdfOptions>(sdOptionsStr); |
| 223 | else |
| 224 | _sdfOptions = new ModelSdfOptions |
| 225 | { |
| 226 | GPU = true, |
| 227 | BackfacesThreshold = 0.6f, |
| 228 | }; |
| 229 | |
| 230 | // Toolstrip |
| 231 | _toolstrip.AddSeparator(); |
| 232 | _showCurrentLODButton = (ToolStripButton)_toolstrip.AddButton(editor.Icons.Info64, () => _preview.ShowCurrentLOD = !_preview.ShowCurrentLOD).LinkTooltip("Show LOD statistics"); |
| 233 | _toolstrip.AddButton(editor.Icons.CenterView64, () => _preview.ResetCamera()).LinkTooltip("Show whole model"); |
| 234 | _toolstrip.AddSeparator(); |
| 235 | _toolstrip.AddButton(editor.Icons.Docs64, () => Platform.OpenUrl(Utilities.Constants.DocsUrl + "manual/graphics/models/index.html")).LinkTooltip("See documentation to learn more"); |
| 236 | |
| 237 | // Model preview |
| 238 | _preview = new Preview(this) |
| 239 | { |
| 240 | ViewportCamera = new FPSCamera(), |
| 241 | ScaleToFit = false, |
| 242 | Parent = _split.Panel1 |
| 243 | }; |
| 244 | |
| 245 | // Properties tabs |
| 246 | _tabs.AddTab(new MeshesTab(this)); |
| 247 | _tabs.AddTab(new MaterialsTab(this)); |
| 248 | _tabs.AddTab(new UVsTab(this)); |
| 249 | _tabs.AddTab(new ImportTab(this)); |
| 250 | |
| 251 | // Highlight actor (used to highlight selected material slot, see UpdateEffectsOnAsset) |
| 252 | _highlightActor = new StaticModel |
| 253 | { |
| 254 | IsActive = false |
| 255 | }; |
| 256 | _preview.Task.AddCustomActor(_highlightActor); |
| 257 | } |
| 258 | |
| 259 | /// <inheritdoc /> |
| 260 | protected override void UpdateEffectsOnAsset() |
nothing calls this directly
no test coverage detected