SkinningTools.UI.fallofCurveUI

Module Contents

Classes

BezierCurve

painterpath class to help draw the bezier curve

BezierFunctions

collection object for all functions that help create bezier curves

BezierGraph

the bezier graph windo which allows us to manipulate the curve

NodeItem

the node items that will serve as handles for the bezier curve

NodeMoveCommand

simple undo override to help with undoing movement in the qt window

NodeScene

the graphics scene in which we draw everything

NodeSwitchCommand

simple undo override to help with undoing curve style switch in the qt window

NodeView

simple graphics view with some default settings

Functions

testUI()

test the current UI without the need of all the extra functionality

SkinningTools.UI.fallofCurveUI._DIR
class SkinningTools.UI.fallofCurveUI.BezierCurve(parent=None)

painterpath class to help draw the bezier curve

pen
_updatePath(self, points)

the update path function, given the points it will calculate the new path

Parameters

points (list) – list of 2d points

boundingRect(self)

get the current bounding box of the path

Returns

the bounding box

Return type

QRectF

paint(self, painter, option, widget)

the painter, here we actually draw the curve

class SkinningTools.UI.fallofCurveUI.BezierFunctions

collection object for all functions that help create bezier curves https://en.wikipedia.org/wiki/B%C3%A9zier_curve

static bernstein(t, i, n)

bernstein function

Parameters
  • t (float) – position in 2d space based on the weight of current given point i

  • i (list) – current 2d point to calculate from

  • n (int) – total amount of points

Returns

weight

Return type

float

static bezier(t, points)

bezier function

Parameters
  • t (float) – parameter on the curve to get the positional information (range is from 0 to 1)

  • points (list) – control points that are used to generate the curve

Returns

2d point in space

Return type

list

static bezierCurveYfromX(inX, points)

get the y position on the curve by giving the x :note: the amount of points used here to generate the curve is 101, this way its easier to get percentage data

Parameters
  • inX (float) – the x position on the graph

  • point – list of points generated by the bezier functions

Returns

y value represented by X

Return type

float

static bezier_curve_range(n, points)

bezier point generator

Parameters
  • n (int) – amount of points to generate

  • points (list) – control points that are used to generate the curve

Returns

list of bezier points the size of the given amount

Return type

list

static binomial(i, n)

binomial function

Parameters
  • i (list) – current 2d point to calculate from

  • n (int) – total amount of points

Returns

weight

Return type

float

static getDataOnPercentage(percentage, npts)

get the data of the curve based on the percentage on the curve itself

Parameters
  • percentage (float) – percentage on the curve

  • npts (list) – control points that are used to generate the curve

Returns

2d point in space for given data

Return type

list

class SkinningTools.UI.fallofCurveUI.BezierGraph(settings=None, parent=None)

the bezier graph windo which allows us to manipulate the curve

closed
toolName = BezierGraph
__lineEdit_Color(self, inLineEdit, inColor)

change the lineedit color

Parameters
  • inLineEdit (QlineEdit) – the lineedit to change

  • inColor (QColor) – color to set the line edit to

__lineEdit_FieldEditted(self, *args)

check the edit of the current text field, block information if wrong characters are used

_loadCBox(self)

load different curves into the combobox for ease of access

changeCurve(self)

change the current curve visual to one that has been stored before

curveAsPoints(self)

get the generated curve as a list of 2d points

Returns

the curve as points

Return type

list

delValues(self)

remove created curves form the settings when no longer necessary

doTranslate(self)

seperate function that calls upon the translate widget to help create a new language we use the english language to translate from to make sure that translation doesnt get lost

getButtonText(self)

convenience function to get the current items that need new locale text

getDataOnPerc(self, percentage, npts=None)

get the data on the curve based on divisions

Parameters
  • percentage (float) – percentage on the curve

  • npts (list) – points on the curve

Returns

position on the curve based on percentage of the parameter

Return type

list

getDataOnPoints(self, inList=0.0, 0.2, 0.25, 0.5, 0.6, 0.66, 0.8, 1.0)

get the data of the curve based on different parameters

Parameters

inList (list) – points on the curve based on parameters

Returns

positions on the curve based on the different parameters

Return type

list

getDivisionData(self, divisions=11)

get the data on the curve based on divisions

Parameters

divisions (int) – amount of points to divide the curve with

Returns

list of curve positions

Return type

list

hideEvent(self, event)

if this graph is hidden its save to call it closed

resizeEvent(self, event)

resize the grid and elements based on the resize of the window

setSnap(self)

set the snap value for all the handles

storeValues(self)

store user made curves into the combobox

translate(self, localeDict={})

translate the ui using the language dictionary given

updateView(self)

always scale the objects to fit the window

class SkinningTools.UI.fallofCurveUI.NodeItem(rect=None, parent=None)

the node items that will serve as handles for the bezier curve

brush
gradient
pen
selPen
width = 10
boundingRect(self)

get the full size of the current widget

Returns

the bounding rect

Return type

QRectF

mouseMoveEvent(self, event)

drag event to take place and update the drawing of elements

Parameters

event (QEvent) – event to trigger

mousePressEvent(self, event)

starting position to be captured on first mouse press

Parameters

event (QEvent) – event to trigger

mouseReleaseEvent(self, event)

final position of the nodehandle to cover

Parameters

event (QEvent) – event to trigger

paint(self, painter, option, widget)

the painter, here we actually draw the control

setLockXPos(self, inPos)

make sure that the object cannot move away from the locked position

Parameters

inPos (float) – the position in x to lock the control to

setRect(self, rect)

set the size for the handle

Parameters

rect (QRectF) – the new size for the handle

setSnap(self, snapValue)

set the node to be able to snap to a certain grid

Parameters

snapValue (int) – size of the grid

class SkinningTools.UI.fallofCurveUI.NodeMoveCommand(scene, node, oldPosition, newPosition, description=None, parent=None)

simple undo override to help with undoing movement in the qt window

redo(self)

the redo function

undo(self)

the undo function

class SkinningTools.UI.fallofCurveUI.NodeScene(baseRect)

the graphics scene in which we draw everything

addPoints(self, inPointObject)

add new control objects for the curve

Parameters

inPointObject (NodeItem) – the new item to add for control

createControls(self)

create the nodeitem controls to spawn the curve

createGrid(self, divider=4, color=Qt.darkGray, line=Qt.DashLine)

create a grid based on the current size and the divider

Parameters
  • divider (int) – draw a line based on the divider to create the grid

  • color (QColor) – the color of the line to use

  • line (Qt.linestyle) – the linepattern to use while drawing the grid

getPoints(self)

get the current positions of all the handles

Returns

the positions of the handles

Return type

list

getUndoStack(self)

get the object that handles the undo setup of this scene

Returns

the current undostack function

Return type

QUndoStack

keyPressEvent(self, event)

triggers from keyboard presses

Parameters

event (QEvent) – event to trigger

setBaseSize(self, inSize)

set the size of the grid

Parameters

inSize (int) – the size of the grid

setBezier(self, inBezier)

set the bezier QPainterPath

Parameters

inBezier (QPainterPath) – the curve to draw

setPointPositions(self, inpts)

function to override handle positions at once, this to make sure we can switch the curve

Parameters

inpts (list) – list of 2d space positions

setPoints(self, inPointObjects)

set the list of objects that will drive the curve

Parameters

inPointObjects – list of nodeitems

Ytpe inPointObjects

list

setSnap(self, snapValue)

set the snap value to all of the controls

Parameters

snapValue (int) – size of the grid

updateCurve(self)

update the curve path with the positions of the control handles

class SkinningTools.UI.fallofCurveUI.NodeSwitchCommand(scene, oldPositions, newPositions, description=None, parent=None)

simple undo override to help with undoing curve style switch in the qt window

redo(self)

the redo function

undo(self)

the undo function

class SkinningTools.UI.fallofCurveUI.NodeView(parent=None)

simple graphics view with some default settings

SkinningTools.UI.fallofCurveUI.testUI()

test the current UI without the need of all the extra functionality