(*args, **kwargs)
| 114 | |
| 115 | |
| 116 | def SelectCCCIDPanel(*args, **kwargs): |
| 117 | # Wrap class definition in a function, so nukescripts.PythonPanel |
| 118 | # is only accessed when ``SelectCCCIDPanel()`` is called, |
| 119 | # https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/277 |
| 120 | |
| 121 | import nukescripts |
| 122 | |
| 123 | class _SelectCCCIDPanel(nukescripts.PythonPanel): |
| 124 | """Allows the user to select from a list of CDLTransform |
| 125 | objects |
| 126 | """ |
| 127 | |
| 128 | def __init__(self, allcdl): |
| 129 | super(_SelectCCCIDPanel, self).__init__() |
| 130 | self.available = {} |
| 131 | for cur in allcdl: |
| 132 | self.available[cur.getID()] = cur |
| 133 | |
| 134 | self.addKnob(nuke.Enumeration_Knob("cccid", "cccid", self.available.keys())) |
| 135 | self.addKnob(nuke.Text_Knob("divider")) |
| 136 | self.addKnob(nuke.Color_Knob("slope")) |
| 137 | self.addKnob(nuke.Color_Knob("offset")) |
| 138 | self.addKnob(nuke.Color_Knob("power")) |
| 139 | self.addKnob(nuke.Double_Knob("saturation")) |
| 140 | |
| 141 | def selected(self): |
| 142 | return self.available[self.knobs()['cccid'].value()] |
| 143 | |
| 144 | def knobChanged(self, knob): |
| 145 | """When the user selects a cccid, a grade-preview knobs are set. |
| 146 | |
| 147 | This method is triggered when any knob is changed, which has the |
| 148 | useful side-effect of preventing changing the preview values, while |
| 149 | keeping them selectable for copy-and-paste. |
| 150 | """ |
| 151 | _cdltransform_to_node(self.selected(), self.knobs()) |
| 152 | |
| 153 | return _SelectCCCIDPanel(*args, **kwargs) |
| 154 | |
| 155 | |
| 156 | def export_as_cc(node = None, filename = None): |
no test coverage detected