def onFrameChangeAndAddSource(self, event): ''' do the main updates in here first update the gui with the current settings from the RVColor Node then connect to the gui change events update procedures on the RVColor Node ''' node = self.getCurrentColorNode() if node == self.node: return #we do not have to run updates if we are still on the same color node as all connections are set else: self.node=node ##this seems to not be working as the color active is not a per node setting ?! need to ask support if int(commands.getIntProperty("%s.color.active" % self.node,0,2500)[0]) == int(1): self.active.setCheckState(QtCore.Qt.Checked) else: self.active.setCheckState(QtCore.Qt.Unchecked) self.updateSpinBoxes('scale', [x for x in commands.getFloatProperty("%s.color.scale" % self.node,0,2500)]) self.updateSpinBoxes('gamma', [x for x in commands.getFloatProperty("%s.color.gamma" % self.node,0,2500)]) self.updateSpinBoxes('exposure', [x for x in commands.getFloatProperty("%s.color.exposure" % self.node,0,2500)]) self.updateSpinBoxes('offset', [x for x in commands.getFloatProperty("%s.color.offset" % self.node,0,2500)]) self.updateSpinBoxes('saturation', [x for x in commands.getFloatProperty("%s.color.saturation" % self.node,0,2500)]) self.active.released.connect(self.checkBoxPressed(self.active, "%s.color.active" % self.node)) self.invert.released.connect(self.checkBoxPressed(self.invert, "%s.color.invert" % self.node)) for gamma in self.gamma: gamma.valueChanged.connect(lambda: self.changeRvColorFromSpinBox("gamma")) for scale in self.scale: scale.valueChanged.connect(lambda: self.changeRvColorFromSpinBox("scale")) for offset in self.offset: offset.valueChanged.connect(lambda: self.changeRvColorFromSpinBox("offset")) for exp in self.exposure: exp.valueChanged.connect(lambda: self.changeRvColorFromSpinBox("exposure")) self.saturation.valueChanged.connect(self.changeSat)
def onGraphStateChange(self,event): x = event.contents() #y = event.contentType() print x self.node = self.getCurrentColorNode() for gamma in self.gamma: try: gamma.valueChanged.disconnect(lambda: self.changeRvColorFromSpinBox("gamma")) except: pass #self.updateSpinBoxes('scale', [x for x in commands.getFloatProperty("%s.color.scale" % self.node,0,2500)]) self.updateSpinBoxes('gamma', [x for x in commands.getFloatProperty("%s.color.gamma" % self.node,0,2500)]) #self.updateSpinBoxes('exposure', [x for x in commands.getFloatProperty("%s.color.exposure" % self.node,0,2500)]) #self.updateSpinBoxes('offset', [x for x in commands.getFloatProperty("%s.color.offset" % self.node,0,2500)]) for gamma in self.gamma: gamma.valueChanged.connect(lambda: self.changeRvColorFromSpinBox("gamma"))
def update_tree(self): sources = Model.get_sources() for source in sources: group = source.get_group() group_item = QtGui.QTreeWidgetItem([group.get_media_name()]) self.tree.addTopLevelItem(group_item) group_item.setExpanded(True) nodes = group.get_nodes() for node in nodes: node_item = QtGui.QTreeWidgetItem([node.nice_name]) group_item.addChild(node_item) attrs = node.get_attrs() if attrs: attrs_item = QtGui.QTreeWidgetItem(['Source Attributes']) for attr in attrs: attr_item = QtGui.QTreeWidgetItem([attr[0], ', '.join(attr[1:])]) attrs_item.addChild(attr_item) node_item.addChild(attrs_item) properties = node.get_properties() for prop in properties: item_class = PROP_WIDGET_ITEM_MAP[prop.get_type()] prop_item = QtGui.QTreeWidgetItem([prop.nice_name, '']) prop_item_widget = item_class(prop.name, prop.get_values()) node_item.addChild(prop_item) self.tree.setItemWidget(prop_item, 1, prop_item_widget) # I can't figure out how to list the color nodes' properties # so do it manually for now using #RVColor # for prop_find in prop.get_values(): if not prop_find == 'RVColor': continue for col_prop in ['exposure', 'gamma', 'saturation', 'contrast']: prop_name = '#RVColor.color.' + col_prop values = commands.getFloatProperty(prop_name, 0, 4) col_item = QtGui.QTreeWidgetItem([col_prop, '']) prop_item.addChild(col_item) item_class = PROP_WIDGET_ITEM_MAP[1] prop_item_widget = item_class(prop_name, values) self.tree.setItemWidget(col_item, 1, prop_item_widget)
def set_widgets(self, *args): values = commands.getFloatProperty('#RVColor.color.exposure', 0, 4) self.gainMasterDoubleSpinBox.setValue(values[0]) self.gainMasterHorizontalSlider.setValue(values[0])