12 #ifndef __OP_Network_h__
13 #define __OP_Network_h__
42 class OP_ProxyRefNode;
119 {
return allowOperatorAsChild(op); }
123 virtual bool allowTool(
const char *tool_name) {
return true; }
155 static const char *getScriptFromTable(
const char *
table);
156 static const char *getOpTypeFromTable(
const char *table);
161 int *hint=
nullptr)
const override;
163 virtual int getChildIndex(
const OP_Node *)
const;
177 virtual void moveChildIndex(
int srcindex,
int dstindex);
183 virtual const char *getChildType()
const;
196 int getOpsByName(
const char *op_name,
200 void stashCurrentNodePtr(
const OP_Node *child);
201 OP_Node * getStashedCurrentNodePtr()
const;
203 virtual OP_Node *getCurrentNodePtr();
204 virtual OP_Node *getDisplayNodePtr();
205 virtual OP_Node *getRenderNodePtr();
206 virtual OP_Node *getExportNodePtr();
208 virtual OP_Node *getCop3DNodePtr();
209 virtual void toggleCop3DNodePtr();
210 virtual OP_Node *getStashedCop3DNodePtr();
211 virtual void setStashedCop3DNodePtr(
const OP_Node *node);
214 virtual void childDeleted(
OP_Node *);
215 virtual void childFlagChange(
OP_Node *);
264 const char *
name =
nullptr,
267 int loadcontents = 1,
268 int *aliased_scripted_op =
nullptr,
269 char *mat_icon_filename =
nullptr,
270 bool exact_type =
false);
274 const char *
name =
nullptr)
276 return createNode(type,
name, 1, 1, 1,
nullptr,
293 const char *toname =
nullptr,
294 bool reference_parameters =
false);
301 bool reference_parameters,
302 bool relative_references,
303 bool connect_outputs_to_multi_inputs);
307 void copyPickedItems(
322 const char *toname =
nullptr,
323 bool reference_parameters =
false);
328 const char *toname =
nullptr);
332 void copyPickedNodes(
const OP_Network *srcnet,
340 virtual bool movePickedNodes(
OP_Network *src_net,
347 int destroyNode(
OP_Node *node);
350 virtual int renameNode(
OP_Node *node,
const char *
name,
355 OP_Network *findOrCreateMotionEffectsNetwork(
bool create=
true);
364 OP_Node *deleteImplicitAncestors(
366 const char *
state =
nullptr,
368 bool included =
true);
375 const char *
state =
nullptr,
377 bool included =
true);
393 virtual int isInvalidName(
const char *
name);
395 static void fixName(
const char *
name,
408 OP_ERROR savePickedItems(std::ostream &os,
417 OP_ERROR saveAllItems(std::ostream &os,
432 std::set<int>* renaming_exclude_ids =
nullptr,
440 OP_ERROR saveSingleNetworkBox(std::ostream &os,
457 OP_ERROR saveOpList(std::ostream &os,
460 int *nsaved =
nullptr);
463 OP_ERROR saveItemList(std::ostream &os,
467 const char *getClipboardFile(
const char *file_prefix =
nullptr);
475 const char *file_prefix =
nullptr);
477 bool turn_off_display =
false,
478 const char *file_prefix =
nullptr);
542 char *findUniqueGroupName(
const char *basename=
nullptr);
545 int destroyGroup(
const char *
name);
548 int getNgroups()
const;
549 OP_Group *getGroup(
int index)
const;
551 int getMemberships(
const OP_Node *node,
555 char *findUniqueNetworkBoxName(
const char *base =
nullptr);
556 char *findUniquePostItNoteName(
const char *base =
nullptr);
557 char *findUniqueDotName(
const char *base =
nullptr);
564 int getNnetworkBoxes()
const;
574 int getNpostItNotes()
const;
579 OP_PostIt *getPostItNote(
int index)
const;
584 {
return myDotList; }
585 int getNdots()
const;
588 OP_Dot *getDot(
int index)
const;
595 bool include_hidden_nodes)
const;
602 bool include_hidden =
false,
603 bool recurse_picked_netboxes =
false)
const;
630 bool isSubNode(
const OP_Node *node)
const;
645 void addPicked(
const OP_Group *group);
646 void subPicked(
const OP_Group *group);
661 const char *script_path=
nullptr);
663 {
return myOperatorTable; }
664 virtual const char *getScriptDirectory();
672 bool wantsParentInputs()
const;
676 {
return myParentInputs.entries(); }
690 void getAllConnectedChildren(
692 bool expand_subnets =
true)
const;
693 void getAllConnectedChildrenNamed(
696 bool expand_subnets =
true)
const;
714 void clearDelScripts(
int picked_only);
739 const char *prefix =
" ")
override;
745 const char *prefix =
" ")
override;
750 int getRepresentativeNodeId(
OP_Node *changed_child,
756 bool changeChildNodeType(
OP_Node *child,
762 int *new_child_id =
nullptr);
766 bool getIsSubNodeEditable(
const OP_Node *subnode)
const;
767 bool hasAnyEditableSubNodes()
const;
769 {
return myEditableSubNodes; }
783 static void saveOTLBackupInformation(std::ostream &os,
787 static void saveFallbacksPathsFor(
794 {
return myIsClearingContentsOfEditableSubnodes; }
799 {
return theWarnDeprecatedOpsOnLoad; }
801 { theWarnDeprecatedOpsOnLoad = enable; }
803 void setCachedMimeFile(
const char *
filename);
804 const char *getCachedMimeFile()
const;
805 void clearCachedMimeFile();
806 bool hasCachedMimeFile()
const;
810 bool update)
override;
818 void clearAndDestroyNodes();
844 {
return myProxyRefNodes.entries() > 0; }
852 const char *ext =
"",
853 const char *
path =
nullptr)
override;
856 virtual void beginLoadingInNetwork();
857 virtual void endLoadingInNetwork();
860 virtual void finishedLoadingChildOrder();
865 virtual void finishedLoadingNetwork(
bool is_child_call=
false);
870 static int syncContentsLevel();
884 virtual void addNode(
OP_Node *node,
int notify=1,
int explicitly=1);
890 void resetDisplayNodePtr(
OP_Node *skipthisnode=
nullptr);
892 void resetRenderNodePtr(
OP_Node *skipthisnode=
nullptr);
894 void resetAudioNodePtr(
OP_Node *skipthisnode=
nullptr);
898 void validateStatusNodePtrs(
const OP_NodeList &skipnodes);
900 virtual void updateExtraFlagPtrs();
905 virtual void destroySingleNode(
OP_Node *node);
910 void modifyAllChildNodeNames(
bool renamepickableobjects,
911 const char *prefix,
int &
id,
912 std::set<int>* renaming_exclude_ids =
nullptr);
945 const char *path_prefix,
bool vopnets);
947 const char *path_prefix,
bool vopnets,
948 bool force_no_init =
false);
951 const OP_SaveFlags &childflags,
const char *path_prefix,
952 bool vopnets,
bool force_no_init =
false,
956 const char *path_prefix);
962 op_PathSet &noneditable_missing_table);
966 const char *path_prefix);
968 const char *path_prefix);
970 const char *path_prefix);
978 bool path_contains_network =
true,
979 bool path_contains_packet_ext =
true,
989 bool path_contains_network =
true,
990 bool path_contains_packet_ext =
true,
1000 bool path_contains_network =
true,
1001 bool path_contains_packet_ext =
true,
1003 OP_Dot **created =
nullptr);
1008 void beginPickLoaded(
bool pick_loaded);
1009 void beginLoadUndo(
OP_Node *save_ops[4]);
1011 void endLoadUndo(
OP_Node *save_ops[4]);
1012 void endPickLoaded();
1018 bool &match_definition_failure,
1019 const char *packet_node_path);
1023 void syncContentsClearNetboxesFromNonInitSubNodes(
OP_Network *net);
1026 void clearContentsOfEditableSubNodes();
1029 bool isLoadingContentsSection(
OP_Operator *op)
const;
1031 void setDoMergeFlag(
bool flag ) { myDoMerge = flag; }
1035 void resolveNetworkBoxOwnership();
1038 void sendBulkNotifications(
const OP_NodeList &loaded_ops,
1040 bool builddependencies,
1041 bool notify_name_dependents);
1042 void fixPendingOverride();
1044 int savePartialVerify(std::ostream &os);
1045 void createParentInputs();
1050 bool buildItemRoots(
UT_IStream &is,
const char *merge_pattern,
1064 void fixLoadInputs();
1070 int groupCount()
const;
1073 OP_ERROR saveParentInputs(std::ostream &os,
int picked= 0);
1085 void prepareOpSave(std::ostream &os,
const OP_SaveFlags &flags,
1086 int &nsaved,
int &write_trailer);
1087 void cleanupOpSave(std::ostream &os,
const OP_SaveFlags &flags,
1088 int &nsaved,
int &write_trailer);
1095 void changeNodeIdFromLoad(
OP_Node &node,
int new_id);
1096 void invokeFinishLoadingNetwork(
OP_NodeList& op_roots);
1098 bool verifyParents();
1099 static bool verifyAllParents();
1119 OP_UndoLoad *myUndoLoad;
1124 short myDandROpsEqual;
1125 char myNameSortDirty;
1126 char myOpLoadedFlag;
1132 int myStashedCurrentNodeId;
1133 bool myIsClearingContentsOfEditableSubnodes;
1138 static bool theWarnDeprecatedOpsOnLoad;
1164 return static_cast<OP_Network *>(node);
1171 return static_cast<const OP_Network *>(node);
1178 return static_cast<OP_Network *>(node);
UT_ValArray< OP_Node * > myOutputNodes
virtual bool allowOperatorInTabMenu(OP_Operator *op)
UT_String suffixReplaceStr
virtual void moveProxyRefNodes(OP_Network *)
virtual void globNetworkBoxes(const char *pat, UT_String *expand, UT_ValArray< OP_NetworkBox * > *list=nullptr, OP_GlobContext *glob_context=nullptr, const char *prefix=" ")
GT_API const UT_StringHolder filename
virtual void traverseScope(const char *pattern, OP_ScopeOp scope_op, const OP_ScopeOptions &scope_options)
Safe reference to an OP node.
void operator=(const OP_Network *net)
int getNparentInputs() const
virtual void clearAndDestroy()
virtual void cloneFromProxyRefNode(OP_Network *proxy)
virtual OP_Node * getChild(const char *name, int *hint=nullptr) const
GLsizei const GLfloat * value
virtual bool canDestroyNode()
Return true if it is safe at this time to destroy this node.
OP_OperatorTable * getOperatorTable() const
const GLuint GLenum const void * binary
GLsizei const GLchar *const * path
OP_NetworkId(const OP_Network *node)
virtual const char * getViewSetting() const
virtual bool load(UT_IStream &is, const char *ext="", const char *path=nullptr)
void buildOpDependencies() override
virtual OP_Network * cloneToProxyRefNode()
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
virtual void nodeUnlocked()
bool operator!=(const OP_Node *node) const
#define OP_INVALID_NODE_ID
virtual void runDelScript()
bool operator!=(const OP_Network *net) const
fpreal getChildrenScale() const
int64 getMemoryUsage(bool inclusive) const override
virtual void inputConnectChanged(OP_InputIdx which)
bool operator==(const OP_Node *node) const
OP_Node * myDisplayNodePtr
SIM_API const UT_StringHolder all
virtual bool getAllowSavingChild(OP_Node *node, const OP_SaveFlags &flags)
Returns true if the child at node can should be saved, false otherwise.
virtual int propagateModification(OP_Node *by_whom, OP_EventType reason, int parm_index, OP_PropagateData &prop_data)
void notifyRenameDependents(const UT_String &full_from)
virtual OP_PostIt * findPostItNote(const char *const_path)
virtual void globPostIts(const char *pat, UT_String *expand, UT_ValArray< OP_PostIt * > *list=nullptr, OP_GlobContext *glob_context=nullptr, const char *prefix=" ")
GA_API const UT_StringHolder scale
virtual ~OP_OperatorFilter()
virtual bool allowTool(const char *tool_name)
static bool warnDeprecatedOpsOnLoad()
virtual int isNetwork() const
int hasProxyRefNodes() const override
virtual int getNchildren() const
GLint GLint GLsizei GLint GLenum GLenum type
OP_NetworkId(const OP_NetworkId &id)
virtual void unpinChannels(bool recurse)
UT_SymbolMap< OP_OperatorTable * > OP_OperatorTableMap
OP_DotList & getDotList()
UT_String prefixReplaceStr
virtual OP_Network * createProxyRefNode(const char *path)
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
virtual OP_ERROR getErrorSeverity()
virtual void setViewSetting(const char *)
static void setWarnDeprecatedOpsOnLoad(bool enable)
void notifyRenameReferences(const UT_String &full_from)
OP_Node * createNodeOfExactType(const char *type, const char *name=nullptr)
Convenience method for requesting en exact type.
GLuint const GLchar * name
virtual OP_NetworkBoxItem * findItem(const char *const_path, OP_ItemTypeMask item_type=OP_ITEMTYPE_ALL)
bool getIsClearingContentsOfEditableSubnodes()
virtual void undisplayChannels(bool recurse)
GLenum GLenum GLsizei void * table
bool operator==(const OP_Network *net) const
OP_Node * myRenderNodePtr
void pickRequest(int shift)
virtual bool allowOperatorAsChild(OP_Operator *op)
const UT_SortedSet< int > & getEditableSubNodes() const
OP_Network * operator->() const
void pickRequest(int shift)
void *(OP_Network::* OP_FindItemFunc)(const char *)
virtual void changeParmTemplate(PRM_Template *new_template)
unsigned int OP_ItemTypeMask
Create an evaluation context scope with a new node.
virtual void rebuildOpDependents(bool proxy_only)
virtual bool syncContents(UT_IStream &is)
virtual bool allowToolSubmenus(const UT_StringHolder &tool_name, const UT_StringArray &submenus)
virtual void unscopeChannels(bool recurse)
virtual void dumpDependencies(std::ostream &os)
virtual void getPotentialChildErrorNodes(OP_NodeList &nodes) const
virtual int getDandROpsEqual()
virtual void getActiveOperatorsDefinedByOTL(UT_Set< OP_Operator * > &active_operators) const
static OP_Node * lookupNode(int unique_id, bool include_proxy=false)
virtual bool getSaveWithVopnets()
void clearUndoFlags() override
virtual int updateDandROpsEqual(int=1)
const OP_Network * ptr() const
virtual bool opShouldHandleChange(OP_EventType reason)
virtual void getAdditionalUndoNodes(const OP_NodeList &orig_list, OP_NodeList &nodes_for_input_undo)
virtual void moveDependencies(OP_Node *from_node)
virtual void getRawErrors(UT_Array< UT_Error > &errors, bool update)
virtual OP_SubnetIndirectInput * findParentInput(const char *const_path)
virtual OP_NetworkBox * findNetworkBox(const char *name)
OP_API const OP_OperatorTableMap & OPgetGlobalOperatorTables()
virtual void clearUnreferencedInputs()
OP_Node * myExportNodePtr
virtual OP_Dot * findDot(const char *const_path)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter