Пример #1
0
        private static void ConvertNodeProperties(UserPropertyCollection properties, Ai.Node aiNode)
        {
            var stringBuilder = new StringBuilder();

            foreach (var property in properties.Values)
            {
                // Todo: Assign to 3ds max user properties
                stringBuilder.Append($"{property.ToUserPropertyString()}&cr;&lf;");
            }

            aiNode.Metadata["UDP3DSMAX"] = new Ai.Metadata.Entry(Ai.MetaDataType.String, stringBuilder.ToString());
        }
Пример #2
0
 internal UserPropertyDictionaryPropertyDescriptor(UserPropertyCollection d, string key)
     : base(key, null)
 {
     mDictionary = d;
     mKey        = key;
 }
Пример #3
0
        private void WriteNodeProperties(uint version, UserPropertyCollection properties)
        {
            WriteInt(properties.Count);

            foreach (var property in properties.Values)
            {
                WriteInt(( int )property.ValueType);
                WriteStringWithHash(version, property.Name);

                switch (property.ValueType)
                {
                case UserPropertyValueType.Int:
                    WriteInt(4);
                    WriteInt(property.GetValue <int>());
                    break;

                case UserPropertyValueType.Float:
                    WriteInt(4);
                    WriteFloat(property.GetValue <float>());
                    break;

                case UserPropertyValueType.Bool:
                    WriteInt(1);
                    WriteBool(property.GetValue <bool>());
                    break;

                case UserPropertyValueType.String:
                {
                    var value = property.GetValue <string>();
                    WriteInt(value.Length + 1);
                    WriteString(value, value.Length);
                }
                break;

                case UserPropertyValueType.ByteVector3:
                    WriteInt(3);
                    WriteByteVector3(property.GetValue <ByteVector3>());
                    break;

                case UserPropertyValueType.ByteVector4:
                    WriteInt(4);
                    WriteByteVector4(property.GetValue <ByteVector4>());
                    break;

                case UserPropertyValueType.Vector3:
                    WriteInt(12);
                    WriteVector3(property.GetValue <Vector3>());
                    break;

                case UserPropertyValueType.Vector4:
                    WriteInt(16);
                    WriteVector4(property.GetValue <Vector4>());
                    break;

                case UserPropertyValueType.ByteArray:
                {
                    var value = property.GetValue <byte[]>();
                    WriteInt(value.Length);
                    WriteBytes(value);
                }
                break;

                default:
                    throw new Exception($"Unknown node property type: {property.ValueType}");
                }
            }
        }