(ctx: qrd.CaptureContext, data)
| 96 | |
| 97 | |
| 98 | def menu_callback(ctx: qrd.CaptureContext, data): |
| 99 | texid = rd.ResourceId.Null() |
| 100 | depth = ctx.CurPipelineState().GetDepthTarget() |
| 101 | |
| 102 | # Prefer depth if possible |
| 103 | if depth.resourceId != rd.ResourceId.Null(): |
| 104 | texid = depth.resourceId |
| 105 | else: |
| 106 | cols = ctx.CurPipelineState().GetOutputTargets() |
| 107 | |
| 108 | # See if we can get the first colour target instead |
| 109 | if len(cols) > 1 and cols[0].resourceId != rd.ResourceId.Null(): |
| 110 | texid = cols[0].resourceId |
| 111 | |
| 112 | if texid == rd.ResourceId.Null(): |
| 113 | ctx.Extensions().MessageDialog("Couldn't find any bound target!", "Extension message") |
| 114 | return |
| 115 | else: |
| 116 | mqt = ctx.Extensions().GetMiniQtHelper() |
| 117 | texname = ctx.GetResourceName(texid) |
| 118 | |
| 119 | def get_minmax(r: rd.ReplayController): |
| 120 | minvals, maxvals = r.GetMinMax(texid, rd.Subresource(), rd.CompType.Typeless) |
| 121 | |
| 122 | msg = '{} has min {:.4} and max {:.4} in red'.format(texname, minvals.floatValue[0], maxvals.floatValue[0]) |
| 123 | |
| 124 | mqt.InvokeOntoUIThread(lambda: ctx.Extensions().MessageDialog(msg, "Extension message")) |
| 125 | |
| 126 | ctx.Replay().AsyncInvoke('', get_minmax) |
| 127 | |
| 128 | |
| 129 |
nothing calls this directly
no test coverage detected