gH]kDwP$Rosetta Beta 7.61[VS_O93Y4Clinton Reese, Clintons3D`d8pM*#ͺO2PNG  IHDR@@% IDATxُ]וÙ\YUdLjEInm+F$@$O~_txl$(DR*|V{ϸ@e5٦vq}ƍoo9MRv73 D՛oIuמyz㝋oO'Ӽ,VwwmnX\ʲ j%Y+4u}ww{[\\xm]`ƫHuJk`U43ñ$ϹQʟ5kz1`w߹x믽l֍Q`o_>3g\򲎣h?kڽ)-Fe$QGJ Dd "֫zt$*kEM#DXCv l{~)b)BV23 "" >`  d(iMxw?_\ZW2Y<㓢;k)jLΛ94T"bT(MUr+3!_w#"& &pi ~vБq!C+KDr`jE5Y@MS8 tDVK< >/ [ RHMtW.@, (msɬ+H2V9v!`$N fDF} qQL8q$PDD;@D`6^uU$T2GJG_RB/\JI0n4E,xSRRt,JӘ>P`]R $y v.kW9\{gBp"%@BJGQe R<瞹JHF D(E^8?}WWPR88NRj@`,|PHHL{(umۜNr"T"/K%4{DR@Iq8M=02GJGQ9 3 `:wܙف>$^zO@a_΃=ꏂ1Vˆy $gyk ᜣf;\aLU@k3;3K_t{_?bNt0;Gfgg]m+So?nGR3m:@$ieQ2@}&e_~koǕ+R򩲪"%Sb=>:\X]]}x</--f.nC+KQ# $0J@[|:yB"JڑcGD%U]*ғ;:~p8ŭ57FQܛQ~(jT_zg}͛e4nomn+936&uρYC!{}DB8MpX;rĝՏ[}+?~ݭvUk_uB!x2YX?ѧb| 0L0#37u(E&J*^J6@X?\COl^\Xw;OmÞ)>kPnzGRÇ;3yɫǏlo Xbzkuʓ++ `vнrh~ocgkwv0c}u烊Bؘ;8ËgduwYs#+)mmL:O85-&,`os?ï9wv{{s<>RJ""(jg{78888wtvov1,KQ o.MH%JHJ眎#"_WnɭQ1|`vowXZ;ٴq2>V&LQLO_:-8Ļy_t婫W=19w-G fB`ݾP$B*@@U] A'0{f@彃êtf?9mDvƵ{d09܁Ψv[[= o{e5\xpm%gdʘ"n۸uV+ŒNy{ʣyQĭ#I7HmM3\Ǻ*\~xgo:ћ1DuC:U_GC7WօVB`D9;8:ϧyయe1`SׯJǎt(kTii_޻~wMitـDN5;P^^MFyqh:98::" $(Sԭ}`po۬Yju9$J  NPP׾^yg7nLN&?lwEG+ '##o7M7WS'GSb|hǁA)e3ޝGU] 0 C(A+ٲ,bb N$wv_+5NWw_֍tBe<5M@ {o?)]v'qQz"&|4HƐT+_}t'2EɁ )BIa/KO]/XG)Yo_xwo^VWyzQt U;Q։N'-j{W.J/éj/.,[`eqGY(0 t$i4px`yy%Mu}l~.8gϟɫbt8/|s)88M$RJDcau\8:tfaqӗN.?۷N[o%#罐 Lc==`&vuŏR+ҝS`TUӬ>ޝ݋wa:g4NS -!0֢ےbjOW/_xB.|w*({&Fm|` Xqnn{F:ZS~X:[3+ F*˻"vgNi!ePG2(gVN_?__RD-^Zg(jLDJVi! ,JE{!0#Uu 3Ky x|4uNGRJm@SOç:y$NTlON uOά|G^UU>ZF)cj!&Ӊ*y"PJ@c)AR30sf=Gɥ,ͦImLEՔ!: xzJ͝rѝnUm۲N|VuQjRJ23 |R#29됁XDT(}D@@y:cB =J}ȔMmRF}MpToܾ+)Rp?37"3 K%tDVOTRB9HB8? Yb'R{S U`<+,,~hwf"!ToNU($K)bD<64UDGY#FȰgdJ "~'SF'Z#,OARD,Bg=إn!XiEq@(4&P`4RH9P>Eiєi+inw>=rkFQֽAOhc}#sQ'q W9c}N cm~=3ΗSIxRc (2xRQ<7;R ^+)Um!}ft*n !|rzR:/,8 CD)!;[["Nqs4AFc=oE`:e$)T QJRx)LDYTC]{ODNxk1z{{^fƙA9d86&Zk-'E:w‹Q~Zg1`.Ѿ5u 6VODR:.EJZYUkS(UUy88rb䣏9{XY[ke]9wQJn (CP$ibwD\j-~QvPT)@ .QGёcOBx@(/Q=ԇ{̠dt4_L3_W>ևO?Nӟ޼yʕg}w/_{擪 "}IENDB`/tfѭ8Lwb"qe܂dKu="workspacelayers4 .;]kI 忞@.;]kI 忞@"SubObject*Encapsulated objects" ǿ ֿ@` @*``a`ha4W}@O{4W}@O{$ Owner4Owner of the Encapsulator$(XFҦV(XFҦV"LE2Data$LE2 Data for node>g'JNjn*p"-1OSM n-1OSM n"LayoutLayout 럆L<_ї"3z*I24Nj3z*I24NjDSelectCPMesh T(`_@[B;Mm[B;MmD$ProtectCurveColor Tn_M,G M,G BLayersURLR*=B%>*=B%>D$DeselectOnLocking Tg_bh]Mvbh]MvDUseSmallAspect Td_dCJ^dCJ^D ConvertLineHair To_H_#FM$B#FM$BD QuickProcessing T(e_ dCJ^ 3z*I24Nj [B;Mm (XFҦV>g'JNjn*pFQDBh@q@B?bh]Mv M,G Lhttp://localhost:8080/web/layers.html#FM$B -1OSM n 럆L<_їN GFʠN=q,#1}}November 6, 2021Z`Ez]UOGFʠN=q,#J }}Select Control Point Mesh3z*I24NjZ`Ez]UOͽ>fdN*5Ւhq,#, }}3z*I24NjZ`Ez]UOGFʠN= q,#D }}Protect Curve Color[B;MmZ`Ez]UOͽ>fdN*5Ւh q,#, }}[B;MmZ`Ez]UOGFʠN=pq,#; }} Layers URLM,G Z`Ez]UO1釥GP>aq,#0 }}M,G Z`Ez]UOGFʠN= 0q,#L }}Deselect Items When Locking*=B%>Z`Ez]UOͽ>fdN*5Ւh 0q,#, }}*=B%>Z`Ez]UOGFʠN=0@q,#E }}Open in Small aspectbh]MvZ`Ez]UOͽ>fdN*5Ւh0@q,#, }}bh]MvZ`Ez]UOOˁCRih[q,#vpp"TahomaJ#ҙ"잩#nActivity.Run("%THIS_NAME%" + "/ReconnectObjectHiders")BReconnect All Object Hider NodesƄvR^I҂{iksGFʠN=@Pq,#T }}#Line Hair Profile to Circle ProfiledCJ^Z`Ez]UOͽ>fdN*5Ւh@Pq,#, }}dCJ^琱Z`Ez]UO AϠOsX`pq,#%}}Z`Ez]UOOˁCRih[q,#vpp"TahomaJ#ҙ"#|Activity.Run("%THIS_NAME%" + "/ReHideLightAndCameraORAPanel"):Re-Hide Camera and Light ORAƄvR^I҂{iksOˁCRih[q,#vpp"TahomaJ#ҙ"̢#<WindowsManager.CloseWindow("/Project/Windows Manager Space/LayersPanelFrame") WindowsManager.CloseWindow("/Project/Windows Manager Space/WebServerFrame") WindowsManager.Activate() WindowsManager.UpdateWindowsStructure() Activity.Run("Scripts/CustomCommands/wsLayersGroup4/loadIt");<Restart Web Server and LayersƄvR^I҂{iksGFʠN=P`q,#A }}Quick Processing#FM$BZ`Ez]UOͽ>fdN*5ՒhP`q,#, }}#FM$BZ`Ez]UO}}*=B%> l^#^#4m48@Jg'JNjn*pceZU@䑧rceZU@䑧r$_scriptData*Internal Script data[җJs@ %4W}@O{$(XFҦVLE2Data, 1#z@Hoz@Ho Control InTransitionInMT^RwL~YYTMT^RwL~YYTޢLE2Data$LE2 Data for node>g'JNjn*pLE2Data, 2J@#QLJ@#QLLE2Data$LE2 Data for node>g'JNjn*pLE2Data, 3-1OSM n# 2|=Bynj2AEHM'>g'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand*// Execute // Called to execute the command function Execute(params) { // TODO: put your action code here } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); var newcolor = eventData.newcolor; Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); var ProtectCurveColor = Node.Value(scene + "/workspacelayers4", "ProtectCurveColor"); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); mycolor = System.CreateDO('Common Data Package/Color Data'); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].color.red = newcolor[0]; LayersData[i].color.green = newcolor[1]; LayersData[i].color.blue = newcolor[2]; mycolor.SetRed8(newcolor[0]); mycolor.SetGreen8(newcolor[1]); mycolor.SetBlue8(newcolor[2]); var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) updatewirecolorrecursive(scene, LayersData[i].layer, ProtectCurveColor); break; } } } function updatewirecolorrecursive(thenode,layer, ProtectCurveColor) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isGroupRecursive(thenode) || CommonFS.isActor(thenode) ) if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { if(Node.ConExists(Node.Owner(thenode), "isaCurve") && ProtectCurveColor) return; if(Node.ConExists(thenode + "/Object Render Attributes","Edges Color")) //Node.Value(thenode + "/Object Render Attributes","Edges Color") = mycolor; util.SetNodeValueColorRGB8(thenode + "/Object Render Attributes","Edges Color", mycolor.GetRed8(), mycolor.GetGreen8(), mycolor.GetBlue8()); } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { updatewirecolorrecursive(childPath,layer, ProtectCurveColor); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language~൱D0#^c4W}@O{(XFҦV>g'JNjn*pnBC`@@P@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@HojJ)MR $JSON Function SetceZU@䑧r$4W}@O{$(XFҦV"-1OSM n"ceZU@䑧r[җJs@ ~NewFunctionSet// This is a jScript Function Set // Put usefull functions, constants, enumerators here and share them across your project // Use Node.AccessFnSet / Node.AccessNearFnSet to get access here from your script commands // Hint: do not use commands like System.ThisOwner, System.ThisName or Node.NearValue here, as they reffer to caller's command location /* json2.js 2014-02-04 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. See http://www.JSON.org/js.html This code should be minified before deployment. See http://javascript.crockford.com/jsmin.html USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO NOT CONTROL. This file creates a global JSON object containing two methods: stringify and parse. JSON.stringify(value, replacer, space) value any JavaScript value, usually an object or array. replacer an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings. space an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or '&nbsp;'), it contains the characters used to indent at each level. This method produces a JSON text from a JavaScript value. When an object value is found, if the object contains a toJSON method, its toJSON method will be called and the result will be stringified. A toJSON method does not serialize: it returns the value represented by the name/value pair that should be serialized, or undefined if nothing should be serialized. The toJSON method will be passed the key associated with the value, and this will be bound to the value For example, this would serialize Dates as ISO strings. Date.prototype.toJSON = function (key) { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; }; You can provide an optional replacer method. It will be passed the key and value of each member, with this bound to the containing object. The value that is returned from your method will be serialized. If your method returns undefined, then the member will be excluded from the serialization. If the replacer parameter is an array of strings, then it will be used to select the members to be serialized. It filters the results such that only members with keys listed in the replacer array are stringified. Values that do not have JSON representations, such as undefined or functions, will not be serialized. Such values in objects will be dropped; in arrays they will be replaced with null. You can use a replacer function to replace those with JSON values. JSON.stringify(undefined) returns undefined. The optional space parameter produces a stringification of the value that is filled with line breaks and indentation to make it easier to read. If the space parameter is a non-empty string, then that string will be used for indentation. If the space parameter is a number, then the indentation will be that many spaces. Example: text = JSON.stringify(['e', {pluribus: 'unum'}]); // text is '["e",{"pluribus":"unum"}]' text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' text = JSON.stringify([new Date()], function (key, value) { return this[key] instanceof Date ? 'Date(' + this[key] + ')' : value; }); // text is '["Date(---current time---)"]' JSON.parse(text, reviver) This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception. The optional reviver parameter is a function that can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then the structure is not modified. If it returns undefined then the member is deleted. Example: // Parse the text. Values that look like ISO date strings will // be converted to Date objects. myData = JSON.parse(text, function (key, value) { var a; if (typeof value === 'string') { a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); if (a) { return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6])); } } return value; }); myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { var d; if (typeof value === 'string' && value.slice(0, 5) === 'Date(' && value.slice(-1) === ')') { d = new Date(value.slice(5, -1)); if (d) { return d; } } return value; }); This is a reference implementation. You are free to copy, modify, or redistribute. */ /*jslint evil: true, regexp: true */ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ // Create a JSON object only if one does not already exist. We create the // methods in a closure to avoid creating global variables. if (typeof JSON !== 'object') { JSON = {}; } (function () { 'use strict'; function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function () { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function () { return this.valueOf(); }; } var cx, escapable, gap, indent, meta, rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { // Produce a string from holder[key]. var i, // The loop counter. k, // The member key. v, // The member value. length, mind = gap, partial, value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is 'object', we might be dealing with an object or an array or // null. case 'object': // Due to a specification blunder in ECMAScript, typeof null is 'object', // so watch out for that case. if (!value) { return 'null'; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === '[object Array]') { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }; JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ''; indent = ''; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === 'string') { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== 'function') { cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; JSON.parse = function (text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); }; } }()); NScript Object Package/jScript language(XFҦV>g'JNjn*pFBCX@>@?-1OSM n 럆L<_ї048@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ j NewCommand// Execute // Called to execute the command function Execute(params) { // TODO: put your action code here } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; var util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].name = eventData.newname; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) break; } } }NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnC B`@@P@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@HojJ)MR t(Common Function SetceZU@䑧r$4W}@O{$(XFҦV"-1OSM n"ceZU@䑧r[җJs@ KNewFunctionSetJ// This is a jScript Function Set // Put usefull functions, constants, enumerators here and share them across your project // Use Node.AccessFnSet / Node.AccessNearFnSet to get access here from your script commands // Hint: do not use commands like System.ThisOwner, System.ThisName or Node.NearValue here, as they reffer to caller's command location OrphanList = []; util = System.CreateDO("Clintons3D Package/Utility functions"); function ConvertSelectToLODMesh(Sel) { var nurbsNode = Sel; if(Node.ConExists(Sel, "Matrix")) nurbsNode = Node.Owner(Sel); if(Node.ConExists(nurbsNode, "isaCurve")) { return nurbsNode + "/LODMesh"; } if(Node.Exists(nurbsNode + "/CP to patch CP")) { return nurbsNode + "/LODMesh"; } return Sel; } function FindOrphanORA(curNode) { if(Node.ConExists(curNode, "RenderAttributes") && Node.ConExists(curNode, "OverlayStrength")) { if(Node.LinkedOutputNodeCount(curNode, "RenderAttributes") < 1) { OrphanList.push(curNode); } } var numChildren = Node.SubObjectCount(curNode); if(numChildren == 0) return; for(var i=0;i<numChildren;i++) { var child = curNode + "/" + Node.SubObject(curNode, i); FindOrphanORA(child); } } function isActor(thenode) { var numchildren = Node.SubObjectCount(thenode); for (var i = 0; i < numchildren; i++) { var childnode = thenode + "/" + Node.SubObject(thenode, i); if (Node.ConExists(childnode, "Skeleton") && thenode != Space.CurrentScene()) { return true; } } return false; } function groupHasNURBS(curNode) { var numChildren = Node.SubObjectCount(curNode); if(numChildren == 0) return false; for(var i=0;i<numChildren;i++) { var child = curNode + "/" + Node.SubObject(curNode, i); if(IsNURBS(child)) return true; if(groupHasNURBS(child)) return true; } return false; } function isGroup(thenode) { if(Node.IsRenderable(thenode)) return false; if(isActor(thenode)) return false; var numchildren = Node.SubObjectCount(thenode); for (var i = 0; i < numchildren; i++) { var childnode = thenode + "/" + Node.SubObject(thenode, i); if (Node.IsRenderable(childnode)) { return true; } } return false; } function isGroupRecursive(thenode) { if(isGroup(thenode)) return true; var numChildren = Node.SubObjectCount(thenode); if(numChildren == 0) return false; for(var i=0;i<numChildren;i++) { var child = thenode + "/" + Node.SubObject(thenode, i); if(isGroupRecursive(child)) return true; } return false; } function IsNURBS(curNode) { var nurbsNode = curNode; if(Node.ConExists(curNode, "Matrix")) nurbsNode = Node.Owner(curNode); if(Node.ConExists(nurbsNode, "isaCurve")) { return true; } if(Node.Exists(nurbsNode + "/CP to patch CP")) { return true; } return false } function GetNURBSNode(currentNode) { var nodeOwner = Node.Owner(currentNode); //child of nurbs selected if(Node.ConExists(nodeOwner, "isaCurve")) return nodeOwner; if(Node.Exists(nodeOwner + "/CP to patch CP")) return nodeOwner; //nurbs direct selected if(Node.ConExists(currentNode, "isaCurve")) return currentNode; if(Node.Exists(currentNode + "/CP to patch CP")) return currentNode; } function HasNURBSChild(thenode) { var numchildren = Node.SubObjectCount(thenode); for(var i=0;i<numchildren;i++) { var childnode = thenode + "/" + Node.SubObject(thenode, i); if(IsNURBS(childnode)) { return true; } } return false; } function HasNURBSChildRecursive(thenode) { if(HasNURBSChild(thenode)) return true; var numChildren = Node.SubObjectCount(thenode); if(numChildren == 0) return false; for(var i=0;i<numChildren;i++) { var child = thenode + "/" + Node.SubObject(thenode, i); if(HasNURBSChildRecursive(child)) return true; } return false; } function LockIt(thenode) { //check for existence of locking code if(!Node.Exists("/Scripts/CustomCommands/unSelectable")) return; if(IsNURBS(thenode)) thenode = GetNURBSNode(thenode); if(!Node.Exists(thenode + "/selectionLocking")) //Node.Copy("/Scripts/CustomCommands/unSelectable/selectionLocking", thenode); util.Copy("/Scripts/CustomCommands/unSelectable/selectionLocking", thenode) if(!Node.Value(thenode + "/selectionLocking","UnSelectable")) //Node.Value(thenode + "/selectionLocking","UnSelectable") = true; util.SetNodeValueInt(thenode + "/selectionLocking","UnSelectable", true) } function UnLockIt(thenode) { //check for existence of locking code if(!Node.Exists("/Scripts/CustomCommands/unSelectable")) return; if(IsNURBS(thenode)) thenode = GetNURBSNode(thenode); if(Node.ConExists(thenode,"UnSelectable")) { //old style locking connector exported //Node.Value(thenode,"UnSelectable") = false;// left in place for history - just in case //Node.ConRemove(thenode,"UnSelectable"); //Node.Delete(thenode + "/selectionLocking"); util.ConRemove(thenode,"UnSelectable") util.Delete(thenode + "/selectionLocking") } else { //new syle locking node exported if(Node.Exists(thenode + "/selectionLocking")) { //Node.Value(thenode + "/selectionLocking", "UnSelectable") = false; //Node.Delete(thenode + "/selectionLocking"); util.Delete(thenode + "/selectionLocking") } } } function HideNode(Sel) { //CameraOrLight = false; ORA_was_created = false; OrphanList = []; if(isGroup(Sel) && !Node.ConExists(Sel, "WldMatrix") && !Node.Exists(Sel + "/Object Render Attributes")) { DoHiding(Sel, true); return; } if(isGroup(Sel) && groupHasNURBS(Sel)) { DoHiding(Sel, true); return; } DoHiding(Sel, false); if(ORA_was_created) { if(OrphanList.length != 0) { while(node = OrphanList.pop()) { //Node.Delete(node); util.Delete(node) } } } } function DoHiding(Sel, nurbsOr2DGroup) { if(nurbsOr2DGroup) { var childCount = Node.SubObjectCount(Sel); if(childCount == 0) return; for(var i=0; i<childCount;i++) { var child = Sel + "/" + Node.SubObject(Sel, i); if(isGroup(child) && !Node.ConExists(child, "WldMatrix")) { DoHiding(child, true); continue; } if(!Node.ConExists(child, "WldMatrix") || Node.SubObjectCount(child) < 2) continue; if(isGroup(child) && groupHasNURBS(child)) { DoHiding(child, true); continue; } DoHiding(child, false); } return; } if(Node.Exists(Sel + "/Object hider") && (Node.IsCamera(Sel) || Node.IsLight(Sel)) ) { //Node.Disconnect(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible"); util.Disconnect(Sel + "/Object hider", "Invisible", Sel + "/Object Render Attributes", "Invisible") } if(!IsNURBS(Sel)) { D3DView.ShowRenderAttribsForObject('', Sel); ORA_was_created = true; FindOrphanORA(Sel); } if(IsNURBS(Sel)) { Sel = ConvertSelectToLODMesh(Sel); } if(Node.Exists(Sel + "/Object Render Attributes")) { //Node.Value(Sel + "/Object Render Attributes", "Invisible") = -1; util.SetNodeValueInt(Sel + "/Object Render Attributes", "Invisible", -1); RsStackView.SetPanelExportInfo(Sel + '/Object Render Attributes','Default',1,1); } if(!Node.Exists(Sel + "/Object Render Attributes")) { D3DView.ShowRenderAttribsForObject('', Sel); if(Node.Exists(Sel + "/Object Render Attributes")) { //Node.Value(Sel + "/Object Render Attributes", "Invisible") = -1; util.SetNodeValueInt(Sel + "/Object Render Attributes", "Invisible", -1); } RsStackView.SetPanelExportInfo(Sel + '/Object Render Attributes','Default',1,1); } } function ShowNode(Sel) { ORA_was_created = false; OrphanList = []; if(isGroup(Sel) && !Node.ConExists(Sel, "WldMatrix") && !Node.Exists(Sel + "/Object Render Attributes")) { DoShowing(Sel, true); return; } if(isGroup(Sel) && groupHasNURBS(Sel)) { DoShowing(Sel, true); return; } DoShowing(Sel, false); if(ORA_was_created) { if(OrphanList.length != 0) { while(node = OrphanList.pop()) { //Node.Delete(node); util.Delete(node) } } } } function DoShowing(Sel, nurbsOr2DGroup) { if(nurbsOr2DGroup) { var childCount = Node.SubObjectCount(Sel); if(childCount == 0) return; for(var i=0; i<childCount;i++) { var child = Sel + "/" + Node.SubObject(Sel, i); if(isGroup(child) && !Node.ConExists(child, "WldMatrix")) { DoShowing(child, true); continue; } if(!Node.ConExists(child, "WldMatrix") || Node.SubObjectCount(child) < 2) continue; if(isGroup(child) && groupHasNURBS(child)) { DoShowing(child, true); continue; } DoShowing(child, false); } return; } // need to run ever time for case of only child is hidden - if ORA already exists it will not be changed if(!IsNURBS(Sel)) { D3DView.ShowRenderAttribsForObject('', Sel); ORA_was_created = true; FindOrphanORA(Sel); } if(IsNURBS(Sel)) { Sel = ConvertSelectToLODMesh(Sel); } if(Node.Exists(Sel + "/Object Render Attributes")) { //Node.Value(Sel + "/Object Render Attributes", "Invisible") = 0; util.SetNodeValueInt(Sel + "/Object Render Attributes", "Invisible", 0) RsStackView.SetPanelExportInfo(Sel + '/Object Render Attributes','Default',1,1); } } NScript Object Package/jScript language^(XFҦV>g'JNjn*pFCCX@>@?-1OSM n 럆L<_ї048@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand // Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; RsStackView = eventData.RsStackView; RsTool = eventData.RsTool; var scene = Space.CurrentScene(); var DeselectOnLocking = Node.Value(scene + "/workspacelayers4", "DeselectOnLocking"); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; var util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].locked = true; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) LockLayerItems(scene, eventData.layer); //RsTool.Arrow();var PVT_LOCKED = 2;RsStackView.RemovePanelsFromCurrSelection(PVT_LOCKED, 0); var PVT_LOCKED = 2;RsStackView.RemovePanelsFromCurrSelection(PVT_LOCKED, 0); break; } } if(DeselectOnLocking) RemoveLockedItemsFromSelection(eventData.layer); } function RemoveLockedItemsFromSelection(layerID) { var reWhiteSpace = /^\s/; // whitespace in first character position for cleaning selection text var reColonSpace = /;\s/g; // clean whitespaces that follow a semicolon var selection = Node.Selection(); var selectionClean = selection.replace(reWhiteSpace, ""); selectionClean = selectionClean.replace(reColonSpace, ";"); var selectionArray = selectionClean.split(";"); var sel = ""; for(var i = 0; i < selectionArray.length; i++) { var cursel = selectionArray[i]; if(Node.Exists(cursel + "/Object Render Attributes") && Node.ConExists(cursel + "/Object Render Attributes", "Layer index")) { if(Node.Value(cursel + "/Object Render Attributes", "Layer index") == layerID) { continue; } } sel = sel + cursel + ";"; } if(sel == "") { Space.Unselect(); return; } //remove training semicolon sel = sel.substr(0, sel.length-1); Space.Select(sel); } function LockLayerItems(thenode, layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { CommonFS.LockIt(thenode ); } } if(CommonFS.isActor(thenode)) return; if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { LockLayerItems(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language <4W}@O{(XFҦV>g'JNjn*pnCCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand*// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); //System.Trace("unlock layer event") Node = eventData.Node; Space = eventData.Space; RsStackView = eventData.RsStackView; RsTool = eventData.RsTool; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; var util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].locked = false; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) UnLockLayerItems(scene, eventData.layer); break; } } } function UnLockLayerItems(thenode, layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { CommonFS.UnLockIt(thenode); } } if(CommonFS.isActor(thenode)) return; if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { UnLockLayerItems(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language=4W}@O{(XFҦV>g'JNjn*pnC Bb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var util = System.CreateDO("Clintons3D Package/Utility functions"); var openID = GetOpenID(LayersData); var layerred = Math.floor(Math.random() * 255); var layergreen = Math.floor(Math.random() * 255); var layerblue = Math.floor(Math.random() * 255); var color = {red: layerred, green: layergreen, blue: layerblue}; var layersobj = {layer:openID, name: "layer" + openID, count:0, color: color, groupcount: 0, groupitemcount: 0}; layersobj.invisible = false; layersobj.locked = false; LayersData.push(layersobj); var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS); } function GetOpenID(LayersData) { var numArr = []; for(var i=0; i<LayersData.length; i++) { numArr[LayersData[i].layer] = LayersData[i].layer; } for( i=0;i<numArr.length;i++) { // find lack of index in the array object if(!numArr.hasOwnProperty(i)) return i; } return numArr.length; } NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnCCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?$1&KߊPV-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ R1NewCommand0// Execute // Called to execute the command function Execute(params) { // TODO: put your action code here } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); mode = eventData.mode; Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); mycolor = System.CreateDO('Common Data Package/Color Data'); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].dispmode = mode; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS); setlayerdisplaymoderecursive(scene, eventData.layer); break; } } } function setlayerdisplaymoderecursive(thenode,layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { var nurbs = CommonFS.GetNURBSNode(thenode); if(Node.ConExists(nurbs, "isaCurve")) return; thenode = nurbs + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { //hair render attribute has different conn name var EnableObjectModeConn = "Ignore layer attributes"; if(Node.ConExists(thenode + "/Object Render Attributes", "Enable object mode")) EnableObjectModeConn = "Enable object mode"; if(mode=="Global") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = false; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, false); } if(mode=="Solid") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//solid //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 0; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 1; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, true);//solid util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity", 0); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity", 1); } if(mode=="Solid Wire") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//solid wire //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 1; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 1; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, true);//solid wire util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity", 1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity", 1); } if(mode=="Transp") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//trans //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 0; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 0.3; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity", 0); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity", 0.3); } if(mode=="Transp Wire") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//trans wire //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 1; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 0.3; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity", 1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity", 0.3); } if(mode=="Wireframe") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//wire //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 1; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 0; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity", 1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity", 0); } if(CommonFS.isActor(thenode)) return; } } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { setlayerdisplaymoderecursive(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language;4W}@O{(XFҦV>g'JNjn*pn'D B`@@P@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand,// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].backfaces = true; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) setbackfacesrecursive(scene, eventData.layer); break; } } } function setbackfacesrecursive(thenode,layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { var nurbs = CommonFS.GetNURBSNode(thenode); if(Node.ConExists(nurbs, "isaCurve")) return; thenode = nurbs + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { //Node.Value(thenode + "/Object Render Attributes","Show backfaces") = -1;//show util.SetNodeValueInt(thenode + "/Object Render Attributes","Show backfaces", -1);//show if(CommonFS.isActor(thenode)) return; } } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { setbackfacesrecursive(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript languageN4W}@O{(XFҦV>g'JNjn*pn'DCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand*// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].backfaces = false; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) setbackfacesrecursive(scene, eventData.layer); break; } } } function setbackfacesrecursive(thenode,layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { var nurbs = CommonFS.GetNURBSNode(thenode); if(Node.ConExists(nurbs, "isaCurve")) return; thenode = nurbs + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { //Node.Value(thenode + "/Object Render Attributes","Show backfaces") = 0;//hide util.SetNodeValueInt(thenode + "/Object Render Attributes","Show backfaces", 0);//hide if(CommonFS.isActor(thenode)) return; } } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { setbackfacesrecursive(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript languageuF4W}@O{(XFҦV>g'JNjn*pn'DjCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommandD// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].hiddenlines = true; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) sethiddenlinesrecursive(scene, eventData.layer); break; } } } function sethiddenlinesrecursive(thenode,layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { var nurbs = CommonFS.GetNURBSNode(thenode); if(Node.ConExists(nurbs, "isaCurve")) return; thenode = nurbs + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { //Node.Value(thenode + "/Object Render Attributes","Show hidden lines") = -1;//show util.SetNodeValueInt(thenode + "/Object Render Attributes","Show hidden lines", -1);//show if(CommonFS.isActor(thenode)) return; } } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { sethiddenlinesrecursive(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript languageҒ4W}@O{(XFҦV>g'JNjn*pn'DCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommandD// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].hiddenlines = false; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS); sethiddenlinesrecursive(scene, eventData.layer); break; } } } function sethiddenlinesrecursive(thenode,layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { var nurbs = CommonFS.GetNURBSNode(thenode); if(Node.ConExists(nurbs, "isaCurve")) return; thenode = nurbs + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { //Node.Value(thenode + "/Object Render Attributes","Show hidden lines") = 0;//hide util.SetNodeValueInt(thenode + "/Object Render Attributes","Show hidden lines", 0);//hide if(CommonFS.isActor(thenode)) return; } } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { sethiddenlinesrecursive(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language d4W}@O{(XFҦV>g'JNjn*pn'DCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ ANewCommand(A// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var util = System.CreateDO("Clintons3D Package/Utility functions"); wsl4 = scene + "/workspacelayers4"; var layersobj = {}; var thelayers = []; thelayers.push({layer:-1,count:0,sort:'number'}); readscenelayersrecursive(scene, thelayers, -1); //always have layer 0 and 1 var layer0Found = false; var layer1Found = false; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == 0) { layer0Found = true; } if(thelayers[i].layer == 1) { layer1Found = true; } } var layerred = Math.floor(Math.random() * 255); var layergreen = Math.floor(Math.random() * 255); var layerblue = Math.floor(Math.random() * 255); var color = {red: layerred, green: layergreen, blue: layerblue}; if(!layer0Found) { thelayers.push({layer:0, name: "layer0", count:0, color: color, groupcount: 0, groupitemcount: 0, backfaces: false, hiddenlines: false, dispmode: "Global", invisible:false, locked: false}); } layerred = Math.floor(Math.random() * 255); layergreen = Math.floor(Math.random() * 255); layerblue = Math.floor(Math.random() * 255); color = {red: layerred, green: layergreen, blue: layerblue}; if(!layer1Found) { thelayers.push({layer:1, name: "layer1", count:0, color: color, groupcount: 0, groupitemcount: 0, backfaces: false, hiddenlines: false, dispmode: "Global", invisible:false, locked: false}); } layersobj.data = thelayers; var jsonstring = JSON.stringify(layersobj); //Node.Value(wsl4 + "/Data", "LayersData") = jsonstring; util.SetNodeValueString(wsl4 + "/Data", "LayersData", jsonstring) } function readscenelayersrecursive(thenode, thelayers, parentLayer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; // character Skinning node reads as a renderable node - tS bug if(Node.SubObjectCount(thenode) == 0) return; var layerindex = parentLayer; var isGroupNode = CommonFS.isGroupRecursive(thenode); var isActorNode = CommonFS.isActor(thenode); var isNURBSNode = CommonFS.IsNURBS(thenode); var foundLayer, visible, locked; if(isNURBSNode) { thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; isGroupNode = false; } if(Node.IsRenderable(thenode) || isActorNode || isGroupNode || isNURBSNode) { if(!Node.Exists(thenode + "/Object Render Attributes") && thenode != scene && !Node.ConExists(thenode, "Input Attributes") && !isGroupNode && !isNURBSNode) { thelayers[0].count++; } else { if(Node.ConExists(thenode, "Input Attributes") && isGroupNode) { for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == parentLayer) { thelayers[i].groupcount++; break; } } } if(Node.ConExists(thenode, "Input Attributes") && Node.IsRenderable(thenode)) { foundLayer = false; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == parentLayer) { thelayers[i].count++; thelayers[i].groupitemcount++; foundLayer = true; break; } } if(!foundLayer) { thelayers.push({layer:parentLayer, count:1, groupcount: 0, groupitemcount: 1}); } } else if(Node.Exists(thenode + "/Object Render Attributes")) { if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) { layerindex = Node.Value(thenode + "/Object Render Attributes","Layer index"); } else { layerindex = -1; } if(Node.ConExists(thenode + "/Object Render Attributes","Edges Color")) { mycolor = System.CreateDO('Common Data Package/Color Data'); mycolor = Node.Value(thenode + "/Object Render Attributes","Edges Color"); foundLayer = false; var color = {red: mycolor.GetRed8, green: mycolor.GetGreen8(), blue: mycolor.GetBlue8()}; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == layerindex) { thelayers[i].color = color; if(!(isGroupNode || isActorNode) || isNURBSNode) { thelayers[i].count++; } if(isGroupNode || isActorNode) { thelayers[i].groupcount++; } foundLayer = true; break; } } if(!foundLayer) { if(isGroupNode || isActorNode) { thelayers.push({layer:layerindex, name: "layer" + layerindex, count:0, color: color, groupcount: 1, groupitemcount: 0}); } else thelayers.push({layer:layerindex, name: "layer" + layerindex, count:1, color: color, groupcount: 0, groupitemcount: 0}); } } //visible, locked if(Node.ConExists(thenode + "/Object Render Attributes","Invisible")) { thelayers[i].invisible = ensurebool(thenode + "/Object Render Attributes","Invisible"); } if(Node.Exists(thenode + "/selectionLocking")) { thelayers[i].locked = ensurebool(thenode + "/selectionLocking", "UnSelectable"); } else { thelayers[i].locked = false; } if(isNURBSNode) { var nurbsnode = Node.Owner(thenode); if(Node.Exists(nurbsnode + "/selectionLocking")) { thelayers[i].locked = ensurebool(nurbsnode + "/selectionLocking", "UnSelectable"); } } // hair return if(!Node.ConExists(thenode + "/Object Render Attributes","Ignore layer attributes")) return; //display mode if(isNURBSNode) return; thelayers[i].dispmode = "Global"; if(isNURBSNode || !ensurebool(thenode + "/Object Render Attributes","Ignore layer attributes")) { thelayers[i].dispmode = "Global"; } else { if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==0 && (Node.Value(thenode + "/Object Render Attributes","Surface Opacity")==1)) thelayers[i].dispmode = "Solid"; if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==1 && (Node.Value(thenode + "/Object Render Attributes","Surface Opacity")==1)) thelayers[i].dispmode = "Solid Wire"; if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==0) { delta = Math.abs(Node.Value(thenode + "/Object Render Attributes","Surface Opacity") - 0.3); if(delta<0.001) thelayers[i].dispmode = "Transp"; } if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==1) { delta = Math.abs(Node.Value(thenode + "/Object Render Attributes","Surface Opacity") - 0.3); if(delta<0.001) thelayers[i].dispmode = "Transp Wire"; } if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==1 && (Node.Value(thenode + "/Object Render Attributes","Surface Opacity")==0)) thelayers[i].dispmode = "Wireframe"; } if(isNURBSNode) return; thelayers[i].backfaces = ensurebool(thenode + "/Object Render Attributes","Show backfaces"); thelayers[i].hiddenlines = ensurebool(thenode + "/Object Render Attributes","Show hidden lines"); } } //if(isActorNode) { // thelayers[i].groupitemcount++; // thelayers[i].count++; // return; //} } //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { readscenelayersrecursive(childPath, thelayers, layerindex); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } //checkboxes can be in undefined states function ensurebool(boolnode,conn) { try { var inv = Node.Value(boolnode,conn); return inv; } catch(err) { return false; } } NScript Object Package/jScript languageڒ4W}@O{(XFҦV>g'JNjn*pnWD Bb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ ,@NewCommand?// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); //System.Trace("refresh layers event"); Node = eventData.Node; Space = eventData.Space; scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var util = System.CreateDO("Clintons3D Package/Utility functions"); var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var thelayers = []; LayersData[0].count = 0; thelayers.push(LayersData[0]); readscenelayersrecursive(scene, thelayers, -1); for(var i=0;i<thelayers.length;i++) { var matchFound = false; for(var j=0;j<LayersData.length;j++) { if(thelayers[i].layer == LayersData[j].layer) { thelayers[i].name = LayersData[j].name; LayersData.splice(j,1,thelayers[i]); matchFound = true; break; } } //no match so add new if(!matchFound) LayersData.push(thelayers[i]); } //zero out old layers if nothing found for(j=0;j<LayersData.length;j++) { matchFound = false; for(var i=0;i<thelayers.length;i++) { if(thelayers[i].layer == LayersData[j].layer) { matchFound = true; break; } } //no match so zero count if(!matchFound) { LayersData[j].count=0; LayersData[j].groupitemcount=0; LayersData[j].groupcount=0; } } var layersobj = {}; layersobj.data = LayersData; var jsonstring = JSON.stringify(layersobj); //Node.Value(dataNode, "LayersData") = jsonstring; util.SetNodeValueString(dataNode, "LayersData", jsonstring) } function readscenelayersrecursive(thenode, thelayers, parentLayer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; // character Skinning node reads as a renderable node - tS bug if(Node.SubObjectCount(thenode) == 0) return; var layerindex = parentLayer; var isGroupNode = CommonFS.isGroupRecursive(thenode); var isActorNode = CommonFS.isActor(thenode); var isNURBSNode = CommonFS.IsNURBS(thenode); var foundLayer, visible, locked; if(isNURBSNode) { thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; isGroupNode = false; } if(Node.IsRenderable(thenode) || isActorNode || isGroupNode || isNURBSNode) { if(!Node.Exists(thenode + "/Object Render Attributes") && thenode != scene && !Node.ConExists(thenode, "Input Attributes") && !isGroupNode && !isNURBSNode) { thelayers[0].count++; } else { if(Node.ConExists(thenode, "Input Attributes") && isGroupNode) { for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == parentLayer) { thelayers[i].groupcount++; break; } } } if(Node.ConExists(thenode, "Input Attributes") && Node.IsRenderable(thenode)) { foundLayer = false; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == parentLayer) { thelayers[i].count++; thelayers[i].groupitemcount++; foundLayer = true; break; } } if(!foundLayer) { thelayers.push({layer:parentLayer, count:1, groupcount: 0, groupitemcount: 1}); } } else if(Node.Exists(thenode + "/Object Render Attributes")) { if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) { layerindex = Node.Value(thenode + "/Object Render Attributes","Layer index"); } else { layerindex = -1; } if(Node.ConExists(thenode + "/Object Render Attributes","Edges Color")) { mycolor = System.CreateDO('Common Data Package/Color Data'); mycolor = Node.Value(thenode + "/Object Render Attributes","Edges Color"); foundLayer = false; var color = {red: mycolor.GetRed8, green: mycolor.GetGreen8(), blue: mycolor.GetBlue8()}; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == layerindex) { thelayers[i].color = color; if(!(isGroupNode || isActorNode) || isNURBSNode) { thelayers[i].count++; } if(isGroupNode || isActorNode) { thelayers[i].groupcount++; } foundLayer = true; break; } } if(!foundLayer) { if(isGroupNode || isActorNode) { thelayers.push({layer:layerindex, name: "layer" + layerindex, count:0, color: color, groupcount: 1, groupitemcount: 0}); } else thelayers.push({layer:layerindex, name: "layer" + layerindex, count:1, color: color, groupcount: 0, groupitemcount: 0}); } } //visible, locked if(Node.ConExists(thenode + "/Object Render Attributes","Invisible")) { thelayers[i].invisible = ensurebool(thenode + "/Object Render Attributes","Invisible"); } if(Node.Exists(thenode + "/selectionLocking")) { thelayers[i].locked = ensurebool(thenode + "/selectionLocking", "UnSelectable"); } else { thelayers[i].locked = false; } if(isNURBSNode) { var nurbsnode = Node.Owner(thenode); if(Node.Exists(nurbsnode + "/selectionLocking")) { thelayers[i].locked = ensurebool(nurbsnode + "/selectionLocking", "UnSelectable"); } } // hair return if(!Node.ConExists(thenode + "/Object Render Attributes","Ignore layer attributes")) return; //display mode if(isNURBSNode) return; thelayers[i].dispmode = "Global"; if(isNURBSNode || !ensurebool(thenode + "/Object Render Attributes","Ignore layer attributes")) thelayers[i].dispmode = "Global"; else { if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==0 && (Node.Value(thenode + "/Object Render Attributes","Surface Opacity")==1)) thelayers[i].dispmode = "Solid"; if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==1 && (Node.Value(thenode + "/Object Render Attributes","Surface Opacity")==1)) thelayers[i].dispmode = "Solid Wire"; if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==0) { delta = Math.abs(Node.Value(thenode + "/Object Render Attributes","Surface Opacity") - 0.3); if(delta<0.001) thelayers[i].dispmode = "Transp"; } if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==1) { delta = Math.abs(Node.Value(thenode + "/Object Render Attributes","Surface Opacity") - 0.3); if(delta<0.001) thelayers[i].dispmode = "Transp Wire"; } if(Node.Value(thenode + "/Object Render Attributes","Edges opacity")==1 && (Node.Value(thenode + "/Object Render Attributes","Surface Opacity")==0)) thelayers[i].dispmode = "Wireframe"; } if(isNURBSNode) return; thelayers[i].backfaces = ensurebool(thenode + "/Object Render Attributes","Show backfaces"); thelayers[i].hiddenlines = ensurebool(thenode + "/Object Render Attributes","Show hidden lines"); } } //if(isActorNode) { // thelayers[i].count++; // thelayers[i].groupitemcount++; // return; //} } //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { readscenelayersrecursive(childPath, thelayers, layerindex); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } //checkboxes can be in undefined states function ensurebool(boolnode,conn) { try { var inv = Node.Value(boolnode,conn); return inv; } catch(err) { return false; } } NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnWDCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ xNewCommand// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); var SelectCPMesh = Node.Value(scene + "/workspacelayers4", "SelectCPMesh"); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); sel = ""; buildselectionlistrecursive(scene, eventData.layer, SelectCPMesh); Space.Select(sel); } function buildselectionlistrecursive(thenode, layer, SelectCPMesh) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var check1downer = Node.Owner(thenode); if(CommonFS.IsNURBS(check1downer)) check1downer = Node.Owner(check1downer); var threeD1member = Node.ConExists( check1downer, "WldMatrix") && Node.SubObjectCount(check1downer) == 2; if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) || CommonFS.IsNURBS(thenode)) { var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; } if(Node.Exists(thenode + "/Object Render Attributes")) { if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) { if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { if(isaNURBS) { thenode = CommonFS.GetNURBSNode(thenode); if(SelectCPMesh) thenode = thenode + "/controlPointMesh"; } //3d group 1 member var thenodeBackup = thenode; if(threeD1member) { thenode = check1downer; } else if(CommonFS.IsNURBS(thenode) && Node.ConExists( check1downer, "WldMatrix")) { //3d group nurbs child thenode = check1downer; } if(sel == "") sel = thenode; else sel = sel + ";" + thenode; if(threeD1member) { thenode = thenodeBackup;; } if(CommonFS.isActor(thenode)) return; if(isaNURBS) return; } } } } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { buildselectionlistrecursive(childPath, layer, SelectCPMesh); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript languageo4W}@O{(XFҦV>g'JNjn*pnCCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ $NewCommand// Execute // Called to execute the command function Execute(params) { // TODO: put your action code here } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; var scene = Space.CurrentScene(); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var util = System.CreateDO("Clintons3D Package/Utility functions"); var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; LayersData[0].sort = eventData.mode; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); //Node.Value(dataNode, "LayersData") = LayersDataS; util.SetNodeValueString(dataNode, "LayersData", LayersDataS) }NScript Object Package/jScript language24W}@O{(XFҦV>g'JNjn*pnWDZC`@@P@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ 0 NewCommand// Execute // Called to execute the command function Execute(params) { cmd = '' cmd += 'var ReconnectHiders = function(currentNode) {' cmd += 'if (Node.Exists(currentNode + "/Object hider") && Node.Exists(currentNode + "/Object Render Attributes")) {' cmd += 'Node.DisconnectAllInputs(currentNode + "/Object Render Attributes", "Invisible");' cmd += 'Node.ConnectTo(currentNode + "/Object hider", "Invisible", currentNode + "/Object Render Attributes", "Invisible");' cmd += 'return;' cmd += '}' cmd += 'var numChildren = Node.SubObjectCount(currentNode);' cmd += 'if (numChildren == 0) return;' cmd += 'for (var i = 0; i < numChildren; i++) {' cmd += 'var childNode = currentNode + "/" + Node.SubObject(currentNode, i);' cmd += 'ReconnectHiders(childNode)' cmd += '}' cmd += '};' cmd += 'var scene = Space.CurrentScene();' cmd += 'for (var i = 0; i < Node.SubObjectCount(scene); i++) {' cmd += 'var currentNode = scene + "/" + Node.SubObject(scene, i);' cmd += 'ReconnectHiders(currentNode);' cmd += '}' RsApp.RunScriptBuffer(cmd); } NScript Object Package/jScript languageT8e4W}@O{(XFҦV>g'JNjn*pnWDC`@@P@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ N NewCommand// Execute // Called to execute the command function Execute(params) { var scene = Space.CurrentScene(); for( var i=0;i<Node.SubObjectCount(scene);i++) { var currentNode = scene + "/" + Node.SubObject(scene, i); ReHideORAPanel(currentNode); } } function ReHideORAPanel(currentNode) { //if(Node.Exists(currentNode + "/Object hider") && Node.Exists(currentNode + "/Object Render Attributes")) { // Node.DisconnectAllInputs(currentNode + "/Object Render Attributes", "Invisible"); // Node.ConnectTo(currentNode + "/Object hider", "Invisible", currentNode + "/Object Render Attributes", "Invisible"); // return; //} if((Node.IsLight(currentNode) || Node.IsCamera(currentNode)) && Node.Exists(currentNode + "/Object Render Attributes")) { RsStackView.SetPanelExportInfo(currentNode + '/Object Render Attributes','Default',0,1); return; } var numChildren = Node.SubObjectCount(currentNode); if(numChildren == 0) return; for(var i=0;i<numChildren;i++) { var childNode = currentNode + "/" + Node.SubObject(currentNode, i); ReHideORAPanel(childNode) } } NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnDC`@@P@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Hoͤ*EgbĬ( Data2AEHM'ceZU@䑧r%4W}@O{$(XFҦV#.;]kI 忞@"-1OSM n#hp_9ԈVOatYt9ԈVOatYBLayersDataB(`_3z*I24NjpDhp_`_n_[B;MmpDhp_`_`_M,G PBg_*=B%>pDhp_`_d_bh]MvpDhp_`_o_dCJ^pDhp_`_(e_#FM$BpDhp_`_dCJ^ 2AEHM'>g'JNjn*pFBC`@0@?[B;Mm 3z*I24Nj ceZU@䑧r[җJs@ NewObject// OnComputeOutputs // Called to compute values of all output connectors function OnComputeOutputs(params) { var DeselectOnLocking = params.ConValue('DeselectOnLocking'); var ConvertLineHair = params.ConValue('ConvertLineHair'); var SelectCPMesh = params.ConValue('SelectCPMesh'); var ProtectCurveColor = params.ConValue('ProtectCurveColor'); var UseSmallAspect = params.ConValue('UseSmallAspect'); var QuickProcessing = params.ConValue('QuickProcessing'); // params.ConValue('LayersData') = ... } // --------------------------------- // Advanced handlers // --------------------------------- // OnDefaultValue // Called to set default value for specific connector function OnDefaultValue(params) { var conName = params.Param('conName'); switch (conName) { // set default value for particular connectors like this, if desired : case 'DeselectOnLocking': params.Param('vtData') = true; params.Param('bHandled') = true; break; case 'SelectCPMesh': params.Param('vtData') = true; params.Param('bHandled') = true; break; case 'ProtectCurveColor': params.Param('vtData') = false; params.Param('bHandled') = true; break; case 'UseSmallAspect': params.Param('vtData') = false; params.Param('bHandled') = true; break; case 'QuickProcessing': params.Param('vtData') = false; params.Param('bHandled') = true; break; case 'ConvertLineHair': params.Param('vtData') = true; params.Param('bHandled') = true; break; case 'LayersData': params.Param('vtData') = ""; params.Param('bHandled') = true; break; case 'LayersURL': params.Param('vtData') = "http://localhost:8080/web/layers.html"; params.Param('bHandled') = true; break; } } NScript Object Package/jScript languagestringLayersData9ԈVOatYbooleanSelectCPMesh 3z*I24Njboolean$ProtectCurveColor [B;MmstringLayersURLM,G boolean$DeselectOnLocking *=B%>booleanUseSmallAspect bh]Mvboolean ConvertLineHair dCJ^boolean QuickProcessing #FM$B4W}@O{(XFҦV>g'JNjn*pFB Bb@ b@?bh]Mv M,G Lhttp://localhost:8080/web/layers.html9ԈVOatY#FM$B -1OSM n 럆L<_ї0.;]kI 忞@*=B%> 48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand*// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; Activity = eventData.Activity; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var QuickProcessing = Node.Value(scene + "/workspacelayers4", "QuickProcessing"); var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].invisible = true; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); util.SetNodeValueString(dataNode, "LayersData", LayersDataS); HideLayerItems(scene, eventData.layer, QuickProcessing); //clean object render attributes from the stack view if(!QuickProcessing) Activity.Run("Scripts/CustomCommands/wsLayersGroup4/CloseORASettings"); break; } } } function HideLayerItems(thenode, layer, QuickProcessing) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { rendatt = thenode + "/Object Render Attributes"; if(Node.Exists(rendatt)){ if(QuickProcessing) { util.SetNodeValueInt(rendatt, "Invisible", true); } else { CommonFS.HideNode(Node.Owner(rendatt)); } } } } if(CommonFS.isActor(thenode)) return; if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { HideLayerItems(childPath, layer, QuickProcessing); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnCKCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho4m48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; Activity = eventData.Activity; var scene = Space.CurrentScene(); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON var QuickProcessing = Node.Value(scene + "/workspacelayers4", "QuickProcessing"); var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; var numlayers = LayersData.length; util = System.CreateDO("Clintons3D Package/Utility functions"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData[i].invisible = false; var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); util.SetNodeValueString(dataNode, "LayersData", LayersDataS); ShowLayerItems(scene, eventData.layer, QuickProcessing); //clean object render attributes from the stack view if(!QuickProcessing) Activity.Run("Scripts/CustomCommands/wsLayersGroup4/CloseORASettings"); break; } } } function ShowLayerItems(thenode, layer, QuickProcessing) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { rendatt = thenode + "/Object Render Attributes"; if(Node.Exists(rendatt)){ if(QuickProcessing) { util.SetNodeValueInt(rendatt, "Invisible", false); } else { CommonFS.ShowNode(Node.Owner(rendatt)); } } } } if(CommonFS.isActor(thenode)) return; if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { ShowLayerItems(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnCCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho4m48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ NewCommand^// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); Node = eventData.Node; Space = eventData.Space; D3DView = eventData.D3DView; RsStackView = eventData.RsStackView; RsTool = eventData.RsTool; scene = Space.CurrentScene(); var ProtectCurveColor = Node.Value(scene + "/workspacelayers4", "ProtectCurveColor"); var ConvertLineHair = Node.Value(scene + "/workspacelayers4", "ConvertLineHair"); var QuickProcessing = Node.Value(scene + "/workspacelayers4", "QuickProcessing"); util = System.CreateDO("Clintons3D Package/Utility functions"); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON color = System.CreateDO("Common Data Package/Color Data"); layerIsLocked = false; layerIsInvisible = false; backfaces = false; hiddenlines = false; sel = System.CreateDO('Kernel Package/Selection Node Data'); sel = Node.Selection(); if(!IsValidSelection(sel)) return; var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { color.SetRed8(LayersData[i].color.red); color.SetGreen8(LayersData[i].color.green); color.SetBlue8(LayersData[i].color.blue); layerIsLocked = LayersData[i].locked; layerIsInvisible = LayersData[i].invisible; mode = LayersData[i].dispmode; backfaces = LayersData[i].backfaces; hiddenlines = LayersData[i].hiddenlines; } } ORA_was_created = false; cnt = Node.SelectedCount(); for(i=0;i<cnt;i++) { //ORA_was_created = false; CommonFS.OrphanList = []; cursel = Node.SelectionGetAt(sel,i); if(CommonFS.IsNURBS(cursel)) { cursel = CommonFS.GetNURBSNode(cursel) + "/LODMesh"; } if(QuickProcessing) addtolayerQuick(cursel, eventData.layer, layerIsLocked, layerIsInvisible, ProtectCurveColor, mode, LayersData ); else addtolayer(cursel, eventData.layer, layerIsLocked, layerIsInvisible, ProtectCurveColor, mode ); if(ConvertLineHair) ConvertHairToCircleProfile(cursel); } if(layerIsLocked) { RsTool.Arrow(); var PVT_LOCKED = 2; RsStackView.RemovePanelsFromCurrSelection(PVT_LOCKED, 0); } if(!QuickProcessing) { if(ORA_was_created) { if(CommonFS.OrphanList.length != 0) { while(node = CommonFS.OrphanList.pop()) { util.Delete(node); } } } var layersobj = {}; var thelayers = []; thelayers.push({layer:-1,count:0}); countscenelayersrecursive(scene, thelayers, -1); for(var i=0; i<LayersData.length; i++) { LayersData[i].count = 0; LayersData[i].groupcount = 0; LayersData[i].groupitemcount = 0; for(var j=0; j<thelayers.length; j++) { if(LayersData[i].layer == thelayers[j].layer) { LayersData[i].count = thelayers[j].count; LayersData[i].groupitemcount = thelayers[j].groupitemcount; LayersData[i].groupcount = thelayers[j].groupcount; break; } } } } var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); util.SetNodeValueString(dataNode, "LayersData", LayersDataS) } function ConvertHairToCircleProfile(currentNode) { if(Node.ConExists(currentNode, "Strand profile")) { if(Node.Value(currentNode, "Strand profile") == "Line") { Node.Value(currentNode, "Strand profile") = "Circle"; } return; } var numChildren = Node.SubObjectCount(currentNode); if(numChildren == 0) return; for(var i=0;i<numChildren;i++) { var childNode = currentNode + "/" + Node.SubObject(currentNode, i); ConvertHairToCircleProfile(childNode); } } function IsValidSelection(selection) { if(!selection) return false; var reWhiteSpace = /^\s/; // whitespace in first character position for cleaning selection text var selectionArray = selection.split(";"); for(var i = 0; i < selectionArray.length; i++) { var selClean = selectionArray[i].replace(reWhiteSpace, ""); if(!Node.Exists(selClean)) { return false; } } return true; } function addtolayerQuick(cursel, layerID, layerIsLocked, layerIsInvisible, ProtectCurveColor, mode, LayersData) { if(CommonFS.IsNURBS(cursel)) { cursel = CommonFS.GetNURBSNode(cursel) + "/LODMesh"; } if(Node.Exists(cursel + "/Object hider") && (Node.IsCamera(cursel) || Node.IsLight(cursel)) ) { util.Disconnect(cursel + "/Object hider", "Invisible", cursel + "/Object Render Attributes", "Invisible") } rendatt = cursel + "/Object Render Attributes"; if(Node.Exists(rendatt)) { //removeFromLayerCount var oldlayer = Node.Value(rendatt, "Layer index"); removeOneFromLayer(oldlayer, LayersData); addOneToLayer(layerID, LayersData); util.SetNodeValueInt(rendatt,"Layer index", layerID) if(Node.ConExists(Node.Owner(cursel), "isaCurve") && ProtectCurveColor) return; util.SetNodeValueColorRGB8(rendatt,"Edges Color", color.GetRed8(), color.GetGreen8(), color.GetBlue8()); setlayerdisplaymode(cursel, layerID, mode); if(layerIsLocked) CommonFS.LockIt(cursel); else CommonFS.UnLockIt(cursel); if(layerIsInvisible) CommonFS.HideNode(cursel); else CommonFS.ShowNode(cursel); } } function removeOneFromLayer(oldlayer, LayersData) { for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == oldlayer) { LayersData[i].count = LayersData[i].count - 1; LayersData[i].groupcount = 0; LayersData[i].groupitemcount = 0; break; } } } function addOneToLayer(layerID, LayersData) { for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == layerID) { LayersData[i].count = LayersData[i].count + 1; LayersData[i].groupcount = 0; LayersData[i].groupitemcount = 0; break; } } } function addtolayer(cursel, layerID, layerIsLocked, layerIsInvisible, ProtectCurveColor, mode) { if( CommonFS.HasNURBSChildRecursive(cursel) ) { var childCount = Node.SubObjectCount(cursel); if(childCount == 0) return; for(var i=0; i<childCount;i++) { var child = cursel + "/" + Node.SubObject(cursel, i); addtolayer(child, layerID, layerIsLocked, layerIsInvisible, ProtectCurveColor, mode); } return; } if(CommonFS.IsNURBS(cursel)) { cursel = CommonFS.GetNURBSNode(cursel) + "/LODMesh"; } if(Node.Exists(cursel + "/Object hider") && (Node.IsCamera(cursel) || Node.IsLight(cursel)) ) { util.Disconnect(cursel + "/Object hider", "Invisible", cursel + "/Object Render Attributes", "Invisible") } if(Node.IsRenderable(cursel) || CommonFS.isActor(cursel) || CommonFS.isGroupRecursive(cursel) ) { rendatt = cursel + "/Object Render Attributes"; CleanChildrenRenderAttributes(cursel); D3DView.ShowRenderAttribsForObject('',cursel);//add object render attributes node ORA_was_created = true; CommonFS.FindOrphanORA(cursel); if(Node.Exists(cursel+ "/Object Render Attributes")) { if(!Node.Exists(cursel+ "/Object hider")) { RsStackView.SetPanelExportInfo(cursel+ '/Object Render Attributes','Default',1,1); } util.SetNodeValueInt(rendatt,"Layer index", layerID) if(Node.ConExists(Node.Owner(cursel), "isaCurve") && ProtectCurveColor) return; util.SetNodeValueColorRGB8(rendatt,"Edges Color", color.GetRed8(), color.GetGreen8(), color.GetBlue8()); setlayerdisplaymoderecursive(cursel, layerID, mode) if(layerIsLocked) CommonFS.LockIt(cursel); else CommonFS.UnLockIt(cursel); if(layerIsInvisible) CommonFS.HideNode(cursel); else CommonFS.ShowNode(cursel); } } } // #### connection changes may need clear history #### function CleanChildrenRenderAttributes(cursel) { var childrenList = []; var childrenLayer = []; var deleteList = []; var rendatt = cursel + "/Object Render Attributes"; if(Node.Exists(rendatt)) { var layer = Node.Value(rendatt,"Layer index"); childrenLayer.push(layer); } else { childrenLayer.push(-1); } childrenList.push(cursel); while(childrenList.length != 0) { var curnode = childrenList.shift(); layer = childrenLayer.shift(); if(layer == -1) { if(Node.ConExists(curnode, "Input Attributes")) { //Node.ConRemove(curnode, "Input Attributes"); util.ConRemove(curnode, "Input Attributes"); } if(Node.ConExists(curnode, "RenderAttributes")) { //Node.ConRemove(curnode, "RenderAttributes"); util.ConRemove(curnode, "RenderAttributes"); } if(Node.Exists(curnode + "/RenderAttributes")) { deleteList.push(curnode + "/RenderAttributes"); } } var numchildren = Node.SubObjectCount(curnode); if(numchildren == 0) continue; for(var i=0;i<numchildren;i++) { var child = curnode + "/" + Node.SubObject(curnode, i); if(Node.ConExists(child, "WldMatrix") && Node.SubObjectCount(child) > 0) { rendatt = child + "/Object Render Attributes"; if(Node.Exists(rendatt)) { layer = Node.Value(rendatt,"Layer index"); childrenLayer.push(layer); } else { childrenLayer.push(-1); } childrenList.push(child); } } } while(deleteMe = deleteList.pop()) { //Node.Delete(deleteMe); util.Delete(deleteMe); } } function countscenelayersrecursive(thenode, thelayers, parentLayer) { // character Skinning node reads as a renderable node - tS bug if(Node.SubObjectCount(thenode) == 0) return; if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; var layerindex = parentLayer; var isGroupNode = CommonFS.isGroupRecursive(thenode); var isActorNode = CommonFS.isActor(thenode); var isNURBSNode = CommonFS.IsNURBS(thenode); var foundLayer, visible, locked; if(isNURBSNode) { thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; isGroupNode = false; } if(Node.IsRenderable(thenode) || isActorNode || isGroupNode || isNURBSNode) { if(!Node.Exists(thenode + "/Object Render Attributes") && thenode != scene && !Node.ConExists(thenode, "Input Attributes") && !isGroupNode && !isNURBSNode) { thelayers[0].count++; } else { if(Node.ConExists(thenode, "Input Attributes") && isGroupNode) { for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == parentLayer) { thelayers[i].groupcount++; break; } } } if(Node.ConExists(thenode, "Input Attributes") && Node.IsRenderable(thenode)) { foundLayer = false; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == parentLayer) { thelayers[i].count++; thelayers[i].groupitemcount++; foundLayer = true; break; } } if(!foundLayer) { thelayers.push({layer:parentLayer, count:1, groupcount: 0, groupitemcount: 1}); } } else if(Node.Exists(thenode + "/Object Render Attributes")) { if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) { layerindex = Node.Value(thenode + "/Object Render Attributes","Layer index"); } else { layerindex = -1; } if(Node.ConExists(thenode + "/Object Render Attributes","Edges Color")) { foundLayer = false; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == layerindex) { if(!(isGroupNode || isActorNode) || isNURBSNode) { thelayers[i].count++; } if(isGroupNode || isActorNode) { thelayers[i].groupcount++; } foundLayer = true; break; } } if(!foundLayer) { if(isGroupNode || isActorNode) { thelayers.push({layer:layerindex, count:0, groupcount: 1, groupitemcount: 0}); } else thelayers.push({layer:layerindex, count:1, groupcount: 0, groupitemcount: 0}); } } if(isNURBSNode) { var nurbsnode = Node.Owner(thenode); } // hair return if(!Node.ConExists(thenode + "/Object Render Attributes","Ignore layer attributes")) return; } } //if(isActorNode) { // thelayers[i].count++; // thelayers[i].groupitemcount++; // return; //} } //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { countscenelayersrecursive(childPath, thelayers, layerindex); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } function setlayerdisplaymode(thenode, layer, mode) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { var nurbs = CommonFS.GetNURBSNode(thenode); if(Node.ConExists(nurbs, "isaCurve")) return; thenode = nurbs + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) { if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) { //hair render attribute has different conn name var EnableObjectModeConn = "Ignore layer attributes"; if(Node.ConExists(thenode + "/Object Render Attributes", "Enable object mode")) EnableObjectModeConn = "Enable object mode"; if(mode=="Global") { util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, false); } if(mode=="Solid") { util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",0); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",1); } if(mode=="Solid Wire") { util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",1); } if(mode=="Transp") { util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",0); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",0.3); } if(mode=="Transp Wire") { util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",0.3); } if(mode=="Wireframe") { util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",0); } if(Node.ConExists(thenode + "/Object Render Attributes", "Show backfaces")) { if(backfaces) util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show backfaces",true); else util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show backfaces",false); } if(Node.ConExists(thenode + "/Object Render Attributes", "Show hidden lines")) { if(hiddenlines) util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show hidden lines",true); else util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show hidden lines",false); } } } } } function setlayerdisplaymoderecursive(thenode, layer, mode) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { var nurbs = CommonFS.GetNURBSNode(thenode); if(Node.ConExists(nurbs, "isaCurve")) return; thenode = nurbs + "/LODMesh"; } if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { //hair render attribute has different conn name var EnableObjectModeConn = "Ignore layer attributes"; if(Node.ConExists(thenode + "/Object Render Attributes", "Enable object mode")) EnableObjectModeConn = "Enable object mode"; if(mode=="Global") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = false; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn, false); } if(mode=="Solid") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//solid //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 0; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 1; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",0); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",1); } if(mode=="Solid Wire") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//solid wire //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 1; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 1; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",1); } if(mode=="Transp") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//trans //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 0; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 0.3; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",0); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",0.3); } if(mode=="Transp Wire") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//trans wire //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 1; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 0.3; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",0.3); } if(mode=="Wireframe") { //Node.Value(thenode + "/Object Render Attributes", EnableObjectModeConn) = true;//wire //Node.Value(thenode + "/Object Render Attributes", "Edges opacity") = 1; //Node.Value(thenode + "/Object Render Attributes", "Surface Opacity") = 0; util.SetNodeValueInt(thenode + "/Object Render Attributes", EnableObjectModeConn,true); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Edges opacity",1); util.SetNodeValueFloat(thenode + "/Object Render Attributes", "Surface Opacity",0); } if(Node.ConExists(thenode + "/Object Render Attributes", "Show backfaces")) { if(backfaces) //Node.Value(thenode + "/Object Render Attributes", "Show backfaces") = true; util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show backfaces",true); else //Node.Value(thenode + "/Object Render Attributes", "Show backfaces") = false; util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show backfaces",false); } if(Node.ConExists(thenode + "/Object Render Attributes", "Show hidden lines")) { if(hiddenlines) //Node.Value(thenode + "/Object Render Attributes", "Show hidden lines") = true; util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show hidden lines",true); else //Node.Value(thenode + "/Object Render Attributes", "Show hidden lines") = false; util.SetNodeValueInt(thenode + "/Object Render Attributes", "Show hidden lines",false); } if(CommonFS.isActor(thenode)) return; if(CommonFS.isGroupRecursive(thenode)) return; } } if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { setlayerdisplaymoderecursive(childPath,layer, mode); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnCKCb@H@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UO$1&KߊPVMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho4m48@Jg'JNjn*pnBC`@0@2|=Bynj|?z@Hoۙ>?ceZU@䑧r[җJs@ LNewCommandNL// Execute // Called to execute the command function Execute(params) { } // --------------------------------- // Advanced handlers // --------------------------------- function OnCustomEvent(params) { var eventData = params.Param('vtEventData'); if(eventData.layer < 2) return; Node = eventData.Node; Space = eventData.Space; scene = Space.CurrentScene(); var ProtectCurveColor = Node.Value(scene + "/workspacelayers4", "ProtectCurveColor"); var QuickProcessing = Node.Value(scene + "/workspacelayers4", "QuickProcessing"); CommonFS = Node.AccessFnSet(scene + "/workspacelayers4/Common Function Set"); JSON = Node.AccessFnSet(scene + "/workspacelayers4/JSON Function Set").JSON util = System.CreateDO("Clintons3D Package/Utility functions"); color = System.CreateDO("Common Data Package/Color Data"); color.SetRed8(255); color.SetGreen8(255); color.SetBlue8(255); var dataNode = scene + "/workspacelayers4/Data"; var LayersDataS = Node.Value(dataNode, "LayersData"); var LayersData = JSON.parse(LayersDataS).data; colorLayer1 = System.CreateDO("Common Data Package/Color Data"); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == 1) { colorLayer1.SetRed8(LayersData[i].color.red); colorLayer1.SetGreen8(LayersData[i].color.green); colorLayer1.SetBlue8(LayersData[i].color.blue); } } UnLockLayerItems(scene, eventData.layer); ShowLayerItems(scene, eventData.layer); emptylayerrecursive(scene, eventData.layer, ProtectCurveColor, LayersData); for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == eventData.layer) { LayersData.splice(i,1); } } if(!QuickProcessing) { var layersobj = {}; var thelayers = []; thelayers.push({layer:-1,count:0}); countscenelayersrecursive(scene, thelayers, -1); for(var i=0; i<LayersData.length; i++) { LayersData[i].count = 0; LayersData[i].groupcount = 0; LayersData[i].groupitemcount = 0; for(var j=0; j<thelayers.length; j++) { if(LayersData[i].layer == thelayers[j].layer) { LayersData[i].count = thelayers[j].count; LayersData[i].groupitemcount = thelayers[j].groupitemcount; LayersData[i].groupcount = thelayers[j].groupcount; break; } } } } var newData = {}; newData.data = LayersData; LayersDataS = JSON.stringify(newData); util.SetNodeValueString(dataNode, "LayersData", LayersDataS) } function UnLockLayerItems(thenode, layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroup(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { CommonFS.UnLockIt(thenode); } } if(CommonFS.isActor(thenode)) return; if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { UnLockLayerItems(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } function ShowLayerItems(thenode, layer) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; if(Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroup(thenode) ) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { rendatt = thenode + "/Object Render Attributes"; if(Node.Exists(rendatt)){ CommonFS.ShowNode(Node.Owner(rendatt)); } } } if(CommonFS.isActor(thenode)) return; if(Node.IsRenderable(thenode)) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { ShowLayerItems(childPath,layer); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } function addOneToLayer(layerID, LayersData) { for(var i=0; i<LayersData.length; i++) { if(LayersData[i].layer == layerID) { LayersData[i].count = LayersData[i].count + 1; LayersData[i].groupcount = 0; LayersData[i].groupitemcount = 0; break; } } } function emptylayerrecursive(thenode,layer, ProtectCurveColor, LayersData) { if(thenode == Space.CurrentScene() + "/workspacelayers3") return; if(thenode == Space.CurrentScene() + "/workspacelayers4") return; var isaNURBS = CommonFS.IsNURBS(thenode); if(isaNURBS) { thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; } if(Node.ConExists(thenode, "Material List") && !Node.IsRenderable(thenode) ) return; if( Node.IsRenderable(thenode) || CommonFS.isActor(thenode) || CommonFS.isGroupRecursive(thenode) || isaNURBS) { if(Node.Exists(thenode + "/Object Render Attributes")) if(Node.Value(thenode + "/Object Render Attributes","Layer index") == layer) { util.SetNodeValueInt(thenode + "/Object Render Attributes","Layer index", 0) addOneToLayer(0, LayersData); } } if(Node.IsRenderable(thenode) || isaNURBS) return; //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { emptylayerrecursive(childPath,layer, ProtectCurveColor, LayersData); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } function countscenelayersrecursive(thenode, thelayers, parentLayer) { var layerindex = parentLayer; var isGroupNode = CommonFS.isGroupRecursive(thenode); var isActorNode = CommonFS.isActor(thenode); var isNURBSNode = CommonFS.IsNURBS(thenode); var foundLayer, visible, locked; if(isNURBSNode) thenode = CommonFS.GetNURBSNode(thenode) + "/LODMesh"; if(Node.IsRenderable(thenode) || isActorNode || isGroupNode || isNURBSNode) { if(!Node.Exists(thenode + "/Object Render Attributes") && thenode != scene && !Node.ConExists(thenode, "Input Attributes") && !isGroupNode && !isNURBSNode) { thelayers[0].count++; } else { if(Node.ConExists(thenode, "Input Attributes") && Node.IsRenderable(thenode)) { foundLayer = false; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == parentLayer) { thelayers[i].count++; thelayers[i].groupitemcount++; foundLayer = true; break; } } if(!foundLayer) { thelayers.push({layer:parentLayer, count:1, groupcount: 0, groupitemcount: 1}); } } else if(Node.Exists(thenode + "/Object Render Attributes")) { if(Node.ConExists(thenode + "/Object Render Attributes","Layer index")) { layerindex = Node.Value(thenode + "/Object Render Attributes","Layer index"); } else { layerindex = -1; } if(Node.ConExists(thenode + "/Object Render Attributes","Edges Color")) { foundLayer = false; for(var i=0; i<thelayers.length;i++) { if(thelayers[i].layer == layerindex) { if(!isGroupNode || isNURBSNode) { thelayers[i].count++; } foundLayer = true; break; } } if(!foundLayer) { if(isGroupNode) { thelayers.push({layer:layerindex, count:0, groupcount: 1, groupitemcount: 0}); } else thelayers.push({layer:layerindex, count:1, groupcount: 0, groupitemcount: 0}); } } if(isNURBSNode) { var nurbsnode = Node.Owner(thenode); } // hair return if(!Node.ConExists(thenode + "/Object Render Attributes","Ignore layer attributes")) return; } } if(isActorNode) return; } //get first child var curIndex = 0; var curnumObj = Node.SubObjectCount(thenode); if(curnumObj > 0) { childshortname = Node.SubObject(thenode,0); childPath = thenode+ "/" + childshortname; } //recursion runs here - get the next child while(curnumObj > 0) { countscenelayersrecursive(childPath, thelayers, layerindex); curIndex = curIndex + 1; if(curIndex < curnumObj) { childshortname = Node.SubObject(thenode, curIndex); childPath = thenode + "/" + childshortname; } else curnumObj = 0; } } NScript Object Package/jScript language4W}@O{(XFҦV>g'JNjn*pnCCb@@P@2|=Bynj|?z@Hoۙ>?J@#QL>g'JNjn*pnBB`@T@2|=Bynj|?z@Hoۙ>?$1&KߊPV-1OSM n 럆L<_їjControlOˁCRih[ a8Activity.Run('%THIS_NAME%') StartZ`Ez]UOOˁCRih[ 0a:Activity.Stop('%THIS_NAME%') StopZ`Ez]UOMT^RwL~YYT>g'JNjn*pnCB`@0@2|=Bynj|?z@Hoۙ>?z@Ho4m8ʯȥJH|o7 gH]kDwPa `d8pM*#ͺO2/tfѭ8Lwb"qe}