/// <summary> /// Initializes a new instance of the <see cref="EditorNavigationViewModel"/> class. /// </summary> /// <param name="editor"></param> /// <param name="serviceProvider">The service provider for this view model.</param> /// <param name="controller">The controller object for the related editor game.</param> public EditorNavigationViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller, [NotNull] EntityHierarchyEditorViewModel editor) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.editor = editor; this.controller = controller; ToggleAllGroupsCommand = new AnonymousCommand <bool>(ServiceProvider, value => Visuals.ForEach(x => x.IsVisible = value)); gameSettingsAsset = editor.Session.AllAssets.FirstOrDefault(x => x.AssetType == typeof(GameSettingsAsset)); if (gameSettingsAsset != null) { gameSettingsAsset.PropertyGraph.ItemChanged += GameSettingsPropertyGraphOnItemChanged; gameSettingsAsset.PropertyGraph.Changed += GameSettingsPropertyGraphOnChanged; UpdateNavigationMeshLayers(); } editor.Dispatcher.InvokeTask(async() => { await controller.GameContentLoaded; service = controller.GetService <EditorGameNavigationMeshService>(); UpdateNavigationMeshLayers(); }); }
public EntityTransformationViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller) : base(serviceProvider) { this.controller = controller; TranslationSnap = new SnapInfoViewModel(ServiceProvider, controller, Transformation.Translation); RotationSnap = new SnapInfoViewModel(ServiceProvider, controller, Transformation.Rotation); ScaleSnap = new SnapInfoViewModel(ServiceProvider, controller, Transformation.Scale); }
public NavigationMeshManager([NotNull] IEditorGameController controller) { referencerId = new AbsoluteId(AssetId.Empty, Guid.NewGuid()); loader = controller.Loader; var root = controller.GameSideNodeContainer.GetOrCreateNode(this); meshesNode = root[nameof(Meshes)].Target; meshesNode.ItemChanged += (sender, args) => { Changed?.Invoke(this, args); }; }
public EditorRenderingViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; }
public EditorGameAssetHighlighterService(IEditorGameController controller, [NotNull] IAssetDependencyManager dependencyManager) { this.controller = controller; foreach (var assetHighlighterType in StrideDefaultAssetsPlugin.AssetHighlighterTypesDictionary) { var instance = (AssetHighlighter)Activator.CreateInstance(assetHighlighterType.Value, dependencyManager); assetHighlighters.Add(assetHighlighterType.Key, instance); } }
/// <summary> /// Initializes a new instance of the <see cref="EditorGridViewModel"/> class. /// </summary> /// <param name="serviceProvider">The service provider for this view model.</param> /// <param name="controller">The controller object for the related editor game.</param> public EditorGridViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; ToggleCommand = new AnonymousCommand(ServiceProvider, () => IsVisible = !IsVisible); }
/// <summary> /// Initializes a new instance of the <see cref="SnapInfoViewModel"/> class. /// </summary> /// <param name="serviceProvider">The service provider for this view model.</param> /// <param name="controller">The controller of the editor game that can give access to a <see cref="IEditorGameTransformViewModelService"/>.</param> /// <param name="transformation">The transformation related to this view model.</param> public SnapInfoViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller, Transformation transformation) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; this.transformation = transformation; }
public EditorCameraViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; ResetCameraCommand = new AnonymousCommand(ServiceProvider, () => Service.ResetCamera()); ResetCameraOrientationCommand = new AnonymousCommand <CameraOrientation>(ServiceProvider, value => Service.ResetCameraOrientation(value)); }
public GizmoViewModel([NotNull] IViewModelServiceProvider serviceProvider, Type componentType, [NotNull] IEditorGameController controller) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; ComponentType = componentType; isActive = true; }
/// <inheritdoc/> public override void Highlight(IEditorGameController controller, EditorServiceGame game, AssetItem assetItem, float duration) { var dependencies = DependencyManager.ComputeDependencies(assetItem.Id, AssetDependencySearchOptions.In, ContentLinkType.Reference); if (dependencies == null) { return; } foreach (var dependency in dependencies.LinksIn.Where(x => x.Item.Asset is MaterialAsset)) { var referencer = assetItem.Package.Session.FindAsset(dependency.Item.Id); if (referencer == null) { continue; } var material = controller.Loader.GetRuntimeObject <Material>(referencer); if (material != null) { lock (highlightedMaterials) { highlightedMaterials[material] = DirectReferenceColor; } var currentMaterial = material; controller.InvokeTask(() => HighlightMaterial(game, currentMaterial, duration)); } var subDependencies = DependencyManager.ComputeDependencies(referencer.Id, AssetDependencySearchOptions.In | AssetDependencySearchOptions.Recursive, ContentLinkType.Reference); if (subDependencies == null) { continue; } foreach (var subDependency in subDependencies.LinksIn.Where(x => x.Item.Asset is MaterialAsset)) { referencer = assetItem.Package.Session.FindAsset(subDependency.Item.Id); if (referencer == null) { continue; } material = controller.Loader.GetRuntimeObject <Material>(referencer); if (material != null) { lock (highlightedMaterials) { highlightedMaterials[material] = IndirectReferenceColor; } var currentMaterial = material; controller.InvokeTask(() => HighlightMaterial(game, currentMaterial, duration)); } } } }
public EditorNavigationGroupViewModel(NavigationMeshGroup group, bool initialVisiblity, int index, [NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; this.group = group; this.index = index; isVisible = initialVisiblity; color = new ColorHSV(((float)index * 80.0f + 90.0f) % 360.0f, 0.95f, 0.75f, 1.0f).ToColor(); }
public EntityGizmosViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.controller = controller; activeGizmos.AddRange(typeof(EntityComponent).GetInheritedTypes().Where(x => StrideDefaultAssetsPlugin.GizmoTypeDictionary.ContainsKey(x)).OrderBy(DisplayAttribute.GetDisplayName).Select(x => new GizmoViewModel(ServiceProvider, x, controller))); FallbackGizmo = new GizmoViewModel(ServiceProvider, typeof(TransformComponent), controller); ToggleAllGizmosCommand = new AnonymousCommand <bool>(ServiceProvider, value => ActiveGizmos.ForEach(x => x.IsActive = value)); }
public EditorGameEntityTransformService([NotNull] EntityHierarchyEditorViewModel editor, [NotNull] IEditorGameController controller) { if (editor == null) { throw new ArgumentNullException(nameof(editor)); } if (controller == null) { throw new ArgumentNullException(nameof(controller)); } this.editor = editor; this.controller = controller; }
public EditorGameGraphicsCompositorService([NotNull] IEditorGameController controller, [NotNull] GameEditorViewModel editor) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } if (editor == null) { throw new ArgumentNullException(nameof(editor)); } this.controller = controller; this.editor = editor; settingsProvider = editor.ServiceProvider.Get <GameSettingsProviderService>(); }
/// <inheritdoc/> public override void Highlight(IEditorGameController controller, EditorServiceGame game, AssetItem assetItem, float duration) { var model = controller.Loader.GetRuntimeObject <Model>(assetItem); if (model != null) { lock (highlightedMeshes) { foreach (var mesh in model.Meshes) { highlightedMeshes[mesh] = DirectReferenceColor; var currentMesh = mesh; controller.InvokeTask(() => HighlightMesh(game, currentMesh, duration)); } } } }
/// <summary> /// Initializes a new instance of the <see cref="EditorNavigationViewModel"/> class. /// </summary> /// <param name="serviceProvider">The service provider for this view model.</param> /// <param name="controller">The controller object for the related editor game.</param> public EditorLightingViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller, [NotNull] EntityHierarchyEditorViewModel editor) : base(serviceProvider) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } if (editor == null) { throw new ArgumentNullException(nameof(editor)); } this.controller = controller; this.editor = editor; RequestLightProbesComputeCommand = new AnonymousTaskCommand(ServiceProvider, () => RebuildLightProbes(LightProbeBounces)); RequestLightProbesResetCommand = new AnonymousTaskCommand(ServiceProvider, () => RebuildLightProbes(0)); CaptureCubemapCommand = new AnonymousTaskCommand(ServiceProvider, CaptureCubemap); }
protected EditorGameCameraService(IEditorGameController controller) { Controller = controller; }
protected EditorGameComponentChangeWatcherService(IEditorGameController controller) { this.controller = controller; }
public EditorGameComponentGizmoService(IEditorGameController controller) { this.controller = controller; }
public EditorGameParticleComponentChangeWatcherService(IEditorGameController controller) : base(controller) { }
public UIEditorGameCameraService(IEditorGameController controller) : base(controller) { }
/// <summary> /// Highlights the given asset in the scene viewport. /// </summary> /// <param name="controller"></param> /// <param name="game"></param> /// <param name="assetItem"></param> /// <param name="duration"></param> /// <remarks>This method is executed from the scene game thread.</remarks> public abstract void Highlight(IEditorGameController controller, EditorServiceGame game, AssetItem assetItem, float duration);
public EditorGameCameraPreviewService(IEditorGameController controller) { this.controller = controller; }
public EditorGameEntityCameraService([NotNull] EntityHierarchyEditorViewModel editor, IEditorGameController controller) : base(controller) { this.editor = editor; }