예제 #1
0
        private static void InsertClipboard(StepData stepData, int offset)
        {
            var target = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(stepData.step.serializedObject.targetObject)) as ComposableObject;

            target.InsertElement(ClipboardItem, stepData.index + offset);
            ClipboardItem = null;
        }
예제 #2
0
        protected override Rect OnAfterElementHeaderGUI(Rect rect, ComposableElement element)
        {
            var offset = 16;

            rect.x     += offset;
            rect.width -= offset;
            return(rect);
        }
예제 #3
0
        static void Copy(object data)
        {
            var stepData = data as StepData;

            if (ClipboardItem)
            {
                DestroyImmediate(ClipboardItem);
            }
            ClipboardItem      = (ComposableElement)Instantiate(stepData.step.objectReferenceValue);
            ClipboardItem.name = ClipboardItem.name.Replace("(Clone)", "");
        }
        private static void AddSubAsset(ComposableElement instance, SerializedProperty stepField, UnityEngine.Object target)
        {
            AssetDatabase.AddObjectToAsset(instance, target);

            stepField.objectReferenceValue = instance;
            stepField.serializedObject.SetIsDifferentCacheDirty();
            stepField.serializedObject.ApplyModifiedProperties();

            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(instance));
            AssetDatabase.SaveAssets();
        }
        private static void InsertClipboard(StepData stepData, int offset)
        {
            var dataArray = stepData.step.serializedObject.FindProperty(nameof(ComposableObject.Data));

            dataArray.InsertArrayElementAtIndex(stepData.index + offset);
            var property = dataArray.GetArrayElementAtIndex(stepData.index + offset);
            var target   = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(stepData.step.serializedObject.targetObject));

            AddSubAsset(ClipboardItem, property, target);
            ClipboardItem = null;
        }
예제 #6
0
        protected override Rect OnBeforeElementHeaderGUI(Rect rect, ComposableElement element, ref string title)
        {
            var job          = element as PipelineJob;
            var toggleRect   = new Rect(rect.x + 2, rect.y + 1, 14, EditorGUIUtility.singleLineHeight);
            var titleContent = new GUIContent(title);

            job.Active    = GUI.Toggle(toggleRect, job.Active, titleContent);
            toggleRect.x += 16;
            var size = GUI.skin.label.CalcSize(titleContent);

            toggleRect.width  = size.x;
            toggleRect.height = size.y;
            GUI.Label(toggleRect, title);
            title = string.Empty;

            return(rect);
        }
예제 #7
0
 protected virtual Rect OnAfterElementHeaderGUI(Rect rect, ComposableElement element) => rect;
예제 #8
0
 protected virtual Rect OnBeforeElementHeaderGUI(Rect rect, ComposableElement element, ref string title) => rect;