bdunderscore / ndmf

MIT License
72 stars 22 forks source link

Drag and drop of materials onto scene objects breaks when replaced by proxy renderers #444

Open bdunderscore opened 5 days ago

bdunderscore commented 5 days ago

Root cause: We need to hook HandleUtility.PickGameObject

bdunderscore commented 5 days ago

PickRectObjects also needs to be hooked.

When hooking, consider:

Sayamame-beans commented 5 days ago

マテリアルのD&D周りにはUnityのバグがあるっぽいので若干注意が必要かもしれません?

↓ D&Dが死ぬ時の例外

InvalidOperationException: Cannot revert overriden properties in Animation Mode.
UnityEditor.PrefabUtility.WarnIfInAnimationMode (UnityEditor.PrefabUtility+OverrideOperation overrideOperation, UnityEditor.InteractionMode action) (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.PrefabUtility.RevertPropertyOverride (UnityEditor.SerializedProperty instanceProperty, UnityEditor.InteractionMode action) (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.MaterialEditor.TryRevertDragChanges () (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.MaterialEditor.ClearDragMaterialRendering () (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.MaterialEditor.HandleRenderer (UnityEngine.Renderer r, System.Int32 materialIndex, UnityEngine.Material dragMaterial, UnityEngine.EventType eventType, System.Boolean alt) (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.MaterialEditor.OnSceneDrag (UnityEditor.SceneView sceneView, System.Int32 index) (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.SceneView.CallEditorDragFunctions (System.Collections.Generic.IList`1[T] dragAndDropObjects) (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.SceneView.HandleDragging (UnityEngine.Event evt) (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.SceneView.DoOnGUI () (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEditor.SceneView.OnSceneGUI () (at <80a8ce1980c648dca8e68f0d8aa3b930>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.IMGUIContainer.ProcessEvent (UnityEngine.UIElements.EventBase evt) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.CallbackEventHandler.UnityEngine.UIElements.IEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPath (UnityEngine.UIElements.EventBase evt) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <332857d8803a4878904bcf8f9581ec33>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <74d6aaa3aedf4a279751914e170fef65>:0)