Skip to content

Commit

Permalink
Fixed bugs related to displaying colors and table selection
Browse files Browse the repository at this point in the history
  • Loading branch information
theRussetPotato committed Aug 23, 2019
1 parent 8899279 commit 6df622c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions scripts/weights_editor_tool/weights_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def __init__(self, parent=None):
# Any other keys will give focus to Maya
self.accept_keys = [ord(char) for char in [">", "<", " ", "S", "E", "A", "R"]]

self.settings_path = os.path.join(os.getenv("HOME"), "maya", "_userSettings", "weights_editor.json")
self.settings_path = os.path.join(os.getenv("HOME"), "maya", "weights_editor.json")

self.create_gui()
self.setup_gui()
Expand Down Expand Up @@ -414,9 +414,10 @@ def create_gui(self):

preset_button = QtWidgets.QPushButton("{0}".format(value), parent=self.central_widget)
preset_button.setMinimumWidth(50)
preset_button.setStyleSheet("QPushButton {background-color:rgb(%s, %s, %s)}" % (button_color.red(),
button_color.green(),
button_color.blue()))
preset_button.setStyleSheet("QPushButton {background-color:rgb(%s, %s, %s)}" % (
button_color.red(),
button_color.green(),
button_color.blue()))
if value > 0:
tooltip = "Add {0} on selected cells.".format(value)
else:
Expand Down Expand Up @@ -1075,7 +1076,11 @@ def recollect_table_data(self, update_skin_data=True, update_verts=True,
self.load_table_selection(selection_data)

self.resize_columns()


utils.toggle_display_colors(
current_obj,
not self.hide_colors_button.isChecked() and cmds.selectMode(q=True, component=True))

self.ignore_cell_selection_event = False

def edit_weights(self, indexes, input_value, mode):
Expand All @@ -1099,7 +1104,10 @@ def edit_weights(self, indexes, input_value, mode):
for index in indexes:
row = index.row()
column = index.column()


if column > len(self.display_infs) - 1:
continue

vert_index = self.vert_indexes[row]
inf_name = self.display_infs[column]
weight_data = new_skin_data[vert_index]["weights"]
Expand Down Expand Up @@ -1589,7 +1597,7 @@ def cell_selection_on_changed(self):

def hide_colors_on_clicked(self):
current_obj = self.get_obj_by_name(self.obj)
if current_obj is not None and self._in_component_mode:
if current_obj is not None and cmds.selectMode(q=True, component=True):
hide_colors = self.hide_colors_button.isChecked()
utils.toggle_display_colors(current_obj, not hide_colors)

Expand Down Expand Up @@ -1814,6 +1822,7 @@ def sort_vert_order_on_triggered(self):


def run():
global tool
tool = WeightsEditor()
tool.show()
return tool
return tool

0 comments on commit 6df622c

Please sign in to comment.