Ejemplo n.º 1
0
        protected override bool BuildColladaInstanceImpl()
        {
            // reset and repopulate the collada file
            COLLADAFile = new ColladaFile();

            COLLADAFile.Version = "1.4.1";
            AddAsset(
                System.Environment.UserName,
                "OpenSauceIDE:ColladaBuilder",
                "meter", 0.0254, Enums.ColladaUpAxisEnum.Z_UP);

            mModelDataProvider = GetDataProvider <IHalo1ModelDataProvider>();

            CreateBoneList();
            CreateMarkerList();
            CreateGeometryList();
            CreateControllerList();
            CreateNodeList();

            CreateImageList();
            CreateEffectList();
            CreateMaterialList();

            AddLibraryImages();
            AddLibraryEffects();
            AddLibraryMaterials();
            AddLibraryGeometries();
            AddLibraryControllers();
            AddLibraryVisualScenes();
            AddScene("main");

            COLLADAFile.Validate();

            return(true);
        }
		/// <summary>
		/// Validates a collada file
		/// </summary>
		/// <param name="collada_file">The file to validate</param>
		/// <returns>True if the file is valid</returns>
		public bool ValidateFile(ColladaFile collada_file)
		{
			// get the local IDs from the collada file
			localIDs.AddRange(collada_file.GetIDs());

			bool is_valid = false;
			try
			{
				collada_file.Validate();
				collada_file.ValidateLocalURIs(localIDs);

				is_valid = true;
			}
			catch (ColladaValidationException exception)
			{
				// if the collada file is not valid, add a report detailing why it is not valid
				OnErrorOccured(ColladaExceptionStrings.ValidationFailed);

				// report an error for all inner exceptions
				for (Exception except = exception; except != null; except = except.InnerException)
				{
					OnErrorOccured(except.Message);

					// if the exception was a validation exception, report the element details
					var validation_exception = except as ColladaValidationException;
					if ((validation_exception != null) && (validation_exception.ElementDetails != null))
					{
						foreach (string detail in validation_exception.ElementDetails)
							OnErrorOccured(String.Format("COLLADA_DETAIL: {0}", detail));
					}
				}
			}

			return is_valid;
		}
Ejemplo n.º 3
0
        /// <summary>
        /// Validates a collada file
        /// </summary>
        /// <param name="collada_file">The file to validate</param>
        /// <returns>True if the file is valid</returns>
        public bool ValidateFile(ColladaFile collada_file)
        {
            // get the local IDs from the collada file
            localIDs.AddRange(collada_file.GetIDs());

            bool is_valid = false;

            try
            {
                collada_file.Validate();
                collada_file.ValidateLocalURIs(localIDs);

                is_valid = true;
            }
            catch (Exception exception)
            {
                // if the collada file is not valid, add a report detailing why it is not valid
                OnErrorOccured(ColladaExceptionStrings.ValidationFailed);

                // report an error for all inner exceptions
                for (var except = exception; except != null; except = except.InnerException)
                {
                    OnErrorOccured(except.Message);

                    // if the exception was a validation exception, report the element details
                    var validation_exception = except as ColladaValidationException;
                    if ((validation_exception != null) && (validation_exception.ElementDetails != null))
                    {
                        foreach (string detail in validation_exception.ElementDetails)
                        {
                            OnErrorOccured(String.Format("COLLADA_DETAIL: {0}", detail));
                        }
                    }
                }
            }

            return(is_valid);
        }
Ejemplo n.º 4
0
		protected override bool BuildColladaInstanceImpl()
		{
			// reset and repopulate the collada file
			COLLADAFile = new ColladaFile();

			COLLADAFile.Version = "1.4.1";
			AddAsset(
				System.Environment.UserName,
				"OpenSauceIDE:ColladaBuilder",
				"meter", 0.0254, Enums.ColladaUpAxisEnum.Z_UP);

			mModelDataProvider = GetDataProvider<IHalo1ModelDataProvider>();

			CreateBoneList();
			CreateMarkerList();
			CreateGeometryList();
			CreateControllerList();
			CreateNodeList();

			CreateImageList();
			CreateEffectList();
			CreateMaterialList();

			AddLibraryImages();
			AddLibraryEffects();
			AddLibraryMaterials();
			AddLibraryGeometries();
			AddLibraryControllers();
			AddLibraryVisualScenes();
			AddScene("main");

			COLLADAFile.Validate();

			return true;
		}