Search - User list
Full Version: How to check if a valid licence was found
Root » Houdini Engine API » How to check if a valid licence was found
Francois Devic
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
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;
}
Francois Devic
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB