public override void OnInspectorGUI() { if (!Initialize()) { return; } InspectorUtils.DrawDefaultScriptField(serializedObject); GUILayout.Label("Description", EditorStyles.boldLabel); EditorGUILayout.TextArea(Node.Description, EditorStyles.wordWrappedLabel); EditorGUILayout.Space(); GUILayout.Label("Settings", EditorStyles.boldLabel); InspectorUtils.DrawDefaultInspectorWithoutScriptField(serializedObject); EditorGUILayout.Space(); GUILayout.Label("Parameters", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); EditorGUIUtility.labelWidth -= FieldLeftShift; var requiredParameters = Node.GetType().GetProperties().Where(p => System.Attribute.IsDefined(p, typeof(Blackboard.Required))); foreach (PropertyInfo propertyInfo in requiredParameters) { if (!propertyInfo.CanRead || !propertyInfo.CanWrite) { EditorGUILayout.HelpBox(string.Format("Property '{0}' must be both readable and writable", propertyInfo.Name), MessageType.Error); continue; } var typename = KnownType.GetDisplayedName(propertyInfo.PropertyType); if (typename == null) { EditorGUILayout.HelpBox(string.Format("Type {0} is not a known type!", propertyInfo.PropertyType), MessageType.Error); continue; } var matchingParameters = Parameters.Where(p => p.GetHoldType().Type == propertyInfo.PropertyType).ToList(); int oldIndex = -1;//Node.GetGenericParameterIndex(propertyInfo.Name, propertyInfo.PropertyType, matchingParameters); bool wasConstant = Node.IsGenericParameterConstant(propertyInfo.Name); BeginPanelBackground(wasConstant, oldIndex == -1); { GUILayout.BeginHorizontal(); { DrawLabel(propertyInfo.Name); var fieldRect = EditorGUILayout.GetControlRect(true, LockSize, SpaceEditorStyles.LightObjectField); var lockRect = new Rect(fieldRect.x + fieldRect.width - LockSize, fieldRect.y + 2, LockSize, fieldRect.height); bool isConstant = EditorGUI.Toggle(lockRect, wasConstant, SpaceEditorStyles.LockButton); fieldRect.width -= LockSize; if (isConstant) { // Variant parameter = wasConstant // ? Node.ParametrizedProperties[propertyInfo.Name].Parameter // : new Variant(propertyInfo.PropertyType); // // VariantUtils.DrawParameter(fieldRect, parameter, false); // // Node.SetRequiredParameter(propertyInfo.Name, parameter, true); } else { fieldRect.y += 2; /*var paramListContent = BuildParameterGUIList(typename, matchingParameters); * int newIndex = EditorGUI.Popup(fieldRect, GUIContent.none, oldIndex + 1, paramListContent.ToArray(), SpaceEditorStyles.LightObjectField); * * if (!Editor.ExecuteInRuntime() && (oldIndex != (newIndex - 1) || (isConstant != wasConstant))) * { * ProcessSelectionResult(newIndex, propertyInfo, matchingParameters); * }*/ } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }