Created
July 13, 2018 22:32
-
-
Save miquelcampos/656e4a1f9951321525b962e3ec70e193 to your computer and use it in GitHub Desktop.
mGear shifter vanilla chain 01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MGEAR is under the terms of the MIT License | |
# Copyright (c) 2016 Jeremie Passerin, Miquel Campos | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
########################################################## | |
# GLOBAL | |
########################################################## | |
# Maya | |
import pymel.core as pm | |
import pymel.core.datatypes as dt | |
# mgear | |
from mgear.maya.shifter.component import MainComponent | |
import mgear.maya.primitive as pri | |
import mgear.maya.transform as tra | |
import mgear.maya.applyop as aop | |
import mgear.maya.attribute as att | |
import mgear.maya.node as nod | |
import mgear.maya.vector as vec | |
########################################################## | |
# COMPONENT | |
########################################################## | |
## The main component class. | |
class Component(MainComponent): | |
# ===================================================== | |
# OBJECTS | |
# ===================================================== | |
## Add all the objects needed to create the component. | |
# @param self | |
def addObjects(self): | |
self.normal = self.guide.blades["blade"].z*-1 | |
self.binormal = self.guide.blades["blade"].x | |
self.isFk = self.settings["mode"] != 1 | |
self.isIk = self.settings["mode"] != 0 | |
self.isFkIk = self.settings["mode"] == 2 | |
self.WIP = self.options["mode"] | |
# FK controllers ------------------------------------ | |
if self.isFk: | |
self.fk_npo = [] | |
self.fk_ctl = [] | |
self.fk_ref = [] | |
self.fk_off = [] | |
t = self.guide.tra["root"] | |
self.ik_cns = pri.addTransform(self.root, self.getName("ik_cns"), t) | |
parent = self.ik_cns | |
tOld = False | |
fk_ctl = None | |
self.previusTag = self.parentCtlTag | |
for i, t in enumerate(tra.getChainTransform(self.guide.apos, self.normal, self.negate)): | |
dist = vec.getDistance(self.guide.apos[i], self.guide.apos[i+1]) | |
if self.settings["neutralpose"] or not tOld: | |
tnpo = t | |
else: | |
tnpo = tra.setMatrixPosition(tOld, tra.getPositionFromMatrix(t)) | |
if i: | |
tref = tra.setMatrixPosition(tOld, tra.getPositionFromMatrix(t)) | |
fk_ref = pri.addTransform(fk_ctl, self.getName("fk%s_ref"%i), tref) | |
self.fk_ref.append(fk_ref) | |
else: | |
tref = t | |
fk_off = pri.addTransform(parent, self.getName("fk%s_off"%i), tref) | |
fk_npo = pri.addTransform(fk_off, self.getName("fk%s_npo"%i), tnpo) | |
fk_ctl = self.addCtl(fk_npo, "fk%s_ctl"%i, t, self.color_fk, "cube", w=dist, h=self.size*.1, d=self.size*.1, po=dt.Vector(dist*.5*self.n_factor,0,0), tp=self.previusTag) | |
self.fk_off.append(fk_off) | |
self.fk_npo.append(fk_npo) | |
self.fk_ctl.append(fk_ctl) | |
tOld = t | |
self.previusTag = fk_ctl | |
# IK controllers ------------------------------------ | |
if self.isIk: | |
normal = vec.getTransposedVector(self.normal, [self.guide.apos[0], self.guide.apos[1]], [self.guide.apos[-2], self.guide.apos[-1]]) | |
t = tra.getTransformLookingAt(self.guide.apos[-2], self.guide.apos[-1], normal, "xy", self.negate) | |
t = tra.setMatrixPosition(t, self.guide.apos[-1]) | |
self.ik_cns = pri.addTransform(self.root, self.getName("ik_cns"), t) | |
self.ikcns_ctl = self.addCtl(self.ik_cns, "ikcns_ctl", t, self.color_ik, "null", w=self.size, tp=self.parentCtlTag) | |
self.ik_ctl = self.addCtl(self.ikcns_ctl, "ik_ctl", t, self.color_ik, "cube", w=self.size*.3, h=self.size*.3, d=self.size*.3, tp=self.ikcns_ctl) | |
att.setKeyableAttributes(self.ik_ctl, self.t_params) | |
v = self.guide.apos[-1] - self.guide.apos[0] | |
v = v ^ self.normal | |
v.normalize() | |
v *= self.size | |
v += self.guide.apos[1] | |
self.upv_cns = pri.addTransformFromPos(self.root, self.getName("upv_cns"), v) | |
self.upv_ctl = self.addCtl(self.upv_cns, "upv_ctl", tra.getTransform(self.upv_cns), self.color_ik, "diamond", w=self.size*.1, tp=self.parentCtlTag) | |
att.setKeyableAttributes(self.upv_ctl, self.t_params) | |
# Chain | |
self.chain = pri.add2DChain(self.root, self.getName("chain"), self.guide.apos, self.normal, self.negate) | |
self.chain[0].attr("visibility").set(self.WIP) | |
# Chain of deformers ------------------------------- | |
self.loc = [] | |
parent = self.root | |
for i, t in enumerate(tra.getChainTransform(self.guide.apos, self.normal, self.negate)): | |
loc = pri.addTransform(parent, self.getName("%s_loc"%i), t) | |
self.loc.append(loc) | |
self.jnt_pos.append([loc, i, None, False]) | |
# ===================================================== | |
# PROPERTY | |
# ===================================================== | |
## Add parameters to the anim and setup properties to control the component. | |
# @param self | |
def addAttributes(self): | |
# Anim ------------------------------------------- | |
if self.isFkIk: | |
self.blend_att = self.addAnimParam("blend", "Fk/Ik Blend", "double", self.settings["blend"], 0, 1) | |
if self.isIk: | |
self.roll_att = self.addAnimParam("roll", "Roll", "double", 0, -180, 180) | |
# Ref | |
if self.settings["ikrefarray"]: | |
ref_names = self.settings["ikrefarray"].split(",") | |
if len(ref_names) > 1: | |
self.ikref_att = self.addAnimEnumParam("ikref", "Ik Ref", 0, self.settings["ikrefarray"].split(",")) | |
# ===================================================== | |
# OPERATORS | |
# ===================================================== | |
## Apply operators, constraints, expressions to the hierarchy.\n | |
# In order to keep the code clean and easier to debug, | |
# we shouldn't create any new object in this method. | |
# @param self | |
def addOperators(self): | |
# Visibilities ------------------------------------- | |
if self.isFkIk: | |
# fk | |
fkvis_node = nod.createReverseNode(self.blend_att) | |
for fk_ctl in self.fk_ctl: | |
for shp in fk_ctl.getShapes(): | |
pm.connectAttr(fkvis_node+".outputX", shp.attr("visibility")) | |
# ik | |
for shp in self.upv_ctl.getShapes(): | |
pm.connectAttr(self.blend_att, shp.attr("visibility")) | |
for shp in self.ikcns_ctl.getShapes(): | |
pm.connectAttr(self.blend_att, shp.attr("visibility")) | |
for shp in self.ik_ctl.getShapes(): | |
pm.connectAttr(self.blend_att, shp.attr("visibility")) | |
# FK Chain ----------------------------------------- | |
if self.isFk: | |
for off, ref in zip(self.fk_off[1:], self.fk_ref): | |
# aop.gear_mulmatrix_op(ref.worldMatrix, off.parentInverseMatrix, off, "rt") | |
nod.createMultMatrixNode(ref.worldMatrix, off.parentInverseMatrix, off, "rt") | |
# IK Chain ----------------------------------------- | |
if self.isIk: | |
self.ikh = pri.addIkHandle(self.root, self.getName("ikh"), self.chain) | |
self.ikh.attr("visibility").set(False) | |
#Constraint and up vector | |
pm.pointConstraint(self.ik_ctl, self.ikh, maintainOffset=False) | |
pm.poleVectorConstraint(self.upv_ctl, self.ikh) | |
# TwistTest | |
if [round(elem, 4) for elem in tra.getTranslation(self.chain[1])] != [round(elem, 4) for elem in self.guide.apos[1]]: | |
add_nodeTwist = nod.createAddNode(180.0, self.roll_att) | |
pm.connectAttr(add_nodeTwist+".output", self.ikh.attr("twist")) | |
else: | |
pm.connectAttr(self.roll_att, self.ikh.attr("twist")) | |
# Chain of deformers ------------------------------- | |
for i, loc in enumerate(self.loc): | |
if self.settings["mode"] == 0: # fk only | |
pm.parentConstraint(self.fk_ctl[i], loc, maintainOffset=False) | |
pm.connectAttr(self.fk_ctl[i]+".scale", loc+".scale") | |
elif self.settings["mode"] == 1: # ik only | |
pm.parentConstraint( self.chain[i], loc, maintainOffset=False) | |
elif self.settings["mode"] == 2: # fk/ik | |
rev_node = nod.createReverseNode(self.blend_att) | |
# orientation | |
cns = pm.parentConstraint(self.fk_ctl[i], self.chain[i], loc, maintainOffset=False) | |
cns.interpType.set(0) | |
weight_att = pm.parentConstraint(cns, query=True, weightAliasList=True) | |
pm.connectAttr(rev_node+".outputX", weight_att[0]) | |
pm.connectAttr(self.blend_att, weight_att[1]) | |
#scaling | |
blend_node = pm.createNode("blendColors") | |
pm.connectAttr(self.chain[i].attr("scale"), blend_node+".color1") | |
pm.connectAttr(self.fk_ctl[i].attr("scale"), blend_node+".color2") | |
pm.connectAttr(self.blend_att, blend_node+".blender") | |
pm.connectAttr(blend_node+".output", loc+".scale") | |
# ===================================================== | |
# CONNECTOR | |
# ===================================================== | |
## Set the relation between object from guide to rig.\n | |
# @param self | |
def setRelation(self): | |
self.relatives["root"] = self.loc[0] | |
self.controlRelatives["root"] = self.fk_ctl[0] | |
self.jointRelatives["root"] = 0 | |
for i in range(0, len(self.loc)-1): | |
self.relatives["%s_loc"%i] = self.loc[i+1] | |
self.controlRelatives["%s_loc"%i] = self.fk_ctl[i+1] | |
self.jointRelatives["%s_loc"%i] = i+1 | |
self.relatives["%s_loc"%(len(self.loc)-1)] = self.loc[-1] | |
self.controlRelatives["%s_loc"%(len(self.loc)-1)] = self.fk_ctl[-1] | |
self.jointRelatives["%s_loc"%(len(self.loc)-1)] = len(self.loc)-1 | |
# @param self | |
def addConnection(self): | |
self.connections["standard"] = self.connect_standard | |
self.connections["orientation"] = self.connect_orientation | |
self.connections["parent"] = self.connect_parent | |
def connect_orientation(self): | |
self.connect_orientCns() | |
## standard connection definition. | |
def connect_standard(self): | |
self.connect_standardWithSimpleIkRef() | |
# @param self | |
def connect_parent(self): | |
self.connect_standardWithSimpleIkRef() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MGEAR is under the terms of the MIT License | |
# Copyright (c) 2016 Jeremie Passerin, Miquel Campos | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
########################################################## | |
# GLOBAL | |
########################################################## | |
from functools import partial | |
# mgear | |
from mgear.maya.shifter.component.guide import ComponentGuide | |
#Pyside | |
from mgear.maya.shifter.component.guide import componentMainSettings | |
import mgear.maya.pyqt as gqt | |
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin | |
from maya.app.general.mayaMixin import MayaQDockWidget | |
import settingsUI as sui | |
QtGui, QtCore, QtWidgets, wrapInstance = gqt.qt_import() | |
# guide info | |
AUTHOR = "Jeremie Passerin, Miquel Campos" | |
URL = "www.jeremiepasserin.com, www.miquel-campos.com" | |
EMAIL = "" | |
VERSION = [1,0,1] | |
TYPE = "vanilla_chain_01" | |
NAME = "chain" | |
DESCRIPTION = "Vanilla Simple IK/FK chain, With IK space switch" | |
########################################################## | |
# CLASS | |
########################################################## | |
class Guide(ComponentGuide): | |
compType = TYPE | |
compName = NAME | |
description = DESCRIPTION | |
author = AUTHOR | |
url = URL | |
email = EMAIL | |
version = VERSION | |
# ===================================================== | |
## | |
# @param self | |
def postInit(self): | |
self.save_transform = ["root", "#_loc"] | |
self.save_blade = ["blade"] | |
self.addMinMax("#_loc", 1, -1) | |
# ===================================================== | |
## Add more object to the object definition list. | |
# @param self | |
def addObjects(self): | |
self.root = self.addRoot() | |
self.locs = self.addLocMulti("#_loc", self.root) | |
self.blade = self.addBlade("blade", self.root, self.locs[0]) | |
centers = [self.root] | |
centers.extend(self.locs) | |
self.dispcrv = self.addDispCurve("crv", centers) | |
# ===================================================== | |
## Add more parameter to the parameter definition list. | |
# @param self | |
def addParameters(self): | |
self.pType = self.addParam("mode", "long", 0, 0) | |
self.pBlend = self.addParam("blend", "double", 1, 0, 1) | |
# self.pBladeOffset = self.addParam("bladeOffset", "float", 0, 0) | |
self.pNeutralPose = self.addParam("neutralpose", "bool", False) | |
self.pIkRefArray = self.addParam("ikrefarray", "string", "") | |
self.pUseIndex = self.addParam("useIndex", "bool", False) | |
self.pParentJointIndex = self.addParam("parentJointIndex", "long", -1, None, None) | |
#TODO: if have IK or IK/FK lock the axis position to force 2D Planar IK solver | |
# Create a a method to lock and unlock while changing options in the PYSIDE component Settings | |
########################################################## | |
# Setting Page | |
########################################################## | |
class settingsTab(QtWidgets.QDialog, sui.Ui_Form): | |
def __init__(self, parent=None): | |
super(settingsTab, self).__init__(parent) | |
self.setupUi(self) | |
class componentSettings(MayaQWidgetDockableMixin, componentMainSettings): | |
def __init__(self, parent = None): | |
self.toolName = TYPE | |
# Delete old instances of the componet settings window. | |
gqt.deleteInstances(self, MayaQDockWidget) | |
super(self.__class__, self).__init__(parent = parent) | |
self.settingsTab = settingsTab() | |
self.setup_componentSettingWindow() | |
self.create_componentControls() | |
self.populate_componentControls() | |
self.create_componentLayout() | |
self.create_componentConnections() | |
def setup_componentSettingWindow(self): | |
self.mayaMainWindow = gqt.maya_main_window() | |
self.setObjectName(self.toolName) | |
self.setWindowFlags(QtCore.Qt.Window) | |
self.setWindowTitle(TYPE) | |
self.resize(280, 350) | |
def create_componentControls(self): | |
return | |
def populate_componentControls(self): | |
""" | |
Populate the controls values from the custom attributes of the component. | |
""" | |
#populate tab | |
self.tabs.insertTab(1, self.settingsTab, "Component Settings") | |
#populate component settings | |
self.settingsTab.ikfk_slider.setValue(int(self.root.attr("blend").get()*100)) | |
self.settingsTab.ikfk_spinBox.setValue(int(self.root.attr("blend").get()*100)) | |
self.settingsTab.mode_comboBox.setCurrentIndex(self.root.attr("mode").get()) | |
if self.root.attr("neutralpose").get(): | |
self.settingsTab.neutralPose_checkBox.setCheckState(QtCore.Qt.Checked) | |
else: | |
self.settingsTab.neutralPose_checkBox.setCheckState(QtCore.Qt.Unchecked) | |
ikRefArrayItems = self.root.attr("ikrefarray").get().split(",") | |
for item in ikRefArrayItems: | |
self.settingsTab.ikRefArray_listWidget.addItem(item) | |
def create_componentLayout(self): | |
self.settings_layout = QtWidgets.QVBoxLayout() | |
self.settings_layout.addWidget(self.tabs) | |
self.settings_layout.addWidget(self.close_button) | |
self.setLayout(self.settings_layout) | |
def create_componentConnections(self): | |
self.settingsTab.ikfk_slider.valueChanged.connect(partial(self.updateSlider, self.settingsTab.ikfk_slider, "blend")) | |
self.settingsTab.ikfk_spinBox.valueChanged.connect(partial(self.updateSlider, self.settingsTab.ikfk_spinBox, "blend")) | |
self.settingsTab.mode_comboBox.currentIndexChanged.connect(partial(self.updateComboBox, self.settingsTab.mode_comboBox, "mode")) | |
self.settingsTab.neutralPose_checkBox.stateChanged.connect(partial(self.updateCheck, self.settingsTab.neutralPose_checkBox, "neutralpose")) | |
self.settingsTab.ikRefArrayAdd_pushButton.clicked.connect(partial(self.addItem2listWidget, self.settingsTab.ikRefArray_listWidget, "ikrefarray")) | |
self.settingsTab.ikRefArrayRemove_pushButton.clicked.connect(partial(self.removeSelectedFromListWidget, self.settingsTab.ikRefArray_listWidget, "ikrefarray")) | |
self.settingsTab.ikRefArray_listWidget.installEventFilter(self) | |
def eventFilter(self, sender, event): | |
if event.type() == QtCore.QEvent.ChildRemoved: | |
if sender == self.settingsTab.ikRefArray_listWidget: | |
self.updateListAttr(sender, "ikrefarray") | |
return True | |
else: | |
return QtWidgets.QDialog.eventFilter(self, sender, event) | |
def dockCloseEventTriggered(self): | |
gqt.deleteInstances(self, MayaQDockWidget) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MGEAR is under the terms of the MIT License | |
# Copyright (c) 2016 Jeremie Passerin, Miquel Campos | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
import mgear.maya.pyqt as gqt | |
QtGui, QtCore, QtWidgets, wrapInstance = gqt.qt_import() | |
class Ui_Form(object): | |
def setupUi(self, Form): | |
Form.setObjectName("Form") | |
Form.resize(255, 290) | |
self.gridLayout = QtWidgets.QGridLayout(Form) | |
self.gridLayout.setObjectName("gridLayout") | |
self.groupBox = QtWidgets.QGroupBox(Form) | |
self.groupBox.setTitle("") | |
self.groupBox.setObjectName("groupBox") | |
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox) | |
self.gridLayout_2.setObjectName("gridLayout_2") | |
self.verticalLayout = QtWidgets.QVBoxLayout() | |
self.verticalLayout.setObjectName("verticalLayout") | |
self.formLayout = QtWidgets.QFormLayout() | |
self.formLayout.setObjectName("formLayout") | |
self.mode_label = QtWidgets.QLabel(self.groupBox) | |
self.mode_label.setObjectName("mode_label") | |
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.mode_label) | |
self.mode_comboBox = QtWidgets.QComboBox(self.groupBox) | |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) | |
sizePolicy.setHorizontalStretch(0) | |
sizePolicy.setVerticalStretch(0) | |
sizePolicy.setHeightForWidth(self.mode_comboBox.sizePolicy().hasHeightForWidth()) | |
self.mode_comboBox.setSizePolicy(sizePolicy) | |
self.mode_comboBox.setObjectName("mode_comboBox") | |
self.mode_comboBox.addItem("") | |
self.mode_comboBox.addItem("") | |
self.mode_comboBox.addItem("") | |
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.mode_comboBox) | |
self.ikfk_label = QtWidgets.QLabel(self.groupBox) | |
self.ikfk_label.setObjectName("ikfk_label") | |
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.ikfk_label) | |
self.horizontalLayout_3 = QtWidgets.QHBoxLayout() | |
self.horizontalLayout_3.setObjectName("horizontalLayout_3") | |
self.ikfk_slider = QtWidgets.QSlider(self.groupBox) | |
self.ikfk_slider.setMinimumSize(QtCore.QSize(0, 15)) | |
self.ikfk_slider.setMaximum(100) | |
self.ikfk_slider.setOrientation(QtCore.Qt.Horizontal) | |
self.ikfk_slider.setObjectName("ikfk_slider") | |
self.horizontalLayout_3.addWidget(self.ikfk_slider) | |
self.ikfk_spinBox = QtWidgets.QSpinBox(self.groupBox) | |
self.ikfk_spinBox.setMaximum(100) | |
self.ikfk_spinBox.setObjectName("ikfk_spinBox") | |
self.horizontalLayout_3.addWidget(self.ikfk_spinBox) | |
self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_3) | |
self.verticalLayout.addLayout(self.formLayout) | |
self.neutralPose_checkBox = QtWidgets.QCheckBox(self.groupBox) | |
self.neutralPose_checkBox.setObjectName("neutralPose_checkBox") | |
self.verticalLayout.addWidget(self.neutralPose_checkBox) | |
self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) | |
self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1) | |
self.ikRefArray_groupBox = QtWidgets.QGroupBox(Form) | |
self.ikRefArray_groupBox.setObjectName("ikRefArray_groupBox") | |
self.gridLayout_3 = QtWidgets.QGridLayout(self.ikRefArray_groupBox) | |
self.gridLayout_3.setObjectName("gridLayout_3") | |
self.ikRefArray_horizontalLayout = QtWidgets.QHBoxLayout() | |
self.ikRefArray_horizontalLayout.setObjectName("ikRefArray_horizontalLayout") | |
self.ikRefArray_verticalLayout_1 = QtWidgets.QVBoxLayout() | |
self.ikRefArray_verticalLayout_1.setObjectName("ikRefArray_verticalLayout_1") | |
self.ikRefArray_listWidget = QtWidgets.QListWidget(self.ikRefArray_groupBox) | |
self.ikRefArray_listWidget.setDragDropOverwriteMode(True) | |
self.ikRefArray_listWidget.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove) | |
self.ikRefArray_listWidget.setDefaultDropAction(QtCore.Qt.MoveAction) | |
self.ikRefArray_listWidget.setAlternatingRowColors(True) | |
self.ikRefArray_listWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) | |
self.ikRefArray_listWidget.setSelectionRectVisible(False) | |
self.ikRefArray_listWidget.setObjectName("ikRefArray_listWidget") | |
self.ikRefArray_verticalLayout_1.addWidget(self.ikRefArray_listWidget) | |
self.ikRefArray_horizontalLayout.addLayout(self.ikRefArray_verticalLayout_1) | |
self.ikRefArray_verticalLayout_2 = QtWidgets.QVBoxLayout() | |
self.ikRefArray_verticalLayout_2.setObjectName("ikRefArray_verticalLayout_2") | |
self.ikRefArrayAdd_pushButton = QtWidgets.QPushButton(self.ikRefArray_groupBox) | |
self.ikRefArrayAdd_pushButton.setObjectName("ikRefArrayAdd_pushButton") | |
self.ikRefArray_verticalLayout_2.addWidget(self.ikRefArrayAdd_pushButton) | |
self.ikRefArrayRemove_pushButton = QtWidgets.QPushButton(self.ikRefArray_groupBox) | |
self.ikRefArrayRemove_pushButton.setObjectName("ikRefArrayRemove_pushButton") | |
self.ikRefArray_verticalLayout_2.addWidget(self.ikRefArrayRemove_pushButton) | |
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) | |
self.ikRefArray_verticalLayout_2.addItem(spacerItem) | |
self.ikRefArray_horizontalLayout.addLayout(self.ikRefArray_verticalLayout_2) | |
self.gridLayout_3.addLayout(self.ikRefArray_horizontalLayout, 0, 0, 1, 1) | |
self.gridLayout.addWidget(self.ikRefArray_groupBox, 1, 0, 1, 1) | |
self.retranslateUi(Form) | |
QtCore.QObject.connect(self.ikfk_slider, QtCore.SIGNAL("sliderMoved(int)"), self.ikfk_spinBox.setValue) | |
QtCore.QObject.connect(self.ikfk_spinBox, QtCore.SIGNAL("valueChanged(int)"), self.ikfk_slider.setValue) | |
QtCore.QMetaObject.connectSlotsByName(Form) | |
def retranslateUi(self, Form): | |
Form.setWindowTitle(gqt.fakeTranslate("Form", "Form", None, -1)) | |
self.mode_label.setText(gqt.fakeTranslate("Form", "Mode:", None, -1)) | |
self.mode_comboBox.setItemText(0, gqt.fakeTranslate("Form", "FK", None, -1)) | |
self.mode_comboBox.setItemText(1, gqt.fakeTranslate("Form", "IK", None, -1)) | |
self.mode_comboBox.setItemText(2, gqt.fakeTranslate("Form", "FK/IK", None, -1)) | |
self.ikfk_label.setText(gqt.fakeTranslate("Form", "IK/FK Blend:", None, -1)) | |
self.neutralPose_checkBox.setText(gqt.fakeTranslate("Form", "Nuetral pose", None, -1)) | |
self.ikRefArray_groupBox.setTitle(gqt.fakeTranslate("Form", "IK Reference Array", None, -1)) | |
self.ikRefArrayAdd_pushButton.setText(gqt.fakeTranslate("Form", "<<", None, -1)) | |
self.ikRefArrayRemove_pushButton.setText(gqt.fakeTranslate("Form", ">>", None, -1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<ui version="4.0"> | |
<class>Form</class> | |
<widget class="QWidget" name="Form"> | |
<property name="geometry"> | |
<rect> | |
<x>0</x> | |
<y>0</y> | |
<width>255</width> | |
<height>290</height> | |
</rect> | |
</property> | |
<property name="windowTitle"> | |
<string>Form</string> | |
</property> | |
<layout class="QGridLayout" name="gridLayout"> | |
<item row="0" column="0"> | |
<widget class="QGroupBox" name="groupBox"> | |
<property name="title"> | |
<string/> | |
</property> | |
<layout class="QGridLayout" name="gridLayout_2"> | |
<item row="0" column="0"> | |
<layout class="QVBoxLayout" name="verticalLayout"> | |
<item> | |
<layout class="QFormLayout" name="formLayout"> | |
<item row="0" column="0"> | |
<widget class="QLabel" name="mode_label"> | |
<property name="text"> | |
<string>Mode:</string> | |
</property> | |
</widget> | |
</item> | |
<item row="0" column="1"> | |
<widget class="QComboBox" name="mode_comboBox"> | |
<property name="sizePolicy"> | |
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> | |
<horstretch>0</horstretch> | |
<verstretch>0</verstretch> | |
</sizepolicy> | |
</property> | |
<item> | |
<property name="text"> | |
<string>FK</string> | |
</property> | |
</item> | |
<item> | |
<property name="text"> | |
<string>IK</string> | |
</property> | |
</item> | |
<item> | |
<property name="text"> | |
<string>FK/IK</string> | |
</property> | |
</item> | |
</widget> | |
</item> | |
<item row="1" column="0"> | |
<widget class="QLabel" name="ikfk_label"> | |
<property name="text"> | |
<string>IK/FK Blend:</string> | |
</property> | |
</widget> | |
</item> | |
<item row="1" column="1"> | |
<layout class="QHBoxLayout" name="horizontalLayout_3"> | |
<item> | |
<widget class="QSlider" name="ikfk_slider"> | |
<property name="minimumSize"> | |
<size> | |
<width>0</width> | |
<height>15</height> | |
</size> | |
</property> | |
<property name="maximum"> | |
<number>100</number> | |
</property> | |
<property name="orientation"> | |
<enum>Qt::Horizontal</enum> | |
</property> | |
</widget> | |
</item> | |
<item> | |
<widget class="QSpinBox" name="ikfk_spinBox"> | |
<property name="maximum"> | |
<number>100</number> | |
</property> | |
</widget> | |
</item> | |
</layout> | |
</item> | |
</layout> | |
</item> | |
<item> | |
<widget class="QCheckBox" name="neutralPose_checkBox"> | |
<property name="text"> | |
<string>Nuetral pose</string> | |
</property> | |
</widget> | |
</item> | |
</layout> | |
</item> | |
</layout> | |
</widget> | |
</item> | |
<item row="1" column="0"> | |
<widget class="QGroupBox" name="ikRefArray_groupBox"> | |
<property name="title"> | |
<string>IK Reference Array</string> | |
</property> | |
<layout class="QGridLayout" name="gridLayout_3"> | |
<item row="0" column="0"> | |
<layout class="QHBoxLayout" name="ikRefArray_horizontalLayout"> | |
<item> | |
<layout class="QVBoxLayout" name="ikRefArray_verticalLayout_1"> | |
<item> | |
<widget class="QListWidget" name="ikRefArray_listWidget"> | |
<property name="dragDropOverwriteMode"> | |
<bool>true</bool> | |
</property> | |
<property name="dragDropMode"> | |
<enum>QAbstractItemView::InternalMove</enum> | |
</property> | |
<property name="defaultDropAction"> | |
<enum>Qt::MoveAction</enum> | |
</property> | |
<property name="alternatingRowColors"> | |
<bool>true</bool> | |
</property> | |
<property name="selectionMode"> | |
<enum>QAbstractItemView::ExtendedSelection</enum> | |
</property> | |
<property name="selectionRectVisible"> | |
<bool>false</bool> | |
</property> | |
</widget> | |
</item> | |
</layout> | |
</item> | |
<item> | |
<layout class="QVBoxLayout" name="ikRefArray_verticalLayout_2"> | |
<item> | |
<widget class="QPushButton" name="ikRefArrayAdd_pushButton"> | |
<property name="text"> | |
<string><<</string> | |
</property> | |
</widget> | |
</item> | |
<item> | |
<widget class="QPushButton" name="ikRefArrayRemove_pushButton"> | |
<property name="text"> | |
<string>>></string> | |
</property> | |
</widget> | |
</item> | |
<item> | |
<spacer name="ikRefArray_verticalSpacer"> | |
<property name="orientation"> | |
<enum>Qt::Vertical</enum> | |
</property> | |
<property name="sizeHint" stdset="0"> | |
<size> | |
<width>20</width> | |
<height>40</height> | |
</size> | |
</property> | |
</spacer> | |
</item> | |
</layout> | |
</item> | |
</layout> | |
</item> | |
</layout> | |
</widget> | |
</item> | |
</layout> | |
</widget> | |
<resources/> | |
<connections> | |
<connection> | |
<sender>ikfk_slider</sender> | |
<signal>sliderMoved(int)</signal> | |
<receiver>ikfk_spinBox</receiver> | |
<slot>setValue(int)</slot> | |
<hints> | |
<hint type="sourcelabel"> | |
<x>144</x> | |
<y>47</y> | |
</hint> | |
<hint type="destinationlabel"> | |
<x>220</x> | |
<y>45</y> | |
</hint> | |
</hints> | |
</connection> | |
<connection> | |
<sender>ikfk_spinBox</sender> | |
<signal>valueChanged(int)</signal> | |
<receiver>ikfk_slider</receiver> | |
<slot>setValue(int)</slot> | |
<hints> | |
<hint type="sourcelabel"> | |
<x>222</x> | |
<y>37</y> | |
</hint> | |
<hint type="destinationlabel"> | |
<x>182</x> | |
<y>37</y> | |
</hint> | |
</hints> | |
</connection> | |
</connections> | |
</ui> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment