mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-14 17:09:31 +07:00
always dirty property test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IsoTools {
|
||||
@@ -29,6 +30,19 @@ namespace IsoTools {
|
||||
}
|
||||
}
|
||||
|
||||
void DirtyTargetPosition() {
|
||||
var position_prop = serializedObject.FindProperty("_position");
|
||||
if ( position_prop != null ) {
|
||||
var last_value = position_prop.vector3Value;
|
||||
position_prop.vector3Value = last_value + Vector3.one;
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(target);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
position_prop.vector3Value = last_value;
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(target);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
bool isAnyAlignment {
|
||||
get { return _positions.Keys.Any(p => p.isAlignment); }
|
||||
}
|
||||
@@ -154,10 +168,33 @@ namespace IsoTools {
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
DrawDefaultInspector();
|
||||
|
||||
GrabPositions();
|
||||
DirtyTargetPosition();
|
||||
|
||||
/*
|
||||
serializedObject.Update();
|
||||
|
||||
var position_prop = serializedObject.FindProperty("_position");
|
||||
EditorGUILayout.PropertyField(position_prop);
|
||||
|
||||
var size_prop = serializedObject.FindProperty("_size");
|
||||
EditorGUILayout.PropertyField(size_prop);
|
||||
|
||||
var alignment_prop = serializedObject.FindProperty("_isAlignment");
|
||||
EditorGUILayout.PropertyField(alignment_prop);
|
||||
|
||||
var show_bounds_prop = serializedObject.FindProperty("_isShowBounds");
|
||||
EditorGUILayout.PropertyField(show_bounds_prop);
|
||||
|
||||
var mode_prop = serializedObject.FindProperty("_mode");
|
||||
EditorGUILayout.PropertyField(mode_prop);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if ( GUILayout.Button("Alignment selection") ) {
|
||||
AlignmentSelection();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
} // namespace IsoTools
|
||||
@@ -192,10 +192,12 @@ namespace IsoTools {
|
||||
|
||||
public bool isAlignment {
|
||||
get { return _isAlignment; }
|
||||
set { _isAlignment = value; }
|
||||
}
|
||||
|
||||
public bool isShowBounds {
|
||||
get { return _isShowBounds; }
|
||||
set { _isShowBounds = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user