Ejemplo n.º 1
0
        private void createShape(System.Windows.Forms.DragEventArgs e)
        {
            _assetPaths = CSharpFramework.Contexts.IDropContext.GetAssetPaths(e);
            _assetTypes = CSharpFramework.Contexts.IDropContext.GetAssetTypes(e);
            _assetNames = CSharpFramework.Contexts.IDropContext.GetAssetNames(e);

            Debug.Assert(_assetPaths.Length == _assetTypes.Length && _assetPaths.Length == _assetNames.Length);
            if (_assetPaths.Length == 0)
            {
                return;
            }

            if (_assetTypes[0] == "Model")
            {
                EntityShape entity = new EntityShape(_assetNames[0]);
                entity.EntityClass = "VisBaseEntity_cl";
                entity.ModelFile   = _assetPaths[0];
                _dummyShape        = entity;
            }
            else if (_assetTypes[0] == "StaticMesh")
            {
                StaticMeshShape staticMesh = new StaticMeshShape(_assetNames[0]);
                staticMesh.MeshFileName = _assetPaths[0];
                _dummyShape             = staticMesh;
            }
            else if (_assetTypes[0] == "Prefab")
            {
                PrefabShape prefabShape = new PrefabShape(_assetNames[0]);
                prefabShape.Filename = _assetPaths[0];
                _dummyShape          = prefabShape;
            }
        }
        public override ShapeBase CreateShapeInstance()
        {
            string ShapeName = System.IO.Path.GetFileNameWithoutExtension(_MeshPath);
              if (ShapeName == string.Empty)
            ShapeName = "Model";

              StaticMeshShape SMS = new StaticMeshShape(ShapeName);
              SMS.MeshFileName = _MeshPath;

              return SMS;
        }
        public override ShapeBase CreateShapeInstance()
        {
            string ShapeName = System.IO.Path.GetFileNameWithoutExtension(_MeshPath);

            if (ShapeName == string.Empty)
            {
                ShapeName = "Model";
            }

            StaticMeshShape SMS = new StaticMeshShape(ShapeName);

            SMS.MeshFileName = _MeshPath;

            return(SMS);
        }
        void EditorManager_ProcessExternalFileDrop(object sender, ExternalFileDropArgs e)
        {
            if (!e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                return;
            }
            if (EditorManager.Scene == null)
            {
                return;
            }

            string filename = ((string[])e.Data.GetData(DataFormats.FileDrop))[0];

            if (!EditorManager.Project.CheckRelative(filename))
            {
                EditorManager.ShowMessageBox("Cannot drop file \n\n" + filename + "\n\n because it is not project relative", "Cannot drop object", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            filename = EditorManager.Project.MakeRelative(filename);
            string extension = Path.GetExtension(filename);
            string name      = Path.GetFileNameWithoutExtension(filename);

            if (string.Compare(extension, ".model", true) == 0)
            {
                EntityShape shape = new EntityShape(name);
                shape.ModelFile = filename;
                EditorManager.ActiveView.DropObject(shape, e);
            }
            else if (string.Compare(extension, ".vmesh", true) == 0)
            {
                StaticMeshShape shape = new StaticMeshShape(name);
                shape.MeshFileName = filename;
                EditorManager.ActiveView.DropObject(shape, e);
            }
            else if (string.Compare(extension, ".prefab", true) == 0)
            {
                PrefabShape shape = new PrefabShape(name);
                shape.Filename = filename;
                EditorManager.ActiveView.DropObject(shape, e);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Overridden function that performs a "relevant operation"
        /// </summary>
        /// <param name="name"></param>
        /// <param name="iShapeIndex"></param>
        /// <param name="iShapeCount"></param>
        public override void PerformRelevantOperation(string name, int iShapeIndex, int iShapeCount)
        {
            base.PerformRelevantOperation (name, iShapeIndex, iShapeCount);

              if (name==@"Set lightgrid offset\pivot" || name==@"Set lightgrid offset\box center" || name==@"Set lightgrid offset\box bottom")
              {
            // open a group action
            if (iShapeIndex==0) EditorManager.Actions.StartGroup("light grid : "+name);

            Vector3F vNewOfs = Vector3F.Zero;
            if (name == @"Set lightgrid offset\pivot") vNewOfs = Vector3F.Zero;
            else
            if (name==@"Set lightgrid offset\box center")
            {
              BoundingBox bbox = LocalScaledBoundingBox;
              if (bbox.Valid)
            vNewOfs = bbox.Center;
              }
              else
            if (name==@"Set lightgrid offset\box bottom")
            {
              BoundingBox bbox = LocalScaledBoundingBox;
              if (bbox.Valid)
              {
            vNewOfs = bbox.Center;
            vNewOfs.Z = bbox.vMin.Z;
              }
            }

            // set the offset
            EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"LightGridSampleOfs",vNewOfs));

            // close group action
            if (iShapeIndex==iShapeCount-1) EditorManager.Actions.EndGroup();
            return;
              }
              if (name==@"Shaders\Model surfaces")
              {
            if (ShaderAssignment!=null)
              ShaderAssignment(this,new ShaderAssignmentEventArgs(this));
            return;
              }
              if (name == RO_CONVERT_TO_STATIC_MESH)
              {
            if (iShapeCount > 1 && iShapeIndex == 0)
              EditorManager.Actions.StartGroup("Convert entities to meshes");

            // create a shape with the same relevant properties
            StaticMeshShape replacement = new StaticMeshShape(this.ShapeName);

            // remap all public browsable properties (except uniform scaling as this overwrites current scaling)
            StringCollection exclude = new StringCollection();
            exclude.Add("UniformScaling");
            SerializationHelper.CopyInstanceProperties(replacement, this, true,true,exclude);

            string sVMeshPath = this.ModelFile;

            // remap file name of the mesh
            if (!string.IsNullOrEmpty(sVMeshPath))
              replacement.MeshFileName = Path.ChangeExtension(sVMeshPath, ".vmesh");

            EditorManager.Actions.Add(new ReplaceShapeAction(this, replacement));

            if (iShapeCount > 1 && iShapeIndex == iShapeCount - 1)
              EditorManager.Actions.EndGroup();

            return;
              }
              if (name == RO_OPEN_IN_MV)
              {
            OpenModelInModelViewer();
            return;
              }
        }
Ejemplo n.º 6
0
        void EditorManager_SceneEvent(object sender, SceneEventArgs e)
        {
            if (e.action == SceneEventArgs.Action.AllowExport)
              {
            if (MeshExportSettings.AutomaticExport && MeshExportSettings.ExportForAssetProfile.IsActiveProfileSet)
            {
              if (EditorManager.ShowMessageBox("The terrain data needs to be saved before the export.\n Continue?", "Save Terrain Data", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
              {
            if (e is ExportSceneEventArgs)
            {
              ((ExportSceneEventArgs)e).CancelExport = true;
            }
              }
            }
              }
              else if (e.action == SceneEventArgs.Action.BeforeExport && HasEngineInstance())
              {
            if (e is ExportSceneEventArgs)
            {
              if (MeshExportSettings.ExportForAssetProfile.IsActiveProfileSet)
              {
            if (!MeshExportSettings.AutomaticExport)
              return;

            EditorManager.ActiveView.SetDefaultContext();

            int iCountX = 0;
            int iCountY = 0;
            if (!EngineTerrain.GetSectorMeshCount(ref iCountX, ref iCountY))
              return;

            EditorManager.EngineManager.DisableRendering();
            EditorManager.Progress.ShowProgressDialog("Exporting terrain sectors as static meshes");

            try
            {
              // export each sector of the terrain as a .vmesh file
              EngineTerrain.ExportTerrainMeshs(MeshExportSettings, EditorManager.Progress, 50.0f, false);

              // collection which holds all exported zones, these zones are removed after the export (see below: SceneEventArgs.Action.AfterExport)
              exportedZones = new ZoneCollection();

              // disable visibility zone disconnecting
              EngineTerrain.SetTerrainMeshExportFlag(true);

              float fStep = 50.0f / (float)(iCountX*iCountY);
              float fPercentage = 50.0f;

              // create zone, layer, and static mesh for each sector of the terrain
              for (int sy = 0; sy < iCountY; ++sy)
              {
                for (int sx = 0; sx < iCountX; ++sx)
                {
                  string sectorFileName = EngineTerrain.GetSectorMeshFileName(sx, sy);
                  if (sectorFileName == null)
                    continue;

                  // create static mesh
                  StaticMeshShape shape = new StaticMeshShape(Path.GetFileNameWithoutExtension(sectorFileName));
                  shape.Position = (Vector3F)EngineTerrain.GetSectorOrigin(sx, sy);
                  shape.MeshFileName = sectorFileName;
                  string lightmapFileName = EngineTerrain.GetSectorLightmapName(sx, sy);
                  if (lightmapFileName != null)
                    shape.CustomLightmap = lightmapFileName;

                  // create zone
                  string uniqueFileName = FileHelper.CreateUniqueFilename(EditorManager.Scene.LayerDirectoryName, "TerrainSectorZone" + sx + "_" + sy, IScene.ZoneFileExtension);
                  object[] zoneParameters = { EditorManager.Scene.CreateUniqueZoneName("TerrainSectorZone" + sx + "_" + sy) };
                  Zone zone = EditorManager.ZoneFactory.CreateInstance(zoneParameters);
                  zone.SetZoneFileNameInternal(uniqueFileName);
                  zone.LoadedDistance = MeshExportSettings.LoadedDistance;
                  zone.CacheInMargin = MeshExportSettings.CacheInMargin;
                  zone.CacheOutMargin = MeshExportSettings.CacheOutMargin;
                  EditorManager.Scene.AddZone(zone);

                  // create layer
                  string uniqueFile = EditorManager.Scene.Layers.CreateUniqueLayerFileName(EditorManager.Scene.LayerDirectoryName, "TerrainSector" + sx + "_" + sy);
                  object[] layerParameters = { "TerrainSector" };
                  Layer layer = EditorManager.LayerFactory.CreateInstance(layerParameters);
                  layer.SetLayerFileNameInternal(uniqueFile);
                  layer.AttachToZone(zone);
                  EditorManager.Scene.AddLayer(layer, true);

                  layer.AddShape(shape, shape.Parent);

                  // add zone to export info, so that it gets exported
                  ((ExportSceneEventArgs)e).ExportInfo.RelevantExportZones.Add(zone);
                  ((ExportSceneEventArgs)e).ExportInfo.RelevantEmbeddedZones.Add(zone);

                  // keep reference to be able to remove the zone after export
                  exportedZones.Add(zone);

                  fPercentage += fStep;
                  if (EditorManager.Progress != null)
                    EditorManager.Progress.Percentage = fPercentage;

                  Application.DoEvents();
                }
              }
            }
            finally
            {
              EditorManager.Progress.HideProgressDialog();
              EditorManager.EngineManager.EnableRendering();
            }
              }
            }
              }
              else if (e.action == SceneEventArgs.Action.AfterExport && HasEngineInstance())
              {
            if (e is ExportSceneEventArgs)
            {
              if (MeshExportSettings.ExportForAssetProfile.IsActiveProfileSet)
              {
            if (!MeshExportSettings.AutomaticExport)
              return;

            // re-enable default behaviour for terrain visibility zone serialization
            EngineTerrain.SetTerrainMeshExportFlag(false);

            foreach (Zone zone in exportedZones)
            {
              // create .deleted filenames
              string absLayerFileName = zone.Layers[0].AbsoluteLayerFilename + ".deleted";
              string absZoneFileName = zone.AbsoluteZoneFilename + ".deleted";

              EditorManager.Scene.RemoveZone(zone);

              // delete .deleted files, because they are not needed in any way
              if (File.Exists(absLayerFileName))
                File.Delete(absLayerFileName);
              if (File.Exists(absZoneFileName))
                File.Delete(absZoneFileName);
            }

            exportedZones.Clear();
              }
            }
              }
        }
        private void createShape(System.Windows.Forms.DragEventArgs e)
        {
            _assetPaths = CSharpFramework.Contexts.IDropContext.GetAssetPaths(e);
              _assetTypes = CSharpFramework.Contexts.IDropContext.GetAssetTypes(e);
              _assetNames = CSharpFramework.Contexts.IDropContext.GetAssetNames(e);

              Debug.Assert(_assetPaths.Length == _assetTypes.Length && _assetPaths.Length == _assetNames.Length);
              if (_assetPaths.Length == 0)
            return;

              if (_assetTypes[0] == "Model")
              {
            EntityShape entity = new EntityShape(_assetNames[0]);
            entity.EntityClass = "VisBaseEntity_cl";
            entity.ModelFile = _assetPaths[0];
            _dummyShape = entity;
              }
              else if (_assetTypes[0] == "StaticMesh")
              {
            StaticMeshShape staticMesh = new StaticMeshShape(_assetNames[0]);
            staticMesh.MeshFileName = _assetPaths[0];
            _dummyShape = staticMesh;
              }
              else if (_assetTypes[0] == "Prefab")
              {
            PrefabShape prefabShape = new PrefabShape(_assetNames[0]);
            prefabShape.Filename = _assetPaths[0];
            _dummyShape = prefabShape;
              }
        }
Ejemplo n.º 8
0
        public bool Build(ShapeCollection staticGeometries, ref int numGeometryVertices, ref int numGeometryTriangles)
        {
            if (!HasEngineInstance())
            {
                return(false);
            }

            EngineNavMesh.ClearNavMesh();
            EngineNavMesh.ClearGeometry();
            EngineNavMesh.ClearCarvers();
            EngineNavMesh.ClearSeedPoints();
            EngineNavMesh.ClearLocalSettings();
            EngineNavMesh.ClearDecorationCapsules();
            SetEngineInstanceBaseProperties();

            HavokNavMeshGlobalSettings globalSettings = GetGlobalSettings();

            if (globalSettings == null)
            {
                return(false);
            }

            BoundingBox parentZoneBbox = new BoundingBox();

            if (globalSettings.RestrictToInputGeometryFromSameZone && ParentZone != null)
            {
                parentZoneBbox = ParentZone.CalculateBoundingBox();
            }

            // check if there's a parent zone
            foreach (ShapeBase shape in staticGeometries)
            {
                // treat as cutter if flag is set and if in different zone
                bool potentiallyTreatAsCutter = globalSettings.RestrictToInputGeometryFromSameZone && (shape.ParentZone != ParentZone);

                if (shape is EntityShape)
                {
                    EntityShape   entity = shape as EntityShape;
                    eNavMeshUsage usage  = entity.GetNavMeshUsage();

                    // exclude entities that have a vHavokRigidBody component with "Motion Type" != "Fixed"
                    ShapeComponentType compType = (ShapeComponentType)EditorManager.EngineManager.ComponentClassManager.GetCollectionType("vHavokRigidBody");
                    if (compType != null && entity.Components != null)
                    {
                        ShapeComponent comp = entity.Components.GetComponentByType(compType);
                        if (comp != null)
                        {
                            string propValue = comp.GetPropertyValue("Motion Type") as string;
                            if (string.Compare(propValue, "Fixed") != 0)
                            {
                                usage = eNavMeshUsage.ExcludeFromNavMesh;
                            }
                        }
                    }

                    // potentially override usage
                    if (potentiallyTreatAsCutter && (usage == eNavMeshUsage.IncludeInNavMesh))
                    {
                        usage = eNavMeshUsage.CutterOnly;
                    }

                    if (usage != eNavMeshUsage.ExcludeFromNavMesh)
                    {
                        EngineNavMesh.AddEntityGeometry(entity.EngineEntity.GetNativeObject(), (int)usage, parentZoneBbox);
                    }
                }
                else if (shape is StaticMeshShape)
                {
                    StaticMeshShape staticMesh = shape as StaticMeshShape;
                    eNavMeshUsage   usage      = staticMesh.GetNavMeshUsage();

                    // potentially override usage
                    if (potentiallyTreatAsCutter && (usage == eNavMeshUsage.IncludeInNavMesh))
                    {
                        usage = eNavMeshUsage.CutterOnly;
                    }


                    if (usage != eNavMeshUsage.ExcludeFromNavMesh)
                    {
                        EngineNavMesh.AddStaticMeshGeometry(staticMesh.EngineMesh.GetNativeObject(), (int)usage, parentZoneBbox);
                    }
                }
                else if (shape is TerrainShape)
                {
                    TerrainShape  terrain = shape as TerrainShape;
                    eNavMeshUsage usage   = terrain.GetNavMeshUsage();

                    // potentially override usage
                    if (potentiallyTreatAsCutter && (usage == eNavMeshUsage.IncludeInNavMesh))
                    {
                        usage = eNavMeshUsage.CutterOnly;
                    }


                    if (usage != eNavMeshUsage.ExcludeFromNavMesh)
                    {
                        EngineNavMesh.AddTerrainGeometry(terrain.EngineTerrain.GetNativeObject(), (int)usage, parentZoneBbox);
                    }
                }
#if !HK_ANARCHY
                else if (shape is DecorationGroupShape)
                {
                    DecorationGroupShape decorationGroup = shape as DecorationGroupShape;

                    // Please note that currently the native HavokAiEnginePlugin only supports decoration capsules as cutters.
                    if (decorationGroup.GetNavMeshLimitedUsage() == DecorationGroupShape.eNavMeshLimitedUsage.CutterOnly)
                    {
                        EngineNavMesh.AddDecorationGroupCapsules(decorationGroup.EngineGroup.GetGroupsObject());
                    }
                }
#endif
#if USE_SPEEDTREE
                else if (shape is Speedtree6GroupShape)
                {
                    Speedtree6GroupShape trees = shape as Speedtree6GroupShape;
                    if (trees.EnableCollisions)
                    {
                        EngineNavMesh.AddSpeedTree6Capsules(trees.EngineGroup.GetGroupsObject());
                    }
                }
#endif
            }
            numGeometryVertices  = EngineNavMesh.GetNumGeometryVertices();
            numGeometryTriangles = EngineNavMesh.GetNumGeometryTriangles();

            // Add carvers
            ShapeCollection carvers = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshCarverShape));
            foreach (ShapeBase shape in carvers)
            {
                HavokNavMeshCarverShape carver    = shape as HavokNavMeshCarverShape;
                BoundingBox             localBbox = null;
                carver.GetLocalBoundingBox(ref localBbox);
                localBbox.vMin.X *= carver.ScaleX;
                localBbox.vMin.Y *= carver.ScaleY;
                localBbox.vMin.Z *= carver.ScaleZ;
                localBbox.vMax.X *= carver.ScaleX;
                localBbox.vMax.Y *= carver.ScaleY;
                localBbox.vMax.Z *= carver.ScaleZ;
                EngineNavMesh.AddBoxCarver(localBbox.vMin, localBbox.vMax, carver.Position, carver.RotationMatrix, carver.IsInverted());
            }

            // Add seed points
            ShapeCollection seedPoints = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshSeedPointShape));
            foreach (ShapeBase shape in seedPoints)
            {
                HavokNavMeshSeedPointShape seedPoint = shape as HavokNavMeshSeedPointShape;
                EngineNavMesh.AddSeedPoint(seedPoint.Position);
            }

            // Add local settings
            ShapeCollection localSettings = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshLocalSettingsShape));
            foreach (ShapeBase shape in localSettings)
            {
                HavokNavMeshLocalSettingsShape ls = shape as HavokNavMeshLocalSettingsShape;
                BoundingBox bbox = null;
                ls.GetLocalBoundingBox(ref bbox);
                bbox.vMin.X *= ls.ScaleX;
                bbox.vMin.Y *= ls.ScaleY;
                bbox.vMin.Z *= ls.ScaleZ;
                bbox.vMax.X *= ls.ScaleX;
                bbox.vMax.Y *= ls.ScaleY;
                bbox.vMax.Z *= ls.ScaleZ;

                // Nav Mesh Generation Settings
                EngineNavMesh.m_maxWalkableSlope = ls.MaxWalkableSlope / 180.0f * 3.14159f;

                // Nav Mesh Edge Matching Settings
                EngineNavMesh.m_maxStepHeight             = ls.MaxStepHeight;
                EngineNavMesh.m_maxSeparation             = ls.MaxSeparation;
                EngineNavMesh.m_maxOverhang               = ls.MaxOverhang;
                EngineNavMesh.m_cosPlanarAlignmentAngle   = (float)Math.Cos(ls.PlanarAlignmentAngle / 180.0f * 3.14159f);
                EngineNavMesh.m_cosVerticalAlignmentAngle = (float)Math.Cos(ls.VerticalAlignmentAngle / 180.0f * 3.14159f);
                EngineNavMesh.m_minEdgeOverlap            = ls.MinEdgeOverlap;

                // Nav Mesh Simplification Settings
                EngineNavMesh.m_maxBorderSimplifyArea        = ls.MaxBorderSimplifyArea;
                EngineNavMesh.m_maxConcaveBorderSimplifyArea = ls.MaxConcaveBorderSimplifyArea;
                EngineNavMesh.m_useHeightPartitioning        = ls.UseHeightPartitioning;
                EngineNavMesh.m_maxPartitionHeightError      = ls.MaxPartitionHeightError;

                // Nav Mesh Simplification Settings (Advanced)
                EngineNavMesh.m_minCorridorWidth                  = ls.MinCorridorWidth;
                EngineNavMesh.m_maxCorridorWidth                  = ls.MaxCorridorWidth;
                EngineNavMesh.m_holeReplacementArea               = ls.HoleReplacementArea;
                EngineNavMesh.m_maxLoopShrinkFraction             = ls.MaxLoopShrinkFraction;
                EngineNavMesh.m_maxBorderHeightError              = ls.MaxBorderHeightError;
                EngineNavMesh.m_maxBorderDistanceError            = ls.MaxBorderDistanceError;
                EngineNavMesh.m_maxPartitionSize                  = ls.MaxPartitionSize;
                EngineNavMesh.m_useConservativeHeightPartitioning = ls.UseConservativeHeightPartitioning;
                EngineNavMesh.m_hertelMehlhornHeightError         = ls.HertelMehlhornHeightError;
                EngineNavMesh.m_cosPlanarityThreshold             = (float)Math.Cos(ls.PlanarityThreshold / 180 * 3.14159f);
                EngineNavMesh.m_nonconvexityThreshold             = ls.NonconvexityThreshold;
                EngineNavMesh.m_boundaryEdgeFilterThreshold       = ls.BoundaryEdgeFilterThreshold;
                EngineNavMesh.m_maxSharedVertexHorizontalError    = ls.MaxSharedVertexHorizontalError;
                EngineNavMesh.m_maxSharedVertexVerticalError      = ls.MaxSharedVertexVerticalError;
                EngineNavMesh.m_maxBoundaryVertexHorizontalError  = ls.MaxBoundaryVertexHorizontalError;
                EngineNavMesh.m_maxBoundaryVertexVerticalError    = ls.MaxBoundaryVertexVerticalError;
                EngineNavMesh.m_mergeLongestEdgesFirst            = ls.MergeLongestEdgesFirst;

                EngineNavMesh.AddLocalSettings(bbox.vMin, bbox.vMax, ls.Position, ls.RotationMatrix);
            }

            // todo: figure out how to pass class instances between here and EngineNavMesh.
            // basically the settings members of EngineNavMesh are reused for transferring the local settings to
            // EngineNavMesh. this should be harmless due to the following call which will revert any changes.
            SetEngineInstanceBaseProperties();

            string fullSnapshotPath = Path.Combine(CSharpFramework.EditorManager.Scene.Project.ProjectDir, m_snapshotFilename);
            bool   ret = EngineNavMesh.BuildNavMeshFromGeometry(m_saveInputSnapshot, fullSnapshotPath);

            EngineNavMesh.ClearGeometry();
            EngineNavMesh.ClearCarvers();
            EngineNavMesh.ClearSeedPoints();
            EngineNavMesh.ClearLocalSettings();
            EngineNavMesh.ClearDecorationCapsules();
            return(ret);
        }
        void EditorManager_ProcessExternalFileDrop(object sender, ExternalFileDropArgs e)
        {
            if (!e.Data.GetDataPresent(DataFormats.FileDrop))
            return;
              if (EditorManager.Scene == null)
            return;

              string filename = ((string[])e.Data.GetData(DataFormats.FileDrop))[0];
              if (!EditorManager.Project.CheckRelative(filename))
              {
            EditorManager.ShowMessageBox("Cannot drop file \n\n" + filename + "\n\n because it is not project relative", "Cannot drop object", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            return;
              }
              filename = EditorManager.Project.MakeRelative(filename);
              string extension = Path.GetExtension(filename);
              string name = Path.GetFileNameWithoutExtension(filename);

              if (string.Compare(extension, ".model", true) == 0)
              {
            EntityShape shape = new EntityShape(name);
            shape.ModelFile = filename;
            EditorManager.ActiveView.DropObject(shape, e);
              }
              else if (string.Compare(extension, ".vmesh", true) == 0)
              {
            StaticMeshShape shape = new StaticMeshShape(name);
            shape.MeshFileName = filename;
            EditorManager.ActiveView.DropObject(shape, e);
              }
              else if (string.Compare(extension, ".prefab", true) == 0)
              {
            PrefabShape shape = new PrefabShape(name);
            shape.Filename = filename;
            EditorManager.ActiveView.DropObject(shape, e);
              }
        }