13 #ifndef __PY_Callback_h__
14 #define __PY_Callback_h__
62 virtual
bool getDesktopOffice(const BM_View&
v,
int &desktop_id,
int &office_id) = 0;
63 virtual FUSE_Office *getOffice(const BM_View& v) = 0;
66 virtual
bool isValidViewerOffice(const BM_View& v) const = 0;
69 virtual
PY_PyObject *newSceneViewer(FUSE_Office &office,
bool convert_context_viewer=false) = 0;
74 virtual
PY_PyObject *newCompositorViewer(FUSE_Office &office) = 0;
90 PY_Callback(
void *python_callable_object,
bool new_ref =
false) noexcept
91 : PY_OpaqueObject(python_callable_object, new_ref)
92 , myExpressionCache(
nullptr)
98 : PY_OpaqueObject(callback)
99 , myExpressionCache(
nullptr)
108 : PY_OpaqueObject(std::forward<
PY_Callback>(callback))
109 , myExpressionCache(
nullptr)
115 std::forward<PY_Callback>(callback));
125 const char *kwargs_expression=NULL)
const;
131 const char *kwargs_expression=NULL)
const
134 call(result, args_expression, kwargs_expression);
140 const char *args_expression,
141 const char *kwargs_expression,
150 const char* args_expression,
151 const char* kwargs_expression,
152 const char* module_name,
154 PY_OpaqueObject& out_args,
155 PY_OpaqueObject& out_kwargs,
161 args_expression, kwargs_expression, module_name, out_args, out_kwargs, arg_handler);
168 desired_result_type);
174 const char* args_expression,
175 const char* kwargs_expression,
176 const char* module_name,
177 PY_OpaqueObject& out_args,
178 PY_OpaqueObject& out_kwargs,
184 args_expression, kwargs_expression, module_name, out_args, out_kwargs);
196 { myExpressionCache =
c; }
214 const char *args_expression,
215 const char *kwargs_expression,
216 const char *module_name,
217 PY_OpaqueObject& out_args,
218 PY_OpaqueObject& out_kwargs )
const;
220 PY_OpaqueObject evaluateExpression(
const char *expression,
PY_Result &
result)
const;
222 PY_OpaqueObject evaluateExpression(
223 const char *expression,
const char* module_name,
PY_Result &
result)
const;
virtual ~PY_CallbackHOM()
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
PY_Callback & operator=(PY_Callback &&callback) noexcept
**But if you need a result
static void setHOM(PY_CallbackHOM *hom)
static PY_CallbackHOM * getHOM()
UT_StringMap< PY_CompiledCode * > myExpressionCache
PY_Result evaluateArgs(const char *args_expression, const char *kwargs_expression, const char *module_name, PY_OpaqueObject &out_args, PY_OpaqueObject &out_kwargs, ArgHandler arg_handler) const
PY_Callback(void *python_callable_object, bool new_ref=false) noexcept
PY_Callback(std::nullptr_t n) noexcept
PY_EvaluationContext myContext
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
std::function< T > UT_Function
PY_Callback & operator=(const PY_Callback &callback) noexcept
PY_OpaqueObject & operator=(const PY_OpaqueObject &opaque_object) noexcept
PY_Callback(const PY_Callback &callback) noexcept
PY_Result call(const char *args_expression, const char *kwargs_expression, const char *module_name, PY_Result::Type desired_result_type, PY_OpaqueObject &out_args, PY_OpaqueObject &out_kwargs, ArgHandler arg_handler) const
void setExpressionCache(PY_CallbackCompiledCodeCache *c)
**If you just want to fire and args
PY_Callback(PY_Callback &&callback) noexcept
UT_Function< void(PY_PyObject *args, PY_PyObject *kwargs)> ArgHandler
PY_Result call(const char *args_expression=NULL, const char *kwargs_expression=NULL) const
PY_PyObject * pyObject() const noexcept