AcademySoftwareFoundation / OpenColorIO

A color management framework for visual effects and animation.
https://opencolorio.org
BSD 3-Clause "New" or "Revised" License
1.74k stars 431 forks source link

Python: deep-copied Configs fail to preserve the "default_view_transform" field. #1906

Closed zachlewis closed 7 months ago

zachlewis commented 8 months ago

It seems that deep-copied Configs lose the "default_view_transform" field entirely...!

>>> import PyOpenColorIO as ocio
>>> from copy import deepcopy

>>> cfg = ocio.Config.CreateFromFile('ocio://studio-config-latest')
>>> xform = ocio.ColorSpaceTransform('ACES2065-1', 'Rec.1886 Rec.709 - Display')

>>> print(cfg.getProcessor(xform).createGroupTransform())

<GroupTransform direction=forward, transforms=
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=0.9382798492772554 -0.004451445812361399 0.01662752358677617 0 0.3373688907878367 0.7295215666902654 -0.06689045747810234 0 0.001173950849685879 -0.003710706402052562 1.091594506312247 0 0 0 0 1, offset=0 0 0 0>
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=3.240969941904521 -1.537383177570093 -0.4986107602930035 0 -0.9692436362808797 1.87596750150772 0.04155505740717564 0 0.05563007969699365 -0.2039769588889765 1.056971514242879 0 0 0 0 1, offset=0 0 0 0>
        <ExponentTransform direction=inverse, value=2.4 2.4 2.4 1, style=clamp>>

>>> print(deepcopy(cfg).getProcessor(xform).createGroupTransform())

<GroupTransform direction=forward, transforms=
        <FixedFunction direction=forward, style=ACES_Glow10>
        <FixedFunction direction=forward, style=ACES_RedMod10>
        <RangeTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, minInValue=0, minOutValue=0>
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=1.451439316145665 -0.2365107468937402 -0.2149285692519252 0 -0.07655377339602043 1.176229699833573 -0.0996759264375522 0 0.008316148425697719 -0.006032449791021028 0.9977163013653233 0 0 0 0 1, offset=0 0 0 0>
        <RangeTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, minInValue=0, minOutValue=0>
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=0.970889148671 0.026963270632 0.002147580696 0 0.010889148671 0.986963270632 0.002147580696 0 0.010889148671 0.026963270632 0.962147580696 0 0 0 0 1, offset=0 0 0 0>
        <LogTransform direction=forward, base=10>
        <GradingRGBCurveTransform direction=forward, style=log, values=<red=<control_points=[<x=0, y=0><x=1, y=1>]>, green=<control_points=[<x=0, y=0><x=1, y=1>]>, blue=<control_points=[<x=0, y=0><x=1, y=1>]>, master=<control_points=[<x=-5.260177612304688, y=-4><x=-3.755027532577515, y=-3.578688383102417><x=-2.249877452850342, y=-1.821313261985779><x=-0.7447274923324585, y=0.6812412142753601><x=1.061452507972717, y=2.874577522277832><x=2.867632389068604, y=3.834062099456787><x=4.673812389373779, y=4>]>>>
        <GradingRGBCurveTransform direction=forward, style=log, values=<red=<control_points=[<x=0, y=0><x=1, y=1>]>, green=<control_points=[<x=0, y=0><x=1, y=1>]>, blue=<control_points=[<x=0, y=0><x=1, y=1>]>, master=<control_points=[<x=-2.540623664855957, y=-1.698969960212708><x=-2.080357313156128, y=-1.588435053825378><x=-1.620090842247009, y=-1.353500008583069><x=-1.159824371337891, y=-1.046949982643127><x=-0.6995580196380615, y=-0.6564000248908997><x=-0.2392915785312653, y=-0.2214100062847137><x=0.2209748327732086, y=0.2281440198421478><x=0.6812412142753601, y=0.6812412142753601><x=1.012846350669861, y=0.9914218783378601><x=1.344451427459717, y=1.258000016212463><x=1.676056504249573, y=1.449949979782104><x=2.007661581039429, y=1.559100031852722><x=2.339266538619995, y=1.622599959373474><x=2.670871734619141, y=1.660654544830322><x=3.002476692199707, y=1.681241273880005>]>>>
        <LogTransform direction=inverse, base=10>
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=0.02084201750729471 0 0 0 0 0.02084201750729471 0 0 0 0 0.02084201750729471 0 0 0 0 1, offset=-0.0004168403501458941 -0.0004168403501458941 -0.0004168403501458941 0>
        <FixedFunction direction=forward, style=ACES_DarkToDim10>
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=0.949056010175 0.047185723607 0.003758266219 0 0.019056010175 0.977185723607 0.003758266219 0 0.019056010175 0.047185723607 0.933758266219 0 0 0 0 1, offset=0 0 0 0>
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=0.6522375418862875 0.1282361359997117 0.1699822491656708 0 0.2676721801253363 0.6743399888015512 0.05798783107311251 0 -0.005381815766387645 0.001369060209095833 1.093070506317172 0 0 0 0 1, offset=0 0 0 0>
        <MatrixTransform direction=forward, fileindepth=unknown, fileoutdepth=unknown, matrix=3.240969941904521 -1.537383177570093 -0.4986107602930035 0 -0.9692436362808797 1.87596750150772 0.04155505740717564 0 0.05563007969699365 -0.2039769588889765 1.056971514242879 0 0 0 0 1, offset=0 0 0 0>
        <ExponentTransform direction=inverse, value=2.4 2.4 2.4 1, style=clamp>>
remia commented 8 months ago

@zachlewis any chance this could be solved by https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/1886 ?

Did you try on latest main?

zachlewis commented 7 months ago

This was absolutely solved by #1886 -- thanks Remi!

remia commented 7 months ago

I'll close this then, thanks for confirming Zach.