10 #define __PDG_PORT_H__
31 #include <type_traits>
45 : myConnectedPort(port)
46 , myIsReference(is_ref)
74 bool builtin =
false);
78 int64 getMemoryUsage(
bool inclusive)
const;
86 bool disconnect(
PDG_Port* port,
bool inverse =
true);
90 bool canConnectTo(
PDG_Port* port)
const;
98 bool filter_reference)
const;
100 bool filter_bypassed,
101 bool filter_reference)
const;
105 bool filter_bypassed,
106 bool filter_reference)
const;
112 void setWorkItemDataType(
121 void setExpression(
int index,
124 void setIsAppParm(
int index,
bool app_parm);
126 bool isAppParm(
int index)
const;
128 bool hasExpressionVars()
const;
133 bool multiExpression(
int index)
const;
134 bool hasExpression(
int index)
const;
136 bool isEnabled()
const;
137 void setIsEnabled(
bool enabled);
139 bool hasWorkItemExpression()
const;
141 void resetExpressionAttribs();
144 int evaluationOrigin()
const;
145 void setEvaluationOrigin(
int origin);
147 void setDisplayType(
int display_type);
149 int displayType()
const;
155 void setDisplayMenuScript(
167 void setDisableCondition(
177 bool isOrdered()
const;
178 bool isCustom()
const;
179 bool isBuiltin()
const;
184 bool skip_defaults)
const;
185 static bool fromJSON(
224 bool eval = evaluate(
225 index, temp, work_item, errors);
267 bool always_replace)
const;
270 bool always_replace)
const;
273 bool always_replace)
const;
297 bool canEvaluate(
int index,
301 template <
typename T>
302 bool evaluateTyped(
int index,
309 index += myPortValues.size();
311 if (!canEvaluate(index, errors))
314 const pdg_PortValue&
val = myPortValues[
index];
321 thread, work_item, isParent(work_item));
323 PDG_EvaluationContext::activeWorkItem(thread);
328 myName, index, expand, result, local_item, thread, errors))
337 if (!val.hasExpression())
339 val.myValue.value(temp);
340 result = postReplace(temp, local_item,
true);
351 result = postReplace(temp, local_item,
true);
355 template <
typename T>
356 bool evaluateArray(
bool expand,
363 errors.
appendFormat(
"Port '{}' is not a parameter", myName);
369 thread, work_item, isParent(work_item));
374 for (
auto&& port_val : myPortValues)
377 if (port_val.isAppParm())
379 if (!appEval(myName, index, expand, temp,
380 local_item, thread, errors))
387 else if (!port_val.hasExpression())
388 port_val.myValue.value(temp);
393 *port_val.myPyExpression,
400 result.
append(postReplace(temp, local_item,
true));
411 : myPyExpression(nullptr)
412 , myMultiExpression(false)
421 if (myPyExpression && !PY_Py_IsInitialized())
422 myPyExpression.release();
425 int64 getMemoryUsage(
bool inclusive)
const
427 int64 mem = inclusive ?
sizeof(*this) : 0;
428 mem += myExpression.getMemoryUsage(
false);
430 mem += myPyExpression->getMemoryUsage(
true);
434 inline bool hasExpression()
const {
return myExpression.length() > 0; }
435 inline bool isAppParm()
const {
return myIsAppParm; }
442 bool myMultiExpression;
447 ConnectionArray myConnections;
461 ExpressionVars myExpressionVars;
464 int myEvaluationOrigin;
470 bool myHasExpressionVars;
static const UT_StringHolder theTypeKey
GLuint GLsizei const GLchar * label
GLsizei const GLfloat * value
static const UT_StringHolder theValueKey
PDG_Port * myConnectedPort
static void updateParameterEvaluation(int thread, bool has_error)
Updates parameter error state.
Class which writes ASCII or binary JSON streams.
GLenum GLenum GLsizei const GLuint GLboolean enabled
**But if you need a result
static const UT_StringHolder theSizeKey
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
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.
static const UT_StringHolder theLabelKey
static const UT_StringHolder theExpressionKey
static const UT_StringHolder theNameKey
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
static const UT_StringHolder theTagsKey
**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)
Class to store JSON objects as C++ objects.
bool evaluate(int index, T &result, const PDG_WorkItem *work_item, UT_WorkBuffer &errors)
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate and *a name There is also one special expression reference
HUSD_API const char * dataType()
PDG_PortType
Enumeration of node port types.