public override void Draw(Rect position, GUIContent label)
        {
            var instructionHeight = AssetDisplayDrawer.GetHeight(label);
            var instructionRect   = RectHelper.TakeHeight(ref position, instructionHeight);

            DrawInstruction(instructionRect, label);
            RectHelper.TakeVerticalSpace(ref position);

            using (new EditorGUI.IndentLevelScope())
            {
                if (_caller.Inputs.Count > 0)
                {
                    var inputsHeight = _inputs.GetHeight();
                    var inputsRect   = RectHelper.TakeHeight(ref position, inputsHeight);

                    _inputs.Draw(inputsRect, _inputsLabel.Content);
                }

                if (_caller.Outputs.Count > 0)
                {
                    var outputsHeight = _outputs.GetHeight();
                    var outputsRect   = RectHelper.TakeHeight(ref position, outputsHeight);

                    _outputs.Draw(outputsRect, _outputsLabel.Content);
                }
            }
        }
        private void DrawInstruction(Rect rect, GUIContent label)
        {
            var instruction = AssetDisplayDrawer.Draw(rect, label, _caller.Instruction, true, true, AssetLocation.Selectable, null);

            if (_caller.Instruction != instruction)
            {
                _caller.Instruction = instruction;
                Refresh();
            }
        }
Beispiel #3
0
        private static void DrawStoreConstraint(Rect rect, ref VariableConstraint constraint)
        {
            if (!(constraint is StoreVariableConstraint storeConstraint))
            {
                storeConstraint = new StoreVariableConstraint {
                    Schema = null
                };
                constraint = storeConstraint;
            }

            storeConstraint.Schema = AssetDisplayDrawer.Draw(rect, GUIContent.none, storeConstraint.Schema, false, false, AssetLocation.None, null);
        }
Beispiel #4
0
        private static VariableValue DrawObject(Rect rect, VariableValue value, ObjectVariableConstraint constraint)
        {
            var objectType  = constraint?.Type ?? value.ReferenceType ?? typeof(Object);
            var unityObject = value.Object;

            if (typeof(Component).IsAssignableFrom(objectType) || typeof(GameObject) == objectType || typeof(Object) == objectType)
            {
                unityObject = EditorGUI.ObjectField(rect, GUIContent.none, value.Object, objectType, true);
            }
            else
            {
                unityObject = AssetDisplayDrawer.Draw(rect, GUIContent.none, unityObject, objectType, true, true, AssetLocation.None, null);
            }

            return(VariableValue.Create(unityObject));
        }
        public override float GetHeight(GUIContent label)
        {
            var height = AssetDisplayDrawer.GetHeight(label);

            if (_caller.Inputs.Count > 0 || _caller.Outputs.Count > 0)
            {
                height += RectHelper.VerticalSpace;
            }

            if (_caller.Inputs.Count > 0)
            {
                height += _inputs.GetHeight();
            }

            if (_caller.Outputs.Count > 0)
            {
                height += _outputs.GetHeight();
            }

            return(height);
        }