Beispiel #1
0
        public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
        {
            GuiHelper.drawConfigTextureProperty(position, prop, label, editor, true);

            string n = "";

            if (prop.textureValue != null)
            {
                n = prop.textureValue.name;
            }
            if (Event.current.type == EventType.DragExited && position.Contains(ThryEditor.lastDragPosition))
            {
                string[] paths = DragAndDrop.paths;
                if (AssetDatabase.GetMainAssetTypeAtPath(paths[0]) != typeof(Texture2DArray))
                {
                    Texture2DArray tex = Converter.PathsToTexture2DArray(paths);
                    Helper.UpdateTargetsValue(prop, tex);
                    if (ThryEditor.currentlyDrawing.currentProperty.options.reference_property != null)
                    {
                        ThryEditor.ShaderProperty p;
                        ThryEditor.currentlyDrawing.propertyDictionary.TryGetValue(ThryEditor.currentlyDrawing.currentProperty.options.reference_property, out p);
                        if (p != null)
                        {
                            Helper.UpdateTargetsValue(p.materialProperty, tex.depth);
                        }
                    }
                    prop.textureValue = tex;
                }
            }
            if (ThryEditor.currentlyDrawing.firstCall)
            {
                ThryEditor.currentlyDrawing.textureArrayProperties.Add((ThryEditor.ShaderProperty)ThryEditor.currentlyDrawing.currentProperty);
            }
        }