Search the Community
Showing results for tags 'sQuery'.
-
Hey guys! Meet sQuery, a jQuery-like library I have been developing for easy scene queries and modifications in Houdini. You can download and read more about it on github: https://github.com/hibernationTheory/sQuery sQuery provides an easy-to-use interface to perform complex scene queries and modifications over your scene. Better to show an example than to try to explain: After importing the module, you would initialize it for a context. sq = sQuery.sQuery("obj") Here is a simple example: sq.children("*house*").filter("t#instance").children("t#alembic").replaceAttrValue("filename, "v002", "v003") # for all the children of the object context that has the word "house" in it filters those that are of type 'instance', gets the alembic nodes inside them and replaces the v002 in their filename attr value to v003. Here is a more complex example: sq.children("*geo*").remove("*HOUSE*).filter("t#instanc*").children("t#alembic [filename~=main]").replaceAttrValue("filename", "v002", "v003") .setUserData("is_altered", "true").addToBundle("alembics_inside_instances").layout().next("t#switch").createNodeAfter("delete", {"group":"*_arms_"}).toggle("affectnumber").select().setColor("red").move(-10, -10) """ gets all the children in obj context with name that matches to the *geo* pattern, from that removes those that have the word *HOUSE* in it, from the result filters those whose type name matches to the *instanc* pattern, chooses the alembic type children of the result for which the filename value contains the word "main" in it. replaces the 'v002' on the alembic nodes filename parameter with 'v003', creates a user data on them called "is_altered" with the value "true" and adds those alembics to the bundle "alembics_inside_instances", lays them out (layoutChildren on the nodes) and selects the next node if it is of type switch and creates a delete node after them with the 'group' parameter set to '*_arms_*', toggles the affectnumber parameter on this delete nodes (meaning if it is on, makes it off or vice versa) and then sets a viewport selection on these 'delete' nodes that were created, also sets their color to red and moves them to -10 at x and -10 y. all in a single line. """ Let me know what you think of it. Thanks!