Esempio n. 1
0
        private void AddAllObjectsFromDeclarations()
        {
            foreach (Definition def in D.Assets.GetAllDefs(DefinitionType.Object))
            {
                var models = GetModelsForDef(def)
                             .Where(f => !string.IsNullOrWhiteSpace(f))
                             .Where(f => f.EndsWith(".fbx", StringComparison.InvariantCultureIgnoreCase) && (!f.StartsWith("assets/", StringComparison.InvariantCultureIgnoreCase)))
                             .Select(f => f.Replace(".fbx", ".model"));

                foreach (string fbxc in models)
                {
                    string fbx = fbxc.ToLower();
                    if (m_Models.ContainsKey(fbx))
                    {
                        m_Objects.AddMulti(def.Name, m_Models[fbx]);
                        m_Models[fbx].ObjectNamesUsingThisModel.Add(def.Name);

                        if (fbxc != m_Models[fbx].NameRealCase)
                        {
                            Lint.MsgWarn("[{0}]: Case-mismatch of filenames in object {1} for model {2}.", def.DeclaringFile, def.Name, m_Models[fbx].NameRealCase);
                        }
                    }
                    else
                    {
                        Lint.MsgWarn("[{0}]: Object {1} refers to model {2} which was not found on disk", def.DeclaringFile, def.Name, fbx);
                    }
                }
            }
        }
Esempio n. 2
0
        public void AddEntity(Entity E, int level)
        {
            if (EntitiesById.ContainsKey(E.Id))
            {
                Lint.MsgErr("Duplicate id: {0}", E.Id);
                return;
            }

            EntitiesById.Add(E.Id, E);

            AllEntities.Add(E);
            EntitiesByLevel.AddMulti(level, E);
            EntitiesByName.AddMulti(E.Name, E);
            EntitiesByClass.AddMulti(E.Class, E);

            foreach (Entity e in E.Items)
            {
                AllEntities.Add(e);
                EntitiesByLevel.AddMulti(level, e);
                EntitiesByName.AddMulti(e.Name, e);
                EntitiesByClass.AddMulti(e.Class, e);
            }
        }