Esempio n. 1
0
        virtual public void Setup()
        {
            // push history stream, so that we can do undo/redo internal to tool,
            // that will not end up in external history
            push_history_stream();

            brushIndicator = new BrushCursorSphere()
            {
                PositionF = () => { return(Scene.ToWorldP(lastBrushPosS.Origin)); },
                Radius    = fDimension.World(() => { return(radius.WorldValue); })
            };
            Indicators.AddIndicator(brushIndicator);
            brushIndicator.material = MaterialUtil.CreateTransparentMaterialF(Colorf.DarkRed, 0.8f);


            if (PreviewMaterial == null)
            {
                PreviewMaterial = SOMaterial.CreateFlatShaded("MeshEditor_generated", Colorf.DimGrey);
            }
            previewSO = new DMeshSO();
            previewSO.EnableSpatial = false;
            previewSO.Create(new DMesh3(Target.Mesh), PreviewMaterial);
            previewSO.Name = "MeshEditorTool_preview";
            previewSO.SetLocalFrame(Target.GetLocalFrame(CoordSpace.ObjectCoords), CoordSpace.ObjectCoords);
            previewSO.SetLocalScale(Target.GetLocalScale());
            Scene.AddSceneObject(previewSO);


            PreviewSpatial = new EditMeshSpatial()
            {
                SourceMesh    = Target.Mesh,
                SourceSpatial = Target.Spatial,
                EditMesh      = PreviewMesh
            };
        }
Esempio n. 2
0
        public DrawTubeTool(FScene scene)
        {
            this.scene = scene;

            behaviors = new InputBehaviorSet();

            // TODO is this where we should be doing this??
            behaviors.Add(
                new DrawTubeTool_MouseBehavior(scene.Context)
            {
                Priority = 5
            });
            behaviors.Add(
                new DrawTubeTool_SpatialDeviceBehavior(this, scene.Context)
            {
                Priority = 5
            });

            // restore radius
            if (SavedSettings.Restore("DrawTubeTool_radius") != null)
            {
                radius = (float)SavedSettings.Restore("DrawTubeTool_radius");
            }


            indicators = new ToolIndicatorSet(this, scene);
            BrushCursorSphere brushSphere = new BrushCursorSphere()
            {
                PositionF = () => { return(lastPreviewPos.Origin); },
                Radius    = fDimension.Scene(() => { return(Radius); })
            };

            brushSphereMat       = MaterialUtil.CreateTransparentMaterialF(Colorf.CornflowerBlue, 0.2f);
            brushSphere.material = brushSphereMat;
            indicators.AddIndicator(brushSphere);
        }