def init_ui_layout(self): """Inits the specific ui layout for this solution.""" # Calls parent init. super(SolutionJointChainFK, self).init_ui_layout() self.master_node = self.get_node("fit", "master") self.master_node_shape = self.master_node.listRelatives(shapes=True)[0] self.master_node_shape_circle = self.master_node_shape.listConnections(source=True)[0] # To override in each specific solution. Prepare layout items with right values. self.dsp_len = ui.get_child(self.ui_widget, "dsp_len") self.sp_segments = ui.get_child(self.ui_widget, "sp_segments") self.pb_apply = ui.get_child(self.ui_widget, "pb_apply") # Update parameters. if self.is_goal_built("fit"): last_core_node = self.get_node("fit", "core", "^last$") last_core_zt_node = self.get_node("fit", "core", "^lastZT$") if last_core_node and last_core_zt_node: self.dsp_len.setValue(last_core_node.attr("translateY").get() + last_core_zt_node.attr("translateY").get()) segments = self.get_nodes("fit", "core", "segment[0-9]{3,3}$") if segments: self.sp_segments.setValue(len(segments) - 1)
def initUI(self): # Load UI file self.ui = ui.loadUiWidgetFromPyFile(__file__, parent=self) # Layout self.setLayout(QtGui.QVBoxLayout()) self.layout().addWidget(self.ui) self.layout().setSpacing(0) self.layout().setContentsMargins(2, 2, 2, 2) # Store ui elements for use later in signals or functions self.sld_cartoon_level = ui.get_child(self.ui, "sld_cartoon_level") self.rb_drama = ui.get_child(self.ui, "rb_drama") self.rb_comedy = ui.get_child(self.ui, "rb_comedy") self.rb_mistery = ui.get_child(self.ui, "rb_mistery") self.pb_apply = ui.get_child(self.ui, "pb_apply") self.pb_unapply = ui.get_child(self.ui, "pb_unapply") self.pb_para_final = ui.get_child(self.ui, "pb_para_final") # Connect signals self.pb_para_final.clicked.connect(self.make_film) self.pb_apply.clicked.connect(self.make_film) self.pb_unapply.clicked.connect(self.make_film)
def initUI(self): """Initializes the widget UI""" # Color vars # Icons self.solutionNewIcon = icons.getIconByName("solutionNew_16x16.png") self.solutionRemoveIcon = icons.getIconByName("solutionRemove_16x16.png") self.solutionFitIcon = self.solution_manager.get_solution_goal_icon("fit") self.solutionDeformIcon = self.solution_manager.get_solution_goal_icon("deform") self.solutionAnimIcon = self.solution_manager.get_solution_goal_icon("anim") self.solutionImportIcon = icons.getIconByName("solutionImport_16x16.png") self.solutionExportIcon = icons.getIconByName("solutionExport_16x16.png") # Load UI file self.ui = ui.loadUiWidgetFromPyFile(__file__, parent=self) # Layout self.setLayout(QtGui.QVBoxLayout()) self.layout().addWidget(self.ui) self.layout().setSpacing(0) self.layout().setContentsMargins(2, 2, 2, 2) # ------------------------------------------ # SOLUTIONS TAB # Solutions UI init. self.tab_solutions_spliter = ui.get_child(self.ui, "sp_splitter") self.tab_solutions_spliter.setSizes([400, 250]) ui.get_child(self.ui, "pb_solutions_new").setIcon(self.solutionNewIcon) ui.get_child(self.ui, "pb_solutions_delete").setIcon(self.solutionRemoveIcon) ui.get_child(self.ui, "pb_solutions_fit").setIcon(self.solutionFitIcon) ui.get_child(self.ui, "pb_solutions_deform").setIcon(self.solutionDeformIcon) ui.get_child(self.ui, "pb_solutions_anim").setIcon(self.solutionAnimIcon) ui.get_child(self.ui, "pb_solutions_import_preset").setIcon(self.solutionImportIcon) ui.get_child(self.ui, "pb_solutions_export_preset").setIcon(self.solutionExportIcon) self.solution_trees = ui.get_child(self.ui, "tr_solutions") self.header_labels = ["Name"] + self.solution_manager.get_solution_goals() self.solution_trees.setColumnCount(len(self.header_labels)) self.solution_trees.setHeaderLabels(self.header_labels) # self.solution_trees.setColumnHidden(2, True) # self.solution_trees.setColumnWidth(0,200) self.solution_trees.header().setResizeMode(0, QtGui.QHeaderView.Stretch) self.solution_description = ui.get_child(self.ui, "lb_solution_desc") self.solution_widget_layout = ui.get_child(self.ui, "wi_solution_widget").layout() self.solution_channel_box_layout = ui.get_child(self.ui, "wi_channel_box").layout() # Fills the solution trees in the UI. self.fill_solution_trees() # Solutions UI signals. # self.solution_trees.itemSelectionChanged.connect(self.fix_solution_trees_selection) self.solution_trees.itemSelectionChanged.connect(self.select_solutions_nodes) self.solution_trees.itemSelectionChanged.connect(self.load_selected_solution_ui) self.solution_trees.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.solution_trees.customContextMenuRequested.connect(self.solution_trees_menu) # ------------------------------------------ # ------------------------------------------ # UTILS TAB # Utils UI init. self.dsp_joints_display_size = ui.get_child(self.ui, "dsp_joints_display_size") self.dsp_joints_display_size.setValue(pm.jointDisplayScale(q=True)) # Utils UI signals. self.dsp_joints_display_size.valueChanged.connect(self.update_joints_display_size)