コード例 #1
0
ファイル: MeshShellTool.cs プロジェクト: tomleetv/gsTools
        protected override void process_new_result(DMeshOutputStatus result)
        {
            bool bOK = (result.IsErrorOutput() == false);

            current_result_is_partial =
                bOK && result.Mesh.HasMetadata && result.Mesh.FindMetadata("is_partial") != null;
        }
コード例 #2
0
ファイル: AddHoleTool.cs プロジェクト: tomleetv/gsTools
        void update_cut_op()
        {
            List <ModelingOpException> exceptions = null;

            if (cut_parameters_dirty)
            {
                CutOp.HoleSize         = hole_size;
                CutOp.HoleSubdivisions = subdivisions;
                CutOp.ThroughHole      = through_hole;
                CutOp.HoleDepth        = hole_depth;
                cut_parameters_dirty   = false;
            }

            try {
                DMeshOutputStatus result = ComputeOp.CheckForNewMesh();
                is_computing = (result.State == DMeshOutputStatus.States.Computing);
                if (result.State == DMeshOutputStatus.States.Ready)
                {
                    current_result_ok = (result.IsErrorOutput() == false);

                    var setMesh = result.Mesh;
                    if (result.Mesh.CompactMetric < 0.8)
                    {
                        setMesh = new DMesh3(result.Mesh, true);
                    }
                    CutPreviewSO.ReplaceMesh(setMesh, true);
                    CutPreviewSO.AssignSOMaterial((current_result_ok) ? CutPreviewMaterial : ErrorMaterial);

                    exceptions = result.ComputeExceptions;
                }
            } catch (Exception e) {
                DebugUtil.Log(2, Name + "Tool.PreRender: caught exception! " + e.Message);
            }

            if (ComputeOp.HaveBackgroundException)
            {
                Exception e = ComputeOp.ExtractBackgroundException();
                if (VerboseOutput)
                {
                    DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute: " + e.Message);
                    DebugUtil.Log(2, e.StackTrace);
                }
            }

            if (exceptions != null && VerboseOutput)
            {
                foreach (var mopex in exceptions)
                {
                    DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute " + mopex.op.GetType().ToString() + " : " + mopex.e.Message);
                    DebugUtil.Log(2, mopex.e.StackTrace);
                }
            }
        }
コード例 #3
0
        virtual public void PreRender()
        {
            if (in_shutdown())
            {
                return;
            }

            try {
                is_computing = false;
                foreach (var obj in objects)
                {
                    List <ModelingOpException> exceptions = null;

                    DMeshOutputStatus result = obj.Compute.CheckForNewMesh();
                    is_computing |= (result.State == DMeshOutputStatus.States.Computing);
                    if (result.State == DMeshOutputStatus.States.Ready)
                    {
                        process_new_result(obj, result);
                        obj.current_result_ok = (result.IsErrorOutput() == false);

                        var setMesh = result.Mesh;
                        if (result.Mesh.CompactMetric < 0.8)
                        {
                            setMesh = new DMesh3(result.Mesh, true);
                        }
                        obj.Preview.ReplaceMesh(setMesh, true);
                        obj.Preview.AssignSOMaterial((obj.current_result_ok) ? PreviewMaterial : ErrorMaterial);
                        exceptions = result.ComputeExceptions;
                    }

                    if (obj.Compute.HaveBackgroundException)
                    {
                        Exception e = obj.Compute.ExtractBackgroundException();
                        DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute: " + e.Message);
                        DebugUtil.Log(2, e.StackTrace);
                    }
                    if (exceptions != null)
                    {
                        foreach (var mopex in exceptions)
                        {
                            DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute " + mopex.op.GetType().ToString() + " : " + mopex.e.Message);
                            DebugUtil.Log(2, mopex.e.StackTrace);
                        }
                    }
                }
            } catch (Exception e) {
                DebugUtil.Log(2, Name + "Tool.PreRender: caught exception! " + e.Message);
            }
        }