12 #ifndef __VOP_ParmGenerator_h__
13 #define __VOP_ParmGenerator_h__
35 bool check_shader_context
38 const char *
outputLabel(
unsigned idx)
const override;
56 void *
data =
nullptr)
override;
64 bool isSubnetParameterDefiner(
VOP_Node *subnet =
nullptr)
const;
65 bool isSubnetInputOrOutputDefiner(
VOP_Node *subnet =
nullptr)
const;
66 bool isSubnetInputDefiner(
VOP_Node *subnet =
nullptr,
67 bool allow_search =
false)
const;
68 bool isSubnetOutputDefiner(
VOP_Node *subnet =
nullptr,
69 bool allow_search =
false)
const;
70 bool isSubnetInputParm()
const;
71 bool isSubnetOutputParm()
const;
81 bool isShaderParm()
const;
82 bool isClassMemberParm()
const;
88 bool isInsideShaderOfType(
VOP_Type shader_type );
105 void recalculateParmDefiner(
bool sendchangeevents);
109 void cacheParmName();
113 {
return myParmNameCache; }
124 {
return exportParm(); }
129 bool for_shader)
const;
139 unsigned nInputs()
const override;
143 virtual void PARMSCOPE(
UT_String &str)
const;
144 virtual void setPARMSCOPE(
const char *str);
145 virtual void PARMACCESS(
UT_String &str)
const;
146 virtual void PARMNAME(
UT_String &str)
const = 0;
147 virtual void setPARMNAME(
const UT_String &str);
148 virtual void PARMPREFIX(
UT_String &str)
const;
149 virtual void PARMPOSTFIX(
UT_String &str)
const;
150 virtual void PARMLABEL(
UT_String &str)
const = 0;
151 virtual void PARMCOMMENT(
UT_String &str)
const;
152 virtual int PARMTYPEINDEX()
const = 0;
153 virtual void setPARMTYPEINDEX(
int type);
156 virtual void setPARMSTORAGE(
int type);
157 virtual void PARMMENUOPTION(
UT_String &str)
const;
158 virtual void setPARMMENUOPTION(
const UT_String &menu_option);
166 virtual bool isParmVisible()
const = 0;
173 virtual void copyDefaultValuesFrom(
181 const char * getParameterDefaultValueParmName();
186 virtual bool evalIntegerValue(
int &
value);
196 bool shouldCheckSecondaryDefinerInput(
200 static void findAllShaderParmDefiners(
208 {
return myParmMicroNode; }
225 void recalculateShaderParmDefiner(
bool sendchangeevents);
226 void recalculateSubnetParmDefiner(
bool sendchangeevents);
247 bool usesTempOutputVar()
const;
250 bool getParameterDeclarationHelper(
UT_String &parmdecl,
256 virtual void getParmDeclarationCode(
UT_String &parm_decl,
259 bool export_parms=
false);
263 virtual bool USEASPARMDEFINER()
const = 0;
264 virtual bool USEOWNEXPORTCONTEXT()
const;
265 virtual bool SHOULDHAVECORRESPONDINGCONNECTOR()
const;
266 virtual int UNIFORM()
const= 0;
267 virtual int USEBOUND()
const;
268 virtual int EXPORTPARM()
const;
269 virtual void EXPORTSHADERCONTEXTS(
271 virtual void MENUCHOICES(
UT_String &str)
const;
272 virtual void MENUSCRIPT(
UT_String &str)
const;
275 virtual bool needsInput() = 0;
279 virtual void getUnboundCode(
UT_String &codestr,
284 virtual void handleParmNameChange(
290 virtual bool getParmCanAffectParmName(
int pidx)
const = 0;
302 int useBound()
const;
303 bool shouldHaveCorrespondingConnector()
const;
304 int exportParm(
bool check_connected =
true)
const;
305 void exportShaderContexts(
307 int getParmTypeIndex();
309 void getMenuOption(
UT_String &menu_option);
313 bool conditioned =
true,
320 bool just_value =
true);
327 static void sendChangesForAllParmsDefinedBy(
351 const char *className()
const override
352 {
return "vop_ParmMicroNode"; }
357 vop_ParmMicroNode myParmMicroNode;
358 mutable OP_VERSION myCachedIsShaderParmVersion;
359 mutable bool myCachedIsShaderParm;
360 bool myIsAlwaysUsedAsShaderParm;
virtual int getInputFromNameSubclass(const UT_String &in) const
Reprsents a language for which VOPs can generate source code.
virtual void getContextsForCodeGeneration(UT_StringArray &context_names) const
virtual bool areOutputVariablesFixed(const VOP_CodeGenContext &ctx)
virtual bool forceCodeGenerationOfInputs(const VOP_CodeGenContext &context, bool check_shader_context) const
virtual unsigned getNumVisibleInputs() const
const UT_StringHolder & getParmNameCache() const
Parameters for OP_Node::getInfoText()/OP_Node::getNodeSpecificInfoText()
static const char *const MENU_SCRIPT
Menu options for this parameter.
virtual void getFixedOutputVariable(UT_String &var, int idx)
static const char *const SCOPE_METHOD
Obtains the scope for this parameter.
virtual unsigned nInputs() const
static PRM_Default theParmscopeDefault
Scope menu helpers for subclasses.
void getNodeSpecificInfoText(OP_Context &context, OP_NodeInfoParms &iparms) override
static const char *const MENU_ITEMS
Menu options for this parameter.
virtual void getOutputVariableName(UT_String &var, int idx) const
GLuint GLint GLboolean GLint GLenum access
constexpr std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size(){return subtype_count< typename std::tuple_element< I, T >::type >::value+tuple_type_size< T, I+1 >);}template< typename T > struct type_count< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size< T, 0 >)};};template< typename T > struct subtype_count{static constexpr int value{is_mutable_container< T >::value?expected_max_vector_size:type_count< T >::value};};template< typename T, typename Enable=void > struct type_count_min{static const int value{0};};template< typename T >struct type_count_min< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_tuple_like< T >::value &&!is_wrapper< T >::value &&!is_complex< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{type_count< T >::value};};template< typename T > struct type_count_min< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr int value{1};};template< typename T >struct type_count_min< T, typename std::enable_if< is_wrapper< T >::value &&!is_complex< T >::value &&!is_tuple_like< T >::value >::type >{static constexpr int value{subtype_count_min< typename T::value_type >::value};};template< typename T, std::size_t I >constexpr typename std::enable_if< I==type_count_base< T >::value, int >::type tuple_type_size_min(){return 0;}template< typename T, std::size_t I > constexpr typename std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size_min(){return subtype_count_min< typename std::tuple_element< I, T >::type >::value+tuple_type_size_min< T, I+1 >);}template< typename T > struct type_count_min< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size_min< T, 0 >)};};template< typename T > struct subtype_count_min{static constexpr int value{is_mutable_container< T >::value?((type_count< T >::value< expected_max_vector_size)?type_count< T >::value:0):type_count_min< T >::value};};template< typename T, typename Enable=void > struct expected_count{static const int value{0};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_wrapper< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{1};};template< typename T > struct expected_count< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr int value{expected_max_vector_size};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&is_wrapper< T >::value >::type >{static constexpr int value{expected_count< typename T::value_type >::value};};enum class object_category:int{char_value=1, integral_value=2, unsigned_integral=4, enumeration=6, boolean_value=8, floating_point=10, number_constructible=12, double_constructible=14, integer_constructible=16, string_assignable=23, string_constructible=24, other=45, wrapper_value=50, complex_number=60, tuple_value=70, container_value=80,};template< typename T, typename Enable=void > struct classify_object{static constexpr object_category value{object_category::other};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, char >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::integral_value};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value &&!std::is_same< T, char >::value &&!is_bool< T >::value >::type >{static constexpr object_category value{object_category::unsigned_integral};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_same< T, char >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::char_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_bool< T >::value >::type >{static constexpr object_category value{object_category::boolean_value};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type >{static constexpr object_category value{object_category::floating_point};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&std::is_assignable< T &, std::string >::value >::type >{static constexpr object_category value{object_category::string_assignable};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&(type_count< T >::value==1)&&std::is_constructible< T, std::string >::value >::type >{static constexpr object_category value{object_category::string_constructible};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::enumeration};};template< typename T > struct classify_object< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr object_category value{object_category::complex_number};};template< typename T > struct uncommon_type{using type=typename std::conditional<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&!std::is_constructible< T, std::string >::value &&!is_complex< T >::value &&!is_mutable_container< T >::value &&!std::is_enum< T >::value, std::true_type, std::false_type >::type;static constexpr bool value=type::value;};template< typename T >struct classify_object< T, typename std::enable_if<(!is_mutable_container< T >::value &&is_wrapper< T >::value &&!is_tuple_like< T >::value &&uncommon_type< T >::value)>::type >{static constexpr object_category value{object_category::wrapper_value};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::number_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&!is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::integer_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::double_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< is_tuple_like< T >::value &&((type_count< T >::value >=2 &&!is_wrapper< T >::value)||(uncommon_type< T >::value &&!is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value)||(uncommon_type< T >::value &&type_count< T >::value >=2))>::type >{static constexpr object_category value{object_category::tuple_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr object_category value{object_category::container_value};};template< typename T, enable_if_t< classify_object< T >::value==object_category::char_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"CHAR";}template< typename T, enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"INT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::unsigned_integral, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"UINT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::floating_point||classify_object< T >::value==object_category::number_constructible||classify_object< T >::value==object_category::double_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"FLOAT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::enumeration, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"ENUM";}template< typename T, enable_if_t< classify_object< T >::value==object_category::boolean_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"BOOLEAN";}template< typename T, enable_if_t< classify_object< T >::value==object_category::complex_number, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"COMPLEX";}template< typename T, enable_if_t< classify_object< T >::value >=object_category::string_assignable &&classify_object< T >::value<=object_category::other, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"TEXT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::container_value||classify_object< T >::value==object_category::wrapper_value, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value==1, detail::enabler >=detail::dummy >inline std::string type_name(){return type_name< typename std::decay< typename std::tuple_element< 0, T >::type >::type >);}template< typename T, std::size_t I >inline typename std::enable_if< I==type_count_base< T >::value, std::string >::type tuple_name(){return std::string{};}template< typename T, std::size_t I >inline typename std::enable_if<(I< type_count_base< T >::value), std::string >::type tuple_name(){auto str=std::string{type_name< typename std::decay< typename std::tuple_element< I, T >::type >::type >)}+ ','+tuple_name< T, I+1 >);if(str.back()== ',') str.pop_back();return str;}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler > > std::string type_name()
Recursively generate the tuple type name.
virtual void getDescriptiveName(UT_String &str) const
virtual bool isSubnetInput() const
Returns true if the node is considered a subnet's input node.
GLuint const GLchar * name
static const char *const NO_MENU
Menu options for this parameter.
VOP_ParmGenerator * castToParmGenerator() override
const VOP_ParmGenerator * castToParmGenerator() const override
GLenum GLenum GLsizei void * table
auto search(const T &set, const V &val) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
A search function.
static const char *const SCOPE_SUBNET
Obtains the scope for this parameter.
virtual void initializeNode()
static PRM_ChoiceList theParmscopeMenu
Scope menu helpers for subclasses.
virtual void getCode(UT_String &codestr, const VOP_CodeGenContext &context)
Get the code fragment to be included in the shader code.
Parameters for OP_Node::fillInfoTree()/OP_Node::fillInfoTreeNodeSpecific()
virtual const char * outputLabel(unsigned idx) const
virtual void getOutputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx)
virtual void getOutputNameSubclass(UT_String &out, int idx) const
static const char *const SCOPE_SHADER
Obtains the scope for this parameter.
bool isExportParm() const
Returns true if it's an exported parameter.
VOP_Type
Enumeration of the built-in (basic) VOP data types.
virtual void getInputNameSubclass(UT_String &in, int idx) const
virtual VOP_Node * getRealDefinition()
virtual bool getIsParmGenerator() const
Returns true if this VOP is a VOP_ParmGenerator or subclass.
void fillInfoTreeNodeSpecific(UT_InfoTree &tree, const OP_NodeInfoTreeParms &parms) override
static const char *const SCOPE_CLASS
Obtains the scope for this parameter.
const OP_DataMicroNode & parmListMicroNodeConst() const override
void opChanged(OP_EventType reason, void *data=0) override
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
virtual void postOpChanged(OP_EventType, void *)