protected void drawCookLog()
    {
        if (HoudiniGUI.button("get_cook_log", "Get Cook Log"))
        {
            myAsset.buildClientSide();
            myLastCookLog = HoudiniHost.getStatusString(
                HAPI_StatusType.HAPI_STATUS_COOK_RESULT,
                HAPI_StatusVerbosity.HAPI_STATUSVERBOSITY_MESSAGES);
        }

        float width = (float)Screen.width - 60;

        myCookLogScrollPosition = EditorGUILayout.BeginScrollView(
            myCookLogScrollPosition, GUILayout.Height(200));

        GUIStyle sel_label = new GUIStyle(GUI.skin.label);

        sel_label.stretchWidth = true;
        sel_label.wordWrap     = true;

        float height = sel_label.CalcHeight(
            new GUIContent(myLastCookLog), width);

        EditorGUILayout.SelectableLabel(
            myLastCookLog, sel_label, GUILayout.Width(width),
            GUILayout.Height(height));

        EditorGUILayout.EndScrollView();
    }
Example #2
0
    public void statusCheckLoop()
    {
#if UNITY_EDITOR
        HAPI_State state = HAPI_State.HAPI_STATE_STARTING_LOAD;
        prCurrentValue = 0;
        prTotal        = 100;

        bool progress_cancelled = false;

        while ((int)state > (int)HAPI_State.HAPI_STATE_MAX_READY_STATE)
        {
            state = (HAPI_State)HoudiniHost.getStatus(HAPI_StatusType.HAPI_STATUS_COOK_STATE);

            if (state == HAPI_State.HAPI_STATE_COOKING)
            {
                prCurrentValue = HoudiniHost.getCookingCurrentCount();
                prTotal        = HoudiniHost.getCookingTotalCount();
            }
            else
            {
                prCurrentValue = (System.DateTime.Now - prStartTime).Seconds;
                prTotal        = 100;
            }

            prMessage = HoudiniHost.getStatusString(
                HAPI_StatusType.HAPI_STATUS_COOK_STATE,
                HAPI_StatusVerbosity.HAPI_STATUSVERBOSITY_WARNINGS);

            if (progress_cancelled)
            {
                EditorUtility.DisplayProgressBar(prTitle, "Aborting...", 0);
            }
            else
            {
                try
                {
                    displayProgressBar();
                }
                catch (HoudiniErrorProgressCancelled)
                {
                    progress_cancelled = true;
                    EditorUtility.DisplayProgressBar(prTitle, "Aborting...", 0);
                }
            }
        }

        // We want to propage the cancellation of the progress still, even if it is after a delay.
        if (progress_cancelled)
        {
            throw new HoudiniErrorProgressCancelled();
        }

        if (state == HAPI_State.HAPI_STATE_READY_WITH_COOK_ERRORS)
        {
            state = HAPI_State.HAPI_STATE_READY;
            string messages = HoudiniHost.getCookErrorMessage();
            HoudiniHost.logWarning(messages);
        }
        else if (state == HAPI_State.HAPI_STATE_READY_WITH_FATAL_ERRORS)
        {
            state = HAPI_State.HAPI_STATE_READY;
            HoudiniHost.throwCookError();
        }
#endif // UNITY_EDITOR
    }