@tool extends EditorScenePostImport var regular_outline_material : StandardMaterial3D var detail_outline_material : StandardMaterial3D var thin_outline_material : StandardMaterial3D func _post_import(root : Node): regular_outline_material = ResourceLoader.load("res://assets/style/base_outline_material.tres") as StandardMaterial3D detail_outline_material = ResourceLoader.load("res://assets/style/detail_outline_material.tres") as StandardMaterial3D thin_outline_material = ResourceLoader.load("res://assets/style/thin_outline_material.tres") as StandardMaterial3D apply_outline_recursive(root) return root func get_flag(node : Node, flag : String) -> bool: if node.name.contains(flag): node.name = node.name.erase(node.name.find(flag), flag.length()) return true else: return false func apply_outline_recursive(node : Node): if node != null: var outline : bool = not get_flag(node, "-nooutline") if outline and node is MeshInstance3D: var detail : bool = get_flag(node, "-detailoutline") var thin : bool = get_flag(node, "-thinoutline") var mesh : MeshInstance3D = (node as MeshInstance3D) if detail and detail_outline_material: mesh.material_overlay = detail_outline_material elif thin and thin_outline_material: mesh.material_overlay = thin_outline_material elif regular_outline_material: mesh.material_overlay = regular_outline_material for child in node.get_children(): apply_outline_recursive(child)