def _lut_mode_changed(self, value): if value == "file": if self.file_name: self.load_lut_from_file(self.file_name) # self.lut.force_build() return reverse = self.reverse_lut if value in pylab_luts: lut = pylab_luts[value] if reverse: lut = lut[::-1, :] n_total = len(lut) n_color = self.number_of_colors if not n_color >= n_total: lut = lut[:: round(n_total / float(n_color))] self.load_lut_from_list(lut.tolist()) # self.lut.force_build() return elif value == "blue-red": if reverse: hue_range = 0.0, 0.6667 saturation_range = 1.0, 1.0 value_range = 1.0, 1.0 else: hue_range = 0.6667, 0.0 saturation_range = 1.0, 1.0 value_range = 1.0, 1.0 elif value == "black-white": if reverse: hue_range = 0.0, 0.0 saturation_range = 0.0, 0.0 value_range = 1.0, 0.0 else: hue_range = 0.0, 0.0 saturation_range = 0.0, 0.0 value_range = 0.0, 1.0 lut = self.lut lut.set( hue_range=hue_range, saturation_range=saturation_range, value_range=value_range, number_of_table_values=self.number_of_colors, ramp="sqrt", ) lut.modified() lut.force_build() self.render()
def _lut_mode_changed(self, value): if value == 'file': if self.file_name: self.load_lut_from_file(self.file_name) #self.lut.force_build() return reverse = self.reverse_lut if value in pylab_luts: lut = pylab_luts[value] if reverse: lut = lut[::-1, :] n_total = len(lut) n_color = self.number_of_colors if not n_color >= n_total: lut = lut[::round(n_total / float(n_color))] self.load_lut_from_list(lut.tolist()) #self.lut.force_build() return elif value == 'blue-red': if reverse: hue_range = 0.0, 0.6667 saturation_range = 1.0, 1.0 value_range = 1.0, 1.0 else: hue_range = 0.6667, 0.0 saturation_range = 1.0, 1.0 value_range = 1.0, 1.0 elif value == 'black-white': if reverse: hue_range = 0.0, 0.0 saturation_range = 0.0, 0.0 value_range = 1.0, 0.0 else: hue_range = 0.0, 0.0 saturation_range = 0.0, 0.0 value_range = 0.0, 1.0 lut = self.lut lut.set(hue_range=hue_range, saturation_range=saturation_range, value_range=value_range, number_of_table_values=self.number_of_colors, ramp='sqrt') lut.modified() lut.force_build() self.render()