def delete(self, value): """Command used to delete a maya scene based on the asset data.""" if settings.DEFAULT_FILE_FORMAT == 'Maya Ascii': self.asset.save_config.command = command.get_command( "delete", "Maya Ascii") elif settings.DEFAULT_FILE_FORMAT == 'Maya Binary': self.asset.save_config.command = command.get_command( 'delete', 'Maya Binary') self.asset.save_config.execute_command()
def open(self, value): """Command used to open a maya scene based on the asset data.""" if settings.DEFAULT_FILE_FORMAT == 'Maya Ascii': self.asset.save_config.command = command.get_command( 'open', 'Maya Ascii') elif settings.DEFAULT_FILE_FORMAT == 'Maya Binary': self.asset.save_config.command = command.get_command( 'open', 'Maya Binary') self.asset.save_config.execute_command()
def __init__(self, has_type=False, asset_type="non", has_name=False, name="unamed", has_variant=False, variant=1, has_scene=False, scene=10, has_shot=False, shot=10, has_version=False, version=1, save_config=None, publish_config=None, export_config=None): data_binding.CBindable.__init__(self) self._has_type = has_type self._type = asset_type self._has_name = has_name self._name = name self._has_variant = has_variant self._variant = variant self._has_scene = has_scene self._scene = scene self._has_shot = has_shot self._shot = shot self._has_version = has_version self._version = version if save_config: self._save_config = save_config else: self._save_config = CConfiguration("save", self,\ file_name_generator_function=naming_convention.generate_file_name_for_saved_asset,\ path_generator_function=naming_convention.generate_path_for_saved_asset,\ default_command=command.get_command('save', settings.DEFAULT_FILE_FORMAT),\ ) if publish_config: self._publish_config = publish_config else: self._publish_config = CConfiguration("publish", self,\ file_name_generator_function=naming_convention.generate_file_name_for_published_asset,\ path_generator_function=naming_convention.generate_path_for_published_asset,\ default_command=command.get_command('publish', settings.DEFAULT_FILE_FORMAT),\ ) if export_config: self._export_config = export_config else: self._export_config = CConfiguration("export", self,\ file_name_generator_function=naming_convention.generate_file_name_for_exported_asset,\ path_generator_function=naming_convention.generate_path_for_exported_asset,\ default_command=command.get_command('export', settings.DEFAULT_FILE_FORMAT),\ )
def batch_publish_maya_ascii(): """Publish all selected objects using Maya Ascii publish command.""" selection = cmds.ls(sl=True) for element in selection: asset = scene_name_parser.parse_string_to_asset(element) cmds.select(cl=True) cmds.select(element, add=True) asset.publish_config.command = command.get_command( 'publish', 'Maya Ascii') asset.publish_config.executeCommand()
def open_export_path_explorer(self, value): """Command used to open the asset's export configuration path in the Explorer.""" self.asset.export_config.command = command.get_command( "open", "Explorer") self.asset.export_config.execute_command()
def set_export_config_command(self, value): """Command used to set the asset's export configuration command based on a given value.""" self.asset.export_config.command = command.get_command("export", value) print self.asset.export_config.command.name
def set_publish_config_command(self, value): """Command used to set the asset's publish configuration command based on a given value.""" self.asset.publish_config.command = command.get_command( "publish", value) print self.asset.publish_config.command.name
def set_save_config_command(self, value): """Command used to set the asset's save configuration command based on a given value.""" self.asset.save_config.command = command.get_command("save", value) print self.asset.save_config.command.name