コード例 #1
0
        public static void InitializeSocketDataModel()
        {
            SocketDesignGraph graph = SocketDesignGraph.Build();

            OG.Model.InitializeWorkflow(graph);
            if (ExtendDesignGraphF != null)
            {
                ExtendDesignGraphF(graph);
            }
        }
コード例 #2
0
        public static void AddVRWorkflowGraphTransitions(SocketDesignGraph graph)
        {
            WorkflowBuilder builder = new WorkflowBuilder(graph);

            WorkflowState scanState = graph.FindStateByName(ScanState.Identifier);

            var alignScanTool = builder.AddState(OGVRWorkflow.VRAlignScanState, OGActions.BeginVRAlignScanTool);

            builder.AddTransition(scanState, alignScanTool, OGVRWorkflow.VRAlignScanStartT, OGActions.CanVRAlignScan, null, null);
            builder.AddTransition(alignScanTool, scanState, OGVRWorkflow.VRAlignScanAcceptT, OGActions.CanAcceptVRAlignScanTool, OGActions.AcceptVRAlignScanTool, null);
            builder.AddTransition(alignScanTool, scanState, OGVRWorkflow.VRAlignScanCancelT, null, OGActions.CancelVRAlignScanTool, null);
        }
コード例 #3
0
        public static SocketDesignGraph Build()
        {
            ScanState scanState = new ScanState()
            {
                Name = ScanState.Identifier
            };
            RectifyState rectifyState = new RectifyState()
            {
                Name = RectifyState.Identifier
            };
            SocketDesignState socketState = new SocketDesignState()
            {
                Name = SocketDesignState.Identifier
            };

            SocketDesignGraph graph   = new SocketDesignGraph();
            WorkflowBuilder   builder = new WorkflowBuilder(graph);

            graph.AddState(scanState);
            graph.AddState(rectifyState);
            graph.AddState(socketState);


            WorkflowTransition toRectify = graph.AddTransition(scanState, rectifyState);

            toRectify.BeforeTransition.Add(() => {
                OG.Context.TransformManager.SetActiveGizmoType(TransformManager.NoGizmoType);
                OGActions.InitializeLegFromScan();
            });


            WorkflowTransition toSocket = graph.AddTransition(rectifyState, socketState);

            toSocket.BeforeTransition.Add(() => {
                OG.Context.TransformManager.SetActiveGizmoType(TransformManager.NoGizmoType);
            });

            WorkflowTransition backToRectify = graph.AddTransition(socketState, rectifyState);

            backToRectify.BeforeTransition.Add(() => {
                OG.Context.TransformManager.SetActiveGizmoType(TransformManager.NoGizmoType);
            });



            // scan tool states

            var trimScanTool = builder.AddState(OGWorkflow.TrimScanState, OGActions.BeginTrimScanTool);

            builder.AddTransition(scanState, trimScanTool, OGWorkflow.TrimScanStartT, OGActions.CanTrimScan, null, null);
            builder.AddTransition(trimScanTool, scanState, OGWorkflow.TrimScanAcceptT, OGActions.CanAcceptTrimScanTool, OGActions.AcceptTrimScanTool, null);
            builder.AddTransition(trimScanTool, scanState, OGWorkflow.TrimScanCancelT, null, OGActions.CancelTrimScanTool, null);

            var alignScanTool = builder.AddState(OGWorkflow.AlignScanState, OGActions.BeginAlignScanTool);

            builder.AddTransition(scanState, alignScanTool, OGWorkflow.AlignScanStartT, OGActions.CanAlignScan, null, null);
            builder.AddTransition(alignScanTool, scanState, OGWorkflow.AlignScanAcceptT, OGActions.CanAcceptAlignScanTool, OGActions.AcceptAlignScanTool, null);
            builder.AddTransition(alignScanTool, scanState, OGWorkflow.AlignScanCancelT, null, OGActions.CancelAlignScanTool, null);


            // rectify tool states

            var drawAreaTool = builder.AddState(OGWorkflow.DrawAreaState, OGActions.BeginDrawAreaTool);

            builder.AddTransition(rectifyState, drawAreaTool, OGWorkflow.DrawAreaStartT, OGActions.CanDrawArea, null, null);
            builder.AddTransition(drawAreaTool, rectifyState, OGWorkflow.DrawAreaExitT, null, OGActions.EndDrawAreaTool, null);

            var deformRingTool = builder.AddState(OGWorkflow.AddDeformRingState, OGActions.BeginDeformRingTool);

            builder.AddTransition(rectifyState, deformRingTool, OGWorkflow.AddDeformRingStartT, OGActions.CanAddDeformRing, null, null);
            builder.AddTransition(deformRingTool, rectifyState, OGWorkflow.AddDeformRingAcceptT, OGActions.CanAcceptDeformRingTool, OGActions.AcceptDeformRingTool, null);
            builder.AddTransition(deformRingTool, rectifyState, OGWorkflow.AddDeformRingCancelT, null, OGActions.CancelDeformRingTool, null);

            var sculptAreaTool = builder.AddState(OGWorkflow.SculptAreaState, OGActions.BeginSculptCurveTool);

            builder.AddTransition(rectifyState, sculptAreaTool, OGWorkflow.SculptAreaStartT, OGActions.CanSculptCurve, null, null);
            builder.AddTransition(sculptAreaTool, rectifyState, OGWorkflow.SculptAreaExitT, null, OGActions.EndSculptCurveTool, null);



            // socket tool states
            var drawTrimlineTool = builder.AddState(OGWorkflow.DrawTrimlineState, OGActions.BeginDrawTrimLineTool);

            builder.AddTransition(socketState, drawTrimlineTool, OGWorkflow.DrawTrimlineStartT, OGActions.CanDrawTrimLine, null, null);
            builder.AddTransition(drawTrimlineTool, socketState, OGWorkflow.DrawTrimlineExitT, null, OGActions.EndDrawTrimLineTool, null);

            var planeTrimlineTool = builder.AddState(OGWorkflow.PlaneTrimlineState, OGActions.BeginPlaneTrimLineTool);

            builder.AddTransition(socketState, planeTrimlineTool, OGWorkflow.PlaneTrimlineStartT, OGActions.CanAddPlaneTrimLine, null, null);
            builder.AddTransition(planeTrimlineTool, socketState, OGWorkflow.PlaneTrimlineAcceptT, OGActions.CanAcceptPlaneTrimLineTool, OGActions.AcceptPlaneTrimLineTool, null);
            builder.AddTransition(planeTrimlineTool, socketState, OGWorkflow.PlaneTrimlineCancelT, null, OGActions.CancelPlaneTrimLineTool, null);

            var sculptTrimlineTool = builder.AddState(OGWorkflow.SculptTrimlineState, OGActions.BeginSculptCurveTool);

            builder.AddTransition(socketState, sculptTrimlineTool, OGWorkflow.SculptTrimlineStartT, OGActions.CanSculptCurve, null, null);
            builder.AddTransition(sculptTrimlineTool, socketState, OGWorkflow.SculptTrimlineExitT, null, OGActions.EndSculptCurveTool, null);


            graph.LogF = DebugUtil.Log;   // print debug output


            return(graph);
        }