def __init__(self, parent=None): super(AssetPublisher, self).__init__(parent) self.setWindowTitle("Pillars Assets Publisher") self.resize(600, 600) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.__mainlayout = QtGui.QVBoxLayout() # self.__mainlayout.setContentsMargins(3, 5, 3, 3) self.setLayout(self.__mainlayout) self.__list_tools = QtGui.QToolBar() self.__mainlayout.addWidget(self.__list_tools) self.filter_character = QtGui.QCheckBox("Character") self.filter_property = QtGui.QCheckBox("Property") self.filter_environment = QtGui.QCheckBox("Environment") self.__list_tools.addWidget(self.filter_character) self.__list_tools.addWidget(self.filter_property) self.__list_tools.addWidget(self.filter_environment) self.actList = QtGui.QAction("List By Type", self) self.actList.triggered.connect(self.list) self.__list_tools.addAction(self.actList) self.actListAll = QtGui.QAction("List All", self) self.actListAll.triggered.connect(self.listAll) self.__list_tools.addAction(self.actListAll) self.current_asset_table_model = AssetsTableModel() self.current_asset_table_view = QtGui.QTableView() self.__mainlayout.addWidget(self.current_asset_table_view) self.current_asset_table_view.horizontalHeader().setStretchLastSection(True) self.current_asset_table_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) # self.current_asset_table_view.setSortingEnabled(True) self.current_asset_table_view.setModel(self.current_asset_table_model) # publish model self.__publisher = QtGui.QToolBar() self.__mainlayout.addWidget(self.__publisher) self.puball = QtGui.QCheckBox("Publish All") self.__publisher.addWidget(self.puball) self.actPubMaya = QtGui.QAction("As Maya", self) self.actPubMaya.triggered.connect(self.publishMaya) self.__publisher.addAction(self.actPubMaya) self.actPubObj = QtGui.QAction("As Obj", self) self.actPubObj.triggered.connect(self.publishObj) self.__publisher.addAction(self.actPubObj) self.actPubAbc = QtGui.QAction("As Abc", self) self.actPubAbc.triggered.connect(self.publishAbc) self.__publisher.addAction(self.actPubAbc) self.actPubAss = QtGui.QAction("As Ass", self) self.actPubAss.triggered.connect(self.publishAss) self.__publisher.addAction(self.actPubAss) self.actPublish = QtGui.QAction("Publish", self) self.actPublish.triggered.connect(self.publish) self.__publisher.addAction(self.actPublish)
def __init__(self, parent=None): super(AnimationAssetPublisher, self).__init__(parent) self.setWindowTitle("Pillars Animation Publisher") self.resize(600, 600) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.__mainlayout = QtGui.QVBoxLayout() # self.__mainlayout.setContentsMargins(3, 5, 3, 3) self.setLayout(self.__mainlayout) self.__list_tools = QtGui.QToolBar() self.__mainlayout.addWidget(self.__list_tools) self.filter_character = QtGui.QCheckBox("Character") self.filter_property = QtGui.QCheckBox("Property") self.__list_tools.addWidget(self.filter_character) self.__list_tools.addWidget(self.filter_property) self.__list_tools.addWidget(QtGui.QLabel(">>>")) self.actList = QtGui.QAction("List By Type", self) self.actList.triggered.connect(self.list) self.__list_tools.addAction(self.actList) self.actListAll = QtGui.QAction("List All", self) self.actListAll.triggered.connect(self.listAll) self.__list_tools.addAction(self.actListAll) self.__publish_tools = QtGui.QToolBar() self.__mainlayout.addWidget(self.__publish_tools) self.actSetProjShaderPath = QtGui.QAction("Shader Path:", self) self.actSetProjShaderPath.triggered.connect(self.setPublishPath) self.__publish_tools.addAction(self.actSetProjShaderPath) self.publish_path = QtGui.QLineEdit("") self.__publish_tools.addWidget(self.publish_path) self.__publish_tools.addWidget(QtGui.QLabel(">>>")) self.actPublishAll = QtGui.QAction("Publish All", self) self.actPublishAll.triggered.connect(self.doPublishAll) self.__publish_tools.addAction(self.actPublishAll) self.actPublishSelected = QtGui.QAction("Publish Selected", self) self.actPublishSelected.triggered.connect(self.doPublishSelected) self.__publish_tools.addAction(self.actPublishSelected) self.anim_asset_tm = AssetsTableModel() self.anim_asset_view = QtGui.QTableView() self.__mainlayout.addWidget(self.anim_asset_view) self.anim_asset_view.horizontalHeader().setStretchLastSection(True) self.anim_asset_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) # self.anim_asset_view.setSortingEnabled(True) self.anim_asset_view.setModel(self.anim_asset_tm)
class AnimationAssetPublisher(QtGui.QWidget): def __init__(self, parent=None): super(AnimationAssetPublisher, self).__init__(parent) self.setWindowTitle("Pillars Animation Publisher") self.resize(600, 600) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.__mainlayout = QtGui.QVBoxLayout() # self.__mainlayout.setContentsMargins(3, 5, 3, 3) self.setLayout(self.__mainlayout) self.__list_tools = QtGui.QToolBar() self.__mainlayout.addWidget(self.__list_tools) self.filter_character = QtGui.QCheckBox("Character") self.filter_property = QtGui.QCheckBox("Property") self.__list_tools.addWidget(self.filter_character) self.__list_tools.addWidget(self.filter_property) self.__list_tools.addWidget(QtGui.QLabel(">>>")) self.actList = QtGui.QAction("List By Type", self) self.actList.triggered.connect(self.list) self.__list_tools.addAction(self.actList) self.actListAll = QtGui.QAction("List All", self) self.actListAll.triggered.connect(self.listAll) self.__list_tools.addAction(self.actListAll) self.__publish_tools = QtGui.QToolBar() self.__mainlayout.addWidget(self.__publish_tools) self.actSetProjShaderPath = QtGui.QAction("Shader Path:", self) self.actSetProjShaderPath.triggered.connect(self.setPublishPath) self.__publish_tools.addAction(self.actSetProjShaderPath) self.publish_path = QtGui.QLineEdit("") self.__publish_tools.addWidget(self.publish_path) self.__publish_tools.addWidget(QtGui.QLabel(">>>")) self.actPublishAll = QtGui.QAction("Publish All", self) self.actPublishAll.triggered.connect(self.doPublishAll) self.__publish_tools.addAction(self.actPublishAll) self.actPublishSelected = QtGui.QAction("Publish Selected", self) self.actPublishSelected.triggered.connect(self.doPublishSelected) self.__publish_tools.addAction(self.actPublishSelected) self.anim_asset_tm = AssetsTableModel() self.anim_asset_view = QtGui.QTableView() self.__mainlayout.addWidget(self.anim_asset_view) self.anim_asset_view.horizontalHeader().setStretchLastSection(True) self.anim_asset_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) # self.anim_asset_view.setSortingEnabled(True) self.anim_asset_view.setModel(self.anim_asset_tm) def setPublishPath(self): folder = getDir() self.publish_path.setText(folder) def getPublishPath(self): return unicode(self.publish_path.text()) def list(self): self.anim_asset_tm.clear() current_assets = pcasset.listAssets() for a in current_assets: if self.filter_character.isChecked(): if a.asset_type() == "Character": self.anim_asset_tm.addAsset(a) if self.filter_property.isChecked(): if a.asset_type() == "Property": self.anim_asset_tm.addAsset(a) self.anim_asset_tm.reset() return True def listAll(self): self.filter_character.setChecked(True) self.filter_property.setChecked(True) self.anim_asset_tm.clear() current_assets = pcasset.listAssets() for a in current_assets: self.anim_asset_tm.addAsset(a) self.anim_asset_tm.reset() return True def selectedAssets(self): select_indexs = self.anim_asset_view.selectedIndexes() if not select_indexs: return [] sel_assets = [] for select_index in select_indexs: if select_index.column() == 0: a = self.anim_asset_tm.getAsset(select_index) sel_assets.append(a) return sel_assets def doPublishAll(self): folder = self.getPublishPath() if not folder: return False assets = self.anim_asset_tm.allAsset() pcasset.exportAssetsAsAbc(folder, assets) return True def doPublishSelected(self): folder = self.getPublishPath() if not folder: return False assets = self.selectedAssets() pcasset.exportAssetsAsAbc(folder, assets) return True
class AssetPublisher(QtGui.QWidget): def __init__(self, parent=None): super(AssetPublisher, self).__init__(parent) self.setWindowTitle("Pillars Assets Publisher") self.resize(600, 600) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.__mainlayout = QtGui.QVBoxLayout() # self.__mainlayout.setContentsMargins(3, 5, 3, 3) self.setLayout(self.__mainlayout) self.__list_tools = QtGui.QToolBar() self.__mainlayout.addWidget(self.__list_tools) self.filter_character = QtGui.QCheckBox("Character") self.filter_property = QtGui.QCheckBox("Property") self.filter_environment = QtGui.QCheckBox("Environment") self.__list_tools.addWidget(self.filter_character) self.__list_tools.addWidget(self.filter_property) self.__list_tools.addWidget(self.filter_environment) self.actList = QtGui.QAction("List By Type", self) self.actList.triggered.connect(self.list) self.__list_tools.addAction(self.actList) self.actListAll = QtGui.QAction("List All", self) self.actListAll.triggered.connect(self.listAll) self.__list_tools.addAction(self.actListAll) self.current_asset_table_model = AssetsTableModel() self.current_asset_table_view = QtGui.QTableView() self.__mainlayout.addWidget(self.current_asset_table_view) self.current_asset_table_view.horizontalHeader().setStretchLastSection(True) self.current_asset_table_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) # self.current_asset_table_view.setSortingEnabled(True) self.current_asset_table_view.setModel(self.current_asset_table_model) # publish model self.__publisher = QtGui.QToolBar() self.__mainlayout.addWidget(self.__publisher) self.puball = QtGui.QCheckBox("Publish All") self.__publisher.addWidget(self.puball) self.actPubMaya = QtGui.QAction("As Maya", self) self.actPubMaya.triggered.connect(self.publishMaya) self.__publisher.addAction(self.actPubMaya) self.actPubObj = QtGui.QAction("As Obj", self) self.actPubObj.triggered.connect(self.publishObj) self.__publisher.addAction(self.actPubObj) self.actPubAbc = QtGui.QAction("As Abc", self) self.actPubAbc.triggered.connect(self.publishAbc) self.__publisher.addAction(self.actPubAbc) self.actPubAss = QtGui.QAction("As Ass", self) self.actPubAss.triggered.connect(self.publishAss) self.__publisher.addAction(self.actPubAss) self.actPublish = QtGui.QAction("Publish", self) self.actPublish.triggered.connect(self.publish) self.__publisher.addAction(self.actPublish) def list(self): self.current_asset_table_model.clear() current_assets = pcasset.listAssets() for a in current_assets: if self.filter_character.isChecked(): if a.asset_type() == "Character": self.current_asset_table_model.addAsset(a) if self.filter_property.isChecked(): if a.asset_type() == "Property": self.current_asset_table_model.addAsset(a) if self.filter_environment.isChecked(): if a.asset_type() == "Evnironment": self.current_asset_table_model.addAsset(a) self.current_asset_table_model.reset() return True def listAll(self): self.filter_character.setChecked(True) self.filter_property.setChecked(True) self.filter_environment.setChecked(True) self.current_asset_table_model.clear() current_assets = pcasset.listAssets() for a in current_assets: self.current_asset_table_model.addAsset(a) self.current_asset_table_model.reset() return True def selectedAssets(self): select_indexs = self.current_asset_table_view.selectedIndexes() if not select_indexs: return [] sel_assets = [] for select_index in select_indexs: if select_index.column() == 0: a = self.current_asset_table_model.getAsset(select_index) sel_assets.append(a) return sel_assets def getPublishAssets(self): pub_assets = [] if self.puball.isChecked(): pub_assets = pcasset.listAssets() else: pub_assets = self.selectedAssets() return pub_assets def publishMaya(self): folder = getDir() if not folder: return False assets = self.getPublishAssets() for a in assets: ma_file = os.path.join(folder, a.name(as_file=True) + ".mb") a.exportAsMaya(ma_file) print "Save %s successful." % ma_file return True def publishObj(self): folder = getDir() if not folder: return False assets = self.getPublishAssets() for a in assets: obj_file = os.path.join(folder, a.name(as_file=True) + ".obj") a.exportAsObj(obj_file) print "Save %s successful." % obj_file return True def publishAbc(self): folder = getDir() if not folder: return False assets = self.getPublishAssets() for a in assets: abc_file = os.path.join(folder, a.name(as_file=True) + ".abc") a.exportAsAbc(abc_file) print "Save %s successful." % abc_file return True def publishAss(self): folder = getDir() if not folder: return False assets = self.getPublishAssets() for a in assets: ass_file = os.path.join(folder, a.name(as_file=True) + ".ass") a.exportAsAss(ass_file) print "Save %s successful." % ass_file return True def publish(self): folder = getDir() if not folder: return False assets = self.getPublishAssets() for a in assets: a.exportAll(folder) print "Publish %s successful." % a.name() return True