Update
@@ -1,209 +0,0 @@
|
||||
"""
|
||||
GS CurveTools License:
|
||||
This collection of code named GS CurveTools is a property of George Sladkovsky (Yehor Sladkovskyi)
|
||||
and can not be copied or distributed without his written permission.
|
||||
|
||||
GS CurveTools v1.3.11 Personal Edition
|
||||
Copyright 2025, George Sladkovsky (Yehor Sladkovskyi)
|
||||
All Rights Reserved
|
||||
|
||||
UI font is Roboto that is licensed under the Apache 2.0 License:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Autodesk Maya is a property of Autodesk, Inc:
|
||||
https://www.autodesk.com/
|
||||
|
||||
Social Media and Contact Links:
|
||||
|
||||
Discord Server: https://discord.gg/f4DH6HQ
|
||||
Online Store: https://sladkovsky3d.artstation.com/store
|
||||
Online Documentation: https://gs-curvetools.readthedocs.io/
|
||||
Twitch Channel: https://www.twitch.tv/videonomad
|
||||
YouTube Channel: https://www.youtube.com/c/GeorgeSladkovsky
|
||||
ArtStation Portfolio: https://www.artstation.com/sladkovsky3d
|
||||
Contact Email: george.sladkovsky@gmail.com
|
||||
"""
|
||||
|
||||
https://www.artstation.com/marketplace-product-eula
|
||||
|
||||
Marketplace Product & Services Agreement
|
||||
|
||||
End User Agreement
|
||||
|
||||
This Marketplace End User Agreement applies to all downloadable products and professional services (e.g. mentorships, personal training, portfolio reviews) sold via the ArtStation Marketplace, unless a custom agreement or license is provided by the seller.
|
||||
|
||||
The EUA is an agreement between the buyer and the seller providing the goods or services.
|
||||
|
||||
PLEASE READ THIS DOCUMENT CAREFULLY. IT SIGNIFICANTLY ALTERS YOUR LEGAL RIGHTS AND REMEDIES.
|
||||
|
||||
BY CLICKING “I AGREE” OR DOWNLOADING OR USING THE DIGITAL PRODUCT OR RECEIVING THE PROFESSIONAL SERVICES TO WHICH THIS AGREEMENT RELATES YOU ACCEPT ALL OF THIS AGREEMENT’S TERMS, INCLUDING THE DISCLAIMERS OF WARRANTIES AND LIMITATIONS ON DAMAGES, USE AND TRANSFERABILITY. IF YOU DO NOT ACCEPT THIS AGREEMENT’S TERMS, DO NOT DOWNLOAD, INSTALL OR USE THE DIGITAL PRODUCT OR RECEIVE OR USE THE PROFESSIONAL SERVICES.
|
||||
|
||||
This end-user agreement (“Agreement”) is a legally binding agreement between you, the licensee and customer (“you” or “your”), and the provider (“we” or “us” or “our”) of the digital products (“Products”) or instructional, training, mentorship or other professional service packages (“Professional Services”) that you purchase through the ArtStation Marketplace, regarding your rights and obligations regarding those Products and Professional Services.
|
||||
|
||||
1. Your Status
|
||||
In this Agreement, “you” means the person or entity acquiring rights in the Products or purchasing Professional Services. That may be a natural person, or a corporate or business entity or organization.
|
||||
|
||||
(a) If you are a natural person then you must be, and you confirm that you are, at least 13 years old. If you are between 13 years and the age of majority in your jurisdiction of residence, you confirm that your parent or legal guardian has reviewed and agrees to this Agreement and is happy for you to access and use the Product or receive the Professional Services.
|
||||
|
||||
(b) If you are a corporate entity then: (i) the rights granted under this Agreement are granted to that entity; (ii) you represent and warrant that the individual completing and accepting this Agreement is an authorized your representative and has the authority to legally bind that you to the Agreement; and (iii) to the extent that one or more of your employees are granted any rights in the Product or to receive Professional Services under this Agreement, you will ensure that your employees comply with this Agreement and you will be responsible and liable for any breach of this Agreement by any employee.
|
||||
|
||||
2. ArtStation
|
||||
ArtStation is a division of Epic Games, Inc., You acknowledge and agree that Epic is a third-party beneficiary of this Agreement and therefore will be entitled to directly enforce and rely upon any provision in this Agreement that confers a benefit on, or rights in favour of, Epic. In addition, you authorize Epic to act as your authorized representative to file a lawsuit or other formal action against a licensor in a court or with any other governmental authority if Epic knows or suspects that a licensor breached any representations or warranties under this Agreement. The foregoing authorization is nonexclusive, and Epic shall be under no obligation to pursue any claim. Epic will not initiate any such action on your behalf without first consulting with and obtaining your approval.
|
||||
|
||||
Products
|
||||
The following sections 3 through 9 apply to any Products you acquire from us through the ArtStation Marketplace:
|
||||
|
||||
3. Product Licence
|
||||
Subject to this Agreement’s terms and conditions, we hereby grant you a limited, non-exclusive, worldwide, non-transferable right and licence to (which will be perpetual unless the licence terminates as set out in this Agreement): (a) download the Product; and (b) copy and use the Product. We reserve all rights not expressly granted to you under this Agreement.
|
||||
|
||||
4. Licence Scope and Restrictions
|
||||
(a) Tutorials
|
||||
You are purchasing ONE licence to create ONE copy of the Product for use by you only (or, if you are a corporate entity, for use by a single authorized employee).
|
||||
|
||||
If this Product is bundled with a stock digital asset then you receive a limited personal use licence regarding that stock digital asset, and you may use that stock digital asset for your personal use only. You will not use that stock digital asset in any commercial manner unless you purchase a separate commercial licence.
|
||||
|
||||
(b) Installable Tools
|
||||
You may purchase one or more licences for the Product. A single licence allows you to install the Product on a single computer at a time for use by a single authorized user. If you are a corporate entity and the authorized employee completing the transaction on your behalf purchases multiple licences, you may choose to store the Product on a single server or shared hard drive for use by a single authorized employee at a time for each licence purchased.
|
||||
|
||||
Provided that you comply with the restrictions on users set out above, you may use the Product on an unlimited number of projects.
|
||||
|
||||
(c) Stock Assets
|
||||
Subject to the restrictions set out in this Agreement, you may copy, use, modify, adapt, translate, distribute, publicly display, transmit, broadcast, and create derivative works from the Product in works you create (“Works”), which may include things like films, videos, multi-media projects, computer games, models, images, publications, broadcasts, documents, and presentations.
|
||||
|
||||
If you are a corporate entity, you may make the Product available for use by your employees in accordance with this Agreement (for example, by storing the Product on a network server).
|
||||
|
||||
You may only share the Product with external people or entities where:
|
||||
- You are collaborating with the external parties in the creation of your Work and you need to share the Product for that purpose, provided that any external party that receives the Product may only use it in your Work and must secure and limit access to the Product for that purpose;
|
||||
- You are working as a contractor for a client in the creation of a Work and need to share the Product with your client, or any external parties working with your client, provided that your client and any such external parties may use the Product only for your client’s Work, and all parties secure and limit access to the Product for that purpose.
|
||||
|
||||
For any other use of the Product by any other party, that party must purchase a licence to the Product.
|
||||
|
||||
In addition to any other restrictions in this Agreement, you will not:
|
||||
- publish, sell, license, offer or make available for sale or licensing, or otherwise distribute the Product except as part of a Work or through a form of sharing that is authorized in this Agreement; or
|
||||
- publish, distribute or make available the Product through any online clearinghouse platform.
|
||||
|
||||
FURTHER SPECIFIC TERMS
|
||||
In addition to the restrictions set out above, the following terms and conditions apply to the following forms of commercial licences for the Product:
|
||||
|
||||
Standard Commercial Licence
|
||||
If you have purchased a Standard Commercial licence then you may exercise your rights under that licence:
|
||||
- for personal use on an unlimited number of personal projects that are not used or distributed in any commercial manner; and
|
||||
- respect to one commercial Work, with up to a maximum of, as applicable, 2,000 sales of the Work or 20,000 monthly views of the Work.
|
||||
|
||||
Extended Commercial Licence
|
||||
If you have purchased an Extended Commercial licence then you may exercise your rights under that licence:
|
||||
- for personal use on an unlimited number of personal projects that are not used or distributed in any commercial manner; and
|
||||
- with respect to any number of commercial Works, with no limit on sales or views.
|
||||
|
||||
5. Additional Restrictions
|
||||
Except as expressly permitted under this Agreement, you will not:
|
||||
|
||||
(a) make any copy of the Product except for archival or backup purposes;
|
||||
|
||||
(b) circumvent or disable any access control technology, security device, procedure, protocol, or technological protection mechanism that may be included or established in or as part of the Product;
|
||||
|
||||
(c) hack, reverse engineer, decompile, disassemble, modify or create derivative works of the Product or any part of the Product;
|
||||
|
||||
(d) publish, sell distribute or otherwise make the Product available to others to use, download or copy;
|
||||
|
||||
(e) transfer or sub-license the Product or any rights under this Agreement to any third party, whether voluntarily or by operation of law;
|
||||
|
||||
(f) use the Product for any purpose that may be defamatory, threatening, abusive, harmful or invasive of anyone’s privacy, or that may otherwise violate any law or give rise to civil or other liability;
|
||||
|
||||
(g) misrepresent yourself as the creator or owner of the Property;
|
||||
|
||||
(h) remove or modify any proprietary notice, symbol or label in or on the Product;
|
||||
|
||||
(i) directly or indirectly assist, facilitate or encourage any third party to carry on any activity prohibited by this Agreement.
|
||||
|
||||
6. Proprietary Rights
|
||||
The Product is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. You are licensing the Product and the right to access, install and use the Product in accordance with this Agreement, not buying the Product. As between you and us, we own all right, title and interest in and to the Product, and you are not acquiring any ownership of or rights in the Product except the limited rights granted under this Agreement.
|
||||
|
||||
7. No Epic Support
|
||||
You acknowledge and agree that you are licensing the Product from us (the Provider), not from Epic, and that Epic has no obligation to support the Product.
|
||||
|
||||
8. Interruptions and Errors
|
||||
Your use of the Product might be interrupted and might not be free of errors.
|
||||
|
||||
9. Updates
|
||||
We have no obligation to update the Product.
|
||||
|
||||
Professional Services
|
||||
The following sections 10 and 11 apply to any Professional Services you purchase from us through the ArtStation Marketplace:
|
||||
|
||||
10. Provision of Professional Services
|
||||
We will provide the Professional Services directly to you and, subject to this Agreement, will assume all responsibility for all aspects of the Professional Services. We represent and warrant that we have the right to offer and provide the Professional Services and that we have appropriate qualifications and experience to provide the Professional Services.
|
||||
|
||||
11. Epic is not Involved
|
||||
You acknowledge and agree that:
|
||||
|
||||
(a) Epic is only a provider of the online ArtStation Marketplace where you purchased the Professional Services, and does not provide or exercise any control or oversight over us or the Professional Services, and is not responsible for us or the Professional Services or any shortcomings in them, including any damages, losses or legal issues caused by us or the Professional Services;
|
||||
|
||||
(b) this Agreement (and any dispute under it) is an agreement between us and you only, and not with Epic, and Epic is not a party to this Agreement;
|
||||
|
||||
(c) we are not Epic’s employee, agent or subcontractor;
|
||||
|
||||
(d) Epic does not have any obligation to attempt to resolve any dispute between us and you; and
|
||||
|
||||
(e) we will provide the Professional Services directly to you, and we (and not Epic) are solely responsible for the Professional Services, and Epic has no obligation or liability to you with respect to the Professional Services.
|
||||
|
||||
Both Products and Services
|
||||
The following sections 12 through 25 apply to all Products or Services you purchase from us through the ArtStation Marketplace:
|
||||
|
||||
12. Disclaimer
|
||||
ANY PRODUCTS OR PROFESSIONAL SERVICES ARE PROVIDED ON AN “AS IS” AND “AS AVAILABLE” BASIS, WITHOUT ANY REPRESENTATIONS, WARRANTIES OR CONDITIONS OF ANY KIND.
|
||||
|
||||
TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW WE DISCLAIM, AND YOU WAIVE (WITH REGARD TO US AND ALSO TO EPIC, ITS AFFILIATES, AND ITS AND THEIR LICENSORS AND SERVICE PROVIDERS (COLLECTIVELY, THE “EPIC PARTIES”), ALL TERMS, CONDITIONS, GUARANTEES, REPRESENTATIONS AND WARRANTIES (EXPRESS, IMPLIED, STATUTORY AND OTHERWISE), IN RESPECT OF THE PRODUCTS AND PROFESSIONAL SERVICES, INCLUDING THOSE OF MERCHANTABILITY, NON-INFRINGEMENT, TITLE, QUALITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
NEITHER WE NOR ANY OF THE EPIC PARTIES REPRESENT OR WARRANT THAT: (A) ANY PRODUCT OR PROFESSIONAL SERVICE IS ACCURATE, COMPLETE, RELIABLE, CURRENT OR ERROR-FREE; (B) ANY PRODUCT OR PROFESSIONAL SERVICE WILL MEET YOUR REQUIREMENTS OR EXPECTATIONS; (C) ANY PRODUCT OR PROFESSIONAL SERVICES IS FREE OF VIRUSES OR OTHER HARMFUL COMPONENTS; OR (D) ANY DEFECTS IN ANY PRODUCT OR PROFESSIONAL SERVICE WILL BE CORRECTED.
|
||||
|
||||
13. Exclusion and Limitation of Liability
|
||||
(a) YOU DOWNLOAD, INSTALL AND OTHERWISE USE ALL PRODUCTS, AND RECEIVE AND USE ALL PROFESSIONAL SERVICES, AT YOUR OWN RISK. YOU AGREE TO, AND HEREBY DO:
|
||||
|
||||
(i) WAIVE ANY CLAIMS THAT YOU MAY HAVE AGAINST US OR THE EPIC PARTIES OR OUR RESPECTIVE DIRECTORS, OFFICERS, EMPLOYEES, AGENTS, REPRESENTATIVES, LICENSORS, SUCCESSORS AND ASSIGNS (COLLECTIVELY THE “RELEASEES”) ARISING FROM OR RELATING TO ANY PRODUCTS OR PROFESSIONAL SERVICES, AND
|
||||
|
||||
(ii) RELEASE THE RELEASEES FROM ANY LIABILITY FOR ANY LOSS, DAMAGE, EXPENSE OR INJURY ARISING FROM OR RELATING TO YOUR USE OF ANY PRODUCT OR PROFESSIONAL SERVICE, WHETHER ARISING IN TORT (INCLUDING NEGLIGENCE), CONTRACT OR OTHERWISE, EVEN IF THE RELEASEES ARE EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH LOSS, INJURY OR DAMAGE AND EVEN IF THAT LOSS, INJURY OR DAMAGE IS FORESEEABLE.
|
||||
|
||||
(b) NEITHER WE NOR THE EPIC PARTIES WILL BE LIABLE FOR ANY LOSSES, DAMAGES, CLAIMS OR EXPENSES THAT CONSTITUTE: (I) LOSS OF INTEREST, PROFIT, BUSINESS, CUSTOMERS OR REVENUE; (II) BUSINESS INTERRUPTIONS; (III) COST OF REPLACEMENT PRODUCTS OR SERVICES; OR (IV) LOSS OF OR DAMAGE TO REPUTATION OR GOODWILL.
|
||||
|
||||
(c) NEITHER WE NOR THE EPIC PARTIES WILL BE LIABLE FOR ANY LOSSES, DAMAGES, CLAIMS OR EXPENSES THAT CONSTITUTE INCIDENTAL, CONSEQUENTIAL, SPECIAL, PUNITIVE, EXEMPLARY, MULTIPLE OR INDIRECT DAMAGES, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, DAMAGES, CLAIMS OR EXPENSES.
|
||||
|
||||
(d) MAXIMUM LIABILITY: IF, DESPITE THE LIMITATIONS SET OUT ABOVE, WE OR ANY EPIC PARTY BECOME LIABLE TO YOU IN RESPECT OF ANY PRODUCT OR PROFESSIONAL SERVICE OR OTHERWISE UNDER THIS AGREEMENT, THE ENTIRE CUMULATIVE LIABILITY OF US AND THE EPIC PARTIES, AND YOUR EXCLUSIVE AND CUMULATIVE REMEDY, FOR ANY DAMAGES (REGARDLESS OF THE CAUSE OR FORM OR ACTION), WILL BE LIMITED TO CAD$10.
|
||||
|
||||
14. Indemnity
|
||||
As a condition of your use of any Product or any Professional Services, you agree to hold harmless and indemnify the Releasees from any liability for any loss or damage to any third party resulting from your access to, installation or use of the Product or your receipt and use of the Professional Services.
|
||||
|
||||
15. Term and Termination
|
||||
This Agreement is effective until terminated. Your rights under this Agreement will terminate automatically without notice if: (a) you breach any terms of this Agreement; or (b) you do not complete payment for the Product or Professional Services, or any payment you make is refunded, reversed or cancelled for any reason. Upon this Agreement’s termination, you will cease all use of the Product and destroy all copies, full or partial, of the Product in your possession. Sections 11 through 25 will survive the termination of this Agreement.
|
||||
|
||||
16. Compliance with Laws
|
||||
You will comply with all applicable laws when using any Product or Professional Services (including intellectual property and export control laws).
|
||||
|
||||
17. Entire Agreement
|
||||
This Agreement supersedes all prior agreements of the parties regarding the Product or Professional Services, and constitutes the whole agreement with respect to the Product or Professional Services.
|
||||
|
||||
18. Disputes
|
||||
If you have any concerns about the Product or Professional Services, please contact us through our ArtStation Marketplace account and we will work with you to try to resolve the issue. You acknowledge and agree that any such dispute is between you and us, and that Epic will not be involved in the dispute and has no obligation to try to resolve the dispute.
|
||||
|
||||
19. Persons Bound
|
||||
This Agreement will enure to the benefit of and be binding upon the parties and their heirs, executors, administrators, legal representatives, lawful successors and permitted assigns.
|
||||
|
||||
20. Assignment
|
||||
We may assign this Agreement without notice to you. You may not assign this Agreement or any of your rights under it without our prior written consent, which we will not withhold unreasonably.
|
||||
|
||||
21. Waiver
|
||||
No waiver, delay, or failure to act by us regarding any particular default or omission will prejudice or impair any of our rights or remedies regarding that or any subsequent default or omission that are not expressly waived in writing.
|
||||
|
||||
22. Applicable Law and Jurisdiction
|
||||
You agree that this Agreement will be deemed to have been made and executed in the State of North Carolina, U.S.A., and any dispute will be resolved in accordance with the laws of North Carolina, excluding that body of law related to choice of laws, and of the United States of America. Any action or proceeding brought to enforce the terms of this Agreement or to adjudicate any dispute must be brought in the Superior Court of Wake County, State of North Carolina or the United States District Court for the Eastern District of North Carolina. You agree to the exclusive jurisdiction and venue of these courts. You waive any claim of inconvenient forum and any right to a jury trial. The Convention on Contracts for the International Sale of Goods will not apply. Any law or regulation which provides that the language of a contract shall be construed against the drafter will not apply to this Agreement.
|
||||
|
||||
23. Legal Effect
|
||||
This Agreement describes certain legal rights. You may have other rights under the laws of your country. This Agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
|
||||
|
||||
24. Interpretation
|
||||
In this Agreement, "we", "us", and "our" refer to the licensor of the Product alone and never refer to the combination of you and that licensor (that combination is referred to as "the parties"), or the combination of you or the licensor with Epic.
|
||||
|
||||
25. Artificial Intelligence
|
||||
For purposes of this Agreement, “Generative AI Programs” means artificial intelligence, machine learning, deep learning, neural networks, or similar technologies designed to automate the generation of or aid in the creation of new content, including but not limited to audio, visual, or text-based content.
|
||||
|
||||
We (the licensor of the Product) represent and warrant that where the Product was created using Generative AI Programs, we have applied the “CreatedWithAI” tag. Under this Agreement, a Product is considered to be created using Generative AI Programs where a material portion of a Product is generated with Generative AI Programs, whether characters, backgrounds, or other material elements. A Product is not considered to be created using Generative AI Programs merely for use of features that solely operate on a Product (e.g., AI-based upscaling or content-aware fill).
|
||||
@@ -1,35 +0,0 @@
|
||||
GS CurveTools installation
|
||||
|
||||
1. Copy gs_curvetools folder to {Path to Documents}\Documents\Maya\{Maya Version}\scripts\
|
||||
|
||||
Example of the final folder structure:
|
||||
|
||||
Documents\Maya\2022\scripts\gs_curvetools\fonts
|
||||
Documents\Maya\2022\scripts\gs_curvetools\icons
|
||||
Documents\Maya\2022\scripts\gs_curvetools\utils
|
||||
Documents\Maya\2022\scripts\gs_curvetools\__init__.py
|
||||
Documents\Maya\2022\scripts\gs_curvetools\core.py
|
||||
Documents\Maya\2022\scripts\gs_curvetools\init.py
|
||||
Documents\Maya\2022\scripts\gs_curvetools\LICENSE.txt
|
||||
Documents\Maya\2022\scripts\gs_curvetools\main.py
|
||||
Documents\Maya\2022\scripts\gs_curvetools\README.txt
|
||||
|
||||
2. Run Maya
|
||||
|
||||
3. Copy and paste this line to "Python" command box and press "Enter":
|
||||
|
||||
import gs_curvetools.init as ct_init;from imp import reload;reload(ct_init);ct_init.Init();
|
||||
|
||||
IMPORTANT: There should be no spaces or tabs before this command!
|
||||
|
||||
4. Look for GS tab on your Shelf
|
||||
|
||||
5. Click CT UI button to run the menu. Click again to hide the menu.
|
||||
|
||||
NOTES:
|
||||
>> To reset to factory defaults click CT with "refresh" arrow button.
|
||||
>> To stop all scripts and close the menu press CT DEL button.
|
||||
>> You can use middle-mouse button drag to move the buttons to any tab.
|
||||
>> All the hotkeys are available in Hotkey Editor > Custom Scripts > GS > GS_CurveTools.
|
||||
>> Always repeat initialization steps when updating the plug-in to a new version.
|
||||
>> You can always repeat initialization steps if you lost control buttons or shelf.
|
||||
|
Before Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 118 B |
|
Before Width: | Height: | Size: 178 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,93 +0,0 @@
|
||||
"""
|
||||
CV Manipulator (highlighting) plug-in entry point for Mac
|
||||
---
|
||||
GS CurveTools License:
|
||||
This collection of code named GS CurveTools is a property of George Sladkovsky (Yehor Sladkovskyi)
|
||||
and can not be copied or distributed without his written permission.
|
||||
|
||||
GS CurveTools v1.3.11 Personal Edition
|
||||
Copyright 2025, George Sladkovsky (Yehor Sladkovskyi)
|
||||
All Rights Reserved
|
||||
|
||||
UI font is Roboto that is licensed under the Apache 2.0 License:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Autodesk Maya is a property of Autodesk, Inc:
|
||||
https://www.autodesk.com/
|
||||
|
||||
Social Media and Contact Links:
|
||||
|
||||
Discord Server: https://discord.gg/f4DH6HQ
|
||||
Online Store: https://sladkovsky3d.artstation.com/store
|
||||
Online Documentation: https://gs-curvetools.readthedocs.io/
|
||||
Twitch Channel: https://www.twitch.tv/videonomad
|
||||
YouTube Channel: https://www.youtube.com/c/GeorgeSladkovsky
|
||||
ArtStation Portfolio: https://www.artstation.com/sladkovsky3d
|
||||
Contact Email: george.sladkovsky@gmail.com
|
||||
"""
|
||||
|
||||
# pylint: disable-all
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
from importlib import reload
|
||||
except ImportError:
|
||||
from imp import reload
|
||||
|
||||
import maya.api.OpenMaya as om
|
||||
import maya.api.OpenMayaRender as omr
|
||||
|
||||
from gs_curvetools.config.constants import NODES
|
||||
from gs_curvetools.plugins import cv_manip_src
|
||||
|
||||
reload(cv_manip_src)
|
||||
|
||||
# API parameters
|
||||
maya_useNewAPI = True
|
||||
|
||||
|
||||
# ------------ Init & UnInit Plugin ------------
|
||||
def initializePlugin(obj):
|
||||
plugin = om.MFnPlugin(obj, "GeorgeSladkovsky", "1.3", "Any")
|
||||
try:
|
||||
plugin.registerNode(
|
||||
NODES.DrawManager.node,
|
||||
cv_manip_src.DrawManagerNode.id,
|
||||
cv_manip_src.DrawManagerNode.creator,
|
||||
cv_manip_src.DrawManagerNode.initialize,
|
||||
om.MPxNode.kLocatorNode,
|
||||
cv_manip_src.DrawManagerNode.drawDbClassification,
|
||||
)
|
||||
except BaseException:
|
||||
sys.stderr.write("Failed to register node\n")
|
||||
raise
|
||||
|
||||
try:
|
||||
omr.MDrawRegistry.registerDrawOverrideCreator(
|
||||
cv_manip_src.DrawManagerNode.drawDbClassification,
|
||||
cv_manip_src.DrawManagerNode.drawRegistrantId,
|
||||
cv_manip_src.DrawOverride.creator,
|
||||
)
|
||||
except BaseException:
|
||||
sys.stderr.write("Failed to register override\n")
|
||||
raise
|
||||
|
||||
|
||||
def uninitializePlugin(obj):
|
||||
om.MMessage.removeCallbacks(cv_manip_src.CALLBACK_IDS)
|
||||
cv_manip_src.CALLBACK_IDS = []
|
||||
plugin = om.MFnPlugin(obj)
|
||||
try:
|
||||
plugin.deregisterNode(cv_manip_src.DrawManagerNode.id)
|
||||
except BaseException:
|
||||
sys.stderr.write("Failed to deregister node\n")
|
||||
raise
|
||||
|
||||
try:
|
||||
omr.MDrawRegistry.deregisterGeometryOverrideCreator(
|
||||
cv_manip_src.DrawManagerNode.drawDbClassification, cv_manip_src.DrawManagerNode.drawRegistrantId
|
||||
)
|
||||
except BaseException:
|
||||
sys.stderr.write("Failed to deregister override\n")
|
||||
raise
|
||||
@@ -1,949 +0,0 @@
|
||||
"""
|
||||
Curve control window
|
||||
---
|
||||
GS CurveTools License:
|
||||
This collection of code named GS CurveTools is a property of George Sladkovsky (Yehor Sladkovskyi)
|
||||
and can not be copied or distributed without his written permission.
|
||||
|
||||
GS CurveTools v1.3.10 Personal Edition
|
||||
Copyright 2025, George Sladkovsky (Yehor Sladkovskyi)
|
||||
All Rights Reserved
|
||||
|
||||
UI font is Roboto that is licensed under the Apache 2.0 License:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Autodesk Maya is a property of Autodesk, Inc:
|
||||
https://www.autodesk.com/
|
||||
|
||||
Social Media and Contact Links:
|
||||
|
||||
Discord Server: https://discord.gg/f4DH6HQ
|
||||
Online Store: https://sladkovsky3d.artstation.com/store
|
||||
Online Documentation: https://gs-curvetools.readthedocs.io/
|
||||
Twitch Channel: https://www.twitch.tv/videonomad
|
||||
YouTube Channel: https://www.youtube.com/c/GeorgeSladkovsky
|
||||
ArtStation Portfolio: https://www.artstation.com/sladkovsky3d
|
||||
Contact Email: george.sladkovsky@gmail.com
|
||||
"""
|
||||
from functools import partial
|
||||
import maya.cmds as mc
|
||||
from gs_curvetools.api.maya_tools import deferred, no_undo, undo
|
||||
from gs_curvetools.api.qt_compat import *
|
||||
from gs_curvetools.api.utils import open_link
|
||||
from gs_curvetools.config.constants import *
|
||||
from gs_curvetools.config.folders import GetFolder
|
||||
from gs_curvetools.core.core import Core
|
||||
from gs_curvetools.debug.logger import logger
|
||||
from gs_curvetools.managers.options_manager import OptionsManager
|
||||
from gs_curvetools.managers.script_jobs import ScriptJobs
|
||||
from gs_curvetools.managers.widget_manager import WidgetManager
|
||||
from gs_curvetools.ui import style
|
||||
from gs_curvetools.ui.tooltips import Tooltips
|
||||
from gs_curvetools.ui.utils import maya_dockable_window
|
||||
from gs_curvetools.ui.widgets import Button, ColorPicker, Column, ControlSlider, FallOffCurve, FloatField, Frame, IconCheckButton, Label, LayerSelector, LineEdit, PopOutWindow, Row, maya_slider, separator
|
||||
|
||||
class CurveControlWindow(QWidget):
|
||||
"""曲线控制用户界面"""
|
||||
update_curve_control_ui = Signal()
|
||||
update_main_ui = Signal()
|
||||
|
||||
def __init__(self, parent):
|
||||
super(CurveControlWindow, self).__init__(parent)
|
||||
self.core = Core.singleton()
|
||||
self.widget_manager = WidgetManager()
|
||||
self.options_manager = OptionsManager()
|
||||
self.script_jobs = ScriptJobs.singleton()
|
||||
self.tooltips = Tooltips()
|
||||
|
||||
def open_ui(self):
|
||||
"""创建曲线控制工作区"""
|
||||
if mc.workspaceControl(WINDOWS.CurveControl.name, q=1, ex=1):
|
||||
if not mc.workspaceControl(WINDOWS.CurveControl.name, q=1, vis=1):
|
||||
mc.workspaceControl(WINDOWS.CurveControl.name, e=1, rs=1)
|
||||
deferred(self.update_main_ui.emit)()
|
||||
else:
|
||||
mc.workspaceControl(WINDOWS.CurveControl.name, e=1, vis=0)
|
||||
return
|
||||
else:
|
||||
dockable_window = maya_dockable_window(name=WINDOWS.CurveControl.name, label="曲线控制", i_w=350, i_h=750, width_property='free')
|
||||
layout = dockable_window.layout()
|
||||
assert layout is not None, '未找到布局'
|
||||
layout.addWidget(self)
|
||||
self.create_ui()
|
||||
self.update_curve_control_ui.emit()
|
||||
self.script_jobs.check_script_jobs(WINDOWS.CurveControl.name)
|
||||
|
||||
def create_ui(self):
|
||||
"""创建曲线控制用户界面"""
|
||||
main_layout = QtWidgets.QVBoxLayout(self)
|
||||
main_layout.setContentsMargins(*style.scale([2, 0, 2, 0]))
|
||||
scroll_widget = QtWidgets.QWidget()
|
||||
layout = QtWidgets.QVBoxLayout(scroll_widget)
|
||||
scroll_area = QtWidgets.QScrollArea()
|
||||
scroll_area.setWidget(scroll_widget)
|
||||
main_layout.addWidget(scroll_area)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(style.scale(2))
|
||||
layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
scroll_area.setFrameShape(QtWidgets.QFrame.Shape.NoFrame)
|
||||
scroll_area.setWidgetResizable(True)
|
||||
layout.addWidget(separator())
|
||||
with Row(layout, 'gsCurveControlHeader') as row:
|
||||
row_layout = row.layout()
|
||||
if not row_layout:
|
||||
raise RuntimeError('未找到行布局')
|
||||
layer_selector = LayerSelector('gsLayerSelector', row_layout)
|
||||
layer_selector.setFixedWidth(style.scale(40))
|
||||
layer_selector.currentIndexChanged.connect(self.core.layer_manager.change_layer_via_option_menu)
|
||||
layer_color_picker = ColorPicker('gsColorPicker', row_layout)
|
||||
layer_color_picker.setContentsMargins(*style.scale([3, 3, 1, 3]))
|
||||
layer_color_picker.setFixedWidth(style.scale(20))
|
||||
layer_color_picker.connect_command(self.core.color_mode.change_layer_color_via_picker)
|
||||
curve_color_picker = ColorPicker('gsCurveColorPicker', row_layout)
|
||||
curve_color_picker.setContentsMargins(*style.scale([1, 3, 2, 3]))
|
||||
curve_color_picker.setFixedWidth(style.scale(20))
|
||||
curve_color_picker.connect_command(self.core.color_mode.change_curve_color_via_picker)
|
||||
selected_object_name = LineEdit('selectedObjectName', row_layout)
|
||||
selected_object_name.setPlaceholderText('选择曲线')
|
||||
selected_object_name.returnPressed.connect(undo(self.core.functions.rename_selected))
|
||||
line_thickness = FloatField('lineWidth', row_layout)
|
||||
line_thickness.setFixedWidth(style.scale(35))
|
||||
line_thickness.set_range(-1, 10)
|
||||
line_thickness.set_value(-1)
|
||||
line_thickness.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, line_thickness))
|
||||
line_thickness.set_release_command(self.core.sliders.release)
|
||||
layout.addWidget(separator())
|
||||
label = Label(layout, 'selectCurvesPrompt')
|
||||
label.set_label('选择兼容的曲线')
|
||||
label.set_font_size(14)
|
||||
label.setVisible(False)
|
||||
with Column(layout, 'axisFrame') as column:
|
||||
column_layout = column.layout()
|
||||
if not column_layout:
|
||||
raise RuntimeError('未找到列布局')
|
||||
label = Label(column_layout)
|
||||
label.set_label('轴控制')
|
||||
label.set_font_size(14)
|
||||
with Row(column.layout()) as row:
|
||||
axis_button_grp = QtWidgets.QButtonGroup(row)
|
||||
self.widget_manager.add('Axis', axis_button_grp)
|
||||
axis_auto = Button(row.layout(), 'gsBindAxisAuto')
|
||||
axis_auto.set_label('自动', line_height=100)
|
||||
axis_auto.setCheckable(True)
|
||||
axis_auto.set_button_style('small')
|
||||
axis_auto.setChecked(True)
|
||||
axis_auto.clicked.connect(partial(undo(self.core.functions.apply_axis), 0))
|
||||
axis_x = Button(row.layout(), 'gsBindAxisX')
|
||||
axis_x.set_label('X', line_height=100)
|
||||
axis_x.setCheckable(True)
|
||||
axis_x.set_button_style('small')
|
||||
axis_x.clicked.connect(partial(undo(self.core.functions.apply_axis), 1))
|
||||
axis_y = Button(row.layout(), 'gsBindAxisY')
|
||||
axis_y.set_label('Y', line_height=100)
|
||||
axis_y.setCheckable(True)
|
||||
axis_y.set_button_style('small')
|
||||
axis_y.clicked.connect(partial(undo(self.core.functions.apply_axis), 2))
|
||||
axis_z = Button(row.layout(), 'gsBindAxisZ')
|
||||
axis_z.set_label('Z', line_height=100)
|
||||
axis_z.setCheckable(True)
|
||||
axis_z.set_button_style('small')
|
||||
axis_z.clicked.connect(partial(undo(self.core.functions.apply_axis), 3))
|
||||
axis_button_grp.addButton(axis_auto, 0)
|
||||
axis_button_grp.addButton(axis_x, 1)
|
||||
axis_button_grp.addButton(axis_y, 2)
|
||||
axis_button_grp.addButton(axis_z, 3)
|
||||
axis_flip = Button(row.layout(), 'AxisFlip')
|
||||
axis_flip.set_label('翻转', line_height=100)
|
||||
axis_flip.setCheckable(True)
|
||||
axis_flip.set_button_style('small')
|
||||
axis_flip.clicked.connect(partial(undo(self.core.functions.apply_axis), -1))
|
||||
column_layout.addWidget(separator())
|
||||
with Row(column.layout(), margins=style.scale([0, 0, 0, 0]), obj_name='originalCurvesRow') as original_curves_row:
|
||||
select_original_curves = Button(original_curves_row.layout(), 'selectOriginalCurves')
|
||||
select_original_curves.set_label('选择原始曲线', line_height=100)
|
||||
select_original_curves.set_button_style('small-filled')
|
||||
select_original_curves.clicked.connect(undo(self.core.curve_control.select_original_objects))
|
||||
edit_orig_obj = Button(original_curves_row.layout(), 'editOrigObj')
|
||||
edit_orig_obj.set_label('编辑原始对象', line_height=100)
|
||||
edit_orig_obj.setCheckable(True)
|
||||
edit_orig_obj.set_button_style('small')
|
||||
edit_orig_obj.clicked.connect(undo(self.core.curve_control.edit_original_objects))
|
||||
column_layout.addWidget(separator())
|
||||
with Row(layout, margins=style.scale([0, 0, 3, 0])) as length_divisions_row:
|
||||
length_division = ControlSlider(obj_name='lengthDivisions', typ='int')
|
||||
length_division.set_label('长度分段')
|
||||
length_division.set_min_max(2, 100)
|
||||
length_division.set_field_min_max(2, 10000)
|
||||
length_division.set_value(2)
|
||||
length_division.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, length_division))
|
||||
length_division.set_release_command(self.core.sliders.release)
|
||||
dynamic_divisions_toggle = Button(obj_name='dynamicDivisions')
|
||||
dynamic_divisions_toggle.set_label('自动')
|
||||
dynamic_divisions_toggle.setFixedWidth(style.scale(35))
|
||||
dynamic_divisions_toggle.set_button_style('small')
|
||||
dynamic_divisions_toggle.setCheckable(True)
|
||||
dynamic_divisions_toggle.clicked.connect(undo(self.core.functions.toggle_dynamic_divisions))
|
||||
length_division_layout = length_divisions_row.layout()
|
||||
if not isinstance(length_division_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到长度分段布局')
|
||||
length_division_layout.addWidget(length_division, 4)
|
||||
length_division_layout.addWidget(dynamic_divisions_toggle, 1)
|
||||
width_division = ControlSlider(layout, 'widthDivisions', 'int')
|
||||
width_division.set_label('宽度分段')
|
||||
width_division.set_min_max(2, 31)
|
||||
width_division.set_field_min_max(2, 10000)
|
||||
width_division.set_value(2)
|
||||
width_division.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, width_division))
|
||||
width_division.set_release_command(self.core.sliders.release)
|
||||
orientation = ControlSlider(layout, 'Orientation', 'float')
|
||||
orientation.set_label('方向')
|
||||
orientation.set_min_max(-180, 180)
|
||||
orientation.set_field_min_max(-36000, 36000)
|
||||
orientation.set_precision(1)
|
||||
orientation.set_step(0.5)
|
||||
orientation.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, orientation))
|
||||
orientation.set_release_command(self.core.sliders.release)
|
||||
twist = ControlSlider(layout, 'Twist', 'float')
|
||||
twist.set_label('扭曲')
|
||||
twist.set_min_max(-180, 180)
|
||||
twist.set_field_min_max(-36000, 36000)
|
||||
twist.set_precision(1)
|
||||
twist.set_step(0.5)
|
||||
twist.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, twist))
|
||||
twist.set_release_command(self.core.sliders.release)
|
||||
inv_twist = ControlSlider(layout, 'invTwist', 'float')
|
||||
inv_twist.set_label('反向扭曲')
|
||||
inv_twist.set_min_max(-180, 180)
|
||||
inv_twist.set_field_min_max(-36000, 36000)
|
||||
inv_twist.set_precision(1)
|
||||
inv_twist.set_step(0.5)
|
||||
inv_twist.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, inv_twist))
|
||||
inv_twist.set_release_command(self.core.sliders.release)
|
||||
with Frame(layout, 'twistCurveFrame', margins=[0, 1, 0, 2]) as twist_curve_frame:
|
||||
twist_curve_frame.get_frame_button().set_label('扭曲曲线图表')
|
||||
twist_graph = FallOffCurve(twist_curve_frame.get_frame_layout(), 'twistCurve')
|
||||
|
||||
def twist_graph_command(_):
|
||||
self.core.attributes.propagate_graphs(twist_graph)
|
||||
self.core.attributes.store_graphs(twist_graph)
|
||||
twist_graph.change_command(twist_graph_command)
|
||||
with Row(twist_curve_frame.get_frame_layout(), margins=style.scale([5, 0, 5, 2])) as row:
|
||||
row.setFixedHeight(int(style.BUTTON_HEIGHT))
|
||||
magnitude = FloatField('Magnitude', row.layout())
|
||||
magnitude.setFixedWidth(style.scale(45))
|
||||
magnitude.set_range(-99, 99)
|
||||
magnitude.set_step(0.01)
|
||||
magnitude.set_precision(2)
|
||||
magnitude.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, magnitude))
|
||||
magnitude.set_release_command(self.core.sliders.release)
|
||||
reset_button = Button(row.layout(), 'gsTwistGraphResetButton')
|
||||
reset_button.set_label('重置曲线')
|
||||
|
||||
def reset_twist_cmd():
|
||||
self.core.utils.reset_single_graph('twist')
|
||||
self.core.attributes.store_graphs(twist_graph)
|
||||
reset_button.clicked.connect(undo(reset_twist_cmd))
|
||||
pop_out_button = Button(row.layout(), 'gsTwistGraphPopOut')
|
||||
pop_out_button.setFixedWidth(style.scale(56))
|
||||
pop_out_button.set_label('^')
|
||||
pop_out_button.clicked.connect(self.twist_graph_pop_out)
|
||||
width = ControlSlider(layout, 'Width', 'float')
|
||||
width.set_label('宽度')
|
||||
width.set_min_max(0.001, 2)
|
||||
width.set_field_min_max(0.001, 1000)
|
||||
width.set_precision(3)
|
||||
width.set_step(0.001)
|
||||
width.set_value(1)
|
||||
width.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, width))
|
||||
width.set_release_command(self.core.sliders.release)
|
||||
taper = ControlSlider(layout, 'Taper', 'float')
|
||||
taper.set_label('锥度')
|
||||
taper.set_min_max(0.001, 3)
|
||||
taper.set_field_min_max(0.001, 1000)
|
||||
taper.set_precision(3)
|
||||
taper.set_step(0.001)
|
||||
taper.set_value(1)
|
||||
taper.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, taper))
|
||||
taper.set_release_command(self.core.sliders.release)
|
||||
with Row(layout, obj_name='widthComboSlider', spacing=0) as row:
|
||||
row_layout = row.layout()
|
||||
if not row_layout:
|
||||
raise RuntimeError('未找到行布局')
|
||||
with Column(row.layout()) as column:
|
||||
column_layout = column.layout()
|
||||
if not column_layout:
|
||||
raise RuntimeError('未找到列布局')
|
||||
width_x = ControlSlider(column_layout, 'WidthX', 'float')
|
||||
width_x.set_label('宽度 X')
|
||||
width_x.set_min_max(0.001, 2)
|
||||
width_x.set_field_min_max(0.001, 1000)
|
||||
width_x.set_precision(3)
|
||||
width_x.set_step(0.001)
|
||||
width_x.set_value(1)
|
||||
width_x.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, width_x))
|
||||
width_x.set_release_command(self.core.sliders.release)
|
||||
width_z = ControlSlider(column.layout(), 'WidthZ', 'float')
|
||||
width_z.set_label('宽度 Z')
|
||||
width_z.set_min_max(0.001, 2)
|
||||
width_z.set_field_min_max(0.001, 1000)
|
||||
width_z.set_precision(3)
|
||||
width_z.set_step(0.001)
|
||||
width_z.set_value(1)
|
||||
width_z.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, width_z))
|
||||
width_z.set_release_command(self.core.sliders.release)
|
||||
lock_button = IconCheckButton(row_layout, 'widthLockSwitch')
|
||||
lock_button.set_icons(GetFolder.icons() + 'sliderLock_en_reversed.png', GetFolder.icons() + 'sliderLock_reversed.png')
|
||||
lock_button.set_icon_width_height(10, 30)
|
||||
lock_button.setChecked(True)
|
||||
with Frame(layout, 'widthCurveFrame', margins=[0, 1, 0, 2]) as width_curve_frame:
|
||||
width_curve_frame.get_frame_button().set_label('宽度曲线图表')
|
||||
width_graph = FallOffCurve(width_curve_frame.get_frame_layout(), 'scaleCurve')
|
||||
|
||||
def width_graph_command(_):
|
||||
self.core.attributes.propagate_graphs(width_graph)
|
||||
self.core.attributes.store_graphs(width_graph)
|
||||
width_graph.change_command(width_graph_command)
|
||||
with Row(width_curve_frame.get_frame_layout(), margins=style.scale([5, 0, 5, 2])) as row:
|
||||
row.setFixedHeight(int(style.BUTTON_HEIGHT))
|
||||
reset_button = Button(row.layout(), 'gsWidthGraphResetButton')
|
||||
reset_button.set_label('重置曲线')
|
||||
|
||||
def reset_width_cmd():
|
||||
self.core.utils.reset_single_graph('scale')
|
||||
self.core.attributes.store_graphs(width_graph)
|
||||
reset_button.clicked.connect(undo(reset_width_cmd))
|
||||
pop_out_button = Button(row.layout(), 'gsWidthGraphPopOut')
|
||||
pop_out_button.setFixedWidth(style.scale(56))
|
||||
pop_out_button.set_label('^')
|
||||
pop_out_button.clicked.connect(self.width_graph_pop_out)
|
||||
length_unlock = Button(layout, 'LengthLock')
|
||||
length_unlock.set_label('长度解锁', line_height=100)
|
||||
length_unlock.setCheckable(True)
|
||||
length_unlock.set_button_style('small')
|
||||
length_unlock.setFixedWidth(style.scale(106))
|
||||
length_unlock.clicked.connect(partial(self.core.updates.curve_control_check_boxes, 2))
|
||||
length = ControlSlider(layout, 'Length', 'float')
|
||||
length.set_label('长度')
|
||||
length.set_min_max(0.001, 40)
|
||||
length.set_field_min_max(-1000, 1000)
|
||||
length.set_precision(3)
|
||||
length.set_step(0.001)
|
||||
length.set_value(20)
|
||||
length.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, length))
|
||||
length.set_release_command(self.core.sliders.release)
|
||||
offset = ControlSlider(layout, 'Offset', 'float')
|
||||
offset.set_label('偏移')
|
||||
offset.set_min_max(-1, 1)
|
||||
offset.set_field_min_max(-30, 30)
|
||||
offset.set_step(0.001)
|
||||
offset.set_value(1)
|
||||
offset.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, offset))
|
||||
offset.set_release_command(self.core.sliders.release)
|
||||
profile = ControlSlider(layout, 'Profile', 'float')
|
||||
profile.set_label('轮廓')
|
||||
profile.set_min_max(-2, 2)
|
||||
profile.set_field_min_max(-1000, 1000)
|
||||
profile.set_step(0.001)
|
||||
profile.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, profile))
|
||||
profile.set_release_command(self.core.sliders.release)
|
||||
with Frame(layout, 'profileCurveGraph', margins=[0, 1, 0, 2]) as profile_curve_frame:
|
||||
profile_curve_frame.get_frame_button().set_label('轮廓曲线图表')
|
||||
profile_graph = FallOffCurve(profile_curve_frame.get_frame_layout(), 'profileCurve', attr=False)
|
||||
|
||||
def change_command(value):
|
||||
self.core.attributes.update_lattice(value)
|
||||
self.core.attributes.equalize_profile_curve()
|
||||
self.core.attributes.store_graphs(profile_graph)
|
||||
profile_graph.change_command(change_command)
|
||||
profile_smoothing_slider = ControlSlider(profile_curve_frame.get_frame_layout(), 'profileSmoothing', 'int')
|
||||
profile_smoothing_slider.set_label('平滑度')
|
||||
profile_smoothing_slider.set_min_max(2, 30)
|
||||
profile_smoothing_slider.set_value(2)
|
||||
profile_smoothing_slider.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, profile_smoothing_slider))
|
||||
profile_smoothing_slider.set_release_command(self.core.sliders.release)
|
||||
with Row(profile_curve_frame.get_frame_layout(), margins=style.scale([5, 0, 5, 2])) as row:
|
||||
row.setFixedHeight(int(style.BUTTON_HEIGHT))
|
||||
with Column(row.layout(), spacing=0) as eq_column:
|
||||
eq_column.setFixedHeight(style.scale(24))
|
||||
with Row(eq_column.layout(), spacing=0) as eq_row:
|
||||
|
||||
def toggle_eq():
|
||||
self.widget_manager.get('equalizeCurveButton').setDisabled(self.widget_manager.get('autoEqualizeSwitchOn').isChecked())
|
||||
auto_equalize_group = QtWidgets.QButtonGroup(eq_row)
|
||||
auto_equalize_group.buttonClicked.connect(toggle_eq)
|
||||
auto_equalize_group.buttonClicked.connect(undo(self.core.attributes.equalize_profile_curve))
|
||||
auto_equalize = Button(eq_row.layout(), 'autoEqualizeSwitchOn')
|
||||
auto_equalize.set_label('自动', line_height=100)
|
||||
auto_equalize.set_label_style('small')
|
||||
auto_equalize.set_button_style('small-compound-top-left')
|
||||
auto_equalize.setCheckable(True)
|
||||
auto_equalize.setChecked(True)
|
||||
auto_equalize_off = Button(eq_row.layout(), 'autoEqualizeSwitchOff')
|
||||
auto_equalize_off.set_label('手动', line_height=100)
|
||||
auto_equalize_off.set_label_style('small')
|
||||
auto_equalize_off.set_button_style('small-compound-top-right')
|
||||
auto_equalize_off.setCheckable(True)
|
||||
auto_equalize_group.addButton(auto_equalize)
|
||||
auto_equalize_group.addButton(auto_equalize_off)
|
||||
equalize_profile_curve = Button(eq_column.layout(), 'equalizeCurveButton')
|
||||
equalize_profile_curve.set_label('均衡曲线', line_height=100)
|
||||
equalize_profile_curve.set_label_style('small')
|
||||
equalize_profile_curve.set_button_style('small-filled-compound-bottom')
|
||||
equalize_profile_curve.setDisabled(True)
|
||||
equalize_profile_curve.clicked.connect(partial(undo(self.core.attributes.equalize_profile_curve), True))
|
||||
reset_button = Button(obj_name='gsResetProfileGraphButton')
|
||||
reset_button.set_label('重置曲线')
|
||||
|
||||
def reset_button_clicked(*_):
|
||||
self.core.attributes.reset_profile_curve()
|
||||
self.core.attributes.store_graphs(profile_graph)
|
||||
reset_button.clicked.connect(undo(reset_button_clicked))
|
||||
pop_out_button = Button(obj_name='gsProfileGraphPopOut')
|
||||
pop_out_button.set_label('^')
|
||||
pop_out_button.clicked.connect(self.profile_graph_pop_out)
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(eq_column, 2)
|
||||
row_layout.addWidget(reset_button, 3)
|
||||
row_layout.addWidget(pop_out_button, 1)
|
||||
normals = ControlSlider(layout, 'surfaceNormals', 'float')
|
||||
normals.set_label('法线')
|
||||
normals.set_min_max(0, 180)
|
||||
normals.set_precision(1)
|
||||
normals.set_value(180)
|
||||
normals.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, normals))
|
||||
normals.set_release_command(self.core.sliders.release)
|
||||
reverse_normals = Button(layout, 'reverseNormals')
|
||||
reverse_normals.set_label('反转法线', line_height=100)
|
||||
reverse_normals.setCheckable(True)
|
||||
reverse_normals.set_button_style('small')
|
||||
reverse_normals.setFixedWidth(style.scale(106))
|
||||
reverse_normals.clicked.connect(partial(self.core.updates.curve_control_check_boxes, 0))
|
||||
with Frame(layout, 'otherFrame', label='其他', margins=[2, 2, 2, 2]) as refine_frame, Row(refine_frame.get_frame_layout(), margins=style.scale([0, 0, 3, 0])) as curve_sampling_row:
|
||||
sampling_accuracy = ControlSlider(layout, 'samplingAccuracy', 'float')
|
||||
sampling_accuracy.set_label('采样精度')
|
||||
sampling_accuracy.set_min_max(0.001, 2)
|
||||
sampling_accuracy.set_step(0.01)
|
||||
sampling_accuracy.set_value(0.33)
|
||||
sampling_accuracy.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, sampling_accuracy))
|
||||
sampling_accuracy.set_release_command(self.core.sliders.release)
|
||||
auto_sampling = Button(obj_name='autoSampling')
|
||||
auto_sampling.set_label('自动')
|
||||
auto_sampling.setFixedWidth(style.scale(35))
|
||||
auto_sampling.set_button_style('small')
|
||||
auto_sampling.setCheckable(True)
|
||||
auto_sampling.clicked.connect(undo(self.core.functions.toggle_auto_sampling))
|
||||
curve_sampling_row_layout = curve_sampling_row.layout()
|
||||
if not isinstance(curve_sampling_row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到曲线采样行布局')
|
||||
curve_sampling_row_layout.addWidget(sampling_accuracy, 4)
|
||||
curve_sampling_row_layout.addWidget(auto_sampling, 1)
|
||||
with Row(refine_frame.get_frame_layout(), margins=style.scale([0, 0, 3, 0])) as curve_refine_row:
|
||||
refine = ControlSlider(layout, 'curveRefine', 'int')
|
||||
refine.set_label('细化')
|
||||
refine.set_min_max(0, 100)
|
||||
refine.set_field_min_max(0, 10000)
|
||||
refine.set_value(20)
|
||||
refine.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, refine))
|
||||
refine.set_release_command(self.core.sliders.release)
|
||||
auto_refine_toggle = Button(obj_name='autoRefine')
|
||||
auto_refine_toggle.set_label('自动')
|
||||
auto_refine_toggle.setFixedWidth(style.scale(35))
|
||||
auto_refine_toggle.set_button_style('small')
|
||||
auto_refine_toggle.setCheckable(True)
|
||||
auto_refine_toggle.clicked.connect(undo(self.core.functions.toggle_auto_refine))
|
||||
curve_refine_row_layout = curve_refine_row.layout()
|
||||
if not isinstance(curve_refine_row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到曲线细化行布局')
|
||||
curve_refine_row_layout.addWidget(refine, 4)
|
||||
curve_refine_row_layout.addWidget(auto_refine_toggle, 1)
|
||||
smooth = ControlSlider(refine_frame.get_frame_layout(), 'curveSmooth', 'float')
|
||||
smooth.setVisible(False)
|
||||
smooth.set_label('平滑')
|
||||
smooth.set_min_max(0, 10)
|
||||
smooth.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, smooth))
|
||||
smooth.set_release_command(self.core.sliders.release)
|
||||
with Frame(layout, 'orientToNormalsFrame', label='朝向法线', margins=[2, 2, 2, 2]) as orient_frame:
|
||||
orient_frame.setVisible(False)
|
||||
|
||||
def select_mesh():
|
||||
sel = mc.filterExpand(mc.ls(sl=1, l=1), sm=12)
|
||||
if not sel:
|
||||
sel = mc.ls(hl=1, o=1, l=1)
|
||||
if not sel:
|
||||
logger.warning('选择兼容的网格。', in_view=True)
|
||||
else:
|
||||
self.mesh_name.setText(sel[0])
|
||||
with Row(orient_frame.get_frame_layout()) as row:
|
||||
select_mesh_btn = Button(row.layout(), 'gsOrientToNormalsSelectTarget')
|
||||
select_mesh_btn.setFixedWidth(style.scale(100))
|
||||
select_mesh_btn.set_label('选择目标')
|
||||
select_mesh_btn.clicked.connect(select_mesh)
|
||||
self.mesh_name = LineEdit('gsOrientMeshName', row.layout())
|
||||
self.mesh_name.setPlaceholderText('选择或输入目标网格')
|
||||
self.mesh_name.setClearButtonEnabled(True)
|
||||
orient_frame.get_frame_layout().addWidget(separator())
|
||||
with Row(orient_frame.get_frame_layout()) as row:
|
||||
iterations_slider = ControlSlider(row.layout(), 'gsIterationsSlider', 'int')
|
||||
iterations_slider.set_min_max(1, 100)
|
||||
iterations_slider.set_value(10)
|
||||
iterations_slider.set_label('迭代次数')
|
||||
auto_refresh_button = Button(row.layout(), 'orientRefreshViewport')
|
||||
auto_refresh_button.set_button_style('small')
|
||||
auto_refresh_button.setCheckable(True)
|
||||
auto_refresh_button.setChecked(True)
|
||||
auto_refresh_button.set_width_height(width=style.scale(60))
|
||||
auto_refresh_button.set_label('刷新视图', line_height=100)
|
||||
with Row(orient_frame.get_frame_layout()) as row:
|
||||
min_angle_slider = ControlSlider(row.layout(), 'gsMinimumAngle', 'float')
|
||||
min_angle_slider.set_min_max(0.1, 90)
|
||||
min_angle_slider.set_value(1)
|
||||
min_angle_slider.set_label('最小角度')
|
||||
orient_frame.get_frame_layout().addWidget(separator())
|
||||
with Row(orient_frame.get_frame_layout()) as row:
|
||||
orient = Button(row.layout(), 'gsOrientToNormals')
|
||||
orient.set_label('朝向')
|
||||
orient.clicked.connect(undo(self.core.functions.orient_to_face_normals))
|
||||
with Frame(layout, 'solidifyFrame', label='实体化控制', margins=[2, 2, 2, 2]) as solidify_frame:
|
||||
solidify = Button(solidify_frame.get_frame_layout(), 'solidify')
|
||||
solidify.set_label('实体化', line_height=100)
|
||||
solidify.setCheckable(True)
|
||||
solidify.set_button_style('small')
|
||||
solidify.setFixedWidth(style.scale(106))
|
||||
solidify.clicked.connect(partial(self.core.updates.curve_control_check_boxes, 1))
|
||||
thickness = ControlSlider(solidify_frame.get_frame_layout(), 'solidifyThickness', 'float')
|
||||
thickness.set_label('厚度')
|
||||
thickness.set_min_max(0.001, 5)
|
||||
thickness.set_field_min_max(-100, 100)
|
||||
thickness.set_value(0.25)
|
||||
thickness.set_step(0.001)
|
||||
thickness.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, thickness))
|
||||
thickness.set_release_command(self.core.sliders.release)
|
||||
divisions = ControlSlider(solidify_frame.get_frame_layout(), 'solidifyDivisions', 'int')
|
||||
divisions.set_label('分段数')
|
||||
divisions.set_min_max(0, 10)
|
||||
divisions.set_field_min_max(0, 100)
|
||||
divisions.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, divisions))
|
||||
divisions.set_release_command(self.core.sliders.release)
|
||||
solidify_scale_x = ControlSlider(solidify_frame.get_frame_layout(), 'solidifyScaleX', 'float')
|
||||
solidify_scale_x.set_label('缩放 X')
|
||||
solidify_scale_x.set_min_max(-10, 10)
|
||||
solidify_scale_x.set_field_min_max(-100, 100)
|
||||
solidify_scale_x.set_step(0.001)
|
||||
solidify_scale_x.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, solidify_scale_x))
|
||||
solidify_scale_x.set_release_command(self.core.sliders.release)
|
||||
solidify_scale_y = ControlSlider(solidify_frame.get_frame_layout(), 'solidifyScaleY', 'float')
|
||||
solidify_scale_y.set_label('缩放 Y')
|
||||
solidify_scale_y.set_min_max(-10, 10)
|
||||
solidify_scale_y.set_field_min_max(-100, 100)
|
||||
solidify_scale_y.set_step(0.001)
|
||||
solidify_scale_y.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, solidify_scale_y))
|
||||
solidify_scale_y.set_release_command(self.core.sliders.release)
|
||||
offset = ControlSlider(solidify_frame.get_frame_layout(), 'solidifyOffset', 'float')
|
||||
offset.set_label('偏移')
|
||||
offset.set_min_max(-1, 1)
|
||||
offset.set_field_min_max(-100, 100)
|
||||
offset.set_step(0.001)
|
||||
offset.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, offset))
|
||||
offset.set_release_command(self.core.sliders.release)
|
||||
solidify_normals = ControlSlider(solidify_frame.get_frame_layout(), 'solidifyNormals', 'float')
|
||||
solidify_normals.set_label('实体化法线')
|
||||
solidify_normals.set_min_max(0, 180)
|
||||
solidify_normals.set_precision(1)
|
||||
solidify_normals.set_value(180)
|
||||
solidify_normals.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, solidify_normals))
|
||||
solidify_normals.set_release_command(self.core.sliders.release)
|
||||
with Frame(layout, 'UVFrame', label='UV 控制', margins=[2, 2, 2, 2]) as uv_frame:
|
||||
flip_uv = Button(uv_frame.get_frame_layout(), 'flipUV')
|
||||
flip_uv.set_label('水平翻转 UV', line_height=100)
|
||||
flip_uv.setCheckable(True)
|
||||
flip_uv.set_button_style('small')
|
||||
flip_uv.setFixedWidth(style.scale(106))
|
||||
flip_uv.clicked.connect(partial(undo(self.core.updates.curve_control_check_boxes), 3))
|
||||
move_u = ControlSlider(uv_frame.get_frame_layout(), 'moveU', 'float')
|
||||
move_u.set_label('移动 U')
|
||||
move_u.set_min_max(-0.5, 0.5)
|
||||
move_u.set_step(0.001)
|
||||
move_u.set_field_min_max(-100, 100)
|
||||
move_u.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, move_u))
|
||||
move_u.set_release_command(self.core.sliders.release)
|
||||
move_v = ControlSlider(uv_frame.get_frame_layout(), 'moveV', 'float')
|
||||
move_v.set_label('移动 V')
|
||||
move_v.set_min_max(-0.5, 0.5)
|
||||
move_v.set_step(0.001)
|
||||
move_v.set_field_min_max(-100, 100)
|
||||
move_v.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, move_v))
|
||||
move_v.set_release_command(self.core.sliders.release)
|
||||
scale_u = ControlSlider(uv_frame.get_frame_layout(), 'scaleU', 'float')
|
||||
scale_u.set_label('缩放 U')
|
||||
scale_u.set_min_max(0.001, 1.999)
|
||||
scale_u.set_field_min_max(0, 100)
|
||||
scale_u.set_step(0.001)
|
||||
scale_u.set_value(1)
|
||||
scale_u.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, scale_u))
|
||||
scale_u.set_release_command(self.core.sliders.release)
|
||||
scale_v = ControlSlider(uv_frame.get_frame_layout(), 'scaleV', 'float')
|
||||
scale_v.set_label('缩放 V')
|
||||
scale_v.set_min_max(0.001, 1.999)
|
||||
scale_v.set_field_min_max(0, 100)
|
||||
scale_v.set_step(0.001)
|
||||
scale_v.set_value(1)
|
||||
scale_v.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, scale_v))
|
||||
scale_v.set_release_command(self.core.sliders.release)
|
||||
rotate_uv = ControlSlider(uv_frame.get_frame_layout(), 'rotateUV', 'float')
|
||||
rotate_uv.set_label('旋转 UV')
|
||||
rotate_uv.set_min_max(-180, 180)
|
||||
rotate_uv.set_field_min_max(-3600, 3600)
|
||||
rotate_uv.set_precision(2)
|
||||
rotate_uv.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, rotate_uv))
|
||||
rotate_uv.set_release_command(self.core.sliders.release)
|
||||
rotate_uv_root = ControlSlider(uv_frame.get_frame_layout(), 'rotateRootUV', 'float')
|
||||
rotate_uv_root.set_label('旋转根部 UV')
|
||||
rotate_uv_root.set_min_max(-180, 180)
|
||||
rotate_uv_root.set_field_min_max(-3600, 3600)
|
||||
rotate_uv_root.set_precision(2)
|
||||
rotate_uv_root.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, rotate_uv_root))
|
||||
rotate_uv_root.set_release_command(self.core.sliders.release)
|
||||
rotate_uv_root.setVisible(False)
|
||||
rotate_uv_tip = ControlSlider(uv_frame.get_frame_layout(), 'rotateTipUV', 'float')
|
||||
rotate_uv_tip.set_label('旋转尖端 UV')
|
||||
rotate_uv_tip.set_min_max(-180, 180)
|
||||
rotate_uv_tip.set_field_min_max(-3600, 3600)
|
||||
rotate_uv_tip.set_precision(2)
|
||||
rotate_uv_tip.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, rotate_uv_tip))
|
||||
rotate_uv_tip.set_release_command(self.core.sliders.release)
|
||||
rotate_uv_tip.setVisible(False)
|
||||
if MAYA_VER in (2020, 2022) and (not self.options_manager.get('UVBugMessageDismissed')):
|
||||
with Row(uv_frame.get_frame_layout()) as row:
|
||||
label = Label(row.layout())
|
||||
label.set_label('<p style="color:#FF542F">如何修复 Maya 2020 - 2022 的 UV 问题:</p>')
|
||||
link_button = Button(row.layout())
|
||||
link_button.set_label('打开修复方法')
|
||||
link_button.set_button_style('small-filled')
|
||||
link_button.clicked.connect(lambda: open_link('https://gs-curvetools.readthedocs.io/en/latest/faq.html#maya-2020-2022-and-broken-uvs'))
|
||||
dismiss_message = Button(row.layout())
|
||||
dismiss_message.set_label('忽略提示')
|
||||
dismiss_message.set_button_style('small-filled')
|
||||
dismiss_message.clicked.connect(lambda: row.setHidden(True))
|
||||
dismiss_message.clicked.connect(lambda: self.options_manager.set('UVBugMessageDismissed', 1))
|
||||
with Frame(layout, 'advancedVisibilityFrame', label='高级可见性设置', margins=style.scale([3, 2, 3, 2]), spacing=style.scale(3)) as visibility_frame:
|
||||
with Row(visibility_frame.get_frame_layout()) as row:
|
||||
geometry_highlight = Button(row.layout(), 'geometryHighlight')
|
||||
geometry_highlight.set_label('几何体高亮显示', line_height=100)
|
||||
geometry_highlight.setCheckable(True)
|
||||
geometry_highlight.setChecked(bool(self.options_manager.get('GeometryHighlightEnabled')))
|
||||
geometry_highlight.set_button_style('small')
|
||||
geometry_highlight.clicked.connect(no_undo(self.core.advanced_visibility.geometry_highlight_command))
|
||||
curve_highlight = Button(row.layout(), 'curveHighlight')
|
||||
curve_highlight.set_label('曲线高亮显示', line_height=100)
|
||||
curve_highlight.setCheckable(True)
|
||||
curve_highlight.set_button_style('small')
|
||||
curve_highlight.setChecked(False)
|
||||
curve_highlight.clicked.connect(undo(self.core.advanced_visibility.toggle_curve_highlight_from_ui))
|
||||
visibility_frame.get_frame_layout().addWidget(separator())
|
||||
|
||||
def slider_change_command(*_):
|
||||
self.core.advanced_visibility.apply_settings_to_node()
|
||||
self.core.advanced_visibility.save_settings_from_ui()
|
||||
with Column(visibility_frame.get_frame_layout(), obj_name='gsCurveHighlightFrame', spacing=style.scale(4)) as column:
|
||||
column.setEnabled(False)
|
||||
column_layout = column.layout()
|
||||
if not isinstance(column_layout, QVBoxLayout):
|
||||
raise RuntimeError('未找到列布局')
|
||||
with Row(column.layout(), spacing=4) as row:
|
||||
cv_size_label = Label()
|
||||
cv_size_label.set_label('控制点大小:')
|
||||
cv_size_label.setFixedWidth(style.scale(100))
|
||||
cv_size_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
point_size_slider = maya_slider(mc.floatSliderGrp('gsPointSizeSlider', f=1, adj=2, w=1, cw=(1, 45), min=1, max=100, v=10, dc=lambda _: no_undo(self.core.advanced_visibility.apply_settings_to_node)(), cc=no_undo(slider_change_command)))
|
||||
self.widget_manager.add('gsPointSizeSlider', point_size_slider)
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(cv_size_label, 0)
|
||||
row_layout.addWidget(point_size_slider, 1)
|
||||
with Row(column.layout(), spacing=style.scale(4)) as row:
|
||||
selected_color_label = Label()
|
||||
selected_color_label.set_label('选中颜色:')
|
||||
selected_color_label.setFixedWidth(style.scale(100))
|
||||
selected_color_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
selected_color_picker = ColorPicker('gsSelectedCVColor')
|
||||
selected_color_picker.connect_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
selected_color_picker.connect_command(no_undo(slider_change_command))
|
||||
selected_alpha_value = FloatField('gsSelectedCVAlpha')
|
||||
selected_alpha_value.setFixedWidth(style.scale(45))
|
||||
selected_alpha_value.set_value(1.0)
|
||||
selected_alpha_value.set_range(0, 1)
|
||||
selected_alpha_value.set_step(0.01)
|
||||
selected_alpha_value.set_precision(2)
|
||||
selected_alpha_value.set_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
selected_alpha_value.set_release_command(no_undo(slider_change_command))
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(selected_color_label, 0)
|
||||
row_layout.addWidget(selected_color_picker, 1)
|
||||
row_layout.addWidget(selected_alpha_value, 0)
|
||||
with Row(column.layout(), spacing=style.scale(4)) as row:
|
||||
deselected_color_label = Label()
|
||||
deselected_color_label.set_label('未选中颜色:')
|
||||
deselected_color_label.setFixedWidth(style.scale(100))
|
||||
deselected_color_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
deselected_color_picker = ColorPicker('gsDeselectedCVColor')
|
||||
deselected_color_picker.connect_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
deselected_color_picker.connect_command(no_undo(slider_change_command))
|
||||
deselected_alpha_value = FloatField('gsDeselectedCVAlpha')
|
||||
deselected_alpha_value.setFixedWidth(style.scale(45))
|
||||
deselected_alpha_value.set_value(1)
|
||||
deselected_alpha_value.set_range(0, 1)
|
||||
deselected_alpha_value.set_step(0.01)
|
||||
deselected_alpha_value.set_precision(2)
|
||||
deselected_alpha_value.set_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
deselected_alpha_value.set_release_command(no_undo(slider_change_command))
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(deselected_color_label, 0)
|
||||
row_layout.addWidget(deselected_color_picker, 1)
|
||||
row_layout.addWidget(deselected_alpha_value, 1)
|
||||
column_layout.addWidget(separator())
|
||||
curve_visibility = Button(column.layout(), 'curveVisibility')
|
||||
curve_visibility.set_label('曲线可见性', line_height=100)
|
||||
curve_visibility.setCheckable(True)
|
||||
curve_visibility.set_button_style('small')
|
||||
curve_visibility.setChecked(True)
|
||||
curve_visibility.clicked.connect(no_undo(slider_change_command))
|
||||
with Row(column.layout(), spacing=4) as row:
|
||||
curve_width_label = Label()
|
||||
curve_width_label.set_label('曲线宽度:')
|
||||
curve_width_label.setFixedWidth(style.scale(100))
|
||||
curve_width_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
curve_width_slider = maya_slider(mc.floatSliderGrp('gsCurveWidthSlider', f=1, adj=2, w=1, cw=(1, 45), min=1, max=100, v=4, dc=lambda _: no_undo(self.core.advanced_visibility.apply_settings_to_node)(), cc=no_undo(slider_change_command)))
|
||||
self.widget_manager.add('gsCurveWidthSlider', curve_width_slider)
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(curve_width_label, 0)
|
||||
row_layout.addWidget(curve_width_slider, 1)
|
||||
with Row(column.layout(), spacing=style.scale(4)) as row:
|
||||
curve_highlight_color_label = Label()
|
||||
curve_highlight_color_label.set_label('曲线颜色:')
|
||||
curve_highlight_color_label.setFixedWidth(style.scale(100))
|
||||
curve_highlight_color_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
curve_highlight_color = ColorPicker('gsCurveHighlightColor')
|
||||
curve_highlight_color.connect_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
curve_highlight_color.connect_command(no_undo(slider_change_command))
|
||||
curve_highlight_alpha = FloatField('gsCurveHighlightAlpha')
|
||||
curve_highlight_alpha.setFixedWidth(style.scale(45))
|
||||
curve_highlight_alpha.set_value(1.0)
|
||||
curve_highlight_alpha.set_range(0, 1)
|
||||
curve_highlight_alpha.set_step(0.01)
|
||||
curve_highlight_alpha.set_precision(2)
|
||||
curve_highlight_alpha.set_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
curve_highlight_alpha.set_release_command(no_undo(slider_change_command))
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(curve_highlight_color_label, 0)
|
||||
row_layout.addWidget(curve_highlight_color, 1)
|
||||
row_layout.addWidget(curve_highlight_alpha, 1)
|
||||
column_layout.addWidget(separator())
|
||||
hull_visibility = Button(column.layout(), 'hullVisibility')
|
||||
hull_visibility.set_label('壳线可见性', line_height=100)
|
||||
hull_visibility.setCheckable(True)
|
||||
hull_visibility.set_button_style('small')
|
||||
hull_visibility.clicked.connect(no_undo(slider_change_command))
|
||||
with Row(column.layout(), spacing=4) as row:
|
||||
hull_width_label = Label()
|
||||
hull_width_label.set_label('壳线宽度:')
|
||||
hull_width_label.setFixedWidth(style.scale(100))
|
||||
hull_width_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
hull_width_slider = maya_slider(mc.floatSliderGrp('gsHullWidthSlider', f=1, adj=2, w=1, cw=(1, 45), min=1, max=100, v=3, dc=lambda _: no_undo(self.core.advanced_visibility.apply_settings_to_node)(), cc=no_undo(slider_change_command)))
|
||||
self.widget_manager.add('gsHullWidthSlider', hull_width_slider)
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(hull_width_label, 0)
|
||||
row_layout.addWidget(hull_width_slider, 1)
|
||||
with Row(column.layout(), spacing=style.scale(4)) as row:
|
||||
hull_color_label = Label()
|
||||
hull_color_label.set_label('壳线颜色:')
|
||||
hull_color_label.setFixedWidth(style.scale(100))
|
||||
hull_color_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
hull_color = ColorPicker('gsHullHighlightColor')
|
||||
hull_color.connect_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
hull_color.connect_command(no_undo(slider_change_command))
|
||||
hull_alpha = FloatField('gsHullHighlightAlpha')
|
||||
hull_alpha.setFixedWidth(style.scale(45))
|
||||
hull_alpha.set_value(1.0)
|
||||
hull_alpha.set_range(0, 1)
|
||||
hull_alpha.set_step(0.01)
|
||||
hull_alpha.set_precision(2)
|
||||
hull_alpha.set_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
hull_alpha.set_release_command(no_undo(slider_change_command))
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(hull_color_label, 0)
|
||||
row_layout.addWidget(hull_color, 1)
|
||||
row_layout.addWidget(hull_alpha, 1)
|
||||
column_layout.addWidget(separator())
|
||||
with Frame(column.layout(), 'advancedVisibilityFrame', label='其他选项:', margins=style.scale([3, 2, 3, 2]), spacing=style.scale(3)) as options_frame:
|
||||
with Row(options_frame.get_frame_layout()) as row:
|
||||
lazy_update = Button(row.layout(), 'lazyUpdate')
|
||||
lazy_update.set_label('延迟更新', line_height=100)
|
||||
lazy_update.setCheckable(True)
|
||||
lazy_update.set_button_style('small')
|
||||
lazy_update.clicked.connect(no_undo(slider_change_command))
|
||||
always_on_top = Button(row.layout(), 'alwaysOnTop')
|
||||
always_on_top.set_label('始终置顶', line_height=100)
|
||||
always_on_top.setCheckable(True)
|
||||
always_on_top.set_button_style('small')
|
||||
always_on_top.setChecked(True)
|
||||
always_on_top.clicked.connect(no_undo(slider_change_command))
|
||||
options_frame.get_frame_layout().addWidget(separator())
|
||||
experimental_label = Label(options_frame.get_frame_layout())
|
||||
experimental_label.set_label('距离颜色设置:')
|
||||
with Row(options_frame.get_frame_layout()) as row:
|
||||
curve_distance_color = Button(row.layout(), 'curveDistanceColor')
|
||||
curve_distance_color.set_label('曲线', line_height=100)
|
||||
curve_distance_color.setCheckable(True)
|
||||
curve_distance_color.set_button_style('small')
|
||||
curve_distance_color.setChecked(True)
|
||||
curve_distance_color.clicked.connect(no_undo(slider_change_command))
|
||||
cv_distance_color = Button(row.layout(), 'cvDistanceColor')
|
||||
cv_distance_color.set_label('控制点', line_height=100)
|
||||
cv_distance_color.setCheckable(True)
|
||||
cv_distance_color.set_button_style('small')
|
||||
cv_distance_color.setChecked(True)
|
||||
cv_distance_color.clicked.connect(no_undo(slider_change_command))
|
||||
hull_distance_color = Button(row.layout(), 'hullDistanceColor')
|
||||
hull_distance_color.set_label('壳线', line_height=100)
|
||||
hull_distance_color.setCheckable(True)
|
||||
hull_distance_color.set_button_style('small')
|
||||
hull_distance_color.setChecked(True)
|
||||
hull_distance_color.clicked.connect(no_undo(slider_change_command))
|
||||
with Row(options_frame.get_frame_layout()) as row:
|
||||
distance_color_min_label = Label()
|
||||
distance_color_min_label.set_label('颜色最小值:')
|
||||
distance_color_min_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
distance_color_min_input = FloatField('gsDistanceColorMinValue')
|
||||
distance_color_min_input.set_value(0.25)
|
||||
distance_color_min_input.set_range(0.01, 1)
|
||||
distance_color_min_input.set_step(0.01)
|
||||
distance_color_min_input.set_precision(2)
|
||||
distance_color_min_input.set_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
distance_color_min_input.set_release_command(no_undo(slider_change_command))
|
||||
distance_color_max_label = Label()
|
||||
distance_color_max_label.set_label('颜色最大值:')
|
||||
distance_color_max_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
distance_color_max_input = FloatField('gsDistanceColorMaxValue')
|
||||
distance_color_max_input.set_value(1.0)
|
||||
distance_color_max_input.set_range(0.01, 1)
|
||||
distance_color_max_input.set_step(0.01)
|
||||
distance_color_max_input.set_precision(2)
|
||||
distance_color_max_input.set_drag_command(lambda *_: no_undo(self.core.advanced_visibility.apply_settings_to_node)())
|
||||
distance_color_max_input.set_release_command(no_undo(slider_change_command))
|
||||
row_layout = row.layout()
|
||||
if not isinstance(row_layout, QHBoxLayout):
|
||||
raise RuntimeError('未找到行布局')
|
||||
row_layout.addWidget(distance_color_min_label, 1)
|
||||
row_layout.addWidget(distance_color_min_input, 1)
|
||||
row_layout.addWidget(distance_color_max_label, 1)
|
||||
row_layout.addWidget(distance_color_max_input, 1)
|
||||
options_frame.get_frame_layout().addWidget(separator())
|
||||
experimental_label = Label(options_frame.get_frame_layout())
|
||||
experimental_label.set_label('实验性功能(可能较慢):')
|
||||
cv_occlusion = Button(options_frame.get_frame_layout(), 'CVocclusion')
|
||||
cv_occlusion.set_label('启用控制点遮挡效果', line_height=100)
|
||||
cv_occlusion.setCheckable(True)
|
||||
cv_occlusion.set_button_style('small')
|
||||
cv_occlusion.clicked.connect(no_undo(slider_change_command))
|
||||
with Row(options_frame.get_frame_layout(), spacing=style.scale(4)) as row:
|
||||
select_occluder_button = Button(row.layout(), 'gsSelectOccluderButton')
|
||||
select_occluder_button.setFixedWidth(style.scale(100))
|
||||
select_occluder_button.set_label('选择遮挡物')
|
||||
select_occluder_button.clicked.connect(no_undo(self.core.advanced_visibility.select_occluder_from_scene))
|
||||
occluder_mesh_name = LineEdit('gsOccluderMeshName', row.layout())
|
||||
occluder_mesh_name.setPlaceholderText('选择或输入遮挡物网格名称')
|
||||
occluder_mesh_name.setClearButtonEnabled(True)
|
||||
occluder_mesh_name.editingFinished.connect(no_undo(slider_change_command))
|
||||
self.core.advanced_visibility.load_settings_from_option_var()
|
||||
self.tooltips.toggle_custom_tooltips_curve_control(self.options_manager.get('enableTooltips'))
|
||||
layout.addWidget(separator())
|
||||
reset_button = Button(layout, 'resetControlSliders')
|
||||
reset_button.set_label('重置滑块范围')
|
||||
reset_button.clicked.connect(self.core.functions.reset_control_sliders)
|
||||
|
||||
def twist_graph_pop_out(self):
|
||||
"""扭曲曲线大图弹出窗口"""
|
||||
name = WINDOWS.TwistGraphWindow.name
|
||||
if mc.workspaceControl(name, q=1, ex=1):
|
||||
mc.deleteUI(name)
|
||||
pop_out = PopOutWindow(name, '扭曲曲线大图', 512, 400)
|
||||
graph = FallOffCurve(pop_out.widget_layout, 'twistCurve_large')
|
||||
|
||||
def twist_graph_command(_):
|
||||
self.core.attributes.propagate_graphs(graph)
|
||||
self.core.attributes.store_graphs(graph)
|
||||
graph.change_command(twist_graph_command)
|
||||
with Row(pop_out.widget_layout, margins=style.scale([5, 0, 5, 2])) as row:
|
||||
row.setFixedHeight(int(style.BUTTON_HEIGHT))
|
||||
magnitude = FloatField('Magnitude_large', row.layout(), attr_name='Magnitude')
|
||||
magnitude.setFixedWidth(style.scale(45))
|
||||
magnitude.set_range(-99, 99)
|
||||
magnitude.set_step(0.01)
|
||||
magnitude.set_precision(2)
|
||||
magnitude.set_drag_command(partial(self.core.sliders.curve_control_slider_drag, magnitude))
|
||||
magnitude.set_release_command(self.core.sliders.release)
|
||||
reset_button = Button(row.layout())
|
||||
reset_button.set_label('重置曲线')
|
||||
|
||||
def reset_twist():
|
||||
self.core.utils.reset_single_graph('twist')
|
||||
self.core.attributes.store_graphs(graph)
|
||||
reset_button.clicked.connect(undo(reset_twist))
|
||||
self.core.curve_control.update_ui()
|
||||
|
||||
def width_graph_pop_out(self):
|
||||
"""宽度曲线大图弹出窗口"""
|
||||
name = WINDOWS.WidthGraphWindow.name
|
||||
if mc.workspaceControl(name, q=1, ex=1):
|
||||
mc.deleteUI(name)
|
||||
pop_out = PopOutWindow(name, '宽度曲线大图', 512, 400)
|
||||
graph = FallOffCurve(pop_out.widget_layout, 'scaleCurve_large')
|
||||
|
||||
def width_graph_command(_):
|
||||
self.core.attributes.propagate_graphs(graph)
|
||||
self.core.attributes.store_graphs(graph)
|
||||
graph.change_command(width_graph_command)
|
||||
with Row(pop_out.widget_layout, margins=style.scale([5, 0, 5, 2])) as row:
|
||||
row.setFixedHeight(int(style.BUTTON_HEIGHT))
|
||||
reset_button = Button(row.layout())
|
||||
reset_button.set_label('重置曲线')
|
||||
|
||||
def reset_width_cmd():
|
||||
self.core.utils.reset_single_graph('width')
|
||||
self.core.attributes.store_graphs(graph)
|
||||
reset_button.clicked.connect(undo(reset_width_cmd))
|
||||
self.core.curve_control.update_ui()
|
||||
|
||||
def profile_graph_pop_out(self):
|
||||
"""轮廓曲线大图弹出窗口"""
|
||||
name = WINDOWS.ProfileGraphWindow.name
|
||||
if mc.workspaceControl(name, q=1, ex=1):
|
||||
mc.deleteUI(name)
|
||||
pop_out = PopOutWindow(name, '轮廓曲线大图', 512, 400)
|
||||
graph = FallOffCurve(pop_out.widget_layout, 'profileCurve_large', attr=False)
|
||||
|
||||
def change_command(value):
|
||||
self.core.attributes.update_lattice(value)
|
||||
self.core.attributes.equalize_profile_curve()
|
||||
graph.change_command(change_command)
|
||||
with Row(pop_out.widget_layout, margins=style.scale([5, 0, 5, 2])) as row:
|
||||
row.setFixedHeight(int(style.BUTTON_HEIGHT))
|
||||
reset_button = Button(row.layout())
|
||||
reset_button.set_label('重置曲线')
|
||||
reset_button.clicked.connect(undo(self.core.attributes.reset_profile_curve))
|
||||
self.core.curve_control.update_ui()
|
||||
@@ -1,308 +0,0 @@
|
||||
"""
|
||||
几何体转曲线弹出窗口
|
||||
---
|
||||
GS CurveTools 许可证:
|
||||
名为 GS CurveTools 的此代码集合归 George Sladkovsky(Yehor Sladkovskyi)所有,
|
||||
未经其书面许可,不得复制或分发。
|
||||
|
||||
GS CurveTools v1.3.10 个人版
|
||||
版权所有 2025,George Sladkovsky(Yehor Sladkovskyi)
|
||||
保留所有权利
|
||||
|
||||
UI 字体为 Roboto,遵循 Apache 2.0 许可证:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Autodesk Maya 是 Autodesk, Inc 的产品:
|
||||
https://www.autodesk.com/
|
||||
|
||||
社交媒体和联系方式:
|
||||
|
||||
Discord 服务器: https://discord.gg/f4DH6HQ
|
||||
在线商店: https://sladkovsky3d.artstation.com/store
|
||||
在线文档: https://gs-curvetools.readthedocs.io/
|
||||
Twitch 频道: https://www.twitch.tv/videonomad
|
||||
YouTube 频道: https://www.youtube.com/c/GeorgeSladkovsky
|
||||
ArtStation 作品集: https://www.artstation.com/sladkovsky3d
|
||||
联系邮箱: george.sladkovsky@gmail.com
|
||||
"""
|
||||
from ast import literal_eval
|
||||
import maya.cmds as mc
|
||||
from gs_curvetools.api.maya_tools import undo
|
||||
from gs_curvetools.api.qt_compat import *
|
||||
from gs_curvetools.config.constants import *
|
||||
from gs_curvetools.core.core import Core
|
||||
from gs_curvetools.debug.logger import logger
|
||||
from gs_curvetools.managers.options_manager import OptionsManager
|
||||
from gs_curvetools.managers.widget_manager import WidgetManager
|
||||
from gs_curvetools.ui import style
|
||||
from gs_curvetools.ui.widgets import Button, Column, Frame, LineEdit, PopOutWindow, Row, separator
|
||||
|
||||
class GeoToCurveWindow(QWidget):
|
||||
"""创建一个用于几何体转曲线的弹出窗口"""
|
||||
|
||||
def __init__(self, parent):
|
||||
super(GeoToCurveWindow, self).__init__(parent)
|
||||
self.ui_name = WINDOWS.GeoToCurveWindow.name
|
||||
self.core = Core.singleton()
|
||||
self.widget_manager = WidgetManager()
|
||||
self.options_manager = OptionsManager()
|
||||
self.buttons_dict = literal_eval(self.options_manager.get('CardToCurveOptions'))
|
||||
|
||||
def get_button(self, name):
|
||||
"""按名称获取按钮"""
|
||||
return self.buttons_dict[name] if name in self.buttons_dict else True
|
||||
|
||||
def open_ui(self):
|
||||
"""创建一个用于几何体转曲线的弹出窗口"""
|
||||
if mc.workspaceControl(self.ui_name, q=1, ex=1):
|
||||
if mc.workspaceControl(self.ui_name, q=1, vis=1):
|
||||
mc.deleteUI(self.ui_name)
|
||||
return
|
||||
mc.deleteUI(self.ui_name)
|
||||
self.pop_out = PopOutWindow(self.ui_name, '几何体转曲线', 270, 365)
|
||||
layout = self.pop_out.widget_layout
|
||||
layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
self.main_button_group = QtWidgets.QButtonGroup(self.pop_out)
|
||||
self.main_button_group.setExclusive(False)
|
||||
self.main_button_group.buttonClicked.connect(self.save_buttons_state)
|
||||
with Column(layout) as main_column:
|
||||
main_column_layout = main_column.layout()
|
||||
if not isinstance(main_column_layout, QVBoxLayout):
|
||||
raise RuntimeError('主列布局未找到')
|
||||
main_column_layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
with Frame(main_column.layout(), label='输出类型:', obj_name='gsGeoToCurve_outputTypeSwitch') as output_type_frame:
|
||||
output_type_frame.set_collapsible(False)
|
||||
output_type_frame.set_collapsed(False)
|
||||
with Row(output_type_frame.get_frame_layout()) as output_type_switch:
|
||||
self.output_type_group = QtWidgets.QButtonGroup(self.pop_out)
|
||||
self.widget_manager.add('gsGeoToCurve_cardTypeGroup', self.output_type_group)
|
||||
generate_auto = Button(output_type_switch.layout(), 'gsGeoToCurve_generateAuto')
|
||||
generate_auto.set_button_style('small')
|
||||
generate_auto.set_label('自动')
|
||||
generate_auto.setCheckable(True)
|
||||
generate_cards = Button(output_type_switch.layout(), 'gsGeoToCurve_generateCards')
|
||||
generate_cards.set_button_style('small')
|
||||
generate_cards.set_label('卡片')
|
||||
generate_cards.setCheckable(True)
|
||||
generate_tubes = Button(output_type_switch.layout(), 'gsGeoToCurve_generateTubes')
|
||||
generate_tubes.set_button_style('small')
|
||||
generate_tubes.set_label('管道')
|
||||
generate_tubes.setCheckable(True)
|
||||
generate_curves = Button(output_type_switch.layout(), 'gsGeoToCurve_generateCurves')
|
||||
generate_curves.set_button_style('small')
|
||||
generate_curves.set_label('曲线')
|
||||
generate_curves.setCheckable(True)
|
||||
self.output_type_group.addButton(generate_auto, 0)
|
||||
self.output_type_group.addButton(generate_cards, 1)
|
||||
self.output_type_group.addButton(generate_tubes, 2)
|
||||
self.output_type_group.addButton(generate_curves, 3)
|
||||
checked_id = self.options_manager.get('CardToCurveOutputType')
|
||||
generate_auto.setChecked(checked_id == 0)
|
||||
generate_cards.setChecked(checked_id == 1)
|
||||
generate_tubes.setChecked(checked_id == 2)
|
||||
generate_curves.setChecked(checked_id == 3)
|
||||
self.output_type_group.buttonClicked.connect(self.update_active_buttons)
|
||||
with Frame(main_column.layout(), label='对象类型:', obj_name='gsGeoToCurve_cardType') as card_type_frame:
|
||||
self.card_type_frame = card_type_frame
|
||||
card_type_frame.set_collapsible(False)
|
||||
card_type_frame.set_collapsed(False)
|
||||
with Row(card_type_frame.get_frame_layout()) as output_type_switch:
|
||||
self.card_type_group = QtWidgets.QButtonGroup(output_type_switch)
|
||||
self.widget_manager.add('gsGeoToCurve_cardTypeGroup', self.card_type_group)
|
||||
self.warp_cards = Button(output_type_switch.layout(), 'gsGeoToCurve_warp')
|
||||
self.warp_cards.set_button_style('small')
|
||||
self.warp_cards.set_label('变形')
|
||||
self.warp_cards.setCheckable(True)
|
||||
extrude_cards = Button(output_type_switch.layout(), 'gsGeoToCurve_extrude')
|
||||
extrude_cards.set_button_style('small')
|
||||
extrude_cards.set_label('挤出')
|
||||
extrude_cards.setCheckable(True)
|
||||
self.card_type_group.addButton(self.warp_cards, 0)
|
||||
self.card_type_group.addButton(extrude_cards, 1)
|
||||
self.warp_cards.setChecked(not self.options_manager.get('CardToCurveCardType'))
|
||||
extrude_cards.setChecked(self.options_manager.get('CardToCurveCardType'))
|
||||
self.card_type_group.buttonClicked.connect(self.update_active_buttons)
|
||||
with Frame(main_column.layout(), label='匹配属性:', obj_name='gsGeoToCurve_matchAttributes') as match_attribute_frame:
|
||||
self.match_attribute_frame = match_attribute_frame
|
||||
match_attribute_frame.set_collapsible(False)
|
||||
match_attribute_frame.set_collapsed(False)
|
||||
with Row(match_attribute_frame.get_frame_layout()) as row:
|
||||
orientation = Button(row.layout(), 'gsGeoToCurve_orientation')
|
||||
orientation.set_button_style('small')
|
||||
orientation.set_label('方向')
|
||||
orientation.setCheckable(True)
|
||||
orientation.setChecked(bool(self.get_button('gsGeoToCurve_orientation')))
|
||||
width = Button(row.layout(), 'gsGeoToCurve_width')
|
||||
width.set_button_style('small')
|
||||
width.set_label('宽度')
|
||||
width.setCheckable(True)
|
||||
width.setChecked(bool(self.get_button('gsGeoToCurve_width')))
|
||||
self.main_button_group.addButton(orientation)
|
||||
self.main_button_group.addButton(width)
|
||||
with Row(match_attribute_frame.get_frame_layout()) as row:
|
||||
taper = Button(row.layout(), 'gsGeoToCurve_taper')
|
||||
taper.set_button_style('small')
|
||||
taper.set_label('锥度')
|
||||
taper.setCheckable(True)
|
||||
taper.setChecked(bool(self.get_button('gsGeoToCurve_taper')))
|
||||
twist = Button(row.layout(), 'gsGeoToCurve_twist')
|
||||
twist.set_button_style('small')
|
||||
twist.set_label('扭曲')
|
||||
twist.setCheckable(True)
|
||||
twist.setChecked(bool(self.get_button('gsGeoToCurve_twist')))
|
||||
self.main_button_group.addButton(taper)
|
||||
self.main_button_group.addButton(twist)
|
||||
with Row(match_attribute_frame.get_frame_layout()) as row:
|
||||
profile = Button(row.layout(), 'gsGeoToCurve_profile')
|
||||
profile.set_button_style('small')
|
||||
profile.set_label('轮廓')
|
||||
profile.setCheckable(True)
|
||||
profile.setChecked(bool(self.get_button('gsGeoToCurve_profile')))
|
||||
material = Button(row.layout(), 'gsGeoToCurve_material')
|
||||
material.set_button_style('small')
|
||||
material.set_label('材质')
|
||||
material.setCheckable(True)
|
||||
material.setChecked(bool(self.get_button('gsGeoToCurve_material')))
|
||||
self.main_button_group.addButton(profile)
|
||||
self.main_button_group.addButton(material)
|
||||
uvs = Button(match_attribute_frame.get_frame_layout(), 'gsGeoToCurve_UVs')
|
||||
uvs.set_button_style('small')
|
||||
uvs.set_label('UVs')
|
||||
uvs.setCheckable(True)
|
||||
uvs.setChecked(bool(self.get_button('gsGeoToCurve_UVs')))
|
||||
uvs.clicked.connect(self.update_active_buttons)
|
||||
self.main_button_group.addButton(uvs)
|
||||
with Frame(main_column.layout(), label='UV 匹配选项:', obj_name='gsGeoToCurve_UVMatchOptions') as uv_match_options_frame:
|
||||
self.uv_match_options_frame = uv_match_options_frame
|
||||
uv_match_options_frame.set_collapsible(False)
|
||||
uv_match_options_frame.set_collapsed(False)
|
||||
with Row(uv_match_options_frame.get_frame_layout()) as row:
|
||||
vertical_flip = Button(row.layout(), 'gsGeoToCurve_verticalFlip')
|
||||
vertical_flip.set_button_style('small')
|
||||
vertical_flip.set_label('垂直翻转')
|
||||
vertical_flip.setCheckable(True)
|
||||
vertical_flip.setChecked(bool(self.get_button('gsGeoToCurve_verticalFlip')))
|
||||
horizontal_flip = Button(row.layout(), 'gsGeoToCurve_horizontalFlip')
|
||||
horizontal_flip.set_button_style('small')
|
||||
horizontal_flip.set_label('水平翻转')
|
||||
horizontal_flip.setCheckable(True)
|
||||
horizontal_flip.setChecked(bool(self.get_button('gsGeoToCurve_horizontalFlip')))
|
||||
self.main_button_group.addButton(vertical_flip)
|
||||
self.main_button_group.addButton(horizontal_flip)
|
||||
with Frame(main_column.layout(), label='其他:') as other_options_frame:
|
||||
other_options_frame.set_collapsible(False)
|
||||
other_options_frame.set_collapsed(False)
|
||||
reverse_curve = Button(other_options_frame.get_frame_layout(), 'gsGeoToCurve_reverseCurve')
|
||||
reverse_curve.set_button_style('small')
|
||||
reverse_curve.set_label('反转曲线')
|
||||
reverse_curve.setCheckable(True)
|
||||
reverse_curve.setChecked(bool(self.get_button('gsGeoToCurve_reverseCurve')))
|
||||
self.main_button_group.addButton(reverse_curve)
|
||||
delete_original_object = Button(other_options_frame.get_frame_layout(), 'gsGeoToCurve_deleteOriginalObject')
|
||||
delete_original_object.set_button_style('small')
|
||||
delete_original_object.set_label('删除原始对象')
|
||||
delete_original_object.setCheckable(True)
|
||||
delete_original_object.setChecked(bool(self.get_button('gsGeoToCurve_deleteOriginalObject')))
|
||||
self.main_button_group.addButton(delete_original_object)
|
||||
use_aim_mesh = Button(other_options_frame.get_frame_layout(), 'gsGeoToCurve_useAimMesh')
|
||||
use_aim_mesh.set_button_style('small')
|
||||
use_aim_mesh.set_label('使用目标网格')
|
||||
use_aim_mesh.setCheckable(True)
|
||||
use_aim_mesh.setChecked(bool(self.get_button('gsGeoToCurve_useAimMesh')))
|
||||
use_aim_mesh.clicked.connect(self.update_active_buttons)
|
||||
self.main_button_group.addButton(use_aim_mesh)
|
||||
with Row(other_options_frame.get_frame_layout(), spacing=style.scale(4)) as aim_mesh_row:
|
||||
select_aim_mesh = Button(aim_mesh_row.layout(), 'gsGeoToCurve_selectAimMesh')
|
||||
select_aim_mesh.setFixedWidth(style.scale(100))
|
||||
select_aim_mesh.set_label('选择目标网格')
|
||||
select_aim_mesh.clicked.connect(self.select_aim_mesh_from_scene)
|
||||
aim_mesh_name = LineEdit('gsGeoToCurve_aimMeshName', aim_mesh_row.layout())
|
||||
aim_mesh_name.setPlaceholderText('选择或输入目标网格名称')
|
||||
aim_mesh_name.setClearButtonEnabled(True)
|
||||
aim_mesh_name.editingFinished.connect(self.save_buttons_state)
|
||||
aim_mesh_name.setText(str(self.get_button('gsGeoToCurve_aimMeshName')))
|
||||
main_column_layout.addWidget(separator())
|
||||
with Row(main_column.layout(), margins=style.scale([0, 3, 0, 3])) as _:
|
||||
pass
|
||||
main_column_layout.addWidget(separator())
|
||||
with Row(main_column.layout()) as row:
|
||||
convert_selected = Button(row.layout(), obj_name='gsGeoToCurve_convertSelected')
|
||||
convert_selected.set_label('转换选中项')
|
||||
convert_selected.clicked.connect(undo(self.core.conversion.geo_to_curve))
|
||||
cancel = Button(row.layout())
|
||||
cancel.set_label('关闭并保存')
|
||||
cancel.clicked.connect(self.close_ui)
|
||||
self.update_active_buttons()
|
||||
self.save_buttons_state()
|
||||
|
||||
def close_ui(self):
|
||||
"""关闭弹出窗口"""
|
||||
self.save_buttons_state()
|
||||
if mc.workspaceControl(self.ui_name, q=1, ex=1):
|
||||
if mc.workspaceControl(self.ui_name, q=1, vis=1):
|
||||
mc.deleteUI(self.ui_name)
|
||||
else:
|
||||
mc.deleteUI(self.ui_name)
|
||||
|
||||
def select_aim_mesh_from_scene(self):
|
||||
"""点击按钮时从场景中选择目标网格"""
|
||||
mesh = mc.ls(sl=1, tr=1)
|
||||
if not mesh:
|
||||
return
|
||||
for obj in mesh:
|
||||
if mc.nodeType(mc.listRelatives(obj, c=1, pa=1)) != 'mesh':
|
||||
continue
|
||||
self.widget_manager.get('gsGeoToCurve_aimMeshName').setText(obj)
|
||||
break
|
||||
else:
|
||||
logger.warning('未选择兼容的网格。请选择一个网格对象。', in_view=True)
|
||||
self.save_buttons_state()
|
||||
|
||||
def update_active_buttons(self):
|
||||
"""Updates the active buttons based on the output type"""
|
||||
checked_id = self.output_type_group.checkedId()
|
||||
self.options_manager.set('CardToCurveOutputType', checked_id)
|
||||
self.options_manager.set('CardToCurveCardType', int(not self.warp_cards.isChecked()))
|
||||
if checked_id == 0:
|
||||
self.match_attribute_frame.setEnabled(True)
|
||||
self.card_type_frame.setEnabled(True)
|
||||
if self.widget_manager.get('gsGeoToCurve_UVs').isChecked():
|
||||
self.uv_match_options_frame.setEnabled(True)
|
||||
else:
|
||||
self.uv_match_options_frame.setEnabled(False)
|
||||
elif checked_id == 1:
|
||||
self.match_attribute_frame.setEnabled(True)
|
||||
self.card_type_frame.setEnabled(True)
|
||||
if self.widget_manager.get('gsGeoToCurve_UVs').isChecked():
|
||||
self.uv_match_options_frame.setEnabled(True)
|
||||
else:
|
||||
self.uv_match_options_frame.setEnabled(False)
|
||||
elif checked_id == 2:
|
||||
self.match_attribute_frame.setEnabled(True)
|
||||
self.card_type_frame.setEnabled(True)
|
||||
if self.widget_manager.get('gsGeoToCurve_UVs').isChecked():
|
||||
self.uv_match_options_frame.setEnabled(True)
|
||||
else:
|
||||
self.uv_match_options_frame.setEnabled(False)
|
||||
elif checked_id == 3:
|
||||
self.match_attribute_frame.setEnabled(False)
|
||||
self.uv_match_options_frame.setEnabled(False)
|
||||
self.card_type_frame.setEnabled(False)
|
||||
is_aim_checked = self.widget_manager.get('gsGeoToCurve_useAimMesh').isChecked()
|
||||
if is_aim_checked:
|
||||
self.widget_manager.get('gsGeoToCurve_aimMeshName').setEnabled(True)
|
||||
self.widget_manager.get('gsGeoToCurve_selectAimMesh').setEnabled(True)
|
||||
else:
|
||||
self.widget_manager.get('gsGeoToCurve_aimMeshName').setEnabled(False)
|
||||
self.widget_manager.get('gsGeoToCurve_selectAimMesh').setEnabled(False)
|
||||
|
||||
def save_buttons_state(self):
|
||||
"""Saves the buttons state"""
|
||||
buttons = self.main_button_group.buttons()
|
||||
buttons_dict = {}
|
||||
for b in buttons:
|
||||
assert isinstance(b, Button), 'Button {b} is not a Button object'.format(b=b)
|
||||
buttons_dict.update({b.obj_name: b.isChecked()})
|
||||
else:
|
||||
buttons_dict.update({'gsGeoToCurve_aimMeshName': self.widget_manager.get('gsGeoToCurve_aimMeshName').text()})
|
||||
self.options_manager.set('CardToCurveOptions', str(buttons_dict))
|
||||
@@ -1,170 +0,0 @@
|
||||
"""
|
||||
随机化曲线窗口
|
||||
---
|
||||
GS曲线工具许可协议:
|
||||
名为GS曲线工具的此代码集合归乔治·斯拉德科夫斯基(叶戈尔·斯拉德科夫斯基)所有,
|
||||
未经他的书面许可,不得复制或分发。
|
||||
|
||||
GS曲线工具 v1.3.10 个人版
|
||||
版权所有 2025,乔治·斯拉德科夫斯基(叶戈尔·斯拉德科夫斯基)
|
||||
保留所有权利
|
||||
|
||||
用户界面字体为Roboto,该字体根据Apache 2.0许可协议授权:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Autodesk Maya是Autodesk公司的产品:
|
||||
https://www.autodesk.com/
|
||||
|
||||
社交媒体和联系方式:
|
||||
|
||||
Discord服务器: https://discord.gg/f4DH6HQ
|
||||
在线商店: https://sladkovsky3d.artstation.com/store
|
||||
在线文档: https://gs-curvetools.readthedocs.io/
|
||||
Twitch频道: https://www.twitch.tv/videonomad
|
||||
YouTube频道: https://www.youtube.com/c/GeorgeSladkovsky
|
||||
ArtStation作品集: https://www.artstation.com/sladkovsky3d
|
||||
联系邮箱: george.sladkovsky@gmail.com
|
||||
"""
|
||||
from functools import partial
|
||||
import maya.cmds as mc
|
||||
from gs_curvetools.api.qt_compat import *
|
||||
from gs_curvetools.config.constants import *
|
||||
from gs_curvetools.core.core import Core
|
||||
from gs_curvetools.ui.widgets import Button, Frame, MayaSlider, PopOutWindow, Row, maya_slider, separator
|
||||
|
||||
|
||||
class RandomizeCurveWindow(QWidget):
|
||||
"""创建一个用于随机化曲线的弹出窗口"""
|
||||
|
||||
def __init__(self, parent):
|
||||
"""创建一个用于随机化曲线的弹出窗口"""
|
||||
super(RandomizeCurveWindow, self).__init__(parent)
|
||||
self.core = Core.singleton()
|
||||
|
||||
def open_ui(self):
|
||||
window_name = WINDOWS.RandomizeCurveWindow.name
|
||||
if mc.workspaceControl(window_name, q=1, ex=1):
|
||||
if mc.workspaceControl(window_name, q=1, vis=1):
|
||||
mc.deleteUI(window_name)
|
||||
return
|
||||
mc.deleteUI(window_name)
|
||||
pop_out = PopOutWindow(window_name, '随机化曲线', 270, 565)
|
||||
layout = pop_out.widget_layout
|
||||
layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
|
||||
def release(slider, *_):
|
||||
self.core.sliders.rand_slider_drag(slider)
|
||||
self.core.sliders.rand_slider_release(slider)
|
||||
self.core.sliders.release()
|
||||
|
||||
def create_enable_slider_row(frame_layout, button_name, slider_name, label):
|
||||
with Row(frame_layout) as row:
|
||||
enable = Button(row.layout(), button_name)
|
||||
enable.set_label('启用', line_height=100)
|
||||
enable.set_button_style('small')
|
||||
enable.setCheckable(True)
|
||||
slider = maya_slider(mc.floatSliderGrp(slider_name, l='倍数:', min=1, max=50, pre=1, step=0.5, cw=[(1, 30), (2, 1)]))
|
||||
row_layout = row.layout()
|
||||
assert row_layout is not None
|
||||
row_layout.addWidget(slider)
|
||||
|
||||
with Frame(layout, label='控制点') as frame:
|
||||
frame.set_collapsible(False)
|
||||
create_enable_slider_row(frame.get_frame_layout(), 'curveRandomizeSlider0', 'gsCurveCVsRandMulti', '控制点')
|
||||
with Row(frame.get_frame_layout()) as row:
|
||||
lock_first = Button(row.layout(), 'gsLockFirstCV')
|
||||
lock_first.set_label('锁定第一个控制点', line_height=100)
|
||||
lock_first.set_button_style('small')
|
||||
lock_first.setCheckable(True)
|
||||
lock_last = Button(row.layout(), 'gsLockLastCV')
|
||||
lock_last.set_label('锁定最后一个控制点', line_height=100)
|
||||
lock_last.set_button_style('small')
|
||||
lock_last.setCheckable(True)
|
||||
with Row(frame.get_frame_layout()) as row:
|
||||
axis_x = Button(row.layout(), 'gsRandAxisX')
|
||||
axis_x.set_label('X', line_height=100)
|
||||
axis_x.set_button_style('small')
|
||||
axis_x.setCheckable(True)
|
||||
axis_y = Button(row.layout(), 'gsRandAxisY')
|
||||
axis_y.set_label('Y', line_height=100)
|
||||
axis_y.set_button_style('small')
|
||||
axis_y.setCheckable(True)
|
||||
axis_z = Button(row.layout(), 'gsRandAxisZ')
|
||||
axis_z.set_label('Z', line_height=100)
|
||||
axis_z.set_button_style('small')
|
||||
axis_z.setCheckable(True)
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveCVsRand', min=0, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 0), cc=partial(release, 0)), layout=frame.get_frame_layout())
|
||||
|
||||
with Frame(layout, label='旋转') as frame:
|
||||
frame.set_collapsible(False)
|
||||
create_enable_slider_row(frame.get_frame_layout(), 'curveRandomizeSlider1', 'gsCurveRotationRandMulti', '旋转')
|
||||
with Row(frame.get_frame_layout()) as row:
|
||||
axis_x = Button(row.layout(), 'gsRandRotateAxisX')
|
||||
axis_x.set_label('X', line_height=100)
|
||||
axis_x.set_button_style('small')
|
||||
axis_x.setCheckable(True)
|
||||
axis_y = Button(row.layout(), 'gsRandRotateAxisY')
|
||||
axis_y.set_label('Y', line_height=100)
|
||||
axis_y.set_button_style('small')
|
||||
axis_y.setCheckable(True)
|
||||
axis_z = Button(row.layout(), 'gsRandRotateAxisZ')
|
||||
axis_z.set_label('Z', line_height=100)
|
||||
axis_z.set_button_style('small')
|
||||
axis_z.setCheckable(True)
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveRotationRand', min=0, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 1), cc=partial(release, 1)), layout=frame.get_frame_layout())
|
||||
|
||||
with Frame(layout, label='方向') as frame:
|
||||
frame.set_collapsible(False)
|
||||
create_enable_slider_row(frame.get_frame_layout(), 'curveRandomizeSlider2', 'gsCurveOrientationRandMulti', '方向')
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveOrientationRand', min=0, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 2), cc=partial(release, 2)), layout=frame.get_frame_layout())
|
||||
|
||||
with Frame(layout, label='扭曲') as frame:
|
||||
frame.set_collapsible(False)
|
||||
create_enable_slider_row(frame.get_frame_layout(), 'curveRandomizeSlider3', 'gsCurveTwistRandMulti', '扭曲')
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveTwistRand', min=0, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 3), cc=partial(release, 3)), layout=frame.get_frame_layout())
|
||||
|
||||
with Frame(layout, label='宽度') as frame:
|
||||
frame.set_collapsible(False)
|
||||
create_enable_slider_row(frame.get_frame_layout(), 'curveRandomizeSlider4', 'gsCurveWidthRandMulti', '宽度')
|
||||
uniform = Button(frame.get_frame_layout(), 'gsWidthCheckBoxUniform')
|
||||
uniform.set_button_style('small')
|
||||
uniform.set_label('均匀', line_height=100)
|
||||
uniform.setCheckable(True)
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveWidthRand', min=0.001, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 4), cc=partial(release, 4)), layout=frame.get_frame_layout())
|
||||
|
||||
with Frame(layout, label='锥度') as frame:
|
||||
frame.set_collapsible(False)
|
||||
create_enable_slider_row(frame.get_frame_layout(), 'curveRandomizeSlider5', 'gsCurveTaperRandMulti', '锥度')
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveTaperRand', min=0, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 5), cc=partial(release, 5)), layout=frame.get_frame_layout())
|
||||
|
||||
with Frame(layout, label='轮廓') as frame:
|
||||
frame.set_collapsible(False)
|
||||
create_enable_slider_row(frame.get_frame_layout(), 'curveRandomizeSlider6', 'gsCurveProfileRandMulti', '轮廓')
|
||||
uniform = Button(frame.get_frame_layout(), 'gsProfileCheckBoxNegative')
|
||||
uniform.set_button_style('small')
|
||||
uniform.set_label('允许负值', line_height=100)
|
||||
uniform.setCheckable(True)
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveProfileRand', min=0, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 6), cc=partial(release, 6)), layout=frame.get_frame_layout())
|
||||
|
||||
with Frame(layout, label='选择') as frame:
|
||||
frame.set_collapsible(False)
|
||||
enable = Button(frame.get_frame_layout(), 'curveRandomizeSlider7')
|
||||
enable.set_label('启用', line_height=100)
|
||||
enable.set_button_style('small')
|
||||
enable.setCheckable(True)
|
||||
MayaSlider(mc.floatSliderGrp('gsCurveSelectRand', min=0, max=1, step=0.05, dc=partial(self.core.sliders.rand_slider_drag, 7), cc=partial(release, 7)), layout=frame.get_frame_layout())
|
||||
|
||||
layout.addWidget(separator())
|
||||
with Row(layout) as row:
|
||||
|
||||
def randomize_click():
|
||||
self.core.sliders.rand_slider_drag(-1)
|
||||
self.core.sliders.rand_slider_release(-1)
|
||||
self.core.sliders.release()
|
||||
|
||||
randomize = Button(row.layout())
|
||||
randomize.set_label('随机化')
|
||||
randomize.clicked.connect(randomize_click)
|
||||
close = Button(row.layout())
|
||||
close.set_label('关闭')
|
||||
close.clicked.connect(lambda: mc.deleteUI(window_name))
|
||||
@@ -1,636 +0,0 @@
|
||||
"""
|
||||
UV 编辑器窗口
|
||||
---
|
||||
GS CurveTools 许可证:
|
||||
名为 GS CurveTools 的此代码集合归 George Sladkovsky(Yehor Sladkovskyi)所有,
|
||||
未经其书面许可,不得复制或分发。
|
||||
|
||||
GS CurveTools v1.3.10 个人版
|
||||
版权所有 2025,George Sladkovsky(Yehor Sladkovskyi)
|
||||
保留所有权利
|
||||
|
||||
UI 字体为 Roboto,遵循 Apache 2.0 许可证:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Autodesk Maya 是 Autodesk, Inc 的产品:
|
||||
https://www.autodesk.com/
|
||||
|
||||
社交媒体和联系方式:
|
||||
|
||||
Discord 服务器: https://discord.gg/f4DH6HQ
|
||||
在线商店: https://sladkovsky3d.artstation.com/store
|
||||
在线文档: https://gs-curvetools.readthedocs.io/
|
||||
Twitch 频道: https://www.twitch.tv/videonomad
|
||||
YouTube 频道: https://www.youtube.com/c/GeorgeSladkovsky
|
||||
ArtStation 作品集: https://www.artstation.com/sladkovsky3d
|
||||
联系邮箱: george.sladkovsky@gmail.com
|
||||
"""
|
||||
import os
|
||||
from ast import literal_eval
|
||||
import maya.cmds as mc
|
||||
from gs_curvetools.api.maya_tools import deferred_lp, get_mod, no_undo, undo
|
||||
from gs_curvetools.api.python import Timer
|
||||
from gs_curvetools.api.qt_compat import *
|
||||
from gs_curvetools.api.utils import clr_to_float, open_link
|
||||
from gs_curvetools.config.constants import *
|
||||
from gs_curvetools.core.core import Core
|
||||
from gs_curvetools.debug.logger import logger
|
||||
from gs_curvetools.managers.options_manager import OptionsManager
|
||||
from gs_curvetools.managers.script_jobs import ScriptJobs
|
||||
from gs_curvetools.managers.widget_manager import WidgetManager
|
||||
from gs_curvetools.ui import style
|
||||
from gs_curvetools.ui.components.uv_editor.editor import UVEditor
|
||||
from gs_curvetools.ui.utils import maya_dockable_window
|
||||
from gs_curvetools.ui.widgets import Button, ColorPicker, Column, Frame, Label, Row, UVItemList, separator
|
||||
|
||||
class UVEditorWindow(QWidget):
|
||||
"""UV 编辑器窗口"""
|
||||
|
||||
def __init__(self, parent):
|
||||
super(UVEditorWindow, self).__init__(parent)
|
||||
self.core = Core.singleton()
|
||||
self.widget_manager = WidgetManager()
|
||||
self.options_manager = OptionsManager()
|
||||
self.script_jobs = ScriptJobs.singleton()
|
||||
self.timer = Timer()
|
||||
self.mouse_toggle = False
|
||||
self.previous_selection = []
|
||||
self.uv_update_check = 0
|
||||
self.isolate_mode = False
|
||||
self.current_selection = []
|
||||
self.controller_group = None
|
||||
self.direction_switch = None
|
||||
|
||||
def open_ui(self):
|
||||
"""UV 编辑器工作区控件"""
|
||||
if mc.workspaceControl(WINDOWS.UVEditor.name, q=1, ex=1):
|
||||
if not mc.workspaceControl(WINDOWS.UVEditor.name, q=1, vis=1):
|
||||
mc.workspaceControl(WINDOWS.UVEditor.name, e=1, rs=1)
|
||||
else:
|
||||
mc.workspaceControl(WINDOWS.UVEditor.name, e=1, vis=0)
|
||||
try:
|
||||
self.update_editor()
|
||||
return
|
||||
except BaseException as exc:
|
||||
logger.exception(exc)
|
||||
return None
|
||||
self.init()
|
||||
self.update_editor()
|
||||
self.script_jobs.check_script_jobs(WINDOWS.UVEditor.name)
|
||||
|
||||
def init(self):
|
||||
"""初始化 UV 编辑器窗口"""
|
||||
if mc.workspaceControl(WINDOWS.UVEditor.name, q=1, ex=1):
|
||||
mc.deleteUI(WINDOWS.UVEditor.name)
|
||||
parent = maya_dockable_window(name=WINDOWS.UVEditor.name, label=WINDOWS.UVEditor.label, i_w=705, i_h=575, width_property='free')
|
||||
self.editor = UVEditor(parent)
|
||||
self.editor.setParent(parent)
|
||||
parent_layout = parent.layout()
|
||||
assert parent_layout is not None
|
||||
parent_layout.addWidget(self)
|
||||
self.window()
|
||||
self.editor.signal_key_press.connect(self.update_buttons)
|
||||
self.editor.signal_mouse_move.connect(self._update_curves)
|
||||
self.editor.signal_mouse_release.connect(self._stop_curves_update)
|
||||
self.editor.signal_uv_draw_end.connect(self.manual_curve_update)
|
||||
self.editor.signal_function_key_press.connect(undo(self.function_switch))
|
||||
self.uv_list.signal_key_pressed.connect(self.update_visibility)
|
||||
|
||||
def window(self):
|
||||
"""UV 编辑器窗口"""
|
||||
main_layout = QtWidgets.QVBoxLayout(self)
|
||||
main_layout.setContentsMargins(*style.scale([2, 2, 2, 2]))
|
||||
scroll_widget = QtWidgets.QWidget()
|
||||
layout = QtWidgets.QVBoxLayout(scroll_widget)
|
||||
scroll_area = QtWidgets.QScrollArea(self)
|
||||
scroll_area.setWidget(scroll_widget)
|
||||
main_layout.addWidget(scroll_area)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(style.scale(2))
|
||||
layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
scroll_area.setFrameShape(QtWidgets.QFrame.Shape.NoFrame)
|
||||
scroll_area.setWidgetResizable(True)
|
||||
self.editor.init()
|
||||
self.update_colors()
|
||||
with Row(layout) as main_row:
|
||||
with Column(main_row.layout()) as main_column:
|
||||
main_column_layout = main_column.layout()
|
||||
assert main_column_layout is not None
|
||||
main_column_layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
main_column.setFixedWidth(style.scale(130))
|
||||
main_column_layout.addWidget(separator())
|
||||
controller_label = Label(main_column.layout())
|
||||
controller_label.set_label('控制模式')
|
||||
self.controller_group = QtWidgets.QButtonGroup(main_column)
|
||||
self.controller_group.buttonReleased.connect(self.update_controller_mode)
|
||||
with Row(main_column.layout()) as select_move:
|
||||
select = Button(select_move.layout(), 'gsUVSelect')
|
||||
select.setCheckable(True)
|
||||
select.setChecked(True)
|
||||
select.set_label('选择 (Q)')
|
||||
move = Button(select_move.layout(), 'gsUVMove')
|
||||
move.setCheckable(True)
|
||||
move.set_label('移动 (W)')
|
||||
with Row(main_column.layout()) as rotate_scale:
|
||||
rotate = Button(rotate_scale.layout(), 'gsUVRotate')
|
||||
rotate.setCheckable(True)
|
||||
rotate.set_label('旋转 (E)')
|
||||
scale = Button(rotate_scale.layout(), 'gsUVScale')
|
||||
scale.setCheckable(True)
|
||||
scale.set_label('缩放 (R)')
|
||||
with Row(main_column.layout()) as scale_row:
|
||||
self.direction_switch = QtWidgets.QButtonGroup(scale_row)
|
||||
self.direction_switch.buttonReleased.connect(self.update_controller_mode)
|
||||
horizontal = Button(scale_row.layout(), 'gsUVHorizontalScale')
|
||||
horizontal.set_label('水平 (H)')
|
||||
horizontal.set_button_style('small')
|
||||
horizontal.setCheckable(True)
|
||||
horizontal.setChecked(True)
|
||||
vertical = Button(scale_row.layout(), 'gsUVVerticalScale')
|
||||
vertical.set_button_style('small')
|
||||
vertical.setCheckable(True)
|
||||
vertical.set_label('垂直 (V)')
|
||||
self.direction_switch.addButton(horizontal, 0)
|
||||
self.direction_switch.addButton(vertical, 1)
|
||||
draw_uv = Button(main_column.layout(), 'gsDrawUVs')
|
||||
draw_uv.setCheckable(True)
|
||||
draw_uv.set_label('绘制 (D)')
|
||||
self.controller_group.addButton(select, 0)
|
||||
self.controller_group.addButton(move, 1)
|
||||
self.controller_group.addButton(rotate, 2)
|
||||
self.controller_group.addButton(scale, 3)
|
||||
self.controller_group.addButton(draw_uv, 4)
|
||||
main_column_layout.addWidget(separator())
|
||||
utility_label = Label(main_column.layout())
|
||||
utility_label.set_label('实用功能')
|
||||
with Row(main_column.layout()) as hv_flip_row:
|
||||
h_flip_uv = Button(hv_flip_row.layout(), 'gsHorizontalFlipUV')
|
||||
h_flip_uv.set_label('水平翻转 (H)')
|
||||
h_flip_uv.clicked.connect(undo(self.horizontal_flip_uv))
|
||||
v_flip_uv = Button(hv_flip_row.layout(), 'gsVerticalFlipUV')
|
||||
v_flip_uv.set_label('垂直翻转 (V)')
|
||||
v_flip_uv.clicked.connect(undo(self.vertical_flip_uv))
|
||||
reset_uv = Button(main_column.layout(), 'gsResetUVs')
|
||||
reset_uv.set_label('重置 UV (X)')
|
||||
reset_uv.clicked.connect(undo(self.reset_uvs))
|
||||
sync_selection = Button(main_column.layout(), 'gsSyncSelectionUVs')
|
||||
sync_selection.set_label('同步选择 (S)')
|
||||
sync_selection.clicked.connect(undo(self.sync_selection))
|
||||
randomize_uvs = Button(main_column.layout(), 'gsRandomizeUVs')
|
||||
randomize_uvs.set_label('随机化')
|
||||
randomize_uvs.set_icon('mod-bottom')
|
||||
randomize_uvs.clicked.connect(undo(self.randomize_uvs))
|
||||
main_column_layout.addWidget(separator())
|
||||
uv_list_label = Label(main_column.layout())
|
||||
uv_list_label.set_label('UV 列表')
|
||||
self.uv_list = UVItemList(main_column_layout)
|
||||
self.uv_list.setLayout(main_column_layout)
|
||||
self.uv_list.signal_mouse_released.connect(self.update_visibility)
|
||||
focus_view = Button(main_column.layout(), 'gsFocusUVs')
|
||||
focus_view.set_label('聚焦视图 (F)')
|
||||
focus_view.clicked.connect(self.editor.focus_view)
|
||||
with Row(main_column.layout()) as hide_isolate:
|
||||
isolate_select = Button(hide_isolate.layout(), 'gsUVIsolateSelect')
|
||||
isolate_select.set_label('隔离选择 (I)')
|
||||
isolate_select.clicked.connect(self.isolate_select)
|
||||
hide = Button(hide_isolate.layout(), 'gsUVHide')
|
||||
hide.set_label('隐藏 (O)')
|
||||
hide.clicked.connect(self.hide)
|
||||
show_all_button = Button(main_column.layout(), 'gsUVShowAll')
|
||||
show_all_button.set_label('显示全部 (A)')
|
||||
show_all_button.clicked.connect(self.show_all)
|
||||
main_column_layout.addWidget(separator())
|
||||
with Frame(main_column.layout(), label='选项') as options_frame:
|
||||
texture_functions_label = Label(options_frame.get_frame_layout())
|
||||
texture_functions_label.set_label('纹理控制:')
|
||||
transparency = Button(options_frame.get_frame_layout(), 'UVEditorTransparencyToggle')
|
||||
transparency.set_button_style('small')
|
||||
transparency.setCheckable(True)
|
||||
transparency.setChecked(self.options_manager.get('UVEditorTransparencyToggle'))
|
||||
transparency.set_label('透明度')
|
||||
alpha_only = Button(options_frame.get_frame_layout(), 'UVEditorAlphaOnlyToggle')
|
||||
alpha_only.set_button_style('small')
|
||||
alpha_only.setCheckable(True)
|
||||
alpha_only.setChecked(self.options_manager.get('UVEditorAlphaOnly'))
|
||||
alpha_only.set_label('仅显示 Alpha 通道')
|
||||
use_transforms = Button(options_frame.get_frame_layout(), 'UVEditorUseTransforms')
|
||||
use_transforms.set_button_style('small')
|
||||
use_transforms.setCheckable(True)
|
||||
use_transforms.setChecked(True)
|
||||
use_transforms.set_label('使用变换')
|
||||
use_transforms.clicked.connect(self.update_texture)
|
||||
|
||||
def toggle_alpha_command():
|
||||
if transparency.isChecked():
|
||||
self.editor.toggle_alpha(True)
|
||||
else:
|
||||
self.editor.toggle_alpha(False)
|
||||
alpha_only.setChecked(False)
|
||||
self.update_texture()
|
||||
self.options_manager.set('UVEditorTransparencyToggle', transparency.isChecked())
|
||||
transparency.clicked.connect(toggle_alpha_command)
|
||||
|
||||
def toggle_alpha_only_command():
|
||||
if alpha_only.isChecked():
|
||||
transparency.setChecked(True)
|
||||
else:
|
||||
transparency.setChecked(False)
|
||||
toggle_alpha_command()
|
||||
self.options_manager.set('UVEditorAlphaOnly', alpha_only.isChecked())
|
||||
alpha_only.clicked.connect(toggle_alpha_only_command)
|
||||
options_frame.get_frame_layout().addWidget(separator())
|
||||
texture_functions_label = Label(options_frame.get_frame_layout())
|
||||
texture_functions_label.set_label('编辑器颜色:')
|
||||
with Row(options_frame.get_frame_layout(), margins=style.scale([5, 0, 5, 5])) as color_row:
|
||||
background_color_picker = ColorPicker('UVEditorBGColorPicker', color_row.layout())
|
||||
background_color_picker.set_rgb_colors(clr_to_float(literal_eval(self.options_manager.get('UVEditorBGColor'))))
|
||||
background_color_picker.connect_command(self.update_colors)
|
||||
grid_color_picker = ColorPicker('UVEditorGridColorPicker', color_row.layout())
|
||||
grid_color_picker.set_rgb_colors(clr_to_float(literal_eval(self.options_manager.get('UVEditorGridColor'))))
|
||||
grid_color_picker.connect_command(self.update_colors)
|
||||
frame_color_picker = ColorPicker('UVEditorFrameColorPicker', color_row.layout())
|
||||
frame_color_picker.set_rgb_colors(clr_to_float(literal_eval(self.options_manager.get('UVEditorFrameColor'))))
|
||||
frame_color_picker.connect_command(self.update_colors)
|
||||
card_colors = Label(options_frame.get_frame_layout())
|
||||
card_colors.set_label('UV 颜色:')
|
||||
with Row(options_frame.get_frame_layout(), margins=style.scale([5, 0, 5, 5])) as color_row2:
|
||||
selected_card_frame_color = ColorPicker('UVEditorUVFrameSelectedColorPicker', color_row2.layout())
|
||||
selected_card_frame_color.set_rgb_colors(clr_to_float(literal_eval(self.options_manager.get('UVEditorUVFrameSelectedColor'))))
|
||||
selected_card_frame_color.connect_command(self.update_colors)
|
||||
deselected_card_frame_color = ColorPicker('UVEditorUVFrameDeselectedColorPicker', color_row2.layout())
|
||||
deselected_card_frame_color.set_rgb_colors(clr_to_float(literal_eval(self.options_manager.get('UVEditorUVFrameDeselectedColor'))))
|
||||
deselected_card_frame_color.connect_command(self.update_colors)
|
||||
card_fill_color = ColorPicker('UVEditorUVCardFillColorPicker', color_row2.layout())
|
||||
card_fill_color.set_rgb_colors(clr_to_float(literal_eval(self.options_manager.get('UVEditorUVCardFillColor'))))
|
||||
card_fill_color.connect_command(self.update_colors)
|
||||
main_column_layout.addWidget(separator())
|
||||
main_row_layout = main_row.layout()
|
||||
assert main_row_layout is not None
|
||||
main_row_layout.addWidget(self.editor)
|
||||
if MAYA_VER in [2020, 2022]:
|
||||
if not self.options_manager.get('UVBugMessageDismissed'):
|
||||
with Row(main_layout) as row:
|
||||
label = Label(row.layout())
|
||||
label.set_label('<p style="color:#FF542F">如何修复 Maya 2020 - 2022 的 UV 问题:</p>')
|
||||
link_button = Button(row.layout())
|
||||
link_button.set_label('打开修复方法')
|
||||
link_button.set_button_style('small-filled')
|
||||
link_button.clicked.connect(lambda: open_link('https://gs-curvetools.readthedocs.io/en/latest/faq.html#maya-2020-2022-and-broken-uvs'))
|
||||
dismiss_message = Button(row.layout())
|
||||
dismiss_message.set_label('忽略提示')
|
||||
dismiss_message.set_button_style('small-filled')
|
||||
dismiss_message.clicked.connect(lambda: row.setHidden(True))
|
||||
dismiss_message.clicked.connect(lambda: self.options_manager.set('UVBugMessageDismissed', 1))
|
||||
|
||||
def update_colors(self, *_):
|
||||
"""更新 UV 编辑器的颜色"""
|
||||
if self.editor:
|
||||
self.options_manager.save()
|
||||
try:
|
||||
self.editor.change_color(literal_eval(self.options_manager.get('UVEditorBGColor')), literal_eval(self.options_manager.get('UVEditorGridColor')), literal_eval(self.options_manager.get('UVEditorFrameColor')), literal_eval(self.options_manager.get('UVEditorUVCardFillColor')), literal_eval(self.options_manager.get('UVEditorUVFrameSelectedColor')))
|
||||
except BaseException as exc:
|
||||
self.editor.change_color()
|
||||
logger.exception(exc)
|
||||
self.editor.update()
|
||||
|
||||
@no_undo
|
||||
def update_editor(self):
|
||||
"""更新 UV 编辑器"""
|
||||
self.update_item_list()
|
||||
self.update_uvs()
|
||||
self.update_texture()
|
||||
|
||||
def show_all(self):
|
||||
"""显示所有 UV"""
|
||||
self.uv_list.expandAll()
|
||||
self.uv_list.selectAll()
|
||||
self.update_visibility()
|
||||
self.isolate_mode = False
|
||||
|
||||
@no_undo
|
||||
def update_uvs(self, keep_selection=False):
|
||||
"""更新 UV"""
|
||||
sel = mc.filterExpand(mc.ls(sl=1, fl=1, l=1), sm=9)
|
||||
old_uvs = self.editor.uv_dict
|
||||
self.editor.purge_uvs()
|
||||
if not sel:
|
||||
return
|
||||
sel = self.check_for_legacy_uvs(sel)
|
||||
assert sel is not None
|
||||
for item in sel:
|
||||
if mc.attributeQuery('Orientation', n=item, ex=1) and mc.connectionInfo(item + '.Orientation', isSource=1):
|
||||
if mc.attributeQuery('gsmessage', n=item, ex=1) and mc.listConnections(item + '.gsmessage'):
|
||||
curves = self.core.utils.get_all_connected_curves(item)
|
||||
else:
|
||||
curves = [item]
|
||||
for curve in curves:
|
||||
attrs = self.core.attributes.get_uvs(curve)
|
||||
checkbox = self.core.attributes.get_checkboxes(curve)
|
||||
if attrs:
|
||||
uv_item = self.editor.create_uv(curve)
|
||||
if 'flipUV' in checkbox:
|
||||
uv_item.flip = not checkbox['flipUV']
|
||||
uv_item.move_uv(x=attrs['moveU'], y=attrs['moveV'], rot=attrs['rotateUV'] * -1, s_x=attrs['scaleU'], s_y=attrs['scaleV'])
|
||||
if keep_selection:
|
||||
new_uvs = self.editor.uv_dict
|
||||
for key, val in new_uvs.items():
|
||||
if key in old_uvs:
|
||||
val.setSelected(True)
|
||||
|
||||
def check_for_legacy_uvs(self, curves):
|
||||
"""检查是否存在旧版 UV"""
|
||||
legacy_curves = []
|
||||
for curve in curves:
|
||||
root = mc.attributeQuery('rotateRootUV', n=curve, ex=1)
|
||||
tip = mc.attributeQuery('rotateTipUV', n=curve, ex=1)
|
||||
if root or tip:
|
||||
root_value = mc.getAttr(curve + '.rotateRootUV')
|
||||
tip_value = mc.getAttr(curve + '.rotateTipUV')
|
||||
if root_value or tip_value:
|
||||
legacy_curves.append(curve)
|
||||
if not legacy_curves:
|
||||
return curves
|
||||
logger.warning('检测到非零旧版 UV 属性', in_view=True)
|
||||
dialog = mc.confirmDialog(title='旧版 UV', message='检测到非零旧版 UV。\nUV 编辑器与此不兼容。\n是否将其归零以继续?', icon='warning', button=['是', '取消'], cancelButton='取消', dismissString='取消')
|
||||
if dialog == '是':
|
||||
for curve in legacy_curves:
|
||||
mc.setAttr(curve + '.rotateRootUV', 0)
|
||||
mc.setAttr(curve + '.rotateTipUV', 0)
|
||||
return curves
|
||||
elif dialog == '取消':
|
||||
dialog = mc.confirmDialog(title='旧版 UV', message='UV 编辑器与旧版 UV 不兼容。\n部分卡片将被忽略。', icon='信息', button='确定', cancelButton='确定', dismissString='确定')
|
||||
return list(set(curves) - set(legacy_curves))
|
||||
|
||||
@no_undo
|
||||
def update_texture(self):
|
||||
"""更新纹理"""
|
||||
sel = self.core.utils.select_part(2, just_return=True)
|
||||
if not sel:
|
||||
self.editor.remove_texture()
|
||||
self.editor.diffuse_path = ''
|
||||
return
|
||||
geo = mc.filterExpand(sel, sm=12)
|
||||
if not geo:
|
||||
return
|
||||
dag = mc.ls(geo[-1], dag=1, s=1)
|
||||
shader = mc.listConnections(dag, d=1, s=1, t='shadingEngine')
|
||||
if not shader:
|
||||
return
|
||||
diffuse_file_node, alpha_file_node = self.core.utils.find_diffuse_alpha(shader[0])
|
||||
if not diffuse_file_node and (not alpha_file_node):
|
||||
return
|
||||
texture_path = None
|
||||
alpha_path = None
|
||||
if diffuse_file_node:
|
||||
texture_path = mc.getAttr(diffuse_file_node + '.fileTextureName')
|
||||
if alpha_file_node:
|
||||
alpha_path = mc.getAttr(alpha_file_node + '.fileTextureName') if alpha_file_node else None
|
||||
if not texture_path and alpha_path:
|
||||
texture_path = alpha_path
|
||||
diffuse_file_node = alpha_file_node
|
||||
place_2d_texture = None
|
||||
if mc.attributeQuery('coverage', n=diffuse_file_node, ex=1):
|
||||
info = mc.connectionInfo(diffuse_file_node + '.coverage', sfd=1)
|
||||
if info:
|
||||
place_2d_texture = info.split('.')
|
||||
if place_2d_texture:
|
||||
place_2d_texture = place_2d_texture[0]
|
||||
cov, trans = (None, None)
|
||||
if place_2d_texture and mc.objExists(place_2d_texture) and self.widget_manager.get('UVEditorUseTransforms').isChecked() and mc.attributeQuery('coverage', ex=1, n=place_2d_texture) and mc.attributeQuery('translateFrame', ex=1, n=place_2d_texture):
|
||||
try:
|
||||
cov = mc.getAttr(place_2d_texture + '.coverage')[0]
|
||||
trans = mc.getAttr(place_2d_texture + '.translateFrame')[0]
|
||||
except BaseException as exc:
|
||||
logger.exception(exc)
|
||||
coverage = cov if cov else (1.0, 1.0)
|
||||
translation = (trans[0], trans[1]) if trans and trans else (0, 0)
|
||||
if not self.widget_manager.get('UVEditorTransparencyToggle').isChecked() and (not self.widget_manager.get('UVEditorAlphaOnlyToggle').isChecked()):
|
||||
alpha_path = None
|
||||
if texture_path:
|
||||
_, ext = os.path.splitext(texture_path)
|
||||
try:
|
||||
supported_formats = [str(x, encoding='ASCII').lower() for x in QtGui.QImageReader.supportedImageFormats()]
|
||||
except TypeError:
|
||||
supported_formats = [str(x).decode('ASCII').lower() for x in QtGui.QImageReader.supportedImageFormats()]
|
||||
if ext and ext[1:].lower() not in supported_formats:
|
||||
logger.warning('{} 格式不受支持。请使用 JPG/JPEG、PNG、TIF/TIFF(LZW 或无压缩)、TGA(24 位,无 RLE)'.format(ext[1:].upper()))
|
||||
return
|
||||
err = self.editor.set_texture('%s' % texture_path, alpha_path, coverage, translation)
|
||||
if err == 'SamePath':
|
||||
return
|
||||
if err == 'NoTexture':
|
||||
logger.warning('无法加载纹理文件。')
|
||||
elif err == 'ZeroTexture':
|
||||
logger.warning('无效路径或零纹理。请检查导出的纹理位深度和压缩方式。TIF/TIFF(LZW 或无压缩)、TGA(24 位,无 RLE)。')
|
||||
|
||||
def manual_curve_update(self):
|
||||
"""手动更新 UV 曲线"""
|
||||
try:
|
||||
self._update_curves()
|
||||
except BaseException as exc:
|
||||
logger.exception(exc)
|
||||
finally:
|
||||
self._stop_curves_update()
|
||||
|
||||
def _update_curves(self):
|
||||
if self.uv_update_check == 0:
|
||||
mc.undoInfo(ock=1, cn='gsUVUpdate')
|
||||
self.uv_update_check = 1
|
||||
sel = mc.filterExpand(mc.ls(sl=1), sm=9)
|
||||
uvs = self.editor.get_uvs()
|
||||
self.current_selection *= 0
|
||||
if not sel:
|
||||
return
|
||||
for curve in sel:
|
||||
if curve in uvs:
|
||||
self.current_selection.append(curve)
|
||||
elif mc.attributeQuery('gsmessage', n=curve, ex=1) and mc.listConnections(curve + '.gsmessage'):
|
||||
bound_curves = self.core.utils.get_all_connected_curves(curve)
|
||||
if bound_curves:
|
||||
self.current_selection += bound_curves
|
||||
if not self.timer.increment(0.016666666666666666):
|
||||
return
|
||||
if not self.current_selection:
|
||||
return
|
||||
uvs = self.editor.get_uvs()
|
||||
for curve in self.current_selection:
|
||||
if curve in uvs:
|
||||
self.core.attributes.set_attributes(curve, uvs[curve])
|
||||
|
||||
def _stop_curves_update(self):
|
||||
if self.uv_update_check == 1:
|
||||
mc.undoInfo(cck=1)
|
||||
self.uv_update_check = 0
|
||||
self.current_selection *= 0
|
||||
self.core.curve_control.update_ui()
|
||||
|
||||
def update_buttons(self, controller_mode, scale_mode):
|
||||
"""更新按钮状态"""
|
||||
assert self.controller_group is not None
|
||||
assert self.direction_switch is not None
|
||||
buttons = self.controller_group.buttons()
|
||||
direction = self.direction_switch.buttons()
|
||||
if controller_mode == 'SELECT':
|
||||
buttons[0].setChecked(True)
|
||||
elif controller_mode == 'MOVE':
|
||||
buttons[1].setChecked(True)
|
||||
elif controller_mode == 'ROTATE':
|
||||
buttons[2].setChecked(True)
|
||||
elif controller_mode == 'SCALE':
|
||||
buttons[3].setChecked(True)
|
||||
if scale_mode == 'H':
|
||||
direction[0].setChecked(True)
|
||||
else:
|
||||
direction[1].setChecked(True)
|
||||
elif controller_mode == 'DRAW':
|
||||
buttons[4].setChecked(True)
|
||||
|
||||
def update_controller_mode(self):
|
||||
"""更新控制模式"""
|
||||
assert self.controller_group is not None
|
||||
assert self.direction_switch is not None
|
||||
button_id = self.controller_group.checkedId()
|
||||
scale_id = self.direction_switch.checkedId()
|
||||
scale = 'H'
|
||||
if button_id == 0:
|
||||
mode = 'SELECT'
|
||||
elif button_id == 1:
|
||||
mode = 'MOVE'
|
||||
elif button_id == 2:
|
||||
mode = 'ROTATE'
|
||||
elif button_id == 3:
|
||||
mode = 'SCALE'
|
||||
if scale_id == 0:
|
||||
scale = 'H'
|
||||
else:
|
||||
scale = 'V'
|
||||
else:
|
||||
mode = 'DRAW'
|
||||
self.editor.controller_mode_change(mode, scale)
|
||||
|
||||
def update_item_list(self):
|
||||
"""更新项目列表"""
|
||||
sel = mc.filterExpand(mc.ls(sl=1), sm=9)
|
||||
if not sel:
|
||||
self.uv_list.clear_item_list()
|
||||
return
|
||||
final_dict = {}
|
||||
for curve in sel:
|
||||
if mc.attributeQuery('Orientation', n=curve, ex=1) and mc.connectionInfo(curve + '.Orientation', isSource=1):
|
||||
if mc.attributeQuery('gsmessage', n=curve, ex=1) and mc.listConnections(curve + '.gsmessage'):
|
||||
bound_curves = self.core.utils.get_all_connected_curves(curve)
|
||||
final_dict[curve] = bound_curves
|
||||
else:
|
||||
final_dict[curve] = []
|
||||
self.uv_list.update_item_list(final_dict)
|
||||
|
||||
def update_visibility(self):
|
||||
"""更新 UV 的可见性"""
|
||||
item_list = self.uv_list.get_selection()
|
||||
items = self.editor.get_all_uvs()
|
||||
for item in items:
|
||||
if item.name in item_list:
|
||||
item.setVisible(True)
|
||||
else:
|
||||
item.setVisible(False)
|
||||
self.editor.update()
|
||||
|
||||
def hide(self):
|
||||
"""隐藏选中的 UV 项目"""
|
||||
sel_uvs = self.editor.get_all_uvs(selected=True)
|
||||
sel_uvs_list = [i.name for i in sel_uvs]
|
||||
for uv_item in sel_uvs:
|
||||
uv_item.setVisible(False)
|
||||
item_list = self.uv_list.get_item_list()
|
||||
select_list = []
|
||||
for item in item_list:
|
||||
if item.curve_name in sel_uvs_list:
|
||||
select_list.append(item)
|
||||
self.uv_list.select_items(select_list)
|
||||
|
||||
def isolate_select(self):
|
||||
"""隔离选中的 UV 项目"""
|
||||
all_uvs = self.editor.get_all_uvs()
|
||||
sel_uvs = self.editor.get_all_uvs(selected=True)
|
||||
if not sel_uvs:
|
||||
return
|
||||
if self.isolate_mode:
|
||||
self.show_all()
|
||||
self.isolate_mode = False
|
||||
return
|
||||
self.isolate_mode = True
|
||||
sel_uvs_list = [i.name for i in sel_uvs]
|
||||
for uv_item in all_uvs:
|
||||
if uv_item.name not in sel_uvs_list:
|
||||
uv_item.setVisible(False)
|
||||
item_list = self.uv_list.get_item_list()
|
||||
deselect_list = []
|
||||
for item in item_list:
|
||||
if item.curve_name not in sel_uvs_list:
|
||||
deselect_list.append(item)
|
||||
self.uv_list.select_items(deselect_list)
|
||||
|
||||
def horizontal_flip_uv(self):
|
||||
"""水平翻转 UV"""
|
||||
items = self.editor.get_all_uvs(selected=True)
|
||||
for item in items:
|
||||
if item.name and mc.attributeQuery('flipUV', n=item.name, ex=1):
|
||||
flip = mc.getAttr(item.name + '.flipUV')
|
||||
mc.setAttr(item.name + '.flipUV', not flip)
|
||||
item.flip = flip
|
||||
item.update()
|
||||
if items:
|
||||
self.editor.update()
|
||||
|
||||
def vertical_flip_uv(self):
|
||||
"""垂直翻转 UV"""
|
||||
self.editor.vertical_flip_uvs()
|
||||
self.manual_curve_update()
|
||||
|
||||
def function_switch(self, key):
|
||||
"""功能切换"""
|
||||
if key == 'H':
|
||||
self.horizontal_flip_uv()
|
||||
elif key == 'V':
|
||||
self.vertical_flip_uv()
|
||||
elif key == 'X':
|
||||
self.reset_uvs()
|
||||
elif key == 'I':
|
||||
self.isolate_select()
|
||||
elif key == 'O':
|
||||
self.hide()
|
||||
elif key == 'A':
|
||||
self.show_all()
|
||||
elif key == 'S':
|
||||
self.sync_selection()
|
||||
|
||||
def reset_uvs(self):
|
||||
"""重置 UV"""
|
||||
self.editor.reset_uvs()
|
||||
self.manual_curve_update()
|
||||
|
||||
def randomize_uvs(self):
|
||||
"""随机化 UV"""
|
||||
if get_mod() == 'Shift':
|
||||
self.editor.randomize_uvs(True)
|
||||
else:
|
||||
self.editor.randomize_uvs(False)
|
||||
self.manual_curve_update()
|
||||
|
||||
def sync_selection(self):
|
||||
"""根据 UV 编辑器的选择在 Maya 视口中选择曲线"""
|
||||
sel = mc.filterExpand(mc.ls(sl=1), sm=9)
|
||||
if not sel:
|
||||
return
|
||||
sel_uvs = [x.name for x in self.editor.get_all_uvs(selected=True)]
|
||||
new_sel = [x for x in sel if x in sel_uvs]
|
||||
if new_sel:
|
||||
mc.select(new_sel, r=1)
|
||||
|
||||
@deferred_lp
|
||||
def x():
|
||||
uvs = self.editor.get_all_uvs()
|
||||
for uv_item in uvs:
|
||||
uv_item.setSelected(True)
|
||||
self.editor.scene().update()
|
||||
x()
|
||||
@@ -1,651 +0,0 @@
|
||||
# 字节码版本: 3.11a7e (3495)
|
||||
# 源代码时间戳: 2025-04-22 11:47:05 UTC (1745322425)
|
||||
|
||||
"""
|
||||
GS曲线工具主窗口
|
||||
---
|
||||
GS曲线工具许可协议:
|
||||
名为GS曲线工具的此代码集合归乔治·斯拉德科夫斯基(叶戈尔·斯拉德科夫斯基)所有,
|
||||
未经他的书面许可,不得复制或分发。
|
||||
|
||||
GS曲线工具 v1.3.10 个人版
|
||||
版权所有 2025,乔治·斯拉德科夫斯基(叶戈尔·斯拉德科夫斯基)
|
||||
保留所有权利
|
||||
|
||||
用户界面字体为Roboto,该字体根据Apache 2.0许可协议授权:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Autodesk Maya是Autodesk公司的产品:
|
||||
https://www.autodesk.com/
|
||||
|
||||
社交媒体和联系方式:
|
||||
|
||||
Discord服务器: https://discord.gg/f4DH6HQ
|
||||
在线商店: https://sladkovsky3d.artstation.com/store
|
||||
在线文档: https://gs-curvetools.readthedocs.io/
|
||||
Twitch频道: https://www.twitch.tv/videonomad
|
||||
YouTube频道: https://www.youtube.com/c/GeorgeSladkovsky
|
||||
ArtStation作品集: https://www.artstation.com/sladkovsky3d
|
||||
联系邮箱: george.sladkovsky@gmail.com
|
||||
"""
|
||||
import os
|
||||
from functools import partial
|
||||
import maya.cmds as mc
|
||||
from gs_curvetools.api.maya_tools import deferred, get_mod, no_undo, undo
|
||||
from gs_curvetools.api.qt_compat import *
|
||||
from gs_curvetools.api.typing import *
|
||||
from gs_curvetools.api.utils import open_link
|
||||
from gs_curvetools.config.constants import *
|
||||
from gs_curvetools.config.folders import GetFolder
|
||||
from gs_curvetools.debug.logger import logger
|
||||
from gs_curvetools.managers.options_manager import OptionsManager
|
||||
from gs_curvetools.managers.script_jobs import ScriptJobs
|
||||
from gs_curvetools.ui import style
|
||||
from gs_curvetools.ui.components import AboutWindow, AttributesFilterWindow, CurveControlWindow, CurveThicknessWindow, CustomLayerColorsWindow, GeoToCurveWindow, RandomizeCurveWindow, ScaleFactorWindow, UVEditorWindow
|
||||
from gs_curvetools.ui.tooltips import Tooltips
|
||||
from gs_curvetools.ui.utils import maya_dockable_window
|
||||
from gs_curvetools.ui.widgets import ActionGroup, Button, Frame, Layer, LayerCollectionWidget, Layout, LineEdit, Menu, MenuItem, Row, get_unique_name, maya_slider, separator, wrap_control
|
||||
if TYPE_CHECKING:
|
||||
from gs_curvetools.core.core import Core
|
||||
from gs_curvetools.managers.widget_manager import WidgetManager
|
||||
|
||||
class MainWindow(QWidget):
|
||||
"""Main GS CurveTools window"""
|
||||
|
||||
def __init__(self, manager, core):
|
||||
menu_height = 786 if MAYA_VER <= 2024 else 810
|
||||
dockable_window = maya_dockable_window(name=WINDOWS.MainWindow.name, label=WINDOWS.MainWindow.label, i_h=menu_height)
|
||||
mc.workspaceControl(WINDOWS.MainWindow.name, e=1, ui=UI_SCRIPT)
|
||||
super(MainWindow, self).__init__(dockable_window)
|
||||
self.setParent(dockable_window)
|
||||
dockable_layout = dockable_window.layout()
|
||||
assert dockable_layout is not None
|
||||
dockable_layout.addWidget(self)
|
||||
self.widget_manager = manager
|
||||
self.core = core
|
||||
self.script_jobs = ScriptJobs.singleton()
|
||||
self.script_jobs.check_script_jobs(WINDOWS.MainWindow.name)
|
||||
self.options_manager = OptionsManager()
|
||||
self.tooltips = Tooltips()
|
||||
QtGui.QFontDatabase.removeAllApplicationFonts()
|
||||
fonts = os.listdir(GetFolder.fonts())
|
||||
for font in fonts:
|
||||
QtGui.QFontDatabase.addApplicationFont(os.path.join(GetFolder.fonts(), font))
|
||||
self.about_window = AboutWindow()
|
||||
self.attributes_filter_window = AttributesFilterWindow(self)
|
||||
self.curve_control_window = CurveControlWindow(self)
|
||||
self.curve_thickness_window = CurveThicknessWindow(self)
|
||||
self.custom_layer_colors_window = CustomLayerColorsWindow(self)
|
||||
self.geo_to_curve_window = GeoToCurveWindow(self)
|
||||
self.randomize_curve_window = RandomizeCurveWindow(self)
|
||||
self.scale_factor_window = ScaleFactorWindow(self)
|
||||
self.uv_editor = UVEditorWindow(self)
|
||||
self.widget_manager.add(WINDOWS.MainWindow.name, dockable_window)
|
||||
self._connect_signals()
|
||||
|
||||
def _connect_signals(self):
|
||||
"""Sets up the signals"""
|
||||
self.curve_control_window.update_curve_control_ui.connect(self.core.curve_control.update_ui)
|
||||
self.curve_control_window.update_main_ui.connect(self.core.updates.update_main_ui)
|
||||
|
||||
def create_ui(self):
|
||||
"""Creates the UI"""
|
||||
main_layout = QVBoxLayout(self)
|
||||
main_layout.setContentsMargins(*style.scale([2, 0, 2, 0]))
|
||||
scroll_area = QScrollArea(self)
|
||||
scroll_widget = QWidget()
|
||||
scroll_widget.setFocus()
|
||||
scroll_layout = QVBoxLayout(scroll_widget)
|
||||
scroll_area.setWidget(scroll_widget)
|
||||
main_layout.addWidget(scroll_area)
|
||||
scroll_layout.setContentsMargins(0, 0, 0, 0)
|
||||
scroll_layout.setSpacing(style.scale(2))
|
||||
scroll_layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
scroll_area.setFrameShape(QtWidgets.QFrame.Shape.NoFrame)
|
||||
scroll_area.setWidgetResizable(True)
|
||||
menu_bar_widget = QWidget(scroll_area)
|
||||
menu_bar_layout = QHBoxLayout(menu_bar_widget)
|
||||
menu_bar_layout.setContentsMargins(0, 0, 0, 0)
|
||||
menu_bar_layout.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
menu_bar = QMenuBar(menu_bar_widget)
|
||||
menu_bar.setSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
menu_bar_layout.addWidget(menu_bar)
|
||||
scroll_layout.addWidget(menu_bar_widget)
|
||||
with Menu('选项', menu_bar) as menu:
|
||||
menu.triggered.connect(self.options_manager.save)
|
||||
menu.addSection('导入 / 导出')
|
||||
import_curves = MenuItem('importCurves', '导入曲线', menu)
|
||||
import_curves.triggered.connect(no_undo(self.core.import_export.import_curves))
|
||||
export_curves = MenuItem('exportCurves', '导出曲线', menu)
|
||||
export_curves.triggered.connect(self.core.import_export.export_curves)
|
||||
menu.addSection('全局修改器')
|
||||
change_scale_factor = MenuItem('changeScaleFactor', '更改比例因子和精度', menu)
|
||||
change_scale_factor.triggered.connect(self.scale_factor_window.show_window)
|
||||
global_curve_thickness = MenuItem('globalCurveThickness', '全局曲线厚度', menu)
|
||||
global_curve_thickness.triggered.connect(self.curve_thickness_window.show_window)
|
||||
menu.addSection('视图端口命令')
|
||||
ao_settings = MenuItem('setAOSettings', '设置AO设置', menu)
|
||||
ao_settings.triggered.connect(self.options_manager.set_ao_settings)
|
||||
with Menu('透明度设置', menu) as transparency_settings_menu:
|
||||
simple_transparency = MenuItem('setSimpleTransparency', '简单透明度(快速,不准确)', transparency_settings_menu)
|
||||
simple_transparency.triggered.connect(partial(no_undo(self.options_manager.set_transparency_settings), 0))
|
||||
object_sorting_transparency = MenuItem('setObjectSortingTransparency', '对象排序透明度(中等)', transparency_settings_menu)
|
||||
object_sorting_transparency.triggered.connect(partial(no_undo(self.options_manager.set_transparency_settings), 1))
|
||||
set_depth_transparency = MenuItem('setDepthTransparency', '深度透明度(准确,缓慢,推荐)', transparency_settings_menu)
|
||||
set_depth_transparency.triggered.connect(partial(no_undo(self.options_manager.set_transparency_settings), 2))
|
||||
menu.addSection('转换曲线')
|
||||
with Menu('转换曲线', menu) as convert_curves_submenu:
|
||||
convert_to_warp_card = MenuItem('convertToWarpCard', '转换为变形面片', convert_curves_submenu)
|
||||
convert_to_warp_card.triggered.connect(partial(undo(self.core.functions.convert_selection_to), 0))
|
||||
convert_to_warp_tube = MenuItem('convertToWarpTube', '转换为变形管', convert_curves_submenu)
|
||||
convert_to_warp_tube.triggered.connect(partial(undo(self.core.functions.convert_selection_to), 1))
|
||||
convert_to_extrude_card = MenuItem('convertToExtrudeCard', '转换为挤压面片', convert_curves_submenu)
|
||||
convert_to_extrude_card.triggered.connect(partial(undo(self.core.functions.convert_selection_to), 2))
|
||||
convert_to_extrude_tube = MenuItem('convertToExtrudeTube', '转换为挤压管', convert_curves_submenu)
|
||||
convert_to_extrude_tube.triggered.connect(partial(undo(self.core.functions.convert_selection_to), 3))
|
||||
menu.addSection('实用功能')
|
||||
duplicate_unparent = MenuItem('duplicateUnparentCurves', '复制并取消父级关联曲线', menu)
|
||||
duplicate_unparent.triggered.connect(undo(self.core.functions.duplicate_unparent))
|
||||
menu.addSection('常规选项')
|
||||
MenuItem('keepCurveAttributes', '保留曲线属性', menu, True, self.options_manager.get('keepCurveAttributes'))
|
||||
MenuItem('addBetweenBlendAttributes', '添加面片/管混合属性', menu, True, self.options_manager.get('addBetweenBlendAttributes'))
|
||||
MenuItem('fillCreateCurvesOnly', '填充仅创建曲线', menu, True, self.options_manager.get('fillCreateCurvesOnly'))
|
||||
MenuItem('convertInstances', '自动转换实例', menu, True, self.options_manager.get('convertInstances'))
|
||||
MenuItem('useAutoSamplingOnNewCurves', '对新曲线使用自动采样', menu, True, self.options_manager.get('useAutoSamplingOnNewCurves'))
|
||||
MenuItem('useAutoRefineOnNewCurves', '对新曲线使用自动细化', menu, True, self.options_manager.get('useAutoRefineOnNewCurves'))
|
||||
MenuItem('flipUVsAfterMirror', '镜像后翻转UV', menu, True, self.options_manager.get('flipUVsAfterMirror'))
|
||||
enable_tooltips_menu = MenuItem('enableTooltips', '启用工具提示', menu, True, self.options_manager.get('enableTooltips'))
|
||||
enable_tooltips_menu.triggered.connect(self.toggle_tooltips)
|
||||
menu.addSection('颜色选项')
|
||||
sync_color = MenuItem('syncCurveColor', '同步曲线颜色到图层颜色', menu, True, self.options_manager.get('syncCurveColor'))
|
||||
sync_color.triggered.connect(self.core.color_mode.sync_curve_colors)
|
||||
MenuItem('colorizedRegroup', '对重新分组的图层进行颜色化', menu, True, self.options_manager.get('colorizedRegroup'))
|
||||
color_only_diffuse = MenuItem('colorOnlyDiffuse', '颜色仅影响漫反射', menu, True, self.options_manager.get('colorOnlyDiffuse'))
|
||||
color_only_diffuse.triggered.connect(self.core.color_mode.update_color_options)
|
||||
checker_pattern = MenuItem('checkerPattern', '颜色模式使用棋盘格图案', menu, True, self.options_manager.get('checkerPattern'))
|
||||
checker_pattern.triggered.connect(self.core.color_mode.update_color_options)
|
||||
menu.addSection('绑定选项')
|
||||
MenuItem('boundCurvesFollowParent', '绑定曲线跟随父级', menu, True, self.options_manager.get('boundCurvesFollowParent'))
|
||||
MenuItem('massBindOption', '绑定到所有可用的空曲线', menu, True, self.options_manager.get('massBindOption'))
|
||||
MenuItem('bindDuplicatesCurves', '绑定前复制曲线', menu, True, self.options_manager.get('bindDuplicatesCurves'))
|
||||
MenuItem('bindFlipUVs', '绑定前翻转UV', menu, True, self.options_manager.get('bindFlipUVs'))
|
||||
menu.addSection('解绑/解包选项')
|
||||
MenuItem('unpackDeleteOriginalObject', '解包时删除原始对象', menu, True, self.options_manager.get('unpackDeleteOriginalObject'))
|
||||
MenuItem('unpackCVMatch', '解包匹配原始CV数量', menu, True, self.options_manager.get('unpackCVMatch'))
|
||||
menu.addSection('图层选项')
|
||||
MenuItem('ignoreLastLayer', '忽略最后一个图层', menu, True, self.options_manager.get('ignoreLastLayer'))
|
||||
MenuItem('syncOutlinerLayerVis', '同步大纲/图层可见性', menu, True, self.options_manager.get('syncOutlinerLayerVis'))
|
||||
MenuItem('replacingCurveLayerSelection', '替换曲线图层选择', menu, True, self.options_manager.get('replacingCurveLayerSelection'))
|
||||
only_numbers_in_layers = MenuItem('layerNumbersOnly', '图层仅使用数字', menu, True, self.options_manager.get('layerNumbersOnly'))
|
||||
only_numbers_in_layers.triggered.connect(self.core.layer_manager.change_layers_to_numbers)
|
||||
only_numbers_in_layers.triggered.connect(self.update_layer_list)
|
||||
with Menu('活动图层数量', menu) as layer_number_menu, ActionGroup('layerRowsActionGroup', layer_number_menu) as action_group:
|
||||
MenuItem('2layerRows', '20个图层', layer_number_menu, True, self.options_manager.get('2layerRows'), collection=action_group)
|
||||
MenuItem('3layerRows', '30个图层', layer_number_menu, True, self.options_manager.get('3layerRows'), collection=action_group)
|
||||
MenuItem('4layerRows', '40个图层', layer_number_menu, True, self.options_manager.get('4layerRows'), collection=action_group)
|
||||
MenuItem('6layerRows', '60个图层', layer_number_menu, True, self.options_manager.get('6layerRows'), collection=action_group)
|
||||
MenuItem('8layerRows', '80个图层', layer_number_menu, True, self.options_manager.get('8layerRows'), collection=action_group)
|
||||
action_group.triggered.connect(self.core.updates.update_main_ui)
|
||||
menu.addSection('图层集合选项')
|
||||
MenuItem('ignoreTemplateCollections', '忽略“模板”集合名称', menu, True, self.options_manager.get('ignoreTemplateCollections'))
|
||||
MenuItem('groupTemplateCollections', '将“模板”集合分组在一起', menu, True, self.options_manager.get('groupTemplateCollections'))
|
||||
layer_collections_toggle = MenuItem('showLayerCollectionsMenu', '显示图层集合菜单', menu, True, self.options_manager.get('showLayerCollectionsMenu'))
|
||||
layer_collections_toggle.triggered.connect(self.core.layer_manager.layer_collections.toggle_widget)
|
||||
MenuItem('importIntoANewCollection', '导入到新集合中', menu, True, self.options_manager.get('importIntoANewCollection'))
|
||||
menu.addSection('其他选项')
|
||||
with Menu('其他选项', menu) as other_options_menu:
|
||||
other_options_menu.addSection('更新功能')
|
||||
convert_to_new_layer_system = MenuItem('convertToNewLayerSystem', '转换为新图层系统', other_options_menu)
|
||||
convert_to_new_layer_system.triggered.connect(undo(self.core.utils.convert_to_new_layer_system))
|
||||
update_layers = MenuItem('updateLayers', '更新图层', other_options_menu)
|
||||
update_layers.triggered.connect(undo(self.core.layer_manager.delete_unused_layers))
|
||||
from gs_curvetools.main import reset as reset_gs_curvetools
|
||||
reset_to_defaults = MenuItem('resetToDefaults', '恢复默认设置', other_options_menu)
|
||||
reset_to_defaults.triggered.connect(reset_gs_curvetools)
|
||||
other_options_menu.addSection('修复')
|
||||
maya_2020_uv_fix = MenuItem('maya2020UVFix', '修复Maya 2020 - 2022 UV错误', other_options_menu)
|
||||
maya_2020_uv_fix.triggered.connect(undo(self.core.fixes.fix_maya_2020_uvs))
|
||||
fix_broken_graphs = MenuItem('mayaFixBrokenGraphs', '修复损坏的图表', other_options_menu)
|
||||
fix_broken_graphs.triggered.connect(undo(self.core.fixes.fix_broken_graphs))
|
||||
convert_bezier_to_nurbs = MenuItem('convertBezierToNurbs', '将所选贝塞尔曲线转换为NURBS曲线', other_options_menu)
|
||||
convert_bezier_to_nurbs.triggered.connect(undo(self.core.fixes.convert_bezier_to_nurbs))
|
||||
maya_2020_twist_fix = MenuItem('maya2020TwistAttribute', '修复Maya 2020.4扭曲属性', other_options_menu)
|
||||
maya_2020_twist_fix.triggered.connect(undo(self.core.fixes.fix_maya_2020_twist))
|
||||
maya_2020_unbind_fix = MenuItem('maya2020UnbindFix', '修复Maya 2020.4解绑功能', other_options_menu)
|
||||
maya_2020_unbind_fix.triggered.connect(undo(self.core.fixes.fix_maya_2020_unbind))
|
||||
delete_all_animation_keys = MenuItem('deleteAllAnimationKeys', '删除所有动画关键帧', other_options_menu)
|
||||
delete_all_animation_keys.triggered.connect(undo(self.core.fixes.delete_keys_on_all_objects))
|
||||
disable_curve_smooth = MenuItem('disableCurveSmooth', '重置旧版曲线平滑属性', other_options_menu)
|
||||
disable_curve_smooth.triggered.connect(self.core.fixes.reset_curve_smooth)
|
||||
reset_legacy_magnitude = MenuItem('resetLegacyMagnitude', '重置旧版轮廓幅度属性', other_options_menu)
|
||||
reset_legacy_magnitude.triggered.connect(self.core.fixes.reset_legacy_profile_magnitude)
|
||||
with Menu('帮助', menu_bar) as menu:
|
||||
open_log_file = MenuItem('openLogFile', '打开日志文件', menu)
|
||||
open_log_file.triggered.connect(logger.open_log_file)
|
||||
open_online_documentation = MenuItem('openOnlineDocumentation', '打开在线文档', menu)
|
||||
open_online_documentation.triggered.connect(lambda: open_link(USER_DOCS))
|
||||
useful_links = MenuItem('usefulLinks', '有用的链接和联系方式', menu)
|
||||
useful_links.triggered.connect(self.about_window.social_window)
|
||||
with Menu('关于', menu_bar) as menu:
|
||||
about_action = MenuItem('gsAbout', '关于', menu)
|
||||
about_action.triggered.connect(self.about_window.about_window)
|
||||
menu.addSeparator()
|
||||
menu.addAction('Made by George Sladkovsky (%s)' % YEAR).setEnabled(False)
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout) as row:
|
||||
extrude_warp_switch_group = QtWidgets.QButtonGroup(scroll_layout.widget())
|
||||
self.widget_manager.add('gsExtrudeWarpSwitchGroup', extrude_warp_switch_group)
|
||||
extrude_warp_switch_group.buttonToggled.connect(self.extrude_warp_toggle)
|
||||
extrude_warp_switch_group.buttonClicked.connect(self.options_manager.save)
|
||||
warp_switch = Button(row.layout(), 'warpSwitch')
|
||||
warp_switch.set_label('变形', line_height=100)
|
||||
warp_switch.set_button_style('small')
|
||||
warp_switch.setCheckable(True)
|
||||
extrude_switch = Button(row.layout(), 'extrudeSwitch')
|
||||
extrude_switch.set_label('挤压', line_height=100)
|
||||
extrude_switch.set_button_style('small')
|
||||
extrude_switch.setCheckable(True)
|
||||
extrude_warp_switch_group.addButton(warp_switch, 0)
|
||||
extrude_warp_switch_group.addButton(extrude_switch, 1)
|
||||
with Row(scroll_layout) as row:
|
||||
new_card = Button(row.layout(), 'newCard')
|
||||
new_card.set_label('新面片')
|
||||
new_card.clicked.connect(partial(undo(self.core.create.new), 0))
|
||||
new_tube = Button(row.layout(), 'newTube')
|
||||
new_tube.set_label('新管')
|
||||
new_tube.clicked.connect(partial(undo(self.core.create.new), 1))
|
||||
with Row(scroll_layout) as row:
|
||||
curve_card = Button(row.layout(), 'curveCard')
|
||||
curve_card.set_label('曲线面片')
|
||||
curve_card.clicked.connect(partial(undo(self.core.create.from_curves), 0))
|
||||
curve_tube = Button(row.layout(), 'curveTube')
|
||||
curve_tube.set_label('曲线管')
|
||||
curve_tube.clicked.connect(partial(undo(self.core.create.from_curves), 1))
|
||||
with Row(scroll_layout) as row:
|
||||
bind = Button(row.layout(), 'gsBind')
|
||||
bind.set_label('绑定')
|
||||
bind.set_icon('mod-top')
|
||||
bind.clicked.connect(undo(self.core.create.bind))
|
||||
unbind = Button(row.layout(), 'gsUnbind')
|
||||
unbind.set_label('解绑')
|
||||
unbind.set_icon('mod-top')
|
||||
unbind.clicked.connect(undo(lambda: self.core.create.unpack() if get_mod() == 'Shift' else self.core.create.unbind()))
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout) as row:
|
||||
add_cards = Button(row.layout(), 'addCards')
|
||||
add_cards.set_label('添加面片')
|
||||
add_cards.set_icon('mod-top')
|
||||
add_cards.clicked.connect(partial(undo(self.core.create.add_between), 0))
|
||||
add_tubes = Button(row.layout(), 'addTubes')
|
||||
add_tubes.set_label('添加管')
|
||||
add_tubes.set_icon('mod-top')
|
||||
add_tubes.clicked.connect(partial(undo(self.core.create.add_between), 1))
|
||||
with Row(scroll_layout) as row:
|
||||
fill = Button(row.layout(), 'gsFill')
|
||||
fill.set_label('填充')
|
||||
fill.set_icon('mod-top')
|
||||
fill.clicked.connect(undo(self.core.create.fill))
|
||||
subdivide = Button(row.layout(), 'gsSubdivide')
|
||||
subdivide.set_label('细分')
|
||||
subdivide.set_icon('mod-top')
|
||||
subdivide.clicked.connect(undo(self.core.functions.subdivide_curve))
|
||||
with Row(scroll_layout) as row:
|
||||
m_add_cards_slider = mc.intSliderGrp('gsCurvesSlider', l='添加', f=1, adj=3, cw=[(1, 20), (2, 25), (3, 1)], min=1, max=10, v=3)
|
||||
add_cards_slider = maya_slider(m_add_cards_slider, layout=row.layout())
|
||||
self.widget_manager.add('gsCurvesSlider', add_cards_slider)
|
||||
add_cards_slider.setContentsMargins(0, 0, 0, 0)
|
||||
c = add_cards_slider.children()[2]
|
||||
if isinstance(c, QWidget):
|
||||
c.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout) as row:
|
||||
edge_to_curve = Button(row.layout(), 'gsEdgeToCurve')
|
||||
edge_to_curve.set_label('边转曲线')
|
||||
edge_to_curve.set_icon('mod-top')
|
||||
edge_to_curve.clicked.connect(undo(self.core.conversion.edge_to_curve))
|
||||
geo_to_curve = Button(row.layout(), 'gsGeoToCurve')
|
||||
geo_to_curve.set_label('几何体转曲线')
|
||||
geo_to_curve.clicked.connect(self.geo_to_curve_window.open_ui)
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout, obj_name='LayerCollectionsLayout', spacing=1) as layer_collections_layout:
|
||||
layer_combo_box = LayerCollectionWidget('layerCollectionsComboBox')
|
||||
layer_combo_box.setStyleSheet(style.SMALL_COMBO_BOX)
|
||||
|
||||
def collection_changed():
|
||||
self.core.updates.update_visibility_based_on_active_collection()
|
||||
self.core.updates.update_main_ui()
|
||||
layer_combo_box.currentIndexChanged.connect(lambda *_: deferred(collection_changed)())
|
||||
layer_combo_box.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||
layer_combo_box.setDuplicatesEnabled(False)
|
||||
layer_combo_box.setMinimumWidth(0)
|
||||
layer_combo_box.setFixedHeight(style.scale(16))
|
||||
mc.popupMenu(mm=1, p=layer_combo_box.objectName())
|
||||
mc.menuItem(rp='N', l='清除', c=lambda *_: undo(self.core.layer_manager.layer_collections.clear)())
|
||||
mc.menuItem(rp='E', l='复制', c=lambda *_: no_undo(self.core.layer_manager.layer_collections.copy)())
|
||||
mc.menuItem(rp='NE', l='上移', c=lambda *_: no_undo(self.core.layer_manager.layer_collections.move_up)())
|
||||
mc.menuItem(rp='NW', l='合并上移', c=lambda *_: no_undo(self.core.layer_manager.layer_collections.merge_up)())
|
||||
mc.menuItem(rp='W', l='粘贴', c=lambda *_: undo(self.core.layer_manager.layer_collections.paste)())
|
||||
mc.menuItem(rp='SW', l='合并下移', c=lambda *_: no_undo(self.core.layer_manager.layer_collections.merge_down)())
|
||||
mc.menuItem(rp='SE', l='下移', c=lambda *_: no_undo(self.core.layer_manager.layer_collections.move_down)())
|
||||
mc.menuItem(rp='S', l='重命名', c=lambda *_: no_undo(self.core.layer_manager.layer_collections.rename)())
|
||||
with Row(layer_collections_layout.layout(), margins=style.scale([1, 0, 0, 0])) as plus_minus_buttons_layout:
|
||||
layer_combo_plus = Button(obj_name='layerCollectionsPlus', layout=plus_minus_buttons_layout.layout())
|
||||
layer_combo_plus.setFixedHeight(style.scale(16))
|
||||
layer_combo_plus.set_label('+', line_height=100)
|
||||
layer_combo_plus.setMinimumWidth(1)
|
||||
layer_combo_plus.set_button_style('small-filled')
|
||||
layer_combo_plus.clicked.connect(self.core.layer_manager.layer_collections.create)
|
||||
layer_combo_minus = Button(obj_name='layerCollectionsMinus', layout=plus_minus_buttons_layout.layout())
|
||||
layer_combo_minus.setEnabled(False)
|
||||
layer_combo_minus.setFixedHeight(style.scale(16))
|
||||
layer_combo_minus.setMinimumWidth(1)
|
||||
layer_combo_minus.set_label('-', line_height=100)
|
||||
layer_combo_minus.set_button_style('small-filled')
|
||||
layer_combo_minus.clicked.connect(undo(self.core.layer_manager.layer_collections.delete))
|
||||
lcl = layer_collections_layout.layout()
|
||||
if isinstance(lcl, QHBoxLayout):
|
||||
lcl.addWidget(layer_combo_box, 3)
|
||||
lcl.addWidget(plus_minus_buttons_layout, 1)
|
||||
layer_combo_box.insertItem(0, '主集合')
|
||||
with Row(scroll_layout) as row:
|
||||
all_filter = Button(row.layout(), 'gsAllFilter')
|
||||
all_filter.set_button_style('small-filled')
|
||||
all_filter.set_label('全部', line_height=100)
|
||||
all_filter.set_icon('mod-top')
|
||||
all_filter.clicked.connect(partial(undo(self.core.layer_manager.layers_filter_toggle), True, True))
|
||||
curve_filter = Button(row.layout(), 'gsCurveFilter')
|
||||
curve_filter.set_button_style('small-filled')
|
||||
curve_filter.set_label('曲线', line_height=100)
|
||||
curve_filter.clicked.connect(partial(undo(self.core.layer_manager.layers_filter_toggle), True, False, ignore=['Shift+Ctrl']))
|
||||
mc.popupMenu(mm=1, p=curve_filter.objectName())
|
||||
mc.menuItem(rp='N', l='切换始终置顶', c=lambda *_: undo(self.core.functions.always_on_top_toggle)())
|
||||
mc.menuItem(rp='S', l='在非活动集合上自动隐藏曲线', cb=self.options_manager.get('AutoHideCurvesOnInactiveCollections'), c=undo(self.core.layer_manager.collection_visibility_toggle))
|
||||
geo_filter = Button(row.layout(), 'gsGeoFilter')
|
||||
geo_filter.set_button_style('small-filled')
|
||||
geo_filter.set_label('几何体', line_height=100)
|
||||
geo_filter.clicked.connect(partial(undo(self.core.layer_manager.layers_filter_toggle), False, True, ignore=['Shift+Ctrl']))
|
||||
color_mode = Button(row.layout(), 'colorMode')
|
||||
color_mode.set_button_style('small-filled')
|
||||
color_mode.setCheckable(True)
|
||||
color_mode.setChecked(False)
|
||||
color_mode.set_label('颜色', line_height=100)
|
||||
color_mode.clicked.connect(undo(self.core.color_mode.toggle_color_vis))
|
||||
mc.popupMenu(mm=1, p=color_mode.objectName())
|
||||
mc.menuItem(rp='N', l='随机化颜色', c=lambda *_: undo(self.core.color_mode.randomize_colors)())
|
||||
mc.menuItem(rp='E', l='重置曲线颜色', c=lambda *_: self.core.color_mode.reset_curve_colors())
|
||||
mc.menuItem(rp='W', l='应用曲线颜色', c=lambda *_: self.core.color_mode.sync_curve_colors(True))
|
||||
mc.menuItem(rp='S', l='自定义颜色窗口', c=lambda *_: self.custom_layer_colors_window.window())
|
||||
with Layout(scroll_layout, obj_name='LayerLayout') as layer_layout:
|
||||
layer_button_grp = QtWidgets.QButtonGroup(layer_layout)
|
||||
layer_button_grp.setObjectName(get_unique_name('LayerGroup'))
|
||||
layer_button_grp.setExclusive(True)
|
||||
self.widget_manager.add('LayerGroup', layer_button_grp)
|
||||
with Row(layer_layout.layout(), 'layerRow0', spacing=0) as row:
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i, row.layout(), str(i)))
|
||||
with Row(layer_layout.layout(), 'layerRow1', spacing=0) as row:
|
||||
letter = ord('A')
|
||||
letters = [chr(i) for i in range(letter, letter + 10)]
|
||||
if self.widget_manager.get('layerNumbersOnly').isChecked():
|
||||
letters = list(range(10, 20))
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i + 10, row.layout(), str(letters[i])))
|
||||
with Row(layer_layout.layout(), 'layerRow2', spacing=0) as row:
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i + 20, row.layout(), str(i + 20)))
|
||||
self.widget_manager.get('layerRow2').setHidden(True)
|
||||
with Row(layer_layout.layout(), 'layerRow3', spacing=0) as row:
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i + 30, row.layout(), str(i + 30)))
|
||||
self.widget_manager.get('layerRow3').setHidden(True)
|
||||
with Row(layer_layout.layout(), 'layerRow4', spacing=0) as row:
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i + 40, row.layout(), str(i + 40)))
|
||||
self.widget_manager.get('layerRow4').setHidden(True)
|
||||
with Row(layer_layout.layout(), 'layerRow5', spacing=0) as row:
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i + 50, row.layout(), str(i + 50)))
|
||||
self.widget_manager.get('layerRow5').setHidden(True)
|
||||
with Row(layer_layout.layout(), 'layerRow6', spacing=0) as row:
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i + 60, row.layout(), str(i + 60)))
|
||||
self.widget_manager.get('layerRow6').setHidden(True)
|
||||
with Row(layer_layout.layout(), 'layerRow7', spacing=0) as row:
|
||||
for i in range(10):
|
||||
layer_button_grp.addButton(self.selection_sets(i + 70, row.layout(), str(i + 70)))
|
||||
self.widget_manager.get('layerRow7').setHidden(True)
|
||||
self.widget_manager.get('curveGrp0').setChecked(True)
|
||||
with Row(scroll_layout) as row:
|
||||
extract_selected = Button(row.layout(), 'gsExtractSelected')
|
||||
extract_selected.set_label('提取<br>所选')
|
||||
extract_selected.set_icon('mod-bottom')
|
||||
extract_selected.clicked.connect(undo(self.core.functions.extract_selected_curves))
|
||||
extract_all = Button(row.layout(), 'gsExtractAll')
|
||||
extract_all.set_label('提取<br>全部')
|
||||
extract_all.set_icon('mod-bottom')
|
||||
extract_all.clicked.connect(undo(self.core.functions.extract_all_curves))
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout) as row:
|
||||
select_curve = Button(row.layout(), 'gsSelectCurve')
|
||||
select_curve.set_label('选择<br>曲线')
|
||||
select_curve.clicked.connect(partial(undo(self.core.utils.select_part), 1))
|
||||
select_geo = Button(row.layout(), 'gsSelectGeo')
|
||||
select_geo.set_label('选择<br>几何体')
|
||||
select_geo.clicked.connect(partial(undo(self.core.utils.select_part), 2))
|
||||
select_group = Button(row.layout(), 'gsSelectGroup')
|
||||
select_group.set_label('选择<br>组')
|
||||
select_group.clicked.connect(partial(undo(self.core.utils.select_part), 0))
|
||||
with Row(scroll_layout) as row:
|
||||
group_curves = Button(row.layout(), 'gsGroupCurves')
|
||||
group_curves.set_label('分组<br>曲线')
|
||||
group_curves.clicked.connect(undo(self.core.functions.group_curves))
|
||||
regroup_by_layer = Button(row.layout(), 'gsRegroupByLayer')
|
||||
regroup_by_layer.set_label('按图层<br>重新分组')
|
||||
regroup_by_layer.clicked.connect(undo(self.core.functions.regroup_by_layer))
|
||||
group_name = LineEdit('gsGroupNameTextField', scroll_layout)
|
||||
group_name.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
group_name.set_auto_format(True)
|
||||
group_name.setClearButtonEnabled(True)
|
||||
group_name.setPlaceholderText('组名称')
|
||||
custom_layer_names_colors = Button(scroll_layout, 'gsCustomLayerNamesAndColors')
|
||||
custom_layer_names_colors.set_button_style('small-filled')
|
||||
custom_layer_names_colors.set_label('图层名称和颜色')
|
||||
custom_layer_names_colors.clicked.connect(self.custom_layer_colors_window.window)
|
||||
scroll_layout.addWidget(separator())
|
||||
scroll_layout.addWidget(wrap_control(mc.text(l='选择控制点')))
|
||||
slider_widget = wrap_control(mc.floatSliderGrp('gsSelectCVSlider', w=1, min=0, max=1, step=0.05, dc=self.core.sliders.select_cv_slider, cc=self.core.sliders.release))
|
||||
self.widget_manager.add('gsSelectCVSlider', slider_widget)
|
||||
scroll_layout.addWidget(slider_widget)
|
||||
with Row(scroll_layout) as row:
|
||||
transfer_attributes = Button(row.layout(), 'gsTransferAttributes')
|
||||
transfer_attributes.set_label('转移<br>属性.')
|
||||
|
||||
transfer_attributes.set_icon('mod-bottom')
|
||||
transfer_attributes.clicked.connect(undo(self.core.attributes.transfer_attributes))
|
||||
mc.popupMenu(mm=1, p=transfer_attributes.objectName())
|
||||
mc.menuItem('gsCopyAttributes', rp='N', l='复制属性', aob=1, c=lambda _: self.core.attributes.copy_attributes())
|
||||
mc.menuItem(ob=1, c=lambda _: self.attributes_filter_window.open_ui())
|
||||
mc.menuItem('gsPasteAttributes', rp='S', l='粘贴属性', aob=1, c=lambda _: self.core.attributes.paste_attributes())
|
||||
mc.menuItem(ob=1, c=lambda _: self.attributes_filter_window.open_ui())
|
||||
transfer_uvs = Button(row.layout(), 'gsTransferUVs')
|
||||
transfer_uvs.set_label('转移\nUV')
|
||||
transfer_uvs.set_icon('mod-bottom')
|
||||
transfer_uvs.clicked.connect(undo(self.core.attributes.transfer_uvs))
|
||||
mc.popupMenu(mm=1, p=transfer_uvs.objectName())
|
||||
mc.menuItem('gsCopyUVs', aob=1, rp='N', l='复制UV', c=lambda _: self.core.attributes.copy_uvs())
|
||||
mc.menuItem(ob=1, c=lambda _: self.attributes_filter_window.open_ui())
|
||||
mc.menuItem('gsPasteUVs', aob=1, rp='S', l='粘贴UV', c=lambda _: self.core.attributes.paste_uvs())
|
||||
mc.menuItem(ob=1, c=lambda _: self.attributes_filter_window.open_ui())
|
||||
reset_pivot = Button(row.layout(), 'gsResetPivot')
|
||||
reset_pivot.set_label('重置\n轴心点')
|
||||
reset_pivot.clicked.connect(undo(self.core.functions.reset_curve_pivot_point))
|
||||
reset_pivot.set_icon('mod-bottom')
|
||||
mc.popupMenu(mm=1, p=reset_pivot.objectName())
|
||||
mc.menuItem('gsResetPivotToRoot', rp='N', l='重置到根部', c=lambda _: self.core.functions.reset_curve_pivot_point())
|
||||
mc.menuItem('gsResetPivotToTip', rp='S', l='重置到尖端', c=lambda _: self.core.functions.reset_curve_pivot_point(2))
|
||||
scroll_layout.addWidget(separator())
|
||||
|
||||
def rebuild_slider_release():
|
||||
self.core.sliders.rebuild_slider_release()
|
||||
self.core.sliders.release()
|
||||
|
||||
def rebuild_button_clicked():
|
||||
self.core.sliders.rebuild_slider_drag()
|
||||
rebuild_slider_release()
|
||||
with Row(scroll_layout, margins=style.scale([1.5, 0, 1.5, 0])) as rebuild_reset_row:
|
||||
rebuild_button = Button(obj_name='gsRebuildWithCurrentValue')
|
||||
rebuild_button.set_button_style('small-filled')
|
||||
rebuild_button.set_label('R', line_height=100)
|
||||
rebuild_button.setMinimumWidth(1)
|
||||
rebuild_button.setMaximumSize(*style.scale([16, 16]))
|
||||
rebuild_button.clicked.connect(rebuild_button_clicked)
|
||||
reset_button = Button(obj_name='gsResetRebuildSliderRange')
|
||||
reset_button.set_button_style('small-filled')
|
||||
reset_button.set_icon('reset')
|
||||
reset_button.setMinimumWidth(1)
|
||||
reset_button.setMaximumSize(*style.scale([16, 16]))
|
||||
reset_button.clicked.connect(lambda: mc.intSliderGrp('gsRebuildSlider', e=1, min=1, max=50))
|
||||
rrr = rebuild_reset_row.layout()
|
||||
if isinstance(rrr, QHBoxLayout):
|
||||
rrr.addWidget(rebuild_button, 1)
|
||||
rrr.addWidget(wrap_control(mc.text(l='重建曲线')), 3)
|
||||
rrr.addWidget(reset_button, 1)
|
||||
rebuild_curve_slider = wrap_control(mc.intSliderGrp('gsRebuildSlider', f=1, cw=[(1, 32), (2, 28)], min=1, max=50, fmx=999, v=1, dc=self.core.sliders.rebuild_slider_drag, cc=lambda *_: rebuild_slider_release()))
|
||||
self.widget_manager.add('gsRebuildSlider', rebuild_curve_slider)
|
||||
scroll_layout.addWidget(rebuild_curve_slider)
|
||||
with Row(scroll_layout) as row:
|
||||
duplicate_curve = Button(row.layout(), 'gsDuplicateCurve')
|
||||
duplicate_curve.set_label('复制')
|
||||
duplicate_curve.clicked.connect(undo(self.core.functions.duplicate_curve))
|
||||
randomize_curve = Button(row.layout(), 'gsRandomizeCurve')
|
||||
randomize_curve.set_label('随机化')
|
||||
randomize_curve.clicked.connect(self.randomize_curve_window.open_ui)
|
||||
with Row(scroll_layout) as row:
|
||||
extend_curve = Button(row.layout(), 'gsExtendCurve')
|
||||
extend_curve.set_label('延伸')
|
||||
extend_curve.clicked.connect(undo(self.core.functions.extend_curve))
|
||||
reduce_curve = Button(row.layout(), 'gsReduceCurve')
|
||||
reduce_curve.set_label('缩减')
|
||||
reduce_curve.clicked.connect(undo(self.core.functions.reduce_curve))
|
||||
with Row(scroll_layout) as row:
|
||||
smooth = Button(row.layout(), 'gsSmooth')
|
||||
smooth.set_label('平滑')
|
||||
smooth.clicked.connect(undo(self.core.functions.smooth_curve))
|
||||
smooth.set_icon('marking-top')
|
||||
mc.popupMenu(mm=1, p=smooth.objectName())
|
||||
mc.radioMenuItemCollection()
|
||||
mc.menuItem('gsSmoothMult1', rp='N', rb=1, l='x1')
|
||||
mc.menuItem('gsSmoothMult3', rp='E', rb=0, l='x3')
|
||||
mc.menuItem('gsSmoothMult5', rp='S', rb=0, l='x5')
|
||||
mc.menuItem('gsSmoothMult10', rp='W', rb=0, l='x10')
|
||||
factor_slider = wrap_control(mc.floatSliderGrp('gsFactorSlider', l='因子', adj=3, w=1, cw=[(1, 32), (2, 28)], min=1, max=100))
|
||||
self.widget_manager.add('gsFactorSlider', factor_slider)
|
||||
scroll_layout.addWidget(factor_slider)
|
||||
scroll_layout.addWidget(separator())
|
||||
with Frame(scroll_layout, obj_name='MirrorFrame', label='镜像', margins=[1, 1, 1, 1]) as frame:
|
||||
with Row(frame.get_frame_layout()) as row:
|
||||
mirror_x = Button(row.layout(), 'mirrorX')
|
||||
mirror_x.set_label('X')
|
||||
mirror_x.set_font_size(16)
|
||||
mirror_x.clicked.connect(partial(undo(self.core.functions.mirror_hair), 0))
|
||||
mirror_y = Button(row.layout(), 'mirrorY')
|
||||
mirror_y.set_label('Y')
|
||||
mirror_y.set_font_size(16)
|
||||
mirror_y.clicked.connect(partial(undo(self.core.functions.mirror_hair), 1))
|
||||
mirror_z = Button(row.layout(), 'mirrorZ')
|
||||
mirror_z.set_label('Z')
|
||||
mirror_z.set_font_size(16)
|
||||
mirror_z.clicked.connect(partial(undo(self.core.functions.mirror_hair), 2))
|
||||
with Row(frame.get_frame_layout()) as row:
|
||||
mirror_flip_grp = QtWidgets.QButtonGroup(row)
|
||||
mirror = Button(row.layout(), 'mirrorRadio')
|
||||
mirror.set_label('镜像')
|
||||
mirror.set_button_style('small')
|
||||
mirror.setCheckable(True)
|
||||
mirror.setChecked(True)
|
||||
flip = Button(row.layout(), 'flipRadio')
|
||||
flip.set_label('翻转')
|
||||
flip.set_button_style('small')
|
||||
flip.setCheckable(True)
|
||||
mirror_flip_grp.addButton(mirror)
|
||||
mirror_flip_grp.addButton(flip)
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout) as row:
|
||||
control_curve = Button(row.layout(), 'gsControlCurve')
|
||||
control_curve.set_label('控制曲线')
|
||||
control_curve.clicked.connect(undo(self.core.functions.control_curve_create))
|
||||
apply_control_curve = Button(row.layout(), 'gsApplyControlCurve')
|
||||
apply_control_curve.set_label('应用')
|
||||
apply_control_curve.setFixedWidth(style.scale(48))
|
||||
apply_control_curve.clicked.connect(undo(self.core.functions.control_curve_apply))
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout) as row:
|
||||
curve_control_window = Button(row.layout(), 'gsCurveControlWindow')
|
||||
curve_control_window.set_label('曲线控制窗口')
|
||||
curve_control_window.pressed.connect(self.curve_control_window.open_ui)
|
||||
scroll_layout.addWidget(separator())
|
||||
with Row(scroll_layout) as row:
|
||||
uv_editor = Button(row.layout(), 'gsUVEditorMain')
|
||||
uv_editor.set_label('UV编辑器窗口')
|
||||
uv_editor.pressed.connect(self.uv_editor.open_ui)
|
||||
scroll_layout.addWidget(separator())
|
||||
scroll_layout.addWidget(wrap_control(mc.text(l=VERSION)))
|
||||
warp_switch.setChecked(self.options_manager.get('warpSwitch'))
|
||||
extrude_switch.setChecked(not self.options_manager.get('warpSwitch'))
|
||||
self.core.layer_manager.layer_collections.toggle_widget()
|
||||
self.tooltips.toggle_custom_tooltips_main(self.options_manager.get('enableTooltips'))
|
||||
|
||||
def selection_sets(self, i, layout, label):
|
||||
def toggle_geometry_edit(*_):
|
||||
self.core.layer_manager.curve_geometry_edit_toggle(i)
|
||||
self.core.updates.update_main_ui()
|
||||
|
||||
def toggle_curve_visibility(*_):
|
||||
self.core.layer_manager.toggle_obj_visibility(i, 0)
|
||||
self.core.updates.update_main_ui()
|
||||
|
||||
def toggle_geo_visibility(*_):
|
||||
self.core.layer_manager.toggle_obj_visibility(i, 1)
|
||||
self.core.updates.update_main_ui()
|
||||
|
||||
def toggle_layer_visibility(*_):
|
||||
self.core.layer_manager.toggle_layer_visibility(i)
|
||||
self.core.updates.update_main_ui()
|
||||
sel_set = Layer(layout=layout, obj_name='curveGrp%s' % i)
|
||||
sel_set.setStyleSheet(style.layer())
|
||||
sel_set.set_label(str(label))
|
||||
mc.popupMenu(mm=1, p=sel_set.objectName())
|
||||
mc.menuItem(rp='N', l='将所选内容添加到图层', c=lambda _: self.core.layer_manager.curve_add_to_layer(i))
|
||||
mc.menuItem(rp='NW', l='提取几何体', c=lambda _: self.core.functions.extract_curve_geo(i))
|
||||
mc.menuItem(rp='NE', l='切换几何体编辑', c=toggle_geometry_edit)
|
||||
mc.menuItem(rp='W', l='选择曲线', c=lambda _: self.core.layer_manager.curve_layer_select_obj(i, 0))
|
||||
mc.menuItem(rp='E', l='选择几何体', c=lambda _: self.core.layer_manager.curve_layer_select_obj(i, 1))
|
||||
mc.menuItem(rp='SW', l='切换曲线可见性', c=toggle_curve_visibility)
|
||||
mc.menuItem(rp='SE', l='切换几何体可见性', c=toggle_geo_visibility)
|
||||
mc.menuItem(rp='S', l='切换图层可见性', c=toggle_layer_visibility)
|
||||
sel_set.clicked.connect(partial(undo(self.core.layer_manager.layer_clicked), i))
|
||||
return sel_set
|
||||
|
||||
def extrude_warp_toggle(self):
|
||||
"""Toggle the extrude/warp switch"""
|
||||
buttons = ['newCard', 'newTube', 'curveCard', 'curveTube', 'addCards', 'addTubes']
|
||||
button_style = style.BUTTON_NORMAL
|
||||
if self.widget_manager.get('extrudeSwitch').isChecked():
|
||||
button_style = style.BUTTON_NORMAL_BLUE_BORDER
|
||||
for button in buttons:
|
||||
self.widget_manager.get(button).setStyleSheet(button_style)
|
||||
|
||||
def update_layer_list(self):
|
||||
"""Update the layer list"""
|
||||
if self.widget_manager.exists('gsLayerSelector'):
|
||||
self.widget_manager.get('gsLayerSelector').updateLayerList()
|
||||
self.core.curve_control.update_ui()
|
||||
|
||||
def toggle_tooltips(self):
|
||||
"""Toggle the custom tooltips"""
|
||||
for widget in self.widget_manager.get_widgets():
|
||||
if hasattr(widget, 'enable_tooltip') and callable(getattr(widget, 'enable_tooltip')):
|
||||
widget.enable_tooltip(self.options_manager.get('enableTooltips'))
|
||||
self.tooltips.toggle_custom_tooltips_main(self.options_manager.get('enableTooltips'))
|
||||
self.tooltips.toggle_custom_tooltips_curve_control(self.options_manager.get('enableTooltips'))
|
||||
self.tooltips.toggle_custom_tooltips_scale_factor(self.options_manager.get('enableTooltips'))
|
||||
@@ -1,967 +0,0 @@
|
||||
<!--
|
||||
Tooltips are added in format:
|
||||
# Widget
|
||||
Tooltip
|
||||
-->
|
||||
|
||||
<!-- main.py -->
|
||||
|
||||
<!-- Options Menu -->
|
||||
# importCurves
|
||||
Imports Curves that were Exported using the Export Button.
|
||||
NOTE: Only import files that were exported using Export Curves button.
|
||||
WARNING: This operation is NOT undoable!
|
||||
|
||||
# exportCurves
|
||||
Exports selected curves into a .curves (or .ma) file. Can then be Imported using Import Curves.
|
||||
|
||||
# changeScaleFactor
|
||||
Opens a window that controls the Scale Factor and Precision Scale.
|
||||
***
|
||||
Scale factor determines the initial size of the created curve and adjusts other parameters.
|
||||
Scale factor is stored in a global preset, in the scene and on each curve.
|
||||
Priority of scale factors Curve>Scene>Global.
|
||||
Setting the appropriate scale factor before starting a project can help to have a good initial Width and size of the cards.
|
||||
***
|
||||
Precision Scale controls the world scale of the curve without changing the curve appearance, CV positions and other parameters.
|
||||
Lowering the Precision scale (from 1.0 to 0.05 for example) helps to fix the geometry deformation on very small curves.
|
||||
The default value of 0.05 should be sufficient for most cases. Values lower than 0.01 can affect performance.
|
||||
***
|
||||
Normalize Selected and Normalize Selected to Default will change the Scale Factor and Precision Scale of the selected curves, without changing their appearance or CV positions.
|
||||
Normalize Selected to Default will reset the slider values to default (0.5 and 0.05) and Normalize Selected will use the current slider values.
|
||||
|
||||
# normalizeSelectedButton
|
||||
Normalize selected curves to the chosen slider values.
|
||||
Normalization will not change the CV positions or geometry appearance, but the selected objects will have new Scale Factor and Precision Scale applied.
|
||||
|
||||
# normalizeSelectedToDefaultButton
|
||||
Normalize selected curves to the default slider values (0.5, 0.05).
|
||||
Resets the slider values to the default.
|
||||
Normalization will not change the CV positions or geometry appearance, but the selected objects will have new Scale Factor and Precision Scale applied.
|
||||
|
||||
# saveScaleFactorAndPrecisionScaleButton
|
||||
Saves the selected slider values to the global storage and to the current scene.
|
||||
New scenes will automatically have these Scale Factor and Precision Scale values.
|
||||
NOTE: This will not apply the new values to already existing objects. See Normalize buttons.
|
||||
|
||||
# saveScaleFactorAndPrecisionScaleButtonAndClose
|
||||
Saves the selected slider values to the global storage and to the current scene.
|
||||
New scenes will automatically have these Scale Factor and Precision Scale values.
|
||||
Closes the window after save.
|
||||
NOTE: This will not apply the new values to already existing objects. See Normalize buttons.
|
||||
|
||||
# closePrecisionScaleWindow
|
||||
Close this window without save
|
||||
|
||||
# globalCurveThickness
|
||||
Opens a window that controls the thickness of the curves in the scene as well as the global curve thickness preset across the scenes.
|
||||
|
||||
# setAOSettings
|
||||
Manually sets the recommended AO settings for older Maya versions.
|
||||
These AO settings are needed to use the "See Through" or "Toggle Always on Top" functions.
|
||||
Are applied automatically by those functions.
|
||||
|
||||
# setTransparencySettings
|
||||
Sets recommended transparency settings for Maya viewport.
|
||||
***
|
||||
Simple Transparency is fast but very inaccurate render mode. Only suitable for simple, one layer hair.
|
||||
Object Sorting Transparency has average performance impact and quality. Can have issues on complex multi-layered grooms.
|
||||
Depth Transparency - these are the optimal settings for the highest quality of the hair cards preview. Can have performance impact on slower systems.
|
||||
|
||||
# convertToWarpCard
|
||||
Converts selection to Warp Cards.
|
||||
Compatible attributes are retained.
|
||||
|
||||
# convertToWarpTube
|
||||
Converts selection to Warp Tubes.
|
||||
Compatible attributes are retained.
|
||||
|
||||
# convertToExtrudeCard
|
||||
Converts selection to Extrude Cards.
|
||||
Compatible attributes are retained.
|
||||
|
||||
# convertToExtrudeTube
|
||||
Converts selection to Extrude Tubes.
|
||||
Compatible attributes are retained.
|
||||
|
||||
# duplicateUnparentCurves
|
||||
Duplicates selected NURBS curves and unparents them (parents them to the world).
|
||||
Original curves are not deleted.
|
||||
Can be used to easily extract and export curves from GS CurveTools objects.
|
||||
|
||||
# syncCurveColor
|
||||
Toggles the syncing of the curve color to the layer color.
|
||||
|
||||
# colorizedRegroup
|
||||
Toggles the colorization of the regrouped layers when Regroup by Layer function is used.
|
||||
|
||||
# colorOnlyDiffuse
|
||||
Colorize only the diffuse component of the card material.
|
||||
Alpha will stay the same.
|
||||
|
||||
# checkerPattern
|
||||
Toggles the use of the checker pattern when the Color mode is enabled.
|
||||
|
||||
# ignoreLastLayer
|
||||
Toggles the filtering (All, Curve, Geo) and Extraction (Extract All) of the last layer. If enabled, the last layer is ignored.
|
||||
NOTE: Last layer is typically used for templates, so it is ignored by default.
|
||||
|
||||
# ignoreTemplateCollections
|
||||
Ignores the filtering (All, Curve, Geo) and Extraction (Extract All) of all the collections that have "template" in their name. Case insensitive.
|
||||
|
||||
# groupTemplateCollections
|
||||
Collections that have "template" in their name (case insensitive) will be grouped together into "CT_Templates" group by Regroup By Layer function.
|
||||
|
||||
# syncOutlinerLayerVis
|
||||
Syncs the outliner and layer visibility. If enabled, hiding the layer will also hide the curve groups in the outliner.
|
||||
|
||||
# keepCurveAttributes
|
||||
If enabled, the attributes that are stored in the curve will be restored if the curve that was duplicated (on its own, without the geo) is used to create other cards or tubes.
|
||||
If disabled, the attributes will be ignored and reset.
|
||||
Example:
|
||||
1. Create a card and change its twist value.
|
||||
2. Ctrl+D and Shift+P the curve (not the curve group).
|
||||
3. Click Curve Card and the twist value will be restored on a newly created card.
|
||||
|
||||
# boundCurvesFollowParent
|
||||
Will ensure that moving a parent curve in a Bound Object (Bound Group) will also move all the child curves along with it to a new layer. Recommended to keep this enabled.
|
||||
|
||||
# massBindOption
|
||||
Will bind selected hair clump (or geometry) to all selected "empty" curves.
|
||||
|
||||
# bindDuplicatesCurves
|
||||
Will automatically duplicate the curves before binding them to the curve, leaving old curves behind with no edits.
|
||||
|
||||
# bindFlipUVs
|
||||
Enabling this option will flip the UVs of the original cards before binding them to the curve.
|
||||
This option will also flip the UVs back when using Unbind for better workflow.
|
||||
Disabling this option will result in an old Bind/Unbind behaviour.
|
||||
|
||||
# unpackDeleteOriginalObject
|
||||
Unpack (Shift + Click on Unbind) will delete the original Bind object.
|
||||
|
||||
# unpackCVMatch
|
||||
Unpack (Shift + Click on Unbind) will match the CVs of the original Bind object.
|
||||
|
||||
# addBetweenBlendAttributes
|
||||
Enables blending of the attributes when using Add Cards/Tubes or Fill functions.
|
||||
|
||||
# fillCreateCurvesOnly
|
||||
When enabled Fill function will only create curves (not the geo).
|
||||
|
||||
# convertInstances
|
||||
Will automatically convert instanced curves to normal curves before any other function is applied.
|
||||
|
||||
# replacingCurveLayerSelection
|
||||
Will disable additive selection for the layers. When holding Ctrl and clicking on a new layer, old layer will be deselected automatically.
|
||||
|
||||
# useAutoRefineOnNewCurves
|
||||
Automatically enables auto-refine on the new curves.
|
||||
|
||||
# flipUVsAfterMirror
|
||||
Enabling this option will flip the UVs horizontally after mirroring the cards to achieve exact mirroring.
|
||||
|
||||
# enableTooltips
|
||||
Will toggle the visibility of these tooltips you are reading right now.
|
||||
|
||||
# showLayerCollectionsMenu
|
||||
Shows layer collections menu widget.
|
||||
|
||||
# importIntoANewCollection
|
||||
If enabled, all the imported curves will be placed into a new "Imported Curves" layer collection.
|
||||
If disabled, all the imported curves will be placed into the "Main" layer collection
|
||||
|
||||
# layerNumbersOnly
|
||||
Layers will use only numbers if enabled.
|
||||
|
||||
# convertToNewLayerSystem
|
||||
Converts all the layers in the scene to a new layer system that is hidden from the Channel Box Display Layers window.
|
||||
Layers can still be accessed from Window->Relationship Editors->Display Layer window.
|
||||
|
||||
# updateLayers
|
||||
Utility function that will manually update all layers. Used for if layers are correct for some reason.
|
||||
|
||||
# resetToDefaults
|
||||
Resets every option and the GS CurveTools to the default "factory" state.
|
||||
|
||||
# maya2020UVFix
|
||||
This function will fix any broken UVs when trying to open old scenes in Maya 2020 or 2022 or when opening scenes in 2020 and 2022 when using Maya Binary file type. This will have no effect on older versions of Maya (<2020). This bug is native to Maya and thus can’t be fixed in GS CurveTools plug-in.
|
||||
|
||||
# mayaFixBrokenGraphs
|
||||
This function will attempt to fix all the broken graphs in the scene.
|
||||
Use if one of the graphs (Width, Twist or Profile) is in a broken state.
|
||||
|
||||
# convertBezierToNurbs
|
||||
Converts the selected Bezier curves to NURBS curves.
|
||||
Bezier curves are not supported by the GS CurveTools.
|
||||
|
||||
# maya2020TwistAttribute
|
||||
This function will fix any broken cards created in Maya 2020.4 before v1.2.2 update.
|
||||
|
||||
# maya2020UnbindFix
|
||||
This function will fix any cards that are not unbinding properly and were created before v1.2.3 update in Maya 2020.4.
|
||||
|
||||
# deleteAllAnimationKeys
|
||||
This function will delete all the animation keys on all the curves present in the scene.
|
||||
This can fix deformation issues when using duplicate or other GS CurveTools functions.
|
||||
Some functions (like duplicate) will delete the keys automatically, however the keys can still cause issues.
|
||||
|
||||
<!-- Main Buttons -->
|
||||
|
||||
# warpSwitch
|
||||
Advanced cards and tubes suitable for longer hair.
|
||||
Additional options and controls.
|
||||
Slower than Extrude (viewport performance).
|
||||
Can have issues on very small scales.
|
||||
|
||||
# extrudeSwitch
|
||||
Simple cards and tubes suitable for shorter hair and brows.
|
||||
Has limited controls.
|
||||
Much faster than Warp (viewport performance).
|
||||
Better for small scales.
|
||||
|
||||
# newCard
|
||||
Creates a new Card in the middle of the world. Used at the beginning of the project to create templates.
|
||||
|
||||
# newTube
|
||||
Creates a new Tube in the middle of the world. Used at the beginning of the project to create templates.
|
||||
|
||||
# curveCard
|
||||
Converts selected Maya curve to CurveTools Card.
|
||||
|
||||
# curveTube
|
||||
Converts selected Maya curve to CurveTools Tube.
|
||||
|
||||
# gsBind
|
||||
Binds selection to a single curve. Creates a Bind Group. Selection options:
|
||||
1. Single "empty" curve (default Maya curve) and single combined geometry.
|
||||
2. Single "empty" curve (default Maya curve) and any number of Curve Cards and Curve Tubes.
|
||||
***
|
||||
Shift + Click will duplicate the original curves/geo before binding it to the empty curve.
|
||||
Same option is available in the Options menu (Duplicate Curves Before Bind).
|
||||
|
||||
# gsUnbind
|
||||
Normal Click:
|
||||
UnBinds geometry or Cards/Tubes from selected Bound object.
|
||||
Geometry and Cards/Tubes will be placed at the origin.
|
||||
***
|
||||
Shift + Click:
|
||||
Will UNPACK the selected Bind object in-place.
|
||||
Unpack will attempt to create an in-place approximation of the cards and tubes that Bind object consists of.
|
||||
Basically it will extract the geometry and create cards (or tubes) based on that geometry.
|
||||
The original Bind object will be deleted in the process. Optionally, you can keep it (toggle in the options menu).
|
||||
This operation is not procedural, so you will not be able to return back to the Bind object after (unlike regular UnBind).
|
||||
WARNING: Unpack is not a 1 to 1 conversion. It will try its best to approximate the shape, but complex twists and bends will not be captured.
|
||||
|
||||
# addCards
|
||||
Creates Cards in-between selected Cards based on the Add slider value.
|
||||
Shift + Click: creates objects but does not blend the attributes.
|
||||
Bound objects are NOT supported.
|
||||
|
||||
NOTE: Selection order defines the direction of added Cards if more than 2 initial Cards are selected.
|
||||
|
||||
# addTubes
|
||||
Creates Tubes in-between selected Tubes based on the Add slider value.
|
||||
Shift + Click: creates objects but does not blend the attributes.
|
||||
Bound objects are NOT supported.
|
||||
|
||||
NOTE: Selection order defines the direction of added Tubes if more than 2 initial Tubes are selected.
|
||||
|
||||
# gsFill
|
||||
Creates Cards/Tubes or Bound Groups in between selected Cards/Tubes or Bound Groups based on the Add slider value.
|
||||
Shift + Click: creates objects but does not blend the attributes.
|
||||
|
||||
NOTE 1: Selection order defines the direction of added curves if more than 2 initial curves are selected.
|
||||
NOTE 2: The type of Card or Tube or Bound Group is defined by the previous curve in the selection chain.
|
||||
NOTE 3: Options -> Fill Creates Only Curves option will make the Fill function create only NURBS curves, but not the geo.
|
||||
|
||||
# gsSubdivide
|
||||
Subdivides selected curve into multiple curves based on the Add slider value
|
||||
Shift + Click subdivides selected curve but does not delete the original curve
|
||||
|
||||
# gsEdgeToCurve
|
||||
Converts selected geometry edges to curves.
|
||||
Multiple unconnected edge groups can be selected at the same time.
|
||||
***
|
||||
Key Combinations:
|
||||
Shift + Click will create a curve without the curvature (first degree curve or simply a line)
|
||||
|
||||
# gsGeoToCurve
|
||||
Opens the Geo-to-Curve UI
|
||||
Geo to Curve algorithm will attempt to generate GS CurveTools cards and tubes from selected geometry.
|
||||
Selected geometry should be either one-sided cards or regular tubes without caps (or both).
|
||||
Multi-selection compatible, but selected geometries should be separate objects and not one combined object.
|
||||
|
||||
# layerCollectionsComboBox
|
||||
Layer collections drop-down menu.
|
||||
Allows to separate the project into different layer collections, up to 80 layers in each collection.
|
||||
Has additional functionality in marking menu (Hold RMB):
|
||||
***
|
||||
Marking menu:
|
||||
1. Clear - will delete all the cards from the current layer. Undoable operation.
|
||||
2. Merge Up, Merge Down - merge all the cards from the current layer to the layer above or below it.
|
||||
3. Copy, Paste - will copy all the cards from the current layer and paste them to the layer that user selects.
|
||||
4. Move Up, Move Down - will rearrange the current layer collections by moving the currently selected collection up or down in the list.
|
||||
5. Rename - will rename the current layer collection
|
||||
|
||||
# layerCollectionsPlus
|
||||
Add additional layer collection after the current one.
|
||||
|
||||
# layerCollectionsMinus
|
||||
Remove current layer collection. All the cards from the removed collection will be merged one layer UP.
|
||||
|
||||
# gsAllFilter
|
||||
Layer filter. Controls the visibility of all objects in all layers:
|
||||
Normal click will show all curves and geometry in all layers.
|
||||
Shift + Click will hide all curves and geometry in all layers
|
||||
Ctrl + Click will show all the curves and geometry in all layers and all collections.
|
||||
Ctrl + Shift + Click will hide all curves and geometry in all layers and all collections.
|
||||
|
||||
# gsCurveFilter
|
||||
Layer filter. Hides all geometry and shows all the curves in all layers.
|
||||
Ctrl + Click will do the same thing, but for all layers and all collections.
|
||||
NOTE: Holding RMB will open a marking menu with Toggle Always on Top function as well as "Auto-Hide Inactive Curves" function.
|
||||
Toggle Always on Top function will toggle the Always on Top feature that will show the curve component always on top. The effect is different in different Maya versions
|
||||
Auto-Hide Inactive Curves will hide all the curve components on all inactive layer collections when switching between collections.
|
||||
|
||||
# gsGeoFilter
|
||||
Layer filter. Hides all curves and shows only geometry.
|
||||
Ctrl + Click will do the same thing, but for all layers and all collections.
|
||||
|
||||
# colorMode
|
||||
Color mode toggle. Enables colors for each layer and (optionally) UV checker material.
|
||||
NOTE: Checker pattern can be disabled in the Options menu
|
||||
|
||||
# curveGrp0
|
||||
Curve Layers that are used for organization of the cards and tubes in the scene.
|
||||
Selected layer (white outline) will be used to store newly created cards.
|
||||
Holding RMB will open a marking menu with all the functions of current layer.
|
||||
***
|
||||
Key Combinations:
|
||||
Shift + Click: additively select the contents of the layers.
|
||||
Ctrl + Click: exclusively select the contents of the layer.
|
||||
Alt + Click: show/hide selected layer.
|
||||
Ctrl + Shift: show/hide curve component on selected layer.
|
||||
Ctrl + Alt: show/hide geo component for the selected layer.
|
||||
Shift + Alt + Click: isolate select the layer.
|
||||
Shift + Ctrl + Alt + Click: enable Always on Top for each layer (only for Maya 2022+).
|
||||
***
|
||||
Layer MMB Dragging:
|
||||
MMB + Drag: move the contents of one layer to another layer. Combine if target layer has contents.
|
||||
MMB + Shift + Drag: copy the contents of one layer to another layer. Copy and Add if target layer has contents.
|
||||
|
||||
# gsExtractSelected
|
||||
Extracts (Duplicates) the geometry component from the selected curves:
|
||||
***
|
||||
Key Combinations:
|
||||
Normal click will extract geometry and combine it.
|
||||
Shift + Click will extract geometry as individual cards.
|
||||
Ctrl + Click will extract geometry, combine it, open export menu and delete the extracted geo after export.
|
||||
Shift + Ctrl click will extract geometry, open export menu and delete the extracted geo after export.
|
||||
|
||||
# gsExtractAll
|
||||
Extracts (Duplicates) the geometry component from all layers and collections. Original layers are HIDDEN, NOT deleted:
|
||||
Last Layer in the current Collection is ignored by default. Can be changed in the options.
|
||||
Collections with "template" in their name (case insensitive) will be ignored by default. Can be changed in the options.
|
||||
***
|
||||
Key Combinations:
|
||||
Normal click will extract geometry and combine it.
|
||||
Shift + Click will extract geometry as individual cards grouped by layers.
|
||||
Ctrl + Click will extract geometry, combine it, open export menu and delete the extracted geo after export.
|
||||
Shift + Ctrl click will extract geometry, open export menu and delete the extracted geo after export.
|
||||
|
||||
# gsSelectCurve
|
||||
Selects the curve components of the selected Curve Cards/Tubes.
|
||||
NOTE: Useful during the selection in the outliner.
|
||||
|
||||
# gsSelectGeo
|
||||
Selects the geometry component of the selected Curve Cards/Tubes.
|
||||
NOTE: Useful for quick assignment of the materials.
|
||||
|
||||
# gsSelectGroup
|
||||
Selects the group component of the selected Curve Cards/Tubes.
|
||||
NOTE: Useful when you are deleting curves from viewport selection.
|
||||
|
||||
# gsGroupCurves
|
||||
Groups the selected curves and assigns the name from Group Name input field (or default name if empty).
|
||||
|
||||
# gsRegroupByLayer
|
||||
Regroups all the curves based on their layer number, group names and collection names.
|
||||
Group names can be changed in the Layer Names & Colors menu.
|
||||
Groups can be colorized if the "Colorize Regrouped Layers" is enabled in the Options menu.
|
||||
Collections with "template" in their name will be grouped under "CT_Templates". Can be changed in the options.
|
||||
|
||||
# gsGroupNameTextField
|
||||
The name used by the Group Curves function.
|
||||
If empty, uses the default name.
|
||||
|
||||
# gsCustomLayerNamesAndColors
|
||||
Opens a menu where group names and colors can be changed and stored in a global preset.
|
||||
|
||||
# gsTransferAttributes
|
||||
Transfers attributes from the FIRST selected curve to ALL the other curves in the selection.
|
||||
NOTE: Shift + Click transfers the attributes from the LAST selected curve to ALL others.
|
||||
NOTE2: Holding RMB on this button opens a marking menu with Copy-Paste and Filter functionality
|
||||
|
||||
# gsTransferUVs
|
||||
Transfers UVs from the FIRST selected curve to ALL the other curves in the selection.
|
||||
NOTE: Shift + Click transfers the UVs from the LAST selected curve to ALL others.
|
||||
NOTE2: Holding RMB on this button opens a marking menu with Copy-Paste and Filter functionality
|
||||
|
||||
# gsResetPivot
|
||||
Resets the pivot on all selected curves to the default position (root CV).
|
||||
|
||||
# gsRebuildWithCurrentValue
|
||||
Rebuild selected curves using current rebuild slider value
|
||||
|
||||
# gsResetRebuildSliderRange
|
||||
Reset rebuild slider range (1 to 50)
|
||||
|
||||
# gsDuplicateCurve
|
||||
Duplicates all the selected curves and selects them.
|
||||
NOTE: You can select either NURBS curve component, geometry component or group to duplicate.
|
||||
|
||||
# gsRandomizeCurve
|
||||
Opens a window where different attributes of the selected curves can be randomized:
|
||||
1. Enable the sections of interest and change the parameters.
|
||||
2. Dragging the sliders in each section enables a PREVIEW of the randomization. Releasing the slider will reset the curves.
|
||||
3. Click Randomize if you wish to apply the current randomization.
|
||||
|
||||
# gsExtendCurve
|
||||
Lengthens a selected curves based on the Factor slider.
|
||||
|
||||
# gsReduceCurve
|
||||
Shortens the selected curves based on the Factor slider.
|
||||
|
||||
# gsSmooth
|
||||
Smoothes selected curves or curve CVs based on the Factor slider.
|
||||
NOTE 1: At least 3 CVs should be selected for component smoothing.
|
||||
NOTE 2: Holding RMB will open a marking menu where you can select a stronger smoothing algorithm.
|
||||
|
||||
# mirrorX
|
||||
Mirrors or Flips all the selected curves on the World X axis.
|
||||
|
||||
# mirrorY
|
||||
Mirrors or Flips all the selected curves on the World Y axis.
|
||||
|
||||
# mirrorZ
|
||||
Mirrors or Flips all the selected curves on the World Z axis.
|
||||
|
||||
# gsControlCurve
|
||||
Adds a Control Curve Deformer to the selected curves. Can be used to adjust groups of curves.
|
||||
NOTE 1: Should NOT be used to permanently control clumps of cards. Use Bind instead.
|
||||
|
||||
# gsApplyControlCurve
|
||||
Applies the Control Curve Deformer.
|
||||
Either the Control Curve or any controlled Curves can be selected for this to work.
|
||||
|
||||
# gsCurveControlWindow
|
||||
Opens a Curve Control Window. Contains all the available controls for curves.
|
||||
|
||||
# gsUVEditorMain
|
||||
Opens a UV editor that can be used to setup and adjust UVs on multiple cards.
|
||||
NOTE 1: Lambert material with PNG, JPG/JPEG or TIF/TIFF (LZW or No Compression) texture file is recommended. TGA (24bit and no RLE) is also supported.
|
||||
NOTE 2: Make sure to select the curves or the group, not the geo, to adjust the UVs.
|
||||
NOTE 3: Using default Maya UV editor will break GS CurveTools Cards, Tubes and Bound Groups.
|
||||
NOTE 4: Default UV editor can be used when custom geometry is used in a Bound Groups.
|
||||
|
||||
<!-- ui.py --->
|
||||
<!-- Curve Control Window Buttons and Frames --->
|
||||
|
||||
# gsLayerSelector
|
||||
Shows the Layer of the selected curve.
|
||||
Selecting different layer will change the layer of all the selected curves.
|
||||
|
||||
# gsColorPicker
|
||||
Layer/Card Color Picker.
|
||||
|
||||
# gsCurveColorPicker
|
||||
Curve Color Picker.
|
||||
|
||||
# selectedObjectName
|
||||
Selected object name. Editing this field will rename all the selected objects.
|
||||
|
||||
# lineWidth
|
||||
Controls the thickness of the selected curves.
|
||||
|
||||
# gsBindAxisAuto
|
||||
Automatic selection of the bind Axis (recommended).
|
||||
NOTE: Change to manual X, Y, Z axis if bind operation result is not acceptable.
|
||||
|
||||
# AxisFlip
|
||||
Flips the direction of the bound geometry.
|
||||
|
||||
# editOrigObj
|
||||
Temporarily disables curve bind and shows the original objects.
|
||||
Used to adjust the objects after the bind.
|
||||
To add or remove from the Bound group use Unbind.
|
||||
|
||||
# selectOriginalCurves
|
||||
Selects the original curves that were attached to a bind curve.
|
||||
Allows to edit their attributes without using Unbind or Edit Original Objects
|
||||
|
||||
# twistCurveFrame
|
||||
Advanced twist control graph. Allows for precise twisting of the geometry along the curve. Click to expand.
|
||||
|
||||
# Magnitude
|
||||
Twist multiplier. The larger the values, the more the twist. Default is 0.5.
|
||||
|
||||
# gsTwistGraphResetButton
|
||||
Resets the graph to the default state.
|
||||
|
||||
# gsTwistGraphPopOut
|
||||
Opens a larger graph in a separate window that is synced to the main graph.
|
||||
|
||||
# widthLockSwitch
|
||||
Links/Unlinks the X and Z width sliders.
|
||||
If linked, the sliders will move as one.
|
||||
|
||||
# LengthLock
|
||||
Locks/Unlocks the length slider.
|
||||
When Locked the geometry is stretched to the length of the curve and the slider is ignored.
|
||||
|
||||
# widthCurveFrame
|
||||
Advanced width control graph. Allows for precise scaling of the geometry along the curve. Click to expand.
|
||||
|
||||
# gsWidthGraphResetButton
|
||||
Resets the graph to the default state.
|
||||
|
||||
# gsWidthGraphPopOut
|
||||
Opens a larger graph in a separate window that is synced to the main graph.
|
||||
|
||||
# profileCurveGraph
|
||||
Advanced control over the profile of the card. Modifies the profile applied by the Profile slider. Click to expand.
|
||||
Add or remove points and change them to increase or decrease the Profile value along the curve.
|
||||
|
||||
# autoEqualizeSwitchOn
|
||||
Locks the points horizontally to equal intervals to avoid geometry deformation.
|
||||
|
||||
# autoEqualizeSwitchOff
|
||||
Unlocks the points and allows for the full control.
|
||||
|
||||
# equalizeCurveButton
|
||||
Snaps the points to the equal horizontal intervals.
|
||||
|
||||
# gsResetProfileGraphButton
|
||||
Resets the curve to the default state.
|
||||
|
||||
# gsProfileGraphPopOut
|
||||
Opens a larger graph in a separate window that is synced to the main graph.
|
||||
|
||||
# reverseNormals
|
||||
Reverses the normals on the selected cards/tubes.
|
||||
|
||||
# orientToNormalsFrame
|
||||
Orient selected cards/tubes to the normals of the selected geo.
|
||||
|
||||
# gsOrientToNormalsSelectTarget
|
||||
Set selected mesh as a target for the algorithm.
|
||||
|
||||
# orientRefreshViewport
|
||||
Toggles the viewport update during the alignment process.
|
||||
Disabling can speed up the process.
|
||||
|
||||
# gsOrientToNormals
|
||||
Starts the alignment process.
|
||||
Will align the selected cards to the normals of the selected geometry.
|
||||
|
||||
# flipUV
|
||||
Flips the UVs of the card/tube horizontally.
|
||||
|
||||
# resetControlSliders
|
||||
Resets the range of the sliders to the default state.
|
||||
|
||||
# UVFrame
|
||||
Legacy controls for the UVs. Just use the new UV Editor.
|
||||
|
||||
# solidifyFrame
|
||||
Expands controls that control the thickness of the cards/tubes.
|
||||
|
||||
# solidify
|
||||
Toggles the thickness of the geometry.
|
||||
|
||||
<!-- Curve Control Window Sliders --->
|
||||
|
||||
# lengthDivisions
|
||||
Change the length divisions of the selected cards/tubes.
|
||||
|
||||
# dynamicDivisions
|
||||
Toggles the dynamic divisions mode.
|
||||
Dynamic divisions will change the divisions of the cards/tubes based on the length of the curves.
|
||||
In dynamic divisions mode, L-Div slider will control the density of the divisions, not the fixed divisions count.
|
||||
|
||||
# widthDivisions
|
||||
Change the width divisions of the selected cards/tubes.
|
||||
|
||||
# Orientation
|
||||
Change the orientation of the card/tube around the curve.
|
||||
|
||||
# Twist
|
||||
Smoothly twist the entire geometry card/tube. Twists the tip of the card.
|
||||
|
||||
# invTwist
|
||||
Smoothly twist the entire geometry card. Twists the root of the card.
|
||||
|
||||
# Width
|
||||
Change the width of the selected card.
|
||||
|
||||
# Taper
|
||||
Linearly changes the width of the card/tube along the length of the curve.
|
||||
|
||||
# WidthX
|
||||
Change the width of the tube along the X axis.
|
||||
|
||||
# WidthZ
|
||||
Change the width of the tube along the Z axis.
|
||||
|
||||
# Length
|
||||
Change the length of the attached geometry. Works only when Length Unlock button is checked.
|
||||
|
||||
# Offset
|
||||
Offset the geometry along the curve.
|
||||
|
||||
# Profile
|
||||
Change the profile of the card along the length of the curve uniformly.
|
||||
|
||||
# profileSmoothing
|
||||
Smoothing will smooth the profile transition.
|
||||
|
||||
# otherFrame
|
||||
Other less used options
|
||||
|
||||
# curveRefine
|
||||
Controls the number of "virtual" vertices on the curve. These are the vertices that are used to calculate the geometry deformation.
|
||||
Zero (0) value will disable the refinement and the geometry will be attached directly to the curve. The fastest option.
|
||||
Larger refine values means smoother geometry that is a closer fit to the curve.
|
||||
Only increase past 20 if you need additional precision or if there are any visual glitches with the geometry.
|
||||
Large refine values can cause significant performance drop, lag and other issues on smaller curve sizes.
|
||||
Recommended values are:
|
||||
20 for curves with less than 20 CVs.
|
||||
0 (disabled) or same as the number of CVs for curves with more than 20 CVs.
|
||||
|
||||
# autoRefine
|
||||
Enables auto-refine for selected curves. Recommended to keep this on.
|
||||
Manual refinement can be helpful if the geometry deformation is wrong or not precise enough.
|
||||
|
||||
# samplingAccuracy
|
||||
Increases the sampling accuracy of the deformer that attaches the geometry to a curve.
|
||||
Larger values = more precise geometry fit to a curve and more lag.
|
||||
|
||||
# surfaceNormals
|
||||
Changes the smoothing angle of the normals of the geometry.
|
||||
|
||||
# gsIterationsSlider
|
||||
Controls the number of iterations per card.
|
||||
|
||||
# gsMinimumAngle
|
||||
Controls the target angle difference between the normal of the mesh and the card.
|
||||
|
||||
# solidifyThickness
|
||||
Controls the amount of thickness on the geometry.
|
||||
|
||||
# solidifyDivisions
|
||||
Controls the number of divisions on the solidify extrusion.
|
||||
|
||||
# solidifyScaleX
|
||||
Changes the scale on the X axis.
|
||||
|
||||
# solidifyScaleY
|
||||
Changes the scale on the Y axis.
|
||||
|
||||
# solidifyOffset
|
||||
Controls the offset of the solidify extrusion.
|
||||
|
||||
# solidifyNormals
|
||||
Controls the smoothing angle for normals of the solidify extrusion.
|
||||
|
||||
# geometryHighlight
|
||||
If enabled, selecting the curve will also highlight the geometry component that is attached to that curve.
|
||||
Works only on GS CurveTools curves and geo.
|
||||
|
||||
# curveHighlight
|
||||
If enabled, selected curves and their components will be additionally highlighted for better visibility.
|
||||
The curves and components will be in X-Ray mode by default.
|
||||
Colors and transparency values can be changes in the menu below.
|
||||
|
||||
# gsSelectedCVColor
|
||||
Selected CV highlight color
|
||||
|
||||
# gsSelectedCVAlpha
|
||||
Selected CV highlight transparency (alpha)
|
||||
|
||||
# gsDeselectedCVColor
|
||||
Deselected CV highlight color
|
||||
|
||||
# gsDeselectedCVAlpha
|
||||
Deselected CV highlight transparency (alpha)
|
||||
|
||||
# curveVisibility
|
||||
Toggle selected curves highlight
|
||||
|
||||
# gsCurveHighlightColor
|
||||
Selected curve highlight color
|
||||
|
||||
# gsCurveHighlightAlpha
|
||||
Selected curve highlight transparency (alpha)
|
||||
|
||||
# hullVisibility
|
||||
Toggle hull visibility.
|
||||
Hull is a line that connects all the CVs on the curve.
|
||||
|
||||
# gsHullHighlightColor
|
||||
Hull highlight color
|
||||
|
||||
# gsHullHighlightAlpha
|
||||
Hull highlight transparency (alpha)
|
||||
|
||||
# advancedVisibilityFrame
|
||||
Better highlights for selected curves and components.
|
||||
|
||||
# lazyUpdate
|
||||
Enables lazy update for selected curves.
|
||||
Lazy update can slightly increase the performance of the highlight,
|
||||
however it has some visual drawbacks (curve highlight can fail to update when switching curves in component selection mode)
|
||||
|
||||
# alwaysOnTop
|
||||
Toggles X-Ray (always on top) drawing for highlighted components.
|
||||
Disabling this defeats the purpose of the advanced visibility, but hey, it's your choice.
|
||||
|
||||
# curveDistanceColor
|
||||
Toggles the distance color effect on the curve highlight.
|
||||
Distance color darkens the curve color the further it is from the camera.
|
||||
|
||||
# cvDistanceColor
|
||||
Toggles the distance color effect on the CV highlight.
|
||||
Distance color darkens the CVs color the further it is from the camera.
|
||||
|
||||
# hullDistanceColor
|
||||
Toggles the distance color effect on the hull highlight.
|
||||
Distance color darkens the hull color the further it is from the camera.
|
||||
|
||||
# gsDistanceColorMinValue
|
||||
Distance color minimum.
|
||||
This value is the minimum allowed color multiplier for the Distance Color effect.
|
||||
The lower this value, the darker further parts of the curve will be.
|
||||
Black at 0.0
|
||||
Original color at 1.0
|
||||
|
||||
# gsDistanceColorMaxValue
|
||||
Distance color maximum.
|
||||
This value is the maximum allowed color multiplier for the Distance Color effect.
|
||||
The higher this value, the brighter closest parts of the curve will be.
|
||||
Black at 0.0
|
||||
Original color at 1.0
|
||||
|
||||
# CVocclusion
|
||||
Toggles the experimental CV occlusion mode (hull is affected as well)
|
||||
When the appropriate mesh name is added to Occluder Mesh input field,
|
||||
this function will automatically hide CVs and hull lines that are behind this mesh (even in X-Ray mode).
|
||||
Warning: enabling this mode can negatively impart viewport performance.
|
||||
|
||||
# gsSelectOccluderButton
|
||||
This button adds the selected mesh name to the Occluder Mesh input field.
|
||||
|
||||
# gsOccluderMeshName
|
||||
Type the full path for the occluder mesh here, or use the "Select Occluder" button on the left <-
|
||||
|
||||
|
||||
<!-- Layer Customization --->
|
||||
|
||||
# gsGenerateLayerColorGradient
|
||||
Generate a color gradient for the layer colors.
|
||||
Rows control the number of Rows to generate.
|
||||
Left color picker sets the initial color.
|
||||
Right color picker sets the final color.
|
||||
|
||||
# gsRandomizeLayerColors
|
||||
Generate random colors for the layers.
|
||||
SatMin controls the minimum allowed saturation.
|
||||
SatMax controls the maximum allowed saturation.
|
||||
|
||||
# gsResetAllLayerColors
|
||||
Resets all the color swatches to the default color.
|
||||
|
||||
# gsGetCurrentSceneLayers
|
||||
Populates the menu with the names and colors stored in the scene.
|
||||
|
||||
# gsSetAsCurrentSceneLayers
|
||||
Applies the names and colors from the menu to the scene.
|
||||
|
||||
# gsLoadGlobalLayerPreset
|
||||
Load the global names and colors preset to the menu.
|
||||
NOTE: Don't forget to Set to Scene before closing the menu.
|
||||
|
||||
# gsSaveGlobalLayerPreset
|
||||
Saves the current names and colors from the menu to the global preset.
|
||||
|
||||
<!-- UV Editor Window --->
|
||||
|
||||
# gsUVSelect
|
||||
Enables the selection of the UVs.
|
||||
Drag to draw a box selection.
|
||||
|
||||
# gsUVMove
|
||||
Enables the Move tool.
|
||||
Move the selected UVs or move individual UVs if nothing is selected.
|
||||
|
||||
# gsUVRotate
|
||||
Enables the Rotation of the selected UVs.
|
||||
Hold LMB and drag anywhere in the viewport to rotate the selected UVs.
|
||||
Rotation pivot is the center of the individual unscaled UV.
|
||||
|
||||
# gsUVScale
|
||||
Enables the Scaling of the selected UVs.
|
||||
Hold LMB and drag in the viewport to scale the card Horizontally of Vertically.
|
||||
Repeated hotkey click will toggle between Horizontal and Vertical scaling.
|
||||
|
||||
# gsUVHorizontalScale
|
||||
Horizontal scaling mode selector.
|
||||
|
||||
# gsUVVerticalScale
|
||||
Vertical scaling mode selector.
|
||||
|
||||
# gsDrawUVs
|
||||
Enables the UVs Drawing Tool:
|
||||
1. Select UVs using Selection Mode.
|
||||
2. Enable the UV Drawing Tool.
|
||||
3. Draw a UV Rectangle anywhere in the viewport to create/move the UVs there.
|
||||
|
||||
# gsHorizontalFlipUV
|
||||
Flips the selected UVs horizontally.
|
||||
Flipped UVs have the blue circle indicator inside the root rectangle.
|
||||
|
||||
# gsVerticalFlipUV
|
||||
Flips the selected UVs vertically.
|
||||
|
||||
# gsResetUVs
|
||||
Resets the selected UVs to the default 0,1 rectangle.
|
||||
|
||||
# gsSyncSelectionUVs
|
||||
Syncs selection between UV editor and Maya Viewport.
|
||||
|
||||
# gsRandomizeUVs
|
||||
Randomize selected UV positions between already existing UV positions.
|
||||
***
|
||||
Normal click will keep the overall density distribution of the UVs.
|
||||
This means that if there is one card in one position and twenty cards in the other,
|
||||
it will keep this distribution of 1 to 20.
|
||||
***
|
||||
Shift+Click will ignore the original density distribution
|
||||
and simply randomize the UVs between the original positions.
|
||||
|
||||
# gsFocusUVs
|
||||
Focuses on the selected UVs or on all the UVs if nothing is selected.
|
||||
|
||||
# gsUVIsolateSelect
|
||||
Hides all the unselected UVs and shows only the selected ones.
|
||||
|
||||
# gsUVShowAll
|
||||
Shows all the hidden UVs.
|
||||
|
||||
# UVEditorUseTransforms
|
||||
Use "Coverage" and "Translate Frame" parameters from place2dTexture node for texture.
|
||||
Offset is not supported.
|
||||
Diffuse and Alpha channel MUST have the same coverage and translate frame values.
|
||||
|
||||
# UVEditorTransparencyToggle
|
||||
Enable texture map transparency using Alpha map from Transparency plug in the material node
|
||||
|
||||
# UVEditorBGColorPicker
|
||||
Background Color
|
||||
|
||||
# UVEditorGridColorPicker
|
||||
Grid Color
|
||||
|
||||
# UVEditorFrameColorPicker
|
||||
Frame Color
|
||||
|
||||
# UVEditorUVFrameSelectedColorPicker
|
||||
Selected UV frame color
|
||||
|
||||
# UVEditorUVFrameDeselectedColorPicker
|
||||
Deselected UV frame color
|
||||
|
||||
# UVEditorUVCardFillColorPicker
|
||||
UV frame background color
|
||||
|
||||
<!-- Card to Curve Window --->
|
||||
|
||||
# gsGeoToCurve_outputTypeSwitch
|
||||
Controls the output of Geo-to-Curve algorithm
|
||||
|
||||
# gsGeoToCurve_generateAuto
|
||||
Automatically determine the final object type (card or tube) based on the selected geometry.
|
||||
|
||||
# gsGeoToCurve_generateCards
|
||||
Generate cards from selected geometry (one-sided cards or tubes)
|
||||
|
||||
# gsGeoToCurve_generateTubes
|
||||
Generate tubes from selected geometry (one-sided cards or tubes)
|
||||
|
||||
# gsGeoToCurve_generateCurves
|
||||
Generate curves from selected geometry (one-sided cards or tubes)
|
||||
|
||||
# gsGeoToCurve_cardType
|
||||
Controls the type of generated objects (Warp or Extrude)
|
||||
|
||||
# gsGeoToCurve_warp
|
||||
Generate Warp cards or tubes
|
||||
|
||||
# gsGeoToCurve_extrude
|
||||
Generate Extrude cards or tubes
|
||||
|
||||
# gsGeoToCurve_matchAttributes
|
||||
Controls which attributes on the new cards/tubes should be approximated from the original geometry.
|
||||
NOTE: This process is not perfect and final result can be inaccurate.
|
||||
|
||||
# gsGeoToCurve_orientation
|
||||
Match orientation attribute during the generation process
|
||||
|
||||
# gsGeoToCurve_width
|
||||
Match orientation attribute during the generation process
|
||||
|
||||
# gsGeoToCurve_taper
|
||||
Match taper attribute during the generation process
|
||||
|
||||
# gsGeoToCurve_twist
|
||||
Match twist attribute during the generation process
|
||||
|
||||
# gsGeoToCurve_profile
|
||||
Match profile attribute during the generation process
|
||||
|
||||
# gsGeoToCurve_material
|
||||
Copy material (shader) from the original geometry
|
||||
|
||||
# gsGeoToCurve_UVs
|
||||
Tries to approximate the UVs from the original geometry
|
||||
NOTE: Matches the bounding box of the UVs. Rotated and deformed UVs are not matched precisely.
|
||||
|
||||
# gsGeoToCurve_UVMatchOptions
|
||||
Controls UV matching behaviour
|
||||
|
||||
# gsGeoToCurve_verticalFlip
|
||||
Vertically flip matched UVs
|
||||
|
||||
# gsGeoToCurve_horizontalFlip
|
||||
Horizontally flip matched UVs
|
||||
|
||||
# gsGeoToCurve_reverseCurve
|
||||
Reverse generated curve direction
|
||||
Root CV should be generated near the scalp of the model.
|
||||
Enable or disable if resulting card direction and taper are reversed.
|
||||
|
||||
# gsGeoToCurve_convertSelected
|
||||
Convert selected geometry to cards, tubes or curves based on the selected options.
|
||||
Newly created procedural objects will be placed in the currently selected layer.
|
||||
NOTE: if the currently selected layer is hidden (grayed out), the newly created objects will be hidden as well.
|
||||
|
||||
# gsGeoToCurve_deleteOriginalObject
|
||||
Delete the original geometry after converting it to cards, tubes or curves.
|
||||
|
||||
# gsGeoToCurve_useAimMesh
|
||||
Use the aim mesh (selected below) to place the root CV of the generated cards, tubes or curves close to the target mesh.
|
||||
Placing CVs close to the target mesh will help with the alignment process and general adjustments later on.
|
||||
The aim mesh should be a polygonal mesh.
|
||||
|
||||
# gsGeoToCurve_selectAimMesh
|
||||
Select the aim mesh in the scene and click this button to add its name to the input field.
|
||||
@@ -1,61 +0,0 @@
|
||||
# ngSkinTools2 模块
|
||||
|
||||
ngSkinTools2 是一个强大的 Maya 蒙皮权重编辑工具。
|
||||
|
||||
## 📁 文件夹结构
|
||||
|
||||
```
|
||||
ngskintools2/ # ngSkinTools2 核心模块
|
||||
├── __init__.py # 模块初始化(原始)
|
||||
├── launcher.py # 启动器脚本(新增)
|
||||
├── api/ # API 接口
|
||||
├── ui/ # 用户界面
|
||||
├── operations/ # 操作功能
|
||||
└── README.md # 本文档
|
||||
```
|
||||
|
||||
## 🚀 使用方法
|
||||
|
||||
### 从工具架启动
|
||||
|
||||
1. 打开 Maya
|
||||
2. 切换到 **Nexus_Rigging** 工具架
|
||||
3. 点击 **ngSkin** 按钮
|
||||
|
||||
### 从 Python 启动
|
||||
|
||||
```python
|
||||
from rigging_tools.ngskintools2 import launcher
|
||||
launcher.LaunchNgSkinTools()
|
||||
```
|
||||
|
||||
### 直接使用 ngSkinTools2 API
|
||||
|
||||
```python
|
||||
from rigging_tools.ngskintools2 import open_ui
|
||||
open_ui()
|
||||
```
|
||||
|
||||
## ✨ 主要功能
|
||||
|
||||
- 高级权重绘制和编辑
|
||||
- 权重镜像和传递
|
||||
- 多层权重管理
|
||||
- 权重导入/导出
|
||||
- 影响对象管理
|
||||
|
||||
## 📝 注意事项
|
||||
|
||||
- 自动检测 Maya 版本并加载对应插件
|
||||
- 支持 Maya 2018-2026 版本
|
||||
- 如果当前版本没有完全匹配的插件,会自动使用向下兼容的版本
|
||||
- 建议在绑定工作流程中使用
|
||||
|
||||
## 🔧 版本兼容性
|
||||
|
||||
启动器会自动检测当前 Maya 版本并加载对应的插件:
|
||||
- **完全匹配**:优先使用与 Maya 版本完全匹配的插件
|
||||
- **向下兼容**:如果没有完全匹配,使用小于等于当前版本的最高版本插件
|
||||
- **兜底策略**:如果当前版本比所有可用插件都旧,使用最旧的可用插件
|
||||
|
||||
支持的 Maya 版本:2018, 2019, 2020, 2022, 2023, 2024, 2025, 2026
|
||||
@@ -432,7 +432,7 @@ class InfluenceMappingConfig(Object):
|
||||
return
|
||||
|
||||
if axis is not None and not isinstance(axis, int):
|
||||
raise Exception("invalid axis type, need int")
|
||||
raise Exception("无效的轴类型,需要整数")
|
||||
|
||||
self.__mirror_axis = axis
|
||||
|
||||
@@ -487,10 +487,10 @@ class InfluenceMapping(Object):
|
||||
|
||||
def __init__(self):
|
||||
self.config = InfluenceMappingConfig() # type:InfluenceMappingConfig
|
||||
"assigned config"
|
||||
"分配的配置"
|
||||
|
||||
self.influences = [] # type: list[InfluenceInfo]
|
||||
"Source influences list. Can be assigned to result of :py:meth:`Layers.list_influences`"
|
||||
"源影响列表. 可以分配给结果 :py:meth:`Layers.list_influences`"
|
||||
|
||||
self.destinationInfluences = None
|
||||
self.calculatedMapping = None
|
||||
@@ -498,7 +498,7 @@ class InfluenceMapping(Object):
|
||||
|
||||
def calculate(self):
|
||||
mirror_mode = self.config.mirror_axis is not None
|
||||
log.info("calculate influence mapping, mirror mode: %s", mirror_mode)
|
||||
log.info("计算影响映射,镜像模式: %s", mirror_mode)
|
||||
if self.destinationInfluences is None:
|
||||
self.destinationInfluences = self.influences
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class LayerEffects(Object):
|
||||
mirror_mask = mirror_dq = mirror_weights = everything
|
||||
|
||||
logger.info(
|
||||
"configure mirror: layer %s mask %r weights %r dq %r direction %r",
|
||||
"配置镜像: 图层 %s 遮罩 %r 权重 %r dq %r 方向 %r",
|
||||
self.__layer.name,
|
||||
mirror_mask,
|
||||
mirror_weights,
|
||||
@@ -103,7 +103,7 @@ class Layer(Object):
|
||||
@classmethod
|
||||
def load(cls, mesh, layer_id):
|
||||
if layer_id < 0:
|
||||
raise Exception("invalid layer ID: %s" % layer_id)
|
||||
raise Exception("无效图层 ID: %s" % layer_id)
|
||||
result = Layer(mesh, layer_id)
|
||||
result.reload()
|
||||
return result
|
||||
@@ -112,7 +112,7 @@ class Layer(Object):
|
||||
self.mesh = mesh
|
||||
self.id = id
|
||||
self.effects = LayerEffects(self) # type: LayerEffects
|
||||
"configure effects for this layer"
|
||||
"配置此图层的效果"
|
||||
|
||||
self.__state = None
|
||||
if state is not None:
|
||||
|
||||
@@ -63,7 +63,7 @@ class Mirror(Object):
|
||||
"""
|
||||
:type mapping: map[int] -> int
|
||||
"""
|
||||
log.info("mapping updated: %r", mapping)
|
||||
log.info("映射已更新: %r", mapping)
|
||||
|
||||
mapping_as_string = ','.join(str(k) + "," + str(v) for (k, v) in list(mapping.items()))
|
||||
plugin.ngst2Layers(self.target, configureMirrorMapping=True, influencesMapping=mapping_as_string)
|
||||
@@ -119,7 +119,7 @@ class Mirror(Object):
|
||||
existing_ref_mesh = self.get_reference_mesh()
|
||||
if existing_ref_mesh:
|
||||
cmds.select(existing_ref_mesh)
|
||||
raise Exception("symmetry mesh already configured for %s: %s" % (str(sc), existing_ref_mesh))
|
||||
raise Exception("对称网格已配置为 %s: %s" % (str(sc), existing_ref_mesh))
|
||||
|
||||
def get_shape(node):
|
||||
return cmds.listRelatives(node, shapes=True)[0]
|
||||
@@ -177,7 +177,7 @@ def set_reference_mesh_from_selection():
|
||||
selection = cmds.ls(sl=True, long=True)
|
||||
|
||||
if len(selection) != 2:
|
||||
log.debug("wrong selection size")
|
||||
log.debug("错误的选择尺寸")
|
||||
return
|
||||
|
||||
m = Mirror(selection[1])
|
||||
|
||||
@@ -83,7 +83,7 @@ class Session(Object):
|
||||
|
||||
@signal.on(self.events.targetChanged)
|
||||
def on_target_change():
|
||||
log.info("target changed: clearing target context")
|
||||
log.info("目标已更改:清除目标上下文")
|
||||
self.context.selected_layers.set([])
|
||||
|
||||
self.events.nodeSelectionChanged.emit()
|
||||
|
||||
@@ -67,7 +67,7 @@ def add_influences(influences, target):
|
||||
def long_names(names):
|
||||
result = set(cmds.ls(names, long=True))
|
||||
if len(result) != len(names):
|
||||
raise Exception("could not convert to a list of influences names: " + str(names))
|
||||
raise Exception("无法转换为影响名称列表: " + str(names))
|
||||
return result
|
||||
|
||||
existing = long_names([i.name if not i.path else i.path for i in list_influences(skin_cluster)])
|
||||
|
||||
@@ -103,7 +103,7 @@ def merge_layers(layers):
|
||||
# verify that all layers are from the same parent
|
||||
for i, j in zip(layers[:-1], layers[1:]):
|
||||
if i.mesh != j.mesh:
|
||||
raise Exception("layers are not from the same mesh")
|
||||
raise Exception("层不是来自同一个网格")
|
||||
|
||||
result = plugin.ngst2tools(
|
||||
tool="mergeLayers",
|
||||
|
||||
@@ -49,7 +49,7 @@ class LayersTransfer(Object):
|
||||
def calc_influences_mapping_as_flat_list(self):
|
||||
mapping_pairs = list(self.influences_mapping.asIntIntMapping(self.influences_mapping.calculate()).items())
|
||||
if len(mapping_pairs) == 0:
|
||||
raise Exception("no mapping between source and destination influences")
|
||||
raise Exception("源和目标影响之间没有映射")
|
||||
# convert dict to flat array
|
||||
return list(itertools.chain.from_iterable(mapping_pairs))
|
||||
|
||||
|
||||
@@ -54,12 +54,12 @@ class Undo(Object):
|
||||
self.name = name
|
||||
|
||||
def __enter__(self):
|
||||
log.debug("UNDO chunk %r: start", self.name)
|
||||
log.debug("UNDO chunk %r: 开始", self.name)
|
||||
cmds.undoInfo(openChunk=True, chunkName=self.name)
|
||||
return self
|
||||
|
||||
def __exit__(self, _type, value, traceback):
|
||||
log.debug("UNDO chunk %r: end", self.name)
|
||||
log.debug("UNDO chunk %r: 结束", self.name)
|
||||
cmds.undoInfo(closeChunk=True)
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 340 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 9.4 KiB |
@@ -1,353 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- saved from url=(0106)https://apps.autodesk.com/RVT/en/Detail/HelpDoc?appId=2231912794620250494&appLang=en&os=Win64&mode=preview -->
|
||||
<html lang="en" class=" js canvas canvastext no-touch hashchange history draganddrop rgba multiplebgs borderimage boxshadow textshadow cssgradients csstransitions sessionstorage" data-lt-installed="true"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
||||
<title>Autodesk App Store - help file</title><link rel="stylesheet" href="./Resources/appstore-combined.min.css"></head>
|
||||
<body>
|
||||
<div id="main" class="detail-page helpdoc-page clearfix" style="min-height: 619px;">
|
||||
<div id="content">
|
||||
<div id="helpdoc-head">
|
||||
<img id="helpdoc-head-icon" src="./Resources/resized_5ca803cc-8cd1-4cbe-8825-98efaeef156e_.png" alt="ngSkinTools 2">
|
||||
<div id="helpdoc-head-description">
|
||||
<h1 id="helpdoc-product-title">ngSkinTools 2</h1>
|
||||
|
||||
<div class="clear"></div>
|
||||
<hr>
|
||||
<div class="seller">Viktoras Makauskas</div>
|
||||
<div class="description">ngSkinTools is a skinning plugin for Autodesk® Maya®, introducing new concepts to character skinning such as layers, any-pose-mirroring, enhanced paint brushes, true smoothing, and more.</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="helpdoc-tag"><a href="#description" class="helpdoc-breadcrumb">Description</a>
|
||||
|
||||
<a href="#generalinfo" class="helpdoc-breadcrumb">General Usage Instructions</a>
|
||||
<a href="#screensinfo" class="helpdoc-breadcrumb">Screenshots</a>
|
||||
<a href="#inunininfo" class="helpdoc-breadcrumb">Installation/Uninstallation</a>
|
||||
<a href="#knownissueinfo" class="helpdoc-breadcrumb">Known Issues</a>
|
||||
<a href="#contactinfo" class="helpdoc-breadcrumb">Contact</a>
|
||||
<a href="#versionhistoryinfo" class="">Version History</a>
|
||||
<div class="clear"></div>
|
||||
</div><div class="helpdoc-element description">
|
||||
<div class="clear"></div>
|
||||
<h1 id="description">Description</h1>
|
||||
<div class="helpdoc-text">
|
||||
|
||||
<h3 id="layers">Layers</h3>
|
||||
<p>Skinning
|
||||
layers are a central feature of ngSkinTools. With them, you break your rig down
|
||||
into easier manageable parts and edit them separately, then blend everything
|
||||
together through layer transparency.</p>
|
||||
<p>They’re
|
||||
not just a simple way to make your work more organized - they also physically
|
||||
isolate groups of influences from the rest of the rig, so paint and edit
|
||||
operations won’t mix-in influences you were not expecting. This also allows you
|
||||
to do things that were impossible before: per-layer mirroring, adjusting
|
||||
influence weight up/down through layer transparency, blend transferred weights
|
||||
with previous weights, to name a few.</p>
|
||||
|
||||
<h3 id="viewport-tools">Viewport
|
||||
tools</h3>
|
||||
<p>Just
|
||||
like in the previous version, ngSkinTools brings its own weight painting tools.
|
||||
Improving viewport experience is the main focus of V2, and it's complete revamp
|
||||
over the previous implementation.</p>
|
||||
<ul>
|
||||
<li>Selecting
|
||||
influences on screen, a #1 requested feature from users, is nowhere. Just hold
|
||||
“S” and drag over the surface to select dominant influence from that part of
|
||||
the mesh, or hover over a joint pivot to select precisely the joints you
|
||||
want;</li>
|
||||
<li>In
|
||||
addition to the usual surface projection mode for the brush, the new “screen”
|
||||
brush projection mode is useful when you want to quickly set weights for both
|
||||
sides of the mesh;</li>
|
||||
<li>Custom
|
||||
shortcuts while in paint mode allow for quick access to intensity
|
||||
presets;</li>
|
||||
<li>Color
|
||||
feedback is now provided through VP2 APIs, greatly improving the performance
|
||||
of displayed meshes.</li></ul><br>
|
||||
|
||||
<h3 id="smoothing">Smoothing</h3>
|
||||
<p>Keeping
|
||||
weights in harmony with each other is not easy. ngSkinTools help you smooth
|
||||
weights with the control you need, allowing you to control the intensity, number
|
||||
of iterations and effective radius. For very dense meshes, added “iterations”
|
||||
argument now allows for the quicker spread of smoothness over larger areas of
|
||||
the mesh.</p>
|
||||
<p>The
|
||||
“relax” tool from V1 is gone. With major performance rework, you’ll notice that
|
||||
simple flood-smoothing is now much faster and should be a near-instant operation
|
||||
even with large meshes.</p>
|
||||
<p>The
|
||||
opposite “brother” of smooth brush, “sharpen”, is also there - for cases where
|
||||
you want to just bring out the dominant influences</p>
|
||||
|
||||
<h3 id="mirroring">Mirroring</h3>
|
||||
<p>Mirroring
|
||||
is one of the most frequent automated tasks you might want from your skinning
|
||||
tool. With ngSkinTools, you’ll be able to:</p>
|
||||
<ul>
|
||||
<li>Mirror
|
||||
rigs in any pose; no need to switch to T-pose;</li>
|
||||
<li>Have
|
||||
granular control over left/right/center influences mapping, matching
|
||||
left/right joints by naming convention, joint labels, etc;</li>
|
||||
<li>Easily
|
||||
mirror parts of your rig by leveraging layers;</li>
|
||||
<li>Automatic
|
||||
mirroring of weights to the opposite side as you paint so that you don’t need
|
||||
to get distracted from painting while working on symmetrical layers.</li></ul><br>
|
||||
|
||||
<h3 id="layer-effects">Layer
|
||||
effects</h3>
|
||||
<p>With
|
||||
the “mirror as a layer effect” feature, ngSkinTools introduce a new concept to
|
||||
ngSkinTools - layer effects. This differs from automatic mirroring of weights as
|
||||
it’s not directly modifying your layer weights; instead, it’s a post-effect that
|
||||
happens in the background buffer. This has multiple benefits, like a much
|
||||
cleaner seamline of left/right sides, the ability to tweak mirroring settings
|
||||
AFTER weights are painted, etc.</p>
|
||||
|
||||
<h3 id="compatibility">Compatibility</h3>
|
||||
<p>As
|
||||
it's predecessor, ngSkinTools2 operates on standard Maya skinCluster (also known
|
||||
as “smooth skin”), so no custom nodes will be required to use your rig. The
|
||||
plugin has a couple of custom nodes, but they’re only required while you work on
|
||||
setting up your skin weights and can be deleted after, so your work should stay
|
||||
compatible with most pipelines out there.</p>
|
||||
|
||||
<h3 id="performance">Performance</h3>
|
||||
<p>A
|
||||
lot of speed improvements have been made since V2, like improving the
|
||||
utilization of modern multi-core processors, or eliminating bottlenecks through
|
||||
much heavier use of performance profiling. Having a responsive, snappy tool is
|
||||
always a pleasure to work with.</p></div></div>
|
||||
|
||||
|
||||
<div class="helpdoc-element ">
|
||||
<div class="clear"></div>
|
||||
<h1 id="generalinfo">General Usage Instructions</h1>
|
||||
<div class="helpdoc-text"><p>The installer from Autodesk App Store loads the application under the Custom shelf.</p>
|
||||
<p><a href="http://www.ngskintools.com/docs"target="_blank">http://www.ngskintools.com/docs/</a></p></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="helpdoc-element-screenshot" class="helpdoc-element ">
|
||||
<div class="clear"></div>
|
||||
<h1 id="screensinfo">Screenshots</h1>
|
||||
<div>
|
||||
<div class="helpdoc-screenshot">
|
||||
<a href="./Resources/original_89910fa8-2c30-4376-a905-12c8a003d16b_.png" title="" data-mime="Image" rel="gallery">
|
||||
<div class="helpdoc-img-container">
|
||||
<span class="helper"></span>
|
||||
<img class="helpdoc-screenshot-img" src="./Resources/original_89910fa8-2c30-4376-a905-12c8a003d16b_.png">
|
||||
<span class="helper"></span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="helpdoc-command helpdoc-element helpdoc-element-hidden">
|
||||
<div class="clear"></div>
|
||||
<h1 id="commandinfo">Commands</h1>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="helpdoc-element ">
|
||||
<div class="clear"></div>
|
||||
<h1 id="inunininfo">Installation/Uninstallation</h1>
|
||||
<div class="helpdoc-text"><div id="pills-tabContent">
|
||||
<div id="pills-windows">
|
||||
<p>The installer that ran when you downloaded this plug-in from Autodesk App Store has already installed the plug-in. Windows only: To uninstall this plug-in, simply rerun the installer downloaded, and select the 'Uninstall' button, or you can uninstall it from 'Control Panel\Programs\Programs and Features', just as you would uninstall any other application from your system. The panel on the Plug-ins tab will not be removed until Maya is restarted.</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Linux and OSX: To uninstall this plug-in, simply delete the module directory from your system. The panel on the Plug-ins tab will not be removed until Maya is restarted.</p>
|
||||
<div id="pills-tabContent">
|
||||
<div id="pills-windows">
|
||||
<p>Download .msi and run it on your computer. The installation will place files in <code>C:\ProgramData\Autodesk\ApplicationPlugins\ngskintools2</code> (unless your <code>%ProgramData%</code> the environment variable is different).</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Using an autoloader system, nothing needs to be configured additionally. Maya scans autoloader locations for plugins at startup and configures each discovered plugin automatically. The autoloader will create a “ngSkinTools2” shelf with a button to open UI.</p>
|
||||
<p>Now, restart Maya and a new tab ngSkinTools2 should appear on your shelf.</p></div>
|
||||
</div>
|
||||
|
||||
<h3>Available on</h3>
|
||||
<table>
|
||||
<tr><td><img height=48 src="./Resources/win64.png" /></td><td><img height=48 src="./Resources/macos64.png" /></td><td><img height=48 src="./Resources/linux64.png" /></td></tr>
|
||||
<tr><td align="center">Windows</td><td align="center">Mac OSX</td><td align="center">Linux</td></tr>
|
||||
</table>
|
||||
|
||||
<div class="helpdoc-element helpdoc-element-hidden">
|
||||
<div class="clear"></div>
|
||||
<h1 id="addinfo">Additional Information</h1>
|
||||
<div class="helpdoc-text"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="helpdoc-element ">
|
||||
<div class="clear"></div>
|
||||
<h1 id="knownissueinfo">Known Issues</h1>
|
||||
<div class="helpdoc-text"><p>For upcoming features and bugfixes, visit <a href="http://ngskintools.com/v2/roadmap"target="_blank">ngSkinTools v2 public roadmap</a>.</p></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="helpdoc-element ">
|
||||
<div class="clear"></div>
|
||||
<h1 id="contactinfo">Contact</h1>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div class="">Company Name: Viktoras Makauskas</div>
|
||||
<div class="">Company URL: <a href="http://www.ngskintools.com/" target="_blank">http://www.ngskintools.com</a></div>
|
||||
<div class="">Support Contact: <a href="mailto:support@ngskintools.com">support@ngskintools.com</a></div>
|
||||
</div>
|
||||
|
||||
<div class="helpdoc-block ">
|
||||
<div class="clear"></div>
|
||||
<h1 id="authorinfo">Author/Company Information</h1>
|
||||
<div class="helpdoc-text">Viktoras Makauskas</div>
|
||||
</div>
|
||||
|
||||
<div class="helpdoc-block ">
|
||||
<div class="clear"></div>
|
||||
<h1 id="supportinfo">Support Information</h1>
|
||||
<div class="helpdoc-text"><p>If you have a problem, a question, a feature request, let me know. Your feedback is what drives the project forward!<strong> </strong></p>
|
||||
<p><strong>Documentation</strong></p>
|
||||
<p>Features, tutorials & FAQ available at <a href="http://ngskintools.com/v2/" target="_blank">ngSkinTools official website</a>. </p>
|
||||
<p><strong>Contact in private</strong></p>
|
||||
<p>Use the <a href="http://ngskintools.com/contact/" target="_blank">online contact form</a> or email to <a href="mailto:support@ngskintools.com">support@ngskintools.com</a>.</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="helpdoc-version helpdoc-element">
|
||||
<div class="clear"></div>
|
||||
<h1 id="versionhistoryinfo">Version History</h1>
|
||||
<div>
|
||||
<table class="helpdoc-table" id="helpdoc-table-version">
|
||||
<colgroup>
|
||||
<col style="width:150px">
|
||||
<col style="width:680px">
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<th>Version Number</th>
|
||||
<th>Version Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.0.24
|
||||
</p>
|
||||
</td>
|
||||
<td style="white-space: pre-wrap;">2.0.23 (2021-Mar-12)
|
||||
* Fixed: stylus pressure is not updated during the stroke;
|
||||
* Fixed: Maya crashes when smoothing an empty layer with "adjust existing influences only";
|
||||
* Fixed: (regression) UI is not opening on macOS;
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.0.23
|
||||
</p>
|
||||
</td>
|
||||
<td style="white-space: pre-wrap;">2.0.23 (2021-Mar-10)
|
||||
* Added: adjustable brush size: don't reset to zero when changing brush size in the viewport.
|
||||
* Added: randomize influence colors in paint/display settings;
|
||||
* Added: layers on/off "eye" button in layers tree UI;
|
||||
* Fixed: ngSkinTools will not modify skinCluster's `normalizeWeights` value anymore; for performance boost, you still
|
||||
can disable skinCluster's normalization by setting `normalizeWeights=None`. In "normalizeWeights:interactive"
|
||||
skinCluster mode, Maya will no longer complain that "The weight total would have exceeded 1.0". ngSkinTools will try
|
||||
extra hard to normalize each vertex to a perfect 1.0;
|
||||
* Fixed: UI is not displayed correctly on high DPI displays when UI scaling is enabled in Maya;
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.0.22
|
||||
</p>
|
||||
</td>
|
||||
<td style="white-space: pre-wrap;">2.0.22 (2021-Feb-06)
|
||||
Added: convenience tool for adding influences to existing skin clusters. Select influences, target mesh and select “Tools | Add Influence”;
|
||||
Fixed: weights will now display properly when viewport option “use default material” is turned on;
|
||||
Added: (v1 feature) Limit max influences per vertex before writing to skin cluster;
|
||||
Added: (v1 feature) Prune small weights before writing to skin cluster.
|
||||
|
||||
2.0.21 (2021-Jan-11)
|
||||
Added: copy/paste vertex weights between different selections (tab “tools” - “copy component weights/paste average component weights”);
|
||||
Added: tool “fill transparency” - for all empty vertices in a layer, assign weights from closest non-empty vertex;
|
||||
Added: “duplicate layer” operation;
|
||||
Added: “Merge layers” operation: combine selected layers into one.
|
||||
|
||||
2.0.20 (2020-Dec-02)
|
||||
Fixed: Linux: crashing on startup
|
||||
|
||||
2.0.19 (2020-Nov-28)
|
||||
Added: influences mapping in mirror screen will now allow matching joints by DG connections; if symmetrical joints are linked between themselves with message connections, ngSkinTools will be able to leverage that information when mirroring weights;
|
||||
Added: symmetry mesh: an option to provide an alternative mesh for calculating vertex mapping for mirroring;
|
||||
Fixed: deleting visibility node can crash Maya sometimes, e.g. switching to component mode (F8) while paint tool is active
|
||||
|
||||
2.0.18 (2020-Nov-20)
|
||||
Added: “use all joints” option for “weights from closest joint” tool; few internal optimizations to speedup operation;
|
||||
Added: “weights from closest joint” option: create a new layer
|
||||
Fixed: “weights from closest joint”: the tool is only using joints as spots, but not as segments;
|
||||
Fixed: after “weights from closest joint” operation influences list is not refreshed;
|
||||
Fixed: “weights from closest joint”: “assign” button sometimes disabled;
|
||||
|
||||
2.0.17 (2020-Nov-19)
|
||||
Fixed: “resume in workspace” error while opening UI
|
||||
|
||||
2.0.16 (2020-Nov-15)
|
||||
Added: skin data will be compressed for ngSkinTools data nodes, which should substantially reduce file size for scenes with lots of skinning layers;
|
||||
Added: paint mode intensity sliders are now exponential: “smooth”, “add” and “sharpen” sliders will now be more precise for lower values, and “scale” mode will allow for more precision when setting high values.
|
||||
|
||||
2.0.15 (2020-Nov-10)
|
||||
Added: new “Set Weights” tab contains tools to apply weights to vertex/edge/polygon selection instead of painting.
|
||||
Added: a new option for smooth tool - “only adjust existing vertex influences”; when this is turned on, the smooth tool will prevent influences weights spreading across the surface
|
||||
Fixed: layer mirror effects correctly saved/loaded in files;
|
||||
Fixed: mask mirror effect was not correctly used by layer blending engine
|
||||
|
||||
2.0.14 (2020-Oct-04)
|
||||
Fixed: occasional crashes when using mirror effect on layers;
|
||||
Additional stability fixes.
|
||||
|
||||
2.0.13 (2020-Oct-04)
|
||||
Fixed: minor bug in 2.0.12 blocks UI from opening;
|
||||
|
||||
2.0.12 (2020-Oct-03)
|
||||
Added: option to view used influences in influences list;
|
||||
Added: hide “DQ weights” channel in influences list if skin cluster skinning method is not set to “Weight Blended”;
|
||||
|
||||
2.0.11 (2020-Oct-01)
|
||||
Fixed: broken Linux builds
|
||||
|
||||
2.0.10 (2020-Sep-26)
|
||||
Added: pressing “f” while painting focuses viewport camera to current paint target; for joints and other influences, the current joint pivot is used as camera interest point; when current paint target is a mask, viewport centers around painted values;
|
||||
Fixed: influence mapping UI error if some influences are no joints;
|
||||
|
||||
2.0.9 (2020-Sep-11)
|
||||
Fixed: undo paint crashing Maya;
|
||||
Fixed: incorrect brush behavior with multiple viewports open;
|
||||
Fixed: incorrect mesh display / VP2 transparency setting sensitive;
|
||||
Fixed: clearing selection while painting does not update the display of current mesh;</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div></body></html>
|
||||
@@ -1,158 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
ngSkinTools2 启动器
|
||||
用于从工具架快速启动 ngSkinTools2
|
||||
ngSkinTools2 Launcher
|
||||
Provides a simple interface to launch ngSkinTools2 from Maya shelf buttons
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
def get_maya_version():
|
||||
"""
|
||||
获取当前 Maya 版本号
|
||||
返回格式: '2023', '2024' 等
|
||||
"""
|
||||
try:
|
||||
from maya import cmds
|
||||
maya_version = cmds.about(version=True)
|
||||
# Maya 版本格式可能是 "2023" 或 "2023.1" 等,取主版本号
|
||||
return maya_version.split('.')[0]
|
||||
except Exception as e:
|
||||
print(f"Failed to get Maya version: {e}")
|
||||
return None
|
||||
|
||||
|
||||
def find_compatible_plugin_dir(base_dir, maya_version):
|
||||
"""
|
||||
查找兼容的插件目录
|
||||
优先使用完全匹配的版本,如果没有则向下查找最接近的版本
|
||||
|
||||
Args:
|
||||
base_dir: 插件基础目录 (plug-ins/)
|
||||
maya_version: Maya 版本号字符串,如 '2023'
|
||||
|
||||
Returns:
|
||||
插件目录路径,如果找不到则返回 None
|
||||
"""
|
||||
if not maya_version:
|
||||
return None
|
||||
|
||||
try:
|
||||
maya_ver_int = int(maya_version)
|
||||
except ValueError:
|
||||
print(f"Invalid Maya version format: {maya_version}")
|
||||
return None
|
||||
|
||||
# 列出所有可用的插件版本目录
|
||||
available_versions = []
|
||||
if os.path.exists(base_dir):
|
||||
for item in os.listdir(base_dir):
|
||||
item_path = os.path.join(base_dir, item)
|
||||
if os.path.isdir(item_path):
|
||||
try:
|
||||
ver_int = int(item)
|
||||
available_versions.append((ver_int, item_path))
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
if not available_versions:
|
||||
return None
|
||||
|
||||
# 按版本号排序
|
||||
available_versions.sort(reverse=True)
|
||||
|
||||
# 首先尝试完全匹配
|
||||
for ver, path in available_versions:
|
||||
if ver == maya_ver_int:
|
||||
print(f"Found exact match plugin for Maya {maya_version}: {path}")
|
||||
return path
|
||||
|
||||
# 如果没有完全匹配,使用小于等于当前版本的最高版本
|
||||
for ver, path in available_versions:
|
||||
if ver <= maya_ver_int:
|
||||
print(f"Using compatible plugin for Maya {maya_version}: {path} (version {ver})")
|
||||
return path
|
||||
|
||||
# 如果当前版本比所有可用版本都旧,使用最旧的版本
|
||||
oldest_ver, oldest_path = available_versions[-1]
|
||||
print(f"Warning: Maya {maya_version} is older than available plugins. Using oldest: {oldest_path} (version {oldest_ver})")
|
||||
return oldest_path
|
||||
|
||||
|
||||
def LaunchNgSkinTools():
|
||||
"""
|
||||
启动 ngSkinTools2 主界面
|
||||
自动检测 Maya 版本并加载对应的插件
|
||||
Launch ngSkinTools2 main UI window
|
||||
|
||||
This function handles two scenarios:
|
||||
1. If module alias exists (ngSkinTools2 -> rigging_tools.ngskintools2), use it
|
||||
2. If not, create the alias on-the-fly and then launch
|
||||
"""
|
||||
try:
|
||||
from maya import cmds, mel
|
||||
|
||||
# 获取当前 Maya 版本
|
||||
maya_version = get_maya_version()
|
||||
if not maya_version:
|
||||
print("Warning: Could not determine Maya version, will try to continue anyway")
|
||||
else:
|
||||
print(f"Detected Maya version: {maya_version}")
|
||||
|
||||
# 将当前目录添加到 Python 路径,并使用别名
|
||||
# 这样 ngSkinTools2 内部的 "from ngSkinTools2.ui" 就能找到模块
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
parent_dir = os.path.dirname(current_dir)
|
||||
|
||||
# 添加父目录到路径
|
||||
if parent_dir not in sys.path:
|
||||
sys.path.insert(0, parent_dir)
|
||||
|
||||
# 添加当前目录到路径,作为 ngSkinTools2 模块
|
||||
if current_dir not in sys.path:
|
||||
sys.path.insert(0, current_dir)
|
||||
|
||||
# 在 sys.modules 中创建别名,让 ngSkinTools2 指向 ngskintools2
|
||||
import rigging_tools.ngskintools2 as ngskintools2_module
|
||||
sys.modules['ngSkinTools2'] = ngskintools2_module
|
||||
|
||||
# 查找并添加插件路径
|
||||
# 根据 Maya 版本自动选择对应的插件目录
|
||||
plugin_base_dir = os.path.join(current_dir, 'plug-ins')
|
||||
plugin_dir = find_compatible_plugin_dir(plugin_base_dir, maya_version)
|
||||
|
||||
if plugin_dir and os.path.exists(plugin_dir):
|
||||
# 添加插件路径
|
||||
current_plugin_path = os.environ.get('MAYA_PLUG_IN_PATH', '')
|
||||
if plugin_dir not in current_plugin_path:
|
||||
os.environ['MAYA_PLUG_IN_PATH'] = plugin_dir + os.pathsep + current_plugin_path
|
||||
|
||||
# 加载插件
|
||||
# Check if module alias already exists
|
||||
if 'ngSkinTools2' not in sys.modules:
|
||||
# Create the alias on-the-fly
|
||||
try:
|
||||
# 检查插件是否已加载
|
||||
if not cmds.pluginInfo('ngSkinTools2', query=True, loaded=True):
|
||||
cmds.loadPlugin(os.path.join(plugin_dir, 'ngSkinTools2.mll'))
|
||||
print(f"ngSkinTools2 plugin loaded successfully from {plugin_dir}")
|
||||
else:
|
||||
print(f"ngSkinTools2 plugin already loaded")
|
||||
except RuntimeError:
|
||||
# 插件不存在,尝试加载
|
||||
try:
|
||||
cmds.loadPlugin(os.path.join(plugin_dir, 'ngSkinTools2.mll'))
|
||||
print(f"ngSkinTools2 plugin loaded successfully from {plugin_dir}")
|
||||
except Exception as plugin_error:
|
||||
print(f"Warning: Could not load ngSkinTools2 plugin: {plugin_error}")
|
||||
except Exception as plugin_error:
|
||||
print(f"Warning: Could not load ngSkinTools2 plugin: {plugin_error}")
|
||||
else:
|
||||
print(f"Warning: Plugin directory not found: {plugin_dir}")
|
||||
import rigging_tools.ngskintools2
|
||||
sys.modules['ngSkinTools2'] = rigging_tools.ngskintools2
|
||||
print("Created ngSkinTools2 module alias")
|
||||
except ImportError as import_err:
|
||||
print(f"Error: Failed to import rigging_tools.ngskintools2 - {import_err}")
|
||||
print("Please ensure the ngskintools2 directory is in the correct location")
|
||||
return
|
||||
|
||||
# 现在可以导入并打开 UI
|
||||
from rigging_tools.ngskintools2 import open_ui
|
||||
# Now import and launch
|
||||
from ngSkinTools2 import open_ui
|
||||
open_ui()
|
||||
print("ngSkinTools2 UI opened successfully")
|
||||
print("ngSkinTools2 launched successfully")
|
||||
|
||||
except ImportError as e:
|
||||
print(f"Error: Failed to import ngSkinTools2 - {e}")
|
||||
print("Please ensure ngSkinTools2 is properly installed")
|
||||
except Exception as e:
|
||||
print(f"Failed to open ngSkinTools2: {e}")
|
||||
print(f"Error: Failed to launch ngSkinTools2 - {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
LaunchNgSkinTools()
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
ngSkinTools Software License Agreement.
|
||||
|
||||
|
||||
This is a legal agreement between you and ngSkinTools author (Viktoras Makauskas) covering your use of
|
||||
ngSkinTools (the "Software").
|
||||
|
||||
1) ngSkinTools is provided as freeware.
|
||||
|
||||
2) ngSkinTools Software is owned by Viktoras Makauskas and is protected by copyright laws and international
|
||||
treaty provisions. Therefore, you must treat the Software like any other copyrighted material.
|
||||
|
||||
3) You may not distribute, rent, sub-license or otherwise make available to others the Software or
|
||||
documentation or copies thereof, except as expressly permitted in this License without prior written consent
|
||||
from ngSkinTools author (Viktoras Makauskas). In the case of an authorized transfer, the transferee must agree
|
||||
to be bound by the terms and conditions of this License Agreement.
|
||||
|
||||
4) You may not remove any proprietary notices, labels, trademarks on the Software or documentation. You may not
|
||||
modify, de-compile, disassemble or reverse engineer the Software.
|
||||
|
||||
5) Limited warranty: ngSkinTools software and documentation are "as is" without any warranty as to their
|
||||
performance, merchantability or fitness for any particular purpose. The licensee assumes the entire risk as to
|
||||
the quality and performance of the software. In no event shall ngSkinTools author or anyone else who has been
|
||||
involved in the creation, development, production, or delivery of this software be liable for any direct,
|
||||
incidental or consequential damages, such as, but not limited to, loss of anticipated profits, benefits, use,
|
||||
or data resulting from the use of this software, or arising out of any breach of warranty.
|
||||
|
||||
Copyright (C) 2009-2020 Viktoras Makauskas
|
||||
|
||||
http://www.ngskintools.com
|
||||
support@ngskintools.com
|
||||
|
||||
All rights reserved.
|
||||
@@ -22,4 +22,4 @@ class ObservableValue(Object):
|
||||
if default != Undefined:
|
||||
return default
|
||||
|
||||
raise Exception("using observable value before setting it")
|
||||
raise Exception("在设置之前使用可观察值")
|
||||
|
||||
@@ -24,7 +24,7 @@ def action_copy_cut(session, parent, cut):
|
||||
operation(session.state.currentLayer.layer, influences)
|
||||
|
||||
operation_name = "Cut" if cut else "Copy"
|
||||
result = actions.define_action(parent, operation_name + " weights to clipboard", callback=cut_copy_callback)
|
||||
result = actions.define_action(parent, operation_name + " 将权重复制到剪贴板", callback=cut_copy_callback) # 将权重复制到剪贴板 weights to clipboard
|
||||
|
||||
@signal.on(session.events.currentLayerChanged, session.events.currentInfluenceChanged, qtParent=parent)
|
||||
def on_selection_changed():
|
||||
@@ -49,13 +49,13 @@ def action_paste(session, parent, operation):
|
||||
api.paste_weights(session.state.currentLayer.layer, operation, influences=influences)
|
||||
|
||||
labels = {
|
||||
PasteOperation.add: 'Paste weights (add to existing)',
|
||||
PasteOperation.subtract: 'Paste weight (subtract from existing)',
|
||||
PasteOperation.replace: 'Paste weights (replace existing)',
|
||||
PasteOperation.add: '粘贴权重(添加到现有)',
|
||||
PasteOperation.subtract: '粘贴权重(从现有值中减去)',
|
||||
PasteOperation.replace: '粘贴权重(替换现有)',
|
||||
}
|
||||
|
||||
result = actions.define_action(parent, labels[operation], callback=paste_callback)
|
||||
result.setToolTip("Paste previously copied weights from clipboard")
|
||||
result.setToolTip("从剪贴板粘贴先前复制的权重")
|
||||
|
||||
@signal.on(session.events.currentLayerChanged)
|
||||
def on_selection_changed():
|
||||
|
||||
@@ -31,7 +31,7 @@ def buildAction_export(session, parent):
|
||||
|
||||
result = actions.define_action(
|
||||
parent,
|
||||
"Export Layers to Json...",
|
||||
"导出图层...",
|
||||
callback=export_callback,
|
||||
tooltip="Save layer info to external file, suitable for importing weights to different scene/mesh",
|
||||
)
|
||||
@@ -79,7 +79,7 @@ def buildAction_import(session, parent, file_dialog_func=None):
|
||||
t.customize_callback = transfer_dialog
|
||||
t.execute()
|
||||
|
||||
result = actions.define_action(parent, "Import Layers from Json...", callback=import_callback, tooltip="Load previously exported weights")
|
||||
result = actions.define_action(parent, "导入图层...", callback=import_callback, tooltip="Load previously exported weights")
|
||||
|
||||
@signal.on(session.events.targetChanged, qtParent=parent)
|
||||
def update():
|
||||
|
||||
@@ -28,8 +28,8 @@ def build_action_import_v1(session, parent):
|
||||
update_state()
|
||||
session.events.targetChanged.emitIfChanged()
|
||||
|
||||
result = actions.define_action(parent, "Convert From v1.0 Layers", callback=do_convert)
|
||||
result.setToolTip("Convert skinning layers from previous version of ngSkinTools; after completing this action, v1 nodes will be deleted.")
|
||||
result = actions.define_action(parent, "从v1.0图层转换", callback=do_convert)
|
||||
result.setToolTip("“转化旧版ngSkinTools的图层;完成此操作后,v1节点将被删除。")
|
||||
|
||||
@signal.on(session.events.targetChanged)
|
||||
def update_state():
|
||||
|
||||
@@ -28,7 +28,7 @@ def initializeLayers(createFirstLayer=True):
|
||||
layers = ngSkinTools2.api.init_layers(target)
|
||||
with ngSkinTools2.api.suspend_updates(target):
|
||||
if createFirstLayer:
|
||||
layer = layers.add("Base weights")
|
||||
layer = layers.add("基础权重") #Base weights
|
||||
layer.set_current()
|
||||
Mirror(target).set_mirror_config(config.mirrorInfluencesDefaults)
|
||||
|
||||
@@ -36,7 +36,7 @@ def initializeLayers(createFirstLayer=True):
|
||||
|
||||
if ngSkinTools2.api.is_slow_mode_skin_cluster(target):
|
||||
dialogs.info(
|
||||
"ngSkinTools switched to slow maya API for setting skin cluster weights for this skinCluster, to workaround a Maya bug when skinCluster uses dg nodes as inputs"
|
||||
"切换为设置皮肤集群权重,以解决 Maya皮肤集群使用装点作为输入时的错误。"
|
||||
)
|
||||
|
||||
|
||||
@@ -73,15 +73,15 @@ def build_action_initialize_layers(session, parent):
|
||||
def do_initialize():
|
||||
if import_v1_actions.can_import(session):
|
||||
q = (
|
||||
"Skinning layers from previous version of ngSkinTools are present on this mesh. This operation will initialize "
|
||||
"skinning layers from scratch, discarding previous layers information. Do you want to continue?"
|
||||
"来自旧版 ngSkinTools的皮肤层存在于此网格上。此操作将初始化"
|
||||
"从头开始剥离图层,丢弃之前的图层信息。您要继续吗?"
|
||||
)
|
||||
if not dialogs.yesNo(q):
|
||||
return
|
||||
|
||||
initializeLayers()
|
||||
|
||||
result = actions.define_action(parent, "Initialize Skinning Layers", callback=do_initialize)
|
||||
result = actions.define_action(parent, "初始化蒙皮层", callback=do_initialize)
|
||||
|
||||
@signal.on(session.events.nodeSelectionChanged)
|
||||
def update():
|
||||
@@ -95,7 +95,7 @@ def build_action_initialize_layers(session, parent):
|
||||
def buildAction_createLayer(session, parent):
|
||||
from ngSkinTools2.ui import actions
|
||||
|
||||
result = actions.define_action(parent, "Create Layer", callback=addLayer, icon=":/newLayerEmpty.png", shortcut=QtCore.Qt.Key_Insert)
|
||||
result = actions.define_action(parent, "创建图层", callback=addLayer, icon=":/newLayerEmpty.png", shortcut=QtCore.Qt.Key_Insert)
|
||||
|
||||
@signal.on(session.events.targetChanged)
|
||||
def update_to_target():
|
||||
@@ -109,7 +109,7 @@ def buildAction_createLayer(session, parent):
|
||||
def buildAction_deleteLayer(session, parent):
|
||||
from ngSkinTools2.ui import actions
|
||||
|
||||
result = actions.define_action(parent, "Delete Layer", callback=deleteSelectedLayers, shortcut=QtCore.Qt.Key_Delete)
|
||||
result = actions.define_action(parent, "删除图层", callback=deleteSelectedLayers, shortcut=QtCore.Qt.Key_Delete)
|
||||
|
||||
@signal.on(session.context.selected_layers.changed, session.events.targetChanged, qtParent=parent)
|
||||
def update_to_target():
|
||||
@@ -126,12 +126,12 @@ def setCurrentLayer(layer):
|
||||
:type layer: ngSkinTools2.api.layers.Layer
|
||||
"""
|
||||
if not session.active():
|
||||
logger.info("didn't set current layer: no session")
|
||||
logger.info("未设置当前图层:没有会话")
|
||||
|
||||
if not session.state.layersAvailable:
|
||||
logger.info("didn't set current layer: layers not enabled")
|
||||
logger.info("未设置当前图层:图层未启用")
|
||||
|
||||
logger.info("setting current layer to %r on %r", layer, session.state.selectedSkinCluster)
|
||||
logger.info("将当前图层设置为 %r on %r", layer, session.state.selectedSkinCluster)
|
||||
layer.set_current()
|
||||
session.events.currentLayerChanged.emitIfChanged()
|
||||
|
||||
@@ -158,7 +158,7 @@ def deleteSelectedLayers():
|
||||
|
||||
|
||||
class ToggleEnabledAction(Action):
|
||||
name = "Enabled"
|
||||
name = "启用图层" #Enabled
|
||||
checkable = True
|
||||
|
||||
def __init__(self, session):
|
||||
@@ -192,7 +192,7 @@ class ToggleEnabledAction(Action):
|
||||
for i in selected_layers:
|
||||
i.enabled = enabled
|
||||
|
||||
logger.info("layers toggled: %r", selected_layers)
|
||||
logger.info("图层已切换: %r", selected_layers)
|
||||
|
||||
session.events.layerListChanged.emitIfChanged()
|
||||
|
||||
@@ -209,8 +209,8 @@ def build_action_randomize_influences_colors(session, parent):
|
||||
:type session: ngSkinTools2.api.session.Session
|
||||
"""
|
||||
|
||||
result = QAction("Randomize colors", parent)
|
||||
result.setToolTip("Choose random colors for each influence, selecting from Maya's pallete of indexed colors")
|
||||
result = QAction("随机颜色", parent)
|
||||
result.setToolTip("为每个影响选择随机颜色,从Maya的索引色板中选择。")
|
||||
|
||||
def color_filter(c):
|
||||
brightness = c[0] * c[0] + c[1] * c[1] + c[2] * c[2]
|
||||
|
||||
@@ -9,8 +9,8 @@ log = getLogger("operations/paint")
|
||||
|
||||
|
||||
class FloodAction(Action):
|
||||
name = "Flood"
|
||||
tooltip = "Apply current brush to whole selection"
|
||||
name = "填充" # Flood
|
||||
tooltip = "将当前画笔应用于整个选择区域"
|
||||
|
||||
def run(self):
|
||||
session.paint_tool.flood(self.session.state.currentLayer.layer, influences=self.session.state.currentLayer.layer.paint_targets)
|
||||
@@ -28,8 +28,8 @@ class FloodAction(Action):
|
||||
|
||||
|
||||
class PaintAction(Action):
|
||||
name = "Paint"
|
||||
tooltip = "Toggle paint tool"
|
||||
name = "绘制" # Paint
|
||||
tooltip = "切换绘制工具"
|
||||
checkable = True
|
||||
|
||||
def run(self):
|
||||
|
||||
@@ -43,14 +43,14 @@ def list_custom_nodes_for_meshes(meshes):
|
||||
return list(itertools.chain.from_iterable([list_custom_nodes_for_mesh(i) for i in meshes]))
|
||||
|
||||
|
||||
message_scene_noCustomNodes = 'Scene does not contain any custom ngSkinTools nodes.'
|
||||
message_selection_noCustomNodes = 'Selection does not contain any custom ngSkinTools nodes.'
|
||||
message_scene_noCustomNodes = '场景中不包含任何自定义的ngSkinTools节点。'
|
||||
message_selection_noCustomNodes = '选择不包含任何自定义ngskinTools节点。'
|
||||
message_scene_warning = (
|
||||
'This command deletes all custom ngSkinTools nodes. Skin weights ' 'will be preserved, but all layer data will be lost. Do you want to continue?'
|
||||
'此命令删除所有自定义ngSkinTools节点。蒙皮权重“”将被保留,但所有图层数据都将丢失。您想继续吗?'
|
||||
)
|
||||
message_selection_warning = (
|
||||
'This command deletes custom ngSkinTools nodes for selection. Skin weights '
|
||||
'will be preserved, but all layer data will be lost. Do you want to continue?'
|
||||
'此命令删除要选择的自定义ngSkinTools节点。皮肤重量'
|
||||
'将被保留,但所有图层数据都将丢失。您想继续吗?'
|
||||
)
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ def remove_custom_nodes(interactive=False, session=None, meshes=None):
|
||||
|
||||
if PaintTool.is_painting():
|
||||
# make sure that painting is canceled to restore mesh display etc
|
||||
cmds.setToolTo("Move")
|
||||
cmds.setToolTo("移除") # Move
|
||||
|
||||
if session is not None:
|
||||
session.events.targetChanged.emitIfChanged()
|
||||
|
||||
@@ -54,7 +54,7 @@ def create_action__from_closest_joint(parent, session):
|
||||
if not options.all_influences():
|
||||
influences = layer.paint_targets
|
||||
if not influences:
|
||||
dialogs.info("Select one or more influences in Influences list")
|
||||
dialogs.info("在影响列表中选择一个或多个影响")
|
||||
return
|
||||
|
||||
if options.create_new_layer():
|
||||
@@ -77,8 +77,8 @@ def create_action__from_closest_joint(parent, session):
|
||||
__create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Assign From Closest Joint",
|
||||
action_tooltip="Assign 1.0 weight for closest influence per each vertex in selected layer",
|
||||
action_name=u"从最近的关节分配",
|
||||
action_tooltip="为选定层中每个顶点的最近影响分配权重1.0",
|
||||
exec_handler=exec_handler,
|
||||
),
|
||||
options,
|
||||
@@ -105,8 +105,8 @@ def create_action__unify_weights(parent, session):
|
||||
__create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Unify Weights",
|
||||
action_tooltip="For selected vertices, make verts the same for all verts",
|
||||
action_name=u"统一权重", # Unify Weights
|
||||
action_tooltip="对于选定的顶点,使所有顶点相同。", #对于选定的顶点,使所有顶点相同。
|
||||
exec_handler=exec_handler,
|
||||
),
|
||||
options,
|
||||
@@ -130,8 +130,8 @@ def create_action__merge_layers(parent, session):
|
||||
return __create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Merge",
|
||||
action_tooltip="Merge contents of this layer into underlying layer. Pre-effects weights will be used for this",
|
||||
action_name=u"合并", # Merge
|
||||
action_tooltip="将本层的元素合并到底层。预效果权重将用于此。",
|
||||
exec_handler=exec_handler,
|
||||
enabled_handler=enabled_handler,
|
||||
)
|
||||
@@ -155,8 +155,8 @@ def create_action__duplicate_layer(parent, session):
|
||||
return __create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Duplicate",
|
||||
action_tooltip="Duplicate selected layer(s)",
|
||||
action_name=u"复制",
|
||||
action_tooltip="复制选择的图层(多选)",
|
||||
exec_handler=exec_handler,
|
||||
)
|
||||
|
||||
@@ -176,8 +176,8 @@ def create_action__fill_transparency(parent, session):
|
||||
return __create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Fill Transparency",
|
||||
action_tooltip="All transparent vertices in the selected layer(s) receive weights from their closest non-empty neighbour vertex",
|
||||
action_name=u"填充透明度",
|
||||
action_tooltip="所选图层中的所有透明顶点接收其最近非空邻接顶点的权重,",
|
||||
exec_handler=exec_handler,
|
||||
)
|
||||
|
||||
@@ -195,8 +195,8 @@ def create_action__copy_component_weights(parent, session):
|
||||
return __create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Copy Component Weights",
|
||||
action_tooltip="Store components weights in memory for further component-based paste actions",
|
||||
action_name=u"复制组件权重",
|
||||
action_tooltip="将组件权重存储在内存中,以便进行进一步的基于组件的粘贴操作",
|
||||
exec_handler=exec_handler,
|
||||
)
|
||||
|
||||
@@ -214,8 +214,8 @@ def create_action__paste_average_component_weight(parent, session):
|
||||
return __create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Paste Average Component Weight",
|
||||
action_tooltip="Compute average of copied component weights and set that value to currently selected components",
|
||||
action_name=u"粘贴平均组件权重",
|
||||
action_tooltip="计算复制的组件重量的平均值,并将该值设置为当前选定的组件",
|
||||
exec_handler=exec_handler,
|
||||
)
|
||||
|
||||
@@ -229,7 +229,7 @@ def create_action__add_influences(parent, session):
|
||||
def exec_handler():
|
||||
selection = cmds.ls(sl=True, l=True)
|
||||
if len(selection) < 2:
|
||||
logger.info("invalid selection: %s", selection)
|
||||
logger.info("无效选择: %s", selection)
|
||||
return
|
||||
api.add_influences(selection[:-1], selection[-1])
|
||||
cmds.select(selection[-1])
|
||||
@@ -238,8 +238,8 @@ def create_action__add_influences(parent, session):
|
||||
return __create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Add Influences",
|
||||
action_tooltip="Add selected influences to current skin cluster.",
|
||||
action_name=u"增加影响",
|
||||
action_tooltip="将选定的影响添加到当前皮肤集群。",
|
||||
exec_handler=exec_handler,
|
||||
)
|
||||
|
||||
@@ -289,7 +289,7 @@ def create_action__select_affected_vertices(parent, session):
|
||||
return __create_tool_action__(
|
||||
parent,
|
||||
session,
|
||||
action_name=u"Select Affected Vertices",
|
||||
action_tooltip="Select vertices that have non-zero weight for current influence.",
|
||||
action_name=u"选择受影响的顶点",
|
||||
action_tooltip="选择当前影响中权重不为要的顶点。",
|
||||
exec_handler=exec_handler,
|
||||
)
|
||||
|
||||
@@ -12,10 +12,10 @@ def website_base_url():
|
||||
|
||||
class WebsiteLinksActions(Object):
|
||||
def __init__(self, parent):
|
||||
self.api_root = make_documentation_action(parent, "API Documentation", "/v2/api")
|
||||
self.user_guide = make_documentation_action(parent, "User Guide", "/v2/")
|
||||
self.changelog = make_documentation_action(parent, "Change Log", "/v2/changelog", icon=None)
|
||||
self.contact = make_documentation_action(parent, "Contact", "/contact/", icon=None)
|
||||
self.api_root = make_documentation_action(parent, "API 文档", "/v2/api")
|
||||
self.user_guide = make_documentation_action(parent, "用户指南", "/v2/")
|
||||
self.changelog = make_documentation_action(parent, "更新日志", "/v2/changelog", icon=None)
|
||||
self.contact = make_documentation_action(parent, "联系", "/contact/", icon=None)
|
||||
|
||||
|
||||
def make_documentation_action(parent, title, url, icon=":/help.png"):
|
||||
|
||||
@@ -24,8 +24,8 @@ class SignalQueue(Object):
|
||||
|
||||
def emit(self, handler):
|
||||
if len(self.queue) > self.max_length:
|
||||
log.error("queue max length reached: emitting too many events?")
|
||||
raise Exception("queue max length reached: emitting too many events?")
|
||||
log.error("队列最大长度已达到:发出的事件过多?")
|
||||
raise Exception("队列最大长度已达到:正在发出太多事件?")
|
||||
|
||||
should_start = len(self.queue) == 0
|
||||
|
||||
@@ -53,7 +53,7 @@ class SignalQueue(Object):
|
||||
current_handler += 1
|
||||
|
||||
if len(self.queue) > 50:
|
||||
log.info("handler queue finished with %d items", len(self.queue))
|
||||
log.info("处理器队列完成,共 %d 项", len(self.queue))
|
||||
self.queue = []
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class Signal(Object):
|
||||
|
||||
def __init__(self, name):
|
||||
if name is None:
|
||||
raise Exception("need name for debug purposes later")
|
||||
raise Exception("需要稍后用于调试目的的名称")
|
||||
self.name = name
|
||||
self.handlers = []
|
||||
self.executing = False
|
||||
|
||||
@@ -19,7 +19,7 @@ def show(parent):
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addStretch()
|
||||
layout.addWidget(QtWidgets.QLabel("<h1>ngSkinTools</h1>"))
|
||||
layout.addWidget(QtWidgets.QLabel("Version {0}".format(version.pluginVersion())))
|
||||
layout.addWidget(QtWidgets.QLabel("当前版本 {0}".format(version.pluginVersion())))
|
||||
layout.addWidget(QtWidgets.QLabel(version.COPYRIGHT))
|
||||
|
||||
url = QtWidgets.QLabel('<a href="{0}" style="color: #007bff;">{0}</a>'.format(version.PRODUCT_URL))
|
||||
@@ -65,7 +65,7 @@ def show(parent):
|
||||
def buttonsRow(window):
|
||||
layout = QtWidgets.QHBoxLayout()
|
||||
layout.addStretch()
|
||||
btnClose = QtWidgets.QPushButton("Close")
|
||||
btnClose = QtWidgets.QPushButton("退出")
|
||||
btnClose.setMinimumWidth(100 * scale_multiplier)
|
||||
layout.addWidget(btnClose)
|
||||
layout.setContentsMargins(20 * scale_multiplier, 15 * scale_multiplier, 20 * scale_multiplier, 15 * scale_multiplier)
|
||||
@@ -76,7 +76,7 @@ def show(parent):
|
||||
window = QtWidgets.QWidget(parent, Qt.Window | Qt.WindowTitleHint | Qt.CustomizeWindowHint)
|
||||
window.resize(600 * scale_multiplier, 500 * scale_multiplier)
|
||||
window.setAttribute(Qt.WA_DeleteOnClose)
|
||||
window.setWindowTitle("About ngSkinTools")
|
||||
window.setWindowTitle("关于 ngSkinTools")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
window.setLayout(layout)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
@@ -35,7 +35,7 @@ def build_action_delete_custom_nodes_for_selection(parent, session):
|
||||
|
||||
result = define_action(
|
||||
parent,
|
||||
"Delete Custom Nodes For Selection",
|
||||
"删除选中网格的Ng节点",
|
||||
callback=lambda: removeLayerData.remove_custom_nodes_from_selection(interactive=True, session=session),
|
||||
)
|
||||
|
||||
@@ -86,7 +86,7 @@ class Actions(Object):
|
||||
self.toolsUnifyWeights, self.toolsUnifyWeightsOptions = tools.create_action__unify_weights(parent, session)
|
||||
|
||||
self.toolsDeleteCustomNodes = define_action(
|
||||
parent, "Delete All Custom Nodes", callback=lambda: removeLayerData.remove_custom_nodes(interactive=True, session=session)
|
||||
parent, "删除所有网格的Ng节点", callback=lambda: removeLayerData.remove_custom_nodes(interactive=True, session=session)
|
||||
)
|
||||
|
||||
self.toolsDeleteCustomNodesOnSelection = build_action_delete_custom_nodes_for_selection(parent, session)
|
||||
@@ -135,10 +135,10 @@ class Actions(Object):
|
||||
context.addAction(self.toggle_layer_enabled)
|
||||
|
||||
def addInfluencesActions(self, context):
|
||||
context.addAction(self.separator(context, "Actions"))
|
||||
context.addAction(self.separator(context, "动作"))
|
||||
context.addAction(self.toolsAssignFromClosestJointSelectedInfluences)
|
||||
context.addAction(self.select_affected_vertices)
|
||||
context.addAction(self.separator(context, "Clipboard"))
|
||||
context.addAction(self.separator(context, "剪贴板"))
|
||||
context.addAction(self.cut_influences)
|
||||
context.addAction(self.copy_influences)
|
||||
context.addAction(self.paste_weights)
|
||||
|
||||
@@ -36,7 +36,7 @@ def open_as_dialog(parent, matcher, result_callback):
|
||||
window.close()
|
||||
|
||||
def save_defaults():
|
||||
if not yesNo("Save current settings as default?"):
|
||||
if not yesNo("将当前设置保存为默认设置?"):
|
||||
return
|
||||
config.mirrorInfluencesDefaults = matcher.config.as_json()
|
||||
|
||||
@@ -47,18 +47,18 @@ def open_as_dialog(parent, matcher, result_callback):
|
||||
|
||||
return widgets.button_row(
|
||||
[
|
||||
("Apply", apply),
|
||||
("Cancel", window.close),
|
||||
("应用", apply),
|
||||
("取消", window.close),
|
||||
],
|
||||
side_menu=[
|
||||
("Save As Default", save_defaults),
|
||||
("Load Defaults", load_defaults),
|
||||
("储存为默认值", save_defaults),
|
||||
("加载默认值", load_defaults),
|
||||
],
|
||||
)
|
||||
|
||||
window = QtWidgets.QDialog(parent)
|
||||
cleanup.registerCleanupHandler(window.close)
|
||||
window.setWindowTitle("Influence Mirror Mapping")
|
||||
window.setWindowTitle("影响镜像映射")
|
||||
window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
window.resize(720 * scale_multiplier, 500 * scale_multiplier)
|
||||
window.setLayout(QtWidgets.QVBoxLayout())
|
||||
@@ -102,10 +102,10 @@ def build_ui(parent, matcher):
|
||||
split_path = path.rsplit("|", 1)
|
||||
parent_path, name = split_path if len(split_path) == 2 else ["", split_path[0]]
|
||||
|
||||
item = QtWidgets.QTreeWidgetItem([name, '-', '(not in skin cluster)' if is_intermediate else '?'])
|
||||
item = QtWidgets.QTreeWidgetItem([name, '-', '(不在皮肤簇中)' if is_intermediate else '?'])
|
||||
tree_items[path] = item
|
||||
|
||||
parent_item = None if parent_path == "" else find_item(parent_path, True)
|
||||
parent_item = None if parent_path is "" else find_item(parent_path, True)
|
||||
|
||||
if parent_item is not None:
|
||||
parent_item.addChild(item)
|
||||
@@ -142,7 +142,7 @@ def build_ui(parent, matcher):
|
||||
def pattern():
|
||||
result = QtWidgets.QTableWidget()
|
||||
result.setColumnCount(2)
|
||||
result.setHorizontalHeaderLabels(["Pattern", "Opposite"] if mirror_mode else ["Source", "Destination"])
|
||||
result.setHorizontalHeaderLabels(["左", "右"] if mirror_mode else ["来源", "目标"])
|
||||
result.setEditTriggers(QtWidgets.QTableWidget.AllEditTriggers)
|
||||
|
||||
result.verticalHeader().setVisible(False)
|
||||
@@ -209,12 +209,12 @@ def build_ui(parent, matcher):
|
||||
|
||||
def automaticRules():
|
||||
form = QtWidgets.QFormLayout()
|
||||
use_joint_names = QtWidgets.QCheckBox("Match by joint name")
|
||||
use_joint_names = QtWidgets.QCheckBox("匹配骨骼名称")
|
||||
naming_patterns = pattern()
|
||||
use_position = QtWidgets.QCheckBox("Match by position")
|
||||
use_position = QtWidgets.QCheckBox("匹配位置")
|
||||
tolerance_scroll = tolerance()
|
||||
use_joint_labels = QtWidgets.QCheckBox("Match by joint label")
|
||||
use_dg_links = QtWidgets.QCheckBox("Match by dependency graph links")
|
||||
use_joint_labels = QtWidgets.QCheckBox("匹配骨骼标签")
|
||||
use_dg_links = QtWidgets.QCheckBox("匹配依存关系图连接")
|
||||
|
||||
def update_enabled_disabled():
|
||||
def enable_form_row(form_item, e):
|
||||
@@ -260,27 +260,27 @@ def build_ui(parent, matcher):
|
||||
use_dg_links.setChecked(matcher.config.use_dg_link_matching)
|
||||
update_enabled_disabled()
|
||||
|
||||
g = QtWidgets.QGroupBox("Rules")
|
||||
g = QtWidgets.QGroupBox("规则")
|
||||
g.setLayout(form)
|
||||
form.addRow(use_dg_links)
|
||||
form.addRow("Attribute name:", dg_attribute)
|
||||
form.addRow("属性名称:", dg_attribute)
|
||||
form.addRow(use_joint_labels)
|
||||
form.addRow(use_joint_names)
|
||||
form.addRow("Naming scheme:", naming_patterns)
|
||||
form.addRow("命名方案:", naming_patterns)
|
||||
form.addRow(use_position)
|
||||
form.addRow("Position tolerance:", tolerance_scroll.layout())
|
||||
form.addRow("位置容差:", tolerance_scroll.layout())
|
||||
|
||||
update_values()
|
||||
return g
|
||||
|
||||
def scriptedRules():
|
||||
g = QtWidgets.QGroupBox("Scripted rules")
|
||||
g = QtWidgets.QGroupBox("脚本规则")
|
||||
g.setLayout(QtWidgets.QVBoxLayout())
|
||||
g.layout().addWidget(QtWidgets.QLabel("TODO"))
|
||||
return g
|
||||
|
||||
def manualRules():
|
||||
g = QtWidgets.QGroupBox("Manual overrides")
|
||||
g = QtWidgets.QGroupBox("手动覆盖")
|
||||
g.setLayout(QtWidgets.QVBoxLayout())
|
||||
g.layout().addWidget(QtWidgets.QLabel("TODO"))
|
||||
return g
|
||||
@@ -302,7 +302,7 @@ def build_ui(parent, matcher):
|
||||
def createMappingView():
|
||||
view = QtWidgets.QTreeWidget()
|
||||
view.setColumnCount(3)
|
||||
view.setHeaderLabels(["Source", "Destination", "Matched by rule"])
|
||||
view.setHeaderLabels(["来源", "目标", "按规则匹配"])
|
||||
view.setIndentation(7)
|
||||
view.setExpandsOnDoubleClick(False)
|
||||
|
||||
@@ -316,14 +316,14 @@ def build_ui(parent, matcher):
|
||||
:type mapping: dict[InfluenceInfo, InfluenceInfo]
|
||||
"""
|
||||
for treeItem in list(usedItems.values()):
|
||||
treeItem.setText(1, "(not matched)")
|
||||
treeItem.setText(1, "(不匹配)")
|
||||
treeItem.setText(2, "")
|
||||
|
||||
for k, v in list(mapping.items()):
|
||||
treeItem = usedItems.get(k.path_name(), None)
|
||||
if treeItem is None:
|
||||
continue
|
||||
treeItem.setText(1, "(self)" if k == v['infl'] else v["infl"].shortestPath)
|
||||
treeItem.setText(1, "(自己)" if k == v['infl'] else v["infl"].shortestPath)
|
||||
treeItem.setText(2, v["matchedRule"])
|
||||
treeItem.setData(1, linkedItemRole, v["infl"].path)
|
||||
|
||||
@@ -343,7 +343,7 @@ def build_ui(parent, matcher):
|
||||
matches = matcher.calculate()
|
||||
mappingView_updateMatches(matches)
|
||||
|
||||
g = QtWidgets.QGroupBox("Calculated mapping")
|
||||
g = QtWidgets.QGroupBox("计算映射")
|
||||
g.setLayout(QtWidgets.QVBoxLayout())
|
||||
mappingView, mappingView_updateMatches = createMappingView()
|
||||
g.layout().addWidget(mappingView)
|
||||
|
||||
@@ -19,9 +19,9 @@ def build_used_influences_action(parent):
|
||||
|
||||
result = actions.define_action(
|
||||
parent,
|
||||
"Used Influences Only",
|
||||
"只显示有权重的影响物",
|
||||
callback=toggle,
|
||||
tooltip="If enabled, influences view will only show influences that have weights on current layer",
|
||||
tooltip="如果启用,影响视图将仅显示当前层上有权重的影响。",
|
||||
)
|
||||
|
||||
@signal.on(config.influences_show_used_influences_only.changed, qtParent=parent)
|
||||
@@ -46,7 +46,7 @@ def build_set_influences_sorted_action(parent):
|
||||
parent,
|
||||
"Show influences sorted",
|
||||
callback=toggle,
|
||||
tooltip="Sort influences by name",
|
||||
tooltip="按名称排序影响",
|
||||
)
|
||||
|
||||
@signal.on(config.influences_show_used_influences_only.changed, qtParent=parent)
|
||||
@@ -108,7 +108,7 @@ def build_view(parent, actions, session, filter):
|
||||
targets = (item_id,)
|
||||
|
||||
layer.locked_influences = add_or_remove(layer.locked_influences, targets, lock)
|
||||
log.info("updated locked influences to %r", layer.locked_influences)
|
||||
log.info("更新锁定的影响为 %r", layer.locked_influences)
|
||||
session.events.influencesListUpdated.emit()
|
||||
|
||||
return handler
|
||||
@@ -170,14 +170,14 @@ def build_view(parent, actions, session, filter):
|
||||
view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
view.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
actions.addInfluencesActions(view)
|
||||
view.addAction(actions.separator(parent, "View Options"))
|
||||
view.addAction(actions.separator(parent, "显示设置"))
|
||||
view.addAction(actions.show_used_influences_only)
|
||||
view.addAction(actions.set_influences_sorted)
|
||||
view.setIndentation(10 * scale_multiplier)
|
||||
view.header().setStretchLastSection(False)
|
||||
view.header().setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
|
||||
|
||||
view.setHeaderLabels(["Influences", ""])
|
||||
view.setHeaderLabels(["影响物", ""])
|
||||
view.header().setSectionResizeMode(1, QtWidgets.QHeaderView.Fixed)
|
||||
view.setColumnWidth(1, 25 * scale_multiplier)
|
||||
|
||||
@@ -208,7 +208,7 @@ def build_view(parent, actions, session, filter):
|
||||
if not session.state.currentLayer.layer:
|
||||
build_items(view, [], None)
|
||||
else:
|
||||
log.info("current layer changed to %s", session.state.currentLayer.layer)
|
||||
log.info("当前图层更改为 %s", session.state.currentLayer.layer)
|
||||
refresh_items()
|
||||
current_influence_changed()
|
||||
|
||||
@@ -217,7 +217,7 @@ def build_view(parent, actions, session, filter):
|
||||
if session.state.currentLayer.layer is None:
|
||||
return
|
||||
|
||||
log.info("current influence changed - updating item selection")
|
||||
log.info("当前影响已更改-更新项目选择")
|
||||
with qt.signals_blocked(view):
|
||||
targets = session.state.currentLayer.layer.paint_targets
|
||||
first = True
|
||||
@@ -239,12 +239,12 @@ def build_view(parent, actions, session, filter):
|
||||
if not session.state.currentLayer.layer:
|
||||
return
|
||||
|
||||
log.info("focused item changed: %r", get_item_id(curr))
|
||||
log.info("焦点项已更改: %r", get_item_id(curr))
|
||||
sync_paint_targets_to_selection()
|
||||
|
||||
@qt.on(view.itemSelectionChanged)
|
||||
def sync_paint_targets_to_selection():
|
||||
log.info("syncing paint targets")
|
||||
log.info("同步绘画目标")
|
||||
selected_ids = [get_item_id(item) for item in view.selectedItems()]
|
||||
selected_ids = [i for i in selected_ids if i is not None]
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@ def build_view(parent, actions):
|
||||
child_layer = item_to_layer(child)
|
||||
|
||||
if child_layer.parent_id != parent_layer_id:
|
||||
log.info("changing layer parent: %r->%r (was %r)", parent_layer_id, child_layer, child_layer.parent_id)
|
||||
log.info("更改图层父级: %r->%r (was %r)", parent_layer_id, child_layer, child_layer.parent_id)
|
||||
child_layer.parent = parent_layer_id
|
||||
|
||||
new_index = tree_item.childCount() - i - 1
|
||||
if child_layer.index != new_index:
|
||||
log.info("changing layer index: %r->%r (was %r)", child_layer, new_index, child_layer.index)
|
||||
log.info("更改图层索引: %r->%r (was %r)", child_layer, new_index, child_layer.index)
|
||||
child_layer.index = new_index
|
||||
|
||||
sync_item(child, child_layer.id)
|
||||
@@ -82,7 +82,7 @@ def build_view(parent, actions):
|
||||
view.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
actions.addLayersActions(view)
|
||||
|
||||
view.setHeaderLabels(["Layers", ""])
|
||||
view.setHeaderLabels(["图层", ""])
|
||||
# view.setHeaderHidden(True)
|
||||
view.header().setMinimumSectionSize(1)
|
||||
view.header().setStretchLastSection(False)
|
||||
@@ -100,7 +100,7 @@ def build_view(parent, actions):
|
||||
bar = QtWidgets.QToolBar(parent=parent)
|
||||
bar.setMovable(False)
|
||||
bar.setIconSize(QtCore.QSize(visibility_icon_size * scale_multiplier, visibility_icon_size * scale_multiplier))
|
||||
a = bar.addAction(icon_visible if layer is None or layer.enabled else icon_hidden, "Toggle enabled/disabled")
|
||||
a = bar.addAction(icon_visible if layer is None or layer.enabled else icon_hidden, "切换 启用/禁用")
|
||||
|
||||
@qt.on(a.triggered)
|
||||
def handler():
|
||||
@@ -117,11 +117,11 @@ def build_view(parent, actions):
|
||||
|
||||
# build map "parent id->list of children "
|
||||
|
||||
log.info("syncing items...")
|
||||
log.info("同步项目q...")
|
||||
|
||||
# save selected layers IDs to restore item selection later
|
||||
selected_layer_ids = {item_to_layer(item).id for item in view.selectedItems()}
|
||||
log.info("selected layer IDs: %r", selected_layer_ids)
|
||||
log.info("选择层 IDs: %r", selected_layer_ids)
|
||||
current_item_id = None if view.currentItem() is None else item_to_layer(view.currentItem()).id
|
||||
|
||||
hierarchy = {}
|
||||
@@ -167,7 +167,7 @@ def build_view(parent, actions):
|
||||
|
||||
@signal.on(session.events.layerListChanged, qtParent=view)
|
||||
def refresh_layer_list():
|
||||
log.info("event handler for layer list changed")
|
||||
log.info("图层列表更改的事件处理程序")
|
||||
if not session.state.layersAvailable:
|
||||
build_items([])
|
||||
else:
|
||||
@@ -177,7 +177,7 @@ def build_view(parent, actions):
|
||||
|
||||
@signal.on(session.events.currentLayerChanged, qtParent=view)
|
||||
def current_layer_changed():
|
||||
log.info("event handler for currentLayerChanged")
|
||||
log.info("当前图层更改的事件处理程序")
|
||||
layer = session.state.currentLayer.layer
|
||||
current_item = view.currentItem()
|
||||
if layer is None:
|
||||
@@ -189,14 +189,14 @@ def build_view(parent, actions):
|
||||
if prev_layer is None or prev_layer.id != layer.id:
|
||||
item = tree_items.get(layer.id, None)
|
||||
if item is not None:
|
||||
log.info("setting current item to " + item.text(0))
|
||||
log.info("将当前项目设置为 " + item.text(0))
|
||||
view.setCurrentItem(item, 0, QtCore.QItemSelectionModel.SelectCurrent | QtCore.QItemSelectionModel.ClearAndSelect)
|
||||
|
||||
item.setSelected(True)
|
||||
|
||||
@qt.on(view.currentItemChanged)
|
||||
def current_item_changed(curr, _):
|
||||
log.info("current item changed")
|
||||
log.info("当前项目已更改")
|
||||
if curr is None:
|
||||
return
|
||||
|
||||
@@ -209,7 +209,7 @@ def build_view(parent, actions):
|
||||
|
||||
@qt.on(view.itemChanged)
|
||||
def item_changed(item, column):
|
||||
log.info("item changed")
|
||||
log.info("项目已更改")
|
||||
layers.renameLayer(item_to_layer(item), item.text(column))
|
||||
|
||||
@qt.on(view.itemSelectionChanged)
|
||||
@@ -217,7 +217,7 @@ def build_view(parent, actions):
|
||||
selection = [item_to_layer(item) for item in view.selectedItems()]
|
||||
|
||||
if selection != session.context.selected_layers(default=[]):
|
||||
log.info("new selected layers: %r", selection)
|
||||
log.info("新选择图层: %r", selection)
|
||||
session.context.selected_layers.set(selection)
|
||||
|
||||
refresh_layer_list()
|
||||
|
||||
@@ -46,20 +46,20 @@ def build_menu(parent, actions):
|
||||
sub_item.setTearOffEnabled(True)
|
||||
return sub_item
|
||||
|
||||
sub = top_level_menu("File")
|
||||
sub.addSeparator().setText("Import/Export")
|
||||
sub = top_level_menu("文件")
|
||||
sub.addSeparator().setText("导入/导出")
|
||||
sub.addAction(actions.importFile)
|
||||
sub.addAction(actions.exportFile)
|
||||
|
||||
sub = top_level_menu("Layers")
|
||||
sub.addSeparator().setText("Layer actions")
|
||||
sub = top_level_menu("图层")
|
||||
sub.addSeparator().setText("图层操作")
|
||||
sub.addAction(actions.initialize)
|
||||
sub.addAction(actions.import_v1)
|
||||
actions.addLayersActions(sub)
|
||||
sub.addSeparator().setText("Copy")
|
||||
sub.addSeparator().setText("复制")
|
||||
sub.addAction(actions.transfer)
|
||||
|
||||
sub = top_level_menu("Tools")
|
||||
sub = top_level_menu("工具")
|
||||
sub.addAction(actions.add_influences)
|
||||
sub.addAction(actions.toolsAssignFromClosestJoint)
|
||||
sub.addSeparator()
|
||||
@@ -68,17 +68,17 @@ def build_menu(parent, actions):
|
||||
sub.addAction(actions.toolsDeleteCustomNodesOnSelection)
|
||||
sub.addAction(actions.toolsDeleteCustomNodes)
|
||||
|
||||
sub = top_level_menu("View")
|
||||
sub = top_level_menu("查看")
|
||||
sub.addAction(actions.show_used_influences_only)
|
||||
|
||||
sub = top_level_menu("Help")
|
||||
sub = top_level_menu("帮助")
|
||||
sub.addAction(actions.documentation.user_guide)
|
||||
sub.addAction(actions.documentation.api_root)
|
||||
sub.addAction(actions.documentation.changelog)
|
||||
sub.addAction(actions.documentation.contact)
|
||||
sub.addSeparator()
|
||||
sub.addAction(actions.check_for_updates)
|
||||
sub.addAction("About...").triggered.connect(lambda: aboutwindow.show(parent))
|
||||
sub.addAction("关于...").triggered.connect(lambda: aboutwindow.show(parent))
|
||||
|
||||
return menu
|
||||
|
||||
@@ -107,11 +107,11 @@ def build_ui(parent):
|
||||
|
||||
tabs = QtWidgets.QTabWidget(window)
|
||||
|
||||
tabs.addTab(tabPaint.build_ui(tabs, actions), "Paint")
|
||||
tabs.addTab(tabSetWeights.build_ui(tabs), "Set Weights")
|
||||
tabs.addTab(tabMirror.build_ui(tabs), "Mirror")
|
||||
tabs.addTab(tabLayerEffects.build_ui(), "Effects")
|
||||
tabs.addTab(tabTools.build_ui(actions, session), "Tools")
|
||||
tabs.addTab(tabPaint.build_ui(tabs, actions), "绘制")
|
||||
tabs.addTab(tabSetWeights.build_ui(tabs), "设置权重")
|
||||
tabs.addTab(tabMirror.build_ui(tabs), "镜像")
|
||||
tabs.addTab(tabLayerEffects.build_ui(), "样式")
|
||||
tabs.addTab(tabTools.build_ui(actions, session), "工具")
|
||||
|
||||
@signal.on(options.current_tab.changed)
|
||||
def set_current_tab():
|
||||
|
||||
@@ -19,4 +19,4 @@ def bind(ui, model):
|
||||
model.set(ui.value())
|
||||
|
||||
else:
|
||||
raise Exception("could not bind control to model")
|
||||
raise Exception("无法将控件绑定到模型")
|
||||
|
||||
@@ -99,10 +99,10 @@ def save_option(varName, value):
|
||||
elif is_string(value):
|
||||
key = 'sv'
|
||||
else:
|
||||
raise ValueError("could not save option %s: invalid value %r" % (varName, value))
|
||||
raise ValueError("无法保存选项 %s: 无效值 %r" % (varName, value))
|
||||
|
||||
kvargs = {key: (varName, value)}
|
||||
log.info("saving optionvar: %r", kvargs)
|
||||
log.info("保存选项变量: %r", kvargs)
|
||||
cmds.optionVar(**kvargs)
|
||||
|
||||
|
||||
@@ -153,11 +153,11 @@ class Config(Object):
|
||||
|
||||
def __get_value__(self, name, default_value):
|
||||
result = self.__state__.get(name, default_value)
|
||||
log.info("config: return %s=%r", name, result)
|
||||
log.info("配置: return %s=%r", name, result)
|
||||
return result
|
||||
|
||||
def __set_value__(self, name, value):
|
||||
log.info("config: save %s=%r", name, value)
|
||||
log.info("配置: save %s=%r", name, value)
|
||||
self.__state__[name] = value
|
||||
self.save()
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ def build_ui():
|
||||
|
||||
def build_properties():
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
opacity = widgets.NumberSliderGroup(tooltip="multiply layer mask to control overall transparency of the layer.")
|
||||
opacity = widgets.NumberSliderGroup(tooltip="多层蒙版来控制图层的整体透明度.")
|
||||
opacity.set_value(1.0)
|
||||
layout.addLayout(createTitledRow("Opacity:", opacity.layout()))
|
||||
layout.addLayout(createTitledRow("不透明度:", opacity.layout()))
|
||||
|
||||
def default_selection_opacity(layers):
|
||||
if len(layers) > 0:
|
||||
@@ -65,7 +65,7 @@ def build_ui():
|
||||
|
||||
update_values()
|
||||
|
||||
group = QtWidgets.QGroupBox("Layer properties")
|
||||
group = QtWidgets.QGroupBox("图层属性")
|
||||
group.setLayout(layout)
|
||||
|
||||
return group
|
||||
@@ -76,18 +76,18 @@ def build_ui():
|
||||
i.effects.configure_mirror(**{option: value})
|
||||
|
||||
mirror_direction = QtWidgets.QComboBox()
|
||||
mirror_direction.addItem("Positive to negative", MirrorOptions.directionPositiveToNegative)
|
||||
mirror_direction.addItem("Negative to positive", MirrorOptions.directionNegativeToPositive)
|
||||
mirror_direction.addItem("Flip", MirrorOptions.directionFlip)
|
||||
mirror_direction.addItem("从正到负", MirrorOptions.directionPositiveToNegative)
|
||||
mirror_direction.addItem("从负到正", MirrorOptions.directionNegativeToPositive)
|
||||
mirror_direction.addItem("翻转", MirrorOptions.directionFlip)
|
||||
mirror_direction.setMinimumWidth(1)
|
||||
|
||||
@qt.on(mirror_direction.currentIndexChanged)
|
||||
def value_changed():
|
||||
configure_mirror_all_layers("mirror_direction", mirror_direction.currentData())
|
||||
configure_mirror_all_layers("镜像方向", mirror_direction.currentData())
|
||||
|
||||
influences = QtWidgets.QCheckBox("Influence weights")
|
||||
mask = QtWidgets.QCheckBox("Layer mask")
|
||||
dq = QtWidgets.QCheckBox("Dual quaternion weights")
|
||||
influences = QtWidgets.QCheckBox("影响物权重")
|
||||
mask = QtWidgets.QCheckBox("图层蒙板")
|
||||
dq = QtWidgets.QCheckBox("双四元数权重")
|
||||
|
||||
def configure_checkbox(checkbox, option):
|
||||
@qt.on(checkbox.stateChanged)
|
||||
@@ -125,21 +125,21 @@ def build_ui():
|
||||
return result
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addLayout(createTitledRow("Mirror effect on:", elements()))
|
||||
layout.addLayout(createTitledRow("Mirror direction:", mirror_direction))
|
||||
layout.addLayout(createTitledRow("镜像效果打开:", elements()))
|
||||
layout.addLayout(createTitledRow("镜像方向:", mirror_direction))
|
||||
|
||||
group = QtWidgets.QGroupBox("Mirror")
|
||||
group = QtWidgets.QGroupBox("镜像")
|
||||
group.setLayout(layout)
|
||||
return group
|
||||
|
||||
def build_skin_properties():
|
||||
use_max_influences = QtWidgets.QCheckBox("Limit max influences per vertex")
|
||||
use_max_influences = QtWidgets.QCheckBox("限制每个顶点的最大影响物")
|
||||
max_influences = widgets.NumberSliderGroup(min_value=1, max_value=5, tooltip="", value_type=int)
|
||||
use_prune_weight = QtWidgets.QCheckBox("Prune small weights before writing to skin cluster")
|
||||
use_prune_weight = QtWidgets.QCheckBox("在写入蒙皮簇之前修剪小权重")
|
||||
|
||||
prune_weight = widgets.NumberSliderGroup(decimals=6, min_value=0.000001, max_value=0.05, tooltip="")
|
||||
prune_weight.set_value(prune_weight.min_value)
|
||||
prune_weight.set_expo("start", 3)
|
||||
prune_weight.set_expo("开始", 3)
|
||||
|
||||
@signal.on(session.events.targetChanged)
|
||||
def update_ui():
|
||||
@@ -164,7 +164,7 @@ def build_ui():
|
||||
@qt.on(use_max_influences.stateChanged, use_prune_weight.stateChanged)
|
||||
@signal.on(max_influences.valueChanged, prune_weight.valueChanged)
|
||||
def update_values():
|
||||
log.info("updating effects tab")
|
||||
log.info("更新效果标签页")
|
||||
|
||||
if session.state.layersAvailable:
|
||||
session.state.layers.influence_limit_per_vertex = max_influences.value() if use_max_influences.isChecked() else 0
|
||||
@@ -174,11 +174,11 @@ def build_ui():
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(use_max_influences)
|
||||
layout.addLayout(createTitledRow("Max influences:", max_influences.layout()))
|
||||
layout.addLayout(createTitledRow("最大影响物:", max_influences.layout()))
|
||||
layout.addWidget(use_prune_weight)
|
||||
layout.addLayout(createTitledRow("Prune below:", prune_weight.layout()))
|
||||
layout.addLayout(createTitledRow("修剪以下:", prune_weight.layout()))
|
||||
|
||||
group = QtWidgets.QGroupBox("Skin Properties")
|
||||
group = QtWidgets.QGroupBox("蒙皮属性")
|
||||
group.setLayout(layout)
|
||||
|
||||
update_ui()
|
||||
|
||||
@@ -16,10 +16,10 @@ def build_ui(parent_window):
|
||||
def build_mirroring_options_group():
|
||||
def get_mirror_direction():
|
||||
mirror_direction = QtWidgets.QComboBox()
|
||||
mirror_direction.addItem("Guess from stroke", MirrorOptions.directionGuess)
|
||||
mirror_direction.addItem("Positive to negative", MirrorOptions.directionPositiveToNegative)
|
||||
mirror_direction.addItem("Negative to positive", MirrorOptions.directionNegativeToPositive)
|
||||
mirror_direction.addItem("Flip", MirrorOptions.directionFlip)
|
||||
mirror_direction.addItem("从笔划猜测", MirrorOptions.directionGuess)
|
||||
mirror_direction.addItem("从正到负", MirrorOptions.directionPositiveToNegative)
|
||||
mirror_direction.addItem("从负到正", MirrorOptions.directionNegativeToPositive)
|
||||
mirror_direction.addItem("翻转", MirrorOptions.directionFlip)
|
||||
mirror_direction.setMinimumWidth(1)
|
||||
qt.select_data(mirror_direction, config.mirror_direction())
|
||||
|
||||
@@ -65,19 +65,19 @@ def build_ui(parent_window):
|
||||
return seam_width_ctrl.layout()
|
||||
|
||||
def elements():
|
||||
influences = bind_checkbox(QtWidgets.QCheckBox("Influence weights"), config.mirror_weights)
|
||||
mask = bind_checkbox(QtWidgets.QCheckBox("Layer mask"), config.mirror_mask)
|
||||
dq = bind_checkbox(QtWidgets.QCheckBox("Dual quaternion weights"), config.mirror_dq)
|
||||
influences = bind_checkbox(QtWidgets.QCheckBox("影响物权重"), config.mirror_weights)
|
||||
mask = bind_checkbox(QtWidgets.QCheckBox("图层遮罩"), config.mirror_mask)
|
||||
dq = bind_checkbox(QtWidgets.QCheckBox("双四元权重"), config.mirror_dq)
|
||||
|
||||
return influences, mask, dq
|
||||
|
||||
result = QtWidgets.QGroupBox("Mirroring options")
|
||||
result = QtWidgets.QGroupBox("镜像选项")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
result.setLayout(layout)
|
||||
layout.addLayout(createTitledRow("Axis:", axis()))
|
||||
layout.addLayout(createTitledRow("Direction:", get_mirror_direction()))
|
||||
layout.addLayout(createTitledRow("Seam width:", mirror_seam_width()))
|
||||
layout.addLayout(createTitledRow("Elements to mirror:", *elements()))
|
||||
layout.addLayout(createTitledRow("镜像轴:", axis()))
|
||||
layout.addLayout(createTitledRow("方向:", get_mirror_direction()))
|
||||
layout.addLayout(createTitledRow("接缝宽度:", mirror_seam_width()))
|
||||
layout.addLayout(createTitledRow("镜像要素:", *elements()))
|
||||
|
||||
return result
|
||||
|
||||
@@ -86,10 +86,10 @@ def build_ui(parent_window):
|
||||
def mirror_mesh_group():
|
||||
mesh_name_edit = QtWidgets.QLineEdit("mesh1")
|
||||
mesh_name_edit.setReadOnly(True)
|
||||
select_button = QtWidgets.QPushButton("Select")
|
||||
create_button = QtWidgets.QPushButton("Create")
|
||||
select_button = QtWidgets.QPushButton("选择")
|
||||
create_button = QtWidgets.QPushButton("创建")
|
||||
set_button = QtWidgets.QPushButton("Set")
|
||||
set_button.setToolTip("Select symmetry mesh and a skinned target first")
|
||||
set_button.setToolTip("首先选择对称网格和蒙皮目标")
|
||||
|
||||
layout = QtWidgets.QHBoxLayout()
|
||||
layout.addWidget(mesh_name_edit)
|
||||
@@ -144,13 +144,13 @@ def build_ui(parent_window):
|
||||
return layout
|
||||
|
||||
vertex_mapping_mode = QtWidgets.QComboBox()
|
||||
vertex_mapping_mode.addItem("Closest point on surface", VertexTransferMode.closestPoint)
|
||||
vertex_mapping_mode.addItem("UV space", VertexTransferMode.uvSpace)
|
||||
vertex_mapping_mode.addItem("曲面上最近的点", VertexTransferMode.closestPoint)
|
||||
vertex_mapping_mode.addItem("UV空间", VertexTransferMode.uvSpace)
|
||||
|
||||
result = QtWidgets.QGroupBox("Vertex Mapping")
|
||||
result = QtWidgets.QGroupBox("顶点映射")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addLayout(createTitledRow("Mapping mode:", vertex_mapping_mode))
|
||||
layout.addLayout(createTitledRow("Symmetry mesh:", mirror_mesh_group()))
|
||||
layout.addLayout(createTitledRow("映射模式:", vertex_mapping_mode))
|
||||
layout.addLayout(createTitledRow("对称网格:", mirror_mesh_group()))
|
||||
result.setLayout(layout)
|
||||
|
||||
@qt.on(vertex_mapping_mode.currentIndexChanged)
|
||||
@@ -166,7 +166,7 @@ def build_ui(parent_window):
|
||||
|
||||
def influence_mapping_group():
|
||||
def edit_mapping():
|
||||
mapping = QtWidgets.QPushButton("Preview and edit mapping")
|
||||
mapping = QtWidgets.QPushButton("预览和编辑映射")
|
||||
|
||||
single_window_policy = qt.SingleWindowPolicy()
|
||||
|
||||
@@ -182,7 +182,7 @@ def build_ui(parent_window):
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addWidget(edit_mapping())
|
||||
|
||||
result = QtWidgets.QGroupBox("Influences mapping")
|
||||
result = QtWidgets.QGroupBox("影响物映射")
|
||||
result.setLayout(layout)
|
||||
return result
|
||||
|
||||
@@ -192,7 +192,7 @@ def build_ui(parent_window):
|
||||
tab.innerLayout.addWidget(influence_mapping_group())
|
||||
tab.innerLayout.addStretch()
|
||||
|
||||
btn_mirror = QtWidgets.QPushButton("Mirror")
|
||||
btn_mirror = QtWidgets.QPushButton("镜像")
|
||||
tab.lowerButtonsRow.addWidget(btn_mirror)
|
||||
|
||||
@qt.on(btn_mirror.clicked)
|
||||
|
||||
@@ -50,14 +50,14 @@ def build_ui(parent, global_actions):
|
||||
t.addAction(a)
|
||||
|
||||
t = QtWidgets.QToolBar()
|
||||
create_brush_mode_button(t, PaintMode.replace, "Replace", "Whatever")
|
||||
create_brush_mode_button(t, PaintMode.add, "Add", "")
|
||||
create_brush_mode_button(t, PaintMode.scale, "Scale", "")
|
||||
create_brush_mode_button(t, PaintMode.replace, "替换", "替换")
|
||||
create_brush_mode_button(t, PaintMode.add, "添加", "")
|
||||
create_brush_mode_button(t, PaintMode.scale, "减少", "")
|
||||
row.addWidget(t)
|
||||
|
||||
t = QtWidgets.QToolBar()
|
||||
create_brush_mode_button(t, PaintMode.smooth, "Smooth", "")
|
||||
create_brush_mode_button(t, PaintMode.sharpen, "Sharpen", "")
|
||||
create_brush_mode_button(t, PaintMode.smooth, "平滑", "")
|
||||
create_brush_mode_button(t, PaintMode.sharpen, "锐化", "")
|
||||
row.addWidget(t)
|
||||
|
||||
@on_signal(et.tool_settings_changed, scope=row)
|
||||
@@ -96,9 +96,9 @@ def build_ui(parent, global_actions):
|
||||
update_to_tool()
|
||||
qt.on(a.toggled)(toggled)
|
||||
|
||||
add_brush_shape_action(':/circleSolid.png', 'Solid', BrushShape.solid, checked=True)
|
||||
add_brush_shape_action(':/circlePoly.png', 'Smooth', BrushShape.smooth)
|
||||
add_brush_shape_action(':/circleGaus.png', 'Gaus', BrushShape.gaus)
|
||||
add_brush_shape_action(':/circleSolid.png', '硬边圆', BrushShape.solid, checked=True)
|
||||
add_brush_shape_action(':/circlePoly.png', '软边圆', BrushShape.smooth)
|
||||
add_brush_shape_action(':/circleGaus.png', '喷枪', BrushShape.gaus)
|
||||
|
||||
return result
|
||||
|
||||
@@ -136,23 +136,23 @@ def build_ui(parent, global_actions):
|
||||
update_to_tool()
|
||||
|
||||
add(
|
||||
'Surface',
|
||||
'Using first surface hit under the mouse, update all nearby vertices that are connected by surface to the hit location. '
|
||||
+ 'Only current shell will be updated.',
|
||||
'表面',
|
||||
'绘制由与曲面相连的模型顶点.'
|
||||
+ '仅更新当前shell.',
|
||||
BrushProjectionMode.surface,
|
||||
use_volume=False,
|
||||
checked=True,
|
||||
)
|
||||
add(
|
||||
'Volume',
|
||||
'Using first surface hit under the mouse, update all nearby vertices, including those from other shells.',
|
||||
'体积',
|
||||
'绘制附近所有模型顶点,包括没有连接的顶点.',
|
||||
BrushProjectionMode.surface,
|
||||
use_volume=True,
|
||||
checked=False,
|
||||
)
|
||||
add(
|
||||
'Screen',
|
||||
'Use screen projection of a brush, updating all vertices on all surfaces that are within the brush radius.',
|
||||
'屏幕',
|
||||
'从屏幕方向投影到笔刷半径内所有曲面上的顶点.',
|
||||
BrushProjectionMode.screen,
|
||||
use_volume=False,
|
||||
checked=False,
|
||||
@@ -163,53 +163,53 @@ def build_ui(parent, global_actions):
|
||||
def stylus_pressure_selection():
|
||||
# noinspection PyShadowingNames
|
||||
result = QtWidgets.QComboBox()
|
||||
result.addItem("Unused")
|
||||
result.addItem("Multiply intensity")
|
||||
result.addItem("Multiply opacity")
|
||||
result.addItem("Multiply radius")
|
||||
result.addItem("未使用")
|
||||
result.addItem("倍增强度")
|
||||
result.addItem("倍增不透明度")
|
||||
result.addItem("倍增半径")
|
||||
return result
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addLayout(createTitledRow("Brush projection:", brush_projection_mode_row()))
|
||||
layout.addLayout(createTitledRow("Brush mode:", brush_mode_row3()))
|
||||
layout.addLayout(createTitledRow("Brush shape:", brush_shape_row()))
|
||||
layout.addLayout(createTitledRow("笔刷投影:", brush_projection_mode_row()))
|
||||
layout.addLayout(createTitledRow("笔刷模式:", brush_mode_row3()))
|
||||
layout.addLayout(createTitledRow("笔刷形状:", brush_shape_row()))
|
||||
intensity = widgets.NumberSliderGroup()
|
||||
radius = widgets.NumberSliderGroup(
|
||||
max_value=100, tooltip="You can also set brush radius by just holding <b>B</b> " "and mouse-dragging in the viewport"
|
||||
max_value=100, tooltip="可以通过在视口中按住 <b>B</b> " "并鼠标左键按住拖动来设置笔刷半径"
|
||||
)
|
||||
iterations = widgets.NumberSliderGroup(value_type=int, min_value=1, max_value=100)
|
||||
layout.addLayout(createTitledRow("Intensity:", intensity.layout()))
|
||||
layout.addLayout(createTitledRow("Brush radius:", radius.layout()))
|
||||
layout.addLayout(createTitledRow("Brush iterations:", iterations.layout()))
|
||||
layout.addLayout(createTitledRow("强度:", intensity.layout()))
|
||||
layout.addLayout(createTitledRow("笔刷半径:", radius.layout()))
|
||||
layout.addLayout(createTitledRow("笔刷迭代次数:", iterations.layout()))
|
||||
|
||||
influences_limit = widgets.NumberSliderGroup(value_type=int, min_value=0, max_value=10)
|
||||
layout.addLayout(createTitledRow("Influences limit:", influences_limit.layout()))
|
||||
layout.addLayout(createTitledRow("影响物限制:", influences_limit.layout()))
|
||||
|
||||
@signal.on(influences_limit.valueChanged)
|
||||
def influences_limit_changed():
|
||||
paint.influences_limit = influences_limit.value()
|
||||
update_ui()
|
||||
|
||||
fixed_influences = QtWidgets.QCheckBox("Only adjust existing vertex influences")
|
||||
fixed_influences = QtWidgets.QCheckBox("仅调整顶点现有影响物,防止周围权重扩散")
|
||||
fixed_influences.setToolTip(
|
||||
"When this option is enabled, smooth will only adjust existing influences per vertex, "
|
||||
"and won't include other influences from nearby vertices"
|
||||
"启用此选项后,平滑-将仅调整每个顶点的现有影响物, "
|
||||
"而不会包含来自附近顶点的影响物,防止周围权重扩散"
|
||||
)
|
||||
layout.addLayout(createTitledRow("Weight bleeding:", fixed_influences))
|
||||
layout.addLayout(createTitledRow("平滑辅助:", fixed_influences))
|
||||
|
||||
@qt.on(fixed_influences.stateChanged)
|
||||
def fixed_influences_changed():
|
||||
paint.fixed_influences_per_vertex = fixed_influences.isChecked()
|
||||
|
||||
limit_to_component_selection = QtWidgets.QCheckBox("Limit to component selection")
|
||||
limit_to_component_selection.setToolTip("When this option is enabled, smoothing will only happen between selected components")
|
||||
layout.addLayout(createTitledRow("Isolation:", limit_to_component_selection))
|
||||
limit_to_component_selection = QtWidgets.QCheckBox("限制在选中组件中平滑")
|
||||
limit_to_component_selection.setToolTip("启用此选项后,仅在选定组件之间进行平滑")
|
||||
layout.addLayout(createTitledRow("隔离选中组件:", limit_to_component_selection))
|
||||
|
||||
@qt.on(limit_to_component_selection.stateChanged)
|
||||
def limit_to_component_selection_changed():
|
||||
paint.limit_to_component_selection = limit_to_component_selection.isChecked()
|
||||
|
||||
interactive_mirror = QtWidgets.QCheckBox("Interactive mirror")
|
||||
interactive_mirror = QtWidgets.QCheckBox("交互式镜像")
|
||||
layout.addLayout(createTitledRow("", interactive_mirror))
|
||||
|
||||
@qt.on(interactive_mirror.stateChanged)
|
||||
@@ -217,7 +217,7 @@ def build_ui(parent, global_actions):
|
||||
paint.mirror = interactive_mirror.isChecked()
|
||||
update_ui()
|
||||
|
||||
sample_joint_on_stroke_start = QtWidgets.QCheckBox("Sample current joint on stroke start")
|
||||
sample_joint_on_stroke_start = QtWidgets.QCheckBox("在笔画开始时取样当前骨骼")
|
||||
layout.addLayout(createTitledRow("", sample_joint_on_stroke_start))
|
||||
|
||||
@qt.on(sample_joint_on_stroke_start.stateChanged)
|
||||
@@ -225,8 +225,8 @@ def build_ui(parent, global_actions):
|
||||
paint.sample_joint_on_stroke_start = sample_joint_on_stroke_start.isChecked()
|
||||
update_ui()
|
||||
|
||||
redistribute_removed_weight = QtWidgets.QCheckBox("Distribute to other influences")
|
||||
layout.addLayout(createTitledRow("Removed weight:", redistribute_removed_weight))
|
||||
redistribute_removed_weight = QtWidgets.QCheckBox("分配给其它影响物")
|
||||
layout.addLayout(createTitledRow("移除的权重:", redistribute_removed_weight))
|
||||
|
||||
@qt.on(redistribute_removed_weight.stateChanged)
|
||||
def redistribute_removed_weight_changed():
|
||||
@@ -234,12 +234,12 @@ def build_ui(parent, global_actions):
|
||||
update_ui()
|
||||
|
||||
stylus = stylus_pressure_selection()
|
||||
layout.addLayout(createTitledRow("Stylus pressure:", stylus))
|
||||
layout.addLayout(createTitledRow("手绘板压力:", stylus))
|
||||
|
||||
@on_signal(et.tool_settings_changed, scope=layout)
|
||||
def update_ui():
|
||||
log.info("updating paint settings ui")
|
||||
log.info("brush mode:%s, brush shape: %s", paint.mode, paint.brush_shape)
|
||||
log.info("更新的绘制设置的ui")
|
||||
log.info("画笔模式:%s, 画笔形状: %s", paint.mode, paint.brush_shape)
|
||||
paint.update_plugin_brush_radius()
|
||||
paint.update_plugin_brush_intensity()
|
||||
|
||||
@@ -280,7 +280,7 @@ def build_ui(parent, global_actions):
|
||||
|
||||
@signal.on(radius.valueChanged, qtParent=layout)
|
||||
def radius_edited():
|
||||
log.info("updated brush radius")
|
||||
log.info("更新笔刷半径")
|
||||
paint.brush_radius = radius.value()
|
||||
update_ui()
|
||||
|
||||
@@ -301,18 +301,18 @@ def build_ui(parent, global_actions):
|
||||
|
||||
update_ui()
|
||||
|
||||
result = QtWidgets.QGroupBox("Brush behavior")
|
||||
result = QtWidgets.QGroupBox("笔刷行为")
|
||||
result.setLayout(layout)
|
||||
return result
|
||||
|
||||
def build_display_settings():
|
||||
result = QtWidgets.QGroupBox("Display settings")
|
||||
result = QtWidgets.QGroupBox("显示设置")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
|
||||
influences_display = QtWidgets.QComboBox()
|
||||
influences_display.addItem("All influences, multiple colors", WeightsDisplayMode.allInfluences)
|
||||
influences_display.addItem("Current influence, grayscale", WeightsDisplayMode.currentInfluence)
|
||||
influences_display.addItem("Current influence, colored", WeightsDisplayMode.currentInfluenceColored)
|
||||
influences_display.addItem("所有权重,多种颜色", WeightsDisplayMode.allInfluences)
|
||||
influences_display.addItem("当前权重,灰度", WeightsDisplayMode.currentInfluence)
|
||||
influences_display.addItem("当前权重,彩色", WeightsDisplayMode.currentInfluenceColored)
|
||||
influences_display.setMinimumWidth(1)
|
||||
influences_display.setCurrentIndex(paint.display_settings.weights_display_mode)
|
||||
|
||||
@@ -327,11 +327,11 @@ def build_ui(parent, global_actions):
|
||||
display_layout = QtWidgets.QVBoxLayout()
|
||||
display_layout.addWidget(influences_display)
|
||||
display_layout.addWidget(display_toolbar)
|
||||
layout.addLayout(createTitledRow("Influences display:", display_layout))
|
||||
layout.addLayout(createTitledRow("权重显示:", display_layout))
|
||||
|
||||
mask_display = QtWidgets.QComboBox()
|
||||
mask_display.addItem("Default", MaskDisplayMode.default_)
|
||||
mask_display.addItem("Color ramp", MaskDisplayMode.color_ramp)
|
||||
mask_display.addItem("默认", MaskDisplayMode.default_)
|
||||
mask_display.addItem("彩色渐变", MaskDisplayMode.color_ramp)
|
||||
mask_display.setMinimumWidth(1)
|
||||
mask_display.setCurrentIndex(paint.display_settings.weights_display_mode)
|
||||
|
||||
@@ -340,14 +340,14 @@ def build_ui(parent, global_actions):
|
||||
paint.display_settings.mask_display_mode = mask_display.currentData()
|
||||
update_ui_to_tool()
|
||||
|
||||
layout.addLayout(createTitledRow("Mask display:", mask_display))
|
||||
layout.addLayout(createTitledRow("表面显示:", mask_display))
|
||||
|
||||
show_effects = QtWidgets.QCheckBox("Show layer effects")
|
||||
show_effects = QtWidgets.QCheckBox("显示图层效果")
|
||||
layout.addLayout(createTitledRow("", show_effects))
|
||||
show_masked = QtWidgets.QCheckBox("Show masked weights")
|
||||
show_masked = QtWidgets.QCheckBox("显示蒙皮权重")
|
||||
layout.addLayout(createTitledRow("", show_masked))
|
||||
|
||||
show_selected_verts_only = QtWidgets.QCheckBox("Hide unselected vertices")
|
||||
show_selected_verts_only = QtWidgets.QCheckBox("隐藏未选择的顶点")
|
||||
layout.addLayout(createTitledRow("", show_selected_verts_only))
|
||||
|
||||
@qt.on(show_effects.stateChanged)
|
||||
@@ -363,7 +363,7 @@ def build_ui(parent, global_actions):
|
||||
paint.display_settings.show_selected_verts_only = show_selected_verts_only.isChecked()
|
||||
|
||||
mesh_toolbar = QtWidgets.QToolBar()
|
||||
toggle_original_mesh = QAction("Show Original Mesh", mesh_toolbar)
|
||||
toggle_original_mesh = QAction("显示原本模型", mesh_toolbar)
|
||||
toggle_original_mesh.setCheckable(True)
|
||||
mesh_toolbar.addAction(toggle_original_mesh)
|
||||
layout.addLayout(createTitledRow("", mesh_toolbar))
|
||||
@@ -374,7 +374,7 @@ def build_ui(parent, global_actions):
|
||||
update_ui_to_tool()
|
||||
|
||||
wireframe_color_button = widgets.ColorButton()
|
||||
layout.addLayout(createTitledRow("Wireframe color:", wireframe_color_button))
|
||||
layout.addLayout(createTitledRow("线框颜色:", wireframe_color_button))
|
||||
|
||||
@signal.on(wireframe_color_button.color_changed)
|
||||
def update_wireframe_color():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
from ngSkinTools2 import signal
|
||||
from ngSkinTools2.api import PaintMode, PaintModeSettings, flood_weights
|
||||
from ngSkinTools2.api.log import getLogger
|
||||
@@ -70,14 +71,14 @@ def build_ui(parent):
|
||||
toolbar.addAction(a)
|
||||
|
||||
t = QtWidgets.QToolBar()
|
||||
create_mode_button(t, PaintMode.replace, "Replace", "")
|
||||
create_mode_button(t, PaintMode.add, "Add", "")
|
||||
create_mode_button(t, PaintMode.scale, "Scale", "")
|
||||
create_mode_button(t, PaintMode.replace, "替换", "")
|
||||
create_mode_button(t, PaintMode.add, "添加", "")
|
||||
create_mode_button(t, PaintMode.scale, "减少", "")
|
||||
row.addWidget(t)
|
||||
|
||||
t = QtWidgets.QToolBar()
|
||||
create_mode_button(t, PaintMode.smooth, "Smooth", "")
|
||||
create_mode_button(t, PaintMode.sharpen, "Sharpen", "")
|
||||
create_mode_button(t, PaintMode.smooth, "平滑", "")
|
||||
create_mode_button(t, PaintMode.sharpen, "锐化", "")
|
||||
row.addWidget(t)
|
||||
|
||||
actions[model.current_settings.mode].setChecked(True)
|
||||
@@ -109,20 +110,20 @@ def build_ui(parent):
|
||||
model.current_settings.iterations = iterations.value()
|
||||
update_ui()
|
||||
|
||||
fixed_influences = QtWidgets.QCheckBox("Only adjust existing vertex influences")
|
||||
fixed_influences = QtWidgets.QCheckBox("仅调整顶点现有影响物,防止周围权重扩散")
|
||||
fixed_influences.setToolTip(
|
||||
"When this option is enabled, smooth will only adjust existing influences per vertex, "
|
||||
"and won't include other influences from nearby vertices"
|
||||
"启用此选项后,平滑-将仅调整每个顶点的现有影响物, "
|
||||
"而不会包含来自附近顶点的影响物,防止周围权重扩散"
|
||||
)
|
||||
|
||||
volume_neighbours = QtWidgets.QCheckBox("Smooth across gaps and thin surfaces")
|
||||
volume_neighbours = QtWidgets.QCheckBox("平滑间隙和薄表面")
|
||||
volume_neighbours.setToolTip(
|
||||
"Use all nearby neighbours, regardless if they belong to same surface. "
|
||||
"This will allow for smoothing to happen across gaps and thin surfaces."
|
||||
"使用所有附近相邻的面,无论它们是否属于同一个曲面."
|
||||
"这将允许在间隙和薄曲面之间进行平滑."
|
||||
)
|
||||
|
||||
limit_to_component_selection = QtWidgets.QCheckBox("Limit to component selection")
|
||||
limit_to_component_selection.setToolTip("When this option is enabled, smoothing will only happen between selected components")
|
||||
limit_to_component_selection = QtWidgets.QCheckBox("在选择的组件中平滑")
|
||||
limit_to_component_selection.setToolTip("启用此选项后,仅在选定组件之间进行平滑")
|
||||
|
||||
@qt.on(fixed_influences.stateChanged)
|
||||
@ui_lock.skip_if_updating
|
||||
@@ -154,16 +155,16 @@ def build_ui(parent):
|
||||
volume_neighbours.setChecked(model.current_settings.use_volume_neighbours)
|
||||
volume_neighbours.setEnabled(model.current_settings.mode == PaintMode.smooth)
|
||||
|
||||
settings_group = QtWidgets.QGroupBox("Mode Settings")
|
||||
settings_group = QtWidgets.QGroupBox("模式设置")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
|
||||
layout.addLayout(createTitledRow("Mode:", mode_row()))
|
||||
layout.addLayout(createTitledRow("Intensity:", intensity.layout()))
|
||||
layout.addLayout(createTitledRow("Iterations:", iterations.layout()))
|
||||
layout.addLayout(createTitledRow("Influences limit:", influences_limit.layout()))
|
||||
layout.addLayout(createTitledRow("Weight bleeding:", fixed_influences))
|
||||
layout.addLayout(createTitledRow("Volume smoothing:", volume_neighbours))
|
||||
layout.addLayout(createTitledRow("Isolation:", limit_to_component_selection))
|
||||
layout.addLayout(createTitledRow("模式:", mode_row()))
|
||||
layout.addLayout(createTitledRow("强度:", intensity.layout()))
|
||||
layout.addLayout(createTitledRow("迭代次数:", iterations.layout()))
|
||||
layout.addLayout(createTitledRow("影响物限制:", influences_limit.layout()))
|
||||
layout.addLayout(createTitledRow("平滑辅助:", fixed_influences))
|
||||
layout.addLayout(createTitledRow("体积平滑:", volume_neighbours))
|
||||
layout.addLayout(createTitledRow("隔离选中组件:", limit_to_component_selection))
|
||||
settings_group.setLayout(layout)
|
||||
|
||||
update_ui()
|
||||
@@ -173,7 +174,7 @@ def build_ui(parent):
|
||||
def common_settings():
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
|
||||
mirror = QtWidgets.QCheckBox("Mirror")
|
||||
mirror = QtWidgets.QCheckBox("镜像")
|
||||
layout.addLayout(createTitledRow("", mirror))
|
||||
|
||||
@qt.on(mirror.stateChanged)
|
||||
@@ -182,8 +183,8 @@ def build_ui(parent):
|
||||
for _, v in model.presets.items():
|
||||
v.mirror = mirror.isChecked()
|
||||
|
||||
redistribute_removed_weight = QtWidgets.QCheckBox("Distribute to other influences")
|
||||
layout.addLayout(createTitledRow("Removed weight:", redistribute_removed_weight))
|
||||
redistribute_removed_weight = QtWidgets.QCheckBox("分配给其它影响物")
|
||||
layout.addLayout(createTitledRow("移除的权重:", redistribute_removed_weight))
|
||||
|
||||
@qt.on(redistribute_removed_weight.stateChanged)
|
||||
def redistribute_removed_weight_changed():
|
||||
@@ -195,7 +196,7 @@ def build_ui(parent):
|
||||
mirror.setChecked(model.current_settings.mirror)
|
||||
redistribute_removed_weight.setChecked(model.current_settings.distribute_to_other_influences)
|
||||
|
||||
group = QtWidgets.QGroupBox("Common Settings")
|
||||
group = QtWidgets.QGroupBox("常用设置")
|
||||
group.setLayout(layout)
|
||||
|
||||
update_ui()
|
||||
@@ -203,8 +204,8 @@ def build_ui(parent):
|
||||
return group
|
||||
|
||||
def apply_button():
|
||||
btn = QtWidgets.QPushButton("Apply")
|
||||
btn.setToolTip("Apply selected operation to vertex")
|
||||
btn = QtWidgets.QPushButton("应用")
|
||||
btn.setToolTip("将设定操作应用于选中顶点")
|
||||
|
||||
@qt.on(btn.clicked)
|
||||
def clicked():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
from ngSkinTools2 import signal
|
||||
from ngSkinTools2.api.pyside import QtWidgets
|
||||
from ngSkinTools2.api.session import Session
|
||||
@@ -20,7 +21,7 @@ def build_ui(actions, session):
|
||||
def influences_options():
|
||||
result = QtWidgets.QVBoxLayout()
|
||||
button_group = QtWidgets.QButtonGroup()
|
||||
for index, i in enumerate(["Use all available influences", "Use selected influences"]):
|
||||
for index, i in enumerate(["使用所有可用的影响物", "使用选定的影响物"]):
|
||||
radio = QtWidgets.QRadioButton(i)
|
||||
button_group.addButton(radio, index)
|
||||
result.addWidget(radio)
|
||||
@@ -38,7 +39,7 @@ def build_ui(actions, session):
|
||||
|
||||
return result
|
||||
|
||||
new_layer = QtWidgets.QCheckBox("Create new layer")
|
||||
new_layer = QtWidgets.QCheckBox("创建新图层")
|
||||
|
||||
@qt.on(new_layer.toggled)
|
||||
def update_new_layer():
|
||||
@@ -53,11 +54,11 @@ def build_ui(actions, session):
|
||||
|
||||
update_ui()
|
||||
|
||||
result = QtWidgets.QGroupBox("Assign weights from closest joint")
|
||||
result = QtWidgets.QGroupBox("从最近的关节指定权重")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
result.setLayout(layout)
|
||||
layout.addLayout(createTitledRow("Target layer", new_layer))
|
||||
layout.addLayout(createTitledRow("Influences", influences_options()))
|
||||
layout.addLayout(createTitledRow("目标层", new_layer))
|
||||
layout.addLayout(createTitledRow("影响物", influences_options()))
|
||||
layout.addWidget(btn)
|
||||
|
||||
return result
|
||||
@@ -69,25 +70,25 @@ def build_ui(actions, session):
|
||||
model_binds.bind(intensity, options.overall_effect)
|
||||
|
||||
single_cluster_mode = QtWidgets.QCheckBox(
|
||||
"Single group mode",
|
||||
"单组模式",
|
||||
)
|
||||
single_cluster_mode.setToolTip("average weights across whole selection, ignoring separate shells or selection gaps")
|
||||
single_cluster_mode.setToolTip("整个选择的平均权重,忽略单独的壳或选择间隙")
|
||||
model_binds.bind(single_cluster_mode, options.single_cluster_mode)
|
||||
|
||||
btn = QtWidgets.QPushButton()
|
||||
qt.bind_action_to_button(actions.toolsUnifyWeights, btn)
|
||||
|
||||
result = QtWidgets.QGroupBox("Unify weights")
|
||||
result = QtWidgets.QGroupBox("统一权重")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
result.setLayout(layout)
|
||||
layout.addLayout(createTitledRow("Intensity:", intensity.layout()))
|
||||
layout.addLayout(createTitledRow("Clustering:", single_cluster_mode))
|
||||
layout.addLayout(createTitledRow("强度:", intensity.layout()))
|
||||
layout.addLayout(createTitledRow("集群:", single_cluster_mode))
|
||||
layout.addWidget(btn)
|
||||
|
||||
return result
|
||||
|
||||
def other_tools_group():
|
||||
result = QtWidgets.QGroupBox("Other")
|
||||
result = QtWidgets.QGroupBox("其它")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
result.setLayout(layout)
|
||||
layout.addWidget(to_button(actions.fill_layer_transparency))
|
||||
|
||||
@@ -25,7 +25,7 @@ def build_layers_ui(parent, actions, session):
|
||||
filter = QtWidgets.QComboBox()
|
||||
filter.setMinimumHeight(22 * scale_multiplier)
|
||||
filter.setEditable(True)
|
||||
filter.lineEdit().setPlaceholderText("Search...")
|
||||
filter.lineEdit().setPlaceholderText("搜索...")
|
||||
result.addWidget(filter)
|
||||
# noinspection PyShadowingNames
|
||||
clear = QAction(result)
|
||||
@@ -83,7 +83,7 @@ def build_no_layers_ui(parent, actions, session):
|
||||
selection_display = QtWidgets.QLabel("pPlane1")
|
||||
selection_display.setStyleSheet("font-weight: bold")
|
||||
|
||||
selection_note = QtWidgets.QLabel("Skinning Layers cannot be attached to this object")
|
||||
selection_note = QtWidgets.QLabel("蒙皮层无法附加到此对象")
|
||||
selection_note.setWordWrap(True)
|
||||
|
||||
layout.addStretch(1)
|
||||
@@ -104,11 +104,11 @@ def build_no_layers_ui(parent, actions, session):
|
||||
selection_display.setText(session.state.selectedSkinCluster)
|
||||
selection_display.setVisible(is_skinned)
|
||||
|
||||
note = "Select a mesh with a skin cluster attached."
|
||||
note = "选择附着蒙皮节点的网格."
|
||||
if is_skinned:
|
||||
note = "Skinning layers are not yet initialized for this mesh."
|
||||
note = "尚未为此网格初始化蒙皮层."
|
||||
if import_v1_actions.can_import(session):
|
||||
note = "Skinning layers from previous ngSkinTools version are initialized on this mesh."
|
||||
note = "ngSkinTools的旧版本的蒙皮层在此网格上初始化."
|
||||
|
||||
selection_note.setText(note)
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
from ngSkinTools2 import api, cleanup, signal
|
||||
from ngSkinTools2.api import VertexTransferMode
|
||||
from ngSkinTools2.api.pyside import QtCore, QtWidgets
|
||||
@@ -43,8 +44,8 @@ def open(parent, model):
|
||||
|
||||
return widgets.button_row(
|
||||
[
|
||||
("Transfer", apply),
|
||||
("Cancel", window.close),
|
||||
("传递", apply),
|
||||
("取消", window.close),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -55,32 +56,32 @@ def open(parent, model):
|
||||
result = QtWidgets.QVBoxLayout()
|
||||
|
||||
vertexMappingMode = QtWidgets.QComboBox()
|
||||
vertexMappingMode.addItem("Closest point on surface", VertexTransferMode.closestPoint)
|
||||
vertexMappingMode.addItem("UV space", VertexTransferMode.uvSpace)
|
||||
vertexMappingMode.addItem("By vertex ID (source and destination vert count must match)", VertexTransferMode.vertexId)
|
||||
vertexMappingMode.addItem("表面上最近的点", VertexTransferMode.closestPoint)
|
||||
vertexMappingMode.addItem("UV空间", VertexTransferMode.uvSpace)
|
||||
vertexMappingMode.addItem("按顶点ID(源和目标顶点数必须匹配)", VertexTransferMode.vertexId)
|
||||
|
||||
g = QtWidgets.QGroupBox("Selection")
|
||||
g = QtWidgets.QGroupBox("选择")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
g.setLayout(layout)
|
||||
|
||||
sourceLabel = QtWidgets.QLabel()
|
||||
layout.addLayout(createTitledRow("Source:", sourceLabel))
|
||||
layout.addLayout(createTitledRow("来源:", sourceLabel))
|
||||
|
||||
destinationLabel = QtWidgets.QLabel()
|
||||
layout.addLayout(createTitledRow("Destination:", destinationLabel))
|
||||
layout.addLayout(createTitledRow("目标:", destinationLabel))
|
||||
result.addWidget(g)
|
||||
|
||||
g = QtWidgets.QGroupBox("Vertex mapping")
|
||||
g = QtWidgets.QGroupBox("顶点映射")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addLayout(createTitledRow("Mapping mode:", vertexMappingMode))
|
||||
layout.addLayout(createTitledRow("映射模式:", vertexMappingMode))
|
||||
g.setLayout(layout)
|
||||
result.addWidget(g)
|
||||
|
||||
g = QtWidgets.QGroupBox("Influences mapping")
|
||||
g = QtWidgets.QGroupBox("影响物映射")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
g.setLayout(layout)
|
||||
|
||||
edit = QtWidgets.QPushButton("Configure")
|
||||
edit = QtWidgets.QPushButton("配置")
|
||||
qt.on(edit.clicked)(view_influences_settings)
|
||||
|
||||
button_row = QtWidgets.QHBoxLayout()
|
||||
@@ -90,12 +91,12 @@ def open(parent, model):
|
||||
|
||||
result.addWidget(g)
|
||||
|
||||
g = QtWidgets.QGroupBox("Other options")
|
||||
g = QtWidgets.QGroupBox("其他选项")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
g.setLayout(layout)
|
||||
|
||||
keep_layers = QtWidgets.QCheckBox("Keep existing layers on destination")
|
||||
keep_layers_row = qt.wrap_layout_into_widget(createTitledRow("Destination layers:", keep_layers))
|
||||
keep_layers = QtWidgets.QCheckBox("保留目标网格的已有图层")
|
||||
keep_layers_row = qt.wrap_layout_into_widget(createTitledRow("目标图层:", keep_layers))
|
||||
layout.addWidget(keep_layers_row)
|
||||
|
||||
@qt.on(keep_layers.stateChanged)
|
||||
@@ -137,12 +138,12 @@ def open(parent, model):
|
||||
|
||||
tabs = QtWidgets.QTabWidget()
|
||||
|
||||
tabs.addTab(qt.wrap_layout_into_widget(build_settings()), "Settings")
|
||||
tabs.addTab(qt.wrap_layout_into_widget(build_influenes_tab()), "Influences mapping")
|
||||
tabs.addTab(qt.wrap_layout_into_widget(build_settings()), "设置")
|
||||
tabs.addTab(qt.wrap_layout_into_widget(build_influenes_tab()), "影响物映射")
|
||||
|
||||
window = QtWidgets.QDialog(parent)
|
||||
cleanup.registerCleanupHandler(window.close)
|
||||
window.setWindowTitle("Transfer")
|
||||
window.setWindowTitle("传递")
|
||||
window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
window.resize(720 * scale_multiplier, 500 * scale_multiplier)
|
||||
window.setLayout(QtWidgets.QVBoxLayout())
|
||||
@@ -196,7 +197,7 @@ def build_transfer_action(session, parent):
|
||||
t.customize_callback = transfer_dialog
|
||||
t.execute()
|
||||
|
||||
result = define_action(parent, "Transfer layers...", callback=handler)
|
||||
result = define_action(parent, "传递图层...", callback=handler)
|
||||
|
||||
@signal.on(session.events.nodeSelectionChanged)
|
||||
def on_selection_changed():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
import webbrowser
|
||||
|
||||
from ngSkinTools2.api import versioncheck
|
||||
@@ -27,10 +28,10 @@ def show(parent, silent_mode):
|
||||
result.setLayout(layout)
|
||||
layout.setContentsMargins(20, 30, 20, 20)
|
||||
|
||||
header = QtWidgets.QLabel("<strong>Checking for update...</strong>")
|
||||
result1 = QtWidgets.QLabel("Current version: <strong>2.0.0</strong>")
|
||||
result2 = QtWidgets.QLabel("Update available: 2.0.1")
|
||||
download = QtWidgets.QPushButton("Download ngSkinTools v2.0.1")
|
||||
header = QtWidgets.QLabel(u"<strong>检查更新中...</strong>")
|
||||
result1 = QtWidgets.QLabel(u"当前版本: <strong>2.1.4</strong>")
|
||||
result2 = QtWidgets.QLabel("最新版本: 2.1.4")
|
||||
download = QtWidgets.QPushButton("下载 中文ngSkinTools v2.0.1")
|
||||
# layout.addWidget(QtWidgets.QLabel("Checking for updates..."))
|
||||
layout.addWidget(header)
|
||||
layout.addWidget(result1)
|
||||
@@ -52,16 +53,16 @@ def show(parent, silent_mode):
|
||||
:type info: ngSkinTools2.api.versioncheck.
|
||||
"""
|
||||
|
||||
header.setText("<strong>{0}</strong>".format('Update available!' if info.update_available else 'ngSkinTools is up to date.'))
|
||||
header.setText("<strong>{0}</strong>".format('更新可用!' if info.update_available else '中文ngSkinTools 已经是最新版.'))
|
||||
result1.setVisible(True)
|
||||
result1.setText("Current version: <strong>{0}</strong>".format(version.pluginVersion()))
|
||||
result1.setText(u"当前版本: <strong>{0}</strong>".format(version.pluginVersion()))
|
||||
if info.update_available:
|
||||
result2.setVisible(True)
|
||||
result2.setText(
|
||||
"Update available: <strong>{0}</strong>, released on {1}".format(info.latest_version, info.update_date.strftime("%d %B, %Y"))
|
||||
u"最新版本: <strong>{0}</strong>, 发布于 {1}".format(info.latest_version, info.update_date.strftime("%d %B, %Y"))
|
||||
)
|
||||
download.setVisible(True)
|
||||
download.setText("Download ngSkinTools v" + info.latest_version)
|
||||
download.setText(u"下载 中文ngSkinTools v" + info.latest_version)
|
||||
|
||||
@qt.on(download.clicked)
|
||||
def open_link():
|
||||
@@ -71,10 +72,10 @@ def show(parent, silent_mode):
|
||||
|
||||
# noinspection PyShadowingNames
|
||||
def buttonsRow(window):
|
||||
btn_close = QtWidgets.QPushButton("Close")
|
||||
btn_close = QtWidgets.QPushButton("取消")
|
||||
btn_close.setMinimumWidth(100 * scale_multiplier)
|
||||
|
||||
check_do_on_startup = bind_checkbox(QtWidgets.QCheckBox("Check for updates at startup"), config.checkForUpdatesAtStartup)
|
||||
check_do_on_startup = bind_checkbox(QtWidgets.QCheckBox("启动时检查更新"), config.checkForUpdatesAtStartup)
|
||||
|
||||
layout = QtWidgets.QHBoxLayout()
|
||||
layout.addWidget(check_do_on_startup)
|
||||
@@ -88,7 +89,7 @@ def show(parent, silent_mode):
|
||||
window = QtWidgets.QWidget(parent, Qt.Window | Qt.WindowTitleHint | Qt.CustomizeWindowHint)
|
||||
window.resize(400 * scale_multiplier, 200 * scale_multiplier)
|
||||
window.setAttribute(Qt.WA_DeleteOnClose)
|
||||
window.setWindowTitle("ngSkinTools2 version update")
|
||||
window.setWindowTitle("ngSkinTools2 (中文) 版本更新")
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
window.setLayout(layout)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -106,14 +107,14 @@ def show(parent, silent_mode):
|
||||
if info.update_available:
|
||||
window.show()
|
||||
else:
|
||||
log.info("not showing the window")
|
||||
log.info("未显示窗口")
|
||||
window.close()
|
||||
|
||||
cleanup.registerCleanupHandler(window.close)
|
||||
|
||||
@qt.on(window.destroyed)
|
||||
def closed():
|
||||
log.info("deleting update window")
|
||||
log.info("删除更新窗口")
|
||||
|
||||
versioncheck.download_update_info(success_callback=success_signal.emit, failure_callback=error_signal.emit)
|
||||
|
||||
@@ -129,4 +130,4 @@ def show_and_start_update(parent):
|
||||
def build_action_check_for_updates(parent):
|
||||
from ngSkinTools2.ui import actions
|
||||
|
||||
return actions.define_action(parent, "Check for Updates...", callback=lambda: show_and_start_update(parent))
|
||||
return actions.define_action(parent, "检查更新...", callback=lambda: show_and_start_update(parent))
|
||||
|
||||
@@ -66,7 +66,7 @@ class SemanticVersion(Object):
|
||||
|
||||
result = pattern.match(stringVersion)
|
||||
if result is None:
|
||||
raise Exception("Invalid version string: '{0}'".format(stringVersion))
|
||||
raise Exception("无效的版本字符串: '{0}'".format(stringVersion))
|
||||
|
||||
self.major = toInt(result.group(1))
|
||||
self.minor = toInt(result.group(3))
|
||||
|
||||
@@ -13,37 +13,20 @@ Features:
|
||||
- Maya 2018+ compatible
|
||||
"""
|
||||
|
||||
import maya.cmds as cmds
|
||||
import maya.mel as mel
|
||||
import maya.utils
|
||||
# Standard library imports
|
||||
import atexit
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
# Set MAYA_MODULE_PATH environment variable for external tools
|
||||
# Maya imports with error handling
|
||||
try:
|
||||
_current_file = os.path.abspath(__file__)
|
||||
_script_dir = os.path.dirname(_current_file)
|
||||
_project_root = os.path.dirname(os.path.dirname(_script_dir))
|
||||
_modules_dir = os.path.join(_project_root, 'modules')
|
||||
|
||||
if os.path.exists(_modules_dir):
|
||||
_modules_dir_normalized = os.path.normpath(_modules_dir)
|
||||
_current_module_path = os.environ.get('MAYA_MODULE_PATH', '')
|
||||
|
||||
# Check if already in path
|
||||
_paths = [p.strip() for p in _current_module_path.split(os.pathsep) if p.strip()]
|
||||
_normalized_paths = [os.path.normpath(p) for p in _paths]
|
||||
|
||||
if _modules_dir_normalized not in _normalized_paths:
|
||||
if _current_module_path:
|
||||
os.environ['MAYA_MODULE_PATH'] = f"{_modules_dir_normalized}{os.pathsep}{_current_module_path}"
|
||||
else:
|
||||
os.environ['MAYA_MODULE_PATH'] = _modules_dir_normalized
|
||||
print(f"[Tool] MAYA_MODULE_PATH set to: {_modules_dir_normalized}")
|
||||
except Exception as e:
|
||||
print(f"[Tool] Warning: Could not set MAYA_MODULE_PATH: {e}")
|
||||
import maya.cmds as cmds
|
||||
import maya.mel as mel
|
||||
import maya.utils
|
||||
except ImportError as e:
|
||||
print(f"[Tool] ERROR: Failed to import Maya modules: {e}")
|
||||
raise
|
||||
|
||||
# Silently try to open default commandPort to avoid startup error if it's already in use
|
||||
try:
|
||||
@@ -51,6 +34,19 @@ try:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# =============================================================================
|
||||
# Constants
|
||||
# =============================================================================
|
||||
|
||||
# Command port name
|
||||
COMMAND_PORT_NAME = "commandportDefault"
|
||||
|
||||
# Log levels
|
||||
LOG_DEBUG = 0
|
||||
LOG_INFO = 1
|
||||
LOG_WARNING = 2
|
||||
LOG_ERROR = 3
|
||||
|
||||
# =============================================================================
|
||||
# Configuration
|
||||
# =============================================================================
|
||||
@@ -58,6 +54,9 @@ except Exception:
|
||||
# Shelves to load
|
||||
SHELF_NAMES = ["Nexus_Manage", "Nexus_Modeling", "Nexus_Rigging", "Nexus_Animation", "Nexus_DevTools"]
|
||||
|
||||
# User configuration file path (optional override)
|
||||
USER_CONFIG_FILE = os.path.join(os.path.expanduser("~"), ".nexus_maya_config.py")
|
||||
|
||||
# Tool packages configuration
|
||||
TOOL_CONFIG = {
|
||||
'scripts': [
|
||||
@@ -67,12 +66,10 @@ TOOL_CONFIG = {
|
||||
{'name': 'manage_tools', 'path': 'manage_tools'},
|
||||
],
|
||||
'plugins': [
|
||||
{'name': 'cv_manip.mll', 'path': 'modeling_tools/gs_curvetools/plugins/2024'},
|
||||
{'name': 'ngskintools2.mll', 'path': 'rigging_tools/ngskintools2/plug-ins/2024'},
|
||||
{'name': 'MGPicker_2024x64.mll', 'path': 'animation_tools/mgpicker/MGPicker_Program/Plug-ins'},
|
||||
],
|
||||
'icons': [
|
||||
{'name': 'gs_curvetools', 'path': 'modeling_tools/gs_curvetools/icons'},
|
||||
{'name': 'gs_toolbox', 'path': 'modeling_tools/gs_toolbox/icons'},
|
||||
{'name': 'modit', 'path': 'modeling_tools/ModIt/Icons/Theme_Classic'},
|
||||
{'name': 'creaseplus', 'path': 'modeling_tools/creaseplus/icons'},
|
||||
@@ -107,14 +104,41 @@ _ADDED_SCRIPT_PATHS = []
|
||||
# Utility Functions
|
||||
# =============================================================================
|
||||
|
||||
def _log(msg, level=LOG_INFO):
|
||||
"""
|
||||
Print log message with level control
|
||||
|
||||
Args:
|
||||
msg: Message to print
|
||||
level: LOG_DEBUG, LOG_INFO, LOG_WARNING, or LOG_ERROR
|
||||
"""
|
||||
if level == LOG_DEBUG and not TOOL_DEBUG:
|
||||
return
|
||||
|
||||
prefix_map = {
|
||||
LOG_DEBUG: "[Tool:DEBUG]",
|
||||
LOG_INFO: "[Tool]",
|
||||
LOG_WARNING: "[Tool:WARNING]",
|
||||
LOG_ERROR: "[Tool:ERROR]"
|
||||
}
|
||||
prefix = prefix_map.get(level, "[Tool]")
|
||||
print(f"{prefix} {msg}")
|
||||
|
||||
def _tool_log(msg):
|
||||
"""Print debug message if TOOL_DEBUG is enabled"""
|
||||
if TOOL_DEBUG:
|
||||
print(msg)
|
||||
_log(msg, LOG_DEBUG)
|
||||
|
||||
def _tool_print(msg):
|
||||
"""Print info message"""
|
||||
print(msg)
|
||||
_log(msg, LOG_INFO)
|
||||
|
||||
def _tool_warning(msg):
|
||||
"""Print warning message"""
|
||||
_log(msg, LOG_WARNING)
|
||||
|
||||
def _tool_error(msg):
|
||||
"""Print error message"""
|
||||
_log(msg, LOG_ERROR)
|
||||
|
||||
def _get_script_dir():
|
||||
"""Get the directory containing this script (with fallback)"""
|
||||
@@ -157,16 +181,25 @@ def _check_maya_version():
|
||||
try:
|
||||
maya_version = int(cmds.about(version=True).split()[0])
|
||||
if maya_version < MAYA_MIN_VERSION:
|
||||
_tool_print(f"[Tool] Warning: Maya {maya_version} detected. Minimum supported version is {MAYA_MIN_VERSION}")
|
||||
_tool_warning(f"Maya {maya_version} detected. Minimum supported version is {MAYA_MIN_VERSION}")
|
||||
return False
|
||||
_tool_log(f"[Tool] Maya version: {maya_version}")
|
||||
_tool_log(f"Maya version: {maya_version}")
|
||||
return True
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Warning: Could not determine Maya version: {e}")
|
||||
_tool_warning(f"Could not determine Maya version: {e}")
|
||||
return True # Continue anyway
|
||||
|
||||
def _find_file_in_paths(filename, search_paths):
|
||||
"""Find file in a list of search paths"""
|
||||
"""
|
||||
Find file in a list of search paths
|
||||
|
||||
Args:
|
||||
filename: Name of file to find
|
||||
search_paths: List of directory paths to search
|
||||
|
||||
Returns:
|
||||
Full path to file if found, None otherwise
|
||||
"""
|
||||
for p in search_paths:
|
||||
if not p:
|
||||
continue
|
||||
@@ -175,6 +208,45 @@ def _find_file_in_paths(filename, search_paths):
|
||||
return candidate
|
||||
return None
|
||||
|
||||
def _validate_tool_config():
|
||||
"""
|
||||
Validate TOOL_CONFIG structure
|
||||
|
||||
Returns:
|
||||
True if valid, False otherwise
|
||||
"""
|
||||
try:
|
||||
required_keys = ['scripts', 'plugins', 'icons']
|
||||
for key in required_keys:
|
||||
if key not in TOOL_CONFIG:
|
||||
_tool_error(f"Missing required key in TOOL_CONFIG: {key}")
|
||||
return False
|
||||
|
||||
if not isinstance(TOOL_CONFIG[key], list):
|
||||
_tool_error(f"TOOL_CONFIG['{key}'] must be a list")
|
||||
return False
|
||||
|
||||
# Validate each item has required fields
|
||||
for idx, item in enumerate(TOOL_CONFIG[key]):
|
||||
if not isinstance(item, dict):
|
||||
_tool_error(f"TOOL_CONFIG['{key}'][{idx}] must be a dict")
|
||||
return False
|
||||
|
||||
if 'name' not in item:
|
||||
_tool_error(f"TOOL_CONFIG['{key}'][{idx}] missing 'name' field")
|
||||
return False
|
||||
|
||||
if 'path' not in item:
|
||||
_tool_error(f"TOOL_CONFIG['{key}'][{idx}] missing 'path' field")
|
||||
return False
|
||||
|
||||
_tool_log("TOOL_CONFIG validation passed")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
_tool_error(f"Error validating TOOL_CONFIG: {e}")
|
||||
return False
|
||||
|
||||
def _verify_shelf_icon_references(search_paths):
|
||||
"""Verify that shelf icon references can be resolved"""
|
||||
if not TOOL_DEBUG:
|
||||
@@ -198,9 +270,9 @@ def _verify_shelf_icon_references(search_paths):
|
||||
for img in imgs:
|
||||
found = any(os.path.exists(os.path.join(p, img).replace('\\', '/')) for p in search_paths)
|
||||
if not found:
|
||||
_tool_log(f"[Tool] Warning: Icon '{img}' not found for shelf '{shelf_name}'")
|
||||
_tool_warning(f"Icon '{img}' not found for shelf '{shelf_name}'")
|
||||
except Exception as e:
|
||||
_tool_log(f"[Tool] Icon verification error: {e}")
|
||||
_tool_log(f"Icon verification error: {e}")
|
||||
|
||||
def _remove_shelf_config(shelf_name):
|
||||
"""Remove shelf config from Maya prefs to force reload"""
|
||||
@@ -239,7 +311,7 @@ def setup_icon_paths():
|
||||
if os.path.exists(full_path):
|
||||
icon_paths[name] = full_path
|
||||
else:
|
||||
_tool_print(f"[Tool] Warning: Icon path not found: {full_path}")
|
||||
_tool_warning(f"Icon path not found: {full_path}")
|
||||
|
||||
# Check if already configured
|
||||
global _ICONS_PATHS
|
||||
@@ -273,7 +345,7 @@ def setup_icon_paths():
|
||||
_verify_shelf_icon_references(paths)
|
||||
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error setting up icon paths: {e}")
|
||||
_tool_error(f"Error setting up icon paths: {e}")
|
||||
|
||||
def load_tool_shelves():
|
||||
"""Load Nexus shelves into Maya"""
|
||||
@@ -284,7 +356,7 @@ def load_tool_shelves():
|
||||
script_dir = _get_script_dir()
|
||||
shelf_paths = os.path.join(os.path.dirname(script_dir), "shelves")
|
||||
if not os.path.exists(shelf_paths):
|
||||
_tool_print("[Tool] Shelf directory not found, skipping")
|
||||
_tool_warning("Shelf directory not found, skipping")
|
||||
return
|
||||
|
||||
shelf_path_list = [p.strip() for p in shelf_paths.split(os.pathsep) if p.strip()]
|
||||
@@ -302,7 +374,7 @@ def load_tool_shelves():
|
||||
break
|
||||
|
||||
if not shelf_file_found:
|
||||
_tool_print(f"[Tool] Shelf not found: shelf_{shelf_name}.mel")
|
||||
_tool_warning(f"Shelf not found: shelf_{shelf_name}.mel")
|
||||
continue
|
||||
|
||||
# Remove existing shelf
|
||||
@@ -350,12 +422,12 @@ def load_tool_shelves():
|
||||
_remove_shelf_config(shelf_name)
|
||||
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error loading shelf {shelf_name}: {e}")
|
||||
_tool_error(f"Error loading shelf {shelf_name}: {e}")
|
||||
|
||||
_tool_log(f"[Tool] ✓ Shelves: {loaded_count}/{len(SHELF_NAMES)} loaded")
|
||||
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error loading shelves: {e}")
|
||||
_tool_error(f"Error loading shelves: {e}")
|
||||
|
||||
def load_tool_plugins():
|
||||
"""Load Nexus plugins"""
|
||||
@@ -376,7 +448,7 @@ def load_tool_plugins():
|
||||
|
||||
_tool_log(f"[Tool] Processing plugin: {plugin_name}")
|
||||
|
||||
# First, check the configured path parameter.
|
||||
# First check the configured path parameter
|
||||
plugin_path = None
|
||||
if plugin_rel_path:
|
||||
# Build full path: script_dir/path/plugin_name
|
||||
@@ -389,7 +461,7 @@ def load_tool_plugins():
|
||||
if not plugin_path:
|
||||
plugin_path = _find_file_in_paths(plugin_name, os.environ.get(env_var, '').split(os.pathsep))
|
||||
|
||||
# Try the script directory and parent plug-ins folder last.
|
||||
# Finally, try the script directory and the parent plug-ins folder.
|
||||
if not plugin_path:
|
||||
search_dirs = [
|
||||
script_dir,
|
||||
@@ -398,7 +470,7 @@ def load_tool_plugins():
|
||||
plugin_path = _find_file_in_paths(plugin_name, search_dirs)
|
||||
|
||||
if not plugin_path:
|
||||
_tool_print(f"[Tool] Plugin not found: {plugin_name}")
|
||||
_tool_warning(f"Plugin not found: {plugin_name}")
|
||||
continue
|
||||
|
||||
# Add plugin directory to environment
|
||||
@@ -435,12 +507,12 @@ def load_tool_plugins():
|
||||
loaded_count += 1
|
||||
_LOADED_PLUGINS[plugin_basename] = plugin_path
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error loading plugin {plugin_basename}: {e}")
|
||||
_tool_error(f"Error loading plugin {plugin_basename}: {e}")
|
||||
|
||||
_tool_log(f"[Tool] ✓ Plugins: {loaded_count}/{len(plugin_configs)} loaded")
|
||||
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error loading plugins: {e}")
|
||||
_tool_error(f"Error loading plugins: {e}")
|
||||
|
||||
def load_tool_scripts():
|
||||
"""Add Nexus script paths to sys.path"""
|
||||
@@ -451,7 +523,6 @@ def load_tool_scripts():
|
||||
_tool_log("[Tool] No scripts configured")
|
||||
return
|
||||
|
||||
global _ADDED_SCRIPT_PATHS
|
||||
loaded = 0
|
||||
for cfg in script_configs:
|
||||
name = cfg.get('name', '')
|
||||
@@ -461,7 +532,7 @@ def load_tool_scripts():
|
||||
|
||||
full_path = os.path.normpath(os.path.join(script_dir, path))
|
||||
if not os.path.exists(full_path):
|
||||
_tool_print(f"[Tool] Script path not found: {full_path}")
|
||||
_tool_warning(f"Script path not found: {full_path}")
|
||||
continue
|
||||
|
||||
if full_path not in sys.path:
|
||||
@@ -473,7 +544,219 @@ def load_tool_scripts():
|
||||
_tool_log(f"[Tool] ✓ Script paths: {loaded}/{len(script_configs)} added")
|
||||
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error loading scripts: {e}")
|
||||
_tool_error(f"Error loading scripts: {e}")
|
||||
|
||||
def _parse_mod_file_line(line, maya_version, modules_dir, module_name):
|
||||
"""
|
||||
Parse a single line from .mod file
|
||||
|
||||
Args:
|
||||
line: Line to parse
|
||||
maya_version: Current Maya version
|
||||
modules_dir: Modules directory path
|
||||
module_name: Name of the module
|
||||
|
||||
Returns:
|
||||
Tuple of (in_correct_version, current_module_root) or None
|
||||
"""
|
||||
parts = line.split()
|
||||
|
||||
if len(parts) < 4:
|
||||
return None
|
||||
|
||||
# Detect current platform
|
||||
current_platform = 'win64' if os.name == 'nt' else ('linux' if sys.platform.startswith('linux') else 'mac')
|
||||
|
||||
# Check for version and platform restrictions
|
||||
has_version_requirement = False
|
||||
version_matches = False
|
||||
platform_matches = True # Assume match if no platform specified
|
||||
|
||||
for part in parts:
|
||||
if part.startswith('MAYAVERSION:'):
|
||||
has_version_requirement = True
|
||||
required_version = int(part.split(':')[1])
|
||||
version_matches = (required_version == maya_version)
|
||||
|
||||
if part.startswith('PLATFORM:'):
|
||||
required_platform = part.split(':')[1].lower()
|
||||
platform_matches = (required_platform == current_platform)
|
||||
|
||||
# Both version and platform must match (or not be specified)
|
||||
if has_version_requirement:
|
||||
if version_matches and platform_matches:
|
||||
# Get the module root path (last parameter)
|
||||
current_module_root = parts[-1]
|
||||
if current_module_root.startswith('..'):
|
||||
current_module_root = _norm_path(os.path.join(modules_dir, current_module_root))
|
||||
_tool_print(f"{module_name}: Maya {maya_version} {current_platform} matched, root: {current_module_root}")
|
||||
return (True, current_module_root)
|
||||
else:
|
||||
return (False, None)
|
||||
|
||||
# If there are no version restrictions, it works for all versions (but still check platform)
|
||||
if platform_matches:
|
||||
current_module_root = parts[-1]
|
||||
if current_module_root.startswith('..'):
|
||||
current_module_root = _norm_path(os.path.join(modules_dir, current_module_root))
|
||||
_tool_print(f"{module_name}: No version restriction, root: {current_module_root}")
|
||||
return (True, current_module_root)
|
||||
|
||||
return (False, None)
|
||||
|
||||
def _load_plugins_from_directory(plugins_dir, mod_file):
|
||||
"""
|
||||
Load all plugins from a directory
|
||||
|
||||
Args:
|
||||
plugins_dir: Directory containing plugins
|
||||
mod_file: Name of .mod file for logging
|
||||
|
||||
Returns:
|
||||
Number of plugins loaded
|
||||
"""
|
||||
plugins_loaded = 0
|
||||
|
||||
if not os.path.exists(plugins_dir):
|
||||
_tool_log(f"Plugin dir not found: {plugins_dir}")
|
||||
return 0
|
||||
|
||||
_tool_log(f"Checking plugin dir: {plugins_dir}")
|
||||
|
||||
for plugin_file in os.listdir(plugins_dir):
|
||||
if not plugin_file.endswith(('.mll', '.so', '.bundle', '.py')):
|
||||
continue
|
||||
|
||||
plugin_name = os.path.splitext(plugin_file)[0]
|
||||
plugin_full_path = _norm_path(os.path.join(plugins_dir, plugin_file))
|
||||
|
||||
# Check if already tracked
|
||||
if plugin_name in _LOADED_PLUGINS:
|
||||
_tool_log(f"Plugin already tracked: {plugin_name}")
|
||||
continue
|
||||
|
||||
# Check if already loaded
|
||||
try:
|
||||
is_loaded = cmds.pluginInfo(plugin_name, query=True, loaded=True)
|
||||
except:
|
||||
is_loaded = False
|
||||
|
||||
if not is_loaded:
|
||||
try:
|
||||
cmds.loadPlugin(plugin_full_path, quiet=False)
|
||||
_tool_print(f"✓ Plugin loaded: {plugin_name} (from {mod_file})")
|
||||
plugins_loaded += 1
|
||||
_LOADED_PLUGINS[plugin_name] = plugin_full_path
|
||||
except Exception as e:
|
||||
_tool_error(f"Failed to load {plugin_name}: {e}")
|
||||
else:
|
||||
_tool_log(f"Plugin already loaded: {plugin_name}")
|
||||
_LOADED_PLUGINS[plugin_name] = plugin_full_path
|
||||
|
||||
return plugins_loaded
|
||||
|
||||
def _add_path_to_environment(env_var, path):
|
||||
"""
|
||||
Add a path to an environment variable
|
||||
|
||||
Args:
|
||||
env_var: Environment variable name (e.g., 'MAYA_SCRIPT_PATH')
|
||||
path: Path to add
|
||||
|
||||
Returns:
|
||||
True if added, False if already exists
|
||||
"""
|
||||
if not os.path.exists(path):
|
||||
_tool_warning(f"Path not found for {env_var}: {path}")
|
||||
return False
|
||||
|
||||
# Get current paths
|
||||
current_value = os.environ.get(env_var, '')
|
||||
current_paths = [p.strip() for p in current_value.split(os.pathsep) if p.strip()]
|
||||
|
||||
# Normalize the new path
|
||||
norm_path = _norm_path(path)
|
||||
|
||||
# Check if already in path
|
||||
if norm_path in [_norm_path(p) for p in current_paths]:
|
||||
_tool_log(f"{env_var} already contains: {norm_path}")
|
||||
return False
|
||||
|
||||
# Add to front of path list
|
||||
current_paths.insert(0, norm_path)
|
||||
new_value = os.pathsep.join(current_paths)
|
||||
os.environ[env_var] = new_value
|
||||
|
||||
# Update MEL environment if needed
|
||||
if env_var in ['XBMLANGPATH', 'MAYA_SCRIPT_PATH', 'MAYA_PLUG_IN_PATH']:
|
||||
try:
|
||||
safe_value = new_value.replace('\\', '/').replace('"', '\\"')
|
||||
mel.eval(f'putenv "{env_var}" "{safe_value}";')
|
||||
except Exception as e:
|
||||
_tool_warning(f"Could not update MEL environment for {env_var}: {e}")
|
||||
|
||||
# Also add PYTHONPATH to sys.path for Python imports
|
||||
if env_var == 'PYTHONPATH':
|
||||
if norm_path not in sys.path:
|
||||
sys.path.insert(0, norm_path)
|
||||
_tool_log(f"Added to sys.path: {norm_path}")
|
||||
|
||||
_tool_print(f"✓ Added to {env_var}: {os.path.basename(norm_path)}")
|
||||
return True
|
||||
|
||||
def _load_user_config():
|
||||
"""
|
||||
Load user configuration from optional config file
|
||||
Allows users to override default TOOL_CONFIG settings
|
||||
"""
|
||||
global TOOL_CONFIG, SHELF_NAMES
|
||||
|
||||
if not os.path.exists(USER_CONFIG_FILE):
|
||||
_tool_log(f"No user config file found at: {USER_CONFIG_FILE}")
|
||||
return
|
||||
|
||||
try:
|
||||
_tool_print(f"Loading user configuration from: {USER_CONFIG_FILE}")
|
||||
|
||||
# Create a namespace for user config
|
||||
user_namespace = {}
|
||||
|
||||
# Execute user config file
|
||||
with open(USER_CONFIG_FILE, 'r', encoding='utf-8') as f:
|
||||
exec(f.read(), user_namespace)
|
||||
|
||||
# Override TOOL_CONFIG if provided
|
||||
if 'TOOL_CONFIG' in user_namespace:
|
||||
user_config = user_namespace['TOOL_CONFIG']
|
||||
|
||||
# Merge configurations
|
||||
for key in ['scripts', 'plugins', 'icons']:
|
||||
if key in user_config:
|
||||
if key in TOOL_CONFIG:
|
||||
# Extend existing config
|
||||
TOOL_CONFIG[key].extend(user_config[key])
|
||||
else:
|
||||
# Add new key
|
||||
TOOL_CONFIG[key] = user_config[key]
|
||||
|
||||
_tool_print("✓ User TOOL_CONFIG loaded and merged")
|
||||
|
||||
# Override SHELF_NAMES if provided
|
||||
if 'SHELF_NAMES' in user_namespace:
|
||||
user_shelves = user_namespace['SHELF_NAMES']
|
||||
if isinstance(user_shelves, list):
|
||||
# Extend shelf list
|
||||
for shelf in user_shelves:
|
||||
if shelf not in SHELF_NAMES:
|
||||
SHELF_NAMES.append(shelf)
|
||||
_tool_print(f"✓ User SHELF_NAMES loaded: {user_shelves}")
|
||||
|
||||
_tool_print("✓ User configuration applied successfully")
|
||||
|
||||
except Exception as e:
|
||||
_tool_error(f"Error loading user config: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
def load_project_modules():
|
||||
"""Load plugins defined in .mod files from the modules directory."""
|
||||
@@ -487,112 +770,155 @@ def load_project_modules():
|
||||
modules_dir = _norm_path(os.path.join(project_root, "modules"))
|
||||
|
||||
if not os.path.exists(modules_dir):
|
||||
_tool_log(f"[Tool] Modules directory not found: {modules_dir}")
|
||||
_tool_log(f"Modules directory not found: {modules_dir}")
|
||||
return
|
||||
|
||||
# Find all .mod files
|
||||
mod_files = [f for f in os.listdir(modules_dir) if f.endswith('.mod')]
|
||||
|
||||
if not mod_files:
|
||||
_tool_log(f"[Tool] No .mod files found in: {modules_dir}")
|
||||
_tool_log(f"No .mod files found in: {modules_dir}")
|
||||
return
|
||||
|
||||
_tool_print(f"[Tool] Found {len(mod_files)} module(s): {', '.join(mod_files)}")
|
||||
_tool_print(f"Found {len(mod_files)} module(s): {', '.join(mod_files)}")
|
||||
|
||||
# TWO-PASS APPROACH: First configure all environment variables, then load plugins
|
||||
# This ensures dependencies are available before plugins initialize
|
||||
|
||||
# PASS 1: Configure all environment variables (including MAYA_PLUG_IN_PATH paths)
|
||||
# Track processed modules to avoid duplicates
|
||||
processed_modules = set()
|
||||
|
||||
# Parse .mod files and load plugins.
|
||||
plugins_loaded = 0
|
||||
for mod_file in mod_files:
|
||||
mod_path = os.path.join(modules_dir, mod_file)
|
||||
_tool_log(f"[Tool] Processing: {mod_file}")
|
||||
module_name = os.path.splitext(mod_file)[0]
|
||||
|
||||
try:
|
||||
current_module_root = None
|
||||
in_correct_version = False
|
||||
module_key = None
|
||||
|
||||
with open(mod_path, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
|
||||
# Skip comments and empty lines.
|
||||
# Skip comments and empty lines
|
||||
if not line or line.startswith('#') or line.startswith('//'):
|
||||
continue
|
||||
|
||||
# Parse module definition lines (starting with +)
|
||||
if line.startswith('+'):
|
||||
parts = line.split()
|
||||
in_correct_version = False
|
||||
current_module_root = None
|
||||
|
||||
if len(parts) >= 4:
|
||||
# Check for version requirements.
|
||||
has_version_requirement = False
|
||||
for part in parts:
|
||||
if part.startswith('MAYAVERSION:'):
|
||||
has_version_requirement = True
|
||||
required_version = int(part.split(':')[1])
|
||||
if required_version == maya_version:
|
||||
in_correct_version = True
|
||||
# Get the module root path (last parameter)
|
||||
current_module_root = parts[-1]
|
||||
if current_module_root.startswith('..'):
|
||||
current_module_root = _norm_path(os.path.join(modules_dir, current_module_root))
|
||||
_tool_log(f"[Tool] Version matched for Maya {maya_version}: {current_module_root}")
|
||||
break
|
||||
result = _parse_mod_file_line(line, maya_version, modules_dir, module_name)
|
||||
if result:
|
||||
in_correct_version, current_module_root = result
|
||||
# Create unique key for this module version
|
||||
module_key = f"{module_name}:{maya_version}:{current_module_root}"
|
||||
|
||||
# If there is no version requirement, it applies to all versions.
|
||||
if not has_version_requirement:
|
||||
in_correct_version = True
|
||||
current_module_root = parts[-1]
|
||||
if current_module_root.startswith('..'):
|
||||
current_module_root = _norm_path(os.path.join(modules_dir, current_module_root))
|
||||
_tool_log(f"[Tool] Module without version restriction loaded: {current_module_root}")
|
||||
# Skip if already processed
|
||||
if module_key in processed_modules:
|
||||
_tool_log(f"Skipping duplicate module definition: {module_key}")
|
||||
in_correct_version = False
|
||||
current_module_root = None
|
||||
continue
|
||||
|
||||
processed_modules.add(module_key)
|
||||
else:
|
||||
in_correct_version = False
|
||||
current_module_root = None
|
||||
module_key = None
|
||||
|
||||
# Only process matching version MAYA_PLUG_IN_PATH
|
||||
# Process ALL environment variables in first pass (including MAYA_PLUG_IN_PATH to env, but don't load plugins)
|
||||
elif in_correct_version and current_module_root and ('+:=' in line or '+=' in line):
|
||||
if line.startswith('MAYA_PLUG_IN_PATH'):
|
||||
# Add plugin directory to MAYA_PLUG_IN_PATH environment, but don't load plugins yet
|
||||
plugin_path_relative = line.split('+:=')[-1].strip() if '+:=' in line else line.split('+=')[-1].strip()
|
||||
plugins_dir = _norm_path(os.path.join(current_module_root, plugin_path_relative))
|
||||
_add_path_to_environment('MAYA_PLUG_IN_PATH', plugins_dir)
|
||||
|
||||
elif line.startswith('MAYA_SCRIPT_PATH'):
|
||||
script_path_relative = line.split('+:=')[-1].strip() if '+:=' in line else line.split('+=')[-1].strip()
|
||||
script_path = _norm_path(os.path.join(current_module_root, script_path_relative))
|
||||
_add_path_to_environment('MAYA_SCRIPT_PATH', script_path)
|
||||
if script_path not in sys.path:
|
||||
sys.path.insert(0, script_path)
|
||||
|
||||
elif line.startswith('XBMLANGPATH'):
|
||||
icon_path_relative = line.split('+:=')[-1].strip() if '+:=' in line else line.split('+=')[-1].strip()
|
||||
icon_path = _norm_path(os.path.join(current_module_root, icon_path_relative))
|
||||
_add_path_to_environment('XBMLANGPATH', icon_path)
|
||||
|
||||
else:
|
||||
# Handle PATH, PYTHONPATH, and other environment variables
|
||||
try:
|
||||
env_var = line.split('+')[0].strip()
|
||||
rel_path = line.split('+:=')[-1].strip() if '+:=' in line else line.split('+=')[-1].strip()
|
||||
full_path = _norm_path(os.path.join(current_module_root, rel_path))
|
||||
_add_path_to_environment(env_var, full_path)
|
||||
except Exception as e:
|
||||
_tool_log(f"Could not process environment variable line: {line}, error: {e}")
|
||||
|
||||
except Exception as e:
|
||||
_tool_error(f"Error processing environment variables in {mod_file}: {e}")
|
||||
|
||||
# PASS 2: Now load plugins with all dependencies configured
|
||||
_tool_log("Environment variables configured, now loading plugins...")
|
||||
plugins_loaded = 0
|
||||
processed_modules.clear() # Reset for second pass
|
||||
|
||||
for mod_file in mod_files:
|
||||
mod_path = os.path.join(modules_dir, mod_file)
|
||||
module_name = os.path.splitext(mod_file)[0]
|
||||
|
||||
try:
|
||||
current_module_root = None
|
||||
in_correct_version = False
|
||||
module_key = None
|
||||
|
||||
with open(mod_path, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
|
||||
if not line or line.startswith('#') or line.startswith('//'):
|
||||
continue
|
||||
|
||||
if line.startswith('+'):
|
||||
result = _parse_mod_file_line(line, maya_version, modules_dir, module_name)
|
||||
if result:
|
||||
in_correct_version, current_module_root = result
|
||||
module_key = f"{module_name}:{maya_version}:{current_module_root}"
|
||||
|
||||
# Skip if already processed
|
||||
if module_key in processed_modules:
|
||||
_tool_log(f"Skipping duplicate module definition for plugin loading: {module_key}")
|
||||
in_correct_version = False
|
||||
current_module_root = None
|
||||
continue
|
||||
|
||||
processed_modules.add(module_key)
|
||||
else:
|
||||
in_correct_version = False
|
||||
current_module_root = None
|
||||
module_key = None
|
||||
|
||||
# Now load plugins
|
||||
elif line.startswith('MAYA_PLUG_IN_PATH') and in_correct_version and current_module_root:
|
||||
if '+:=' in line or '+=' in line:
|
||||
plugin_path_relative = line.split('=')[-1].strip()
|
||||
plugin_path_relative = line.split('+:=')[-1].strip() if '+:=' in line else line.split('+=')[-1].strip()
|
||||
plugins_dir = _norm_path(os.path.join(current_module_root, plugin_path_relative))
|
||||
|
||||
if os.path.exists(plugins_dir):
|
||||
_tool_log(f"[Tool] Checking plugin dir: {plugins_dir}")
|
||||
|
||||
for plugin_file in os.listdir(plugins_dir):
|
||||
if plugin_file.endswith(('.mll', '.so', '.bundle', '.py')):
|
||||
plugin_name = os.path.splitext(plugin_file)[0]
|
||||
plugin_full_path = os.path.join(plugins_dir, plugin_file)
|
||||
|
||||
# Check if already loaded.
|
||||
if plugin_name in _LOADED_PLUGINS:
|
||||
continue
|
||||
|
||||
try:
|
||||
is_loaded = cmds.pluginInfo(plugin_name, query=True, loaded=True)
|
||||
except:
|
||||
is_loaded = False
|
||||
|
||||
if not is_loaded:
|
||||
try:
|
||||
cmds.loadPlugin(plugin_full_path, quiet=True)
|
||||
_tool_print(f"[Tool] ✓ Plugin loaded: {plugin_name} (from {mod_file})")
|
||||
plugins_loaded += 1
|
||||
_LOADED_PLUGINS[plugin_name] = plugin_full_path
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Failed to load {plugin_name}: {e}")
|
||||
else:
|
||||
_tool_log(f"[Tool] Plugin dir not found: {plugins_dir}")
|
||||
plugins_loaded += _load_plugins_from_directory(plugins_dir, mod_file)
|
||||
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error processing {mod_file}: {e}")
|
||||
_tool_error(f"Error processing {mod_file}: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if plugins_loaded > 0:
|
||||
_tool_print(f"[Tool] ✓ Total {plugins_loaded} module plugin(s) loaded")
|
||||
_tool_print(f"✓ Total {plugins_loaded} module plugin(s) loaded")
|
||||
else:
|
||||
_tool_print(f"[Tool] No module plugins loaded")
|
||||
_tool_print("No module plugins loaded")
|
||||
|
||||
except Exception as e:
|
||||
_tool_print(f"[Tool] Error loading modules: {e}")
|
||||
_tool_error(f"Error loading modules: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -602,18 +928,18 @@ def setup_command_port():
|
||||
try:
|
||||
# Check if already open
|
||||
try:
|
||||
port_exists = bool(mel.eval('commandPort -q -name "commandportDefault"'))
|
||||
port_exists = bool(mel.eval(f'commandPort -q -name "{COMMAND_PORT_NAME}"'))
|
||||
except Exception:
|
||||
port_exists = False
|
||||
|
||||
if port_exists:
|
||||
_tool_log("[Tool] Command port already open")
|
||||
_tool_log("Command port already open")
|
||||
_COMMAND_PORT_OPENED = True
|
||||
return
|
||||
|
||||
# Open command port
|
||||
mel.eval('commandPort -securityWarning -name "commandportDefault";')
|
||||
_tool_log("[Tool] ✓ Command port opened")
|
||||
mel.eval(f'commandPort -securityWarning -name "{COMMAND_PORT_NAME}";')
|
||||
_tool_log("✓ Command port opened")
|
||||
_COMMAND_PORT_OPENED = True
|
||||
|
||||
except Exception as e:
|
||||
@@ -630,15 +956,19 @@ def initialize_tool():
|
||||
print("[Tool] Nexus Plugin System - Initializing...")
|
||||
print("=" * 80)
|
||||
|
||||
# Validate configuration
|
||||
if not _validate_tool_config():
|
||||
_tool_error("Configuration validation failed, continuing with caution...")
|
||||
|
||||
# Check Maya version compatibility
|
||||
if not _check_maya_version():
|
||||
print("[Tool] Warning: Running on unsupported Maya version")
|
||||
_tool_warning("Running on unsupported Maya version")
|
||||
|
||||
# Set icon paths first, so shelves can find icons
|
||||
# First, set the icon path so that the shelf can find the icon when it loads.
|
||||
setup_icon_paths()
|
||||
|
||||
# Load project modules
|
||||
load_project_modules() # Automatic loading using Maya standard module system
|
||||
load_project_modules() # Use Maya standard module systems for automatic loading.
|
||||
|
||||
# Setup command port
|
||||
setup_command_port()
|
||||
@@ -673,11 +1003,11 @@ def cleanup_on_exit():
|
||||
global _COMMAND_PORT_OPENED
|
||||
if _COMMAND_PORT_OPENED:
|
||||
try:
|
||||
if mel.eval('commandPort -q -name "commandportDefault"'):
|
||||
mel.eval('commandPort -cl "commandportDefault"')
|
||||
_tool_log("[Tool] ✓ Command port closed")
|
||||
if mel.eval(f'commandPort -q -name "{COMMAND_PORT_NAME}"'):
|
||||
mel.eval(f'commandPort -cl "{COMMAND_PORT_NAME}"')
|
||||
_tool_log("✓ Command port closed")
|
||||
except Exception as e:
|
||||
_tool_log(f"[Tool] Could not close command port: {e}")
|
||||
_tool_log(f"Could not close command port: {e}")
|
||||
|
||||
# Unload plugins
|
||||
if _LOADED_PLUGINS:
|
||||
@@ -725,4 +1055,4 @@ def cleanup_on_exit():
|
||||
_tool_log(f"[Tool] Cleanup error: {e}")
|
||||
|
||||
# Register cleanup function
|
||||
atexit.register(cleanup_on_exit)
|
||||
atexit.register(cleanup_on_exit)
|
||||
|
||||