Problem
The annotate COMP is probably one of my favorite additions to TouchDesigner in the last few years, and as such there are lots of ways I’m using these days. Recently, however, on a project we realized that while the Annotation COMP
knows which ops it encloses with enclosedOPs
, an operator doesn’t know if it’s inside an annotation.
Proposal
The op
class contains members for dock
and docked
, a lovely addition would be annotated
(or some other descriptor) as a member that could return a possibly empty list of annotation COMPs that an operator is inside of.
Proof of Concept
A simple python execution is fairly straightforward to implement, and could even be added to the tdu module as a helper instead of as an op class member.
def find_in_annotations(some_op:object) -> list:
annotate_owners = []
annotate_ops = some_op.parent().findChildren(type=annotateCOMP, depth=1)
for each_annotate in annotate_ops:
ops_as_paths = [each_op.path for each_op in each_annotate.enclosedOPs]
print(ops_as_paths, some_op.path)
if some_op.path in each_annotate.enclosedOPs:
annotate_owners.append(each_annotate)
return annotate_owners
The simple python approach works with ops that are enclosed in a single op:
And also works with an op enclosed in multiple annotations: