示例#1
0
    def computeOffset(self):
        """Invokes the constraint and computes the offset

        Returns:
            xfo: The offset to be used for the constraint.

        """

        if self._constrainee is None:
            return Xfo()
        if len(self._constrainers) == 0:
            return Xfo()
        if not self.getMaintainOffset():
            return Xfo()

        cls = self.__class__.__name__
        ks.loadExtension('KrakenForCanvas')
        rtVal = ks.rtVal('Kraken%s' % cls)

        rtVal.offset = ks.rtVal('Mat44', Mat44())
        for c in self._constrainers:
            rtVal.addConstrainer('', ks.rtVal('Xfo', c.globalXfo).toMat44('Mat44'))

        return Xfo(rtVal.computeOffset("Xfo",
                                       ks.rtVal('Xfo', self._constrainee.xfo).toMat44('Mat44')))
示例#2
0
    def compute(self):
        """invokes the constraint and returns the resulting transform

        Returns:
            xfo: The result of the constraint in global space.

        """

        if self._constrainee is None:
            return None
        if len(self._constrainers) == 0:
            return None
        if self.getMaintainOffset():
            return self._constrainee.xfo

        cls = self.__class__.__name__
        ks.loadExtension('KrakenForCanvas')
        rtVal = ks.rtVal('KrakenForCanvas::Kraken%s' % cls)

        for c in self._constrainers:
            rtVal.addConstrainer('',
                                 ks.rtVal('Xfo', c.globalXfo).toMat44('Mat44'))

        # Using globalXfo here would cause a recursion
        return Xfo(
            rtVal.compute(
                "Xfo",
                ks.rtVal('Xfo', self._constrainee.xfo).toMat44('Mat44')))
示例#3
0
文件: quat.py 项目: yes7rose/Kraken
    def setFrom2Vectors(self,
                        sourceDirVec,
                        destDirVec,
                        arbitraryIfAmbiguous=True):
        """Set the quaternion to the rotation required to rotate the source
        vector to the destination vector.

        Function taken from the 'Game Programming Gems' article
        'The Shortest Arc Quat' by Stan Melax, both vectors must be units.

        Args:
            sourceDirVec (Vec3): Source vector.
            destDirVec (Vec3): Destination vector.
            arbitraryIfAmbiguous (bool): Arbitrary if ambiguous.

        Returns:
            Quat: New quaternion set from 2 vectors.

        """

        return Quat(
            self._rtval.setFrom2Vectors(
                'Quat', ks.rtVal('Vec3', sourceDirVec),
                ks.rtVal('Vec3', destDirVec),
                ks.rtVal('Boolean', arbitraryIfAmbiguous)))
示例#4
0
    def computeOffset(self):
        """Invokes the constraint and computes the offset

        Returns:
            xfo: The offset to be used for the constraint.

        """

        if self._constrainee is None:
            return Xfo()
        if len(self._constrainers) == 0:
            return Xfo()
        if not self.getMaintainOffset():
            return Xfo()

        cls = self.__class__.__name__
        ks.loadExtension('KrakenForCanvas')
        rtVal = ks.rtVal('KrakenForCanvas::Kraken%s' % cls)

        rtVal.offset = ks.rtVal('Mat44', Mat44())
        for c in self._constrainers:
            rtVal.addConstrainer('',
                                 ks.rtVal('Xfo', c.globalXfo).toMat44('Mat44'))

        return Xfo(
            rtVal.computeOffset(
                "Xfo",
                ks.rtVal('Xfo', self._constrainee.xfo).toMat44('Mat44')))
示例#5
0
    def compute(self):
        """invokes the constraint and returns the resulting transform

        Returns:
            xfo: The result of the constraint in global space.

        """

        if self._constrainee is None:
            return None
        if len(self._constrainers) == 0:
            return None
        if self.getMaintainOffset():
            return self._constrainee.xfo

        cls = self.__class__.__name__
        ks.loadExtension('KrakenForCanvas')
        rtVal = ks.rtVal('Kraken%s' % cls)

        for c in self._constrainers:
            rtVal.addConstrainer('', ks.rtVal('Xfo', c.globalXfo).toMat44('Mat44'))

        # Using globalXfo here would cause a recursion
        return Xfo(rtVal.compute("Xfo",
                                 ks.rtVal('Xfo', self._constrainee.xfo).toMat44('Mat44')))
示例#6
0
    def getDefaultValue(self, name, RTValDataType, mode="arg"):
        """Returns the default RTVal value for this argument
        Only print debug if setting default inputs.  Don't care about outputs, really

        Args:
            name (str): Name of the input to get.
            mode (str): "inputs" or "outputs"

        Returns:
            RTVal

        """
        def isFixedArrayType(string):
            return bool(re.search(r'\[\d', string))

        # If attribute has a default value
        if self.solverRTVal.defaultValues.has("Boolean", name).getSimpleType():

            RTVal = ks.convertFromRTVal(self.solverRTVal.defaultValues[name])

            if RTVal.isArray():
                # If RTValDataType is variable array, but default value is fixed array, convert it
                if isFixedArrayType(RTVal.getTypeName().getSimpleType()
                                    ) and not isFixedArrayType(RTValDataType):
                    RTValArray = ks.rtVal(RTValDataType)
                    if len(RTVal):
                        RTValArray.resize(len(RTVal))

                    for i in range(len(RTVal)):
                        RTValArray[i] = RTVal[i]

                    RTVal = RTValArray
            else:
                # Not totally sure why we need to do this, but we get None from getSimpleType from the RTVal
                # when we run it on it's own and use the type that we query.  Gotta investigate this further...
                RTVal = ks.convertFromRTVal(
                    self.solverRTVal.defaultValues[name],
                    RTTypeName=RTValDataType)

            logger.debug(
                "Using default value for %s.%s.%s(%s) --> %s" %
                (self.solverTypeName, self.getName(), mode, name, RTVal))

            return RTVal

        defaultValue = ks.rtVal(RTValDataType)
        if name in self.inputs:  # Only warn for input types, OK that we generate default outputs, I think.  Maybe even safer.
            logger.warn(
                "    Creating default value by generating new RTVal object of type: %s. You should set default values for %s.%s(%s) in your KL Operator."
                % (RTValDataType, self.solverTypeName, mode, name))

        return defaultValue
示例#7
0
    def setComponent(self, i, v):
        """Sets the component of this Vec3 by index.

        Args:
            i (int): index of the component to set.
            v (float): Value to set component as.

        Returns:
            bool: True if successful.

        """

        return self._rtval.setComponent("", ks.rtVal("Size", i), ks.rtVal("Scalar", v))
示例#8
0
文件: euler.py 项目: Leopardob/Kraken
    def almostEqual(self, other, precision):
        """Checks almost equality of this Euler with another.

        Args:
            other (Euler): Other value to check equality with.
            precision (float): precision value.

        Returns:
            bool: True if almost equal.

        """

        return self._rtval.almostEqual('Boolean', ks.rtVal('Euler', other), ks.rtVal('Scalar', precision))
示例#9
0
    def almostEqual(self, other, precision):
        """Checks almost equality of this Euler with another.

        Args:
            other (Euler): Other value to check equality with.
            precision (float): precision value.

        Returns:
            bool: True if almost equal.

        """

        return self._rtval.almostEqual('Boolean', ks.rtVal('Euler', other), ks.rtVal('Scalar', precision))
示例#10
0
文件: xfo.py 项目: Leopardob/Kraken
    def linearInterpolate(self, other, t):
        """Linearly interpolates this transform with another one based on a
        scalar blend value (0.0 to 1.0).

        Args:
            other (Xfo): Transform to blend to.
            t (float): Blend value.

        Returns:
            Xfo: New transform blended between this and the input transform.

        """

        return Xfo(self._rtval.linearInterpolate("Xfo", ks.rtVal("Xfo", other), ks.rtVal("Scalar", t)))
示例#11
0
文件: vec2.py 项目: Leopardob/Kraken
    def setComponent(self, i, v):
        """Sets the component of this Vec2 by index.

        Args:
            i (int): index of the component to set.
            v (float): Value to set component as.

        Returns:
            bool: True if successful.

        """

        self._rtval.setComponent('', ks.rtVal('Size', i),
                                        ks.rtVal('Scalar', v))
示例#12
0
    def almostEqual(self, other, precision):
        """Checks almost equality of this Matrix44 with another.

        Args:
            other (Mat44): other matrix to check equality with.
            precision (float): precision value.

        Returns:
            bool: True if almost equal.

        """

        return self._rtval.almostEqual('Boolean', ks.rtVal('Mat44', other),
                                       ks.rtVal('Scalar', precision))
示例#13
0
    def setComponent(self, i, v):
        """Sets the component of this Color by index.

        Args:
            i (int): index of the component to set.
            v (float): Value to set component as.

        Returns:
            bool: True if successful.

        """

        return self._rtval.setComponent('', ks.rtVal('Size', i),
                                        ks.rtVal('Scalar', v))
示例#14
0
    def almostEqual(self, other, precision):
        """Checks almost equality of this Quat with another.

        Args:
            other (Mat33): other matrix to check equality with.
            precision (float): precision value.

        Returns:
            bool: True if almost equal.

        """

        return self._rtval.almostEqual('Boolean', ks.rtVal('Quat', other),
                                       ks.rtVal('Scalar', precision))
示例#15
0
文件: quat.py 项目: AbedSHP/Kraken
    def almostEqualWithPrecision(self, other, precision):
        """Checks almost equality of this Quat with another using a custom
        precision value.

        Args:
            other (Mat33): other matrix to check equality with.
            precision (float): precision value.

        Returns:
            bool: True if almost equal.

        """

        return self._rtval.almostEqual('Boolean', ks.rtVal('Quat', other),
                                       ks.rtVal('Scalar', precision)).getSimpleType()
示例#16
0
文件: xfo.py 项目: sonictk/Kraken
    def linearInterpolate(self, other, t):
        """Linearly interpolates this transform with another one based on a
        scalar blend value (0.0 to 1.0).

        Args:
            other (Xfo): Transform to blend to.
            t (float): Blend value.

        Returns:
            Xfo: New transform blended between this and the input transform.

        """

        return Xfo(self._rtval.linearInterpolate('Xfo', ks.rtVal('Xfo', other),
                                                 ks.rtVal('Scalar', t)))
示例#17
0
    def almostEqual(self, other, precision=None):
        """Checks almost equality of this Matrix33 with another.

        Args:
            other (Mat33): Other matrix to check equality with.
            precision (float): precision value.

        Returns:
            bool: True if almost equal.

        """
        if precision is not None:
            return self._rtval.almostEqual('Boolean', ks.rtVal('Mat33', other), ks.rtVal('Scalar', precision))
        else:
            return self._rtval.almostEqual('Boolean', ks.rtVal('Mat33', other))
示例#18
0
文件: quat.py 项目: Leopardob/Kraken
    def set(self, v, w):
        """Sets the quaternion from vector and scalar values.

        Args:
            v (Vec3): vector value.
            w (float): scalar value.

        Returns:
            bool: True if successful.

        """

        self._rtval.set('', ks.rtVal('Vec3', v), ks.rtVal('Scalar', w))

        return True
示例#19
0
文件: quat.py 项目: Leopardob/Kraken
    def setFromAxisAndAngle(self, axis, angle):
        """Set this quat to a rotation defined by an axis and an angle
        (in radians).

        Args:
            axis (Vec3): vector axis.
            angle (float): angle value.

        Returns:
            Quat: Set from axis and angle values.

        """

        return Quat(self._rtval.setFromAxisAndAngle('Quat', ks.rtVal('Vec3', axis),
                    ks.rtVal('Scalar', angle)))
示例#20
0
文件: quat.py 项目: Leopardob/Kraken
    def setFromEulerAngles(self, angles, ro):
        """Sets this quat to a given angles vector (in radians) and a rotation
        order.

        Args:
            angles (Vec3): Angle vector.
            ro (RotationOrder): Rotation order to use.

        Returns:
            Quat: New quaternion set from angles vector and rotation order.

        """

        return Quat(self._rtval.setFromEuler('Quat', ks.rtVal('Vec3', angles),
                    ks.rtVal('RotationOrder', ro)))
示例#21
0
文件: quat.py 项目: yes7rose/Kraken
    def set(self, v, w):
        """Sets the quaternion from vector and scalar values.

        Args:
            v (Vec3): vector value.
            w (float): scalar value.

        Returns:
            bool: True if successful.

        """

        self._rtval.set('', ks.rtVal('Vec3', v), ks.rtVal('Scalar', w))

        return True
示例#22
0
文件: quat.py 项目: Leopardob/Kraken
    def setFromDirectionAndUpvector(self, direction, upvector):
        """Set the quat to represent the direction as the Z axis and the
        upvector pointing along the XY plane.

        Args:
            direction (Vec3): Direction vector.
            upvector (Vec3): Up direction vector.

        Returns:
            Quat: New quaternion set from direction and up vector.

        """

        return Quat(self._rtval.setFromDirectionAndUpvector('Quat',
                    ks.rtVal('Vec3', direction), ks.rtVal('Vec3', upvector)))
示例#23
0
文件: vec2.py 项目: Leopardob/Kraken
    def set(self, x, y):
        """Sets the x and y value from the input values.

        Args:
            x (float): Value to set the x property as.
            y (float): Value to set the x property as.

        Returns:
            bool: True if successful.

        """

        self._rtval.set('', ks.rtVal('Scalar', x), ks.rtVal('Scalar', y))

        return True
示例#24
0
    def set(self, x, y):
        """Sets the x and y value from the input values.

        Args:
            x (float): Value to set the x property as.
            y (float): Value to set the x property as.

        Returns:
            bool: True if successful.

        """

        self._rtval.set('', ks.rtVal('Scalar', x), ks.rtVal('Scalar', y))

        return True
示例#25
0
文件: mat33.py 项目: yes7rose/Kraken
    def almostEqual(self, other, precision=None):
        """Checks almost equality of this Matrix33 with another.

        Args:
            other (Mat33): Other matrix to check equality with.
            precision (float): precision value.

        Returns:
            bool: True if almost equal.

        """
        if precision is not None:
            return self._rtval.almostEqual('Boolean', ks.rtVal('Mat33', other), ks.rtVal('Scalar', precision)).getSimpleType()
        else:
            return self._rtval.almostEqual('Boolean', ks.rtVal('Mat33', other)).getSimpleType()
示例#26
0
文件: mat33.py 项目: yes7rose/Kraken
    def setRows(self, row0, row1, row2):
        """Setter from vectors, row-wise.

        Args:
            row0 (Vec3): Vector to use to set row 0.
            row1 (Vec3): Vector to use to set row 1.
            row2 (Vec3): Vector to use to set row 2.

        Returns:
            bool: True if successful.

        """

        self._rtval.setRows('', ks.rtVal('Vec3', row0), ks.rtVal('Vec3', row1), ks.rtVal('Vec3', row2))

        return True
示例#27
0
文件: quat.py 项目: yes7rose/Kraken
    def setFromAxisAndAngle(self, axis, angle):
        """Set this quat to a rotation defined by an axis and an angle
        (in radians).

        Args:
            axis (Vec3): vector axis.
            angle (float): angle value.

        Returns:
            Quat: Set from axis and angle values.

        """

        return Quat(
            self._rtval.setFromAxisAndAngle('Quat', ks.rtVal('Vec3', axis),
                                            ks.rtVal('Scalar', angle)))
示例#28
0
文件: quat.py 项目: yes7rose/Kraken
    def setFromEulerAnglesWithRotOrder(self, angles, ro):
        """Sets this quat to a given angles vector (in radians) and a rotation
        order.

        Args:
            angles (Vec3): Angle vector.
            ro (RotationOrder): Rotation order to use.

        Returns:
            Quat: New quaternion set from angles vector and rotation order.

        """

        return Quat(
            self._rtval.setFromEuler('Quat', ks.rtVal('Vec3', angles),
                                     ks.rtVal('RotationOrder', ro)))
示例#29
0
文件: quat.py 项目: yes7rose/Kraken
    def __init__(self, v=None, w=None):
        """Initializes the Quaternion."""

        super(Quat, self).__init__()

        if ks.getRTValTypeName(v) == 'Quat':
            self._rtval = v
        else:
            if v is not None and not isinstance(v, Vec3) and not isinstance(
                    v, Euler):
                raise TypeError(
                    "Quat: Invalid type for 'v' argument. Must be a Vec3.")

            if w is not None and not isinstance(w, (int, float)):
                raise TypeError(
                    "Quat: Invalid type for 'w' argument. Must be a int or float."
                )

            self._rtval = ks.rtVal('Quat')
            if isinstance(v, Quat):
                self.set(v=v.v, w=v.w)
            elif isinstance(v, Euler):
                self.setFromEuler(v)
            elif v is not None and w is not None:
                self.set(v=v, w=w)
示例#30
0
    def set(self, x, y, z):
        """Sets the x, y, and z value from the input values.

        Args:
            x (float): Value to set the x property as.
            y (float): Value to set the x property as.
            z (float): Value to set the z property as.

        Returns:
            bool: True if successful.

        """

        self._rtval.set("", ks.rtVal("Scalar", x), ks.rtVal("Scalar", y), ks.rtVal("Scalar", z))

        return True
示例#31
0
文件: mat33.py 项目: yes7rose/Kraken
    def setColumns(self, col0, col1, col2):
        """Setter from vectors, column-wise.

        Args:
            col0 (Vec3): Vector to use to set column 0.
            col1 (Vec3): Vector to use to set column 1.
            col2 (Vec3): Vector to use to set column 2.

        Returns:
            bool: True if successful.

        """

        self._rtval.setColumns('', ks.rtVal('Vec3', col0), ks.rtVal('Vec3', col1), ks.rtVal('Vec3', col2))

        return True
示例#32
0
    def setColumns(self, col0, col1, col2):
        """Setter from vectors, column-wise.

        Args:
            col0 (Vec3): Vector to use to set column 0.
            col1 (Vec3): Vector to use to set column 1.
            col2 (Vec3): Vector to use to set column 2.

        Returns:
            bool: True if successful.

        """

        self._rtval.setColumns('', ks.rtVal('Vec3', col0), ks.rtVal('Vec3', col1), ks.rtVal('Vec3', col2))

        return True
示例#33
0
    def __init__(self, x=None, y=None, z=None, ro=None):
        """Initialize values for x,y,z, and rotation order values."""

        super(Euler, self).__init__()

        if ks.getRTValTypeName(x) == 'Euler':
            self._rtval = x
        else:

            if x is not None and not isinstance(x, (int, float)) and not isinstance(x, Euler):
                raise TypeError("Euler: Invalid type for 'x' argument. \
                                Must be an int or float.")

            if y is not None and not isinstance(y, (int, float)):
                raise TypeError("Euler: Invalid type for 'y' argument. Must be \
                                an int or float.")

            if z is not None and not isinstance(z, (int, float)):
                raise TypeError("Euler: Invalid type for 'z' argument. Must be \
                                an int or float.")

            if ro is not None:
                if isinstance(ro, basestring) or isinstance(ro, (int)):
                    ro = RotationOrder(order=ro)

            self._rtval = ks.rtVal('Euler')
            if isinstance(x, Euler):
                self.set(x=x.x, y=x.y, z=x.z, ro=x.ro)
            elif x is not None and y is not None and z is not None:
                if ro is not None:
                    self.set(x=x, y=y, z=z, ro=ro)
                else:
                    self.set(x=x, y=y, z=z)
示例#34
0
    def setRows(self, row0, row1, row2):
        """Setter from vectors, row-wise.

        Args:
            row0 (Vec3): Vector to use to set row 0.
            row1 (Vec3): Vector to use to set row 1.
            row2 (Vec3): Vector to use to set row 2.

        Returns:
            bool: True if successful.

        """

        self._rtval.setRows('', ks.rtVal('Vec3', row0), ks.rtVal('Vec3', row1), ks.rtVal('Vec3', row2))

        return True
示例#35
0
文件: euler.py 项目: Leopardob/Kraken
    def __init__(self, x=None, y=None, z=None, ro=None):
        """Initialize values for x,y,z, and rotation order values."""

        super(Euler, self).__init__()

        if ks.getRTValTypeName(x) == 'Euler':
            self._rtval = x
        else:

            if x is not None and not isinstance(x, (int, float)) and not isinstance(x, Euler):
                raise TypeError("Euler: Invalid type for 'x' argument. \
                                Must be an int or float.")

            if y is not None and not isinstance(y, (int, float)):
                raise TypeError("Euler: Invalid type for 'y' argument. Must be \
                                an int or float.")

            if z is not None and not isinstance(z, (int, float)):
                raise TypeError("Euler: Invalid type for 'z' argument. Must be \
                                an int or float.")

            if ro is not None:
                if isinstance(ro, basestring) or isinstance(ro, (int)):
                    ro = RotationOrder(order=ro)

            self._rtval = ks.rtVal('Euler')
            if isinstance(x, Euler):
                self.set(x=x.x, y=x.y, z=x.z, ro=x.ro)
            elif x is not None and y is not None and z is not None:
                if ro is not None:
                    self.set(x=x, y=y, z=z, ro=ro)
                else:
                    self.set(x=x, y=y, z=z)
示例#36
0
文件: xfo.py 项目: Leopardob/Kraken
    def set(self, tr, ori, sc):
        """Setter from the translation, rotation and scaling.

        Args:
            tr (Vec3): Vector to set the translation by.
            ori (Quat): Quaternion to set the orientation by.
            sc (Vec3): Vector to set the scaling by.

        Returns:
            bool: True if successful.

        """

        self._rtval.set("", ks.rtVal("Vec3", tr), ks.rtVal("Quat", ori), ks.rtVal("Vec3", sc))

        return True
示例#37
0
    def linearInterpolate(self, other, t):
        """Linearly interpolates this color with another one based on a scalar
        blend value (0.0 to 1.0).

        Args:
            other (Color): color to blend to.
            t (float): Blend value.

        Returns:
            Color: New color blended between this and the input color.

        """

        return Color(
            self._rtval.linearInterpolate('Color', ks.rtVal('Color', other),
                                          ks.rtVal('Scalar', t)))
示例#38
0
文件: quat.py 项目: yes7rose/Kraken
    def setFromDirectionAndUpvector(self, direction, upvector):
        """Set the quat to represent the direction as the Z axis and the
        upvector pointing along the XY plane.

        Args:
            direction (Vec3): Direction vector.
            upvector (Vec3): Up direction vector.

        Returns:
            Quat: New quaternion set from direction and up vector.

        """

        return Quat(
            self._rtval.setFromDirectionAndUpvector(
                'Quat', ks.rtVal('Vec3', direction),
                ks.rtVal('Vec3', upvector)))
示例#39
0
文件: xfo.py 项目: yes7rose/Kraken
    def set(self, tr, ori, sc):
        """Setter from the translation, rotation and scaling.

        Args:
            tr (Vec3): Vector to set the translation by.
            ori (Quat): Quaternion to set the orientation by.
            sc (Vec3): Vector to set the scaling by.

        Returns:
            bool: True if successful.

        """

        self._rtval.set('', ks.rtVal('Vec3', tr), ks.rtVal('Quat', ori),
                        ks.rtVal('Vec3', sc))

        return True
示例#40
0
    def getRTVal(self):
        """Returns and RTVal object for this attribute.

        Return:
        RTVal

        """
        return ks.rtVal('Integer', self._value)
示例#41
0
    def getRTVal(self):
        """Returns and RTVal object for this attribute.

        Return:
        RTVal

        """
        return ks.rtVal('Integer', self._value)
示例#42
0
文件: quat.py 项目: Leopardob/Kraken
    def sphericalLinearInterpolate(self, q2, t):
        """Interpolates two quaternions spherically (slerp) given a scalar blend
        value (0.0 to 1.0).

        Note: This and q2 should be unit Quaternions.

        Args:
            q2 (Quat): Quaternion to blend to.
            t (float): blend value.

        Returns:
            Quat: New quaternion blended between this and the input quaternion.

        """

        return Quat(self._rtval.sphericalLinearInterpolate('Quat',
                    ks.rtVal('Quat', q2), ks.rtVal('Scalar', t)))
示例#43
0
    def y(self, value):
        """Y parameter setter.

        Args:
            value (float): Y value of the Euler Angles.

        """

        self._rtval.y = ks.rtVal('Scalar', value)
示例#44
0
    def setColumns(self, col0, col1, col2, col3):
        """Setter from vectors, column-wise.

        Args:
            col0 (Vec4): vector to use for column 0.
            col1 (Vec4): vector to use for column 1.
            col2 (Vec4): vector to use for column 2.
            col3 (Vec4): vector to use for column 3.

        Returns:
            bool: True if successful.

        """

        self._rtval.setColumns('', ks.rtVal('Vec4', col0), ks.rtVal('Vec4', col0),
                               ks.rtVal('Vec4', col2), ks.rtVal('Vec4', col3))

        return True
示例#45
0
    def setRows(self, row0, row1, row2, row3):
        """Set from vectors, row-wise.

        Args:
            row0 (Vec4): vector to use for row 0.
            row1 (Vec4): vector to use for row 1.
            row2 (Vec4): vector to use for row 2.
            row3 (Vec4): vector to use for row 3.

        Returns:
            bool: True if successful.

        """

        self._rtval.setRows('', ks.rtVal('Vec4', row0), ks.rtVal('Vec4', row0),
                            ks.rtVal('Vec4', row2), ks.rtVal('Vec4', row3))

        return True
示例#46
0
    def getRTVal(self):
        """Returns and RTVal object for this attribute.

        Returns:
            RTVal: RTVal object of the attribute.

        """

        return ks.rtVal('String', self._value)
示例#47
0
文件: euler.py 项目: Leopardob/Kraken
    def y(self, value):
        """Y parameter setter.

        Args:
            value (float): Y value of the Euler Angles.

        """

        self._rtval.y = ks.rtVal('Scalar', value)
示例#48
0
文件: euler.py 项目: Leopardob/Kraken
    def z(self, value):
        """Z parameter setter.

        Args:
            value (float): Z value of the Euler Angles.

        """

        self._rtval.z = ks.rtVal('Scalar', value)
示例#49
0
    def ro(self, value):
        """Rotation Order setter.

        Args:
            value (int): Rotation Order(ro) value of the Euler Angles.

        """

        self._rtval.ro = ks.rtVal('RotationOrder', value)
示例#50
0
    def getRTVal(self):
        """Returns and RTVal object for this attribute.

        Returns:
            RTVal: RTVal object of the attribute.

        """

        return ks.rtVal("Scalar", self._value)
示例#51
0
文件: euler.py 项目: Leopardob/Kraken
    def x(self, value):
        """X parameter setter.

        Args:
            value (float): X value of the Euler Angles.

        """

        self._rtval.x = ks.rtVal('Scalar', value)
示例#52
0
文件: euler.py 项目: Leopardob/Kraken
    def ro(self, value):
        """Rotation Order setter.

        Args:
            value (int): Rotation Order(ro) value of the Euler Angles.

        """

        self._rtval.ro = ks.rtVal('RotationOrder', value)
示例#53
0
    def x(self, value):
        """X parameter setter.

        Args:
            value (float): X value of the Euler Angles.

        """

        self._rtval.x = ks.rtVal('Scalar', value)
示例#54
0
    def set(self, r, g, b, a):
        """Sets the r, g, b, and a value from the input values.

        Args:
            r (float): Value to set the r channel to.
            g (float): Value to set the g channel to.
            b (float): Value to set the b channel to.
            a (float): Value to set the a channel to.

        Returns:
            bool: True if successful.

        """

        self._rtval.set('', ks.rtVal('Scalar', r), ks.rtVal('Scalar', g),
                        ks.rtVal('Scalar', b), ks.rtVal('Scalar', a))

        return True
示例#55
0
    def z(self, value):
        """Z parameter setter.

        Args:
            value (float): Z value of the Euler Angles.

        """

        self._rtval.z = ks.rtVal('Scalar', value)
示例#56
0
文件: color.py 项目: Leopardob/Kraken
    def set(self, r, g, b, a):
        """Sets the r, g, b, and a value from the input values.

        Args:
            r (float): Value to set the r channel to.
            g (float): Value to set the g channel to.
            b (float): Value to set the b channel to.
            a (float): Value to set the a channel to.

        Returns:
            bool: True if successful.

        """

        self._rtval.set('', ks.rtVal('Scalar', r), ks.rtVal('Scalar', g),
                        ks.rtVal('Scalar', b), ks.rtVal('Scalar', a))

        return True
示例#57
0
    def setRows(self, row0, row1, row2, row3):
        """Set from vectors, row-wise.

        Args:
            row0 (Vec4): vector to use for row 0.
            row1 (Vec4): vector to use for row 1.
            row2 (Vec4): vector to use for row 2.
            row3 (Vec4): vector to use for row 3.

        Returns:
            bool: True if successful.

        """

        self._rtval.setRows('', ks.rtVal('Vec4', row0), ks.rtVal('Vec4', row0),
                            ks.rtVal('Vec4', row2), ks.rtVal('Vec4', row3))

        return True
示例#58
0
文件: quat.py 项目: Leopardob/Kraken
    def setFrom2Vectors(sourceDirVec, destDirVec, arbitraryIfAmbiguous=True):
        """Set the quaternion to the rotation required to rotate the source
        vector to the destination vector.

        Function taken from the 'Game Programming Gems' article
        'The Shortest Arc Quat' by Stan Melax, both vectors must be units.

        Args:
            sourceDirVec (Vec3): Source vector.
            destDirVec (Vec3): Destination vector.
            arbitraryIfAmbiguous (bool): Arbitrary if ambiguous.

        Returns:
            Quat: New quaternion set from 2 vectors.

        """

        return Quat(self._rtval.setFrom2Vectors('Quat', ks.rtVal('Vec3', sourceDirVec),
                    ks.rtVal('Vec3', destDirVec), ks.rtVal('Boolean', arbitraryIfAmbiguous)))
示例#59
0
文件: quat.py 项目: yes7rose/Kraken
    def sphericalLinearInterpolate(self, q2, t):
        """Interpolates two quaternions spherically (slerp) given a scalar blend
        value (0.0 to 1.0).

        Note: This and q2 should be unit Quaternions.

        Args:
            q2 (Quat): Quaternion to blend to.
            t (float): blend value.

        Returns:
            Quat: New quaternion blended between this and the input quaternion.

        """

        return Quat(
            self._rtval.sphericalLinearInterpolate('Quat',
                                                   ks.rtVal('Quat', q2),
                                                   ks.rtVal('Scalar', t)))
示例#60
0
    def setColumns(self, col0, col1, col2, col3):
        """Setter from vectors, column-wise.

        Args:
            col0 (Vec4): vector to use for column 0.
            col1 (Vec4): vector to use for column 1.
            col2 (Vec4): vector to use for column 2.
            col3 (Vec4): vector to use for column 3.

        Returns:
            bool: True if successful.

        """

        self._rtval.setColumns('', ks.rtVal('Vec4', col0),
                               ks.rtVal('Vec4', col0), ks.rtVal('Vec4', col2),
                               ks.rtVal('Vec4', col3))

        return True