コード例 #1
0
 public CurveHandleEditWidget(ITransformGizmo parent, PolyCurveSO curve, FScene scene)
 {
     //this.parent = parent;
     this.curve = curve;
     //this.scene = scene;
     VertexIndex = 0;
 }
コード例 #2
0
        public void DismissActiveGizmo()
        {
            FScene scene = Context.Scene;

            if (activeGizmo != null)
            {
                scene.RemoveUIElement(activeGizmo, true);
                activeGizmo = null;
                SendOnActiveGizmoModified();
            }
        }
コード例 #3
0
        public TransformManager(ITransformGizmoBuilder defaultBuilder)
        {
            activeBuilder = defaultBuilder;
            activeGizmo   = null;

            GizmoTypes = new Dictionary <string, ITransformGizmoBuilder>();
            RegisterGizmoType(NoGizmoType, new NoGizmoBuilder());
            RegisterGizmoType(DefaultGizmoType, activeBuilder);
            sActiveGizmoType = DefaultGizmoType;

            defaultFrameType   = FrameType.LocalFrame;
            lastFrameTypeCache = new Dictionary <SceneObject, FrameType>();

            sOverrideGizmoType = "";
        }
コード例 #4
0
 public SnapDragSourceWidget(ITransformGizmo parent, FScene scene, SnapSet targets)
 {
     this.parent  = parent;
     this.scene   = scene;
     this.Targets = targets;
 }
コード例 #5
0
        public void AddGizmo(List <TransformableSO> targets)
        {
            ITransformGizmoBuilder useBuilder = activeBuilder;

            if (sOverrideGizmoType != null && sOverrideGizmoType != "")
            {
                useBuilder = GizmoTypes[sOverrideGizmoType];
            }

            List <TransformableSO> useTargets = new List <TransformableSO>(targets);

            if (useTargets.Count > 0 && useBuilder.SupportsMultipleObjects == false)
            {
                useTargets.RemoveRange(1, useTargets.Count - 1);
            }

            FScene scene = Context.Scene;

            // remove existing active gizmo
            // [TODO] support multiple gizmos?
            if (activeGizmo != null)
            {
                if (unordered_lists_equal(activeGizmo.Targets, useTargets))
                {
                    return;     // same targets
                }
                DismissActiveGizmo();
            }

            if (targets != null)
            {
                activeGizmo = useBuilder.Build(scene, useTargets);

                if (activeGizmo == null)
                {
                    return;
                }

                // set frame type. behavior here is a bit tricky...we have a default frame type
                // and then a cached type for each object. However if we only cache type on explicit
                // user changes, then if user changes default, all other gizmos inherit this default.
                // This is currently a problem because we are also using default frame type to
                // control things like snapping behavior (local=translate+rotate, world=translate-only).
                // So then if we change that, we can change default, which then changes object gizmo
                // behavior in unexpected ways. So right now we are initializing cache with a per-type
                // default (always Local right now), which user can then change. This "feels" right-est...
                if (activeGizmo.SupportsFrameMode)
                {
                    if (targets.Count == 1)
                    {
                        if (lastFrameTypeCache.ContainsKey(useTargets[0]) == false)
                        {
                            lastFrameTypeCache[useTargets[0]] = initial_frame_type(useTargets[0]);
                        }
                        activeGizmo.CurrentFrameMode = lastFrameTypeCache[useTargets[0]];
                    }
                    else
                    {
                        activeGizmo.CurrentFrameMode = defaultFrameType;
                    }
                }

                scene.AddUIElement(activeGizmo);
                SendOnActiveGizmoModified();
            }
        }
コード例 #6
0
 public PositionConstrainedPointWidget(ITransformGizmo parent, FScene scene)
 {
     //this.parent = parent;
     this.Scene = scene;
 }
コード例 #7
0
 public AxisParameterEditWidget(ITransformGizmo parent, PrimitiveSO primitive, FScene scene)
 {
     //this.parent = parent;
     this.primitive = primitive;
     this.scene     = scene;
 }