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(
163 bool hasNoCopyTag()
const;
169 void setDisableCondition(
179 bool isOrdered()
const;
180 bool isCustom()
const;
181 bool isBuiltin()
const;
186 bool skip_defaults)
const;
187 static bool fromJSON(
226 bool eval = evaluate(
227 index, temp, work_item, errors);
269 bool always_replace)
const;
272 bool always_replace)
const;
275 bool always_replace)
const;
299 bool canEvaluate(
int index,
303 template <
typename T>
304 bool evaluateTyped(
int index,
311 index += myPortValues.size();
313 if (!canEvaluate(index, errors))
316 const pdg_PortValue&
val = myPortValues[
index];
323 thread, work_item, isParent(work_item));
325 PDG_EvaluationContext::activeWorkItem(thread);
330 myName, index, expand, result, local_item, thread, errors))
339 if (!val.hasExpression())
341 val.myValue.value(temp);
342 result = postReplace(temp, local_item,
true);
353 result = postReplace(temp, local_item,
true);
357 template <
typename T>
358 bool evaluateArray(
bool expand,
365 errors.
appendFormat(
"Port '{}' is not a parameter", myName);
371 thread, work_item, isParent(work_item));
376 for (
auto&& port_val : myPortValues)
379 if (port_val.isAppParm())
381 if (!appEval(myName, index, expand, temp,
382 local_item, thread, errors))
389 else if (!port_val.hasExpression())
390 port_val.myValue.value(temp);
395 *port_val.myPyExpression,
402 result.
append(postReplace(temp, local_item,
true));
413 : myPyExpression(nullptr)
414 , myMultiExpression(false)
423 if (myPyExpression && !PY_Py_IsInitialized())
424 myPyExpression.release();
427 int64 getMemoryUsage(
bool inclusive)
const
429 int64 mem = inclusive ?
sizeof(*this) : 0;
430 mem += myExpression.getMemoryUsage(
false);
432 mem += myPyExpression->getMemoryUsage(
true);
436 inline bool hasExpression()
const {
return myExpression.length() > 0; }
437 inline bool isAppParm()
const {
return myIsAppParm; }
444 bool myMultiExpression;
449 ConnectionArray myConnections;
463 ExpressionVars myExpressionVars;
466 int myEvaluationOrigin;
472 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)
GLint GLint GLsizei GLint GLenum GLenum type
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.