def on_item_spinbox_changed(self, item, value):
        value = round(value, 2)
        mode = ZlmLayerMode.active
        if value < 0.000001:
            value = 0
            mode = ZlmLayerMode.off
        if value > 1.0:
            value = 1.0
            mode = ZlmLayerMode.active

        if self.current_item_recording:
            self.current_item_recording.layer.mode = ZlmLayerMode.active
            self.current_item_recording = None

        for i in self.selectedItems():
            if i.layer != item.layer:
                i.intensity_widget.set_intensity(value)
                i.mode_widget.setMode(mode)
                i.layer.intensity = value
                i.layer.mode = mode

        item.layer.intensity = value
        item.layer.mode = mode
        item.mode_widget.setMode(mode)

        send_to_zbrush()
    def on_item_slider_pressed(self, item, value):
        value = round(value, 2)
        if value < 0.000001:
            value = 0
        if value > 1.0:
            value = 1.0

        self._selected_items = self.selectedItems()
        self._selected_layers = [i.layer for i in self._selected_items]

        try:
            self._selected_items.remove(item)
        except Exception as e:
            self._selected_layers.append(item.layer)

        for i in self._selected_items:
            i.intensity_widget.set_intensity(value)

        for l in self._selected_layers:
            l.intensity = value

        # If there is an item recording deactivate it for now
        if self.current_item_recording:
            self.current_item_recording.layer.mode = ZlmLayerMode.active

        send_to_zbrush()
    def on_item_mode_changed(self, item, mode):
        column = self.sortColumn()
        if column == 2:
            order = self.header().sortIndicatorOrder()
            self.setSortingEnabled(False)

        if mode == ZlmLayerMode.record:
            if self.current_item_recording:
                self.current_item_recording.layer.mode = ZlmLayerMode.active
                # current item recording might be deleted if filter was used
                try:
                    self.current_item_recording.mode_widget.setMode(
                        ZlmLayerMode.active)
                except:
                    pass
            self.current_item_recording = item
            item.layer.mode = mode
        else:
            selectedItems = self.selectedItems()
            if selectedItems:
                for i in selectedItems:
                    if self.current_item_recording and self.current_item_recording == i:
                        self.current_item_recording = None
                    i.layer.mode = mode
                    i.mode_widget.setMode(mode)
            item.layer.mode = mode
            if self.current_item_recording and self.current_item_recording == item:
                self.current_item_recording = None

        if column == 2:
            self.setSortingEnabled(True)
            self.sortByColumn(column, order)

        send_to_zbrush()
 def on_preset_activated(self):
     preset = self.get_current_preset()
     if preset is not None:
         # to avoid any error in preset file.
         try:
             zlm_core.apply_preset(preset)
         except:
             pass
         self.preset_activated.emit()
         zlm_to_zbrush.send_to_zbrush()
    def on_item_slider_released(self, item, value):
        value = round(value, 2)
        if value < 0.000001:
            value = 0
        if value > 1.0:
            value = 1.0

        # If there was an item recording reactivate it
        if self.current_item_recording:
            self.current_item_recording.layer.mode = ZlmLayerMode.record

        for l in self._selected_layers:
            l.intensity = value

        send_to_zbrush()
Esempio n. 6
0
 def turn_all_off(self):
     for layer in zlm_core.main_layers.instances_list:
         layer.mode = 0
     self.tree_widget.update_layer()
     send_to_zbrush()