MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / project_quality

Function project_quality

unity_cli/cli/commands/project.py:274–354  ·  view source on GitHub ↗

Show quality settings.

(
    ctx: typer.Context,
    path: Annotated[
        Path,
        typer.Argument(help="Unity project path"),
    ] = Path("."),
    json_flag: Annotated[
        bool,
        typer.Option("--json", help="Output as JSON"),
    ] = False,
)

Source from the content-addressed store, hash-verified

272
273@project_app.command("quality")
274def project_quality(
275 ctx: typer.Context,
276 path: Annotated[
277 Path,
278 typer.Argument(help="Unity project path"),
279 ] = Path("."),
280 json_flag: Annotated[
281 bool,
282 typer.Option("--json", help="Output as JSON"),
283 ] = False,
284) -> None:
285 """Show quality settings."""
286 context: CLIContext = ctx.obj
287 from unity_cli.hub.project import QualitySettings, is_unity_project
288
289 path = path.resolve()
290
291 if not is_unity_project(path):
292 print_error(f"Not a valid Unity project: {path}", "INVALID_PROJECT")
293 raise typer.Exit(ExitCode.USAGE_ERROR) from None
294
295 settings = QualitySettings.from_file(path)
296
297 if _should_json(context, json_flag):
298 print_json(
299 {
300 "current_quality": settings.current_quality,
301 "levels": [
302 {
303 "name": lvl.name,
304 "shadow_resolution": lvl.shadow_resolution,
305 "shadow_distance": lvl.shadow_distance,
306 "vsync_count": lvl.vsync_count,
307 "lod_bias": lvl.lod_bias,
308 "anti_aliasing": lvl.anti_aliasing,
309 }
310 for lvl in settings.levels
311 ],
312 }
313 )
314 else:
315 title = f"Quality Levels (current: {settings.current_quality})"
316 headers = ["#", "Name", "Shadow Res", "Shadow Dist", "VSync", "LOD Bias", "AA"]
317
318 if is_no_color():
319 rows = [
320 [
321 f"{'>' if i == settings.current_quality else ' '}{i}",
322 lvl.name,
323 str(lvl.shadow_resolution),
324 str(lvl.shadow_distance),
325 str(lvl.vsync_count),
326 str(lvl.lod_bias),
327 str(lvl.anti_aliasing),
328 ]
329 for i, lvl in enumerate(settings.levels)
330 ]
331 _print_plain_table(headers, rows, title)

Callers

nothing calls this directly

Calls 8

is_unity_projectFunction · 0.90
print_errorFunction · 0.90
_should_jsonFunction · 0.90
print_jsonFunction · 0.90
is_no_colorFunction · 0.90
get_consoleFunction · 0.90
ExitMethod · 0.80
from_fileMethod · 0.45

Tested by

no test coverage detected