-
Notifications
You must be signed in to change notification settings - Fork 5
03009 zhang ying #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /.idea/ | ||
|
|
||
| /test/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # .@FileName:script_update | ||
| # @Date....:2020-04-04 20:49 | ||
| # ..:XingLian | ||
| import re | ||
| import nuke | ||
| import nukescripts | ||
|
|
||
| # 获取工程名称 | ||
| script_name = nuke.scriptName() | ||
| # 匹配是否存在版本号,如果不存在,另存为版本1,并进行升级操作 | ||
| if not re.search(script_name, r'.?_v/d*.nk$'): | ||
| print re.search(script_name, r'.?_v/d*.nk$') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里只会返回一个_sre.SRE_Match对象,打印出来没有意义 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. . 的匹配最好变成 . 吧 ?不然别的字符也会匹配进去了 比如 lv001d 而不是 .v001.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zclongpop123 他只检查代码里有没有版本号,不关心其他字符,有就行 |
||
| new_script_name = script_name[::-1].replace('kn.', 'kn.100v_', 1)[::-1] | ||
|
haogeek marked this conversation as resolved.
|
||
| print new_script_name | ||
| nuke.scriptSaveAs(new_script_name) | ||
| nukescripts.script_and_write_nodes_version_up() | ||
|
haogeek marked this conversation as resolved.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re相关查询函数的参数列表都是pattern在前,string在后,这里的pattern应该写成
r'.?_v\d+\.nk$