def _load(self): sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if propList is not None: if self.identifier in propList: preset = userprop.getUserPropList(sceneRoot, self.identifier) self.name = preset[0] self.optionPreset = None if len(preset) < 2 else preset[1]
def _load(self): sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if propList is not None: if self.identifier in propList: preset = userprop.getUserPropList(sceneRoot, self.identifier) self.name = preset[const.PROP_PRESET_PARAM_NAME_ID] self.group = preset[const.PROP_PRESET_PARAM_GROUP_ID] self.path = preset[const.PROP_PRESET_PARAM_PATH_ID] self.layerNames = preset[const. PROP_PRESET_PARAM_OFFSET:len(preset)]
def convertBabylonMultiExporterData(): log = "" root = getSceneRootNode() print("Converting") if userprop.getUserProp(root,"babylonjs_ExportItemListBackup") is None: # Only convert if we didn't before exportItemList = userprop.getUserPropList(root, "babylonjs_ExportItemList") rawExportItemList = userprop.getUserProp(root, "babylonjs_ExportItemList") if exportItemList is not None: for exportItem in exportItemList: try: itemProp = userprop.getUserProp(root, exportItem) itemProp = str(itemProp).replace(";;", ";-;") item = userprop.parseUserPropAsList(itemProp) if (item is not None): expPath = item[1] serialLayers = item[3] print(serialLayers) layerNames = [x for x in item[3].split("~")] absPath = convertRelativePathToAbsolute(expPath, rt.maxfilepath) relPath = convertAbsolutePathToRelative(absPath, rt.pathConfig.getCurrentProjectFolder()) presetName = os.path.splitext(os.path.split(relPath)[1])[0] presetUtils.createNewPreset(presetName, None, relPath, layerNames) log += "{0}\n".format(presetName) except Exception as error: log += "Couldn't convert " + exportItem + " of the path because " + error print(error) # Uncomment if you want to destroy the original Babylon Preset userprop.setUserProp(root, "babylonjs_ExportItemListBackup", rawExportItemList) # userprop.removeUserProp(root, "babylonjs_ExportItemList") return log
def _load(self): sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if propList is not None: if self.identifier in propList: preset = userprop.getUserProp(sceneRoot, self.identifier) self.name = preset
def delete(self): self._load() sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if self.identifier in propList: propList.remove(self.identifier) userprop.removeUserProp(sceneRoot, self.identifier) userprop.setUserPropList(sceneRoot, self.listStorage, propList)
def _gatherSceneObjects(self): rootNode = sceneUtils.getSceneRootNode() presetList = userprop.getUserPropList(rootNode, self.presetStorageId) presets = [] if presetList is not None: for presetID in presetList: p = PresetObject(presetID) presets.append(p) return presets
def _gatherGroups(self): rootNode = sceneUtils.getSceneRootNode() groupList = userprop.getUserPropList(rootNode, self.groupStorageId) groups = [] if groupList is not None: for groupID in groupList: g = GroupObject(groupID) groups.append(g) return groups
def _gatherGroups(self): rootNode = sceneUtils.getSceneRootNode() groupList = userprop.getUserPropList(rootNode, constants.PROP_PRESET_GROUP_LIST) groups = [] if groupList is not None: for groupID in groupList: g = presetUtils.GroupObject(groupID) groups.append(g) return groups
def _load(self): sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if propList is not None: if self.identifier in propList: groupTuple = userprop.getUserPropHeadedDict( sceneRoot, self.identifier) if (isinstance(groupTuple, tuple)): self.name = groupTuple[0] self.dictionary = groupTuple[1]
def _gatherScenePresets(self): rootNode = sceneUtils.getSceneRootNode() presetList = userprop.getUserPropList(rootNode, constants.PROP_PRESET_LIST) presets = [] if presetList is not None: for presetID in presetList: p = presetUtils.PresetObject(presetID) presets.append(p) return presets
def _write(self): sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if (propList is None): presetList = list() else: presetList = propList if self.name is None: newPreset = self.defaultName else: newPreset = self.name if self.identifier not in presetList: presetList.append(self.identifier) userprop.setUserProp(sceneRoot, self.identifier, newPreset) userprop.setUserPropList(sceneRoot, self.listStorage, presetList)
def _write(self): sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if (propList is None): presetList = list() else: presetList = propList if self.name is None: self.name = self.defaultName newGroup = (self.name, self.dictionary) if self.identifier not in presetList: presetList.append(self.identifier) userprop.setUserPropHeadedDict(sceneRoot, self.identifier, newGroup) userprop.setUserPropList(sceneRoot, self.listStorage, presetList)
def _write(self): sceneRoot = sceneUtils.getSceneRootNode() propList = userprop.getUserPropList(sceneRoot, self.listStorage) if (propList is None): presetList = list() else: presetList = propList newPreset = [] newPreset.insert( const.PROP_PRESET_PARAM_NAME_ID, str(self.defaultName) if self.name is None else str(self.name)) newPreset.insert(const.PROP_PRESET_PARAM_GROUP_ID, "-" if self.group is None else self.group) newPreset.insert(const.PROP_PRESET_PARAM_PATH_ID, ".\\" if self.path is None else self.path) for layer in self.layerNames: newPreset.append(layer) if self.identifier not in presetList: presetList.append(self.identifier) userprop.setUserPropList(sceneRoot, self.identifier, newPreset) userprop.setUserPropList(sceneRoot, self.listStorage, presetList)
def _intializeContent(self): self.clear() self.presetObjectList = [] optionPresetList = userprop.getUserPropList( sceneUtils.getSceneRootNode(), const.PROP_OPTIONS_LIST) if optionPresetList is None: optionPresetList = list() if len(optionPresetList) > 0: defaultPresetId = optionPresetList[0] else: defaultPresetId = const.PROP_OPTIONS_ENTRY_PREFIX.format( uuid.uuid4()) defaultPreset = presetUtils.OptionPresetObject( defaultPresetId, listStorage=const.PROP_OPTIONS_LIST) defaultPreset.create("default", getCurrentSettingsAsDict()) self.presetObjectList.append(defaultPreset) for i in range(1, len(optionPresetList)): option = optionPresetList[i] preset = presetUtils.OptionPresetObject(option, const.PROP_OPTIONS_LIST) self.presetObjectList.append(preset) for item in self.presetObjectList: self.addItem(item.name, item)
def getExportPath(presetID): rootNode = sceneUtils.getSceneRootNode() presetParam = userprop.getUserPropList(rootNode, presetID) return presetParam[const.PROP_PRESET_PARAM_PATH_ID]
def getDefaultExportPresetOptions(): sceneRoot = sceneUtils.getSceneRootNode() optionPresetList = userprop.getUserPropList(sceneRoot, const.PROP_OPTIONS_LIST) option = OptionPresetObject(optionPresetList[0]) return option