Example #1
0
        /// <summary>
        /// 获取属性值
        /// </summary>
        /// <param name="suEntityRef"></param>
        /// <param name="attributeName"></param>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        public static bool GetAttribute(SUEntityRef suEntityRef, string attributeName, string propertyName, out string defaultValue)
        {
            if (suEntityRef.ptr == IntPtr.Zero)
            {
                defaultValue = null;
                return(false);
            }
            SUAttributeDictionaryRef dictionaryRef = default(SUAttributeDictionaryRef);

            if (SKPCExport.SUEntityGetAttributeDictionary(suEntityRef, attributeName, ref dictionaryRef) == SUResult.SU_ERROR_NONE)
            {
                SUTypedValueRef propertyValueRef = default(SUTypedValueRef);
                if (SKPCExport.SUAttributeDictionaryGetValue(dictionaryRef, attributeName, ref propertyValueRef) == SUResult.SU_ERROR_NONE)
                {
                    SUStringRef temp = default;
                    SKPCExport.SUStringCreate(ref temp);
                    SKPCExport.SUTypedValueGetString(propertyValueRef, ref temp);
                    defaultValue = Utilities.GetString(temp);
                    SKPCExport.SUStringRelease(ref temp);
                    return(true);
                }
            }
            defaultValue = null;
            return(false);
        }