Пример #1
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static RotationDrawer Create(Vector3 value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            RotationDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new RotationDrawer();
            }
            result.Setup(value, typeof(Vector3), memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
Пример #2
0
        /// <inheritdoc/>
        protected override void DoBuildMembers()
        {
            if (DebugMode)
            {
                base.DoBuildMembers();
                return;
            }

            DrawerArrayPool.Resize(ref members, 3);

            bool usingLocalSpace = UsingLocalSpace;

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(memberBuildList.Count == (usingLocalSpace ? 3 : 2));
                        #endif

            var labels         = Preferences.labels;
            var firstTransform = (Transform)Target;
            members[0] = PositionDrawer.Create(usingLocalSpace ? firstTransform.localPosition : firstTransform.position, memberBuildList[0], this, labels.Position, ReadOnly);
            members[1] = RotationDrawer.Create(usingLocalSpace ? firstTransform.localEulerAngles : firstTransform.eulerAngles, memberBuildList[1], this, labels.Rotation, ReadOnly);
            var scaleMember = ScaleDrawer.Create(usingLocalSpace ? firstTransform.localScale : firstTransform.lossyScale, memberBuildList[2], this, labels.Scale, ReadOnly);
            members[2] = scaleMember;
        }