diff --git a/layout_tool/__init__.py b/layout_tool/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2afa335246a170bd524e0d2f76033f3e19a0ff47 100644 --- a/layout_tool/__init__.py +++ b/layout_tool/__init__.py @@ -0,0 +1,3 @@ +import os + +here = os.path.dirname(os.path.realpath(__file__)) diff --git a/layout_tool/api/scene.py b/layout_tool/api/scene.py index e1b928bfb8d1f82ea0f89235742ac9afa3255dfd..f8856d984f88f769ad4551bcf89b4401eb993af8 100644 --- a/layout_tool/api/scene.py +++ b/layout_tool/api/scene.py @@ -1,45 +1,140 @@ import modo +import lxifc +import lx from PySide.QtGui import QApplication +# get next id name should be part of utils -scene = modo.Scene() -filename = scene.filename +def get_parent_window(): + app = QApplication.instance() + for obj in app.topLevelWidgets(): + if ( + obj.inherits("QMainWindow") + and obj.metaObject().className() == "LUXQt::LUXWindow" + ): + return obj -MESH_TYPE = "mesh" -GROUP_TYPE = "groupLocator" -KNOWN_TYPES = [MESH_TYPE, GROUP_TYPE] +def get_next_id_name(name, pos_list): + if name in pos_list: + old_id = name.split("_")[2] + new_id = str(int(old_id) + 1).zfill(2) + name = name.replace(old_id, new_id) + return get_next_id_name(name, pos_list) + else: + pos_list.append(name) + return name +class RepEnumVis(lxifc.Visitor): + def __init__(self, repEnum, asset): + self.enum = repEnum + self.asset = asset + self.count = 0 + self.locator_list = [] -def get_items(type_=None): - """Get all items for the scene""" - if type_ is not None and type_ not in KNOWN_TYPES: - raise AttributeError("{Unknown item type: {}".format(type)) + def vis_Evaluate(self): + self.count += 1 + source = self.enum.Item().Name().split("_")[0] + loc = self.asset + "_" + source + "_01_POS" + loc_name = get_next_id_name(loc, self.locator_list) + self.locator_list.append(loc_name) - return [_serialize_item(i) for i in scene.items(type_)] +class LayoutManagerModel(): + def __init__(self, object_name): + self.group = object_name + self.scene = modo.Scene() + self.object_name = object_name + self.asset_name = object_name.split("_")[0] -def get_meshes(): - """Shortcut function for meshes""" - return get_items(MESH_TYPE) + self.asset_group = self.get_asset_group() + def get_child_assets(self): + assets = self.get_child_assets_from_POS() + assets += self.get_child_assets_from_REP() + return assets -def _serialize_item(item): - """Format Modo Item object into a regular dict""" - if not item: - return + def get_asset_group(self): + try: + self.scene.item(self.object_name) + except LookupError: + return False + else: + return self.scene.item(self.object_name) - return { - "name": item.name, - "id": item.id, - "base_name": item.baseName, - "parent": _serialize_item(item.parent), - } + def get_meshes(self): + meshes = [] + for each in self.asset_group.children(True): + if each.type == "mesh": + if self.check_for_parent(each): + meshes.append(each.name) + return meshes + def check_for_parent(self, item): + asset = item.name.split("_")[0] + parent = item.parent + if parent.name == self.asset_group.name: + return True + elif asset in parent.name and parent.name.endswith("POS"): + return False + else: + return self.check_for_parent(item.parent) -def get_parent_window(): - app = QApplication.instance() - for obj in app.topLevelWidgets(): - if ( - obj.inherits("QMainWindow") - and obj.metaObject().className() == "LUXQt::LUXWindow" - ): - return obj \ No newline at end of file + def get_child_assets_from_POS(self): + asset_data_list = [] + for each in self.asset_group.children(True): + if each.type == "locator" and each.name.endswith("POS"): + asset_dict = {} + collection_name = each.name.split("_")[1] + if each.childCount() == 0: + collection_type = "position" + elif "source" in each.children()[0].itemGraphNames: + collection_type = "instance" + else: + collection_type = "mesh" + if not any(d.get('Name') == collection_name for d in asset_data_list): + asset_dict["Name"] = collection_name + asset_dict["Source"] = collection_name + asset_dict["Type"] = collection_type + asset_dict["Count"] = 1 + asset_dict["Locators"] = [each.name] + asset_data_list.append(asset_dict) + else: + child_asset = next((item for item in asset_data_list if item['Name'] == collection_name), None) + count = child_asset["Count"] + child_asset["Count"] = count + 1 + child_asset["Locators"].append(each.name) + return asset_data_list + + def get_child_assets_from_REP(self): + asset_data_list = [] + for rep in self.asset_group.children(True): + if rep.type == "replicator" and rep.name.endswith("REP"): + asset_dict = {} + for each in rep.itemGraph("particle").forward(): + if each == rep.itemGraph("particle").forward()[0]: #If it's the first one + collection_name = each.name.split("_")[0] + else: + collection_name += "/" + each.name.split("_")[0] + chan_read = self.scene.Channels(None, 0.0) + enum = lx.service.Particle().GetReplicatorEnumerator(rep) + vis = RepEnumVis(enum, self.asset_name) + enum.Enumerate(vis, chan_read, 0) + collection_count = vis.count + locator_list = vis.locator_list + collection_type = "replicator" + asset_dict["Name"] = rep.name + asset_dict["Source"] = collection_name + asset_dict["Type"] = collection_type + asset_dict["Count"] = collection_count + asset_dict["Locators"] = locator_list + asset_data_list.append(asset_dict) + return asset_data_list + + def get_next_id_name(self, name, pos_list): + if name in pos_list: + old_id = name.split("_")[2] + new_id = str(int(old_id) + 1).zfill(2) + name = name.replace(old_id, new_id) + return self.get_next_id_name(name, pos_list) + else: + pos_list.append(name) + return name diff --git a/layout_tool/app.py b/layout_tool/app.py index f6b8d7b76f098fbc15c76489cdf1e59d91612172..88954f0f8b7b74b11a4d80832fcd475a9fb4b042 100644 --- a/layout_tool/app.py +++ b/layout_tool/app.py @@ -1,7 +1,8 @@ #!/usr/bin/python from .ui import View from .constants import NAME, DISPLAY_NAME -import api.scene +from api.scene import LayoutManagerModel +from api.scene import get_parent_window class LayoutTool: @@ -9,21 +10,24 @@ class LayoutTool: display_name = DISPLAY_NAME def __init__(self): - items = self.get_scene_items() + # items = self.get_scene_items() + self.model = LayoutManagerModel("OfficeA_GRP") + group_name = self.model.asset_group.name + + parent = self.get_parent_window() self.view = View(parent, self) - self.view.load(items) + self.view.load_meshes(self.model.get_meshes()) + self.view.load_child_assets(self.model.get_child_assets()) self.view.show() - @staticmethod - def get_scene_meshes(): - return api.scene.get_meshes() - - @staticmethod - def get_scene_items(): - return api.scene.get_items() + def refresh(self): + print self.view.get_changes() + self.view.clear() + self.view.load_meshes(self.model.get_meshes()) + self.view.load_child_assets(self.model.get_child_assets()) @staticmethod def get_parent_window(): - return api.scene.get_parent_window() + return get_parent_window() diff --git a/layout_tool/assets/I_icon_blue.png b/layout_tool/assets/I_icon_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..37b7bbd29e10d833a7b5be2778152917a22bf6b3 Binary files /dev/null and b/layout_tool/assets/I_icon_blue.png differ diff --git a/layout_tool/assets/I_icon_green.png b/layout_tool/assets/I_icon_green.png new file mode 100644 index 0000000000000000000000000000000000000000..227986128c324e800e45e5c3104593fbe43f064b Binary files /dev/null and b/layout_tool/assets/I_icon_green.png differ diff --git a/layout_tool/assets/I_icon_grey.png b/layout_tool/assets/I_icon_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..fe8eb54d5aefc161cf0c17af28e6901e2363af5d Binary files /dev/null and b/layout_tool/assets/I_icon_grey.png differ diff --git a/layout_tool/assets/I_icon_red.png b/layout_tool/assets/I_icon_red.png new file mode 100644 index 0000000000000000000000000000000000000000..81ffa78711dae4877c9371ac5972076d8b2c5866 Binary files /dev/null and b/layout_tool/assets/I_icon_red.png differ diff --git a/layout_tool/assets/I_icon_white.png b/layout_tool/assets/I_icon_white.png new file mode 100644 index 0000000000000000000000000000000000000000..bb6a907562a89ee97fe0db06d502d02c04a948b1 Binary files /dev/null and b/layout_tool/assets/I_icon_white.png differ diff --git a/layout_tool/assets/M_icon_blue.png b/layout_tool/assets/M_icon_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..07a02bfa3ca7a13bc590b8798e048222fa265d6f Binary files /dev/null and b/layout_tool/assets/M_icon_blue.png differ diff --git a/layout_tool/assets/M_icon_green.png b/layout_tool/assets/M_icon_green.png new file mode 100644 index 0000000000000000000000000000000000000000..8b46f5ef5aa7eca551830012ec20ad48d4c5cc93 Binary files /dev/null and b/layout_tool/assets/M_icon_green.png differ diff --git a/layout_tool/assets/M_icon_grey.png b/layout_tool/assets/M_icon_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..cead4da5d635b9c112cf4f3f05b968d39a74ce53 Binary files /dev/null and b/layout_tool/assets/M_icon_grey.png differ diff --git a/layout_tool/assets/M_icon_red.png b/layout_tool/assets/M_icon_red.png new file mode 100644 index 0000000000000000000000000000000000000000..b631d142f6ef34f0b6e1b68bc9b964207ca9ea72 Binary files /dev/null and b/layout_tool/assets/M_icon_red.png differ diff --git a/layout_tool/assets/M_icon_white.png b/layout_tool/assets/M_icon_white.png new file mode 100644 index 0000000000000000000000000000000000000000..088c5c47ee884fd1cec460b4bbe21bc8eda5a207 Binary files /dev/null and b/layout_tool/assets/M_icon_white.png differ diff --git a/layout_tool/assets/R_icon_blue.png b/layout_tool/assets/R_icon_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..7d821efa8eaada1a51746178a5a067d40faecd42 Binary files /dev/null and b/layout_tool/assets/R_icon_blue.png differ diff --git a/layout_tool/assets/R_icon_green.png b/layout_tool/assets/R_icon_green.png new file mode 100644 index 0000000000000000000000000000000000000000..aaa625ff8b8b92ef64d4ccb4de09fe0c48fb476a Binary files /dev/null and b/layout_tool/assets/R_icon_green.png differ diff --git a/layout_tool/assets/R_icon_grey.png b/layout_tool/assets/R_icon_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..e2636eea334b1f6ca43b176a12d4cef0078f4d9e Binary files /dev/null and b/layout_tool/assets/R_icon_grey.png differ diff --git a/layout_tool/assets/R_icon_red.png b/layout_tool/assets/R_icon_red.png new file mode 100644 index 0000000000000000000000000000000000000000..78fde6904ec2ceaa0d338164bfd544486631a67d Binary files /dev/null and b/layout_tool/assets/R_icon_red.png differ diff --git a/layout_tool/assets/R_icon_white.png b/layout_tool/assets/R_icon_white.png new file mode 100644 index 0000000000000000000000000000000000000000..0f2acd1b7d3b3bd8675bf47aaab8694054369cbd Binary files /dev/null and b/layout_tool/assets/R_icon_white.png differ diff --git a/layout_tool/assets/check.png b/layout_tool/assets/check.png new file mode 100644 index 0000000000000000000000000000000000000000..c0007d8a9913f3bd2424c569c4e365a82e59be7b Binary files /dev/null and b/layout_tool/assets/check.png differ diff --git a/layout_tool/assets/refresh_grey.png b/layout_tool/assets/refresh_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..4feb84aa1593e4a19083ab9e3d9413d9d2ffb71e Binary files /dev/null and b/layout_tool/assets/refresh_grey.png differ diff --git a/layout_tool/assets/refresh_white.png b/layout_tool/assets/refresh_white.png new file mode 100644 index 0000000000000000000000000000000000000000..cfbde7d72e554079c8de5b5dbc8fe49429e060a2 Binary files /dev/null and b/layout_tool/assets/refresh_white.png differ diff --git a/layout_tool/assets/right_arrow_grey.png b/layout_tool/assets/right_arrow_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..ec3b611e7c78a17be6de9883b0dcc87c2f556591 Binary files /dev/null and b/layout_tool/assets/right_arrow_grey.png differ diff --git a/layout_tool/assets/right_arrow_white.png b/layout_tool/assets/right_arrow_white.png new file mode 100644 index 0000000000000000000000000000000000000000..88a2facd48bf7077d0cb282555880e5236c440e7 Binary files /dev/null and b/layout_tool/assets/right_arrow_white.png differ diff --git a/layout_tool/assets/stylesheet.css b/layout_tool/assets/stylesheet.css new file mode 100644 index 0000000000000000000000000000000000000000..b88498f8a73a1bb9be119ba6b276583754c18848 --- /dev/null +++ b/layout_tool/assets/stylesheet.css @@ -0,0 +1,160 @@ +QWidget{ + color: #e6e6e6; + background-color : #292929; +} + +QWidget#base{ + background-color : #292929; + color: #e6e6e6; + font-family: "Roboto"; + font-color: #e6e6e6; +} + +QFrame#asset{ + border: 1px solid #707070; + border-radius: 4px; +} + +QFrame#emptyasset{ + border: 1px solid #707070; + border-radius: 4px; + background-color : #4a2c33; +} + +QFrame{ + background-color : #292929; + font-family: "Roboto"; +} + +QComboBox{ + background-color: #424242; +} + +QListWidget{ + background-color: #424242; + border-radius: 4px; + font-size: 10pt; +} + +QListView::item:selected:active { + background: #e6e6e6; + color: #5c57ff; +} + + +QLabel{ + background: transparent; + font-size: 10pt; +} + +QLabel#title{ + background: transparent; + font-size: 14pt; +} + +QLineEdit{ + background-color: #424242; + color: white; + border-radius: 2px; + +} +QFrame#asset{ + border: 1px solid #707070; + border-radius: 4px; +} + +QFrame#emptyasset{ + border: 1px solid #707070; + border-radius: 4px; + background-color : #33cc355b; +} + +QPushButton{ + border: 0px; + width: 15px; + height: 15px; + border-radius: 12px; + background-color: #5c57ff; +} + +QPushButton#expand{ + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/right_arrow_grey.png") +} + +QPushButton#refresh{ + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/refresh_grey.png") +} + +QPushButton#expand::hover{ + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/right_arrow_white.png") +} + +QPushButton#refresh::hover{ + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/refresh_white.png") +} + +QRadioButton { + background: transparent; +} + +QRadioButton::indicator { + width: 25px; + height: 25px; + background: transparent; + border: 0px; +} + +QRadioButton#mesh::indicator::unchecked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/M_icon_grey.png") +} +QRadioButton#instance::indicator::unchecked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/I_icon_grey.png") +} +QRadioButton#replicator::indicator::unchecked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/R_icon_grey.png") +} + +QRadioButton#meshcurrent::indicator::unchecked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/M_icon_red.png") +} +QRadioButton#instancecurrent::indicator::unchecked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/I_icon_red.png") +} +QRadioButton#replicatorcurrent::indicator::unchecked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/R_icon_red.png") +} + +QRadioButton#mesh::indicator::checked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/M_icon_green.png") +} +QRadioButton#instance::indicator::checked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/I_icon_green.png") +} +QRadioButton#replicator::indicator::checked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/R_icon_green.png") +} + +QRadioButton#meshcurrent::indicator::checked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/M_icon_blue.png"); +} +QRadioButton#instancecurrent::indicator::checked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/I_icon_blue.png"); +} +QRadioButton#replicatorcurrent::indicator::checked { + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/R_icon_blue.png"); +} + +QCheckBox { + spacing: 5px; +} + +QCheckBox::indicator { + background-color: #424242; + width: 15px; + height: 15px; +} + +QCheckBox::indicator:checked, QGroupBox::indicator:checked{ + background-color: #424242; + image: url("D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool/layout_tool/assets/check.png") +} diff --git a/layout_tool/ui/main.py b/layout_tool/ui/main.py index 84a24622f1138251e6efbabf6986e4dd376313dd..c29e4d1bd657b55105174054358cf30cdd6cbd6d 100644 --- a/layout_tool/ui/main.py +++ b/layout_tool/ui/main.py @@ -1,7 +1,80 @@ #!/usr/bin/python +import os from layout_tool.constants import WIDTH, HEIGHT -from PySide.QtGui import QWidget, QDesktopWidget, QVBoxLayout, QListWidget, QPushButton -from PySide.QtCore import Qt +from layout_tool import here +from PySide.QtGui import * +from PySide.QtCore import * + +class ChildAsset(QFrame): + def __init__(self, name, count, type): + QFrame.__init__(self) + + # inputs = name, count, current_type + self.setObjectName("asset") + self.name = name + self.count = str(count) + self.current_type = type + self.collection_type = type + self.layout = QHBoxLayout() + self.layout.setContentsMargins(10,0,0,0) + self.name_label = QLabel(self.name) + self.name_label.setFixedWidth(150) + self.asset_count = QLabel(self.count) + self.asset_count.setFixedWidth(50) + self.setFixedSize(500,40) + self.mesh = QRadioButton() + self.mesh.setObjectName("mesh") + self.mesh.toggled.connect(self.get_collection_type) + self.instance = QRadioButton() + self.instance.setObjectName("instance") + self.instance.toggled.connect(self.get_collection_type) + self.replicator = QRadioButton() + self.replicator.setObjectName("replicator") + self.replicator.toggled.connect(self.get_collection_type) + # self.refresh_button = QPushButton() + # self.refresh_button.setFixedSize(30,30) + # self.refresh_button.setObjectName("refresh") + + # self.expand_button = QPushButton() + # self.expand_button.setFixedSize(30,30) + # self.expand_button.setObjectName("expand") + self.set_radio_buttons() + self.layout.addWidget(self.name_label) + self.layout.addWidget(self.asset_count) + self.layout.addStretch() + # self.layout.addWidget(self.refresh_button) + # self.layout.addStretch() + self.layout.addWidget(self.mesh) + self.layout.addWidget(self.instance) + self.layout.addWidget(self.replicator) + # self.layout.addWidget(self.expand_button) + + self.setLayout(self.layout) + + def set_radio_buttons(self): + if self.current_type == "mesh": + self.mesh.setChecked(True) + self.mesh.setObjectName("meshcurrent") + elif self.current_type == "instance": + self.instance.setChecked(True) + self.instance.setObjectName("instancecurrent") + elif self.current_type == "replicator": + self.replicator.setChecked(True) + self.replicator.setObjectName("replicatorcurrent") + elif self.current_type == "position": + self.setObjectName("emptyasset") + + def get_collection_type(self): + button = self.sender() + if button.isChecked(): + if button.objectName().endswith("current"): + self.collection_type = button.objectName()[:-7] + else: + self.collection_type = button.objectName() + + def get_changes(self): + if self.current_type != self.collection_type: + return [self.name, self.current_type, self.collection_type] class View(QWidget): @@ -9,34 +82,139 @@ class View(QWidget): super(View, self).__init__(parent) self.controller = controller - self.items = None + self.mesh_items = None + self.asset_items = None + self.child_assets = [] self.init_ui() self.resize(WIDTH, HEIGHT) self.center() + self.set_stylesheet() def init_ui(self): self.setWindowFlags(Qt.Tool) - self.setLayout(QVBoxLayout()) + self.base_layout = QVBoxLayout() + self.setLayout(self.base_layout) - self.items_list = QListWidget() - self.layout().addWidget(self.items_list) + self.meshes_label = QLabel("Meshes") + self.parent_asset_label = QLabel("OfficeA_GRP") + self.parent_asset_label.setObjectName("title") + self.parent_asset_label.setAlignment(Qt.AlignCenter) + self.base_layout.addWidget(self.parent_asset_label) - self.execute_button = QPushButton() - self.execute_button.setText("Execute") - self.layout().addWidget(self.execute_button) + self.mesh_layout = QVBoxLayout() + self.meshes_label = QLabel("Meshes") - def clear(self): - self.items = None - self.items_list.clear() + self.mesh_list_widget = QListWidget() + self.mesh_list_widget.setMaximumHeight(250) + self.mesh_list_widget.setFocusPolicy(Qt.NoFocus) + self.mesh_layout.addWidget(self.meshes_label) + self.mesh_layout.addWidget(self.mesh_list_widget) + self.mesh_list_widget.setSelectionMode(QAbstractItemView.MultiSelection) + + #------------------------------------------------------------- + #Assetize BAR + + self.assetize_layout_01 = QHBoxLayout() + self.assetize_layout_02 = QHBoxLayout() + self.asset_name_label = QLabel("Asset Name:") + self.asset_name_edit = QLineEdit() + self.asset_name_edit.setPlaceholderText("e.g ChairA") + self.merge = QCheckBox("Merge Meshes:") + self.merge.setLayoutDirection(Qt.RightToLeft) + self.pivot_label = QLabel("Pivot Position:") + self.pivot_combo = QComboBox() + self.pivot_combo.addItems(["Keep", "Bottom", "Center"]) + self.collection_type_label = QLabel("Collection Type:") + self.collection_type_combo = QComboBox() + self.collection_type_combo.addItems(["Mesh", "Instance", "Replicator"]) + self.keep_original = QCheckBox("Keep Original:") + self.keep_original.setLayoutDirection(Qt.RightToLeft) + self.assetize_button = QPushButton("Assetize") + self.assetize_button.setFixedWidth(220) + self.assetize_button.setObjectName("button") + self.assetize_button.clicked.connect(self.get_assetize_values) + self.assetize_layout_01.addWidget(self.asset_name_label) + self.assetize_layout_01.addWidget(self.asset_name_edit) + self.assetize_layout_01.addWidget(self.merge) + self.assetize_layout_01.addWidget(self.pivot_label) + self.assetize_layout_01.addWidget(self.pivot_combo) + self.assetize_layout_02.addWidget(self.collection_type_label) + self.assetize_layout_02.addWidget(self.collection_type_combo) + self.assetize_layout_02.addWidget(self.keep_original) + self.assetize_layout_02.addWidget(self.assetize_button) + + self.mesh_layout.addLayout(self.assetize_layout_01) + self.mesh_layout.addLayout(self.assetize_layout_02) + + #------------------------------------------------------------- + #Child Assets - def load(self, items): - self.clear() - self.items = sorted(items, key=lambda k: k["name"]) - self.items_list.addItems([i["name"] for i in self.items]) + self.child_assets_layout = QVBoxLayout() + self.child_assets_label = QLabel("Child Assets") + self.child_assets_layout.addWidget(self.child_assets_label) + + + self.apply_layout = QVBoxLayout() + self.apply_layout.addStretch() + self.apply_button = QPushButton("Apply Changes") + self.apply_button.setObjectName("button") + self.apply_layout.addWidget(self.apply_button) + self.export_button = QPushButton("Export " + "OfficeA") + self.export_button.setObjectName("button") + self.apply_layout.addWidget(self.export_button) + self.apply_button.clicked.connect(self.controller.refresh) + #------------------------------------------------------------- + + self.base_layout.addLayout(self.mesh_layout) + self.base_layout.addLayout(self.child_assets_layout) + self.base_layout.addLayout(self.apply_layout) def center(self): geometry = self.frameGeometry() center_point = QDesktopWidget().availableGeometry().center() geometry.moveCenter(center_point) self.move(geometry.topLeft()) + + def set_stylesheet(self): + with open(os.path.join(here, "assets", "stylesheet.css"), "r") as f_stylesheet: + stylesheet = str(f_stylesheet.read()) + self.setStyleSheet(stylesheet) + + def clear(self): + self.mesh_items = None + self.asset_items = None + self.mesh_list_widget.clear() + for each in self.child_assets: + self.child_assets_layout.removeWidget(each) + each.deleteLater() + + def load_meshes(self, items): + self.mesh_items = sorted(items) + self.mesh_list_widget.addItems(self.mesh_items) + + def get_assetize_values(self): + name = self.asset_name_edit.text() + collection_type = self.collection_type_combo.currentText() + pivot = self.pivot_combo.currentText() + merge = self.merge.isChecked() + keep = self.keep_original.isChecked() + assetize_info = [name, collection_type, pivot, merge, keep] + print assetize_info + + + def load_child_assets(self, items): + self.child_assets = [] + self.asset_items = sorted(items, key=lambda k: k["Name"]) + for each in self.asset_items: + child_asset = ChildAsset(each["Name"], each["Count"], each["Type"]) + self.child_assets_layout.addWidget(child_asset) + self.child_assets.append(child_asset) + + def get_changes(self): + changes = [] + for each in self.child_assets: + asset_change = each.get_changes() + if asset_change is not None: + changes.append(each.get_changes()) + return changes \ No newline at end of file diff --git a/misc/debug.py b/misc/debug.py index 7e58b299cb540f526890f5f87a5e1ea75ddceeb8..6f21ccf5ac53453625f5e703b03c7a74fb0d4373 100644 --- a/misc/debug.py +++ b/misc/debug.py @@ -1,6 +1,6 @@ import sys -path = "/mnt/horatius/Corentin/Local/Projects/Code/linux/blinkink/inkubator/modo-layout-tool" +path = "D:/Documents/BLINKINK/Scripts/Bip/modo-layout-tool" def delete_modules(starts_with):