public override ShapeBase CreateShapeInstance()
        {
            string ShapeName = System.IO.Path.GetFileNameWithoutExtension(_ModelPath);
              if (ShapeName == string.Empty)
            ShapeName = "Model";

              EntityShape ES = new EntityShape(ShapeName);
              ES.ModelFile = _ModelPath;

              return ES;
        }
Example #2
0
        /// <summary>
        /// Called when deserializing
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected EntityShape(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _entityClass = info.GetString( "_entityClass" );
              _modelFile   = info.GetString( "_modelFile" );

              // load entity properties
              object entityProps = (object) info.GetValue( "_entityProperties", typeof(object) );
              _entityProperties = entityProps as DynamicPropertyCollection;

              // Store the old property collection data in a member variable (when loading old scene files).
              // We'll migrate the property values in the OnDeserialization when all nested properties are fully loaded.
              if (_entityProperties == null)
              {
            _oldEntityProperties = entityProps as CloneableBase;
            UpdateEntityProperties(true);
            //_entityProperties = EditorManager.EngineManager.EntityClassManager.CreateCollection(this,_entityClass);
              }

              if (SerializationHelper.HasElement(info,"_bCastStaticShadows"))
            _bCastStaticShadows = info.GetBoolean("_bCastStaticShadows");
              if (SerializationHelper.HasElement(info,"_bCastDynamicShadows"))
            _bCastDynamicShadows = info.GetBoolean("_bCastDynamicShadows");
              if (SerializationHelper.HasElement(info,"_vLightGridOfs"))
            _vLightGridOfs = (Vector3F)info.GetValue("_vLightGridOfs", typeof(Vector3F));
              if (SerializationHelper.HasElement(info,"_iVisibleBitmask"))
            _iVisibleBitmask = (FlagsInt32_e)info.GetValue("_iVisibleBitmask", typeof(FlagsInt32_e));
              if (SerializationHelper.HasElement(info,"_iLightInfluenceBitmask"))
            _iLightInfluenceBitmask = (FlagsInt32_e)info.GetValue("_iLightInfluenceBitmask", typeof(FlagsInt32_e));
            //      if (SerializationHelper.HasElement(info,"_fLightmapTiling"))
            //        _fLightmapTiling = info.GetSingle("_fLightmapTiling");
              if (SerializationHelper.HasElement(info,"_ambientColor"))
            _ambientColor = (Color)info.GetValue("_ambientColor", typeof(Color));
              if (SerializationHelper.HasElement(info, "_farClipDistance"))
            _farClipDistance = info.GetSingle("_farClipDistance");
              if (SerializationHelper.HasElement(info, "_nearClipDistance"))
            _nearClipDistance = info.GetSingle("_nearClipDistance");
              if (SerializationHelper.HasElement(info, "_renderOrderPriority"))
            _renderOrderPriority = info.GetSByte("_renderOrderPriority");
              if (SerializationHelper.HasElement(info, "_classDefTemplate"))
            _classDefTemplate = info.GetString("_classDefTemplate");
              if (SerializationHelper.HasElement(info, "_copySource"))
            _copySource = (EntityShape)info.GetValue("_copySource", typeof(EntityShape));
              if (SerializationHelper.HasElement(info, "_customMaterialSetName"))
            _customMaterialSetName = info.GetString("_customMaterialSetName");
        }
Example #3
0
 public override ShapeBase CreateShapeInstance()
 {
     EntityShape entity = new EntityShape("Entity");
       entity.Position = EditorManager.Scene.CurrentShapeSpawnPosition;
       return entity;
 }
Example #4
0
 void GetSelectionRecursive(EntityShape entity, List<BoneProxyShape> list, TreeNodeCollection nodes)
 {
     if (nodes == null)
     return;
       foreach (TreeNode node in nodes)
       {
     GetSelectionRecursive(entity, list, node.Nodes);
     if (!node.Checked)
       continue;
     if (node.Tag != null) // shapes that were previously in the list, are stored in the tag value
       list.Add((BoneProxyShape)node.Tag);
     else
     {
       entity.CreateBoneProxyShape(node.Text, false);
     }
       }
 }
Example #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="_sender"></param>
 public ShaderAssignmentEventArgs(EntityShape _sender)
 {
     MaterialProvider = _sender.MaterialProvider;
 }
Example #6
0
 void ValidateCopySource()
 {
     if (_copySource == null)
     return;
       if (!_copySource.IsAddedToScene)
     _copySource = null;
 }
        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;
              }
        }
        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);
              }
        }
        void LoadEntityShapeTestScene()
        {
            TestManager.Helpers.OpenSceneFromFile(Path.Combine(TestManager.Helpers.TestDataDir, @"EntityShapeTest\EntityShapeTest.scene"));

              _entityShape = new EntityShape("TestEntity");
              Layer layer = EditorManager.Scene.ActiveLayer;
              EditorManager.Actions.Add(AddShapeAction.CreateAddShapeAction(_entityShape, null, layer, false));
        }