def _execute(self, context, vrsceneDict): for pluginDesc in vrsceneDict: pluginID = pluginDesc['ID'] pluginName = pluginDesc['Name'] pluginAttrs = pluginDesc['Attributes'] pluginModule = PLUGINS_ID.get(pluginID) if pluginModule is None: continue if not hasattr(context.scene.vray, pluginID): # TODO: Add warning? continue propGroup = getattr(context.scene.vray, pluginID) for attrName in pluginAttrs: attrDesc = NodesImport.getParamDesc(pluginModule.PluginParams, attrName) if attrDesc is None: continue attrValue = pluginAttrs[attrName] if attrDesc['type'] == 'ENUM': attrValue = str(attrValue) setattr(propGroup, attrName, attrValue) return {'FINISHED'}
def ImportSettings(context, filePath, pluginFilter=None): debug.PrintInfo('Importing settings from "%s"' % filePath) vrsceneDict = ParseVrscene(filePath) for pluginDesc in vrsceneDict: pluginID = pluginDesc['ID'] pluginName = pluginDesc['Name'] pluginAttrs = pluginDesc['Attributes'] if pluginID not in PLUGINS['SETTINGS']: continue pluginModule = PLUGINS_ID.get(pluginID) if pluginModule is None: continue if not hasattr(context.scene.vray, pluginID): continue propGroup = getattr(context.scene.vray, pluginID) for attrName in pluginAttrs: attrDesc = NodesImport.getParamDesc(pluginModule.PluginParams, attrName) if attrDesc is None: continue attrValue = pluginAttrs[attrName] if attrDesc['type'] == 'ENUM': attrValue = str(attrValue) setattr(propGroup, attrName, attrValue) return {'FINISHED'}