HAPI_GetGroupMembership(
     ref HAPI_Session session,
     HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id, HAPI_PartId part_id,
     HAPI_GroupType group_type,
     string group_name,
     [Out] int[] membership_array,
     int start, int length);
Exemple #2
0
    public int getElementCountByGroupType(HAPI_GroupType type)
    {
        switch (type)
        {
        case HAPI_GroupType.HAPI_GROUPTYPE_POINT: return(pointCount);

        case HAPI_GroupType.HAPI_GROUPTYPE_PRIM: return(faceCount);

        default: return(0);
        }
    }
Exemple #3
0
    public int getGroupCountByType(HAPI_GroupType type)
    {
        switch (type)
        {
        case HAPI_GroupType.HAPI_GROUPTYPE_POINT: return(pointGroupCount);

        case HAPI_GroupType.HAPI_GROUPTYPE_PRIM: return(primitiveGroupCount);

        default: return(0);
        }
    }
    public static void addGroup(
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
		HAPI_GroupType group_type, string group_name )
    {
        #if ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) )
        HAPI_Result status_code = HAPI_AddGroup(
            ref mySession, asset_id, object_id, geo_id, group_type, group_name );
        processStatusCode( status_code );
        #else
        throw new HoudiniErrorUnsupportedPlatform();
        #endif
    }
Exemple #5
0
		/// <summary>
		/// Gets the group names for given group type.
		/// </summary>
		/// <param name="nodeID">The node ID</param>
		/// <param name="groupType">The group type to query</param>
		/// <returns>Populated array of string names, or null if failed</returns>
		public static string[] GetGroupNames(HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, bool isInstanced)
		{
			HEU_SessionBase session = GetOrCreateDefaultSession();
			if (session != null)
			{
				HAPI_GeoInfo geoInfo = new HAPI_GeoInfo();
				if (session.GetGeoInfo(nodeID, ref geoInfo))
				{
					int groupCount = 0;

					if(!isInstanced)
					{
						groupCount = geoInfo.getGroupCountByType(groupType); ;
					}
					else
					{
						int pointGroupCount = 0;
						int primGroupCount = 0;
						if (session.GetGroupCountOnPackedInstancePart(nodeID, partID, out pointGroupCount, out primGroupCount))
						{
							groupCount = (groupType == HAPI_GroupType.HAPI_GROUPTYPE_POINT) ? pointGroupCount : primGroupCount;
						}
					}

					if(groupCount <= 0)
					{
						return null;
					}

					int[] groupNames = new int[groupCount];
					bool bSuccess = false;
					if(!isInstanced)
					{
						bSuccess = session.GetGroupNames(nodeID, groupType, ref groupNames, groupCount);
					}
					else
					{
						bSuccess = session.GetGroupNamesOnPackedInstancePart(nodeID, partID, groupType, ref groupNames, groupCount);
					}

					if (bSuccess)
					{
						string[] nameStrings = new string[groupCount];
						for (int i = 0; i < groupCount; ++i)
						{
							nameStrings[i] = GetString(groupNames[i]);
						}
						return nameStrings;
					}
				}
			}
			return null;
		}
Exemple #6
0
		/// <summary>
		/// Gets the group names for given group type.
		/// </summary>
		/// <param name="nodeID">The node ID</param>
		/// <param name="groupType">The group type to query</param>
		/// <returns>Populated array of string names, or null if failed</returns>
		public static string[] GetGroupNames(HAPI_NodeId nodeID, HAPI_GroupType groupType)
		{
			HEU_SessionBase sessionBase = GetOrCreateDefaultSession();
			if (sessionBase != null)
			{
				HAPI_GeoInfo geoInfo = new HAPI_GeoInfo();
				if (sessionBase.GetGeoInfo(nodeID, ref geoInfo))
				{
					int count = geoInfo.getGroupCountByType(groupType);
					int[] names = new int[count];
					if (sessionBase.GetGroupNames(nodeID, groupType, ref names, count))
					{
						string[] nameStrings = new string[count];
						for (int i = 0; i < count; ++i)
						{
							nameStrings[i] = GetString(names[i]);
						}
						return nameStrings;
					}
				}
			}
			return null;
		}
Exemple #7
0
 HAPI_AddGroup(
     HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
     HAPI_GroupType group_type,
     string group_name);
    private static extern HAPI_Result HAPI_AddGroup(
		ref HAPI_Session session,
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
		HAPI_GroupType group_type,
		string group_name );
	public static void setGroupMembership(
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
		HAPI_GroupType group_type,
		string group_name,
		bool[] membership,
		int count )
	{
#if ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) )
		if ( count != membership.Length )
			throw new HoudiniErrorInvalidArgument( "Membership array not same size as count argument!" );

		int[] membership_int = new int[ count ];
		for ( int i = 0; i < count; ++i )
			membership_int[ i ] = membership[ i ] ? 1 : 0;

		HAPI_Result status_code = HAPI_SetGroupMembership(
			ref mySession, asset_id, object_id, geo_id, group_type, group_name, membership_int, 0, count );
		processStatusCode( status_code );
#else
		throw new HoudiniErrorUnsupportedPlatform();
#endif
	}
	public static bool[] getGroupMembership(
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id, HAPI_PartId part_id,
		HAPI_GroupType group_type,
		string group_name )
	{
#if ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) )
		HAPI_PartInfo part_info = new HAPI_PartInfo();
		HAPI_Result status_code = HAPI_GetPartInfo( ref mySession, asset_id, object_id, geo_id, part_id, out part_info );
		processStatusCode( status_code );

		int count = part_info.getElementCountByGroupType( group_type );

		int[] membership = new int[ count ];

		if ( count > 0 )
		{
			status_code = HAPI_GetGroupMembership(
				ref mySession, asset_id, object_id, geo_id, part_id, group_type, group_name, membership, 0, count );
			processStatusCode( status_code );
		}

		bool[] membership_bools = new bool[ count ];
		for ( int i = 0; i < count; ++i )
			membership_bools[ i ] = membership[ i ] > 0;

		return membership_bools;
#else
		throw new HoudiniErrorUnsupportedPlatform();
#endif
	}
	public static string[] getGroupNames(
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
		HAPI_GroupType group_type )
	{
#if ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) )
		HAPI_GeoInfo geo_info = new HAPI_GeoInfo();
		HAPI_Result status_code = HAPI_GetGeoInfo( ref mySession, asset_id, object_id, geo_id, out geo_info );
		processStatusCode( status_code );

		int count = geo_info.getGroupCountByType( group_type );

		int[] names = new int[ count ];
		status_code = HAPI_GetGroupNames(
			ref mySession, asset_id, object_id, geo_id, group_type, names, count );
		processStatusCode( status_code );

		string[] name_strings = new string[ count ];
		for ( int i = 0; i < count; ++i )
			name_strings[ i ] = getString( names[ i ] );

		return name_strings;
#else
		throw new HoudiniErrorUnsupportedPlatform();
#endif
	}
    private static extern HAPI_Result HAPI_GetGroupMembership(
		ref HAPI_Session session,
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id, HAPI_PartId part_id,
		HAPI_GroupType group_type,
		string group_name,
		[Out] int[] membership_array,
		int start, int length );
		public virtual bool GetGroupMembershipOnPackedInstancePart(HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, string groupName, ref bool membershipArrayAllEqual, [Out] int[] membershipArray, int start, int length)
		{
			return false;
		}
		/// <summary>
		/// Gets the group names for given group type.
		/// </summary>
		/// <param name="nodeID">The node ID</param>
		/// <param name="groupType">The group type</param>
		/// <param name="names">Array to populate. Must at least be of size count</param>
		/// <param name="count">Should be less than or equal to size of names</param>
		/// <returns>True if successfully queried the group names</returns>
		public virtual bool GetGroupNames(HAPI_NodeId nodeID, HAPI_GroupType groupType, ref HAPI_StringHandle[] names, int count)
		{
			return false;
		}
Exemple #15
0
 HAPI_GetGroupNames(
     HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
     HAPI_GroupType group_type,
     [Out] HAPI_StringHandle[] group_names,
     int group_count);
Exemple #16
0
	public int getElementCountByGroupType( HAPI_GroupType type )
	{
		switch ( type )
		{
			case HAPI_GroupType.HAPI_GROUPTYPE_POINT: return pointCount;
			case HAPI_GroupType.HAPI_GROUPTYPE_PRIM: return faceCount;
			default: return 0;
		}
	}
Exemple #17
0
	public int getGroupCountByType( HAPI_GroupType type )
	{
		switch ( type )
		{
			case HAPI_GroupType.HAPI_GROUPTYPE_POINT: return pointGroupCount;
			case HAPI_GroupType.HAPI_GROUPTYPE_PRIM: return primitiveGroupCount;
			default: return 0;
		}
	}
 HAPI_AddGroup(
     ref HAPI_Session session,
     HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
     HAPI_GroupType group_type,
     string group_name);
 HAPI_GetGroupNames(
     ref HAPI_Session session,
     HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
     HAPI_GroupType group_type,
     [Out] HAPI_StringHandle[] group_names_array,
     int group_count);
		public virtual bool SetGroupMembership(HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, string groupName, [Out] int[] membershipArray, int start, int length)
		{
			return false;
		}
Exemple #21
0
 HAPI_SetGroupMembership(
     HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
     HAPI_GroupType group_type,
     string group_name,
     [Out] int[] membership,
     int start, int length);
		public virtual bool GetGroupNamesOnPackedInstancePart(HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, ref HAPI_StringHandle[] groupNamesArray, int groupCount)
		{
			return false;
		}
	HAPI_GetGroupNames(
		ref HAPI_Session session,
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
		HAPI_GroupType group_type,
		[Out] HAPI_StringHandle[] group_names_array,
		int group_count );
		public virtual bool DeleteGroup(HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, string groupName)
		{
			return false;
		}
	HAPI_AddGroup(
		ref HAPI_Session session,
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
		HAPI_GroupType group_type,
		string group_name );
	/// <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;
	}
	HAPI_SetGroupMembership(
		ref HAPI_Session session,
		HAPI_AssetId asset_id, HAPI_ObjectId object_id, HAPI_GeoId geo_id,
		HAPI_GroupType group_type,
		string group_name,
		[Out] int[] membership_array,
		int start, int length );