コード例 #1
0
        public TRModelDefinition CreateModelDefinition(TR2Entities modelEntity)
        {
            Definition = new TRModelDefinition
            {
                Alias = modelEntity
            };

            if (_entityAliases.ContainsKey(modelEntity))
            {
                modelEntity = _entityAliases[modelEntity];
            }
            _modelHandler.ModelEntity = modelEntity;

            _textureHandler.ExportIndividualSegments = ExportIndividualSegments;
            _textureHandler.SegmentsFolder           = _segmentsFolder;
            _textureHandler.TextureClassifier        = TextureClassifier;

            _modelHandler.Export();
            _meshHandler.Export();
            _colourHandler.Export();
            _textureHandler.Export();
            _animationHandler.Export();
            _cinematicHandler.Export();
            _soundHandler.Export();

            ExportDependencies();

            return(_definition);
        }
コード例 #2
0
ファイル: TRModelImporter.cs プロジェクト: lahm86/TR2-Rando
        private void BuildDefinitionList(List <TRModelDefinition> standardModelDefinitions, List <TRModelDefinition> soundModelDefinitions, List <TR2Entities> modelEntities, TR2Entities nextEntity, bool isDependency)
        {
            if (modelEntities.Contains(nextEntity))
            {
                // If the model already in the list is a dependency only, but the new one to add isn't, switch it
                TRModelDefinition definition = standardModelDefinitions.Find(m => m.Alias == nextEntity);
                if (definition != null && definition.IsDependencyOnly && !isDependency)
                {
                    definition.IsDependencyOnly = false;
                }
                return;
            }

            TRModelDefinition nextDefinition = LoadDefinition(nextEntity);

            nextDefinition.IsDependencyOnly = isDependency;
            modelEntities.Add(nextEntity);

            // Add dependencies first
            foreach (TR2Entities dependency in nextDefinition.Dependencies)
            {
                // If it's a non-graphics dependency, but we are importing another alias
                // for it, or the level already contains the dependency, we don't need it.
                bool        nonGraphics = _noGraphicsEntityDependencies.Contains(dependency);
                TR2Entities aliasFor    = TR2EntityUtilities.TranslateEntityAlias(dependency);
                if (aliasFor != dependency && nonGraphics)
                {
                    bool required = true;
                    // #139 check entire model list for instances where alias and dependencies cause clashes
                    foreach (TR2Entities entity in modelEntities)
                    {
                        // If this entity and the dependency are in the same family
                        if (aliasFor == TR2EntityUtilities.TranslateEntityAlias(entity))
                        {
                            // Skip it
                            required = false;
                            break;
                        }
                    }

                    if (!required)
                    {
                        // We don't need the graphics, but do we need hardcoded sound?
                        if (_soundOnlyDependencies.Contains(dependency) && standardModelDefinitions.Find(m => m.Alias == dependency) == null)
                        {
                            soundModelDefinitions.Add(LoadDefinition(dependency));
                        }

                        continue;
                    }
                }

                BuildDefinitionList(standardModelDefinitions, soundModelDefinitions, modelEntities, dependency, nonGraphics);
            }

            standardModelDefinitions.Add(nextDefinition);
        }