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); } } } }
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); } }
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); }