Hi there!
i've manage to do the same thing today, and stumble upon this discussion,
now i my shared ToolSets ( that contains subversion .svn directory ) is now
ignored from the Nuke toolsets menu creation.
I have just overrided the nukescripts.toolsets.createToolsetMenuItems function
to a copy of this function, where i've added one list comprehension
line to exclude
.svn directory from the parsing.
let me know if it works for you too ;)
here is the line i've used:
filecontents = [item for item in filecontents if ".svn" not in item]
you also need to put this in your init.py or menu.py file:
nukescripts.toolsets.createToolsetMenuItems = createToolsetMenuItemsOverride
and here the full function code with my correction:
def createToolsetMenuItemsOverride(m, rootPath, fullPath, delete,
allToolsetsList, isLocal):
filecontents = sorted(os.listdir(fullPath), key = str.lower)
filecontents = [item for item in filecontents if ".svn" not in
item] #### Here the .svn exclude dir from list
# First list all directories
retval = False
if filecontents != []:
for group in filecontents:
if os.path.isdir("/".join([fullPath, group])):
menuName = group
if isLocal and (menuName in allToolsetsList):
menuName = "[user] " + menuName
elif not isLocal:
allToolsetsList.append(menuName)
n = m.addMenu(menuName)
retval = createToolsetMenuItems(n, rootPath,
"/".join([fullPath, group]), delete, allToolsetsList, isLocal)
# if we are deleting, and the sub directory is now
empty, delete the directory also
if delete and os.listdir(fullPath) == []:
os.rmdir(fullPath)
# Now list individual files
for group in filecontents:
fullFileName = "/".join([fullPath, group])
if not os.path.isdir(fullFileName):
extPos = group.find(".nk")
if extPos != -1 and extPos == len(group) - 3:
group = group.replace('.nk', '')
if delete:
m.addCommand(group,
'nukescripts.toolsets.deleteToolset("%s", "%s")' % (rootPath,
fullFileName), "")
retval = True
else:
# get the filename below toolsets
i = fullFileName.find("ToolSets/")
if i != -1:
subfilename = fullFileName[i:]
else:
# should never happen, but just in case ...
subfilename = fullfilename
if isLocal and (subfilename in allToolsetsList):
# if we've already appended [user] to the
menu name, don't need it on the filename
if (i != -1) and
subfilename[len("ToolSets/"):].find("/") == -1:
group = "[user] " + group
elif not isLocal:
allToolsetsList.append(subfilename)
m.addCommand(group, 'nuke.loadToolset("%s")' %
fullFileName, "")
retval = True
return retval
On Tue, Feb 7, 2012 at 12:16 AM, Anthony Kramer
<[email protected]> wrote:
> Thanks Pete
>
>
> On Wed, Feb 1, 2012 at 3:40 AM, Peter Crossley <[email protected]>
> wrote:
>>
>> Hi,
>>
>>
>> On 31/01/2012 22:24, Anthony Kramer wrote:
>>
>> I found this in the python docs: nuke.addToolsetExcludePaths(paths)
>>
>> I tried adding it to my menu.py but it doesn't seem to do anything. I even
>> confirmed that its grabbing the paths I specify in my menu.py by running a
>> "print nuke.getToolsetExcludePaths()" from the script editor. Anyone have
>> any experience with this function?
>>
>>
>> I just had a quick look at the code for this (which is in
>> plugins/nukescripts/toolsets.py, traversePluginPaths()). Currently this just
>> allows you to exclude any of the nuke plugin paths from the search (so if
>> you added .nuke, you *shouldn't* see any toolsets stored under
>> .nuke/ToolSets appearing in the list
>>
>>
>>
>>
>> On Tue, Jan 31, 2012 at 1:25 PM, Anthony Kramer <[email protected]>
>> wrote:
>>>
>>> We have our nuke install under version control and so there are hidden
>>> ".svn" files stored on the file system. The ToolSets menu seems to think
>>> these are folders it should load so every level of the menu has a ".svn"
>>> folder with a bunch of sub folders. Any one have any ideas how I can get
>>> nuke not to display those folders?
>>>
>>> nuke 6.3v6 on linux
>>
>>
>> Unfortunately there's no way to do this currently. You can exclude the
>> entire .nuke/ToolSets directory, but if you don't exclude it everything
>> below there will appear in the menu (including .svn folders).
>>
>> However it shouldn't be too difficult to change the logic to support what
>> you want. I've logged the bug
>>
>> Bug 24709 - Toolsets - .svn folders are appearing in the toolset menu
>>
>> I'll keep you updated on progress.
>>
>> Cheers,
>>
>> Peter.
>>
>>>
>>> -Anthony
>>
>>
>>
>>
>> _______________________________________________
>> Nuke-users mailing list
>> [email protected], http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>
>>
>>
>> _______________________________________________
>> Nuke-users mailing list
>> [email protected], http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
>
>
> _______________________________________________
> Nuke-users mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
--
Matthieu Cadet
Compositor Artist & TD,
nWave Digital
[email protected]
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users