Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Add UniScale option for games compatible #9 . The new option have bee…
Browse files Browse the repository at this point in the history
…n added but needs carefull testing
  • Loading branch information
miquelcampos committed Jun 21, 2018
1 parent 0dec38a commit 2e37e78
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 44 deletions.
3 changes: 3 additions & 0 deletions shifter/component/__init__.py
Expand Up @@ -280,6 +280,9 @@ def addJoint(self,
# TODO: fix squash stretch solver to scale the joint uniform
# the next line cheat the uniform scaling only fo X or Y axis
# oriented joints
if self.options["force_uniScale"]:
UniScale = True

if UniScale:
pm.connectAttr(dm_node + ".outputScaleZ", jnt + ".sx")
pm.connectAttr(dm_node + ".outputScaleZ", jnt + ".sy")
Expand Down
7 changes: 7 additions & 0 deletions shifter/guide.py
Expand Up @@ -305,6 +305,7 @@ def addParameters(self):
# --------------------------------------------------
# Settings
self.pJointRig = self.addParam("joint_rig", "bool", True)
self.pJointRig = self.addParam("force_uniScale", "bool", False)
self.pSynoptic = self.addParam("synoptic", "string", "")

self.pDoPreCustomStep = self.addParam("doPreCustomStep", "bool", False)
Expand Down Expand Up @@ -1011,6 +1012,8 @@ def populate_controls(self):
self.root.attr("skin").get())
self.populateCheck(
self.guideSettingsTab.jointRig_checkBox, "joint_rig")
self.populateCheck(
self.guideSettingsTab.force_uniScale_checkBox, "force_uniScale")
self.populateAvailableSynopticTabs()

for item in self.root.attr("synoptic").get().split(","):
Expand Down Expand Up @@ -1091,6 +1094,10 @@ def create_connections(self):
partial(self.updateCheck,
tap.jointRig_checkBox,
"joint_rig"))
tap.force_uniScale_checkBox.stateChanged.connect(
partial(self.updateCheck,
tap.force_uniScale_checkBox,
"force_uniScale"))
tap.addTab_pushButton.clicked.connect(
partial(self.moveFromListWidget2ListWidget,
tap.available_listWidget,
Expand Down
100 changes: 56 additions & 44 deletions shifter/guideUI.py
@@ -1,5 +1,13 @@
import mgear.core.pyqt as gqt
from mgear.vendor.Qt import QtCore, QtWidgets
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'C:/datawork/mgear_dev/mgear_dist/shifter/shifter/guideUI.ui'
#
# Created: Thu Jun 21 14:06:41 2018
# by: pyside2-uic running on PySide2 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!

from PySide2 import QtCore, QtGui, QtWidgets

class Ui_Form(object):
def setupUi(self, Form):
Expand Down Expand Up @@ -244,6 +252,9 @@ def setupUi(self, Form):
self.jointRig_checkBox = QtWidgets.QCheckBox(self.groupBox_3)
self.jointRig_checkBox.setObjectName("jointRig_checkBox")
self.gridLayout_5.addWidget(self.jointRig_checkBox, 0, 0, 1, 1)
self.force_uniScale_checkBox = QtWidgets.QCheckBox(self.groupBox_3)
self.force_uniScale_checkBox.setObjectName("force_uniScale_checkBox")
self.gridLayout_5.addWidget(self.force_uniScale_checkBox, 1, 0, 1, 1)
self.gridLayout_2.addWidget(self.groupBox_3, 4, 0, 1, 1)
self.groupBox_6 = QtWidgets.QGroupBox(Form)
self.groupBox_6.setObjectName("groupBox_6")
Expand Down Expand Up @@ -274,46 +285,47 @@ def setupUi(self, Form):
QtCore.QMetaObject.connectSlotsByName(Form)

def retranslateUi(self, Form):
Form.setWindowTitle(gqt.fakeTranslate("Form", "Form", None, -1))
self.groupBox_5.setTitle(gqt.fakeTranslate("Form", "Color Settings", None, -1))
self.label.setText(gqt.fakeTranslate("Form", "Left", None, -1))
self.label_2.setText(gqt.fakeTranslate("Form", "Center", None, -1))
self.label_3.setText(gqt.fakeTranslate("Form", "Right", None, -1))
self.L_color_fk_label.setText(gqt.fakeTranslate("Form", "FK", None, -1))
self.L_color_fk_label_5.setText(gqt.fakeTranslate("Form", "FK", None, -1))
self.L_color_fk_label_3.setText(gqt.fakeTranslate("Form", "FK", None, -1))
self.L_color_fk_label_2.setText(gqt.fakeTranslate("Form", "IK", None, -1))
self.L_color_fk_label_6.setText(gqt.fakeTranslate("Form", "IK", None, -1))
self.L_color_fk_label_4.setText(gqt.fakeTranslate("Form", " IK", None, -1))
self.groupBox.setTitle(gqt.fakeTranslate("Form", "Rig Settings", None, -1))
self.rigName_label.setText(gqt.fakeTranslate("Form", "Rig Name", None, -1))
self.mode_label.setText(gqt.fakeTranslate("Form", "Debug Mode", None, -1))
self.mode_comboBox.setItemText(0, gqt.fakeTranslate("Form", "Final", None, -1))
self.mode_comboBox.setItemText(1, gqt.fakeTranslate("Form", "WIP", None, -1))
self.step_label.setText(gqt.fakeTranslate("Form", "Guide Build Steps:", None, -1))
self.step_comboBox.setItemText(0, gqt.fakeTranslate("Form", "All Steps", None, -1))
self.step_comboBox.setItemText(1, gqt.fakeTranslate("Form", "Objects", None, -1))
self.step_comboBox.setItemText(2, gqt.fakeTranslate("Form", "Attributes", None, -1))
self.step_comboBox.setItemText(3, gqt.fakeTranslate("Form", "Operators", None, -1))
self.step_comboBox.setItemText(4, gqt.fakeTranslate("Form", "Connect", None, -1))
self.step_comboBox.setItemText(5, gqt.fakeTranslate("Form", "Joints", None, -1))
self.step_comboBox.setItemText(6, gqt.fakeTranslate("Form", "Finalize", None, -1))
self.groupBox_2.setTitle(gqt.fakeTranslate("Form", "Skinning Settings", None, -1))
self.importSkin_checkBox.setText(gqt.fakeTranslate("Form", "Import Skin", None, -1))
self.skin_label.setText(gqt.fakeTranslate("Form", "Skin Path", None, -1))
self.loadSkinPath_pushButton.setText(gqt.fakeTranslate("Form", "Load Path", None, -1))
self.groupBox_4.setTitle(gqt.fakeTranslate("Form", "Synoptic Settings", None, -1))
self.rigTabs_label.setText(gqt.fakeTranslate("Form", "Rig Tabs", None, -1))
self.addTab_pushButton.setText(gqt.fakeTranslate("Form", "<<", None, -1))
self.removeTab_pushButton.setText(gqt.fakeTranslate("Form", ">>", None, -1))
self.available_label.setText(gqt.fakeTranslate("Form", "Available Tabs", None, -1))
self.groupBox_3.setTitle(gqt.fakeTranslate("Form", "Joint Settings", None, -1))
self.jointRig_checkBox.setText(gqt.fakeTranslate("Form", "Separated Joint Structure", None, -1))
self.groupBox_6.setTitle(gqt.fakeTranslate("Form", "Animation Channels Settings", None, -1))
self.proxyChannels_checkBox.setText(gqt.fakeTranslate("Form", "Add Internal Proxy Channels", None, -1))
self.classicChannelNames_checkBox.setToolTip(gqt.fakeTranslate("Form", "<html><head/><body><p>If this option is checked. The channel name will have unique full name. </p><p align=\"center\"><span style=\" font-weight:600;\">i.e: &quot;arm_L0_blend&quot;</span><br/></p><p>If the option is unchecked. The channel will use the simple name. </p><p align=\"center\"><span style=\" font-weight:600;\">i.e: &quot;arm_blend&quot;</span><br/></p><p><span style=\" font-weight:600;\">NOTE</span>: With the option unchecked. If the channel host (uiHost) have 2 or more componets of the same type. The connection will be shared amoung all the componets with the same name channel. </p><p><span style=\" font-weight:600;\">i.e:</span> If we have 2 arms, the channels will be shared for both arms. To avoid this behaviour with the unchecked option, please use a unique channel host for each component.</p></body></html>", None, -1))
self.classicChannelNames_checkBox.setText(gqt.fakeTranslate("Form", "Use Classic Channel Names (All channels will have unique names.)", None, -1))
self.groupBox_7.setTitle(gqt.fakeTranslate("Form", "Base Rig Control", None, -1))
self.worldCtl_checkBox.setToolTip(gqt.fakeTranslate("Form", "<html><head/><body><p>Shifter creates by default a Base control called &quot;<span style=\" font-weight:600;\">global_C0_ctl</span>&quot;. </p><p>Since this control is not accesible from any guide locator. Is not possible to add it as a space reference.</p><p>If this option is active, The base control will be named &quot;<span style=\" font-weight:600;\">world_ctl</span>&quot; and we can add &quot;<span style=\" font-weight:600;\">global_C0_ctl</span>&quot; as a regular &quot;Control_01&quot; component. </p><p>This way we can use it as space reference.</p><p>The biped guide template is configured with this structure.</p></body></html>", None, -1))
self.worldCtl_checkBox.setText(gqt.fakeTranslate("Form", "Use World Ctl", None, -1))
Form.setWindowTitle(QtWidgets.QApplication.translate("Form", "Form", None, -1))
self.groupBox_5.setTitle(QtWidgets.QApplication.translate("Form", "Color Settings", None, -1))
self.label.setText(QtWidgets.QApplication.translate("Form", "Left", None, -1))
self.label_2.setText(QtWidgets.QApplication.translate("Form", "Center", None, -1))
self.label_3.setText(QtWidgets.QApplication.translate("Form", "Right", None, -1))
self.L_color_fk_label.setText(QtWidgets.QApplication.translate("Form", "FK", None, -1))
self.L_color_fk_label_5.setText(QtWidgets.QApplication.translate("Form", "FK", None, -1))
self.L_color_fk_label_3.setText(QtWidgets.QApplication.translate("Form", "FK", None, -1))
self.L_color_fk_label_2.setText(QtWidgets.QApplication.translate("Form", "IK", None, -1))
self.L_color_fk_label_6.setText(QtWidgets.QApplication.translate("Form", "IK", None, -1))
self.L_color_fk_label_4.setText(QtWidgets.QApplication.translate("Form", " IK", None, -1))
self.groupBox.setTitle(QtWidgets.QApplication.translate("Form", "Rig Settings", None, -1))
self.rigName_label.setText(QtWidgets.QApplication.translate("Form", "Rig Name", None, -1))
self.mode_label.setText(QtWidgets.QApplication.translate("Form", "Debug Mode", None, -1))
self.mode_comboBox.setItemText(0, QtWidgets.QApplication.translate("Form", "Final", None, -1))
self.mode_comboBox.setItemText(1, QtWidgets.QApplication.translate("Form", "WIP", None, -1))
self.step_label.setText(QtWidgets.QApplication.translate("Form", "Guide Build Steps:", None, -1))
self.step_comboBox.setItemText(0, QtWidgets.QApplication.translate("Form", "All Steps", None, -1))
self.step_comboBox.setItemText(1, QtWidgets.QApplication.translate("Form", "Objects", None, -1))
self.step_comboBox.setItemText(2, QtWidgets.QApplication.translate("Form", "Attributes", None, -1))
self.step_comboBox.setItemText(3, QtWidgets.QApplication.translate("Form", "Operators", None, -1))
self.step_comboBox.setItemText(4, QtWidgets.QApplication.translate("Form", "Connect", None, -1))
self.step_comboBox.setItemText(5, QtWidgets.QApplication.translate("Form", "Joints", None, -1))
self.step_comboBox.setItemText(6, QtWidgets.QApplication.translate("Form", "Finalize", None, -1))
self.groupBox_2.setTitle(QtWidgets.QApplication.translate("Form", "Skinning Settings", None, -1))
self.importSkin_checkBox.setText(QtWidgets.QApplication.translate("Form", "Import Skin", None, -1))
self.skin_label.setText(QtWidgets.QApplication.translate("Form", "Skin Path", None, -1))
self.loadSkinPath_pushButton.setText(QtWidgets.QApplication.translate("Form", "Load Path", None, -1))
self.groupBox_4.setTitle(QtWidgets.QApplication.translate("Form", "Synoptic Settings", None, -1))
self.rigTabs_label.setText(QtWidgets.QApplication.translate("Form", "Rig Tabs", None, -1))
self.addTab_pushButton.setText(QtWidgets.QApplication.translate("Form", "<<", None, -1))
self.removeTab_pushButton.setText(QtWidgets.QApplication.translate("Form", ">>", None, -1))
self.available_label.setText(QtWidgets.QApplication.translate("Form", "Available Tabs", None, -1))
self.groupBox_3.setTitle(QtWidgets.QApplication.translate("Form", "Joint Settings", None, -1))
self.jointRig_checkBox.setText(QtWidgets.QApplication.translate("Form", "Separated Joint Structure", None, -1))
self.force_uniScale_checkBox.setText(QtWidgets.QApplication.translate("Form", "Force uniform scaliing in all joints by connection all axis to Z axis", None, -1))
self.groupBox_6.setTitle(QtWidgets.QApplication.translate("Form", "Animation Channels Settings", None, -1))
self.proxyChannels_checkBox.setText(QtWidgets.QApplication.translate("Form", "Add Internal Proxy Channels", None, -1))
self.classicChannelNames_checkBox.setToolTip(QtWidgets.QApplication.translate("Form", "<html><head/><body><p>If this option is checked. The channel name will have unique full name. </p><p align=\"center\"><span style=\" font-weight:600;\">i.e: &quot;arm_L0_blend&quot;</span><br/></p><p>If the option is unchecked. The channel will use the simple name. </p><p align=\"center\"><span style=\" font-weight:600;\">i.e: &quot;arm_blend&quot;</span><br/></p><p><span style=\" font-weight:600;\">NOTE</span>: With the option unchecked. If the channel host (uiHost) have 2 or more componets of the same type. The connection will be shared amoung all the componets with the same name channel. </p><p><span style=\" font-weight:600;\">i.e:</span> If we have 2 arms, the channels will be shared for both arms. To avoid this behaviour with the unchecked option, please use a unique channel host for each component.</p></body></html>", None, -1))
self.classicChannelNames_checkBox.setText(QtWidgets.QApplication.translate("Form", "Use Classic Channel Names (All channels will have unique names.)", None, -1))
self.groupBox_7.setTitle(QtWidgets.QApplication.translate("Form", "Base Rig Control", None, -1))
self.worldCtl_checkBox.setToolTip(QtWidgets.QApplication.translate("Form", "<html><head/><body><p>Shifter creates by default a Base control called &quot;<span style=\" font-weight:600;\">global_C0_ctl</span>&quot;. </p><p>Since this control is not accesible from any guide locator. Is not possible to add it as a space reference.</p><p>If this option is active, The base control will be named &quot;<span style=\" font-weight:600;\">world_ctl</span>&quot; and we can add &quot;<span style=\" font-weight:600;\">global_C0_ctl</span>&quot; as a regular &quot;Control_01&quot; component. </p><p>This way we can use it as space reference.</p><p>The biped guide template is configured with this structure.</p></body></html>", None, -1))
self.worldCtl_checkBox.setText(QtWidgets.QApplication.translate("Form", "Use World Ctl", None, -1))

7 changes: 7 additions & 0 deletions shifter/guideUI.ui
Expand Up @@ -483,6 +483,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="force_uniScale_checkBox">
<property name="text">
<string>Force uniform scaling in all joints by connection all axis to Z axis</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 2e37e78

Please sign in to comment.