Hi all, I am trying to re-purpose the code from pluginAddPath(). Copying the behavior especially the resolution of relative filenames.
The idea is to have a function which will be executed in a similar fashion inside init.py scripts. It would be very neat if I could run customAddPath('./custom') and Nuke would resolve the path for me. I don't want my custom path to be added to the pluginPath in the end. I would just add it and remove it again to use the resolution part. My first approach was to add the path to the plugin path so Nuke resolves it but before I do that make a backup and after Nuke resolved the path revert pluginPath to the backed up list. Unfortunately this doesn't work because _nuke.pluginPath() is not a list but a function. e.g. pretty close to Nuke8.0v6/plugins/nuke/overrides.py - pluginAddPath() # Nuke does it's own resolution of relative filenames, so that they end up # relative to the right location. Rather than duplicating that logic here, # we just get the difference between the pluginPath before and after we've # added the new paths. backup_plugin_path = _nuke.pluginPath oldPluginPath = tuple(_nuke.pluginPath()) for i in args: _nuke.pluginAddPath(i) newPaths = [p for p in _nuke.pluginPath() if p not in oldPluginPath] for path in newPaths: if path not in custom_paths: custom_paths.insert(0, path) _nuke.pluginPath = backup_plugin_path Two questions come to mind: 1. Is there a way I can remove paths from the pluginPath()? This way I could use the resolution but remove what I added afterwards. 2. Can I just use the resolution of relative paths which is Nuke using internally? Perhaps someone has a good idea. Thanks, Sebastian
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python