Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Help] Is there an API hook for grouping/ungrouping drawings?

1608372618
Pat
Pro
API Scripter
I'm looking at this for a number of reasons - Is there a way to group or ungroup drawings on the tabletop via the API? Or is it tracking the change of any of the set of objects and then dragging the rest to their appropriate relative positions? 
AFAIK there is no grouping. But as you state, i think you could implement some form of grouped graphics move based on some sort of marker ID on a set of objects. Though cascading events would be a challenge.
1608406309
The Aaron
Roll20 Production Team
API Scripter
There isn't access to the grouping system from the API.  Storing an id and moving all of them when any of them move works well. You can actually repurpose the controlled by field for this. For example, in UniversalVTTImporter I put the token_id from the map graphic in the controlledby field of all the DL lines, which makes it easy to find them all and remove them. You don't have to use an actual id, you could put "Group:1" and use that for your matchup, etc. 
The controlledby field is not cleansed upon access/change by roll20? Nasty and nice and the same time. It surely beats hiding the identifier in the bar3 value.
1608422893
The Aaron
Roll20 Production Team
API Scripter
For paths, there's not a UI for the controlledby field, so the only way it can get a value is if you were the one drawing it, or the API sets one. 
1608423232
The Aaron
Roll20 Production Team
API Scripter
The same trick works for tokens and characters, but you have to do a bit more to not break things. The UI will only show actual players, and won't remove your additions, you just have to be sure to not remove the others. Also, you can't do a simple match and must actually process the field as a CSV.