Skip to content

Instantly share code, notes, and snippets.

@rms80
Created June 15, 2017 02:49
Show Gist options
  • Save rms80/d2be0f96cecbe04ee136633eb206fa3b to your computer and use it in GitHub Desktop.
Save rms80/d2be0f96cecbe04ee136633eb206fa3b to your computer and use it in GitHub Desktop.
BaseImmediateActionTool
// 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