override protected void OnUpdateCapture(Ray3f worldRay, Standard3DWidget w)
 {
     if (activeWidget is SurfaceConstrainedPointWidget)
     {
         CurrentConstraintSurface = (activeWidget as SurfaceConstrainedPointWidget).CurrentConstraintSO;
     }
 }
 public virtual void EndHover(Ray3f ray)
 {
     if (hoverWidget != null)
     {
         MaterialUtil.SetMaterial(hoverWidget.RootGameObject, hoverWidget.StandardMaterial);
         hoverWidget = null;
     }
 }
 public virtual void UpdateHover(Ray3f ray, UIRayHit hit)
 {
     if (hoverWidget != null)
     {
         EndHover(ray);
     }
     if (Widgets.ContainsKey(hit.hitGO))
     {
         hoverWidget = Widgets[hit.hitGO];
         MaterialUtil.SetMaterial(hoverWidget.RootGameObject, hoverWidget.HoverMaterial);
     }
 }
        override protected void OnBeginCapture(Ray3f worldRay, Standard3DWidget w)
        {
            List <SceneObject> PotentialTargets = new List <SceneObject>(ConstraintSurfaces);

            foreach (var v in Widgets)
            {
                if (v.Value is SurfaceConstrainedPointWidget)
                {
                    SurfaceConstrainedPointWidget widget = v.Value as SurfaceConstrainedPointWidget;
                    widget.SourceSO           = Targets[0];
                    widget.ConstraintSurfaces = PotentialTargets;
                }
            }
        }
        virtual public bool BeginCapture(InputEvent e)
        {
            activeWidget = null;

            // if the hit gameobject has a widget attached to it, begin capture & transformation
            // TODO maybe wrapper class should have Begin/Update/End capture functions, then we do not need BeginTransformation/EndTransformation ?
            if (Widgets.ContainsKey(e.hit.hitGO))
            {
                Standard3DWidget w = Widgets [e.hit.hitGO];
                if (w.BeginCapture(targetWrapper, e.ray, e.hit.toUIHit()))
                {
                    MaterialUtil.SetMaterial(w.RootGameObject, w.HoverMaterial);
                    targetWrapper.BeginTransformation();
                    activeWidget = w;
                    OnTransformInteractionStart();
                    return(true);
                }
            }
            return(false);
        }
        virtual public bool EndCapture(InputEvent e)
        {
            if (activeWidget != null)
            {
                MaterialUtil.SetMaterial(activeWidget.RootGameObject, activeWidget.StandardMaterial);

                // tell wrapper we are done with capture, so it should bake transform/etc
                bool bModified = targetWrapper.DoneTransformation();
                if (bModified)
                {
                    // update gizmo
                    onTransformModified(null);
                    // allow client/subclass to add any other change records
                    OnTransformInteractionEnd();
                    // gizmos drop change events by default
                    Scene.History.PushInteractionCheckpoint();
                }

                activeWidget = null;
            }
            return(true);
        }
        virtual public bool EndCapture(InputEvent e)
        {
            if (activeWidget != null)
            {
                MaterialUtil.SetMaterial(activeWidget.RootGameObject, activeWidget.StandardMaterial);

                // update widget frame in case we want to do something like stay scene-aligned...
                activeWidget.EndCapture(targetWrapper);

                // note: e will be null if we call this from Disconnect(), because we were in an
                //   active capture when we were Disconnected. Not sure how to handle this gracefully
                //   in subclasses...could pass e directly to OnEndCapture? pass a flag?
                if (e != null)
                {
                    OnEndCapture(e.ray, activeWidget);
                }

                // tell wrapper we are done with capture, so it should bake transform/etc
                bool bModified = targetWrapper.DoneTransformation(EmitChanges);
                if (bModified)
                {
                    // update gizmo
                    onTransformModified(null);
                    // allow client/subclass to add any other change records
                    OnTransformInteractionEnd();
                    // gizmos drop change events by default
                    if (EmitChanges)
                    {
                        Scene.History.PushInteractionCheckpoint();
                    }
                }
            }

            activeWidget = null;
            return(true);
        }
 virtual protected void OnEndCapture(Ray3f worldRay, Standard3DWidget w)
 {
 }
 protected override void OnEndCapture(Ray3f worldRay, Standard3DWidget w)
 {
     //clear TargetObjects in widgets?
 }