mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 00:08:51 -05:00
initial commot
This commit is contained in:
parent
ef546df51b
commit
356b11e251
708
.editorconfig
Normal file
708
.editorconfig
Normal file
@ -0,0 +1,708 @@
|
|||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = crlf
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
insert_final_newline = false
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
# Microsoft .NET properties
|
||||||
|
csharp_indent_braces = false
|
||||||
|
csharp_indent_switch_labels = true
|
||||||
|
csharp_new_line_before_catch = true
|
||||||
|
csharp_new_line_before_else = true
|
||||||
|
csharp_new_line_before_finally = true
|
||||||
|
csharp_new_line_before_members_in_object_initializers = false
|
||||||
|
csharp_new_line_before_open_brace = all
|
||||||
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
|
csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
||||||
|
csharp_preserve_single_line_blocks = true
|
||||||
|
csharp_space_after_cast = true
|
||||||
|
csharp_space_after_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_after_comma = true
|
||||||
|
csharp_space_after_dot = false
|
||||||
|
csharp_space_after_keywords_in_control_flow_statements = true
|
||||||
|
csharp_space_after_semicolon_in_for_statement = true
|
||||||
|
csharp_space_around_binary_operators = before_and_after
|
||||||
|
csharp_space_before_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_before_comma = false
|
||||||
|
csharp_space_before_dot = false
|
||||||
|
csharp_space_before_open_square_brackets = false
|
||||||
|
csharp_space_before_semicolon_in_for_statement = false
|
||||||
|
csharp_space_between_empty_square_brackets = false
|
||||||
|
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||||
|
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||||
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_parentheses = false
|
||||||
|
csharp_space_between_square_brackets = false
|
||||||
|
csharp_style_var_elsewhere = true:suggestion
|
||||||
|
csharp_style_var_for_built_in_types = true:suggestion
|
||||||
|
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||||
|
csharp_using_directive_placement = outside_namespace:silent
|
||||||
|
dotnet_naming_rule.constants_rule.severity = warning
|
||||||
|
dotnet_naming_rule.constants_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.constants_rule.symbols = constants_symbols
|
||||||
|
dotnet_naming_rule.event_rule.severity = warning
|
||||||
|
dotnet_naming_rule.event_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.event_rule.symbols = event_symbols
|
||||||
|
dotnet_naming_rule.interfaces_rule.severity = warning
|
||||||
|
dotnet_naming_rule.interfaces_rule.style = i_upper_camel_case_style
|
||||||
|
dotnet_naming_rule.interfaces_rule.symbols = interfaces_symbols
|
||||||
|
dotnet_naming_rule.locals_rule.severity = warning
|
||||||
|
dotnet_naming_rule.locals_rule.style = lower_camel_case_style
|
||||||
|
dotnet_naming_rule.locals_rule.symbols = locals_symbols
|
||||||
|
dotnet_naming_rule.local_constants_rule.severity = warning
|
||||||
|
dotnet_naming_rule.local_constants_rule.style = lower_camel_case_style
|
||||||
|
dotnet_naming_rule.local_constants_rule.symbols = local_constants_symbols
|
||||||
|
dotnet_naming_rule.local_functions_rule.severity = warning
|
||||||
|
dotnet_naming_rule.local_functions_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.local_functions_rule.symbols = local_functions_symbols
|
||||||
|
dotnet_naming_rule.method_rule.severity = warning
|
||||||
|
dotnet_naming_rule.method_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.method_rule.symbols = method_symbols
|
||||||
|
dotnet_naming_rule.parameters_rule.severity = warning
|
||||||
|
dotnet_naming_rule.parameters_rule.style = lower_camel_case_style
|
||||||
|
dotnet_naming_rule.parameters_rule.symbols = parameters_symbols
|
||||||
|
dotnet_naming_rule.private_constants_rule.severity = warning
|
||||||
|
dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
|
||||||
|
dotnet_naming_rule.private_instance_fields_rule.severity = warning
|
||||||
|
dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style_1
|
||||||
|
dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
|
||||||
|
dotnet_naming_rule.private_static_fields_rule.severity = warning
|
||||||
|
dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style_1
|
||||||
|
dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
|
||||||
|
dotnet_naming_rule.private_static_readonly_rule.severity = warning
|
||||||
|
dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
|
||||||
|
dotnet_naming_rule.property_rule.severity = warning
|
||||||
|
dotnet_naming_rule.property_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.property_rule.symbols = property_symbols
|
||||||
|
dotnet_naming_rule.public_fields_rule.severity = warning
|
||||||
|
dotnet_naming_rule.public_fields_rule.style = lower_camel_case_style
|
||||||
|
dotnet_naming_rule.public_fields_rule.symbols = public_fields_symbols
|
||||||
|
dotnet_naming_rule.static_readonly_rule.severity = warning
|
||||||
|
dotnet_naming_rule.static_readonly_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.static_readonly_rule.symbols = static_readonly_symbols
|
||||||
|
dotnet_naming_rule.types_and_namespaces_rule.severity = warning
|
||||||
|
dotnet_naming_rule.types_and_namespaces_rule.style = upper_camel_case_style
|
||||||
|
dotnet_naming_rule.types_and_namespaces_rule.symbols = types_and_namespaces_symbols
|
||||||
|
dotnet_naming_rule.type_parameters_rule.severity = warning
|
||||||
|
dotnet_naming_rule.type_parameters_rule.style = t_upper_camel_case_style
|
||||||
|
dotnet_naming_rule.type_parameters_rule.symbols = type_parameters_symbols
|
||||||
|
dotnet_naming_style.i_upper_camel_case_style.capitalization = pascal_case
|
||||||
|
dotnet_naming_style.i_upper_camel_case_style.required_prefix = I
|
||||||
|
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
|
||||||
|
dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case
|
||||||
|
dotnet_naming_style.lower_camel_case_style_1.required_prefix = _
|
||||||
|
dotnet_naming_style.t_upper_camel_case_style.capitalization = pascal_case
|
||||||
|
dotnet_naming_style.t_upper_camel_case_style.required_prefix = T
|
||||||
|
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
|
||||||
|
dotnet_naming_symbols.constants_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
|
||||||
|
dotnet_naming_symbols.constants_symbols.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.constants_symbols.required_modifiers = const
|
||||||
|
dotnet_naming_symbols.event_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.event_symbols.applicable_kinds = event
|
||||||
|
dotnet_naming_symbols.interfaces_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.interfaces_symbols.applicable_kinds = interface
|
||||||
|
dotnet_naming_symbols.locals_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.locals_symbols.applicable_kinds = local
|
||||||
|
dotnet_naming_symbols.local_constants_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.local_constants_symbols.applicable_kinds = local
|
||||||
|
dotnet_naming_symbols.local_constants_symbols.required_modifiers = const
|
||||||
|
dotnet_naming_symbols.local_functions_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.local_functions_symbols.applicable_kinds = local_function
|
||||||
|
dotnet_naming_symbols.method_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.method_symbols.applicable_kinds = method
|
||||||
|
dotnet_naming_symbols.parameters_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.parameters_symbols.applicable_kinds = parameter
|
||||||
|
dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
|
||||||
|
dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
|
||||||
|
dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
|
||||||
|
dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
|
||||||
|
dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
|
||||||
|
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
|
||||||
|
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static,readonly
|
||||||
|
dotnet_naming_symbols.property_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.property_symbols.applicable_kinds = property
|
||||||
|
dotnet_naming_symbols.public_fields_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
|
||||||
|
dotnet_naming_symbols.public_fields_symbols.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.static_readonly_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
|
||||||
|
dotnet_naming_symbols.static_readonly_symbols.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.static_readonly_symbols.required_modifiers = static,readonly
|
||||||
|
dotnet_naming_symbols.types_and_namespaces_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.types_and_namespaces_symbols.applicable_kinds = namespace,class,struct,enum,delegate
|
||||||
|
dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
|
||||||
|
dotnet_separate_import_directive_groups = false
|
||||||
|
dotnet_sort_system_directives_first = true
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||||
|
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||||
|
dotnet_style_qualification_for_event = false:suggestion
|
||||||
|
dotnet_style_qualification_for_field = false:suggestion
|
||||||
|
dotnet_style_qualification_for_method = false:suggestion
|
||||||
|
dotnet_style_qualification_for_property = false:suggestion
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
|
||||||
|
file_header_template =
|
||||||
|
|
||||||
|
# ReSharper properties
|
||||||
|
resharper_accessor_owner_body = expression_body
|
||||||
|
resharper_alignment_tab_fill_style = use_spaces
|
||||||
|
resharper_align_first_arg_by_paren = false
|
||||||
|
resharper_align_linq_query = false
|
||||||
|
resharper_align_multiline_array_and_object_initializer = false
|
||||||
|
resharper_align_multiline_array_initializer = true
|
||||||
|
resharper_align_multiline_ctor_init = true
|
||||||
|
resharper_align_multiline_expression_braces = false
|
||||||
|
resharper_align_multiline_implements_list = true
|
||||||
|
resharper_align_multiline_property_pattern = false
|
||||||
|
resharper_align_multiline_switch_expression = false
|
||||||
|
resharper_align_multiline_type_argument = true
|
||||||
|
resharper_align_multiline_type_parameter = true
|
||||||
|
resharper_align_multline_type_parameter_constrains = false
|
||||||
|
resharper_align_multline_type_parameter_list = false
|
||||||
|
resharper_align_ternary = align_not_nested
|
||||||
|
resharper_align_tuple_components = false
|
||||||
|
resharper_allow_alias = true
|
||||||
|
resharper_allow_comment_after_lbrace = false
|
||||||
|
resharper_allow_far_alignment = false
|
||||||
|
resharper_always_use_end_of_line_brace_style = false
|
||||||
|
resharper_anonymous_method_declaration_braces = next_line
|
||||||
|
resharper_apply_auto_detected_rules = true
|
||||||
|
resharper_apply_on_completion = false
|
||||||
|
resharper_arguments_anonymous_function = positional
|
||||||
|
resharper_arguments_literal = positional
|
||||||
|
resharper_arguments_named = positional
|
||||||
|
resharper_arguments_other = positional
|
||||||
|
resharper_arguments_skip_single = false
|
||||||
|
resharper_arguments_string_literal = positional
|
||||||
|
resharper_attribute_style = do_not_touch
|
||||||
|
resharper_autodetect_indent_settings = true
|
||||||
|
resharper_blank_lines_after_block_statements = 1
|
||||||
|
resharper_blank_lines_after_case = 0
|
||||||
|
resharper_blank_lines_after_control_transfer_statements = 0
|
||||||
|
resharper_blank_lines_after_imports = 1
|
||||||
|
resharper_blank_lines_after_multiline_statements = 0
|
||||||
|
resharper_blank_lines_after_options = 1
|
||||||
|
resharper_blank_lines_after_start_comment = 1
|
||||||
|
resharper_blank_lines_after_using_list = 1
|
||||||
|
resharper_blank_lines_around_accessor = 0
|
||||||
|
resharper_blank_lines_around_auto_property = 1
|
||||||
|
resharper_blank_lines_around_block_case_section = 0
|
||||||
|
resharper_blank_lines_around_class_definition = 1
|
||||||
|
resharper_blank_lines_around_field = 1
|
||||||
|
resharper_blank_lines_around_function_declaration = 0
|
||||||
|
resharper_blank_lines_around_function_definition = 1
|
||||||
|
resharper_blank_lines_around_global_attribute = 0
|
||||||
|
resharper_blank_lines_around_invocable = 1
|
||||||
|
resharper_blank_lines_around_local_method = 1
|
||||||
|
resharper_blank_lines_around_multiline_case_section = 0
|
||||||
|
resharper_blank_lines_around_namespace = 1
|
||||||
|
resharper_blank_lines_around_other_declaration = 0
|
||||||
|
resharper_blank_lines_around_property = 1
|
||||||
|
resharper_blank_lines_around_razor_functions = 1
|
||||||
|
resharper_blank_lines_around_razor_helpers = 1
|
||||||
|
resharper_blank_lines_around_razor_sections = 1
|
||||||
|
resharper_blank_lines_around_region = 1
|
||||||
|
resharper_blank_lines_around_single_line_accessor = 0
|
||||||
|
resharper_blank_lines_around_single_line_auto_property = 0
|
||||||
|
resharper_blank_lines_around_single_line_field = 0
|
||||||
|
resharper_blank_lines_around_single_line_function_definition = 0
|
||||||
|
resharper_blank_lines_around_single_line_invocable = 0
|
||||||
|
resharper_blank_lines_around_single_line_local_method = 0
|
||||||
|
resharper_blank_lines_around_single_line_property = 0
|
||||||
|
resharper_blank_lines_around_single_line_type = 1
|
||||||
|
resharper_blank_lines_around_type = 1
|
||||||
|
resharper_blank_lines_before_block_statements = 0
|
||||||
|
resharper_blank_lines_before_case = 0
|
||||||
|
resharper_blank_lines_before_control_transfer_statements = 0
|
||||||
|
resharper_blank_lines_before_multiline_statements = 0
|
||||||
|
resharper_blank_lines_before_single_line_comment = 0
|
||||||
|
resharper_blank_lines_inside_namespace = 0
|
||||||
|
resharper_blank_lines_inside_region = 1
|
||||||
|
resharper_blank_lines_inside_type = 0
|
||||||
|
resharper_blank_line_after_pi = true
|
||||||
|
resharper_braces_for_dowhile = required
|
||||||
|
resharper_braces_for_fixed = required
|
||||||
|
resharper_braces_for_for = required
|
||||||
|
resharper_braces_for_foreach = required
|
||||||
|
resharper_braces_for_ifelse = required
|
||||||
|
resharper_braces_for_lock = required
|
||||||
|
resharper_braces_for_using = required
|
||||||
|
resharper_braces_for_while = required
|
||||||
|
resharper_braces_redundant = false
|
||||||
|
resharper_break_template_declaration = line_break
|
||||||
|
resharper_can_use_global_alias = true
|
||||||
|
resharper_constructor_or_destructor_body = block_body
|
||||||
|
resharper_continuous_indent_multiplier = 1
|
||||||
|
resharper_continuous_line_indent = single
|
||||||
|
resharper_cpp_align_multiline_argument = true
|
||||||
|
resharper_cpp_align_multiline_binary_expressions_chain = false
|
||||||
|
resharper_cpp_align_multiline_calls_chain = true
|
||||||
|
resharper_cpp_align_multiline_extends_list = true
|
||||||
|
resharper_cpp_align_multiline_for_stmt = true
|
||||||
|
resharper_cpp_align_multiline_parameter = true
|
||||||
|
resharper_cpp_align_multiple_declaration = true
|
||||||
|
resharper_cpp_case_block_braces = next_line_shifted_2
|
||||||
|
resharper_cpp_indent_switch_labels = false
|
||||||
|
resharper_cpp_max_line_length = 120
|
||||||
|
resharper_cpp_new_line_before_while = true
|
||||||
|
resharper_cpp_space_after_cast = false
|
||||||
|
resharper_cpp_space_around_binary_operator = true
|
||||||
|
resharper_cpp_wrap_lines = true
|
||||||
|
resharper_csharp_align_multiline_argument = false
|
||||||
|
resharper_csharp_align_multiline_binary_expressions_chain = true
|
||||||
|
resharper_csharp_align_multiline_calls_chain = false
|
||||||
|
resharper_csharp_align_multiline_expression = false
|
||||||
|
resharper_csharp_align_multiline_extends_list = false
|
||||||
|
resharper_csharp_align_multiline_for_stmt = false
|
||||||
|
resharper_csharp_align_multiline_parameter = false
|
||||||
|
resharper_csharp_align_multiple_declaration = false
|
||||||
|
resharper_csharp_max_line_length = 120
|
||||||
|
resharper_csharp_naming_rule.enum_member = AaBb
|
||||||
|
resharper_csharp_naming_rule.method_property_event = AaBb
|
||||||
|
resharper_csharp_naming_rule.other = AaBb
|
||||||
|
resharper_csharp_naming_rule.public_fields = aaBb, AaBb
|
||||||
|
resharper_csharp_new_line_before_while = false
|
||||||
|
resharper_csharp_prefer_qualified_reference = false
|
||||||
|
resharper_csharp_space_after_unary_operator = false
|
||||||
|
resharper_csharp_wrap_lines = true
|
||||||
|
resharper_cxxcli_property_declaration_braces = next_line
|
||||||
|
resharper_default_exception_variable_name = e
|
||||||
|
resharper_default_value_when_type_evident = default_literal
|
||||||
|
resharper_default_value_when_type_not_evident = default_literal
|
||||||
|
resharper_delete_quotes_from_solid_values = false
|
||||||
|
resharper_disable_blank_line_changes = false
|
||||||
|
resharper_disable_formatter = false
|
||||||
|
resharper_disable_indenter = false
|
||||||
|
resharper_disable_int_align = false
|
||||||
|
resharper_disable_line_break_changes = false
|
||||||
|
resharper_disable_line_break_removal = false
|
||||||
|
resharper_disable_space_changes = false
|
||||||
|
resharper_disable_space_changes_before_trailing_comment = false
|
||||||
|
resharper_dont_remove_extra_blank_lines = false
|
||||||
|
resharper_empty_block_style = multiline
|
||||||
|
resharper_enable_wrapping = false
|
||||||
|
resharper_enforce_line_ending_style = false
|
||||||
|
resharper_event_handler_pattern_long = $object$On$event$
|
||||||
|
resharper_event_handler_pattern_short = On$event$
|
||||||
|
resharper_expression_braces = inside
|
||||||
|
resharper_expression_pars = inside
|
||||||
|
resharper_extra_spaces = remove_all
|
||||||
|
resharper_force_attribute_style = separate
|
||||||
|
resharper_force_chop_compound_do_expression = false
|
||||||
|
resharper_force_chop_compound_if_expression = false
|
||||||
|
resharper_force_chop_compound_while_expression = false
|
||||||
|
resharper_format_leading_spaces_decl = false
|
||||||
|
resharper_free_block_braces = next_line
|
||||||
|
resharper_fsharp_align_function_signature_to_indentation = false
|
||||||
|
resharper_fsharp_alternative_long_member_definitions = false
|
||||||
|
resharper_fsharp_indent_on_try_with = false
|
||||||
|
resharper_fsharp_keep_if_then_in_same_line = false
|
||||||
|
resharper_fsharp_max_array_or_list_width = 40
|
||||||
|
resharper_fsharp_max_elmish_width = 40
|
||||||
|
resharper_fsharp_max_function_binding_width = 40
|
||||||
|
resharper_fsharp_max_if_then_else_short_width = 40
|
||||||
|
resharper_fsharp_max_infix_operator_expression = 50
|
||||||
|
resharper_fsharp_max_line_length = 120
|
||||||
|
resharper_fsharp_max_record_width = 40
|
||||||
|
resharper_fsharp_max_value_binding_width = 40
|
||||||
|
resharper_fsharp_multiline_block_brackets_on_same_column = false
|
||||||
|
resharper_fsharp_newline_between_type_definition_and_members = false
|
||||||
|
resharper_fsharp_semicolon_at_end_of_line = false
|
||||||
|
resharper_fsharp_single_argument_web_mode = false
|
||||||
|
resharper_fsharp_space_after_comma = true
|
||||||
|
resharper_fsharp_space_after_semicolon = true
|
||||||
|
resharper_fsharp_space_around_delimiter = true
|
||||||
|
resharper_fsharp_space_before_class_constructor = false
|
||||||
|
resharper_fsharp_space_before_colon = false
|
||||||
|
resharper_fsharp_space_before_lowercase_invocation = true
|
||||||
|
resharper_fsharp_space_before_member = false
|
||||||
|
resharper_fsharp_space_before_parameter = true
|
||||||
|
resharper_fsharp_space_before_semicolon = false
|
||||||
|
resharper_fsharp_space_before_uppercase_invocation = false
|
||||||
|
resharper_fsharp_wrap_lines = true
|
||||||
|
resharper_function_declaration_return_type_style = do_not_change
|
||||||
|
resharper_function_definition_return_type_style = do_not_change
|
||||||
|
resharper_generator_mode = false
|
||||||
|
resharper_html_attribute_indent = align_by_first_attribute
|
||||||
|
resharper_html_linebreak_before_elements = body,div,p,form,h1,h2,h3
|
||||||
|
resharper_html_max_blank_lines_between_tags = 2
|
||||||
|
resharper_html_max_line_length = 120
|
||||||
|
resharper_html_pi_attribute_style = on_single_line
|
||||||
|
resharper_html_space_before_self_closing = false
|
||||||
|
resharper_html_wrap_lines = true
|
||||||
|
resharper_ignore_space_preservation = false
|
||||||
|
resharper_include_prefix_comment_in_indent = false
|
||||||
|
resharper_indent_access_specifiers_from_class = false
|
||||||
|
resharper_indent_aligned_ternary = true
|
||||||
|
resharper_indent_anonymous_method_block = false
|
||||||
|
resharper_indent_case_from_select = true
|
||||||
|
resharper_indent_child_elements = OneIndent
|
||||||
|
resharper_indent_class_members_from_access_specifiers = false
|
||||||
|
resharper_indent_comment = true
|
||||||
|
resharper_indent_inside_namespace = true
|
||||||
|
resharper_indent_invocation_pars = inside
|
||||||
|
resharper_indent_method_decl_pars = inside
|
||||||
|
resharper_indent_nested_fixed_stmt = false
|
||||||
|
resharper_indent_nested_foreach_stmt = false
|
||||||
|
resharper_indent_nested_for_stmt = false
|
||||||
|
resharper_indent_nested_lock_stmt = false
|
||||||
|
resharper_indent_nested_usings_stmt = false
|
||||||
|
resharper_indent_nested_while_stmt = false
|
||||||
|
resharper_indent_pars = inside
|
||||||
|
resharper_indent_preprocessor_directives = normal
|
||||||
|
resharper_indent_preprocessor_if = no_indent
|
||||||
|
resharper_indent_preprocessor_other = no_indent
|
||||||
|
resharper_indent_preprocessor_region = usual_indent
|
||||||
|
resharper_indent_statement_pars = inside
|
||||||
|
resharper_indent_text = OneIndent
|
||||||
|
resharper_indent_typearg_angles = inside
|
||||||
|
resharper_indent_typeparam_angles = inside
|
||||||
|
resharper_indent_type_constraints = true
|
||||||
|
resharper_indent_wrapped_function_names = false
|
||||||
|
resharper_instance_members_qualify_declared_in = this_class, base_class
|
||||||
|
resharper_int_align = false
|
||||||
|
resharper_int_align_comments = false
|
||||||
|
resharper_int_align_declaration_names = false
|
||||||
|
resharper_int_align_eq = false
|
||||||
|
resharper_int_align_fix_in_adjacent = true
|
||||||
|
resharper_invocable_declaration_braces = next_line
|
||||||
|
resharper_keep_blank_lines_in_code = 2
|
||||||
|
resharper_keep_blank_lines_in_declarations = 2
|
||||||
|
resharper_keep_existing_attribute_arrangement = true
|
||||||
|
resharper_keep_existing_declaration_block_arrangement = false
|
||||||
|
resharper_keep_existing_declaration_parens_arrangement = true
|
||||||
|
resharper_keep_existing_embedded_arrangement = true
|
||||||
|
resharper_keep_existing_embedded_block_arrangement = false
|
||||||
|
resharper_keep_existing_enum_arrangement = false
|
||||||
|
resharper_keep_existing_expr_member_arrangement = true
|
||||||
|
resharper_keep_existing_invocation_parens_arrangement = true
|
||||||
|
resharper_keep_existing_property_patterns_arrangement = true
|
||||||
|
resharper_keep_existing_switch_expression_arrangement = true
|
||||||
|
resharper_keep_nontrivial_alias = true
|
||||||
|
resharper_keep_user_linebreaks = true
|
||||||
|
resharper_keep_user_wrapping = true
|
||||||
|
resharper_linebreaks_around_razor_statements = true
|
||||||
|
resharper_linebreaks_inside_tags_for_elements_longer_than = 2147483647
|
||||||
|
resharper_linebreaks_inside_tags_for_elements_with_child_elements = true
|
||||||
|
resharper_linebreaks_inside_tags_for_multiline_elements = true
|
||||||
|
resharper_linebreak_before_all_elements = false
|
||||||
|
resharper_linebreak_before_multiline_elements = true
|
||||||
|
resharper_linebreak_before_singleline_elements = false
|
||||||
|
resharper_line_break_after_colon_in_member_initializer_lists = do_not_change
|
||||||
|
resharper_line_break_after_comma_in_member_initializer_lists = false
|
||||||
|
resharper_line_break_before_comma_in_member_initializer_lists = false
|
||||||
|
resharper_linkage_specification_braces = end_of_line
|
||||||
|
resharper_linkage_specification_indentation = none
|
||||||
|
resharper_local_function_body = block_body
|
||||||
|
resharper_max_array_initializer_elements_on_line = 10000
|
||||||
|
resharper_max_attribute_length_for_same_line = 38
|
||||||
|
resharper_max_enum_members_on_line = 3
|
||||||
|
resharper_max_formal_parameters_on_line = 10000
|
||||||
|
resharper_max_initializer_elements_on_line = 4
|
||||||
|
resharper_max_invocation_arguments_on_line = 10000
|
||||||
|
resharper_member_initializer_list_style = do_not_change
|
||||||
|
resharper_method_or_operator_body = block_body
|
||||||
|
resharper_namespace_declaration_braces = next_line
|
||||||
|
resharper_namespace_indentation = all
|
||||||
|
resharper_nested_ternary_style = autodetect
|
||||||
|
resharper_never_outdent_pipe_operators = true
|
||||||
|
resharper_new_line_before_catch = true
|
||||||
|
resharper_new_line_before_else = true
|
||||||
|
resharper_new_line_before_enumerators = true
|
||||||
|
resharper_normalize_tag_names = false
|
||||||
|
resharper_no_indent_inside_elements = html,body,thead,tbody,tfoot
|
||||||
|
resharper_no_indent_inside_if_element_longer_than = 200
|
||||||
|
resharper_object_creation_when_type_evident = target_typed
|
||||||
|
resharper_object_creation_when_type_not_evident = explicitly_typed
|
||||||
|
resharper_old_engine = false
|
||||||
|
resharper_other_braces = next_line
|
||||||
|
resharper_outdent_binary_operators = true
|
||||||
|
resharper_outdent_binary_ops = false
|
||||||
|
resharper_outdent_commas = false
|
||||||
|
resharper_outdent_dots = false
|
||||||
|
resharper_outdent_namespace_member = false
|
||||||
|
resharper_outdent_ternary_ops = false
|
||||||
|
resharper_parentheses_non_obvious_operations = none, bitwise, bitwise_inclusive_or, bitwise_exclusive_or, shift, bitwise_and
|
||||||
|
resharper_parentheses_redundancy_style = remove_if_not_clarifies_precedence
|
||||||
|
resharper_pi_attributes_indent = align_by_first_attribute
|
||||||
|
resharper_place_attribute_on_same_line = true
|
||||||
|
resharper_place_comments_at_first_column = false
|
||||||
|
resharper_place_constructor_initializer_on_same_line = true
|
||||||
|
resharper_place_event_attribute_on_same_line = false
|
||||||
|
resharper_place_expr_accessor_on_single_line = if_owner_is_single_line
|
||||||
|
resharper_place_expr_method_on_single_line = if_owner_is_single_line
|
||||||
|
resharper_place_expr_property_on_single_line = if_owner_is_single_line
|
||||||
|
resharper_place_linq_into_on_new_line = true
|
||||||
|
resharper_place_namespace_definitions_on_same_line = false
|
||||||
|
resharper_place_property_attribute_on_same_line = false
|
||||||
|
resharper_place_simple_case_statement_on_same_line = false
|
||||||
|
resharper_place_simple_embedded_statement_on_same_line = if_owner_is_single_line
|
||||||
|
resharper_place_simple_initializer_on_single_line = true
|
||||||
|
resharper_place_simple_property_pattern_on_single_line = true
|
||||||
|
resharper_place_simple_switch_expression_on_single_line = false
|
||||||
|
resharper_place_type_constraints_on_same_line = true
|
||||||
|
resharper_prefer_explicit_discard_declaration = false
|
||||||
|
resharper_prefer_separate_deconstructed_variables_declaration = false
|
||||||
|
resharper_preserve_spaces_inside_tags = pre,textarea
|
||||||
|
resharper_qualified_using_at_nested_scope = false
|
||||||
|
resharper_quote_style = doublequoted
|
||||||
|
resharper_razor_prefer_qualified_reference = true
|
||||||
|
resharper_remove_blank_lines_near_braces = false
|
||||||
|
resharper_remove_blank_lines_near_braces_in_code = true
|
||||||
|
resharper_remove_blank_lines_near_braces_in_declarations = true
|
||||||
|
resharper_remove_this_qualifier = true
|
||||||
|
resharper_requires_expression_braces = next_line
|
||||||
|
resharper_resx_attribute_indent = single_indent
|
||||||
|
resharper_resx_linebreak_before_elements =
|
||||||
|
resharper_resx_max_blank_lines_between_tags = 0
|
||||||
|
resharper_resx_max_line_length = 2147483647
|
||||||
|
resharper_resx_pi_attribute_style = do_not_touch
|
||||||
|
resharper_resx_space_before_self_closing = false
|
||||||
|
resharper_resx_wrap_lines = false
|
||||||
|
resharper_resx_wrap_tags_and_pi = false
|
||||||
|
resharper_resx_wrap_text = false
|
||||||
|
resharper_shaderlab_brace_style = next_line
|
||||||
|
resharper_shaderlab_max_line_length = 120
|
||||||
|
resharper_shaderlab_wrap_lines = true
|
||||||
|
resharper_show_autodetect_configure_formatting_tip = true
|
||||||
|
resharper_simple_block_style = do_not_change
|
||||||
|
resharper_simple_case_statement_style = do_not_change
|
||||||
|
resharper_simple_embedded_statement_style = do_not_change
|
||||||
|
resharper_sort_attributes = false
|
||||||
|
resharper_sort_class_selectors = false
|
||||||
|
resharper_sort_usings = true
|
||||||
|
resharper_sort_usings_lowercase_first = false
|
||||||
|
resharper_spaces_around_eq_in_attribute = false
|
||||||
|
resharper_spaces_around_eq_in_pi_attribute = false
|
||||||
|
resharper_spaces_inside_tags = false
|
||||||
|
resharper_space_after_attributes = true
|
||||||
|
resharper_space_after_attribute_target_colon = true
|
||||||
|
resharper_space_after_colon = true
|
||||||
|
resharper_space_after_colon_in_case = true
|
||||||
|
resharper_space_after_colon_in_inheritance_clause = true
|
||||||
|
resharper_space_after_comma = true
|
||||||
|
resharper_space_after_for_colon = true
|
||||||
|
resharper_space_after_keywords_in_control_flow_statements = true
|
||||||
|
resharper_space_after_last_attribute = false
|
||||||
|
resharper_space_after_last_pi_attribute = false
|
||||||
|
resharper_space_after_operator_keyword = true
|
||||||
|
resharper_space_after_ptr_in_data_member = true
|
||||||
|
resharper_space_after_ptr_in_data_members = false
|
||||||
|
resharper_space_after_ptr_in_method = true
|
||||||
|
resharper_space_after_ref_in_data_member = true
|
||||||
|
resharper_space_after_ref_in_data_members = false
|
||||||
|
resharper_space_after_ref_in_method = true
|
||||||
|
resharper_space_after_semicolon_in_for_statement = true
|
||||||
|
resharper_space_after_ternary_colon = true
|
||||||
|
resharper_space_after_ternary_quest = true
|
||||||
|
resharper_space_after_triple_slash = true
|
||||||
|
resharper_space_after_type_parameter_constraint_colon = true
|
||||||
|
resharper_space_around_additive_op = true
|
||||||
|
resharper_space_around_alias_eq = true
|
||||||
|
resharper_space_around_assignment_op = true
|
||||||
|
resharper_space_around_assignment_operator = true
|
||||||
|
resharper_space_around_deref_in_trailing_return_type = true
|
||||||
|
resharper_space_around_lambda_arrow = true
|
||||||
|
resharper_space_around_member_access_operator = false
|
||||||
|
resharper_space_around_relational_op = true
|
||||||
|
resharper_space_around_shift_op = true
|
||||||
|
resharper_space_around_stmt_colon = true
|
||||||
|
resharper_space_around_ternary_operator = true
|
||||||
|
resharper_space_before_array_rank_parentheses = false
|
||||||
|
resharper_space_before_attribute_target_colon = false
|
||||||
|
resharper_space_before_checked_parentheses = false
|
||||||
|
resharper_space_before_colon = false
|
||||||
|
resharper_space_before_colon_in_case = false
|
||||||
|
resharper_space_before_colon_in_inheritance_clause = true
|
||||||
|
resharper_space_before_comma = false
|
||||||
|
resharper_space_before_default_parentheses = false
|
||||||
|
resharper_space_before_empty_invocation_parentheses = false
|
||||||
|
resharper_space_before_empty_method_parentheses = false
|
||||||
|
resharper_space_before_for_colon = true
|
||||||
|
resharper_space_before_initializer_braces = false
|
||||||
|
resharper_space_before_invocation_parentheses = false
|
||||||
|
resharper_space_before_label_colon = false
|
||||||
|
resharper_space_before_lambda_parentheses = false
|
||||||
|
resharper_space_before_method_parentheses = false
|
||||||
|
resharper_space_before_nameof_parentheses = false
|
||||||
|
resharper_space_before_nullable_mark = false
|
||||||
|
resharper_space_before_open_square_brackets = false
|
||||||
|
resharper_space_before_pointer_asterik_declaration = false
|
||||||
|
resharper_space_before_ptr_in_abstract_decl = false
|
||||||
|
resharper_space_before_ptr_in_data_member = false
|
||||||
|
resharper_space_before_ptr_in_data_members = true
|
||||||
|
resharper_space_before_ptr_in_method = false
|
||||||
|
resharper_space_before_ref_in_abstract_decl = false
|
||||||
|
resharper_space_before_ref_in_data_member = false
|
||||||
|
resharper_space_before_ref_in_data_members = true
|
||||||
|
resharper_space_before_ref_in_method = false
|
||||||
|
resharper_space_before_semicolon = false
|
||||||
|
resharper_space_before_semicolon_in_for_statement = false
|
||||||
|
resharper_space_before_singleline_accessorholder = true
|
||||||
|
resharper_space_before_sizeof_parentheses = false
|
||||||
|
resharper_space_before_template_args = false
|
||||||
|
resharper_space_before_template_params = true
|
||||||
|
resharper_space_before_ternary_colon = true
|
||||||
|
resharper_space_before_ternary_quest = true
|
||||||
|
resharper_space_before_trailing_comment = true
|
||||||
|
resharper_space_before_typeof_parentheses = false
|
||||||
|
resharper_space_before_type_argument_angle = false
|
||||||
|
resharper_space_before_type_parameter_angle = false
|
||||||
|
resharper_space_before_type_parameter_constraint_colon = true
|
||||||
|
resharper_space_before_type_parameter_parentheses = true
|
||||||
|
resharper_space_between_accessors_in_singleline_property = true
|
||||||
|
resharper_space_between_attribute_sections = true
|
||||||
|
resharper_space_between_closing_angle_brackets_in_template_args = false
|
||||||
|
resharper_space_between_keyword_and_expression = true
|
||||||
|
resharper_space_between_keyword_and_type = true
|
||||||
|
resharper_space_between_method_call_empty_parameter_list_parentheses = false
|
||||||
|
resharper_space_between_method_call_name_and_opening_parenthesis = false
|
||||||
|
resharper_space_between_method_call_parameter_list_parentheses = false
|
||||||
|
resharper_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||||
|
resharper_space_between_method_declaration_name_and_open_parenthesis = false
|
||||||
|
resharper_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
|
resharper_space_between_parentheses_of_control_flow_statements = false
|
||||||
|
resharper_space_between_square_brackets = false
|
||||||
|
resharper_space_between_typecast_parentheses = false
|
||||||
|
resharper_space_in_singleline_accessorholder = true
|
||||||
|
resharper_space_in_singleline_anonymous_method = true
|
||||||
|
resharper_space_in_singleline_method = true
|
||||||
|
resharper_space_near_postfix_and_prefix_op = false
|
||||||
|
resharper_space_within_array_initialization_braces = false
|
||||||
|
resharper_space_within_array_rank_empty_parentheses = false
|
||||||
|
resharper_space_within_array_rank_parentheses = false
|
||||||
|
resharper_space_within_attribute_angles = false
|
||||||
|
resharper_space_within_checked_parentheses = false
|
||||||
|
resharper_space_within_default_parentheses = false
|
||||||
|
resharper_space_within_empty_braces = true
|
||||||
|
resharper_space_within_empty_initializer_braces = false
|
||||||
|
resharper_space_within_empty_invocation_parentheses = false
|
||||||
|
resharper_space_within_empty_method_parentheses = false
|
||||||
|
resharper_space_within_empty_template_params = false
|
||||||
|
resharper_space_within_expression_parentheses = false
|
||||||
|
resharper_space_within_initializer_braces = false
|
||||||
|
resharper_space_within_invocation_parentheses = false
|
||||||
|
resharper_space_within_method_parentheses = false
|
||||||
|
resharper_space_within_nameof_parentheses = false
|
||||||
|
resharper_space_within_parentheses = false
|
||||||
|
resharper_space_within_single_line_array_initializer_braces = false
|
||||||
|
resharper_space_within_sizeof_parentheses = false
|
||||||
|
resharper_space_within_template_args = false
|
||||||
|
resharper_space_within_template_params = false
|
||||||
|
resharper_space_within_tuple_parentheses = false
|
||||||
|
resharper_space_within_typeof_parentheses = false
|
||||||
|
resharper_space_within_type_argument_angles = false
|
||||||
|
resharper_space_within_type_parameter_angles = false
|
||||||
|
resharper_space_within_type_parameter_parentheses = false
|
||||||
|
resharper_special_else_if_treatment = true
|
||||||
|
resharper_static_members_qualify_members = none
|
||||||
|
resharper_static_members_qualify_with = declared_type
|
||||||
|
resharper_stick_comment = true
|
||||||
|
resharper_support_vs_event_naming_pattern = true
|
||||||
|
resharper_toplevel_function_declaration_return_type_style = do_not_change
|
||||||
|
resharper_toplevel_function_definition_return_type_style = do_not_change
|
||||||
|
resharper_trailing_comma_in_multiline_lists = true
|
||||||
|
resharper_trailing_comma_in_singleline_lists = true
|
||||||
|
resharper_type_declaration_braces = next_line
|
||||||
|
resharper_use_continuous_indent_inside_initializer_braces = true
|
||||||
|
resharper_use_continuous_indent_inside_parens = true
|
||||||
|
resharper_use_continuous_line_indent_in_expression_braces = false
|
||||||
|
resharper_use_continuous_line_indent_in_method_pars = false
|
||||||
|
resharper_use_heuristics_for_body_style = true
|
||||||
|
resharper_use_indents_from_main_language_in_file = true
|
||||||
|
resharper_use_indent_from_previous_element = true
|
||||||
|
resharper_use_indent_from_vs = false
|
||||||
|
resharper_use_roslyn_logic_for_evident_types = false
|
||||||
|
resharper_vb_align_multiline_argument = true
|
||||||
|
resharper_vb_align_multiline_expression = true
|
||||||
|
resharper_vb_align_multiline_parameter = true
|
||||||
|
resharper_vb_align_multiple_declaration = true
|
||||||
|
resharper_vb_max_line_length = 120
|
||||||
|
resharper_vb_place_field_attribute_on_same_line = true
|
||||||
|
resharper_vb_place_method_attribute_on_same_line = false
|
||||||
|
resharper_vb_place_type_attribute_on_same_line = false
|
||||||
|
resharper_vb_prefer_qualified_reference = false
|
||||||
|
resharper_vb_space_after_unary_operator = true
|
||||||
|
resharper_vb_space_around_multiplicative_op = false
|
||||||
|
resharper_vb_wrap_lines = true
|
||||||
|
resharper_wrap_after_binary_opsign = true
|
||||||
|
resharper_wrap_after_declaration_lpar = false
|
||||||
|
resharper_wrap_after_dot = false
|
||||||
|
resharper_wrap_after_dot_in_method_calls = false
|
||||||
|
resharper_wrap_after_expression_lbrace = true
|
||||||
|
resharper_wrap_after_invocation_lpar = false
|
||||||
|
resharper_wrap_arguments_style = wrap_if_long
|
||||||
|
resharper_wrap_around_elements = true
|
||||||
|
resharper_wrap_array_initializer_style = wrap_if_long
|
||||||
|
resharper_wrap_base_clause_style = wrap_if_long
|
||||||
|
resharper_wrap_before_arrow_with_expressions = false
|
||||||
|
resharper_wrap_before_binary_opsign = false
|
||||||
|
resharper_wrap_before_colon = false
|
||||||
|
resharper_wrap_before_comma = false
|
||||||
|
resharper_wrap_before_comma_in_base_clause = false
|
||||||
|
resharper_wrap_before_declaration_lpar = false
|
||||||
|
resharper_wrap_before_declaration_rpar = false
|
||||||
|
resharper_wrap_before_expression_rbrace = true
|
||||||
|
resharper_wrap_before_extends_colon = false
|
||||||
|
resharper_wrap_before_first_type_parameter_constraint = false
|
||||||
|
resharper_wrap_before_invocation_lpar = false
|
||||||
|
resharper_wrap_before_invocation_rpar = false
|
||||||
|
resharper_wrap_before_linq_expression = false
|
||||||
|
resharper_wrap_before_ternary_opsigns = true
|
||||||
|
resharper_wrap_before_type_parameter_langle = false
|
||||||
|
resharper_wrap_braced_init_list_style = wrap_if_long
|
||||||
|
resharper_wrap_chained_binary_expressions = wrap_if_long
|
||||||
|
resharper_wrap_chained_method_calls = wrap_if_long
|
||||||
|
resharper_wrap_ctor_initializer_style = wrap_if_long
|
||||||
|
resharper_wrap_enumeration_style = chop_if_long
|
||||||
|
resharper_wrap_enum_declaration = chop_always
|
||||||
|
resharper_wrap_extends_list_style = wrap_if_long
|
||||||
|
resharper_wrap_for_stmt_header_style = chop_if_long
|
||||||
|
resharper_wrap_multiple_declaration_style = chop_if_long
|
||||||
|
resharper_wrap_multiple_type_parameter_constraints_style = chop_if_long
|
||||||
|
resharper_wrap_object_and_collection_initializer_style = chop_if_long
|
||||||
|
resharper_wrap_parameters_style = wrap_if_long
|
||||||
|
resharper_wrap_property_pattern = chop_if_long
|
||||||
|
resharper_wrap_switch_expression = chop_always
|
||||||
|
resharper_wrap_ternary_expr_style = chop_if_long
|
||||||
|
resharper_wrap_verbatim_interpolated_strings = no_wrap
|
||||||
|
resharper_xmldoc_attribute_indent = single_indent
|
||||||
|
resharper_xmldoc_linebreak_before_elements = summary,remarks,example,returns,param,typeparam,value,para
|
||||||
|
resharper_xmldoc_max_blank_lines_between_tags = 0
|
||||||
|
resharper_xmldoc_max_line_length = 120
|
||||||
|
resharper_xmldoc_pi_attribute_style = do_not_touch
|
||||||
|
resharper_xmldoc_space_before_self_closing = true
|
||||||
|
resharper_xmldoc_wrap_lines = true
|
||||||
|
resharper_xmldoc_wrap_tags_and_pi = true
|
||||||
|
resharper_xmldoc_wrap_text = true
|
||||||
|
resharper_xml_attribute_indent = align_by_first_attribute
|
||||||
|
resharper_xml_linebreak_before_elements =
|
||||||
|
resharper_xml_max_blank_lines_between_tags = 2
|
||||||
|
resharper_xml_max_line_length = 120
|
||||||
|
resharper_xml_pi_attribute_style = do_not_touch
|
||||||
|
resharper_xml_space_before_self_closing = true
|
||||||
|
resharper_xml_wrap_lines = true
|
||||||
|
resharper_xml_wrap_tags_and_pi = true
|
||||||
|
resharper_xml_wrap_text = false
|
||||||
|
|
||||||
|
[*.asmdef]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.{appxmanifest,asax,ascx,aspx,axaml,build,cg,cginc,compute,cs,cshtml,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,paml,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
tab_width = 4
|
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
*.*~
|
||||||
|
*.db
|
||||||
|
*.sln
|
||||||
|
*.userprefs
|
||||||
|
*.csproj
|
||||||
|
*.pidb
|
||||||
|
*.unityproj
|
||||||
|
*.apk
|
||||||
|
*.stackdump
|
||||||
|
/Library
|
||||||
|
/obj
|
||||||
|
/Temp
|
||||||
|
/Build*
|
||||||
|
/Logs/
|
||||||
|
/AssetBundles
|
||||||
|
/Logs/
|
||||||
|
.vs
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
.gradle
|
||||||
|
*_LEGACY
|
||||||
|
*.DotSettings.user
|
||||||
|
/Assets/Plugins/Editor/JetBrains*
|
||||||
|
/Assets/LEGACY*
|
||||||
|
/Assets/TextMesh Pro*
|
||||||
|
/Assets/Plugins/Sirenix*
|
8
Editor.Extras.meta
Normal file
8
Editor.Extras.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a7f4b4fc58f88d3459559029b269259e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
3
Editor.Extras/Drawers.meta
Normal file
3
Editor.Extras/Drawers.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 62b6b24478bb48c4acc0f072f2687607
|
||||||
|
timeCreated: 1639376870
|
41
Editor.Extras/Drawers/BoolDrawer.cs
Normal file
41
Editor.Extras/Drawers/BoolDrawer.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(BoolDrawer), TriDrawerOrder.Fallback)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class BoolDrawer : TriValueDrawer<bool>
|
||||||
|
{
|
||||||
|
public override TriElement CreateElement(TriValue<bool> propertyValue, TriElement next)
|
||||||
|
{
|
||||||
|
if (propertyValue.Property.TryGetSerializedProperty(out _))
|
||||||
|
{
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CreateElement(propertyValue, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width, TriValue<bool> propertyValue, TriElement next)
|
||||||
|
{
|
||||||
|
return EditorGUIUtility.singleLineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position, TriValue<bool> propertyValue, TriElement next)
|
||||||
|
{
|
||||||
|
var value = propertyValue.Value;
|
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
|
value = EditorGUI.Toggle(position, propertyValue.Property.DisplayNameContent, value);
|
||||||
|
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
propertyValue.Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/BoolDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/BoolDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e7795a3fa9734e729f1567c86c4926c5
|
||||||
|
timeCreated: 1639317854
|
41
Editor.Extras/Drawers/FloatDrawer.cs
Normal file
41
Editor.Extras/Drawers/FloatDrawer.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(FloatDrawer), TriDrawerOrder.Fallback)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class FloatDrawer : TriValueDrawer<float>
|
||||||
|
{
|
||||||
|
public override TriElement CreateElement(TriValue<float> propertyValue, TriElement next)
|
||||||
|
{
|
||||||
|
if (propertyValue.Property.TryGetSerializedProperty(out _))
|
||||||
|
{
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CreateElement(propertyValue, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width, TriValue<float> propertyValue, TriElement next)
|
||||||
|
{
|
||||||
|
return EditorGUIUtility.singleLineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position, TriValue<float> propertyValue, TriElement next)
|
||||||
|
{
|
||||||
|
var value = propertyValue.Value;
|
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
|
value = EditorGUI.FloatField(position, propertyValue.Property.DisplayNameContent, value);
|
||||||
|
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
propertyValue.Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/FloatDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/FloatDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 519fae04e2154ae69d75d5f131a8678c
|
||||||
|
timeCreated: 1639384497
|
25
Editor.Extras/Drawers/GUIColorDrawer.cs
Normal file
25
Editor.Extras/Drawers/GUIColorDrawer.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(GUIColorDrawer), TriDrawerOrder.Decorator)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class GUIColorDrawer : TriAttributeDrawer<GUIColorAttribute>
|
||||||
|
{
|
||||||
|
public override void OnGUI(Rect position, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
var oldColor = GUI.color;
|
||||||
|
var newColor = new Color(Attribute.R, Attribute.G, Attribute.B, Attribute.A);
|
||||||
|
|
||||||
|
GUI.color = newColor;
|
||||||
|
GUI.contentColor = newColor;
|
||||||
|
|
||||||
|
next.OnGUI(position);
|
||||||
|
|
||||||
|
GUI.color = oldColor;
|
||||||
|
GUI.contentColor = oldColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/GUIColorDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/GUIColorDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3e34331cbcd3451cb18c9cc11c43f7b3
|
||||||
|
timeCreated: 1638943578
|
19
Editor.Extras/Drawers/IndentDrawer.cs
Normal file
19
Editor.Extras/Drawers/IndentDrawer.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(IndentDrawer), TriDrawerOrder.Decorator)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class IndentDrawer : TriAttributeDrawer<IndentAttribute>
|
||||||
|
{
|
||||||
|
public override void OnGUI(Rect position, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
TriGuiHelper.PushIndentLevel(Attribute.Indent);
|
||||||
|
next.OnGUI(position);
|
||||||
|
TriGuiHelper.PopIndentLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/IndentDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/IndentDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 53bdb27623d2437a9af368e1342d9176
|
||||||
|
timeCreated: 1638947263
|
21
Editor.Extras/Drawers/LabelWidthDrawer.cs
Normal file
21
Editor.Extras/Drawers/LabelWidthDrawer.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(LabelWidthDrawer), TriDrawerOrder.Decorator)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class LabelWidthDrawer : TriAttributeDrawer<LabelWidthAttribute>
|
||||||
|
{
|
||||||
|
public override void OnGUI(Rect position, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
var oldLabelWidth = EditorGUIUtility.labelWidth;
|
||||||
|
|
||||||
|
EditorGUIUtility.labelWidth = Attribute.Width;
|
||||||
|
next.OnGUI(position);
|
||||||
|
EditorGUIUtility.labelWidth = oldLabelWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/LabelWidthDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/LabelWidthDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d7bb028f84224ec5817b1c807ca5db86
|
||||||
|
timeCreated: 1638948103
|
29
Editor.Extras/Drawers/PropertySpaceDrawer.cs
Normal file
29
Editor.Extras/Drawers/PropertySpaceDrawer.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(PropertySpaceDrawer), TriDrawerOrder.Inspector)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class PropertySpaceDrawer : TriAttributeDrawer<PropertySpaceAttribute>
|
||||||
|
{
|
||||||
|
public override float GetHeight(float width, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
var totalSpace = Attribute.SpaceBefore + Attribute.SpaceAfter;
|
||||||
|
|
||||||
|
return next.GetHeight(width) + totalSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
var contentPosition = new Rect(position)
|
||||||
|
{
|
||||||
|
yMin = position.yMin + Attribute.SpaceBefore,
|
||||||
|
yMax = position.yMax - Attribute.SpaceAfter,
|
||||||
|
};
|
||||||
|
|
||||||
|
next.OnGUI(contentPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/PropertySpaceDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/PropertySpaceDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d703a4146e75487aa57e22f375b04c32
|
||||||
|
timeCreated: 1638942558
|
37
Editor.Extras/Drawers/ShowDrawerChainDrawer.cs
Normal file
37
Editor.Extras/Drawers/ShowDrawerChainDrawer.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using TriInspector.Elements;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(ShowDrawerChainDrawer), TriDrawerOrder.System)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class ShowDrawerChainDrawer : TriCustomDrawer
|
||||||
|
{
|
||||||
|
public override TriElement CreateElementInternal(TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
return new TriDrawerChainInfoElement(property.AllDrawers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TriDrawerChainInfoElement : TriElement
|
||||||
|
{
|
||||||
|
public TriDrawerChainInfoElement(IReadOnlyList<TriCustomDrawer> drawers)
|
||||||
|
{
|
||||||
|
var info = new StringBuilder();
|
||||||
|
|
||||||
|
info.Append("Drawer Chain:");
|
||||||
|
|
||||||
|
for (var i = 0; i < drawers.Count; i++)
|
||||||
|
{
|
||||||
|
var drawer = drawers[i];
|
||||||
|
info.AppendLine();
|
||||||
|
info.Append(i).Append(": ").Append(drawer.GetType().Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddChild(new TriInfoBoxElement(info.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/ShowDrawerChainDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/ShowDrawerChainDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d473213c669247e48e0059471d0b6d2c
|
||||||
|
timeCreated: 1639215046
|
71
Editor.Extras/Drawers/StringDrawer.cs
Normal file
71
Editor.Extras/Drawers/StringDrawer.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(StringDrawer), TriDrawerOrder.Fallback)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class StringDrawer : TriValueDrawer<string>
|
||||||
|
{
|
||||||
|
public override TriElement CreateElement(TriValue<string> value, TriElement next)
|
||||||
|
{
|
||||||
|
if (value.Property.TryGetSerializedProperty(out var serializedProperty))
|
||||||
|
{
|
||||||
|
return new StringSerializedPropertyDrawerElement(serializedProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new StringDrawerElement(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class StringDrawerElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly TriValue<string> _propertyValue;
|
||||||
|
|
||||||
|
public StringDrawerElement(TriValue<string> propertyValue)
|
||||||
|
{
|
||||||
|
_propertyValue = propertyValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return EditorGUIUtility.singleLineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
var value = _propertyValue.Value;
|
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
|
value = EditorGUI.TextField(position, _propertyValue.Property.DisplayNameContent, value);
|
||||||
|
|
||||||
|
if (EditorGUI.EndChangeCheck())
|
||||||
|
{
|
||||||
|
_propertyValue.Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class StringSerializedPropertyDrawerElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly SerializedProperty _serializedProperty;
|
||||||
|
|
||||||
|
public StringSerializedPropertyDrawerElement(SerializedProperty serializedProperty)
|
||||||
|
{
|
||||||
|
_serializedProperty = serializedProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return EditorGUIUtility.singleLineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
EditorGUI.PropertyField(position, _serializedProperty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/StringDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/StringDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6e5a2105103347338b704022e9a860d4
|
||||||
|
timeCreated: 1639316821
|
53
Editor.Extras/Drawers/TitleDrawer.cs
Normal file
53
Editor.Extras/Drawers/TitleDrawer.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Drawers;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriDrawer(typeof(TitleDrawer), TriDrawerOrder.Inspector)]
|
||||||
|
|
||||||
|
namespace TriInspector.Drawers
|
||||||
|
{
|
||||||
|
public class TitleDrawer : TriAttributeDrawer<TitleAttribute>
|
||||||
|
{
|
||||||
|
private const int SpaceBeforeTitle = 9;
|
||||||
|
private const int SpaceBeforeLine = 2;
|
||||||
|
private const int LineHeight = 2;
|
||||||
|
private const int SpaceBeforeContent = 3;
|
||||||
|
|
||||||
|
public override float GetHeight(float width, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
var extraHeight = SpaceBeforeTitle +
|
||||||
|
EditorGUIUtility.singleLineHeight +
|
||||||
|
SpaceBeforeLine +
|
||||||
|
LineHeight
|
||||||
|
+ SpaceBeforeContent;
|
||||||
|
|
||||||
|
return next.GetHeight(width) + extraHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
var titleRect = new Rect(position)
|
||||||
|
{
|
||||||
|
y = position.y + SpaceBeforeTitle,
|
||||||
|
height = EditorGUIUtility.singleLineHeight,
|
||||||
|
};
|
||||||
|
|
||||||
|
var lineRect = new Rect(position)
|
||||||
|
{
|
||||||
|
y = titleRect.yMax + SpaceBeforeLine,
|
||||||
|
height = LineHeight,
|
||||||
|
};
|
||||||
|
|
||||||
|
var contentRect = new Rect(position)
|
||||||
|
{
|
||||||
|
yMin = lineRect.yMax + SpaceBeforeContent,
|
||||||
|
};
|
||||||
|
|
||||||
|
GUI.Label(titleRect, Attribute.Title, EditorStyles.boldLabel);
|
||||||
|
EditorGUI.DrawRect(lineRect, Color.gray);
|
||||||
|
|
||||||
|
next.OnGUI(contentRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/Drawers/TitleDrawer.cs.meta
Normal file
3
Editor.Extras/Drawers/TitleDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2ad25a9f98e94ba1aafe184b7fed387d
|
||||||
|
timeCreated: 1638944499
|
3
Editor.Extras/GroupDrawers.meta
Normal file
3
Editor.Extras/GroupDrawers.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f1f781f159fb4215882cf59a6c4cbfa4
|
||||||
|
timeCreated: 1639417598
|
90
Editor.Extras/GroupDrawers/TriBoxGroupDrawer.cs
Normal file
90
Editor.Extras/GroupDrawers/TriBoxGroupDrawer.cs
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Elements;
|
||||||
|
using TriInspector.GroupDrawers;
|
||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriGroupDrawer(typeof(TriBoxGroupDrawer))]
|
||||||
|
|
||||||
|
namespace TriInspector.GroupDrawers
|
||||||
|
{
|
||||||
|
public class TriBoxGroupDrawer : TriGroupDrawer<DeclareBoxGroupAttribute>
|
||||||
|
{
|
||||||
|
public override TriPropertyCollectionBaseElement CreateElement(DeclareBoxGroupAttribute attribute)
|
||||||
|
{
|
||||||
|
return new TriBoxGroupElement(attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TriBoxGroupElement : TriPropertyCollectionBaseElement
|
||||||
|
{
|
||||||
|
private const float HeaderWidth = 22;
|
||||||
|
private const float InsetTop = 4;
|
||||||
|
private const float InsetBottom = 4;
|
||||||
|
private const float InsetLeft = 4;
|
||||||
|
private const float InsetRight = 4;
|
||||||
|
|
||||||
|
private readonly GUIContent _headerLabel;
|
||||||
|
|
||||||
|
public TriBoxGroupElement(DeclareBoxGroupAttribute attribute)
|
||||||
|
{
|
||||||
|
_headerLabel = attribute.Title == null
|
||||||
|
? GUIContent.none
|
||||||
|
: new GUIContent(attribute.Title);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
var height = base.GetHeight(width) + InsetTop + InsetBottom;
|
||||||
|
|
||||||
|
if (_headerLabel != GUIContent.none)
|
||||||
|
{
|
||||||
|
height += HeaderWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
var headerBgRect = new Rect(position)
|
||||||
|
{
|
||||||
|
height = _headerLabel != GUIContent.none ? HeaderWidth : 0,
|
||||||
|
};
|
||||||
|
var headerLabelRect = new Rect(headerBgRect)
|
||||||
|
{
|
||||||
|
xMin = headerBgRect.xMin + 6,
|
||||||
|
xMax = headerBgRect.xMax - 6,
|
||||||
|
yMin = headerBgRect.yMin + 2,
|
||||||
|
yMax = headerBgRect.yMax - 2,
|
||||||
|
};
|
||||||
|
var contentBgRect = new Rect(position)
|
||||||
|
{
|
||||||
|
yMin = headerBgRect.yMax,
|
||||||
|
};
|
||||||
|
var contentRect = new Rect(contentBgRect)
|
||||||
|
{
|
||||||
|
xMin = contentBgRect.xMin + InsetLeft,
|
||||||
|
xMax = contentBgRect.xMax - InsetRight,
|
||||||
|
yMin = contentBgRect.yMin + InsetTop,
|
||||||
|
yMax = contentBgRect.yMax - InsetBottom,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_headerLabel != GUIContent.none)
|
||||||
|
{
|
||||||
|
TriEditorGUI.DrawBox(headerBgRect, TriEditorStyles.HeaderBox);
|
||||||
|
EditorGUI.LabelField(headerLabelRect, _headerLabel);
|
||||||
|
TriEditorGUI.DrawBox(contentBgRect, TriEditorStyles.ContentBox);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TriEditorGUI.DrawBox(contentBgRect, TriEditorStyles.Box);
|
||||||
|
}
|
||||||
|
|
||||||
|
TriGuiHelper.PushLabelWidth(EditorGUIUtility.labelWidth - InsetLeft);
|
||||||
|
base.OnGUI(contentRect);
|
||||||
|
TriGuiHelper.PopLabelWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor.Extras/GroupDrawers/TriBoxGroupDrawer.cs.meta
Normal file
3
Editor.Extras/GroupDrawers/TriBoxGroupDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 735d0d9ee1cc4692ac11013b95983551
|
||||||
|
timeCreated: 1639417619
|
63
Editor.Extras/GroupDrawers/TriHorizontalGroupDrawer.cs
Normal file
63
Editor.Extras/GroupDrawers/TriHorizontalGroupDrawer.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using TriInspector;
|
||||||
|
using TriInspector.Elements;
|
||||||
|
using TriInspector.GroupDrawers;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[assembly: RegisterTriGroupDrawer(typeof(TriHorizontalGroupDrawer))]
|
||||||
|
|
||||||
|
namespace TriInspector.GroupDrawers
|
||||||
|
{
|
||||||
|
public class TriHorizontalGroupDrawer : TriGroupDrawer<DeclareHorizontalGroupAttribute>
|
||||||
|
{
|
||||||
|
public override TriPropertyCollectionBaseElement CreateElement(DeclareHorizontalGroupAttribute attribute)
|
||||||
|
{
|
||||||
|
return new TriBoxGroupElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TriBoxGroupElement : TriPropertyCollectionBaseElement
|
||||||
|
{
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
if (ChildrenCount == 0)
|
||||||
|
{
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
var height = 0f;
|
||||||
|
|
||||||
|
for (var i = 0; i < ChildrenCount; i++)
|
||||||
|
{
|
||||||
|
var child = GetChild(i);
|
||||||
|
var childWidth = width / ChildrenCount;
|
||||||
|
var childHeight = child.GetHeight(childWidth);
|
||||||
|
|
||||||
|
height = Mathf.Max(height, childHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
if (ChildrenCount == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var childWidth = position.width / ChildrenCount;
|
||||||
|
|
||||||
|
for (var i = 0; i < ChildrenCount; i++)
|
||||||
|
{
|
||||||
|
var child = GetChild(i);
|
||||||
|
var childRect = new Rect(position)
|
||||||
|
{
|
||||||
|
width = childWidth,
|
||||||
|
x = position.x + i * childWidth,
|
||||||
|
};
|
||||||
|
|
||||||
|
child.OnGUI(childRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 866eb8cc0f46446b8ceb1b2cb78b344c
|
||||||
|
timeCreated: 1640871674
|
19
Editor.Extras/TriInspector.Editor.Extras.asmdef
Normal file
19
Editor.Extras/TriInspector.Editor.Extras.asmdef
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "TriInspector.Editor.Extras",
|
||||||
|
"rootNamespace": "",
|
||||||
|
"references": [
|
||||||
|
"TriInspector",
|
||||||
|
"TriInspector.Editor"
|
||||||
|
],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": false,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
7
Editor.Extras/TriInspector.Editor.Extras.asmdef.meta
Normal file
7
Editor.Extras/TriInspector.Editor.Extras.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7be4600869ec09d4ca9a37d1dbfbf1a2
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Editor.meta
Normal file
8
Editor.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 992bfd855a98c4f45b7f93c37256f4ce
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
29
Editor/Attributes.cs
Normal file
29
Editor/Attributes.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public class RegisterTriDrawerAttribute : Attribute
|
||||||
|
{
|
||||||
|
public RegisterTriDrawerAttribute(Type drawerType, int order)
|
||||||
|
{
|
||||||
|
DrawerType = drawerType;
|
||||||
|
Order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type DrawerType { get; }
|
||||||
|
public int Order { get; }
|
||||||
|
public bool ApplyOnArrayElement { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public class RegisterTriGroupDrawerAttribute : Attribute
|
||||||
|
{
|
||||||
|
public RegisterTriGroupDrawerAttribute(Type drawerType)
|
||||||
|
{
|
||||||
|
DrawerType = drawerType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type DrawerType { get; }
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Attributes.cs.meta
Normal file
3
Editor/Attributes.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 83289a1468a54453b62573925bc0635a
|
||||||
|
timeCreated: 1639581370
|
3
Editor/Editors.meta
Normal file
3
Editor/Editors.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d685f31e94904c5d9319405aa8b775f9
|
||||||
|
timeCreated: 1638856449
|
13
Editor/Editors/MonoBehaviourEditor.cs
Normal file
13
Editor/Editors/MonoBehaviourEditor.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Editors
|
||||||
|
{
|
||||||
|
#if TRI_INSPECTOR
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
[CustomEditor(typeof(MonoBehaviour), true, isFallback = true)]
|
||||||
|
internal sealed class MonoBehaviourEditor : TriEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
3
Editor/Editors/MonoBehaviourEditor.cs.meta
Normal file
3
Editor/Editors/MonoBehaviourEditor.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1c8274dd1fc8462c81ee2518b617d0f4
|
||||||
|
timeCreated: 1638716636
|
13
Editor/Editors/ScriptableObjectEditor.cs
Normal file
13
Editor/Editors/ScriptableObjectEditor.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Editors
|
||||||
|
{
|
||||||
|
#if TRI_INSPECTOR
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
[CustomEditor(typeof(ScriptableObject), true, isFallback = true)]
|
||||||
|
internal sealed class ScriptableObjectEditor : TriEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
3
Editor/Editors/ScriptableObjectEditor.cs.meta
Normal file
3
Editor/Editors/ScriptableObjectEditor.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 821b3e07ed6e47bfb89586d61fcaa8fc
|
||||||
|
timeCreated: 1638716639
|
10
Editor/Editors/TriMonoBehaviourEditor.cs
Normal file
10
Editor/Editors/TriMonoBehaviourEditor.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace TriInspector.Editors
|
||||||
|
{
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
[CustomEditor(typeof(TriMonoBehaviour), true, isFallback = true)]
|
||||||
|
internal sealed class TriMonoBehaviourEditor : TriEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Editors/TriMonoBehaviourEditor.cs.meta
Normal file
3
Editor/Editors/TriMonoBehaviourEditor.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 223f94884b20464e911c7837f76dd64a
|
||||||
|
timeCreated: 1638856605
|
10
Editor/Editors/TriScriptableObjectEditor.cs
Normal file
10
Editor/Editors/TriScriptableObjectEditor.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace TriInspector.Editors
|
||||||
|
{
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
[CustomEditor(typeof(TriScriptableObject), true, isFallback = true)]
|
||||||
|
internal sealed class TriScriptableObjectEditor : TriEditor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Editors/TriScriptableObjectEditor.cs.meta
Normal file
3
Editor/Editors/TriScriptableObjectEditor.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4ed91dbccd1a4cff924be75c33af13a5
|
||||||
|
timeCreated: 1638856403
|
3
Editor/Elements.meta
Normal file
3
Editor/Elements.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 99d0fe2f9d1c4cb88cf46ba5813c091f
|
||||||
|
timeCreated: 1638772919
|
33
Editor/Elements/TriBuiltInPropertyElement.cs
Normal file
33
Editor/Elements/TriBuiltInPropertyElement.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
internal class TriBuiltInPropertyElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
private readonly PropertyHandlerProxy _propertyHandler;
|
||||||
|
private readonly SerializedProperty _serializedProperty;
|
||||||
|
|
||||||
|
public TriBuiltInPropertyElement(
|
||||||
|
TriProperty property,
|
||||||
|
SerializedProperty serializedProperty,
|
||||||
|
PropertyHandlerProxy propertyHandler)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
_serializedProperty = serializedProperty;
|
||||||
|
_propertyHandler = propertyHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return _propertyHandler.GetHeight(_serializedProperty, _property.DisplayNameContent, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
_propertyHandler.OnGUI(position, _serializedProperty, _property.DisplayNameContent, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriBuiltInPropertyElement.cs.meta
Normal file
3
Editor/Elements/TriBuiltInPropertyElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cb76597978d84d19a27f6e8596e1a4bf
|
||||||
|
timeCreated: 1638774260
|
100
Editor/Elements/TriFoldoutElement.cs
Normal file
100
Editor/Elements/TriFoldoutElement.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
internal class TriFoldoutElement : TriPropertyCollectionBaseElement
|
||||||
|
{
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
|
||||||
|
public TriFoldoutElement(TriProperty property)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
|
||||||
|
DeclareGroups(property.ValueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Update()
|
||||||
|
{
|
||||||
|
var dirty = false;
|
||||||
|
|
||||||
|
if (_property.IsExpanded)
|
||||||
|
{
|
||||||
|
dirty |= GenerateChildren();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dirty |= ClearChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
dirty |= base.Update();
|
||||||
|
|
||||||
|
return dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
var height = EditorGUIUtility.singleLineHeight;
|
||||||
|
|
||||||
|
if (!_property.IsExpanded)
|
||||||
|
{
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
height += base.GetHeight(width);
|
||||||
|
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
var headerRect = new Rect(position)
|
||||||
|
{
|
||||||
|
height = EditorGUIUtility.singleLineHeight,
|
||||||
|
};
|
||||||
|
var contentRect = new Rect(position)
|
||||||
|
{
|
||||||
|
yMin = position.yMin + headerRect.height,
|
||||||
|
};
|
||||||
|
|
||||||
|
TriEditorGUI.Foldout(headerRect, _property);
|
||||||
|
|
||||||
|
if (!_property.IsExpanded)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TriGuiHelper.PushIndentLevel();
|
||||||
|
base.OnGUI(contentRect);
|
||||||
|
TriGuiHelper.PopIndentLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool GenerateChildren()
|
||||||
|
{
|
||||||
|
if (ChildrenCount != 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var childProperty in _property.ChildrenProperties)
|
||||||
|
{
|
||||||
|
AddProperty(childProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ClearChildren()
|
||||||
|
{
|
||||||
|
if (ChildrenCount == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveAllChildren();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriFoldoutElement.cs.meta
Normal file
3
Editor/Elements/TriFoldoutElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 90b64b1805694cf8999a0380d4ca70b6
|
||||||
|
timeCreated: 1638772042
|
45
Editor/Elements/TriInfoBoxElement.cs
Normal file
45
Editor/Elements/TriInfoBoxElement.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
public class TriInfoBoxElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly GUIContent _message;
|
||||||
|
private readonly Color _color;
|
||||||
|
|
||||||
|
public TriInfoBoxElement(string message, MessageType type = MessageType.None, Color? color = null)
|
||||||
|
{
|
||||||
|
_message = new GUIContent(message, EditorGUIUtilityProxy.GetHelpIcon(type));
|
||||||
|
_color = color ?? GetColor(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return EditorStyles.helpBox.CalcHeight(_message, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
TriGuiHelper.PushColor(_color);
|
||||||
|
GUI.Label(position, _message, EditorStyles.helpBox);
|
||||||
|
TriGuiHelper.PopColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Color GetColor(MessageType type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case MessageType.Error:
|
||||||
|
return Color.red;
|
||||||
|
|
||||||
|
case MessageType.Warning:
|
||||||
|
return Color.yellow;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return Color.white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriInfoBoxElement.cs.meta
Normal file
3
Editor/Elements/TriInfoBoxElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f64a66d501c34a808686c834530dd9a9
|
||||||
|
timeCreated: 1638860979
|
41
Editor/Elements/TriInlineGenericElement.cs
Normal file
41
Editor/Elements/TriInlineGenericElement.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
internal class TriInlineGenericElement : TriPropertyCollectionBaseElement
|
||||||
|
{
|
||||||
|
private readonly bool _drawPrefixLabel;
|
||||||
|
private readonly float _labelWidth;
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
|
||||||
|
public TriInlineGenericElement(TriProperty property,
|
||||||
|
bool drawPrefixLabel = false, float labelWidth = 0f)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
_drawPrefixLabel = drawPrefixLabel;
|
||||||
|
_labelWidth = labelWidth;
|
||||||
|
|
||||||
|
DeclareGroups(property.ValueType);
|
||||||
|
|
||||||
|
foreach (var childProperty in property.ChildrenProperties)
|
||||||
|
{
|
||||||
|
AddProperty(childProperty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
if (_drawPrefixLabel)
|
||||||
|
{
|
||||||
|
var controlId = GUIUtility.GetControlID(FocusType.Passive);
|
||||||
|
position = EditorGUI.PrefixLabel(position, controlId, _property.DisplayNameContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
TriGuiHelper.PushLabelWidth(_labelWidth);
|
||||||
|
base.OnGUI(position);
|
||||||
|
TriGuiHelper.PopLabelWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriInlineGenericElement.cs.meta
Normal file
3
Editor/Elements/TriInlineGenericElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a5124d0a8d93488a858723d80fe69e69
|
||||||
|
timeCreated: 1638788657
|
15
Editor/Elements/TriInspectorElement.cs
Normal file
15
Editor/Elements/TriInspectorElement.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
internal class TriInspectorElement : TriPropertyCollectionBaseElement
|
||||||
|
{
|
||||||
|
public TriInspectorElement(TriPropertyTree propertyTree)
|
||||||
|
{
|
||||||
|
DeclareGroups(propertyTree.TargetObjectType);
|
||||||
|
|
||||||
|
foreach (var childProperty in propertyTree.Properties)
|
||||||
|
{
|
||||||
|
AddProperty(childProperty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriInspectorElement.cs.meta
Normal file
3
Editor/Elements/TriInspectorElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4795377c7a0741c0a7de210cf2b3554e
|
||||||
|
timeCreated: 1638771141
|
24
Editor/Elements/TriLabelElement.cs
Normal file
24
Editor/Elements/TriLabelElement.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
public class TriLabelElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly GUIContent _label;
|
||||||
|
|
||||||
|
public TriLabelElement(string label)
|
||||||
|
{
|
||||||
|
_label = new GUIContent(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return GUI.skin.label.CalcHeight(_label, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
GUI.Label(position, _label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriLabelElement.cs.meta
Normal file
3
Editor/Elements/TriLabelElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a193f4236257483a8d5a10f0025b3d4f
|
||||||
|
timeCreated: 1638771650
|
226
Editor/Elements/TriListElement.cs
Normal file
226
Editor/Elements/TriListElement.cs
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditorInternal;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
internal class TriListElement : TriElement
|
||||||
|
{
|
||||||
|
private static readonly Action<object, Rect> ReorderableListDrawHeaderMethod;
|
||||||
|
private static readonly Action<object> ReorderableListClearCacheRecursiveMethod;
|
||||||
|
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
private readonly ReorderableList _reorderableListGui;
|
||||||
|
|
||||||
|
private float _lastContentWidth;
|
||||||
|
private bool _scheduleRemove;
|
||||||
|
|
||||||
|
static TriListElement()
|
||||||
|
{
|
||||||
|
ReorderableListDrawHeaderMethod = typeof(ReorderableList)
|
||||||
|
.CompileVoidInstanceMethod<Rect>("DoListHeader");
|
||||||
|
|
||||||
|
ReorderableListClearCacheRecursiveMethod = typeof(ReorderableList)
|
||||||
|
.CompileVoidInstanceMethod("ClearCacheRecursive");
|
||||||
|
}
|
||||||
|
|
||||||
|
public TriListElement(TriProperty property)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
|
||||||
|
if (_property.TryGetSerializedProperty(out var serializedProperty) && serializedProperty.isArray)
|
||||||
|
{
|
||||||
|
_reorderableListGui = new ReorderableList(serializedProperty.serializedObject, serializedProperty,
|
||||||
|
true, true, true, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_reorderableListGui = new ReorderableList((IList) _property.Value,
|
||||||
|
_property.ArrayElementType,
|
||||||
|
false, true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
_reorderableListGui.drawHeaderCallback = DrawHeaderCallback;
|
||||||
|
_reorderableListGui.elementHeightCallback = ElementHeightCallback;
|
||||||
|
_reorderableListGui.drawElementCallback = DrawElementCallback;
|
||||||
|
_reorderableListGui.drawElementBackgroundCallback = DrawElementBackgroundCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Update()
|
||||||
|
{
|
||||||
|
var dirty = false;
|
||||||
|
|
||||||
|
if (_property.IsExpanded)
|
||||||
|
{
|
||||||
|
dirty |= GenerateChildren();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dirty |= ClearChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
dirty |= base.Update();
|
||||||
|
|
||||||
|
if (dirty)
|
||||||
|
{
|
||||||
|
ReorderableListClearCacheRecursiveMethod(_reorderableListGui);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
if (!_property.IsExpanded)
|
||||||
|
{
|
||||||
|
return _reorderableListGui.headerHeight + 4f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastContentWidth = width;
|
||||||
|
|
||||||
|
return _reorderableListGui.GetHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
if (!_property.IsExpanded)
|
||||||
|
{
|
||||||
|
ReorderableListDrawHeaderMethod(_reorderableListGui, new Rect(position)
|
||||||
|
{
|
||||||
|
yMax = position.yMax - 4,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var labelWidthExtra = 6f + (_reorderableListGui.draggable ? 15f : 0f);
|
||||||
|
|
||||||
|
TriGuiHelper.PushLabelWidth(EditorGUIUtility.labelWidth - labelWidthExtra);
|
||||||
|
_reorderableListGui.DoList(position);
|
||||||
|
TriGuiHelper.PopLabelWidth();
|
||||||
|
|
||||||
|
if (_scheduleRemove)
|
||||||
|
{
|
||||||
|
_scheduleRemove = false;
|
||||||
|
ReorderableList.defaultBehaviours.DoRemoveButton(_reorderableListGui);
|
||||||
|
ReorderableListClearCacheRecursiveMethod(_reorderableListGui);
|
||||||
|
GUI.changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool GenerateChildren()
|
||||||
|
{
|
||||||
|
var count = _reorderableListGui.count;
|
||||||
|
|
||||||
|
if (ChildrenCount == count)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (ChildrenCount < count)
|
||||||
|
{
|
||||||
|
var property = _property.ArrayElementProperties[ChildrenCount];
|
||||||
|
AddChild(new TriPropertyElement(property, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
while (ChildrenCount > count)
|
||||||
|
{
|
||||||
|
RemoveChildAt(ChildrenCount - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ClearChildren()
|
||||||
|
{
|
||||||
|
if (ChildrenCount == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveAllChildren();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawElementBackgroundCallback(Rect rect, int index, bool isActive, bool isFocused)
|
||||||
|
{
|
||||||
|
if (index % 2 == 1)
|
||||||
|
{
|
||||||
|
TriEditorGUI.DrawBox(rect, GUI.skin.box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawHeaderCallback(Rect rect)
|
||||||
|
{
|
||||||
|
var labelRect = new Rect(rect)
|
||||||
|
{
|
||||||
|
xMin = rect.xMin + 10,
|
||||||
|
xMax = rect.xMax,
|
||||||
|
};
|
||||||
|
|
||||||
|
var arraySizeRect = new Rect(rect)
|
||||||
|
{
|
||||||
|
xMin = rect.xMax - 100,
|
||||||
|
};
|
||||||
|
|
||||||
|
TriEditorGUI.Foldout(labelRect, _property);
|
||||||
|
GUI.Label(arraySizeRect, $"{_reorderableListGui.count} items", Styles.ItemsCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
|
||||||
|
{
|
||||||
|
var contentRect = new Rect(rect)
|
||||||
|
{
|
||||||
|
xMax = rect.xMax - 28,
|
||||||
|
};
|
||||||
|
var deleteRect = new Rect(rect)
|
||||||
|
{
|
||||||
|
xMin = rect.xMax - 22,
|
||||||
|
};
|
||||||
|
|
||||||
|
GetChild(index).OnGUI(contentRect);
|
||||||
|
|
||||||
|
if (GUI.Button(deleteRect, Styles.IconToolbarMinus, Styles.RemoveItemButton))
|
||||||
|
{
|
||||||
|
_reorderableListGui.index = index;
|
||||||
|
_scheduleRemove = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float ElementHeightCallback(int index)
|
||||||
|
{
|
||||||
|
return GetChild(index).GetHeight(_lastContentWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Styles
|
||||||
|
{
|
||||||
|
public static readonly GUIStyle ItemsCount;
|
||||||
|
public static readonly GUIStyle RemoveItemButton;
|
||||||
|
|
||||||
|
public static readonly GUIContent IconToolbarMinus =
|
||||||
|
EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove selection from the list");
|
||||||
|
|
||||||
|
static Styles()
|
||||||
|
{
|
||||||
|
RemoveItemButton = new GUIStyle("RL FooterButton")
|
||||||
|
{
|
||||||
|
fixedHeight = 0f,
|
||||||
|
alignment = TextAnchor.MiddleCenter,
|
||||||
|
};
|
||||||
|
ItemsCount = new GUIStyle(GUI.skin.label)
|
||||||
|
{
|
||||||
|
alignment = TextAnchor.MiddleRight,
|
||||||
|
normal =
|
||||||
|
{
|
||||||
|
textColor = EditorGUIUtility.isProSkin
|
||||||
|
? new Color(0.6f, 0.6f, 0.6f)
|
||||||
|
: new Color(0.3f, 0.3f, 0.3f),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriListElement.cs.meta
Normal file
3
Editor/Elements/TriListElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c9ed87465ed54b039d11e455c4aa3efc
|
||||||
|
timeCreated: 1638776402
|
27
Editor/Elements/TriMultiEditNotSupportedElement.cs
Normal file
27
Editor/Elements/TriMultiEditNotSupportedElement.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
public class TriMultiEditNotSupportedElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
private readonly GUIContent _message;
|
||||||
|
|
||||||
|
public TriMultiEditNotSupportedElement(TriProperty property)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
_message = new GUIContent("Multi edit not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return EditorGUIUtility.singleLineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
EditorGUI.LabelField(position, _property.DisplayNameContent, _message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriMultiEditNotSupportedElement.cs.meta
Normal file
3
Editor/Elements/TriMultiEditNotSupportedElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 575bf0dafd7f459fb09451ec5a83c427
|
||||||
|
timeCreated: 1641382168
|
27
Editor/Elements/TriNoDrawerElement.cs
Normal file
27
Editor/Elements/TriNoDrawerElement.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
public class TriNoDrawerElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly GUIContent _message;
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
|
||||||
|
public TriNoDrawerElement(TriProperty property)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
_message = new GUIContent($"No drawer for {property.FieldType}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return EditorGUIUtility.singleLineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
EditorGUI.LabelField(position, _property.DisplayNameContent, _message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriNoDrawerElement.cs.meta
Normal file
3
Editor/Elements/TriNoDrawerElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e6cc0cc1449a4af4b8d435b87ef20378
|
||||||
|
timeCreated: 1639319113
|
110
Editor/Elements/TriPropertyCollectionBaseElement.cs
Normal file
110
Editor/Elements/TriPropertyCollectionBaseElement.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using TriInspector.Utilities;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
public abstract class TriPropertyCollectionBaseElement : TriElement
|
||||||
|
{
|
||||||
|
private List<DeclareGroupBaseAttribute> _declarations = new List<DeclareGroupBaseAttribute>();
|
||||||
|
|
||||||
|
private Dictionary<string, TriPropertyCollectionBaseElement> _groups;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public void DeclareGroups([CanBeNull] Type type)
|
||||||
|
{
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var attribute in TriReflectionUtilities.GetAttributesCached(type))
|
||||||
|
{
|
||||||
|
if (attribute is DeclareGroupBaseAttribute declareAttribute)
|
||||||
|
{
|
||||||
|
_declarations.Add(declareAttribute);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public void AddProperty(TriProperty property)
|
||||||
|
{
|
||||||
|
var propertyElement = new TriPropertyElement(property);
|
||||||
|
|
||||||
|
if (property.TryGetAttribute(out GroupAttribute groupAttribute))
|
||||||
|
{
|
||||||
|
IEnumerable<string> path = groupAttribute.Path.Split('/');
|
||||||
|
|
||||||
|
var remaining = path.GetEnumerator();
|
||||||
|
if (remaining.MoveNext())
|
||||||
|
{
|
||||||
|
AddGroupedChild(propertyElement, remaining.Current, remaining.Current, remaining);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddChild(propertyElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddChild(propertyElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddGroupedChild(TriElement child, string currentPath, string currentName,
|
||||||
|
IEnumerator<string> remainingPath)
|
||||||
|
{
|
||||||
|
if (_groups == null)
|
||||||
|
{
|
||||||
|
_groups = new Dictionary<string, TriPropertyCollectionBaseElement>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var groupElement = CreateSubGroup(currentPath, currentName);
|
||||||
|
|
||||||
|
if (remainingPath.MoveNext())
|
||||||
|
{
|
||||||
|
var nextPath = currentPath + "/" + remainingPath.Current;
|
||||||
|
var nextName = remainingPath.Current;
|
||||||
|
|
||||||
|
groupElement.AddGroupedChild(child, nextPath, nextName, remainingPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
groupElement.AddChild(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private TriPropertyCollectionBaseElement CreateSubGroup(string groupPath, string groupName)
|
||||||
|
{
|
||||||
|
if (!_groups.TryGetValue(groupName, out var groupElement))
|
||||||
|
{
|
||||||
|
var declaration = _declarations.FirstOrDefault(it => it.Path == groupPath);
|
||||||
|
|
||||||
|
if (declaration != null)
|
||||||
|
{
|
||||||
|
groupElement = TriDrawersUtilities.TryCreateGroupElementFor(declaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupElement == null)
|
||||||
|
{
|
||||||
|
groupElement = new DefaultGroupElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
groupElement._declarations = _declarations;
|
||||||
|
|
||||||
|
_groups.Add(groupName, groupElement);
|
||||||
|
|
||||||
|
AddChild(groupElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DefaultGroupElement : TriPropertyCollectionBaseElement
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriPropertyCollectionBaseElement.cs.meta
Normal file
3
Editor/Elements/TriPropertyCollectionBaseElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1373b681c88a425c943ea5e6d149a217
|
||||||
|
timeCreated: 1639412705
|
133
Editor/Elements/TriPropertyElement.cs
Normal file
133
Editor/Elements/TriPropertyElement.cs
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
internal class TriPropertyElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
|
||||||
|
public TriPropertyElement(TriProperty property, bool inline = false)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
|
||||||
|
var element = CreateElement(property, inline);
|
||||||
|
|
||||||
|
var drawers = property.AllDrawers;
|
||||||
|
for (var index = drawers.Count - 1; index >= 0; index--)
|
||||||
|
{
|
||||||
|
if (drawers[index].ApplyOnArrayElement != _property.IsArrayElement)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
element = drawers[index].CreateElementInternal(property, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
if (!_property.IsVisible)
|
||||||
|
{
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetHeight(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
if (!_property.IsVisible)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var oldEnabled = GUI.enabled;
|
||||||
|
|
||||||
|
GUI.enabled = _property.IsEnabled;
|
||||||
|
base.OnGUI(position);
|
||||||
|
GUI.enabled = oldEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TriElement CreateElement(TriProperty property, bool inline = false)
|
||||||
|
{
|
||||||
|
var isSerializedProperty = property.TryGetSerializedProperty(out var serializedProperty);
|
||||||
|
|
||||||
|
if (!isSerializedProperty && property.PropertyTree.TargetObjects.Length > 1)
|
||||||
|
{
|
||||||
|
return new TriMultiEditNotSupportedElement(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
var handler = isSerializedProperty
|
||||||
|
? ScriptAttributeUtilityProxy.GetHandler(serializedProperty)
|
||||||
|
: default(PropertyHandlerProxy?);
|
||||||
|
|
||||||
|
if (!handler.HasValue || !handler.Value.hasPropertyDrawer)
|
||||||
|
{
|
||||||
|
var propertyType = property.PropertyType;
|
||||||
|
|
||||||
|
switch (propertyType)
|
||||||
|
{
|
||||||
|
case TriPropertyType.Array:
|
||||||
|
{
|
||||||
|
return CreateArrayElement(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TriPropertyType.Reference:
|
||||||
|
{
|
||||||
|
return CreateReferenceElement(property, inline);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TriPropertyType.Generic:
|
||||||
|
{
|
||||||
|
return CreateGenericElement(property, inline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSerializedProperty)
|
||||||
|
{
|
||||||
|
return new TriBuiltInPropertyElement(property, serializedProperty, handler.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TriNoDrawerElement(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TriElement CreateArrayElement(TriProperty property)
|
||||||
|
{
|
||||||
|
return new TriListElement(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TriElement CreateReferenceElement(TriProperty property, bool inline)
|
||||||
|
{
|
||||||
|
if (inline)
|
||||||
|
{
|
||||||
|
return new TriReferenceElement(property, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property.TryGetAttribute(out InlinePropertyAttribute inlineAttribute))
|
||||||
|
{
|
||||||
|
return new TriReferenceElement(property, true, true, inlineAttribute.LabelWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TriReferenceElement(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TriElement CreateGenericElement(TriProperty property, bool inline)
|
||||||
|
{
|
||||||
|
if (inline)
|
||||||
|
{
|
||||||
|
return new TriInlineGenericElement(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property.TryGetAttribute(out InlinePropertyAttribute inlineAttribute))
|
||||||
|
{
|
||||||
|
return new TriInlineGenericElement(property, true, inlineAttribute.LabelWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TriFoldoutElement(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriPropertyElement.cs.meta
Normal file
3
Editor/Elements/TriPropertyElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f57a61ef6fe34b51939950c6b9597f88
|
||||||
|
timeCreated: 1638776439
|
141
Editor/Elements/TriReferenceElement.cs
Normal file
141
Editor/Elements/TriReferenceElement.cs
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
using System;
|
||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector.Elements
|
||||||
|
{
|
||||||
|
internal class TriReferenceElement : TriPropertyCollectionBaseElement
|
||||||
|
{
|
||||||
|
private readonly bool _drawPrefixLabel;
|
||||||
|
private readonly bool _inline;
|
||||||
|
private readonly float _labelWidth;
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
|
||||||
|
private Type _referenceType;
|
||||||
|
|
||||||
|
public TriReferenceElement(TriProperty property,
|
||||||
|
bool inline = false, bool drawPrefixLabel = false, float labelWidth = 0f)
|
||||||
|
{
|
||||||
|
_property = property;
|
||||||
|
_inline = inline;
|
||||||
|
_drawPrefixLabel = drawPrefixLabel;
|
||||||
|
_labelWidth = labelWidth;
|
||||||
|
|
||||||
|
DeclareGroups(property.ValueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Update()
|
||||||
|
{
|
||||||
|
var dirty = false;
|
||||||
|
|
||||||
|
if (_inline || _property.IsExpanded)
|
||||||
|
{
|
||||||
|
dirty |= GenerateChildren();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dirty |= ClearChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
dirty |= base.Update();
|
||||||
|
|
||||||
|
return dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
var height = EditorGUIUtility.singleLineHeight;
|
||||||
|
|
||||||
|
if (_inline || _property.IsExpanded)
|
||||||
|
{
|
||||||
|
height += base.GetHeight(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
if (_drawPrefixLabel)
|
||||||
|
{
|
||||||
|
var controlId = GUIUtility.GetControlID(FocusType.Passive);
|
||||||
|
position = EditorGUI.PrefixLabel(position, controlId, _property.DisplayNameContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
var headerRect = new Rect(position)
|
||||||
|
{
|
||||||
|
height = EditorGUIUtility.singleLineHeight,
|
||||||
|
};
|
||||||
|
var headerLabelRect = new Rect(position)
|
||||||
|
{
|
||||||
|
height = EditorGUIUtility.singleLineHeight,
|
||||||
|
width = EditorGUIUtility.labelWidth,
|
||||||
|
};
|
||||||
|
var headerFieldRect = new Rect(position)
|
||||||
|
{
|
||||||
|
height = EditorGUIUtility.singleLineHeight,
|
||||||
|
xMin = headerRect.xMin + EditorGUIUtility.labelWidth,
|
||||||
|
};
|
||||||
|
var contentRect = new Rect(position)
|
||||||
|
{
|
||||||
|
yMin = position.yMin + headerRect.height,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_inline)
|
||||||
|
{
|
||||||
|
TriManagedReferenceGui.DrawTypeSelector(headerRect, _property);
|
||||||
|
|
||||||
|
TriGuiHelper.PushLabelWidth(_labelWidth);
|
||||||
|
base.OnGUI(contentRect);
|
||||||
|
TriGuiHelper.PopLabelWidth();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TriEditorGUI.Foldout(headerLabelRect, _property);
|
||||||
|
TriManagedReferenceGui.DrawTypeSelector(headerFieldRect, _property);
|
||||||
|
|
||||||
|
if (_property.IsExpanded)
|
||||||
|
{
|
||||||
|
TriGuiHelper.PushIndentLevel();
|
||||||
|
TriGuiHelper.PushLabelWidth(_labelWidth);
|
||||||
|
base.OnGUI(contentRect);
|
||||||
|
TriGuiHelper.PopLabelWidth();
|
||||||
|
TriGuiHelper.PopIndentLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool GenerateChildren()
|
||||||
|
{
|
||||||
|
if (_property.ValueType == _referenceType)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_referenceType = _property.ValueType;
|
||||||
|
|
||||||
|
RemoveAllChildren();
|
||||||
|
|
||||||
|
foreach (var childProperty in _property.ChildrenProperties)
|
||||||
|
{
|
||||||
|
AddProperty(childProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ClearChildren()
|
||||||
|
{
|
||||||
|
if (ChildrenCount == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_referenceType = null;
|
||||||
|
RemoveAllChildren();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/Elements/TriReferenceElement.cs.meta
Normal file
3
Editor/Elements/TriReferenceElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7dd13898e07a45afacca03cc86c0e24c
|
||||||
|
timeCreated: 1638789498
|
8
Editor/Resources.meta
Normal file
8
Editor/Resources.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d8d4d0876dcc071428509b59e2f78e29
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Editor/Resources/TriInspector_Box_Bg.png
Normal file
BIN
Editor/Resources/TriInspector_Box_Bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 153 B |
108
Editor/Resources/TriInspector_Box_Bg.png.meta
Normal file
108
Editor/Resources/TriInspector_Box_Bg.png.meta
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7a524300faaf5aa40a2ff59c25b28b71
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Editor/Resources/TriInspector_Box_Bg_Dark.png
Normal file
BIN
Editor/Resources/TriInspector_Box_Bg_Dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 B |
108
Editor/Resources/TriInspector_Box_Bg_Dark.png.meta
Normal file
108
Editor/Resources/TriInspector_Box_Bg_Dark.png.meta
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6c3f6c6cd431e8e4e87094572f59d524
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Editor/Resources/TriInspector_Content_Bg.png
Normal file
BIN
Editor/Resources/TriInspector_Content_Bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 150 B |
108
Editor/Resources/TriInspector_Content_Bg.png.meta
Normal file
108
Editor/Resources/TriInspector_Content_Bg.png.meta
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 372e4831c9374244aafdd096c36bb645
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Editor/Resources/TriInspector_Content_Bg_Dark.png
Normal file
BIN
Editor/Resources/TriInspector_Content_Bg_Dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 B |
108
Editor/Resources/TriInspector_Content_Bg_Dark.png.meta
Normal file
108
Editor/Resources/TriInspector_Content_Bg_Dark.png.meta
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d73be6aba60ae5b41887b4116facc353
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Editor/Resources/TriInspector_Header_Bg.png
Normal file
BIN
Editor/Resources/TriInspector_Header_Bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 149 B |
108
Editor/Resources/TriInspector_Header_Bg.png.meta
Normal file
108
Editor/Resources/TriInspector_Header_Bg.png.meta
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 527fefefcbb0e3e4289bf8c5e0be5cd4
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Editor/Resources/TriInspector_Header_Bg_Dark.png
Normal file
BIN
Editor/Resources/TriInspector_Header_Bg_Dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 B |
108
Editor/Resources/TriInspector_Header_Bg_Dark.png.meta
Normal file
108
Editor/Resources/TriInspector_Header_Bg_Dark.png.meta
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ee1f3c29d1186ca43bf0eb4cc9d90ee5
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: 3
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
68
Editor/TriAttributeDrawer.cs
Normal file
68
Editor/TriAttributeDrawer.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public abstract class TriAttributeDrawer : TriCustomDrawer
|
||||||
|
{
|
||||||
|
internal Attribute RawAttribute { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class TriAttributeDrawer<TAttribute> : TriAttributeDrawer
|
||||||
|
where TAttribute : Attribute
|
||||||
|
{
|
||||||
|
[PublicAPI]
|
||||||
|
public TAttribute Attribute => (TAttribute) RawAttribute;
|
||||||
|
|
||||||
|
public sealed override TriElement CreateElementInternal(TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
return CreateElement(property, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public virtual TriElement CreateElement(TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
return new DefaultAttributeDrawerElement(this, property, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public virtual float GetHeight(float width, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
return next.GetHeight(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public virtual void OnGUI(Rect position, TriProperty property, TriElement next)
|
||||||
|
{
|
||||||
|
next.OnGUI(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DefaultAttributeDrawerElement : TriElement
|
||||||
|
{
|
||||||
|
private readonly TriAttributeDrawer<TAttribute> _drawer;
|
||||||
|
private readonly TriElement _next;
|
||||||
|
private readonly TriProperty _property;
|
||||||
|
|
||||||
|
public DefaultAttributeDrawerElement(TriAttributeDrawer<TAttribute> drawer, TriProperty property,
|
||||||
|
TriElement next)
|
||||||
|
{
|
||||||
|
_drawer = drawer;
|
||||||
|
_property = property;
|
||||||
|
_next = next;
|
||||||
|
|
||||||
|
AddChild(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetHeight(float width)
|
||||||
|
{
|
||||||
|
return _drawer.GetHeight(width, _property, _next);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
_drawer.OnGUI(position, _property, _next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriAttributeDrawer.cs.meta
Normal file
3
Editor/TriAttributeDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 31f59a1db97a4d389263665aaf9bccf1
|
||||||
|
timeCreated: 1639381350
|
10
Editor/TriCustomDrawer.cs
Normal file
10
Editor/TriCustomDrawer.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public abstract class TriCustomDrawer
|
||||||
|
{
|
||||||
|
internal int Order { get; set; }
|
||||||
|
internal bool ApplyOnArrayElement { get; set; }
|
||||||
|
|
||||||
|
public abstract TriElement CreateElementInternal(TriProperty property, TriElement next);
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriCustomDrawer.cs.meta
Normal file
3
Editor/TriCustomDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 896bcecdfc7048de8375841799d14ecc
|
||||||
|
timeCreated: 1638885450
|
11
Editor/TriDrawerOrder.cs
Normal file
11
Editor/TriDrawerOrder.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public static class TriDrawerOrder
|
||||||
|
{
|
||||||
|
public const int System = -9999;
|
||||||
|
public const int Inspector = -2000;
|
||||||
|
public const int Decorator = -1000;
|
||||||
|
public const int Drawer = 0;
|
||||||
|
public const int Fallback = 9999;
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriDrawerOrder.cs.meta
Normal file
3
Editor/TriDrawerOrder.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2db5b837fe8643de8e5be9eaee10f509
|
||||||
|
timeCreated: 1639384181
|
96
Editor/TriEditor.cs
Normal file
96
Editor/TriEditor.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Profiling;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public abstract class TriEditor : Editor
|
||||||
|
{
|
||||||
|
private bool _drawDefaultInspector;
|
||||||
|
private TriPropertyTree _inspector;
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
if (serializedObject.targetObject != null)
|
||||||
|
{
|
||||||
|
_inspector = TriPropertyTree.Create(serializedObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
_inspector?.Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
if (_inspector == null)
|
||||||
|
{
|
||||||
|
DrawDefaultInspector();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
serializedObject.UpdateIfRequiredOrScript();
|
||||||
|
|
||||||
|
DrawInspectorModeHeader();
|
||||||
|
|
||||||
|
if (_drawDefaultInspector)
|
||||||
|
{
|
||||||
|
DrawDefaultInspector();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Profiler.BeginSample("TriInspector.Update()");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_inspector.Update();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Profiler.EndSample();
|
||||||
|
}
|
||||||
|
|
||||||
|
TriGuiHelper.PushEditor(this);
|
||||||
|
Profiler.BeginSample("TriInspector.DoLayout()");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_inspector.DoLayout();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Profiler.EndSample();
|
||||||
|
TriGuiHelper.PopEditor(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawInspectorModeHeader()
|
||||||
|
{
|
||||||
|
GUILayout.Space(5);
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.FlexibleSpace();
|
||||||
|
if (GUILayout.Toggle(!_drawDefaultInspector, "Tri Inspector", EditorStyles.miniButtonLeft))
|
||||||
|
{
|
||||||
|
_drawDefaultInspector = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Toggle(_drawDefaultInspector, "Default Inspector", EditorStyles.miniButtonRight))
|
||||||
|
{
|
||||||
|
_drawDefaultInspector = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.FlexibleSpace();
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.Space(5);
|
||||||
|
|
||||||
|
var rect = EditorGUILayout.GetControlRect(false, 1);
|
||||||
|
EditorGUI.DrawRect(rect, Color.gray);
|
||||||
|
GUILayout.Space(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Editor/TriEditor.cs.meta
Normal file
11
Editor/TriEditor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7985f723508b7434183568ca5c8436bd
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
83
Editor/TriEditorStyles.cs
Normal file
83
Editor/TriEditorStyles.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public static class TriEditorStyles
|
||||||
|
{
|
||||||
|
private const string BaseResourcesPath = "Packages/com.triinspector/Editor/Resources/";
|
||||||
|
|
||||||
|
private static GUIStyle _headerBox;
|
||||||
|
private static GUIStyle _contentBox;
|
||||||
|
private static GUIStyle _box;
|
||||||
|
|
||||||
|
public static GUIStyle HeaderBox
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_headerBox == null)
|
||||||
|
{
|
||||||
|
_headerBox = new GUIStyle
|
||||||
|
{
|
||||||
|
border = new RectOffset(2, 2, 2, 2),
|
||||||
|
normal =
|
||||||
|
{
|
||||||
|
background = LoadTexture("TriInspector_Header_Bg"),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return _headerBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GUIStyle ContentBox
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_contentBox == null)
|
||||||
|
{
|
||||||
|
_contentBox = new GUIStyle
|
||||||
|
{
|
||||||
|
border = new RectOffset(2, 2, 2, 2),
|
||||||
|
normal =
|
||||||
|
{
|
||||||
|
background = LoadTexture("TriInspector_Content_Bg"),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return _contentBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GUIStyle Box
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_box == null)
|
||||||
|
{
|
||||||
|
_box = new GUIStyle
|
||||||
|
{
|
||||||
|
border = new RectOffset(2, 2, 2, 2),
|
||||||
|
normal =
|
||||||
|
{
|
||||||
|
background = LoadTexture("TriInspector_Box_Bg"),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return _box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Texture2D LoadTexture(string name)
|
||||||
|
{
|
||||||
|
var path = EditorGUIUtility.isProSkin
|
||||||
|
? BaseResourcesPath + name + "_Dark.png"
|
||||||
|
: BaseResourcesPath + name + ".png";
|
||||||
|
|
||||||
|
return (Texture2D) EditorGUIUtility.Load(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriEditorStyles.cs.meta
Normal file
3
Editor/TriEditorStyles.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6f23eb6fd2f644a0a718543287192636
|
||||||
|
timeCreated: 1639462144
|
197
Editor/TriElement.cs
Normal file
197
Editor/TriElement.cs
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public class TriElement
|
||||||
|
{
|
||||||
|
private static readonly List<TriElement> Empty = new List<TriElement>();
|
||||||
|
|
||||||
|
private bool _attached;
|
||||||
|
private List<TriElement> _children = Empty;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public int ChildrenCount => _children.Count;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public virtual bool Update()
|
||||||
|
{
|
||||||
|
if (!_attached)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{GetType().Name} not attached");
|
||||||
|
}
|
||||||
|
|
||||||
|
var dirty = false;
|
||||||
|
|
||||||
|
foreach (var child in _children)
|
||||||
|
{
|
||||||
|
dirty |= child.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public virtual float GetHeight(float width)
|
||||||
|
{
|
||||||
|
if (!_attached)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{GetType().Name} not attached");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (_children.Count)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return 0f;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return _children[0].GetHeight(width);
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
var height = (_children.Count - 1) * EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
|
||||||
|
foreach (var child in _children)
|
||||||
|
{
|
||||||
|
height += child.GetHeight(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public virtual void OnGUI(Rect position)
|
||||||
|
{
|
||||||
|
if (!_attached)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{GetType().Name} not attached");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (_children.Count)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
_children[0].OnGUI(position);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
var offset = 0f;
|
||||||
|
var spacing = EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
|
||||||
|
foreach (var child in _children)
|
||||||
|
{
|
||||||
|
var childHeight = child.GetHeight(position.width);
|
||||||
|
|
||||||
|
child.OnGUI(new Rect(position.x, position.y + offset, position.width, childHeight));
|
||||||
|
|
||||||
|
offset += childHeight + spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public TriElement GetChild(int index)
|
||||||
|
{
|
||||||
|
return _children[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public void RemoveChildAt(int index)
|
||||||
|
{
|
||||||
|
if (_children.Count < index)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var child = _children[index];
|
||||||
|
_children.RemoveAt(index);
|
||||||
|
|
||||||
|
if (_attached)
|
||||||
|
{
|
||||||
|
child.DetachInternal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public void RemoveAllChildren()
|
||||||
|
{
|
||||||
|
if (_attached)
|
||||||
|
{
|
||||||
|
foreach (var child in _children)
|
||||||
|
{
|
||||||
|
child.DetachInternal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_children.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public void AddChild(TriElement child)
|
||||||
|
{
|
||||||
|
if (_children == Empty)
|
||||||
|
{
|
||||||
|
_children = new List<TriElement>();
|
||||||
|
}
|
||||||
|
|
||||||
|
_children.Add(child);
|
||||||
|
|
||||||
|
if (_attached)
|
||||||
|
{
|
||||||
|
child.AttachInternal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void AttachInternal()
|
||||||
|
{
|
||||||
|
if (_attached)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{GetType().Name} already attached");
|
||||||
|
}
|
||||||
|
|
||||||
|
_attached = true;
|
||||||
|
|
||||||
|
OnAttachToPanel();
|
||||||
|
|
||||||
|
foreach (var child in _children)
|
||||||
|
{
|
||||||
|
child.AttachInternal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void DetachInternal()
|
||||||
|
{
|
||||||
|
if (!_attached)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{GetType().Name} not attached");
|
||||||
|
}
|
||||||
|
|
||||||
|
_attached = false;
|
||||||
|
|
||||||
|
foreach (var child in _children)
|
||||||
|
{
|
||||||
|
child.DetachInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
OnDetachFromPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnAttachToPanel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnDetachFromPanel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriElement.cs.meta
Normal file
3
Editor/TriElement.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 543813bc0e9e4045904a35ef56ea6abe
|
||||||
|
timeCreated: 1638771508
|
23
Editor/TriGroupDrawer.cs
Normal file
23
Editor/TriGroupDrawer.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using TriInspector.Elements;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public abstract class TriGroupDrawer
|
||||||
|
{
|
||||||
|
public abstract TriPropertyCollectionBaseElement CreateElementInternal(Attribute attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class TriGroupDrawer<TAttribute> : TriGroupDrawer
|
||||||
|
where TAttribute : Attribute
|
||||||
|
{
|
||||||
|
public sealed override TriPropertyCollectionBaseElement CreateElementInternal(Attribute attribute)
|
||||||
|
{
|
||||||
|
return CreateElement((TAttribute) attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public abstract TriPropertyCollectionBaseElement CreateElement(TAttribute attribute);
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriGroupDrawer.cs.meta
Normal file
3
Editor/TriGroupDrawer.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c7337ea7305e4a5681ff404a041dc93e
|
||||||
|
timeCreated: 1639417787
|
18
Editor/TriInspector.Editor.asmdef
Normal file
18
Editor/TriInspector.Editor.asmdef
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "TriInspector.Editor",
|
||||||
|
"rootNamespace": "",
|
||||||
|
"references": [
|
||||||
|
"TriInspector"
|
||||||
|
],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": true,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
7
Editor/TriInspector.Editor.asmdef.meta
Normal file
7
Editor/TriInspector.Editor.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e851236b9ac2b9b4eaaa99506366edea
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
373
Editor/TriProperty.cs
Normal file
373
Editor/TriProperty.cs
Normal file
@ -0,0 +1,373 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public sealed class TriProperty : ITriPropertyParent
|
||||||
|
{
|
||||||
|
private static readonly IList EmptyList = new List<object>();
|
||||||
|
|
||||||
|
private readonly TriPropertyDefinition _definition;
|
||||||
|
private readonly ITriPropertyParent _parent;
|
||||||
|
[CanBeNull] private readonly SerializedProperty _serializedProperty;
|
||||||
|
private List<TriProperty> _arrayElementProperties;
|
||||||
|
private List<TriProperty> _childrenProperties;
|
||||||
|
|
||||||
|
private GUIContent _displayNameBackingField;
|
||||||
|
private bool? _isReadOnlyBackingField;
|
||||||
|
|
||||||
|
internal TriProperty(
|
||||||
|
TriPropertyTree propertyTree,
|
||||||
|
ITriPropertyParent parent,
|
||||||
|
TriPropertyDefinition definition,
|
||||||
|
[CanBeNull] SerializedProperty serializedProperty)
|
||||||
|
{
|
||||||
|
_parent = parent;
|
||||||
|
_definition = definition;
|
||||||
|
_serializedProperty = serializedProperty?.Copy();
|
||||||
|
|
||||||
|
PropertyTree = propertyTree;
|
||||||
|
PropertyType = GetPropertyType(this);
|
||||||
|
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public GUIContent DisplayNameContent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_displayNameBackingField == null)
|
||||||
|
{
|
||||||
|
_displayNameBackingField = TryGetAttribute(out HideLabelAttribute _)
|
||||||
|
? GUIContent.none
|
||||||
|
: new GUIContent(ObjectNames.NicifyVariableName(_definition.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_displayNameBackingField != GUIContent.none)
|
||||||
|
{
|
||||||
|
if (TryGetAttribute(out LabelTextAttribute labelTextAttribute))
|
||||||
|
{
|
||||||
|
_displayNameBackingField.text = labelTextAttribute.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryGetAttribute(out PropertyTooltipAttribute tooltipAttribute))
|
||||||
|
{
|
||||||
|
_displayNameBackingField.tooltip = tooltipAttribute.Tooltip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _displayNameBackingField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool IsVisible => true;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IsReadOnly)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public Type FieldType => _definition.FieldType;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public Type ArrayElementType => _definition.ArrayElementType;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool IsArrayElement => _definition.IsArrayElement;
|
||||||
|
|
||||||
|
public IReadOnlyList<TriCustomDrawer> AllDrawers => _definition.Drawers;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool IsExpanded
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_serializedProperty != null)
|
||||||
|
{
|
||||||
|
return _serializedProperty.isExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add saves
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (IsExpanded == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_serializedProperty != null)
|
||||||
|
{
|
||||||
|
_serializedProperty.isExpanded = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
[CanBeNull]
|
||||||
|
public Type ValueType { get; private set; }
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public TriPropertyType PropertyType { get; }
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public IReadOnlyList<TriProperty> ChildrenProperties =>
|
||||||
|
PropertyType == TriPropertyType.Generic || PropertyType == TriPropertyType.Reference
|
||||||
|
? _childrenProperties
|
||||||
|
: throw new InvalidOperationException("Cannot read ChildrenProperties for " + PropertyType);
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public IReadOnlyList<TriProperty> ArrayElementProperties => PropertyType == TriPropertyType.Array
|
||||||
|
? _arrayElementProperties
|
||||||
|
: throw new InvalidOperationException("Cannot read ArrayElementProperties for " + PropertyType);
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public TriPropertyTree PropertyTree { get; }
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool IsReadOnly
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_isReadOnlyBackingField == null)
|
||||||
|
{
|
||||||
|
_isReadOnlyBackingField = _definition.IsReadOnly || _parent.IsReadOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _isReadOnlyBackingField.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyChildValueModifications(int targetIndex)
|
||||||
|
{
|
||||||
|
var parentValue = _parent.GetValue(targetIndex);
|
||||||
|
var value = _definition.GetValue(parentValue);
|
||||||
|
_definition.SetValue(parentValue, value);
|
||||||
|
|
||||||
|
_parent.ApplyChildValueModifications(targetIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
[CanBeNull]
|
||||||
|
public object Value { get; private set; }
|
||||||
|
|
||||||
|
object ITriPropertyParent.GetValue(int targetIndex)
|
||||||
|
{
|
||||||
|
return _definition.GetValue(_parent.GetValue(targetIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public void SetValue(object value)
|
||||||
|
{
|
||||||
|
Undo.RegisterCompleteObjectUndo(PropertyTree.TargetObjects, "Inspector");
|
||||||
|
Undo.FlushUndoRecordObjects();
|
||||||
|
|
||||||
|
for (var i = 0; i < PropertyTree.TargetObjects.Length; i++)
|
||||||
|
{
|
||||||
|
_definition.SetValue(_parent.GetValue(i), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
_serializedProperty?.serializedObject.Update();
|
||||||
|
|
||||||
|
if (_serializedProperty != null)
|
||||||
|
{
|
||||||
|
_serializedProperty.serializedObject.ApplyModifiedProperties();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (var i = 0; i < PropertyTree.TargetObjects.Length; i++)
|
||||||
|
{
|
||||||
|
_parent.ApplyChildValueModifications(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Update()
|
||||||
|
{
|
||||||
|
var newValue = _definition.GetValue(_parent.GetValue(0));
|
||||||
|
var valueChanged = !ReferenceEquals(Value, newValue);
|
||||||
|
|
||||||
|
var newValueType = valueChanged ? newValue?.GetType() : ValueType;
|
||||||
|
var valueTypeChanged = ValueType != newValueType;
|
||||||
|
|
||||||
|
Value = newValue;
|
||||||
|
ValueType = newValueType;
|
||||||
|
|
||||||
|
switch (PropertyType)
|
||||||
|
{
|
||||||
|
case TriPropertyType.Generic:
|
||||||
|
case TriPropertyType.Reference:
|
||||||
|
if (_childrenProperties == null || valueTypeChanged)
|
||||||
|
{
|
||||||
|
_childrenProperties ??= new List<TriProperty>();
|
||||||
|
_childrenProperties.Clear();
|
||||||
|
|
||||||
|
var selfType = PropertyType == TriPropertyType.Reference ? ValueType : FieldType;
|
||||||
|
if (selfType != null)
|
||||||
|
{
|
||||||
|
foreach (var childDefinition in TriTypeDefinition.GetCached(selfType).Properties)
|
||||||
|
{
|
||||||
|
var childSerializedProperty =
|
||||||
|
_serializedProperty?.FindPropertyRelative(childDefinition.Name);
|
||||||
|
var childProperty =
|
||||||
|
new TriProperty(PropertyTree, this, childDefinition, childSerializedProperty);
|
||||||
|
|
||||||
|
_childrenProperties.Add(childProperty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var childrenProperty in _childrenProperties)
|
||||||
|
{
|
||||||
|
childrenProperty.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TriPropertyType.Array:
|
||||||
|
_arrayElementProperties ??= new List<TriProperty>();
|
||||||
|
|
||||||
|
var list = (IList) Value ?? EmptyList;
|
||||||
|
|
||||||
|
while (_arrayElementProperties.Count < list.Count)
|
||||||
|
{
|
||||||
|
var index = _arrayElementProperties.Count;
|
||||||
|
var elementDefinition = _definition.GetArrayElementDefinition(index);
|
||||||
|
var elementSerializedReference = _serializedProperty?.GetArrayElementAtIndex(index);
|
||||||
|
|
||||||
|
var elementProperty =
|
||||||
|
new TriProperty(PropertyTree, this, elementDefinition, elementSerializedReference);
|
||||||
|
|
||||||
|
_arrayElementProperties.Add(elementProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (_arrayElementProperties.Count > list.Count)
|
||||||
|
{
|
||||||
|
_arrayElementProperties.RemoveAt(_arrayElementProperties.Count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var arrayElementProperty in _arrayElementProperties)
|
||||||
|
{
|
||||||
|
arrayElementProperty.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool TryGetSerializedProperty(out SerializedProperty serializedProperty)
|
||||||
|
{
|
||||||
|
serializedProperty = _serializedProperty;
|
||||||
|
return serializedProperty != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool TryGetAttribute<TAttribute>(out TAttribute attribute)
|
||||||
|
where TAttribute : Attribute
|
||||||
|
{
|
||||||
|
if (ValueType != null)
|
||||||
|
{
|
||||||
|
foreach (var attr in TriReflectionUtilities.GetAttributesCached(ValueType))
|
||||||
|
{
|
||||||
|
if (attr is TAttribute typedAttr)
|
||||||
|
{
|
||||||
|
attribute = typedAttr;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var attr in _definition.Attributes)
|
||||||
|
{
|
||||||
|
if (attr is TAttribute typedAttr)
|
||||||
|
{
|
||||||
|
attribute = typedAttr;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TriPropertyType GetPropertyType(TriProperty property)
|
||||||
|
{
|
||||||
|
if (property._serializedProperty != null)
|
||||||
|
{
|
||||||
|
if (property._serializedProperty.isArray &&
|
||||||
|
property._serializedProperty.propertyType != SerializedPropertyType.String)
|
||||||
|
{
|
||||||
|
return TriPropertyType.Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property._serializedProperty.propertyType == SerializedPropertyType.ManagedReference)
|
||||||
|
{
|
||||||
|
return TriPropertyType.Reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property._serializedProperty.propertyType == SerializedPropertyType.Generic)
|
||||||
|
{
|
||||||
|
return TriPropertyType.Generic;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TriPropertyType.Primitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property._definition.FieldType.IsPrimitive ||
|
||||||
|
property._definition.FieldType == typeof(string))
|
||||||
|
{
|
||||||
|
return TriPropertyType.Primitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property._definition.FieldType.IsValueType)
|
||||||
|
{
|
||||||
|
return TriPropertyType.Generic;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property._definition.IsArray)
|
||||||
|
{
|
||||||
|
return TriPropertyType.Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TriPropertyType.Reference;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ITriPropertyParent
|
||||||
|
{
|
||||||
|
object GetValue(int targetIndex);
|
||||||
|
bool IsReadOnly { get; }
|
||||||
|
|
||||||
|
void ApplyChildValueModifications(int targetIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TriPropertyType
|
||||||
|
{
|
||||||
|
Array,
|
||||||
|
Reference,
|
||||||
|
Generic,
|
||||||
|
Primitive,
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriProperty.cs.meta
Normal file
3
Editor/TriProperty.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4db12eccd9e84863a9b3b445ce3ac85e
|
||||||
|
timeCreated: 1638862848
|
170
Editor/TriPropertyDefinition.cs
Normal file
170
Editor/TriPropertyDefinition.cs
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using TriInspector.Utilities;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
internal class TriPropertyDefinition
|
||||||
|
{
|
||||||
|
private readonly Func<object, object> _valueGetter;
|
||||||
|
[CanBeNull] private readonly Action<object, object> _valueSetter;
|
||||||
|
|
||||||
|
private IReadOnlyList<TriCustomDrawer> _drawersBackingField;
|
||||||
|
|
||||||
|
internal TriPropertyDefinition(int order, FieldInfo fi)
|
||||||
|
: this(order, fi.Name, fi.FieldType, fi.GetValue, fi.SetValue, fi.GetCustomAttributes(), false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal TriPropertyDefinition(int order, PropertyInfo pi)
|
||||||
|
: this(order, pi.Name, pi.PropertyType, MakeGetter(pi), MakeSetter(pi), pi.GetCustomAttributes(), false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private TriPropertyDefinition(
|
||||||
|
int order,
|
||||||
|
string fieldName,
|
||||||
|
Type fieldType,
|
||||||
|
Func<object, object> valueGetter,
|
||||||
|
Action<object, object> valueSetter,
|
||||||
|
IEnumerable<Attribute> fieldAttributes,
|
||||||
|
bool isArrayElement)
|
||||||
|
{
|
||||||
|
Name = fieldName;
|
||||||
|
FieldType = fieldType;
|
||||||
|
IsArrayElement = isArrayElement;
|
||||||
|
|
||||||
|
_valueGetter = valueGetter;
|
||||||
|
_valueSetter = valueSetter;
|
||||||
|
|
||||||
|
Attributes = fieldAttributes.ToList();
|
||||||
|
Order = Attributes.TryGet(out PropertyOrderAttribute orderAttribute) ? orderAttribute.Order : order;
|
||||||
|
IsReadOnly = _valueSetter == null || Attributes.TryGet(out ReadOnlyAttribute _);
|
||||||
|
|
||||||
|
if (TriReflectionUtilities.IsArrayOrList(FieldType, out var elementType))
|
||||||
|
{
|
||||||
|
IsArray = true;
|
||||||
|
ArrayElementType = elementType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type FieldType { get; }
|
||||||
|
|
||||||
|
public string Name { get; }
|
||||||
|
|
||||||
|
public int Order { get; }
|
||||||
|
|
||||||
|
public IReadOnlyList<Attribute> Attributes { get; }
|
||||||
|
|
||||||
|
public bool IsReadOnly { get; }
|
||||||
|
|
||||||
|
public bool IsArrayElement { get; }
|
||||||
|
public Type ArrayElementType { get; }
|
||||||
|
|
||||||
|
public bool IsArray { get; }
|
||||||
|
|
||||||
|
public IReadOnlyList<TriCustomDrawer> Drawers
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_drawersBackingField == null)
|
||||||
|
{
|
||||||
|
var valueDrawers =
|
||||||
|
from drawer in TriDrawersUtilities.AllValueDrawerTypes
|
||||||
|
where TriDrawersUtilities.IsValueDrawerFor(drawer.DrawerType, FieldType)
|
||||||
|
select CreateValueDrawer(drawer);
|
||||||
|
|
||||||
|
var attributeDrawers =
|
||||||
|
from attribute in Attributes
|
||||||
|
from drawer in TriDrawersUtilities.AllAttributeDrawerTypes
|
||||||
|
where TriDrawersUtilities.IsAttributeDrawerFor(drawer.DrawerType, attribute)
|
||||||
|
select CreateAttributeDrawer(drawer, attribute);
|
||||||
|
|
||||||
|
_drawersBackingField = Enumerable.Empty<TriCustomDrawer>()
|
||||||
|
.Concat(valueDrawers)
|
||||||
|
.Concat(attributeDrawers)
|
||||||
|
.OrderBy(it => it.Order)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
static TriValueDrawer CreateValueDrawer(RegisterTriDrawerAttribute drawer)
|
||||||
|
{
|
||||||
|
var instance = (TriValueDrawer) Activator.CreateInstance(drawer.DrawerType);
|
||||||
|
instance.ApplyOnArrayElement = drawer.ApplyOnArrayElement;
|
||||||
|
instance.Order = drawer.Order;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
static TriAttributeDrawer CreateAttributeDrawer(RegisterTriDrawerAttribute drawer,
|
||||||
|
Attribute attribute)
|
||||||
|
{
|
||||||
|
var instance = (TriAttributeDrawer) Activator.CreateInstance(drawer.DrawerType);
|
||||||
|
instance.ApplyOnArrayElement = drawer.ApplyOnArrayElement;
|
||||||
|
instance.Order = drawer.Order;
|
||||||
|
instance.RawAttribute = attribute;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _drawersBackingField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object GetValue(object obj)
|
||||||
|
{
|
||||||
|
return _valueGetter(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetValue(object obj, object value)
|
||||||
|
{
|
||||||
|
if (IsReadOnly)
|
||||||
|
{
|
||||||
|
Debug.LogError("Cannot set value for readonly property");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_valueSetter?.Invoke(obj, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TriPropertyDefinition GetArrayElementDefinition(int index)
|
||||||
|
{
|
||||||
|
if (!IsArray)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
$"Cannot get array element definition for non array property: {FieldType}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var elementName = $"Element {index}";
|
||||||
|
var elementGetter = new Func<object, object>(obj => ((IList) obj)[index]);
|
||||||
|
var elementSetter = new Action<object, object>((obj, value) => ((IList) obj)[index] = value);
|
||||||
|
var elementOrder = index;
|
||||||
|
var elementAttributes = Attributes;
|
||||||
|
|
||||||
|
var definition = new TriPropertyDefinition(elementOrder, elementName, ArrayElementType,
|
||||||
|
elementGetter, elementSetter, elementAttributes, true);
|
||||||
|
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Func<object, object> MakeGetter(PropertyInfo pi)
|
||||||
|
{
|
||||||
|
var method = pi.GetMethod;
|
||||||
|
return obj => method.Invoke(obj, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Action<object, object> MakeSetter(PropertyInfo pi)
|
||||||
|
{
|
||||||
|
var method = pi.SetMethod;
|
||||||
|
if (method == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (obj, value) => method.Invoke(obj, new[] {value,});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Editor/TriPropertyDefinition.cs.meta
Normal file
3
Editor/TriPropertyDefinition.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4feaa123e82e4c93846c94ebd3af253e
|
||||||
|
timeCreated: 1638873323
|
82
Editor/TriPropertyTree.cs
Normal file
82
Editor/TriPropertyTree.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using TriInspector.Elements;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
|
namespace TriInspector
|
||||||
|
{
|
||||||
|
public sealed class TriPropertyTree : ITriPropertyParent
|
||||||
|
{
|
||||||
|
private readonly TriInspectorElement _inspectorElement;
|
||||||
|
|
||||||
|
private TriPropertyTree(SerializedObject serializedObject)
|
||||||
|
{
|
||||||
|
TargetObjects = serializedObject.targetObjects;
|
||||||
|
TargetObjectType = TargetObjects[0].GetType();
|
||||||
|
Root = this;
|
||||||
|
|
||||||
|
Properties = TriTypeDefinition.GetCached(TargetObjectType)
|
||||||
|
.Properties
|
||||||
|
.Select(propertyDefinition =>
|
||||||
|
{
|
||||||
|
var serializedProperty = serializedObject.FindProperty(propertyDefinition.Name);
|
||||||
|
return new TriProperty(this, this, propertyDefinition, serializedProperty);
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
_inspectorElement = new TriInspectorElement(this);
|
||||||
|
_inspectorElement.AttachInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public IReadOnlyList<TriProperty> Properties { get; }
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public Object[] TargetObjects { get; }
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public Type TargetObjectType { get; }
|
||||||
|
|
||||||
|
public TriPropertyTree Root { get; }
|
||||||
|
|
||||||
|
object ITriPropertyParent.GetValue(int targetIndex) => TargetObjects[targetIndex];
|
||||||
|
bool ITriPropertyParent.IsReadOnly => false;
|
||||||
|
|
||||||
|
void ITriPropertyParent.ApplyChildValueModifications(int targetIndex)
|
||||||
|
{
|
||||||
|
EditorUtility.SetDirty(TargetObjects[targetIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static TriPropertyTree Create(SerializedObject scriptableObject)
|
||||||
|
{
|
||||||
|
return new TriPropertyTree(scriptableObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Destroy()
|
||||||
|
{
|
||||||
|
_inspectorElement.DetachInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Update()
|
||||||
|
{
|
||||||
|
foreach (var property in Properties)
|
||||||
|
{
|
||||||
|
property.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
_inspectorElement.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void DoLayout()
|
||||||
|
{
|
||||||
|
var width = EditorGUIUtility.currentViewWidth;
|
||||||
|
var height = _inspectorElement.GetHeight(width);
|
||||||
|
var rect = GUILayoutUtility.GetRect(width, height);
|
||||||
|
_inspectorElement.OnGUI(rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user