Created
June 15, 2017 02:49
-
-
Save rms80/d2be0f96cecbe04ee136633eb206fa3b to your computer and use it in GitHub Desktop.
BaseImmediateActionTool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tool that should be immediately applied on Activation. | |
// Not clear how to end it though...don't know hand! | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using g3; | |
namespace f3 | |
{ | |
public abstract class BaseImmediateActionTool : ITool | |
{ | |
abstract public string Name { get; } | |
abstract public string TypeIdentifier { get; } | |
virtual public InputBehaviorSet InputBehaviors { | |
get { return null; } | |
} | |
// client must implement Apply to specify behavior | |
abstract public void Apply(); | |
protected FScene Scene; | |
protected List<SceneObject> Targets; | |
public BaseImmediateActionTool(FScene scene, List<SceneObject> targets) | |
{ | |
Scene = scene; | |
Targets = new List<SceneObject>(targets); | |
Scene.Context.RegisterNextFrameAction(() => { | |
Apply(); | |
Scene.Context.RegisterNextFrameAction(() => { | |
//deactivate tool somehow ?? | |
//Scene.Context.ToolManager.DeactivateTool() | |
}); | |
}); | |
} | |
public virtual bool AllowSelectionChanges { get { return false; } } | |
virtual public bool HasApply { get { return true; } } | |
virtual public bool CanApply { get { return true; } } | |
virtual public void PreRender() | |
{ | |
} | |
virtual public void Shutdown() | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment