Просмотрите наши продукты

Aspose.3D for .NET 19,11 Примечания к выпуску

Улучшения и изменения

 КлючСводкаКатегория
THREEDNET-575  Add .ATT поддержка импорта файлов. Новая особенность
THREEDNET-578 Поддержка экспорта файлов  Add .ATT Новая особенность
THREEDNET-577  RefactorСистема собственностиВ Aspose.3D  Улучшение
THREEDNET-583   Реализовано неподдерживаемоеТип объекта RVM   Улучшение
THREEDNET-580  FBX ИмпортИсключения  Улучшение
THREEDNET-579   Проблема с конвертирования RVM в GLTF Ошибка
THREEDNET-582   Проблема с преобразованием RVM Ошибка
THREEDNET-585   Исправлены ошибки проверки сгенерированных файлов glTF Ошибка

API изменения

Добавлен класс Aspose.ThreeD.Formats.FBXLoadOptions

Когда некоторые свойства, определенные в разделах глобальных настроек FBX, имеют аналогичную замену в Aspose.ThreeD.AssetInfo, они будут потреблены и преобразованы в собственное свойство, поэтому вы не сможете получить к ним доступ через динамическое свойство.

В Aspose.3D 19,11 вы можете использовать KeepBuildinGlobalSettings в FBXLoadOptions, чтобы отключить эту функцию и сохранить все в GlobalSettings без фильтров.

Код образца:

 //This will output all properties defined in GlobalSettings in FBX file.

Scene scene = new Scene();

var opt = new FBXLoadOptions() { KeepBuiltinGlobalSettings = true };

scene.Open(@"test.FBX", opt);

foreach (Property property in scene.RootNode.AssetInfo.Properties)

{

     Console.WriteLine(property);

}

Добавлен класс Aspose.ThreeD. Форматы. RvmFormat

Определение:

     /// <summary>

    /// The RVM Format

    /// </summary>

    public class RvmFormat : FileFormat

    {

        /// <summary>

        /// Load the attributes from specified stream

        /// </summary>

        /// <param name="scene">The scene where the attributes will be applied to</param>

        /// <param name="stream">The stream that contains the attributes</param>

        /// <param name="prefix">The prefix of the attributes that used to avoid conflict of names, default value is "rvm:"</param>

        public void LoadAttributes(Scene scene, Stream stream, string prefix = "rvm:");

        /// <summary>

        /// Load the attributes from specified file name

        /// </summary>

        /// <param name="scene">The scene where the attributes will be applied to</param>

        /// <param name="fileName">The file's name that contains the attributes</param>

        /// <param name="prefix">The prefix of the attributes that used to avoid conflict of names, default value is "rvm:"</param>

        public void LoadAttributes(Scene scene, string fileName, string prefix = "rvm:");

    }

Это позволяет пользователю вручную загружать. Att файл и прикрепить метаданные к указанному экземпляру сцены, что полезно, когда. Файл att не может быть найден Aspose.3D.

Код образца:

Добавлены члены в класс Aspose.ThreeD. Форматы. RvmLoadOptions

Добавлены члены в класс Aspose.ThreeD. Форматы. RvmSaveOptions

 /// <summary>

/// Gets or sets the prefix of which attributes that will be exported, the exported property will contains no prefix, custom properties with different prefix will not be exported, default value is 'rvm:'.

/// For example if a property is rvm:Refno=345, the exported attribute will be Refno = 345, the prefix is stripped.

/// </summary>

public string AttributePrefix { get; set; }

/// <summary>

/// Gets or sets the file name of attribute list file, exporter will generate a name based on the .rvm file name when this property is undefined, default value is null.

/// </summary>

public string AttributeListFile { get; set; }

/// <summary>

/// Gets or sets whether to export the attribute list to an external .att file, default value is false.

/// </summary>

public bool ExportAttributes { get; set; }

Код образца

 Scene scene = new Scene();

var node = scene.RootNode.CreateChildNode("Box", new Box());

node.SetProperty("rvm:Refno", "=3462123");

node.SetProperty("rvm:Description", "This is the description of the box");

//The RVM attribute's prefix is rvm:, all properties that starts with rvm: will be exported to .att file(the prefix will be removed)

var opt = new RvmSaveOptions() { AttributePrefix = "rvm:", ExportAttributes = true };

scene.Save("test.rvm", opt);

Добавлено свойство Properties к классу Aspose.ThreeD.A3DObject

 /// <summary>

/// The properties of the current object.

/// </summary>

Aspose.ThreeD.PropertyCollection Properties{ get;}

Добавлен класс Aspose.ThreeD.PropertyCollection

     /// <summary>

    /// The collection of properties

    /// </summary>

    public class PropertyCollection : IEnumerable<Property>

    {

        /// <summary>

        /// Gets the count of declared properties.

        /// </summary>

        public int Count { get; }

        /// <summary>

        /// Gets the property by index.

        /// </summary>

        /// <param name="idx">The 0-based index of the property</param>

        /// <returns></returns>

        public Property this[int idx] { get; }

        /// <summary>

        /// Finds the property.

        /// It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) 

        /// or native property(Identified by its name)

        /// </summary>

        /// <returns>The property.</returns>

        /// <param name="property">Property name.</param>

        public Property FindProperty(string property);

        /// <summary>

        /// Gets or sets the value of the property by property name.

        /// </summary>

        /// <param name="property">The name of the property</param>

        /// <returns>The property's value</returns>

        public object this[string property] {get; set; }

        /// <summary>

        /// Removes a dynamic property.

        /// </summary>

        /// <param name="property">Which property to remove</param>

        /// <returns>true if the property is successfully removed</returns>

        public bool RemoveProperty(Property property);

        /// <summary>

        /// Removes a dynamic property.

        /// </summary>

        /// <param name="property">Which property to remove</param>

        /// <returns>true if the property is successfully removed</returns>

        public bool RemoveProperty(string property);

        /// <summary>

        ///  Returns an enumerator that iterates through the collection.

        /// </summary>

        /// <returns></returns>

        public IEnumerator<Property> GetEnumerator();

    }

Код образца

Сцена сцены = новая сцена (@ "Camera.fbx");

Material material = scene.RootNode.ChildNodes[0].Material;

PropertyCollection реквизит = материал. Свойства;

// Список всех свойств с использованием foreach

Для каждого (var prop в реквизите)

            {

Console.WriteLine("{0} = {1}", prop.Name, prop.Value);

}

// Или используя порядковый номер для цикла

Для (int i = 0; i< props.Count; i++)

            {

                var prop = props[i];

                Console.WriteLine("{0} = {1}", prop.Name, prop.Value);

            }

            //Get property value by name

            var diffuse = props["Diffuse"];

            Console.WriteLine(diffuse);

            //modify property value by name

            props["Diffuse"] = new Vector3(1, 0, 1);

            //Get property instance by name

            Property pdiffuse = props.FindProperty("Diffuse");

            Console.WriteLine(pdiffuse);

            //Since Property is also inherited from A3DObject

            //It's possible to get the property of the property

            Console.WriteLine("Property flags = {0}", pdiffuse.GetProperty("flags"));

            //and some properties that only defined in FBX file:

            Console.WriteLine("Label = {0}", pdiffuse.GetProperty("label"));

            Console.WriteLine("Type Name = {0}", pdiffuse.GetProperty("typeName"));

            //so traversal on property's property is possible

            foreach(var pp in pdiffuse.Properties)

            {

                Console.WriteLine("Diffuse.{0} = {1}", pp.Name, pp.Value);

            }


 
 Русский