コード例 #1
0
	/// <summary>
	/// Get group membership
	/// </summary>
	/// <param name="nodeID"></param>
	/// <param name="partID"></param>
	/// <param name="groupType"></param>
	/// <param name="groupName"></param>
	/// <param name="membership">Array of ints representing the membership of this group</param>
	/// <returns>True if successfully queried the group membership</returns>
	public static bool GetGroupMembership(HEU_SessionBase session, HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, string groupName, ref int[] membership, bool isInstanced)
	{
	    HAPI_PartInfo partInfo = new HAPI_PartInfo();
	    bool bResult = session.GetPartInfo(nodeID, partID, ref partInfo);
	    if (bResult)
	    {
		int count = partInfo.getElementCountByGroupType(groupType);
		membership = new int[count];
		if (count > 0)
		{
		    bool membershipArrayAllEqual = false;
		    if (!isInstanced)
		    {
			session.GetGroupMembership(nodeID, partID, groupType, groupName, ref membershipArrayAllEqual, membership, 0, count);
		    }
		    else
		    {
			session.GetGroupMembershipOnPackedInstancePart(nodeID, partID, groupType, groupName, ref membershipArrayAllEqual, membership, 0, count);
		    }
		}
		return true;
	    }
	    return false;
	}