generating TreeView is very slow
hi.
any idea why generatetreeviewitems funcion slow? takes 2 seconds generate treeview once edittext field active. cc2015 or did wrong here?
thanks.
var myobjectlist = { "group 1" : [ { "name" : "fui box combo", "funck": "fuiboxcombo" }, { "name" : "fui combo 1", "funck": "fuicombo1" }, { "name" : "fui combo 2", "funck": "fuicombo2" }, { "name" : "fui combo 3", "funck": "fuicombo3" }, { "name" : "fui combo 4", "funck": "fuicombo4" }, { "name" : "fui combo 5", "funck": "fuicombo5" }, { "name" : "fui combo 6", "funck": "fuicombo6" }, { "name" : "fui new 1.5", "funck": "fuinewto1_5" } ], "group 2" : [ { "name" : "bg crosshairs", "funck": "bgcrosshairs" }, { "name" : "bg curvesquiggles", "funck": "bgcurvesquiggles" }, { "name" : "bg diag", "funck": "bgdiag" }, { "name" : "bg diag boxed", "funck": "bgdiagboxed" }, { "name" : "bg fat stripes", "funck": "bgfatstripes" }, { "name" : "bg hex", "funck": "bghex" }, { "name" : "bg light grid", "funck": "bglightgrid" }, { "name" : "bg lines", "funck": "bglines" }, { "name" : "bg ls", "funck": "bgls" }, { "name" : "bg opengrid", "funck": "bgopengrid" }, { "name" : "bg step squares", "funck": "bgstepsquares" }, { "name" : "bg tri grid", "funck": "bgtrigrid" }, { "name" : "bg waves", "funck": "bgwaves" }, { "name" : "bg zippy squares", "funck": "bgzippysquares" } ], "group 3" : [ { "name" : "blocks", "funck": "blocks" }, { "name" : "boingy-box", "funck": "boingybox" }, { "name" : "bracket box", "funck": "bracketbox" }, { "name" : "corner box", "funck": "cornerbox" }, { "name" : "fake screen", "funck": "fakescreen" }, { "name" : "flashy table", "funck": "flashytable" }, { "name" : "os frame", "funck": "osframe" }, { "name" : "periodic table", "funck": "periodictable" }, { "name" : "photoframe 1", "funck": "photoframe1" }, { "name" : "point box", "funck": "pointbox" }, { "name" : "pointless box", "funck": "pointlessbox" }, { "name" : "square dance", "funck": "squaredance" }, { "name" : "target box", "funck": "targetbox" }, { "name" : "techy frame", "funck": "techyframe" }, { "name" : "triangle box", "funck": "trianglebox" } ], "group 3" : [ { "name" : "blips", "funck": "blips" }, { "name" : "bursty", "funck": "bursty" }, { "name" : "dot belt", "funck": "dotbelt" }, { "name" : "earthquake", "funck": "earthquake" }, { "name" : "fig8. v1", "funck": "fig8v1" }, { "name" : "fig8. v2", "funck": "fig8v2" }, { "name" : "fig8. v3", "funck": "fig8v3" }, { "name" : "fizzy data thing", "funck": "fizzydatathing" }, { "name" : "just dots, relax", "funck": "justsomedotsrelax" }, { "name" : "knightrider scan", "funck": "knightriderscan" }, { "name" : "shoop shoop lines", "funck": "shoopshooplines" }, { "name" : "wobbly", "funck": "wobbly" } ], "group 4" : [ { "name" : "elaborate line graph", "funck": "elaboratelinegraph" }, { "name" : "flickery pie slices", "funck": "flickerypieslices" }, { "name" : "meaningless line graph", "funck": "meaninglessjerkylinegraph" }, { "name" : "nondescript barchart", "funck": "nondescriptbarchart" }, { "name" : "overactive line graph", "funck": "overactivelinegraph" }, { "name" : "rgb curves", "funck": "rgbcurves" }, { "name" : "sine wave", "funck": "sinewave" }, { "name" : "snappy line graph", "funck": "snappylinegraph" }, { "name" : "stupid line graph", "funck": "stupidlinegraph" } ], "group 5" : [ { "name" : "after effects (kinda)", "funck": "aftereffectskinda" }, { "name" : "almost dna", "funck": "almostdna" }, { "name" : "apple loading", "funck": "appleloading" }, { "name" : "atom", "funck": "atom" }, { "name" : "bunch of knobs", "funck": "bunchofknobs" }, { "name" : "calendar", "funck": "calendar" }, { "name" : "chevron thing", "funck": "chevronthing" }, { "name" : "clock", "funck": "clock" }, { "name" : "complicated compass", "funck": "complicatedcompass" }, { "name" : "crap siri", "funck": "crapsiri" }, { "name" : "deleting files", "funck": "deletingfiles" }, { "name" : "fingerprint", "funck": "fingerprint" }, { "name" : "flicky squares", "funck": "flickysquares" }, { "name" : "flux capacitor", "funck": "fluxcapacitor" }, { "name" : "kitt voice", "funck": "kittvoice" }, { "name" : "label", "funck": "label" }, { "name" : "loading (line)", "funck": "loadingline" }, { "name" : "plus", "funck": "plus" }, { "name" : "radar", "funck": "radar" }, { "name" : "segment thing", "funck": "segmentthing" }, { "name" : "skype loader", "funck": "skypeloader" }, { "name" : "speed thing", "funck": "speedthing" }, { "name" : "spiral", "funck": "spiral" }, { "name" : "stay on target", "funck": "stayontarget" }, { "name" : "techy spinny blocks", "funck": "techyspinnyblocks" }, { "name" : "temperature thing", "funck": "temperaturething" }, { "name" : "warning?", "funck": "warning" }, { "name" : "wobbly hexagons", "funck": "wobblyhexagons" } ], "group 6" : [ { "name" : "compression wave", "funck": "compressionwave" }, { "name" : "connector things", "funck": "connectorthings" }, { "name" : "diagram indicator", "funck": "diagramindicator" }, { "name" : "flickery ********", "funck": "flickerybullshit" }, { "name" : "hex thing", "funck": "hexthing" }, { "name" : "hex thing alt", "funck": "hexthingalt" }, { "name" : "lineup", "funck": "lineup" }, { "name" : "scanny grid", "funck": "scannygrid" }, { "name" : "sciencey looking analysis", "funck": "scienceylookinganalysis" }, { "name" : "sciencey looking analysis 2", "funck": "scienceylookinganalysis2" }, { "name" : "triangle", "funck": "triangle" } ], "group 7" : [ { "name" : "cafinated wavey sliders", "funck": "cafinatedwaveysliders" }, { "name" : "delightful tabs", "funck": "delightfultabs" }, { "name" : "different sliders", "funck": "differentsliders" }, { "name" : "graphic eq", "funck": "graphiceq" }, { "name" : "meaningless sliders", "funck": "meaninglesssliders" }, { "name" : "side2side", "funck": "side2side" }, { "name" : "sideways", "funck": "sideways" }, { "name" : "voice synth", "funck": "voicesynth" } ], "group 8" : [ { "name" : "3d spinner", "funck": "spinner3d" }, { "name" : "bouncy rings", "funck": "bouncyrings" }, { "name" : "clumps?", "funck": "clumps" }, { "name" : "digital corona", "funck": "digitalcorona" }, { "name" : "dot party", "funck": "dotparty" }, { "name" : "flippy rings", "funck": "flippyrings" }, { "name" : "interesting dots + lines", "funck": "interestingdotslines" }, { "name" : "interesting triangles", "funck": "interestingtriangles" }, { "name" : "jiggly balls", "funck": "jigglyballs" }, { "name" : "misc rotating thing", "funck": "miscrotatingthing" }, { "name" : "nice useless circle", "funck": "nicebutuselesscircle" }, { "name" : "overanimated dial", "funck": "overanimateddial" }, { "name" : "overanimated rings", "funck": "overanimatedrings" }, { "name" : "simple dashy circle", "funck": "simpledashycircle" }, { "name" : "slices", "funck": "slices" }, { "name" : "spinny orb crosses", "funck": "spinnyorbwithcrosses" }, { "name" : "strange concentric circles", "funck": "strangeconcentriccircles" }, { "name" : "undulating thing 1", "funck": "undulatingthing1" }, { "name" : "undulating thing 2", "funck": "undulatingthing2" }, { "name" : "undulating thing 3", "funck": "undulatingthing3" }, { "name" : "woop-woop", "funck": "woopwoop" }, { "name" : "zoomy spiral", "funck": "zoomyspiral" } ] } var win = new window("palette", "settings", undefined, {resizeable:true}); //dialog win.preferredsize = [150, 300]; var mygroup = win.add("group"); mygroup.alignment = ["fill", "fill"]; mygroup.orientation = "column"; var mysearch = mygroup.add("edittext", undefined, ""); mysearch.alignment = ["fill", "top"]; var mytree = mygroup.add("treeview", undefined, [], {multiselect:true}); generatetreeitems(mytree, myobjectlist); mytree.alignment = ["fill", "fill"]; mysearch.onchanging = function() { var filtereditems = finditems(myobjectlist, mysearch.text.tolowercase()); mytree.removeall(); generatetreeitems(mytree, filtereditems); (var = 0; < mytree.items.length; ++) { if (mysearch.text !== "") { mytree.children[i].expanded = true } } } function finditems(myobject, inputstring){ var newobject = {}; (var category in myobject) { (var = 0; < myobject[category].length; ++) { if (myobject[category][i]["name"].tolowercase().match(inputstring)) { if (!newobject.hasownproperty(category)) { newobject[category] = []; } newobject[category].push(myobject[category][i]); } } } return newobject } function generatetreeitems(mytree2, myobject) { (var category in myobject) { var tempnode = mytree2.add("node", category); (var animal in myobject[category]) { tempnode.add("item", myobject[category][animal]["name"]); } } } win.onresizing = win.onresize = function () { this.layout.resize(); }; win.show ();
2014.2 working pretty instantly me.
More discussions in After Effects Scripting
adobe
Comments
Post a Comment