Example #1
0
    /// <summary>
    /// Insert a MayaConstraint.Target placeholder into targets using its attribute name
    /// </summary>
    /// <param name="attributeName">
    /// A <see cref="System.String"/>
    /// </param>
    /// <param name="targetName">
    /// A <see cref="System.String"/>
    /// </param>
    public void InsertTargetUsingTargetAttribute(string attributeName, string targetName)
    {
        // attribute names from Maya have the format target##targetParentMatrix
        int targetIndex = int.Parse(new Regex(@"(?<=target)\d+").Match(attributeName).Value);

        if (targets == null)
        {
            targets = new MayaConstraint.Target[targetIndex + 1];
        }
        if (targets.Length <= targetIndex)
        {
            MayaConstraint.Target[] newTargetList = new MayaConstraint.Target[targetIndex + 1];
            for (int i = 0; i < targets.Length; i++)
            {
                newTargetList[i] = targets[i];
            }
            targets = newTargetList;
        }
        if (targets[targetIndex] == null)
        {
            targets[targetIndex] = new MayaConstraint.Target();
        }
        targets[targetIndex].targetName = targetName;
    }
Example #2
0
    /// <summary>
    /// Insert a MayaConstraint.Target placeholder into targets using its attribute name
    /// </summary>
    /// <param name="attributeName">
    /// A <see cref="System.String"/>
    /// </param>
    /// <param name="weight">
    /// A <see cref="System.Single"/>
    /// </param>
    public void InsertTargetUsingWeightAttribute(string attributeName, float weight)
    {
        // attribute names from Maya have the format targetObjectNameW##
        int targetIndex = int.Parse(new Regex(@"(?<=W)\d+$").Match(attributeName).Value);

        if (targets == null)
        {
            targets = new MayaConstraint.Target[targetIndex + 1];
        }
        if (targets.Length <= targetIndex)
        {
            MayaConstraint.Target[] newTargetList = new MayaConstraint.Target[targetIndex + 1];
            for (int i = 0; i < targets.Length; i++)
            {
                newTargetList[i] = targets[i];
            }
            targets = newTargetList;
        }
        if (targets[targetIndex] == null)
        {
            targets[targetIndex] = new MayaConstraint.Target();
        }
        targets[targetIndex].weight = weight;
    }
Example #3
0
	/// <summary>
	/// Insert a MayaConstraint.Target placeholder into targets using its attribute name
	/// </summary>
	/// <param name="attributeName">
	/// A <see cref="System.String"/>
	/// </param>
	/// <param name="targetName">
	/// A <see cref="System.String"/>
	/// </param>
	public void InsertTargetUsingTargetAttribute(string attributeName, string targetName)
	{
		// attribute names from Maya have the format target##targetParentMatrix
		int targetIndex = int.Parse(new Regex(@"(?<=target)\d+").Match(attributeName).Value);
		
		if (targets == null) targets = new MayaConstraint.Target[targetIndex+1];
		if (targets.Length <= targetIndex)
		{
			MayaConstraint.Target[] newTargetList = new MayaConstraint.Target[targetIndex+1];
			for (int i=0; i<targets.Length; i++)
				newTargetList[i] = targets[i];
			targets = newTargetList;
		}
		if (targets[targetIndex] == null)
			targets[targetIndex] = new MayaConstraint.Target();
		targets[targetIndex].targetName = targetName;
	}
Example #4
0
	/// <summary>
	/// Insert a MayaConstraint.Target placeholder into targets using its attribute name
	/// </summary>
	/// <param name="attributeName">
	/// A <see cref="System.String"/>
	/// </param>
	/// <param name="weight">
	/// A <see cref="System.Single"/>
	/// </param>
	public void InsertTargetUsingWeightAttribute(string attributeName, float weight)
	{
		// attribute names from Maya have the format targetObjectNameW##
		int targetIndex = int.Parse(new Regex(@"(?<=W)\d+$").Match(attributeName).Value);
		
		if (targets == null) targets = new MayaConstraint.Target[targetIndex+1];
		if (targets.Length <= targetIndex)
		{
			MayaConstraint.Target[] newTargetList = new MayaConstraint.Target[targetIndex+1];
			for (int i=0; i<targets.Length; i++)
				newTargetList[i] = targets[i];
			targets = newTargetList;
		}
		if (targets[targetIndex] == null)
			targets[targetIndex] = new MayaConstraint.Target();
		targets[targetIndex].weight = weight;
	}