Example #1
0
File: preset.py Project: JuhaW/vb30
    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'}
Example #2
0
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'}
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'}
    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'}