SearchReplacePanel v1.3


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Frank Rueter
Website: www.ohufx.com
a better search and replace panel
Requirements:
13.1, 12.2, 12.1, 12.0, 11.3, 11.2, 11.1, 11.0, 10 or later
Linux, Mac, Windows
13 May 2021
2708

watch the videoTool Video

v1.3: Nuke 13. compatible


 

v1.2: fixed bug to make the panel work with file paths without sequence padding (e.g. quicktimes, still frames, etc)


v1.1: added features:

 

  • added tooltips
  • option to turn off case sensitivity
  • history menu for quick access of previous search&replace actions
  • control the size of the history when creating the menu, e.g.:
    1
    
    srPanel = SearchReplacePanel.SearchReplacePanel( maxSteps=5 )

     

This was actually my first test project when python panels became available and has proven very handy tucked away in the pane menu for easy access.
To load the panel into the 'Pane' menu and make it save with layouts properly, drop something like this into your menu.py:

1
2
3
4
5
6
7
8
9
10
import SearchReplacePanel

def
addSRPanel():

'''Run the panel script and add it as a tab into the pane it is called from'''
myPanel = SearchReplacePanel.SearchReplacePanel()
return myPanel.addToPane()
 
#THIS LINE WILL ADD THE NEW ENTRY TO THE PANE MENU
nuke.menu('Pane').addCommand('SearchReplace', addSRPanel)
 
#THIS LINE WILL REGISTER THE PANEL SO IT CAN BE RESTORED WITH LAYOUTS
nukescripts.registerPanel('com.ohufx.SearchReplace', addSRPanel)

The above code in the menu.py will give you this:
SR_02

You can chose to perform the search&replace on all nodes or just selected ones:
SR_03

Please login in order to download these files.

Comments   

 
+2 # Frank Rueter 2010-10-18 16:25
just subscribing...
 
 
0 # Dennis Serras 2011-03-01 12:41
Thanks for making this. You'd think there would be one of these in Nuke already! Or if there is, I'm too big of an idiot to find it. I duplicate and rename my nodes all the time and you just saved me a ton of work.
 
 
0 # Carlos Trijueque 2011-10-28 04:59
I use it almost daily. Nice improvements.

Thanks!
 
 
0 # Cameron Carson 2012-02-14 16:55
Nice piece of scripting. However, It appears to hang when searching any nodes that are local cached. Strange.
 
 
0 # Frank Rueter 2012-02-15 17:58
Hi Cameron, I can't reproduce this. Can you see any info in the script editor or error console? What version are you running? How big is your script?
 
 
0 # Cameron Carson 2012-02-15 18:27
It's a fairly large comp. Upon further inspection it doesn't appear to be caused by the locally cached files. Just seems to hang when certain files are selected. Even if i just select that one read node. It's rather odd. No worries though I have just been going back to the old open the .nuke in a text editor and Find & Replace that way.
 
 
0 # Priyank Murarka 2012-03-15 13:53
Very very useful.. Thanks!
 
 
0 # Gary Couto 2012-03-16 10:17
Awesome! Thanks!
 
 
0 # Carlos Rubio 2012-05-21 08:03
Thank you very much!!!
 
 
0 # Laurent Reynaud 2012-06-28 03:56
where do I need to paste the SearchReplace.p y ?
 
 
0 # Frank Rueter 2012-06-28 15:38
Have a look at this:
http://www.nukepedia.com/video-tutorials/22/video/

The example code required to hook things up is on the top of the page.
Hope that helps.
 
 
0 # Travis Button 2013-02-15 14:47
Awesome tool Frank! Wish I would have found this months ago. Great addition right there by the side of MassivePanel. Is there a way to get it in the pane dock automatically upon opening Nuke without saving it as part of your layout? I feel like MassivePanel just showed up after I installed it, never had to actually select it through the Pane menu but can't figure it out for Search and Replace.
 
 
0 # Frank Rueter 2013-02-15 16:18
I can have a look but am pretty swamped for the next few weeks. might need a reminder ;-)
 
 
0 # Cristian Predut 2014-02-16 13:25
Excellent, this saved me days of work! Well done :)
 
 
0 # Josh Robertson 2014-07-05 00:13
Awesome tool Frank! I use this all the time for remapping nodes that seem to have lost their way.

I did modify the script by changing the "self.replaceSt r = nuke.String_Kno b" to a File_Knob as I primarily am change the file path and it just made it quicker and more convenient if I couldn't remember the exact file path. Plus it still works to replace anything even if I don't put in a file path :P

Again awesome script thanks Frank!
 
 
0 # Evgeny Shpilivoi 2016-08-03 15:40
best!
 
 
0 # asin shin 2016-10-06 11:50
Hi, thankyou very much!, btw where should i put SearchReplacePa nel.py ?

the link video not found

thanks
 
 
0 # Frank Rueter 2016-10-07 02:33
put the py file anywhere in your nuke plugin path, if in doubt in ~/.nuke (where "~" is your home directory).
The link to the video works fine for me.
 
 
0 # roshan maharjan 2018-01-08 06:43
but it didn't change my write node path
 
 
0 # Frank Rueter 2018-01-08 10:14
I use it all the time to change my write node path. are you seeing any errors?
 
 
0 # roshan maharjan 2018-01-10 09:27
thanks man, there is no error it fixed.
 
 
0 # Dima Dragun 2018-03-18 11:31
Hello, Frank. Thank you for your tool. I used it by last 2 years, but in this year it didn't work ): I have try to reinstall it few times, but it didn't launch like before. I have button in Window-Custom-S earchReplace, but when I click it nothing is happing. I really don't have any ideas. Could you help me? Thank you.
Mac OS High Sierra, NukeX 10 and 11 any versions.
 
 
0 # frank admin 2018-03-18 22:52
Hi Dima, when you so you can see the panel but when you push the button id doesn't work? Can you see anything in the script editor or the error console? When you launch Nuke from a terminal, can you see any output in that terminal when you push the button?
 
 
0 # Dima Dragun 2018-03-19 08:42
I don't have any message in error console inside nuke, but I have message in terminal:
Traceback (most recent call last):
File "/Users/d.dragu n/.nuke/myTools /scripts/menu.p y", line 55, in addSRPanel
myPanel = SearchReplacePa nel.SearchRepla cePanel()
File "/Users/d.dragu n/.nuke/myTools /scripts/Search ReplacePanel.py ", line 24, in __init__
self.history = nuke.Enumeratio n_Knob( 'history', 'Recent Searches', self.loadHistor y() )
File "/Users/d.dragu n/.nuke/myTools /scripts/Search ReplacePanel.py ", line 53, in loadHistory
xmlTree = ElementTree.par se( self.historyFil e )
File "/Applications/ Nuke11.1v2/Nuke 11.1v2.app/Cont ents/Frameworks /Python.framewo rk/Versions/2.7 /lib/python2.7/ xml/etree/Eleme ntTree.py", line 1182, in parse
tree.parse(sour ce, parser)
File "/Applications/ Nuke11.1v2/Nuke 11.1v2.app/Cont ents/Frameworks /Python.framewo rk/Versions/2.7 /lib/python2.7/ xml/etree/Eleme ntTree.py", line 657, in parse
self._root = parser.close()
File "/Applications/ Nuke11.1v2/Nuke 11.1v2.app/Cont ents/Frameworks /Python.framewo rk/Versions/2.7 /lib/python2.7/ xml/etree/Eleme ntTree.py", line 1665, in close
self._raiseerro r(v)
File "/Applications/ Nuke11.1v2/Nuke 11.1v2.app/Cont ents/Frameworks /Python.framewo rk/Versions/2.7 /lib/python2.7/ xml/etree/Eleme ntTree.py", line 1517, in _raiseerror
raise err
xml.etree.ElementTree.ParseError: unclosed token: line 1, column 363
 
 
0 # Dima Dragun 2018-03-19 08:53
screencast from my machine for better explain
https://drive.google.com/file/d/1iyjbiOVLXm-5NxhwkFfPO0tJ8SvgBKop/view?usp=sharing
 
 
0 # Frank Rueter 2018-03-19 20:48
Hi Dima,
it looks like the panel has trouble reading your history file. Can you show me the contents of your ~/.nuke/srhisto ry.xml ?
Try moving it away or renaming it to a temporary name and see if the panel comes up then (it should generate a new history file).

Cheers,
frank
 
 
0 # Dima Dragun 2018-03-24 11:48
Frank, thank you so much! It's help! I just delete srhisto ry.xml file and your tool launch.
In this file was next (I delete here brace, becouse this site don't let me write this on comment):
SearchReplacePanel
ITEM replace="080" search="190" /
ITEM replace="0050" search="0080" /
ITEM replace="0110" search="0050" /
ITEM replace="0020" search="0060" /
ITEM replace="0030" search="0020" /
ITEM replace="0030" search="0110" /
ITEM replace="0090" search="0030" /
ITEM replace="FOOTAG E" search="FOOTAGE " /
ITEM replace="footag e" search="FOOTAGE " /
ITEM
 
 
0 # Frank Rueter 2018-03-25 00:58
not sure if the site formatted the text you pasted, but if this is actually what was in the srhistory.xml it sure was busted for some reason.
I use this all the time and haven't had this issue, so maybe you accidentally did something to the history file that caused it to become invalid xml syntax which would have caused the error you saw.
Let me know if it happens again and I will put a fail-safe in place when trying to read the history file.
 
 
0 # Jerome Desvignes 2018-12-21 11:09
hello, i have an issue with the way of calling it from a menu
in dont want to modifiy the main app menu so i use a launcher where i add some command like creation of compagny menu

it lauch the search and replace but it doesn't look like yours

here is my code,

import SearchReplacePa nel
menubar = nuke.menu("Nuke")
tbmenu = menubar.addMenu("&My_Compagny")
tbmenu.addCommand("Search and Replace Panel", "SearchReplaceP anel.SearchRepl acePanel() ")
#tbmenu.addCommand("Search and Replace Panel", SearchReplacePa nel.SearchReplacePa nel(),)
try:
if nuke.env[ 'studio' ]:
import SearchReplacePa nel
tbmenu.addComma nd("Reserve Frame Server Slaves", SearchReplacePa nel.SearchReplacePa nel(), "")
except:
pass

i also have trouble to integrate this line

nukescripts.registerPanel('com.ohufx.SearchReplace', addSRPanel)

as i dont use a def to appen to menu, i must also add that i'm very new to code :)

any idea ?
 
 
0 # Jerome Desvignes 2018-12-21 11:40
i have finally find my way :)

import SearchReplacePanel
menubar = nuke.menu("Nuke")
tbmenu = menubar.addMenu("&My_Compagny")


import SearchReplacePanel

def addSRPanel():
'''Run the panel script and add it as a tab into the pane it is called from'''
myPanel = SearchReplacePa nel.SearchRepla cePanel()

return myPanel.show()

#THIS LINE WILL ADD THE NEW ENTRY TO THE PANE MENU

tbmenu.addCommand('SearchReplace', addSRPanel)

#THIS LINE WILL REGISTER THE PANEL SO IT CAN BE RESTORED WITH LAYOUTS
nukescripts.registerPanel('com.ohufx.SearchReplace', addSRPanel)

i also change the addToPane by show wich is more convenient for me

thanx a lot for your script !
 
 
0 # frank admin 2018-12-23 02:32
glad you got it working
 
 
0 # Victor Perez 2021-03-17 19:16
Hey Frank! I hope you are doing well.
Any chances you would update the code to make it compatible with Python 3.0 so we can use it in NUKE 13? I use this tool a lot!
Thanks a lot!
 
 
0 # ThanhHung Nguyen 2021-05-10 04:54
Quoting Victor Perez:
Hey Frank! I hope you are doing well.
Any chances you would update the code to make it compatible with Python 3.0 so we can use it in NUKE 13? I use this tool a lot!
Thanks a lot!


Hi ! You can try it. I fixed for Nuke 13

DOWNLOAD HERE: https://bit.ly/3nZoMkw
 
 
0 # Frank Rueter 2021-05-13 01:45
Thanks you! I have now update the file here as well. Sorry Victor, your message must have fallenl through the cracks.
 
 
0 # ThanhHung Nguyen 2021-05-19 01:52
Quoting Frank Rueter:
Thanks you! I have now update the file here as well. Sorry Victor, your message must have fallenl through the cracks.


That's awesome. I will remove my link.
 
 
0 # Victor Perez 2021-06-03 16:29
You rock Frank! Thanks so much!
 
 
0 # Jung Keun Kim 2021-06-07 08:11
I got a error message like this. could you give some advise for me?



replacing
Traceback (most recent call last):
File "C:\Program Files\Nuke13.0v 2\lib\sre_parse .py", line 1015, in parse_template
this = chr(ESCAPES[this][1])
KeyError: '\\U'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Program Files/Nuke13.0v 2/plugins\nuke_ internal\callba cks.py", line 127, in knobChanged
_doCallbacks(kn obChangeds)
File "C:/Program Files/Nuke13.0v 2/plugins\nuke_ internal\callba cks.py", line 46, in _doCallbacks
f[0](*f[1],**f[ 2])
File "C:/Program Files/Nuke13.0v 2/plugins\nukes cripts\panels.p y", line 23, in PythonPanelKnob Changed
widget.knobChan gedCallback(nuk e.thisKnob())
File "C:/Program Files/Nuke13.0v 2/plugins\nukes cripts\panels.p y", line 71, in knobChangedCall back
self.knobChange d(knob)
File "C:/Users/cg16/ .nuke/Python\Se archReplacePane l.py", line 174, in knobChanged
k.setValue( self.__doReplac e( k ) )
File "C:/Users/cg16/ .nuke/Python\Se archReplacePane l.py", line 162, in __doReplace
newStr = re.sub( m, self.replaceStr .value(), newStr )
File "C:\Program Files\Nuke13.0v 2\lib\re.py", line 192, in sub
return _compile(patter n, flags).sub(repl , string, count)
File "C:\Program Files\Nuke13.0v 2\lib\re.py", line 309, in _subx
template = _compile_repl(t emplate, pattern)
File "C:\Program Files\Nuke13.0v 2\lib\re.py", line 300, in _compile_repl
return sre_parse.parse _template(repl, pattern)
File "C:\Program Files\Nuke13.0v 2\lib\sre_parse .py", line 1018, in parse_template
raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \U at position 2
 
 
0 # Hiroki Iijima 2022-09-21 03:09
It doesn't work this in NukeIndie.
Something different?
 

You have no rights to post comments

We have 2289 guests and 76 members online