def save_crv(self): """ Save selected curve under selected name. If no name given, use crv name. :return: """ # Get data from ui data = self.get_ui_data() # get selection selection = Mgu.get_selection() # get the name of the curve crv_name = selection[0] if data['new_shape_name']: crv_type = data['new_shape_name'] else: crv_type = crv_name crv_dict = Mcu.get_crv_info(crv_name) self.crv_data[crv_type] = crv_dict fu.FileSystem.save_to_json(self.crv_data, DICTS_PATH) self.crv_list = self.create_crv_list() UIu.update_combobox(self.curve_cbB, self.crv_list) UIu.update_combobox(self.curve_to_delete_cbB, self.crv_list) return
def move_even_obj(self): data = self.get_data() selection = Mgu.get_selection() Mmu.move_even(selection, data['translate'], data['rotate'], data['scale'], data['world_space'], data['mirror'], data['mirror_axis'], data['behavior'])
def rename(self): search = self.search.text() replace = self.replace.text() prefix = self.prefix.text() main_name = self.main_name.text() suffix = self.suffix.text() selection = gu.get_selection() name_utils.rename(selection, prefix, main_name, suffix, search, replace)
def constrain_even(self): data = self.get_data() selection = Mgu.get_selection() for i, obj in enumerate(selection): if i % 2 == 0: Mmu.constrain(constraint_type=data['constraint_type'], targets=[selection[i]], source=selection[i + 1], aim_vector=data['aim_vector'], up_vector=data['up_vector'], maintain_offset=data['maintain_offset'], skip=(data['skip_translation'], data['skip_rotation'], data['skip_scale']))
def constrain(self): data = self.get_data() selection = Mgu.get_selection() if data['constraint_type'] == 'Mirror selected': targets = selection source = '' elif len(selection) > 1: targets = selection[:-1] source = selection[-1] else: print 'You need to select at least 2 objects to constrain', return Mmu.constrain(constraint_type=data['constraint_type'], targets=targets, source=source, aim_vector=data['aim_vector'], up_vector=data['up_vector'], maintain_offset=data['maintain_offset'], skip=(data['skip_translation'], data['skip_rotation'], data['skip_scale']))
def create_crv_from_ui(self): """ Create curve(s) using ui data :return: """ Mgu.open_undo_chunk() # Get data from ui data = self.get_ui_data() selection = Mgu.get_selection() name = nu.create_name(main_name=data['name']) print name crv_dict = self.crv_data[data['crv_type']] Mcu.create_edit_crv(selection, crv_dict, name, create_orig=data['create_orig'], axis=data['axis'], mirror=data['mirror']) Mgu.close_undo_chunk()
def edit_crv_from_ui(self): """ Edit curve(s) using ui data :return: """ Mgu.open_undo_chunk() # Get data from ui data = self.get_ui_data() selection = Mgu.get_selection() crv_dict = self.crv_data[data['crv_type']] if data['remove_shape']: add = False else: add = True Mcu.create_edit_crv(selection, crv_dict, 'ctrl', edit=True, add=add, axis=data['axis'], mirror=data['mirror']) Mgu.close_undo_chunk()