-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
苍之幻灵
committed
Dec 8, 2021
1 parent
d1d8d02
commit 7e41e41
Showing
28 changed files
with
1,272 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
# dg_editor | ||
一个maya DG图的编辑工具 | ||
|
||
## 目录 | ||
|
||
- [版权说明](#版权说明) | ||
|
||
### 版权说明 | ||
|
||
该项目签署了Apache-2.0 授权许可,详情请参阅 LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/12/5 7:39 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals, print_function | ||
import imp | ||
import init | ||
|
||
imp.reload(init) | ||
import attr_regex_match_dialog | ||
|
||
print(attr_regex_match_dialog.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/11/22 5:37 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals, print_function | ||
|
||
import imp | ||
import init | ||
|
||
imp.reload(init) | ||
import gen_name_exp_dialog | ||
|
||
print(gen_name_exp_dialog.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/11/19 3:54 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
import imp | ||
import init | ||
|
||
imp.reload(init) | ||
import main_window | ||
|
||
win = main_window.new() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/12/5 1:40 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals, print_function | ||
|
||
import imp | ||
import init | ||
|
||
imp.reload(init) | ||
import regex_match_dialog | ||
|
||
print(regex_match_dialog.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/12/6 5:48 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals, print_function | ||
import imp | ||
import init | ||
|
||
imp.reload(init) | ||
|
||
import rename | ||
|
||
import maya.mel as mel | ||
|
||
mel.eval(""" | ||
polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1; | ||
// 结果: pSphere1 polySphere1 // | ||
select -r pSphere1 ; | ||
doGroup 0 1 1; | ||
doGroup 0 1 1; | ||
doGroup 0 1 1; | ||
doGroup 0 1 1; | ||
doGroup 0 1 1; | ||
doGroup 0 1 1; | ||
duplicate -rr; | ||
//结果: group7 // | ||
select -add group6 ; | ||
""") | ||
rename.add_name_prefix("_") | ||
rename.search_replace_name("gr", "gra") | ||
rename.regex_search_replace_name("o.p", "urp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/11/19 3:45 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
import sys | ||
|
||
sys.path = [i for i in sys.path if not "\\MASH\\" in i] | ||
sys.path.append(r"D:\Development\python_maya\dg_editor\src") | ||
sys.path.append(r"D:\Development\python_maya\dg_editor\script") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/12/5 7:38 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals, print_function | ||
|
||
import re | ||
|
||
import maya.cmds as mc | ||
|
||
|
||
def match(exp): | ||
re_o = re.compile(exp) | ||
for n in mc.ls("*"): | ||
for attr in mc.listAttr(n): | ||
attr = "{}.{}".format(n, attr) | ||
m = re_o.match(attr) | ||
if not m is None: | ||
if m.group() == attr: | ||
yield attr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/12/5 7:38 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals, print_function | ||
from PySide2.QtGui import * | ||
from PySide2.QtCore import Qt | ||
from PySide2.QtWidgets import * | ||
|
||
import setting | ||
import attr_regex_match | ||
|
||
|
||
class AttrRegexMatchDialog(QDialog): | ||
def __init__(self, parent=None): | ||
self.names = None | ||
super(AttrRegexMatchDialog, self).__init__(parent) | ||
self.setWindowTitle("attr regex match") | ||
self.main_layout = QHBoxLayout(self) | ||
|
||
self.exp_line_edit = QLineEdit() | ||
self.match_bn = QPushButton("匹配") | ||
self.match_bn.clicked.connect(self.match) | ||
|
||
self.main_layout.addWidget(QLabel("正则表达式: ")) | ||
self.main_layout.addWidget(self.exp_line_edit) | ||
self.main_layout.addWidget(self.match_bn) | ||
# 应用设置 | ||
self.setting() | ||
|
||
def setting(self): | ||
fs = setting.get("font", None) | ||
if fs is None: | ||
fs = QFont().toString() | ||
f = QFont() | ||
f.fromString(fs) | ||
self.setFont(f) | ||
|
||
def match(self): | ||
self.names = list(attr_regex_match.match(self.exp_line_edit.text())) | ||
# print("attr_regex_match_dialog self.names >> ", self.names) | ||
self.close() | ||
|
||
|
||
def exec_(parent=None): | ||
dia = AttrRegexMatchDialog(parent) | ||
dia.exec_() | ||
return dia.names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/11/17 5:12 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals | ||
import os | ||
# 是否处于DEBUG状态 | ||
DEBUG = True | ||
# 版本 | ||
VERSION = "0.1.0" | ||
# 插件目录 | ||
PATH = os.path.dirname(os.path.abspath(__file__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# -*-coding:utf-8 -*- | ||
u""" | ||
:创建时间: 2021/11/20 6:06 | ||
:作者: 苍之幻灵 | ||
:我的主页: https://cpcgskill.com | ||
:QQ: 2921251087 | ||
:爱发电: https://afdian.net/@Phantom_of_the_Cang | ||
:aboutcg: https://www.aboutcg.org/teacher/54335 | ||
:bilibili: https://space.bilibili.com/351598127 | ||
""" | ||
from __future__ import unicode_literals, print_function | ||
import config | ||
import sys | ||
from PySide2.QtCore import Qt | ||
from PySide2.QtWidgets import * | ||
|
||
import maya.cmds as mc | ||
|
||
import attr_regex_match_dialog | ||
|
||
from utils import undo_block | ||
|
||
|
||
class FuncSelectWidget(QWidget): | ||
Connect, DisConnect = range(2) | ||
ConnectText = "建立连接" | ||
DisConnectText = "断开连接" | ||
|
||
def __init__(self, parent=None): | ||
super(FuncSelectWidget, self).__init__(parent) | ||
self.main_layout = QHBoxLayout(self) | ||
|
||
self.f_com = QComboBox(self) | ||
self.f_com.addItem(self.ConnectText) | ||
self.f_com.addItem(self.DisConnectText) | ||
|
||
self.main_layout.addWidget(QLabel("功能")) | ||
self.main_layout.addWidget(self.f_com) | ||
self.main_layout.addStretch(0) | ||
|
||
def func(self): | ||
if self.f_com.currentText() == self.ConnectText: | ||
return self.Connect | ||
else: | ||
return self.DisConnect | ||
|
||
|
||
class MatchWidget(QWidget): | ||
def __init__(self, parent=None): | ||
super(MatchWidget, self).__init__(parent) | ||
self.main_layout = QHBoxLayout(self) | ||
self.name_text = QTextEdit() | ||
self.r_layout = QVBoxLayout() | ||
self.regex_match_bn = QPushButton("通过正则表达式匹配") | ||
self.regex_match_bn.clicked.connect(self.regex_match) | ||
self.r_layout.addWidget(self.regex_match_bn) | ||
self.r_layout.addStretch(0) | ||
|
||
self.main_layout.addWidget(self.name_text) | ||
self.main_layout.addLayout(self.r_layout) | ||
|
||
def regex_match(self): | ||
names = attr_regex_match_dialog.exec_(self) | ||
if names is None: | ||
mc.warning("取消了操作") | ||
return | ||
self.name_text.setPlainText("\n".join(names)) | ||
|
||
def names(self): | ||
return list(self.name_text.toPlainText().splitlines()) | ||
|
||
|
||
class ConnectWidget(QWidget): | ||
def __init__(self, parent=None): | ||
super(ConnectWidget, self).__init__(parent) | ||
self.main_layout = QVBoxLayout(self) | ||
|
||
self.func_sel_widget = FuncSelectWidget(self) | ||
self.match_out_attrs_widget = MatchWidget(self) | ||
self.match_in_attrs_widget = MatchWidget(self) | ||
self.do_bn = QPushButton("执行功能") | ||
self.do_bn.clicked.connect(self.do) | ||
|
||
self.main_layout.addWidget(self.func_sel_widget) | ||
self.main_layout.addWidget(QLabel("输出属性: ")) | ||
self.main_layout.addWidget(self.match_out_attrs_widget) | ||
self.main_layout.addWidget(QLabel("输入属性: ")) | ||
self.main_layout.addWidget(self.match_in_attrs_widget) | ||
self.main_layout.addWidget(self.do_bn) | ||
|
||
@undo_block | ||
def do(self): | ||
out_attrs = self.match_out_attrs_widget.names() | ||
in_attrs = self.match_in_attrs_widget.names() | ||
if len(out_attrs) != len(in_attrs): | ||
raise ValueError("输出输入属性数量不一致") | ||
if self.func_sel_widget.func() == FuncSelectWidget.Connect: | ||
for o, i in zip(out_attrs, in_attrs): | ||
mc.connectAttr(o, i) | ||
else: | ||
for o, i in zip(out_attrs, in_attrs): | ||
mc.disconnectAttr(o, i) | ||
|
||
|
||
def new(): | ||
return ConnectWidget() |
Oops, something went wrong.