Created
February 24, 2017 09:47
-
-
Save nicelifeBS/de28a348aed022766ffaffa2913c5b2c to your computer and use it in GitHub Desktop.
KATANA: How to layout widget like Katana does it
This file contains hidden or 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
import UI4.FormMaster.PythonValuePolicy | |
# Create a node for which to create parameter widgets | |
node = NodegraphAPI.CreateNode('Alembic_In', NodegraphAPI.GetRootNode()) | |
# Get a couple of parameters from the node | |
addForceExpandParameter = node.getParameter('addForceExpand') | |
addBoundsParameter = node.getParameter('addBounds') | |
fpsParameter = node.getParameter('fps') | |
# Create parameter policies for the parameters | |
addForceExpandParameterPolicy = UI4.FormMaster.CreateParameterPolicy(None, addForceExpandParameter) | |
addBoundsParameterPolicy = UI4.FormMaster.CreateParameterPolicy(None, addBoundsParameter) | |
fpsParameterPolicy = UI4.FormMaster.CreateParameterPolicy(None, fpsParameter) | |
# Create a policy to group the above parameter policies, and set a widget hint on it to hide the group's title | |
myGroupPolicy = UI4.FormMaster.PythonValuePolicy.PythonValuePolicy('myGroup', {}) | |
myGroupPolicy.addChildPolicy(addForceExpandParameterPolicy) | |
myGroupPolicy.addChildPolicy(addBoundsParameterPolicy) | |
myGroupPolicy.addChildPolicy(fpsParameterPolicy) | |
myGroupPolicy.getWidgetHints()['hideTitle'] = True | |
# Create and show the parameter widgets | |
groupFormWidget = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory.buildWidget(None, myGroupPolicy) | |
groupFormWidget.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorting the widgets order: