Exemple #1
0
            public override void Finish(bool cancel)
            {
                if (!cancel)
                {
                    //calculate area position
                    var points = CreatingObject.GetPoints();
                    if (points.Length != 0)
                    {
                        var position = Vector3.Zero;
                        foreach (var point in points)
                        {
                            position += point.TransformV.Position;
                        }
                        position /= points.Length;
                        CreatingObject.Transform = new Transform(position, Quaternion.Identity);
                    }

                    ////attach points to the area
                    //foreach( var point in points )
                    //	Component_ObjectInSpace_Utility.Attach( CreatingObject, point );

                    //select area and points
                    var toSelect = new List <Component>();
                    toSelect.Add(CreatingObject);
                    toSelect.AddRange(points);
                    EditorAPI.SelectComponentsInMainObjectsWindow(DocumentWindow, toSelect.ToArray());
                }

                base.Finish(cancel);
            }
Exemple #2
0
            public override void Finish(bool cancel)
            {
                if (!cancel)
                {
                    //calculate mesh in space position
                    var points = MeshGeometry.GetPointPositions();
                    if (points.Length != 0)
                    {
                        var position = Vector3.Zero;
                        foreach (var point in points)
                        {
                            position += point;
                        }
                        position /= points.Length;
                        CreatingObject.Transform = new Transform(position, Quaternion.Identity);
                    }

                    //attach points to the mesh in space
                    foreach (var point in MeshGeometry.GetPoints())
                    {
                        Component_ObjectInSpace_Utility.Attach(CreatingObject, point);
                    }

                    //select meshin space and points
                    var toSelect = new List <Component>();
                    toSelect.Add(CreatingObject);
                    //toSelect.AddRange( points );
                    EditorAPI.SelectComponentsInMainObjectsWindow(DocumentWindow, toSelect.ToArray());

                    //update mesh
                    MeshGeometry?.ShouldRecompileMesh();
                }

                base.Finish(cancel);
            }