SpiecsEngine
 
Loading...
Searching...
No Matches
HoudiniCore.h
Go to the documentation of this file.
1/**
2* @file HoudiniCore.h.
3* @brief SpicesEngine HoudiniCore Macro.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9#include "HAPI/HAPI.h"
10
11namespace HoudiniEngine {
12
13/**
14* @brief HoudiniEngine Check macro.
15* Verify HoudiniEngine API Effectiveness.
16*/
17#define HE_CHECK(expr)
18 if((expr) != HAPI_RESULT_SUCCESS)
19 {
20 std::stringstream ss;
21 ss << "Houdini Call Failed:\n Error Code: "
22 << GetHoudiniLastError()
23 << "\n At Lines: " << __LINE__
24 << "\n At Files: " << __FILE__;
25 SPICES_CORE_WARN(ss.str());
26 }
27
28/**
29* @brief HoudiniEngine Check Cook macro.
30* Verify HoudiniEngine Cook API Effectiveness.
31*/
32#define HE_CHECK_COOK(expr)
33 if((expr) != HAPI_RESULT_SUCCESS)
34 {
35 std::stringstream ss;
36 ss << "Houdini Call Failed:\n Error Code: "
37 << GetHoudiniLastCookError()
38 << "\n At Lines: " << __LINE__
39 << "\n At Files: " << __FILE__;
40 SPICES_CORE_WARN(ss.str());
41 }
42
43 static std::string GetHoudiniLastError()
44 {
45 int bufferLength;
46 HAPI_GetStatusStringBufLength(nullptr, HAPI_STATUS_CALL_RESULT, HAPI_STATUSVERBOSITY_ERRORS, &bufferLength);
47
48 char* buffer = new char[bufferLength];
49 HAPI_GetStatusString(nullptr, HAPI_STATUS_CALL_RESULT, buffer, bufferLength);
50
51 std::string result(buffer);
52 delete[] buffer;
53
54 return result;
55 }
56
57 static std::string GetHoudiniLastCookError()
58 {
59 int bufferLength;
60 HAPI_GetStatusStringBufLength(nullptr, HAPI_STATUS_COOK_RESULT, HAPI_STATUSVERBOSITY_ERRORS, &bufferLength);
61
62 char* buffer = new char[bufferLength];
63 HAPI_GetStatusString(nullptr, HAPI_STATUS_COOK_RESULT, buffer, bufferLength);
64
65 std::string result(buffer);
66 delete[] buffer;
67
68 return result;
69 }
70
71}
virtual ~HoudiniSession()=default
static std::string GetHoudiniLastError()
Definition HoudiniCore.h:43
static std::string GetHoudiniLastCookError()
Definition HoudiniCore.h:57