10 #define __PDG_PORT_H__
30 #include <type_traits>
42 : myConnectedPort(port)
43 , myIsReference(is_ref)
63 bool builtin =
false);
67 int64 getMemoryUsage(
bool inclusive)
const;
75 bool disconnect(
PDG_Port* port,
bool inverse =
true);
79 bool canConnectTo(
PDG_Port* port)
const;
82 bool reference)
const;
87 bool filter_reference)
const;
90 bool filter_reference)
const;
95 bool filter_reference)
const;
100 void setWorkItemDataType(
109 void setExpression(
int index,
112 void setIsAppParm(
int index,
bool app_parm);
114 bool isAppParm(
int index)
const;
116 bool hasExpressionVars()
const;
121 bool multiExpression(
int index)
const;
122 bool hasExpression(
int index)
const;
124 bool isEnabled()
const;
125 void setIsEnabled(
bool enabled);
127 bool hasWorkItemExpression()
const;
129 void resetExpressionAttribs();
132 int evaluationOrigin()
const;
133 void setEvaluationOrigin(
int origin);
135 void setDisplayType(
int display_type);
137 int displayType()
const;
143 void setDisplayMenuScript(
155 void setDisableCondition(
165 bool isOrdered()
const;
166 bool isCustom()
const;
167 bool isBuiltin()
const;
204 bool eval = evaluate(
205 index, temp, work_item, errors);
247 bool always_replace)
const;
250 bool always_replace)
const;
253 bool always_replace)
const;
277 bool canEvaluate(
int index,
281 template <
typename T>
282 bool evaluateTyped(
int index,
289 index += myPortValues.size();
291 if (!canEvaluate(index, errors))
294 const pdg_PortValue&
val = myPortValues[
index];
301 thread, work_item, isParent(work_item));
303 PDG_EvaluationContext::activeWorkItem(thread);
308 myName, index, expand, result, local_item, thread, errors))
317 if (!val.hasExpression())
319 val.myValue.value(temp);
320 result = postReplace(temp, local_item,
true);
331 result = postReplace(temp, local_item,
true);
335 template <
typename T>
336 bool evaluateArray(
bool expand,
343 errors.
appendFormat(
"Port '{}' is not a parameter", myName);
349 thread, work_item, isParent(work_item));
354 for (
auto&& port_val : myPortValues)
357 if (port_val.isAppParm())
359 if (!appEval(myName, index, expand, temp,
360 local_item, thread, errors))
367 else if (!port_val.hasExpression())
368 port_val.myValue.value(temp);
373 *port_val.myPyExpression,
380 result.
append(postReplace(temp, local_item,
true));
391 : myPyExpression(nullptr)
392 , myMultiExpression(false)
399 if (myPyExpression && PY_Py_IsInitialized())
400 delete myPyExpression;
403 int64 getMemoryUsage(
bool inclusive)
const
405 int64 mem = inclusive ?
sizeof(*this) : 0;
406 mem += myExpression.getMemoryUsage(
false);
408 mem += myPyExpression->getMemoryUsage(
true);
412 inline bool hasExpression()
const {
return myExpression.length() > 0; }
413 inline bool isAppParm()
const {
return myIsAppParm; }
419 bool myMultiExpression;
424 ConnectionArray myConnections;
438 ExpressionVars myExpressionVars;
441 int myEvaluationOrigin;
447 bool myHasExpressionVars;
GLuint GLsizei const GLchar * label
GLsizei const GLfloat * value
PDG_Port * myConnectedPort
static void updateParameterEvaluation(int thread, bool has_error)
Updates parameter error state.
GLenum GLenum GLsizei const GLuint GLboolean enabled
**But if you need a result
Scoped setter of local work item.
size_t appendFormat(const char *fmt, const Args &...args)
static const PDG_WorkItem * activeWorkItem(int thread)
The script succeeded without any exceptions.
PDG_PortType
Enumeration of node port types.
static EvaluationResult evaluate(int thread, const PY_CompiledCode &expression, fpreal &result, UT_WorkBuffer &errors)
Primitive Python eval methods (loat, int, string)
HUSD_API bool eval(VtValue &val, T &ret_val)
GLuint const GLchar * name
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
pdg_Connection(PDG_Port *port, bool is_ref)
bool evaluate(int index, T &result, const PDG_WorkItem *work_item, UT_WorkBuffer &errors)
HUSD_API const char * dataType()