:mod:`SkinningTools.UI.fallofCurveUI` ===================================== .. py:module:: SkinningTools.UI.fallofCurveUI Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: SkinningTools.UI.fallofCurveUI.BezierCurve SkinningTools.UI.fallofCurveUI.BezierFunctions SkinningTools.UI.fallofCurveUI.BezierGraph SkinningTools.UI.fallofCurveUI.NodeItem SkinningTools.UI.fallofCurveUI.NodeMoveCommand SkinningTools.UI.fallofCurveUI.NodeScene SkinningTools.UI.fallofCurveUI.NodeSwitchCommand SkinningTools.UI.fallofCurveUI.NodeView Functions ~~~~~~~~~ .. autoapisummary:: SkinningTools.UI.fallofCurveUI.testUI .. data:: _DIR .. py:class:: BezierCurve(parent=None) painterpath class to help draw the bezier curve .. attribute:: pen .. method:: _updatePath(self, points) the update path function, given the points it will calculate the new path :param points: list of 2d points :type points: list .. method:: boundingRect(self) get the current bounding box of the path :return: the bounding box :rtype: QRectF .. method:: paint(self, painter, option, widget) the painter, here we actually draw the curve .. py:class:: BezierFunctions collection object for all functions that help create bezier curves https://en.wikipedia.org/wiki/B%C3%A9zier_curve .. method:: bernstein(t, i, n) :staticmethod: bernstein function :param t: position in 2d space based on the weight of current given point i :type t: float :param i: current 2d point to calculate from :type i: list :param n: total amount of points :type n: int :return: weight :rtype: float .. method:: bezier(t, points) :staticmethod: bezier function :param t: parameter on the curve to get the positional information (range is from 0 to 1) :type t: float :param points: control points that are used to generate the curve :type points: list :return: 2d point in space :rtype: list .. method:: bezierCurveYfromX(inX, points) :staticmethod: 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 :param inX: the x position on the graph :type inX: float :param point: list of points generated by the bezier functions :type points: list :return: y value represented by X :rtype: float .. method:: bezier_curve_range(n, points) :staticmethod: bezier point generator :param n: amount of points to generate :type n: int :param points: control points that are used to generate the curve :type points: list :return: list of bezier points the size of the given amount :rtype: list .. method:: binomial(i, n) :staticmethod: binomial function :param i: current 2d point to calculate from :type i: list :param n: total amount of points :type n: int :return: weight :rtype: float .. method:: getDataOnPercentage(percentage, npts) :staticmethod: get the data of the curve based on the percentage on the curve itself :param percentage: percentage on the curve :type percentage: float :param npts: control points that are used to generate the curve :type npts: list :return: 2d point in space for given data :rtype: list .. py:class:: BezierGraph(settings=None, parent=None) the bezier graph windo which allows us to manipulate the curve .. attribute:: closed .. attribute:: toolName :annotation: = BezierGraph .. method:: __lineEdit_Color(self, inLineEdit, inColor) change the lineedit color :param inLineEdit: the lineedit to change :type inLineEdit: QlineEdit :param inColor: color to set the line edit to :type inColor: QColor .. method:: __lineEdit_FieldEditted(self, *args) check the edit of the current text field, block information if wrong characters are used .. method:: _loadCBox(self) load different curves into the combobox for ease of access .. method:: changeCurve(self) change the current curve visual to one that has been stored before .. method:: curveAsPoints(self) get the generated curve as a list of 2d points :return: the curve as points :rtype: list .. method:: delValues(self) remove created curves form the settings when no longer necessary .. method:: 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 .. method:: getButtonText(self) convenience function to get the current items that need new locale text .. method:: getDataOnPerc(self, percentage, npts=None) get the data on the curve based on divisions :param percentage: percentage on the curve :type percentage: float :param npts: points on the curve :type npts: list :return: position on the curve based on percentage of the parameter :rtype: list .. method:: 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 :param inList: points on the curve based on parameters :type inList: list :return: positions on the curve based on the different parameters :rtype: list .. method:: getDivisionData(self, divisions=11) get the data on the curve based on divisions :param divisions: amount of points to divide the curve with :type divisions: int :return: list of curve positions :rtype: list .. method:: hideEvent(self, event) if this graph is hidden its save to call it closed .. method:: resizeEvent(self, event) resize the grid and elements based on the resize of the window .. method:: setSnap(self) set the snap value for all the handles .. method:: storeValues(self) store user made curves into the combobox .. method:: translate(self, localeDict={}) translate the ui using the language dictionary given .. method:: updateView(self) always scale the objects to fit the window .. py:class:: NodeItem(rect=None, parent=None) the node items that will serve as handles for the bezier curve .. attribute:: brush .. attribute:: gradient .. attribute:: pen .. attribute:: selPen .. attribute:: width :annotation: = 10 .. method:: boundingRect(self) get the full size of the current widget :return: the bounding rect :rtype: QRectF .. method:: mouseMoveEvent(self, event) drag event to take place and update the drawing of elements :param event: event to trigger :type event: QEvent .. method:: mousePressEvent(self, event) starting position to be captured on first mouse press :param event: event to trigger :type event: QEvent .. method:: mouseReleaseEvent(self, event) final position of the nodehandle to cover :param event: event to trigger :type event: QEvent .. method:: paint(self, painter, option, widget) the painter, here we actually draw the control .. method:: setLockXPos(self, inPos) make sure that the object cannot move away from the locked position :param inPos: the position in x to lock the control to :type inPos: float .. method:: setRect(self, rect) set the size for the handle :param rect: the new size for the handle :type rect: QRectF .. method:: setSnap(self, snapValue) set the node to be able to snap to a certain grid :param snapValue: size of the grid :type snapValue: int .. py:class:: NodeMoveCommand(scene, node, oldPosition, newPosition, description=None, parent=None) simple undo override to help with undoing movement in the qt window .. method:: redo(self) the redo function .. method:: undo(self) the undo function .. py:class:: NodeScene(baseRect) the graphics scene in which we draw everything .. method:: addPoints(self, inPointObject) add new control objects for the curve :param inPointObject: the new item to add for control :type inPointObject: NodeItem .. method:: createControls(self) create the nodeitem controls to spawn the curve .. method:: createGrid(self, divider=4, color=Qt.darkGray, line=Qt.DashLine) create a grid based on the current size and the divider :param divider: draw a line based on the divider to create the grid :type divider: int :param color: the color of the line to use :type color: QColor :param line: the linepattern to use while drawing the grid :type line: Qt.linestyle .. method:: getPoints(self) get the current positions of all the handles :return: the positions of the handles :rtype: list .. method:: getUndoStack(self) get the object that handles the undo setup of this scene :return: the current undostack function :rtype: QUndoStack .. method:: keyPressEvent(self, event) triggers from keyboard presses :param event: event to trigger :type event: QEvent .. method:: setBaseSize(self, inSize) set the size of the grid :param inSize: the size of the grid :type inSize: int .. method:: setBezier(self, inBezier) set the bezier QPainterPath :param inBezier: the curve to draw :type inBezier: QPainterPath .. method:: setPointPositions(self, inpts) function to override handle positions at once, this to make sure we can switch the curve :param inpts: list of 2d space positions :type inpts: list .. method:: setPoints(self, inPointObjects) set the list of objects that will drive the curve :param inPointObjects: list of nodeitems :ytpe inPointObjects: list .. method:: setSnap(self, snapValue) set the snap value to all of the controls :param snapValue: size of the grid :type snapValue: int .. method:: updateCurve(self) update the curve path with the positions of the control handles .. py:class:: NodeSwitchCommand(scene, oldPositions, newPositions, description=None, parent=None) simple undo override to help with undoing curve style switch in the qt window .. method:: redo(self) the redo function .. method:: undo(self) the undo function .. py:class:: NodeView(parent=None) simple graphics view with some default settings .. function:: testUI() test the current UI without the need of all the extra functionality