|
View your shopping cart.
Recent topics
Recent Comments |
Type detection?Hey guys, Anyone aware of a super easy way to detect a type? Trying to detect whether a virtual output is a structure or a number. Willing to use JS if needs be.
More like this
|
Try this - uses Composition Info, could be run in a separate window if taking an URL to a composition.
URL can be ./nameoffile.qtz, at directory root level.
You can count the structure and if it's non-zero you have a structure.
Testing a structure by evaluating it in a math patch (a==b?1:0) will semi-crash the composition such that no layers 'above' the layer falling over will render so that's not a great way to do it but as a hack it works.
Unfortunately in JS the typeof function just returns object for any object nothing more specific. I messed with using
but javascript think it is performing math even on a structured object and I was getting some weird results anyhow so left it alone.
The second attached composition shows you how to use the .constructor method to determine some types. Hope it helps.
Are you asking if one can id the type, as in "virtual, mesh, image, structure, color, number, etc."?