public async override Task GenerateVisual(object typeInstance, Type neosType, bool force = false) { Component targetInstance = typeInstance as Component; Category typeCategory = GetCategory(neosType); string typeSafeName = GetSafeName(neosType); if (!(force || NeedsVisual(typeSafeName, typeCategory))) { return; } Rect bounds = await BuildComponentUI(targetInstance); double aspectRatio = (bounds.height + 5.0) / bounds.width; VisualSlot.LocalPosition = new float3(0, ((((bounds.height / 2.0f) - bounds.Center.y) / 2.0f) + 5.0f) * 0.1f, 0.5f); VisualCaptureCamera.OrthographicSize.Value = (bounds.height + 5) / 20.0f; await new ToWorld(); Bitmap2D componentImage = await VisualCaptureCamera.RenderToBitmap(new int2(400, (int)(400 * aspectRatio))); foreach (string path in typeCategory.Paths) { Directory.CreateDirectory($"{WikiAssetGenerator.BasePath}\\Components\\{path}\\"); componentImage.Save($"{WikiAssetGenerator.BasePath}\\Components\\{path}\\{typeSafeName}Component.png", 100, true); } VisualSlot.DestroyChildren(); }
public async override Task GenerateVisual(object typeInstance, Type neosType, bool force = false) { LogixNode targetInstance = typeInstance as LogixNode; Category typeCategory = GetCategory(neosType); string typeSafeName = GetSafeName(neosType); if (!(force || NeedsVisual(typeSafeName, typeCategory))) { return; } await BuildLogiXUI(targetInstance); Canvas logixVisual = VisualSlot.GetComponentInChildren <Canvas>(); float aspectRatio = logixVisual.Size.Value.y / logixVisual.Size.Value.x; VisualCaptureCamera.OrthographicSize.Value = logixVisual.Size.Value.y / 20.0f; Bitmap2D logixImage = await VisualCaptureCamera.RenderToBitmap(new int2(128, (int)(128.0 * aspectRatio))); foreach (string path in typeCategory.Paths) { Directory.CreateDirectory($"{WikiAssetGenerator.BasePath}\\Logix\\{path}\\"); logixImage.Save($"{WikiAssetGenerator.BasePath}\\Logix\\{path}\\{typeSafeName}Node.png", 100, true); } }
public override async Task GenerateVisual(object typeInstance, Type neosType, bool force = false) { SyncObject targetInstance = typeInstance as SyncObject; string typeSafeName = GetSafeName(neosType); if (!(force || NeedsVisual(typeSafeName))) { return; } Rect bounds = await BuildSyncMemberUI(targetInstance); double aspectRatio = (bounds.height + 5.0) / bounds.width; VisualSlot.LocalPosition = new float3(0, ((((bounds.height / 2.0f) - bounds.Center.y) / 2.0f) + 5.0f) * 0.1f, 0.5f); VisualCaptureCamera.OrthographicSize.Value = (bounds.height + 5) / 20.0f; await new ToWorld(); Bitmap2D componentImage = await VisualCaptureCamera.RenderToBitmap(new int2(400, (int)(400 * aspectRatio))); componentImage.Save($"{WikiAssetGenerator.BasePath}\\SyncTypes\\{typeSafeName}SyncType.png", 100, true); VisualSlot.DestroyChildren(); }