示例#1
0
 public void HanldeDropEvent(MaterialProperty prop, ShaderProperty shaderProperty)
 {
     string[] paths = DragAndDrop.paths;
     if (AssetDatabase.GetMainAssetTypeAtPath(paths[0]) != typeof(Texture2DArray))
     {
         Texture2DArray tex = Converter.PathsToTexture2DArray(paths);
         MaterialHelper.UpdateTargetsValue(prop, tex);
         if (shaderProperty.options.reference_property != null)
         {
             ShaderProperty p;
             if (ShaderEditor.currentlyDrawing.propertyDictionary.TryGetValue(shaderProperty.options.reference_property, out p))
             {
                 MaterialHelper.UpdateFloatValue(p.materialProperty, tex.depth);
             }
         }
         prop.textureValue = tex;
     }
     else
     {
         Texture2DArray tex = AssetDatabase.LoadAssetAtPath <Texture2DArray>(paths[0]);
         prop.textureValue = tex;
         if (shaderProperty.options.reference_property != null)
         {
             ShaderProperty p;
             if (ShaderEditor.currentlyDrawing.propertyDictionary.TryGetValue(shaderProperty.options.reference_property, out p))
             {
                 MaterialHelper.UpdateFloatValue(p.materialProperty, tex.depth);
             }
         }
     }
 }
示例#2
0
        public void HanldeDropEvent(MaterialProperty prop, ShaderProperty shaderProperty)
        {
            string[]       paths = DragAndDrop.paths;
            Texture2DArray tex;

            if (AssetDatabase.GetMainAssetTypeAtPath(paths[0]) != typeof(Texture2DArray))
            {
                tex = Converter.PathsToTexture2DArray(paths);
                MaterialHelper.UpdateTargetsValue(prop, tex);
            }
            else
            {
                tex = AssetDatabase.LoadAssetAtPath <Texture2DArray>(paths[0]);
            }
            prop.textureValue = tex;
            UpdateFramesProperty(prop, shaderProperty, tex);
        }