How to check if a valid licence was found

   232   2   1
User Avatar
Member
4 posts
Joined: July 2017
Offline
Hi!

First question
In the Licencing page : Licensing for Houdini engine 3.0 [www.sidefx.com], it is stated that the licence is checked when loading an asset or creeating a node.
Is there a simple way to check if a valid Licence is found before these calls to functions?

For example : HAPI_IsValidLicenceFound()

Thanks
User Avatar
Staff
85 posts
Joined: Sept. 2016
Offline
Yes, and here's some code to check the license:

bool
GetLicenseType( FString & LicenseType )
{
    LicenseType = TEXT( "" );
    HAPI_License LicenseTypeValue = HAPI_LICENSE_NONE;

    HAPI_GetSessionEnvInt(
        MyHAPISession, HAPI_SESSIONENVINT_LICENSE,
        (int32 *) &LicenseTypeValue );

    switch ( LicenseTypeValue )
    {
        case HAPI_LICENSE_NONE:
        {
            LicenseType = TEXT( "No License Acquired" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_ENGINE:
        {
            LicenseType = TEXT( "Houdini Engine" );
            break;
        }

        case HAPI_LICENSE_HOUDINI:
        {
            LicenseType = TEXT( "Houdini" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_FX:
        {
            LicenseType = TEXT( "Houdini FX" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_ENGINE_INDIE:
        {
            LicenseType = TEXT( "Houdini Engine Indie" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_INDIE:
        {
            LicenseType = TEXT( "Houdini Indie" );
            break;
        }

        case HAPI_LICENSE_MAX:
        default:
        {
            return false;
        }
    }

    return true;
}
Edited by chrisgreb - Oct. 5, 2017 11:41:36
User Avatar
Member
4 posts
Joined: July 2017
Offline
chrisgreb
Yes, and here's some code to check the license:

bool
GetLicenseType( FString & LicenseType )
{
    LicenseType = TEXT( "" );
    HAPI_License LicenseTypeValue = HAPI_LICENSE_NONE;

    HAPI_GetSessionEnvInt(
        MyHAPISession, HAPI_SESSIONENVINT_LICENSE,
        (int32 *) &LicenseTypeValue );

    switch ( LicenseTypeValue )
    {
        case HAPI_LICENSE_NONE:
        {
            LicenseType = TEXT( "No License Acquired" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_ENGINE:
        {
            LicenseType = TEXT( "Houdini Engine" );
            break;
        }

        case HAPI_LICENSE_HOUDINI:
        {
            LicenseType = TEXT( "Houdini" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_FX:
        {
            LicenseType = TEXT( "Houdini FX" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_ENGINE_INDIE:
        {
            LicenseType = TEXT( "Houdini Engine Indie" );
            break;
        }

        case HAPI_LICENSE_HOUDINI_INDIE:
        {
            LicenseType = TEXT( "Houdini Indie" );
            break;
        }

        case HAPI_LICENSE_MAX:
        default:
        {
            return false;
        }
    }

    return true;
}
Thanks for the answer!
I can now check the licence. But in fact, I really need to load an asset or create a node before being able to check it correctly.

Thanks again for the quick answer.
  • Quick Links