@@ -4594,11 +4594,19 @@ internal static Vector3 LinkedVector3Field(Rect position, GUIContent label, GUI
45944594 GUIContent copy = label;
45954595 Rect fullLabelRect = position;
45964596
4597- if(proportionalScaleProperty != null)
4597+ BeginChangeCheck();
4598+
4599+ if (proportionalScaleProperty != null)
4600+ {
45984601 BeginPropertyInternal(fullLabelRect, label, proportionalScaleProperty);
4602+ }
45994603
4604+ var scalePropertyId = -1;
46004605 if (property != null)
4606+ {
46014607 label = BeginPropertyInternal(position, label, property);
4608+ scalePropertyId = GUIUtility.keyboardControl;
4609+ }
46024610
46034611 SerializedProperty copiedProperty = property == null ? property : property.Copy();
46044612 var toggle = EditorStyles.toggle.CalcSize(GUIContent.none);
@@ -4627,13 +4635,26 @@ internal static Vector3 LinkedVector3Field(Rect position, GUIContent label, GUI
46274635 position.width -= toggle.x + kDefaultSpacing;
46284636 position.height = kSingleLineHeight;
46294637
4630- var newValue = LinkedVector3Field(position, value, proportionalScale, mixedValues, initialScale, ref axisModified, copiedProperty);
4638+ if (proportionalScaleProperty != null)
4639+ {
4640+ EndProperty();
4641+ }
46314642
46324643 if (property != null)
4633- EndProperty();
4644+ {
4645+ // Note: due to how both the scale + constrainScale property drawn and handled in a custom fashion, the lastcontrolId never correspond
4646+ // to the scaleProperty. Also s_PendingPropertyKeyboardHandling is nullifed by the constrainScale property.
4647+ // Make it work for now but I feel this whole system is super brittle.
4648+ // This will be hopefully fixed up when we use uitk to create these editors.
46344649
4635- if(proportionalScaleProperty != null)
4650+ var lastId = EditorGUIUtility.s_LastControlID;
4651+ EditorGUIUtility.s_LastControlID = scalePropertyId;
4652+ s_PendingPropertyKeyboardHandling = property;
46364653 EndProperty();
4654+ EditorGUIUtility.s_LastControlID = lastId;
4655+ }
4656+
4657+ var newValue = LinkedVector3Field(position, value, proportionalScale, mixedValues, initialScale, ref axisModified, copiedProperty);
46374658
46384659 return newValue;
46394660 }
@@ -4652,7 +4673,6 @@ static Vector3 LinkedVector3Field(Rect position, Vector3 value, bool proportiona
46524673 s_Vector3Floats[1] = value.y;
46534674 s_Vector3Floats[2] = value.z;
46544675 position.height = kSingleLineHeight;
4655- BeginChangeCheck();
46564676 const float kPrefixWidthOffset = 3.65f;
46574677 LockingMultiFloatFieldInternal(position, proportionalScale, mixedValues, s_XYZLabels, s_Vector3Floats, new float[] {initialScale.x, initialScale.y, initialScale.z}, property, EditorGUI.CalcPrefixLabelWidth(s_XYZLabels[0]) + kPrefixWidthOffset);
46584678 if (EndChangeCheck())
@@ -7029,6 +7049,8 @@ private static void DoPropertyFieldKeyboardHandling(SerializedProperty property)
70297049 // Copy & Paste
70307050 if (evt.commandName == EventCommandNames.Copy || evt.commandName == EventCommandNames.Paste)
70317051 {
7052+ if (evt.commandName == EventCommandNames.Paste)
7053+ GUI.changed = true;
70327054 ClipboardContextMenu.SetupPropertyCopyPaste(property, menu: null, evt: evt);
70337055 }
70347056 }
0 commit comments