NodesMaterial.hx 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056
  1. package arm.shader;
  2. import haxe.Json;
  3. import zui.Zui;
  4. import zui.Id;
  5. import zui.Nodes;
  6. import arm.Project;
  7. import arm.Translator._tr;
  8. class NodesMaterial {
  9. public static var categories = [_tr("Input"), _tr("Texture"), _tr("Color"), _tr("Vector"), _tr("Converter"), _tr("Group")];
  10. public static var list: Array<Array<TNode>> = [
  11. [ // Input
  12. {
  13. id: 0,
  14. name: _tr("Attribute"),
  15. type: "ATTRIBUTE",
  16. x: 0,
  17. y: 0,
  18. color: 0xffb34f5a,
  19. inputs: [],
  20. outputs: [
  21. {
  22. id: 0,
  23. node_id: 0,
  24. name: _tr("Color"),
  25. type: "RGBA",
  26. color: 0xffc7c729,
  27. default_value: f32([0.8, 0.8, 0.8, 1.0])
  28. },
  29. {
  30. id: 0,
  31. node_id: 0,
  32. name: _tr("Vector"),
  33. type: "VECTOR",
  34. color: 0xff6363c7,
  35. default_value: f32([0.0, 0.0, 0.0])
  36. },
  37. {
  38. id: 0,
  39. node_id: 0,
  40. name: _tr("Fac"),
  41. type: "VALUE",
  42. color: 0xffa1a1a1,
  43. default_value: 0.0
  44. }
  45. ],
  46. buttons: [
  47. {
  48. name: _tr("Name"),
  49. type: "STRING"
  50. }
  51. ]
  52. },
  53. {
  54. id: 0,
  55. name: _tr("Camera Data"),
  56. type: "CAMERA",
  57. x: 0,
  58. y: 0,
  59. color: 0xffb34f5a,
  60. inputs: [],
  61. outputs: [
  62. {
  63. id: 0,
  64. node_id: 0,
  65. name: _tr("View Vector"),
  66. type: "VECTOR",
  67. color: 0xff6363c7,
  68. default_value: f32([0.0, 0.0, 0.0])
  69. },
  70. {
  71. id: 0,
  72. node_id: 0,
  73. name: _tr("View Z Depth"),
  74. type: "VALUE",
  75. color: 0xffa1a1a1,
  76. default_value: 0.0
  77. },
  78. {
  79. id: 0,
  80. node_id: 0,
  81. name: _tr("View Distance"),
  82. type: "VALUE",
  83. color: 0xffa1a1a1,
  84. default_value: 0.0
  85. }
  86. ],
  87. buttons: []
  88. },
  89. {
  90. id: 0,
  91. name: _tr("Fresnel"),
  92. type: "FRESNEL",
  93. x: 0,
  94. y: 0,
  95. color: 0xffb34f5a,
  96. inputs: [
  97. {
  98. id: 0,
  99. node_id: 0,
  100. name: _tr("IOR"),
  101. type: "VALUE",
  102. color: 0xffa1a1a1,
  103. default_value: 1.45,
  104. min: 0,
  105. max: 3
  106. },
  107. {
  108. id: 0,
  109. node_id: 0,
  110. name: _tr("Normal"),
  111. type: "VECTOR",
  112. color: 0xff6363c7,
  113. default_value: f32([0.0, 0.0, 0.0])
  114. }
  115. ],
  116. outputs: [
  117. {
  118. id: 0,
  119. node_id: 0,
  120. name: _tr("Fac"),
  121. type: "VALUE",
  122. color: 0xffa1a1a1,
  123. default_value: 0.0
  124. }
  125. ],
  126. buttons: []
  127. },
  128. {
  129. id: 0,
  130. name: _tr("Geometry"),
  131. type: "NEW_GEOMETRY",
  132. x: 0,
  133. y: 0,
  134. color: 0xffb34f5a,
  135. inputs: [],
  136. outputs: [
  137. {
  138. id: 0,
  139. node_id: 0,
  140. name: _tr("Position"),
  141. type: "VECTOR",
  142. color: 0xff6363c7,
  143. default_value: f32([0.0, 0.0, 0.0])
  144. },
  145. {
  146. id: 0,
  147. node_id: 0,
  148. name: _tr("Normal"),
  149. type: "VECTOR",
  150. color: 0xff6363c7,
  151. default_value: f32([0.0, 0.0, 0.0])
  152. },
  153. {
  154. id: 0,
  155. node_id: 0,
  156. name: _tr("Tangent"),
  157. type: "VECTOR",
  158. color: 0xff6363c7,
  159. default_value: f32([0.0, 0.0, 0.0])
  160. },
  161. {
  162. id: 0,
  163. node_id: 0,
  164. name: _tr("True Normal"),
  165. type: "VECTOR",
  166. color: 0xff6363c7,
  167. default_value: f32([0.0, 0.0, 0.0])
  168. },
  169. {
  170. id: 0,
  171. node_id: 0,
  172. name: _tr("Incoming"),
  173. type: "VECTOR",
  174. color: 0xff6363c7,
  175. default_value: f32([0.0, 0.0, 0.0])
  176. },
  177. {
  178. id: 0,
  179. node_id: 0,
  180. name: _tr("Parametric"),
  181. type: "VECTOR",
  182. color: 0xff6363c7,
  183. default_value: f32([0.0, 0.0, 0.0])
  184. },
  185. {
  186. id: 0,
  187. node_id: 0,
  188. name: _tr("Backfacing"),
  189. type: "VALUE",
  190. color: 0xffa1a1a1,
  191. default_value: 0.0
  192. },
  193. {
  194. id: 0,
  195. node_id: 0,
  196. name: _tr("Pointiness"),
  197. type: "VALUE",
  198. color: 0xffa1a1a1,
  199. default_value: 0.0
  200. },
  201. {
  202. id: 0,
  203. node_id: 0,
  204. name: _tr("Random Per Island"),
  205. type: "VALUE",
  206. color: 0xffa1a1a1,
  207. default_value: 0.0
  208. }
  209. ],
  210. buttons: []
  211. },
  212. {
  213. id: 0,
  214. name: _tr("Layer"),
  215. type: "LAYER", // extension
  216. x: 0,
  217. y: 0,
  218. color: 0xff4982a0,
  219. inputs: [],
  220. outputs: [
  221. {
  222. id: 0,
  223. node_id: 0,
  224. name: _tr("Base Color"),
  225. type: "RGBA",
  226. color: 0xffc7c729,
  227. default_value: f32([0.0, 0.0, 0.0, 1.0])
  228. },
  229. {
  230. id: 0,
  231. node_id: 0,
  232. name: _tr("Opacity"),
  233. type: "VALUE",
  234. color: 0xffa1a1a1,
  235. default_value: 1.0
  236. },
  237. {
  238. id: 0,
  239. node_id: 0,
  240. name: _tr("Occlusion"),
  241. type: "VALUE",
  242. color: 0xffa1a1a1,
  243. default_value: 1.0
  244. },
  245. {
  246. id: 0,
  247. node_id: 0,
  248. name: _tr("Roughness"),
  249. type: "VALUE",
  250. color: 0xffa1a1a1,
  251. default_value: 1.0
  252. },
  253. {
  254. id: 0,
  255. node_id: 0,
  256. name: _tr("Metallic"),
  257. type: "VALUE",
  258. color: 0xffa1a1a1,
  259. default_value: 1.0
  260. },
  261. {
  262. id: 0,
  263. node_id: 0,
  264. name: _tr("Normal Map"),
  265. type: "VECTOR",
  266. color: -10238109,
  267. default_value: f32([0.5, 0.5, 1.0])
  268. },
  269. {
  270. id: 0,
  271. node_id: 0,
  272. name: _tr("Emission"),
  273. type: "VALUE",
  274. color: 0xffa1a1a1,
  275. default_value: 1.0
  276. },
  277. {
  278. id: 0,
  279. node_id: 0,
  280. name: _tr("Height"),
  281. type: "VALUE",
  282. color: 0xffa1a1a1,
  283. default_value: 1.0
  284. },
  285. {
  286. id: 0,
  287. node_id: 0,
  288. name: _tr("Subsurface"),
  289. type: "VALUE",
  290. color: 0xffa1a1a1,
  291. default_value: 1.0
  292. }
  293. ],
  294. buttons: [
  295. {
  296. name: _tr("Layer"),
  297. type: "ENUM",
  298. default_value: 0,
  299. data: ""
  300. }
  301. ]
  302. },
  303. {
  304. id: 0,
  305. name: _tr("Layer Mask"),
  306. type: "LAYER_MASK", // extension
  307. x: 0,
  308. y: 0,
  309. color: 0xff4982a0,
  310. inputs: [],
  311. outputs: [
  312. {
  313. id: 0,
  314. node_id: 0,
  315. name: _tr("Value"),
  316. type: "VALUE",
  317. color: 0xffa1a1a1,
  318. default_value: 0.0
  319. }
  320. ],
  321. buttons: [
  322. {
  323. name: _tr("Layer"),
  324. type: "ENUM",
  325. default_value: 0,
  326. data: ""
  327. }
  328. ]
  329. },
  330. {
  331. id: 0,
  332. name: _tr("Layer Weight"),
  333. type: "LAYER_WEIGHT",
  334. x: 0,
  335. y: 0,
  336. color: 0xffb34f5a,
  337. inputs: [
  338. {
  339. id: 0,
  340. node_id: 0,
  341. name: _tr("Blend"),
  342. type: "VALUE",
  343. color: 0xffa1a1a1,
  344. default_value: 0.5
  345. },
  346. {
  347. id: 0,
  348. node_id: 0,
  349. name: _tr("Normal"),
  350. type: "VECTOR",
  351. color: 0xff6363c7,
  352. default_value: f32([0.0, 0.0, 0.0])
  353. }
  354. ],
  355. outputs: [
  356. {
  357. id: 0,
  358. node_id: 0,
  359. name: _tr("Fresnel"),
  360. type: "VALUE",
  361. color: 0xffa1a1a1,
  362. default_value: 0.0
  363. },
  364. {
  365. id: 0,
  366. node_id: 0,
  367. name: _tr("Facing"),
  368. type: "VALUE",
  369. color: 0xffa1a1a1,
  370. default_value: 0.0
  371. }
  372. ],
  373. buttons: []
  374. },
  375. {
  376. id: 0,
  377. name: _tr("Material"),
  378. type: "MATERIAL", // extension
  379. x: 0,
  380. y: 0,
  381. color: 0xff4982a0,
  382. inputs: [],
  383. outputs: [
  384. {
  385. id: 0,
  386. node_id: 0,
  387. name: _tr("Base Color"),
  388. type: "RGBA",
  389. color: 0xffc7c729,
  390. default_value: f32([0.0, 0.0, 0.0, 1.0])
  391. },
  392. {
  393. id: 0,
  394. node_id: 0,
  395. name: _tr("Opacity"),
  396. type: "VALUE",
  397. color: 0xffa1a1a1,
  398. default_value: 1.0
  399. },
  400. {
  401. id: 0,
  402. node_id: 0,
  403. name: _tr("Occlusion"),
  404. type: "VALUE",
  405. color: 0xffa1a1a1,
  406. default_value: 1.0
  407. },
  408. {
  409. id: 0,
  410. node_id: 0,
  411. name: _tr("Roughness"),
  412. type: "VALUE",
  413. color: 0xffa1a1a1,
  414. default_value: 1.0
  415. },
  416. {
  417. id: 0,
  418. node_id: 0,
  419. name: _tr("Metallic"),
  420. type: "VALUE",
  421. color: 0xffa1a1a1,
  422. default_value: 1.0
  423. },
  424. {
  425. id: 0,
  426. node_id: 0,
  427. name: _tr("Normal Map"),
  428. type: "VECTOR",
  429. color: -10238109,
  430. default_value: f32([0.5, 0.5, 1.0])
  431. },
  432. {
  433. id: 0,
  434. node_id: 0,
  435. name: _tr("Emission"),
  436. type: "VALUE",
  437. color: 0xffa1a1a1,
  438. default_value: 1.0
  439. },
  440. {
  441. id: 0,
  442. node_id: 0,
  443. name: _tr("Height"),
  444. type: "VALUE",
  445. color: 0xffa1a1a1,
  446. default_value: 1.0
  447. },
  448. {
  449. id: 0,
  450. node_id: 0,
  451. name: _tr("Subsurface"),
  452. type: "VALUE",
  453. color: 0xffa1a1a1,
  454. default_value: 1.0
  455. }
  456. ],
  457. buttons: [
  458. {
  459. name: _tr("Material"),
  460. type: "ENUM",
  461. default_value: 0,
  462. data: ""
  463. }
  464. ]
  465. },
  466. {
  467. id: 0,
  468. name: _tr("Object Info"),
  469. type: "OBJECT_INFO",
  470. x: 0,
  471. y: 0,
  472. color: 0xffb34f5a,
  473. inputs: [],
  474. outputs: [
  475. {
  476. id: 0,
  477. node_id: 0,
  478. name: _tr("Location"),
  479. type: "VECTOR",
  480. color: 0xff6363c7,
  481. default_value: f32([0.0, 0.0, 0.0])
  482. },
  483. {
  484. id: 0,
  485. node_id: 0,
  486. name: _tr("Color"),
  487. type: "RGBA",
  488. color: 0xffc7c729,
  489. default_value: f32([0.0, 0.0, 0.0, 1.0])
  490. },
  491. {
  492. id: 0,
  493. node_id: 0,
  494. name: _tr("Object Index"),
  495. type: "VALUE",
  496. color: 0xffa1a1a1,
  497. default_value: 0.0
  498. },
  499. {
  500. id: 0,
  501. node_id: 0,
  502. name: _tr("Material Index"),
  503. type: "VALUE",
  504. color: 0xffa1a1a1,
  505. default_value: 0.0
  506. },
  507. {
  508. id: 0,
  509. node_id: 0,
  510. name: _tr("Random"),
  511. type: "VALUE",
  512. color: 0xffa1a1a1,
  513. default_value: 0.0
  514. }
  515. ],
  516. buttons: []
  517. },
  518. {
  519. id: 0,
  520. name: _tr("Picker"),
  521. type: "PICKER", // extension
  522. x: 0,
  523. y: 0,
  524. color: 0xff4982a0,
  525. inputs: [],
  526. outputs: [
  527. {
  528. id: 0,
  529. node_id: 0,
  530. name: _tr("Base Color"),
  531. type: "RGBA",
  532. color: 0xffc7c729,
  533. default_value: f32([0.0, 0.0, 0.0, 1.0])
  534. },
  535. {
  536. id: 0,
  537. node_id: 0,
  538. name: _tr("Opacity"),
  539. type: "VALUE",
  540. color: 0xffa1a1a1,
  541. default_value: 1.0
  542. },
  543. {
  544. id: 0,
  545. node_id: 0,
  546. name: _tr("Occlusion"),
  547. type: "VALUE",
  548. color: 0xffa1a1a1,
  549. default_value: 1.0
  550. },
  551. {
  552. id: 0,
  553. node_id: 0,
  554. name: _tr("Roughness"),
  555. type: "VALUE",
  556. color: 0xffa1a1a1,
  557. default_value: 1.0
  558. },
  559. {
  560. id: 0,
  561. node_id: 0,
  562. name: _tr("Metallic"),
  563. type: "VALUE",
  564. color: 0xffa1a1a1,
  565. default_value: 1.0
  566. },
  567. {
  568. id: 0,
  569. node_id: 0,
  570. name: _tr("Normal Map"),
  571. type: "VECTOR",
  572. color: -10238109,
  573. default_value: f32([0.5, 0.5, 1.0])
  574. },
  575. {
  576. id: 0,
  577. node_id: 0,
  578. name: _tr("Emission"),
  579. type: "VALUE",
  580. color: 0xffa1a1a1,
  581. default_value: 1.0
  582. },
  583. {
  584. id: 0,
  585. node_id: 0,
  586. name: _tr("Height"),
  587. type: "VALUE",
  588. color: 0xffa1a1a1,
  589. default_value: 1.0
  590. },
  591. {
  592. id: 0,
  593. node_id: 0,
  594. name: _tr("Subsurface"),
  595. type: "VALUE",
  596. color: 0xffa1a1a1,
  597. default_value: 1.0
  598. }
  599. ],
  600. buttons: []
  601. },
  602. {
  603. id: 0,
  604. name: _tr("RGB"),
  605. type: "RGB",
  606. x: 0,
  607. y: 0,
  608. color: 0xffb34f5a,
  609. inputs: [],
  610. outputs: [
  611. {
  612. id: 0,
  613. node_id: 0,
  614. name: _tr("Color"),
  615. type: "RGBA",
  616. color: 0xffc7c729,
  617. default_value: f32([0.5, 0.5, 0.5, 1.0])
  618. }
  619. ],
  620. buttons: [
  621. {
  622. name: _tr("default_value"),
  623. type: "RGBA",
  624. output: 0
  625. }
  626. ]
  627. },
  628. {
  629. id: 0,
  630. name: _tr("Script"),
  631. type: "SCRIPT_CPU", // extension
  632. x: 0,
  633. y: 0,
  634. color: 0xffb34f5a,
  635. inputs: [],
  636. outputs: [
  637. {
  638. id: 0,
  639. node_id: 0,
  640. name: _tr("Value"),
  641. type: "VALUE",
  642. color: 0xffa1a1a1,
  643. default_value: 0.5
  644. }
  645. ],
  646. buttons: [
  647. {
  648. name: " ",
  649. type: "STRING",
  650. default_value: ""
  651. }
  652. ]
  653. },
  654. {
  655. id: 0,
  656. name: _tr("Shader"),
  657. type: "SHADER_GPU", // extension
  658. x: 0,
  659. y: 0,
  660. color: 0xffb34f5a,
  661. inputs: [],
  662. outputs: [
  663. {
  664. id: 0,
  665. node_id: 0,
  666. name: _tr("Value"),
  667. type: "VALUE",
  668. color: 0xffa1a1a1,
  669. default_value: 0.5
  670. }
  671. ],
  672. buttons: [
  673. {
  674. name: " ",
  675. type: "STRING",
  676. default_value: ""
  677. }
  678. ]
  679. },
  680. {
  681. id: 0,
  682. name: _tr("Tangent"),
  683. type: "TANGENT",
  684. x: 0,
  685. y: 0,
  686. color: 0xffb34f5a,
  687. inputs: [],
  688. outputs: [
  689. {
  690. id: 0,
  691. node_id: 0,
  692. name: _tr("Tangent"),
  693. type: "VECTOR",
  694. color: 0xff6363c7,
  695. default_value: f32([0.0, 0.0, 0.0])
  696. }
  697. ],
  698. buttons: []
  699. },
  700. {
  701. id: 0,
  702. name: _tr("Texture Coordinate"),
  703. type: "TEX_COORD",
  704. x: 0,
  705. y: 0,
  706. color: 0xffb34f5a,
  707. inputs: [],
  708. outputs: [
  709. {
  710. id: 0,
  711. node_id: 0,
  712. name: _tr("Generated"),
  713. type: "VECTOR",
  714. color: 0xff6363c7,
  715. default_value: f32([0.0, 0.0, 0.0])
  716. },
  717. {
  718. id: 0,
  719. node_id: 0,
  720. name: _tr("Normal"),
  721. type: "VECTOR",
  722. color: 0xff6363c7,
  723. default_value: f32([0.0, 0.0, 0.0])
  724. },
  725. {
  726. id: 0,
  727. node_id: 0,
  728. name: _tr("UV"),
  729. type: "VECTOR",
  730. color: 0xff6363c7,
  731. default_value: f32([0.0, 0.0, 0.0])
  732. },
  733. {
  734. id: 0,
  735. node_id: 0,
  736. name: _tr("Object"),
  737. type: "VECTOR",
  738. color: 0xff6363c7,
  739. default_value: f32([0.0, 0.0, 0.0])
  740. },
  741. {
  742. id: 0,
  743. node_id: 0,
  744. name: _tr("Camera"),
  745. type: "VECTOR",
  746. color: 0xff6363c7,
  747. default_value: f32([0.0, 0.0, 0.0])
  748. },
  749. {
  750. id: 0,
  751. node_id: 0,
  752. name: _tr("Window"),
  753. type: "VECTOR",
  754. color: 0xff6363c7,
  755. default_value: f32([0.0, 0.0, 0.0])
  756. },
  757. {
  758. id: 0,
  759. node_id: 0,
  760. name: _tr("Reflection"),
  761. type: "VECTOR",
  762. color: 0xff6363c7,
  763. default_value: f32([0.0, 0.0, 0.0])
  764. }
  765. ],
  766. buttons: []
  767. },
  768. {
  769. id: 0,
  770. name: _tr("UV Map"),
  771. type: "UVMAP",
  772. x: 0,
  773. y: 0,
  774. color: 0xffb34f5a,
  775. inputs: [],
  776. outputs: [
  777. {
  778. id: 0,
  779. node_id: 0,
  780. name: _tr("UV"),
  781. type: "VECTOR",
  782. color: 0xff6363c7,
  783. default_value: f32([0.0, 0.0, 0.0])
  784. }
  785. ],
  786. buttons: []
  787. },
  788. {
  789. id: 0,
  790. name: _tr("Value"),
  791. type: "VALUE",
  792. x: 0,
  793. y: 0,
  794. color: 0xffb34f5a,
  795. inputs: [],
  796. outputs: [
  797. {
  798. id: 0,
  799. node_id: 0,
  800. name: _tr("Value"),
  801. type: "VALUE",
  802. color: 0xffa1a1a1,
  803. default_value: 0.5
  804. }
  805. ],
  806. buttons: [
  807. {
  808. name: _tr("default_value"),
  809. type: "VALUE",
  810. output: 0,
  811. min: 0.0,
  812. max: 10.0
  813. }
  814. ]
  815. },
  816. {
  817. id: 0,
  818. name: _tr("Vertex Color"),
  819. type: "VERTEX_COLOR",
  820. x: 0,
  821. y: 0,
  822. color: 0xffb34f5a,
  823. inputs: [],
  824. outputs: [
  825. {
  826. id: 0,
  827. node_id: 0,
  828. name: _tr("Color"),
  829. type: "RGBA",
  830. color: 0xffc7c729,
  831. default_value: f32([0.8, 0.8, 0.8, 1.0])
  832. },
  833. {
  834. id: 0,
  835. node_id: 0,
  836. name: _tr("Alpha"),
  837. type: "VALUE",
  838. color: 0xffa1a1a1,
  839. default_value: 0.0
  840. }
  841. ],
  842. buttons: []
  843. },
  844. {
  845. id: 0,
  846. name: _tr("Wireframe"),
  847. type: "WIREFRAME",
  848. x: 0,
  849. y: 0,
  850. color: 0xffb34f5a,
  851. inputs: [
  852. {
  853. id: 0,
  854. node_id: 0,
  855. name: _tr("Size"),
  856. type: "VALUE",
  857. color: 0xffa1a1a1,
  858. default_value: 0.01,
  859. max: 0.1
  860. },
  861. ],
  862. outputs: [
  863. {
  864. id: 0,
  865. node_id: 0,
  866. name: _tr("Fac"),
  867. type: "VALUE",
  868. color: 0xffa1a1a1,
  869. default_value: 0.0
  870. }
  871. ],
  872. buttons: [
  873. {
  874. name: _tr("Pixel Size"),
  875. type: "BOOL",
  876. default_value: false,
  877. output: 0
  878. }
  879. ]
  880. },
  881. ],
  882. // [ // Output
  883. // {
  884. // id: 0,
  885. // name: _tr("Material Output"),
  886. // type: "OUTPUT_MATERIAL_PBR",
  887. // x: 0,
  888. // y: 0,
  889. // color: 0xffb34f5a,
  890. // inputs: [
  891. // {
  892. // id: 0,
  893. // node_id: 0,
  894. // name: _tr("Base Color"),
  895. // type: "RGBA",
  896. // color: 0xffc7c729,
  897. // default_value: f32([0.8, 0.8, 0.8, 1.0])
  898. // },
  899. // {
  900. // id: 0,
  901. // node_id: 0,
  902. // name: _tr("Opacity"),
  903. // type: "VALUE",
  904. // color: 0xffa1a1a1,
  905. // default_value: 1.0
  906. // },
  907. // {
  908. // id: 0,
  909. // node_id: 0,
  910. // name: _tr("Occlusion"),
  911. // type: "VALUE",
  912. // color: 0xffa1a1a1,
  913. // default_value: 1.0
  914. // },
  915. // {
  916. // id: 0,
  917. // node_id: 0,
  918. // name: _tr("Roughness"),
  919. // type: "VALUE",
  920. // color: 0xffa1a1a1,
  921. // default_value: 0.1
  922. // },
  923. // {
  924. // id: 0,
  925. // node_id: 0,
  926. // name: _tr("Metallic"),
  927. // type: "VALUE",
  928. // color: 0xffa1a1a1,
  929. // default_value: 0.0
  930. // },
  931. // {
  932. // id: 0,
  933. // node_id: 0,
  934. // name: _tr("Normal Map"),
  935. // type: "VECTOR",
  936. // color: -10238109,
  937. // default_value: f32([0.5, 0.5, 1.0])
  938. // },
  939. // {
  940. // id: 0,
  941. // node_id: 0,
  942. // name: _tr("Emission"),
  943. // type: "VALUE",
  944. // color: 0xffa1a1a1,
  945. // default_value: 0.0
  946. // },
  947. // {
  948. // id: 0,
  949. // node_id: 0,
  950. // name: _tr("Height"),
  951. // type: "VALUE",
  952. // color: 0xffa1a1a1,
  953. // default_value: 0.0
  954. // },
  955. // {
  956. // id: 0,
  957. // node_id: 0,
  958. // name: _tr("Subsurface"),
  959. // type: "VALUE",
  960. // color: 0xffa1a1a1,
  961. // default_value: 0.0
  962. // }
  963. // ],
  964. // outputs: [],
  965. // buttons: []
  966. // }
  967. // ],
  968. [ // Texture
  969. {
  970. id: 0,
  971. name: _tr("Brick Texture"),
  972. type: "TEX_BRICK",
  973. x: 0,
  974. y: 0,
  975. color: 0xff4982a0,
  976. inputs: [
  977. {
  978. id: 0,
  979. node_id: 0,
  980. name: _tr("Vector"),
  981. type: "VECTOR",
  982. color: 0xff6363c7,
  983. default_value: f32([0.0, 0.0, 0.0])
  984. },
  985. {
  986. id: 0,
  987. node_id: 0,
  988. name: _tr("Color 1"),
  989. type: "RGBA",
  990. color: 0xffc7c729,
  991. default_value: f32([0.8, 0.8, 0.8])
  992. },
  993. {
  994. id: 0,
  995. node_id: 0,
  996. name: _tr("Color 2"),
  997. type: "RGBA",
  998. color: 0xffc7c729,
  999. default_value: f32([0.2, 0.2, 0.2])
  1000. },
  1001. {
  1002. id: 0,
  1003. node_id: 0,
  1004. name: _tr("Mortar"),
  1005. type: "RGBA",
  1006. color: 0xffc7c729,
  1007. default_value: f32([0.0, 0.0, 0.0])
  1008. },
  1009. {
  1010. id: 0,
  1011. node_id: 0,
  1012. name: _tr("Scale"),
  1013. type: "VALUE",
  1014. color: 0xffa1a1a1,
  1015. default_value: 5.0,
  1016. min: 0.0,
  1017. max: 10.0
  1018. }
  1019. ],
  1020. outputs: [
  1021. {
  1022. id: 0,
  1023. node_id: 0,
  1024. name: _tr("Color"),
  1025. type: "RGBA",
  1026. color: 0xffc7c729,
  1027. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1028. },
  1029. {
  1030. id: 0,
  1031. node_id: 0,
  1032. name: _tr("Fac"),
  1033. type: "VALUE",
  1034. color: 0xffa1a1a1,
  1035. default_value: 1.0
  1036. }
  1037. ],
  1038. buttons: []
  1039. },
  1040. {
  1041. id: 0,
  1042. name: _tr("Checker Texture"),
  1043. type: "TEX_CHECKER",
  1044. x: 0,
  1045. y: 0,
  1046. color: 0xff4982a0,
  1047. inputs: [
  1048. {
  1049. id: 0,
  1050. node_id: 0,
  1051. name: _tr("Vector"),
  1052. type: "VECTOR",
  1053. color: 0xff6363c7,
  1054. default_value: f32([0.0, 0.0, 0.0])
  1055. },
  1056. {
  1057. id: 0,
  1058. node_id: 0,
  1059. name: _tr("Color 1"),
  1060. type: "RGBA",
  1061. color: 0xffc7c729,
  1062. default_value: f32([0.8, 0.8, 0.8])
  1063. },
  1064. {
  1065. id: 0,
  1066. node_id: 0,
  1067. name: _tr("Color 2"),
  1068. type: "RGBA",
  1069. color: 0xffc7c729,
  1070. default_value: f32([0.2, 0.2, 0.2])
  1071. },
  1072. {
  1073. id: 0,
  1074. node_id: 0,
  1075. name: _tr("Scale"),
  1076. type: "VALUE",
  1077. color: 0xffa1a1a1,
  1078. default_value: 5.0,
  1079. min: 0.0,
  1080. max: 10.0
  1081. }
  1082. ],
  1083. outputs: [
  1084. {
  1085. id: 0,
  1086. node_id: 0,
  1087. name: _tr("Color"),
  1088. type: "RGBA",
  1089. color: 0xffc7c729,
  1090. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1091. },
  1092. {
  1093. id: 0,
  1094. node_id: 0,
  1095. name: _tr("Fac"),
  1096. type: "VALUE",
  1097. color: 0xffa1a1a1,
  1098. default_value: 1.0
  1099. }
  1100. ],
  1101. buttons: []
  1102. },
  1103. {
  1104. id: 0,
  1105. name: _tr("Curvature Bake"),
  1106. type: "BAKE_CURVATURE",
  1107. x: 0,
  1108. y: 0,
  1109. color: 0xff4982a0,
  1110. inputs: [
  1111. {
  1112. id: 0,
  1113. node_id: 0,
  1114. name: _tr("Strength"),
  1115. type: "VALUE",
  1116. color: 0xffa1a1a1,
  1117. default_value: 1.0,
  1118. min: 0.0,
  1119. max: 2.0
  1120. },
  1121. {
  1122. id: 0,
  1123. node_id: 0,
  1124. name: _tr("Radius"),
  1125. type: "VALUE",
  1126. color: 0xffa1a1a1,
  1127. default_value: 1.0,
  1128. min: 0.0,
  1129. max: 2.0
  1130. },
  1131. {
  1132. id: 0,
  1133. node_id: 0,
  1134. name: _tr("Offset"),
  1135. type: "VALUE",
  1136. color: 0xffa1a1a1,
  1137. default_value: 0.0,
  1138. min: -2.0,
  1139. max: 2.0
  1140. }
  1141. ],
  1142. outputs: [
  1143. {
  1144. id: 0,
  1145. node_id: 0,
  1146. name: _tr("Value"),
  1147. type: "VALUE",
  1148. color: 0xffa1a1a1,
  1149. default_value: 1.0
  1150. }
  1151. ],
  1152. buttons: []
  1153. },
  1154. {
  1155. id: 0,
  1156. name: _tr("Gradient Texture"),
  1157. type: "TEX_GRADIENT",
  1158. x: 0,
  1159. y: 0,
  1160. color: 0xff4982a0,
  1161. inputs: [
  1162. {
  1163. id: 0,
  1164. node_id: 0,
  1165. name: _tr("Vector"),
  1166. type: "VECTOR",
  1167. color: 0xff6363c7,
  1168. default_value: f32([0.0, 0.0, 0.0])
  1169. }
  1170. ],
  1171. outputs: [
  1172. {
  1173. id: 0,
  1174. node_id: 0,
  1175. name: _tr("Color"),
  1176. type: "RGBA",
  1177. color: 0xffc7c729,
  1178. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1179. },
  1180. {
  1181. id: 0,
  1182. node_id: 0,
  1183. name: _tr("Fac"),
  1184. type: "VALUE",
  1185. color: 0xffa1a1a1,
  1186. default_value: 1.0
  1187. }
  1188. ],
  1189. buttons: [
  1190. {
  1191. name: _tr("gradient_type"),
  1192. type: "ENUM",
  1193. // data: ["Linear", "Quadratic", "Easing", "Diagonal", "Radial", "Quadratic Sphere", "Spherical"],
  1194. data: [_tr("Linear"), _tr("Diagonal"), _tr("Radial"), _tr("Spherical")],
  1195. default_value: 0,
  1196. output: 0
  1197. }
  1198. ]
  1199. },
  1200. {
  1201. id: 0,
  1202. name: _tr("Image Texture"),
  1203. type: "TEX_IMAGE",
  1204. x: 0,
  1205. y: 0,
  1206. color: 0xff4982a0,
  1207. inputs: [
  1208. {
  1209. id: 0,
  1210. node_id: 0,
  1211. name: _tr("Vector"),
  1212. type: "VECTOR",
  1213. color: 0xff6363c7,
  1214. default_value: f32([0.0, 0.0, 0.0])
  1215. }
  1216. ],
  1217. outputs: [
  1218. {
  1219. id: 0,
  1220. node_id: 0,
  1221. name: _tr("Color"),
  1222. type: "RGBA",
  1223. color: 0xffc7c729,
  1224. default_value: f32([0.0, 0.0, 0.0, 1.0])
  1225. },
  1226. {
  1227. id: 0,
  1228. node_id: 0,
  1229. name: _tr("Alpha"),
  1230. type: "VALUE",
  1231. color: 0xffa1a1a1,
  1232. default_value: 1.0
  1233. }
  1234. ],
  1235. buttons: [
  1236. {
  1237. name: _tr("File"),
  1238. type: "ENUM",
  1239. default_value: 0,
  1240. data: ""
  1241. },
  1242. {
  1243. name: _tr("Color Space"),
  1244. type: "ENUM",
  1245. default_value: 0,
  1246. data: [_tr("Auto"), _tr("Linear"), _tr("sRGB"), _tr("DirectX Normal Map")]
  1247. }
  1248. ]
  1249. },
  1250. {
  1251. id: 0,
  1252. name: _tr("Magic Texture"),
  1253. type: "TEX_MAGIC",
  1254. x: 0,
  1255. y: 0,
  1256. color: 0xff4982a0,
  1257. inputs: [
  1258. {
  1259. id: 0,
  1260. node_id: 0,
  1261. name: _tr("Vector"),
  1262. type: "VECTOR",
  1263. color: 0xff6363c7,
  1264. default_value: f32([0.0, 0.0, 0.0])
  1265. },
  1266. {
  1267. id: 0,
  1268. node_id: 0,
  1269. name: _tr("Scale"),
  1270. type: "VALUE",
  1271. color: 0xffa1a1a1,
  1272. default_value: 5.0,
  1273. min: 0.0,
  1274. max: 10.0
  1275. }
  1276. ],
  1277. outputs: [
  1278. {
  1279. id: 0,
  1280. node_id: 0,
  1281. name: _tr("Color"),
  1282. type: "RGBA",
  1283. color: 0xffc7c729,
  1284. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1285. },
  1286. {
  1287. id: 0,
  1288. node_id: 0,
  1289. name: _tr("Fac"),
  1290. type: "VALUE",
  1291. color: 0xffa1a1a1,
  1292. default_value: 1.0
  1293. }
  1294. ],
  1295. buttons: []
  1296. },
  1297. {
  1298. id: 0,
  1299. name: _tr("Musgrave Texture"),
  1300. type: "TEX_MUSGRAVE",
  1301. x: 0,
  1302. y: 0,
  1303. color: 0xff4982a0,
  1304. inputs: [
  1305. {
  1306. id: 0,
  1307. node_id: 0,
  1308. name: _tr("Vector"),
  1309. type: "VECTOR",
  1310. color: 0xff6363c7,
  1311. default_value: f32([0.0, 0.0, 0.0])
  1312. },
  1313. {
  1314. id: 0,
  1315. node_id: 0,
  1316. name: _tr("Scale"),
  1317. type: "VALUE",
  1318. color: 0xffa1a1a1,
  1319. default_value: 5.0,
  1320. min: 0.0,
  1321. max: 10.0
  1322. }
  1323. ],
  1324. outputs: [
  1325. {
  1326. id: 0,
  1327. node_id: 0,
  1328. name: _tr("Height"),
  1329. type: "VALUE",
  1330. color: 0xffa1a1a1,
  1331. default_value: 1.0
  1332. }
  1333. ],
  1334. buttons: []
  1335. },
  1336. {
  1337. id: 0,
  1338. name: _tr("Noise Texture"),
  1339. type: "TEX_NOISE",
  1340. x: 0,
  1341. y: 0,
  1342. color: 0xff4982a0,
  1343. inputs: [
  1344. {
  1345. id: 0,
  1346. node_id: 0,
  1347. name: _tr("Vector"),
  1348. type: "VECTOR",
  1349. color: 0xff6363c7,
  1350. default_value: f32([0.0, 0.0, 0.0])
  1351. },
  1352. {
  1353. id: 0,
  1354. node_id: 0,
  1355. name: _tr("Scale"),
  1356. type: "VALUE",
  1357. color: 0xffa1a1a1,
  1358. default_value: 5.0,
  1359. min: 0.0,
  1360. max: 10.0
  1361. }
  1362. ],
  1363. outputs: [
  1364. {
  1365. id: 0,
  1366. node_id: 0,
  1367. name: _tr("Color"),
  1368. type: "RGBA",
  1369. color: 0xffc7c729,
  1370. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1371. },
  1372. {
  1373. id: 0,
  1374. node_id: 0,
  1375. name: _tr("Fac"),
  1376. type: "VALUE",
  1377. color: 0xffa1a1a1,
  1378. default_value: 1.0
  1379. }
  1380. ],
  1381. buttons: []
  1382. },
  1383. {
  1384. id: 0,
  1385. name: _tr("Voronoi Texture"),
  1386. type: "TEX_VORONOI",
  1387. x: 0,
  1388. y: 0,
  1389. color: 0xff4982a0,
  1390. inputs: [
  1391. {
  1392. id: 0,
  1393. node_id: 0,
  1394. name: _tr("Vector"),
  1395. type: "VECTOR",
  1396. color: 0xff6363c7,
  1397. default_value: f32([0.0, 0.0, 0.0])
  1398. },
  1399. {
  1400. id: 0,
  1401. node_id: 0,
  1402. name: _tr("Scale"),
  1403. type: "VALUE",
  1404. color: 0xffa1a1a1,
  1405. default_value: 5.0,
  1406. min: 0.0,
  1407. max: 10.0
  1408. }
  1409. ],
  1410. outputs: [
  1411. {
  1412. id: 0,
  1413. node_id: 0,
  1414. name: _tr("Color"),
  1415. type: "RGBA",
  1416. color: 0xffc7c729,
  1417. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1418. },
  1419. {
  1420. id: 0,
  1421. node_id: 0,
  1422. name: _tr("Fac"),
  1423. type: "VALUE",
  1424. color: 0xffa1a1a1,
  1425. default_value: 1.0
  1426. }
  1427. ],
  1428. buttons: [
  1429. {
  1430. name: _tr("coloring"),
  1431. type: "ENUM",
  1432. data: [_tr("Intensity"), _tr("Cells")],
  1433. default_value: 0,
  1434. output: 0
  1435. }
  1436. ]
  1437. },
  1438. {
  1439. id: 0,
  1440. name: _tr("Wave Texture"),
  1441. type: "TEX_WAVE",
  1442. x: 0,
  1443. y: 0,
  1444. color: 0xff4982a0,
  1445. inputs: [
  1446. {
  1447. id: 0,
  1448. node_id: 0,
  1449. name: _tr("Vector"),
  1450. type: "VECTOR",
  1451. color: 0xff6363c7,
  1452. default_value: f32([0.0, 0.0, 0.0])
  1453. },
  1454. {
  1455. id: 0,
  1456. node_id: 0,
  1457. name: _tr("Scale"),
  1458. type: "VALUE",
  1459. color: 0xffa1a1a1,
  1460. default_value: 5.0,
  1461. min: 0.0,
  1462. max: 10.0
  1463. }
  1464. ],
  1465. outputs: [
  1466. {
  1467. id: 0,
  1468. node_id: 0,
  1469. name: _tr("Color"),
  1470. type: "RGBA",
  1471. color: 0xffc7c729,
  1472. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1473. },
  1474. {
  1475. id: 0,
  1476. node_id: 0,
  1477. name: _tr("Fac"),
  1478. type: "VALUE",
  1479. color: 0xffa1a1a1,
  1480. default_value: 1.0
  1481. }
  1482. ],
  1483. buttons: []
  1484. }
  1485. ],
  1486. [ // Color
  1487. {
  1488. id: 0,
  1489. name: _tr("Blur"),
  1490. type: "BLUR", // extension
  1491. x: 0,
  1492. y: 0,
  1493. color: 0xff448c6d,
  1494. inputs: [
  1495. {
  1496. id: 0,
  1497. node_id: 0,
  1498. name: _tr("Color"),
  1499. type: "RGBA",
  1500. color: 0xffc7c729,
  1501. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1502. },
  1503. {
  1504. id: 0,
  1505. node_id: 0,
  1506. name: _tr("Strength"),
  1507. type: "VALUE",
  1508. color: 0xffa1a1a1,
  1509. default_value: 0.5
  1510. }
  1511. ],
  1512. outputs: [
  1513. {
  1514. id: 0,
  1515. node_id: 0,
  1516. name: _tr("Color"),
  1517. type: "RGBA",
  1518. color: 0xffc7c729,
  1519. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1520. }
  1521. ],
  1522. buttons: []
  1523. },
  1524. {
  1525. id: 0,
  1526. name: _tr("Bright/Contrast"),
  1527. type: "BRIGHTCONTRAST",
  1528. x: 0,
  1529. y: 0,
  1530. color: 0xff448c6d,
  1531. inputs: [
  1532. {
  1533. id: 0,
  1534. node_id: 0,
  1535. name: _tr("Color"),
  1536. type: "RGBA",
  1537. color: 0xffc7c729,
  1538. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1539. },
  1540. {
  1541. id: 0,
  1542. node_id: 0,
  1543. name: _tr("Bright"),
  1544. type: "VALUE",
  1545. color: 0xffa1a1a1,
  1546. default_value: 0.0
  1547. },
  1548. {
  1549. id: 0,
  1550. node_id: 0,
  1551. name: _tr("Contrast"),
  1552. type: "VALUE",
  1553. color: 0xffa1a1a1,
  1554. default_value: 0.0
  1555. }
  1556. ],
  1557. outputs: [
  1558. {
  1559. id: 0,
  1560. node_id: 0,
  1561. name: _tr("Color"),
  1562. type: "RGBA",
  1563. color: 0xffc7c729,
  1564. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1565. }
  1566. ],
  1567. buttons: []
  1568. },
  1569. {
  1570. id: 0,
  1571. name: _tr("Gamma"),
  1572. type: "GAMMA",
  1573. x: 0,
  1574. y: 0,
  1575. color: 0xff448c6d,
  1576. inputs: [
  1577. {
  1578. id: 0,
  1579. node_id: 0,
  1580. name: _tr("Color"),
  1581. type: "RGBA",
  1582. color: 0xffc7c729,
  1583. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1584. },
  1585. {
  1586. id: 0,
  1587. node_id: 0,
  1588. name: _tr("Gamma"),
  1589. type: "VALUE",
  1590. color: 0xffa1a1a1,
  1591. default_value: 1.0
  1592. }
  1593. ],
  1594. outputs: [
  1595. {
  1596. id: 0,
  1597. node_id: 0,
  1598. name: _tr("Color"),
  1599. type: "RGBA",
  1600. color: 0xffc7c729,
  1601. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1602. }
  1603. ],
  1604. buttons: []
  1605. },
  1606. {
  1607. id: 0,
  1608. name: _tr("Hue/Saturation"),
  1609. type: "HUE_SAT",
  1610. x: 0,
  1611. y: 0,
  1612. color: 0xff448c6d,
  1613. inputs: [
  1614. {
  1615. id: 0,
  1616. node_id: 0,
  1617. name: _tr("Hue"),
  1618. type: "VALUE",
  1619. color: 0xffa1a1a1,
  1620. default_value: 0.5
  1621. },
  1622. {
  1623. id: 0,
  1624. node_id: 0,
  1625. name: _tr("Saturation"),
  1626. type: "VALUE",
  1627. color: 0xffa1a1a1,
  1628. default_value: 1.0
  1629. },
  1630. {
  1631. id: 0,
  1632. node_id: 0,
  1633. name: _tr("Value"),
  1634. type: "VALUE",
  1635. color: 0xffa1a1a1,
  1636. default_value: 1.0
  1637. },
  1638. {
  1639. id: 0,
  1640. node_id: 0,
  1641. name: _tr("Fac"),
  1642. type: "VALUE",
  1643. color: 0xffa1a1a1,
  1644. default_value: 1.0
  1645. },
  1646. {
  1647. id: 0,
  1648. node_id: 0,
  1649. name: _tr("Color"),
  1650. type: "RGBA",
  1651. color: 0xffc7c729,
  1652. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1653. }
  1654. ],
  1655. outputs: [
  1656. {
  1657. id: 0,
  1658. node_id: 0,
  1659. name: _tr("Color"),
  1660. type: "RGBA",
  1661. color: 0xffc7c729,
  1662. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1663. }
  1664. ],
  1665. buttons: []
  1666. },
  1667. {
  1668. id: 0,
  1669. name: _tr("Invert"),
  1670. type: "INVERT",
  1671. x: 0,
  1672. y: 0,
  1673. color: 0xff448c6d,
  1674. inputs: [
  1675. {
  1676. id: 0,
  1677. node_id: 0,
  1678. name: _tr("Fac"),
  1679. type: "VALUE",
  1680. color: 0xffa1a1a1,
  1681. default_value: 1.0
  1682. },
  1683. {
  1684. id: 0,
  1685. node_id: 0,
  1686. name: _tr("Color"),
  1687. type: "RGBA",
  1688. color: 0xffc7c729,
  1689. default_value: f32([0.0, 0.0, 0.0, 1.0])
  1690. }
  1691. ],
  1692. outputs: [
  1693. {
  1694. id: 0,
  1695. node_id: 0,
  1696. name: _tr("Color"),
  1697. type: "RGBA",
  1698. color: 0xffc7c729,
  1699. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1700. }
  1701. ],
  1702. buttons: []
  1703. },
  1704. {
  1705. id: 0,
  1706. name: _tr("MixRGB"),
  1707. type: "MIX_RGB",
  1708. x: 0,
  1709. y: 0,
  1710. color: 0xff448c6d,
  1711. inputs: [
  1712. {
  1713. id: 0,
  1714. node_id: 0,
  1715. name: _tr("Fac"),
  1716. type: "VALUE",
  1717. color: 0xffa1a1a1,
  1718. default_value: 0.5
  1719. },
  1720. {
  1721. id: 0,
  1722. node_id: 0,
  1723. name: _tr("Color 1"),
  1724. type: "RGBA",
  1725. color: 0xffc7c729,
  1726. default_value: f32([0.5, 0.5, 0.5, 1.0])
  1727. },
  1728. {
  1729. id: 0,
  1730. node_id: 0,
  1731. name: _tr("Color 2"),
  1732. type: "RGBA",
  1733. color: 0xffc7c729,
  1734. default_value: f32([0.5, 0.5, 0.5, 1.0])
  1735. }
  1736. ],
  1737. outputs: [
  1738. {
  1739. id: 0,
  1740. node_id: 0,
  1741. name: _tr("Color"),
  1742. type: "RGBA",
  1743. color: 0xffc7c729,
  1744. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1745. }
  1746. ],
  1747. buttons: [
  1748. {
  1749. name: _tr("blend_type"),
  1750. type: "ENUM",
  1751. data: [_tr("Mix"), _tr("Darken"), _tr("Multiply"), _tr("Burn"), _tr("Lighten"), _tr("Screen"), _tr("Dodge"), _tr("Add"), _tr("Overlay"), _tr("Soft Light"), _tr("Linear Light"), _tr("Difference"), _tr("Subtract"), _tr("Divide"), _tr("Hue"), _tr("Saturation"), _tr("Color"), _tr("Value")],
  1752. default_value: 0,
  1753. output: 0
  1754. },
  1755. {
  1756. name: _tr("use_clamp"),
  1757. type: "BOOL",
  1758. default_value: false,
  1759. output: 0
  1760. }
  1761. ]
  1762. },
  1763. {
  1764. id: 0,
  1765. name: _tr("Quantize"),
  1766. type: "QUANTIZE",
  1767. x: 0,
  1768. y: 0,
  1769. color: 0xff448c6d,
  1770. inputs: [
  1771. {
  1772. id: 0,
  1773. node_id: 0,
  1774. name: _tr("Stength"),
  1775. type: "VALUE",
  1776. color: 0xffa1a1a1,
  1777. default_value: 0.1,
  1778. min: 0,
  1779. max: 1
  1780. },
  1781. {
  1782. id: 0,
  1783. node_id: 0,
  1784. name: _tr("Color"),
  1785. type: "RGBA",
  1786. color: 0xffc7c729,
  1787. default_value: f32([0.0, 0.0, 0.0, 1.0])
  1788. }
  1789. ],
  1790. outputs: [
  1791. {
  1792. id: 0,
  1793. node_id: 0,
  1794. name: _tr("Color"),
  1795. type: "RGBA",
  1796. color: 0xffc7c729,
  1797. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1798. }
  1799. ],
  1800. buttons: []
  1801. },
  1802. {
  1803. id: 0,
  1804. name: _tr("Warp"),
  1805. type: "DIRECT_WARP", // extension
  1806. x: 0,
  1807. y: 0,
  1808. color: 0xff448c6d,
  1809. inputs: [
  1810. {
  1811. id: 0,
  1812. node_id: 0,
  1813. name: _tr("Color"),
  1814. type: "RGBA",
  1815. color: 0xffc7c729,
  1816. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1817. },
  1818. {
  1819. id: 0,
  1820. node_id: 0,
  1821. name: _tr("Angle"),
  1822. type: "VALUE",
  1823. color: 0xffa1a1a1,
  1824. default_value: 0.0,
  1825. min: 0.0,
  1826. max: 360.0
  1827. },
  1828. {
  1829. id: 0,
  1830. node_id: 0,
  1831. name: _tr("Mask"),
  1832. type: "VALUE",
  1833. color: 0xffa1a1a1,
  1834. default_value: 0.5,
  1835. min: 0.0,
  1836. max: 1.0
  1837. }
  1838. ],
  1839. outputs: [
  1840. {
  1841. id: 0,
  1842. node_id: 0,
  1843. name: _tr("Color"),
  1844. type: "RGBA",
  1845. color: 0xffc7c729,
  1846. default_value: f32([0.8, 0.8, 0.8, 1.0])
  1847. }
  1848. ],
  1849. buttons: []
  1850. }
  1851. ],
  1852. [ // Vector
  1853. {
  1854. id: 0,
  1855. name: _tr("Bump"),
  1856. type: "BUMP",
  1857. x: 0,
  1858. y: 0,
  1859. color: 0xff522c99,
  1860. inputs: [
  1861. {
  1862. id: 0,
  1863. node_id: 0,
  1864. name: _tr("Strength"),
  1865. type: "VALUE",
  1866. color: 0xffa1a1a1,
  1867. default_value: 1.0
  1868. },
  1869. {
  1870. id: 0,
  1871. node_id: 0,
  1872. name: _tr("Distance"),
  1873. type: "VALUE",
  1874. color: 0xffa1a1a1,
  1875. default_value: 0.0
  1876. },
  1877. {
  1878. id: 0,
  1879. node_id: 0,
  1880. name: _tr("Height"),
  1881. type: "VALUE",
  1882. color: 0xffa1a1a1,
  1883. default_value: 1.0
  1884. },
  1885. {
  1886. id: 0,
  1887. node_id: 0,
  1888. name: _tr("Normal"),
  1889. type: "VECTOR",
  1890. color: 0xff6363c7,
  1891. default_value: f32([0.0, 0.0, 0.0])
  1892. }
  1893. ],
  1894. outputs: [
  1895. {
  1896. id: 0,
  1897. node_id: 0,
  1898. name: _tr("Normal Map"),
  1899. type: "VECTOR",
  1900. color: -10238109,
  1901. default_value: f32([0.0, 0.0, 0.0])
  1902. }
  1903. ],
  1904. buttons: []
  1905. },
  1906. {
  1907. id: 0,
  1908. name: _tr("Mapping"),
  1909. type: "MAPPING",
  1910. x: 0,
  1911. y: 0,
  1912. color: 0xff522c99,
  1913. inputs: [
  1914. {
  1915. id: 0,
  1916. node_id: 0,
  1917. name: _tr("Vector"),
  1918. type: "VECTOR",
  1919. color: 0xff6363c7,
  1920. default_value: f32([0.0, 0.0, 0.0])
  1921. },
  1922. {
  1923. id: 0,
  1924. node_id: 0,
  1925. name: _tr("Location"),
  1926. type: "VECTOR",
  1927. color: 0xff6363c7,
  1928. default_value: f32([0.0, 0.0, 0.0]),
  1929. display: 1
  1930. },
  1931. {
  1932. id: 0,
  1933. node_id: 0,
  1934. name: _tr("Rotation"),
  1935. type: "VECTOR",
  1936. color: 0xff6363c7,
  1937. default_value: f32([0.0, 0.0, 0.0]),
  1938. max: 360.0,
  1939. display: 1
  1940. },
  1941. {
  1942. id: 0,
  1943. node_id: 0,
  1944. name: _tr("Scale"),
  1945. type: "VECTOR",
  1946. color: 0xff6363c7,
  1947. default_value: f32([1.0, 1.0, 1.0]),
  1948. display: 1
  1949. }
  1950. ],
  1951. outputs: [
  1952. {
  1953. id: 0,
  1954. node_id: 0,
  1955. name: _tr("Vector"),
  1956. type: "VECTOR",
  1957. color: 0xff6363c7,
  1958. default_value: f32([0.0, 0.0, 0.0])
  1959. }
  1960. ],
  1961. buttons: []
  1962. },
  1963. {
  1964. id: 0,
  1965. name: _tr("Mix Normal Map"),
  1966. type: "MIX_NORMAL_MAP",
  1967. x: 0,
  1968. y: 0,
  1969. color: 0xff522c99,
  1970. inputs: [
  1971. {
  1972. id: 0,
  1973. node_id: 0,
  1974. name: _tr("Normal Map 1"),
  1975. type: "VECTOR",
  1976. color: -10238109,
  1977. default_value: f32([0.5, 0.5, 1.0])
  1978. },
  1979. {
  1980. id: 0,
  1981. node_id: 0,
  1982. name: _tr("Normal Map 2"),
  1983. type: "VECTOR",
  1984. color: -10238109,
  1985. default_value: f32([0.5, 0.5, 1.0])
  1986. }
  1987. ],
  1988. outputs: [
  1989. {
  1990. id: 0,
  1991. node_id: 0,
  1992. name: _tr("Normal Map"),
  1993. type: "VECTOR",
  1994. color: -10238109,
  1995. default_value: f32([0.5, 0.5, 1.0])
  1996. }
  1997. ],
  1998. buttons: [
  1999. {
  2000. name: _tr("blend_type"),
  2001. type: "ENUM",
  2002. data: [_tr("Partial Derivative"), _tr("Whiteout"), _tr("Reoriented")],
  2003. default_value: 0,
  2004. output: 0
  2005. }
  2006. ]
  2007. },
  2008. {
  2009. id: 0,
  2010. name: _tr("Normal"),
  2011. type: "NORMAL",
  2012. x: 0,
  2013. y: 0,
  2014. color: 0xff522c99,
  2015. inputs: [
  2016. {
  2017. id: 0,
  2018. node_id: 0,
  2019. name: _tr("Normal"),
  2020. type: "VECTOR",
  2021. color: 0xff6363c7,
  2022. default_value: f32([0.0, 0.0, 0.0])
  2023. }
  2024. ],
  2025. outputs: [
  2026. {
  2027. id: 0,
  2028. node_id: 0,
  2029. name: _tr("Normal"),
  2030. type: "VECTOR",
  2031. color: 0xff6363c7,
  2032. default_value: f32([0.0, 0.0, 0.0])
  2033. },
  2034. {
  2035. id: 0,
  2036. node_id: 0,
  2037. name: _tr("Dot"),
  2038. type: "VALUE",
  2039. color: 0xffa1a1a1,
  2040. default_value: 1.0
  2041. }
  2042. ],
  2043. buttons: [
  2044. {
  2045. name: _tr("Vector"),
  2046. type: "VECTOR",
  2047. default_value: f32([0.0, 0.0, 0.0]),
  2048. output: 0
  2049. }
  2050. ]
  2051. },
  2052. {
  2053. id: 0,
  2054. name: _tr("Normal Map"),
  2055. type: "NORMAL_MAP",
  2056. x: 0,
  2057. y: 0,
  2058. color: 0xff522c99,
  2059. inputs: [
  2060. {
  2061. id: 0,
  2062. node_id: 0,
  2063. name: _tr("Stength"),
  2064. type: "VALUE",
  2065. color: 0xffa1a1a1,
  2066. default_value: 1.0,
  2067. min: 0.0,
  2068. max: 2.0
  2069. },
  2070. {
  2071. id: 0,
  2072. node_id: 0,
  2073. name: _tr("Normal Map"),
  2074. type: "VECTOR",
  2075. color: -10238109,
  2076. default_value: f32([0.5, 0.5, 1.0])
  2077. }
  2078. ],
  2079. outputs: [
  2080. {
  2081. id: 0,
  2082. node_id: 0,
  2083. name: _tr("Normal Map"),
  2084. type: "VECTOR",
  2085. color: -10238109,
  2086. default_value: f32([0.5, 0.5, 1.0])
  2087. }
  2088. ],
  2089. buttons: []
  2090. },
  2091. {
  2092. id: 0,
  2093. name: _tr("Vector Curves"),
  2094. type: "CURVE_VEC",
  2095. x: 0,
  2096. y: 0,
  2097. color: 0xff522c99,
  2098. inputs: [
  2099. {
  2100. id: 0,
  2101. node_id: 0,
  2102. name: _tr("Fac"),
  2103. type: "VALUE",
  2104. color: 0xffa1a1a1,
  2105. default_value: 1.0
  2106. },
  2107. {
  2108. id: 0,
  2109. node_id: 0,
  2110. name: _tr("Vector"),
  2111. type: "VECTOR",
  2112. color: 0xff6363c7,
  2113. default_value: f32([0.0, 0.0, 0.0])
  2114. }
  2115. ],
  2116. outputs: [
  2117. {
  2118. id: 0,
  2119. node_id: 0,
  2120. name: _tr("Vector"),
  2121. type: "VECTOR",
  2122. color: 0xff6363c7,
  2123. default_value: f32([0.0, 0.0, 0.0])
  2124. }
  2125. ],
  2126. buttons: [
  2127. {
  2128. name: "arm.shader.NodesMaterial.vectorCurvesButton",
  2129. type: "CUSTOM",
  2130. default_value: [[f32([0.0, 0.0]), f32([0.0, 0.0])], [f32([0.0, 0.0]), f32([0.0, 0.0])], [f32([0.0, 0.0]), f32([0.0, 0.0])]],
  2131. output: 0,
  2132. height: 8.5
  2133. }
  2134. ]
  2135. }
  2136. ],
  2137. [ // Converter
  2138. {
  2139. id: 0,
  2140. name: _tr("Clamp"),
  2141. type: "CLAMP",
  2142. x: 0,
  2143. y: 0,
  2144. color: 0xff62676d,
  2145. inputs: [
  2146. {
  2147. id: 0,
  2148. node_id: 0,
  2149. name: _tr("Value"),
  2150. type: "VALUE",
  2151. color: 0xffa1a1a1,
  2152. default_value: 0.5
  2153. },
  2154. {
  2155. id: 0,
  2156. node_id: 0,
  2157. name: _tr("Min"),
  2158. type: "VALUE",
  2159. color: 0xffa1a1a1,
  2160. default_value: 0.0
  2161. },
  2162. {
  2163. id: 0,
  2164. node_id: 0,
  2165. name: _tr("Max"),
  2166. type: "VALUE",
  2167. color: 0xffa1a1a1,
  2168. default_value: 1.0
  2169. }
  2170. ],
  2171. outputs: [
  2172. {
  2173. id: 0,
  2174. node_id: 0,
  2175. name: _tr("Value"),
  2176. type: "VALUE",
  2177. color: 0xffa1a1a1,
  2178. default_value: 0.0
  2179. }
  2180. ],
  2181. buttons: [
  2182. {
  2183. name: _tr("operation"),
  2184. type: "ENUM",
  2185. data: [_tr("Min Max"), _tr("Range")],
  2186. default_value: 0,
  2187. output: 0
  2188. }
  2189. ]
  2190. },
  2191. {
  2192. id: 0,
  2193. name: _tr("Color Ramp"),
  2194. type: "VALTORGB",
  2195. x: 0,
  2196. y: 0,
  2197. color: 0xff62676d,
  2198. inputs: [
  2199. {
  2200. id: 0,
  2201. node_id: 0,
  2202. name: _tr("Fac"),
  2203. type: "VALUE",
  2204. color: 0xffa1a1a1,
  2205. default_value: 0.5
  2206. }
  2207. ],
  2208. outputs: [
  2209. {
  2210. id: 0,
  2211. node_id: 0,
  2212. name: _tr("Color"),
  2213. type: "RGBA",
  2214. color: 0xffc7c729,
  2215. default_value: f32([0.0, 0.0, 0.0, 1.0])
  2216. },
  2217. {
  2218. id: 0,
  2219. node_id: 0,
  2220. name: _tr("Alpha"),
  2221. type: "VALUE",
  2222. color: 0xffa1a1a1,
  2223. default_value: 0.0
  2224. }
  2225. ],
  2226. buttons: [
  2227. {
  2228. name: "arm.shader.NodesMaterial.colorRampButton",
  2229. type: "CUSTOM",
  2230. default_value: [f32([1.0, 1.0, 1.0, 1.0, 0.0])],
  2231. data: 0,
  2232. output: 0,
  2233. height: 4.5
  2234. }
  2235. ]
  2236. },
  2237. {
  2238. id: 0,
  2239. name: _tr("Color Mask"),
  2240. type: "COLMASK",
  2241. x: 0,
  2242. y: 0,
  2243. color: 0xff62676d,
  2244. inputs: [
  2245. {
  2246. id: 0,
  2247. node_id: 0,
  2248. name: _tr("Color"),
  2249. type: "RGBA",
  2250. color: 0xffc7c729,
  2251. default_value: f32([0.8, 0.8, 0.8, 1.0])
  2252. },
  2253. {
  2254. id: 0,
  2255. node_id: 0,
  2256. name: _tr("Mask Color"),
  2257. type: "RGBA",
  2258. color: 0xffc7c729,
  2259. default_value: f32([0.8, 0.8, 0.8, 1.0])
  2260. },
  2261. {
  2262. id: 0,
  2263. node_id: 0,
  2264. name: _tr("Radius"),
  2265. type: "VALUE",
  2266. color: 0xffa1a1a1,
  2267. default_value: 0.1,
  2268. min: 0.0,
  2269. max: 1.74
  2270. },
  2271. {
  2272. id: 0,
  2273. node_id: 0,
  2274. name: _tr("Fuzziness"),
  2275. type: "VALUE",
  2276. color: 0xffa1a1a1,
  2277. default_value: 0.0
  2278. }
  2279. ],
  2280. outputs: [
  2281. {
  2282. id: 0,
  2283. node_id: 0,
  2284. name: _tr("Mask"),
  2285. type: "VALUE",
  2286. color: 0xffa1a1a1,
  2287. default_value: 0.0
  2288. }
  2289. ],
  2290. buttons: []
  2291. },
  2292. {
  2293. id: 0,
  2294. name: _tr("Combine HSV"),
  2295. type: "COMBHSV",
  2296. x: 0,
  2297. y: 0,
  2298. color: 0xff62676d,
  2299. inputs: [
  2300. {
  2301. id: 0,
  2302. node_id: 0,
  2303. name: _tr("H"),
  2304. type: "VALUE",
  2305. color: 0xffa1a1a1,
  2306. default_value: 0.0
  2307. },
  2308. {
  2309. id: 0,
  2310. node_id: 0,
  2311. name: _tr("S"),
  2312. type: "VALUE",
  2313. color: 0xffa1a1a1,
  2314. default_value: 0.0
  2315. },
  2316. {
  2317. id: 0,
  2318. node_id: 0,
  2319. name: _tr("V"),
  2320. type: "VALUE",
  2321. color: 0xffa1a1a1,
  2322. default_value: 0.0
  2323. }
  2324. ],
  2325. outputs: [
  2326. {
  2327. id: 0,
  2328. node_id: 0,
  2329. name: _tr("Color"),
  2330. type: "RGBA",
  2331. color: 0xffc7c729,
  2332. default_value: f32([0.8, 0.8, 0.8, 1.0])
  2333. }
  2334. ],
  2335. buttons: []
  2336. },
  2337. {
  2338. id: 0,
  2339. name: _tr("Combine RGB"),
  2340. type: "COMBRGB",
  2341. x: 0,
  2342. y: 0,
  2343. color: 0xff62676d,
  2344. inputs: [
  2345. {
  2346. id: 0,
  2347. node_id: 0,
  2348. name: _tr("R"),
  2349. type: "VALUE",
  2350. color: 0xffa1a1a1,
  2351. default_value: 0.0
  2352. },
  2353. {
  2354. id: 0,
  2355. node_id: 0,
  2356. name: _tr("G"),
  2357. type: "VALUE",
  2358. color: 0xffa1a1a1,
  2359. default_value: 0.0
  2360. },
  2361. {
  2362. id: 0,
  2363. node_id: 0,
  2364. name: _tr("B"),
  2365. type: "VALUE",
  2366. color: 0xffa1a1a1,
  2367. default_value: 0.0
  2368. }
  2369. ],
  2370. outputs: [
  2371. {
  2372. id: 0,
  2373. node_id: 0,
  2374. name: _tr("Color"),
  2375. type: "RGBA",
  2376. color: 0xffc7c729,
  2377. default_value: f32([0.8, 0.8, 0.8, 1.0])
  2378. }
  2379. ],
  2380. buttons: []
  2381. },
  2382. {
  2383. id: 0,
  2384. name: _tr("Combine XYZ"),
  2385. type: "COMBXYZ",
  2386. x: 0,
  2387. y: 0,
  2388. color: 0xff62676d,
  2389. inputs: [
  2390. {
  2391. id: 0,
  2392. node_id: 0,
  2393. name: _tr("X"),
  2394. type: "VALUE",
  2395. color: 0xffa1a1a1,
  2396. default_value: 0.0
  2397. },
  2398. {
  2399. id: 0,
  2400. node_id: 0,
  2401. name: _tr("Y"),
  2402. type: "VALUE",
  2403. color: 0xffa1a1a1,
  2404. default_value: 0.0
  2405. },
  2406. {
  2407. id: 0,
  2408. node_id: 0,
  2409. name: _tr("Z"),
  2410. type: "VALUE",
  2411. color: 0xffa1a1a1,
  2412. default_value: 0.0
  2413. }
  2414. ],
  2415. outputs: [
  2416. {
  2417. id: 0,
  2418. node_id: 0,
  2419. name: _tr("Vector"),
  2420. type: "VECTOR",
  2421. color: 0xff6363c7,
  2422. default_value: f32([0.0, 0.0, 0.0])
  2423. }
  2424. ],
  2425. buttons: []
  2426. },
  2427. {
  2428. id: 0,
  2429. name: _tr("Map Range"),
  2430. type: "MAPRANGE",
  2431. x: 0,
  2432. y: 0,
  2433. color: 0xff62676d,
  2434. inputs: [
  2435. {
  2436. id: 0,
  2437. node_id: 0,
  2438. name: _tr("Value"),
  2439. type: "VALUE",
  2440. color: 0xffa1a1a1,
  2441. default_value: 0.5
  2442. },
  2443. {
  2444. id: 0,
  2445. node_id: 0,
  2446. name: _tr("From Min"),
  2447. type: "VALUE",
  2448. color: 0xffa1a1a1,
  2449. default_value: 0.0
  2450. },
  2451. {
  2452. id: 0,
  2453. node_id: 0,
  2454. name: _tr("From Max"),
  2455. type: "VALUE",
  2456. color: 0xffa1a1a1,
  2457. default_value: 1.0
  2458. },
  2459. {
  2460. id: 0,
  2461. node_id: 0,
  2462. name: _tr("To Min"),
  2463. type: "VALUE",
  2464. color: 0xffa1a1a1,
  2465. default_value: 0.0
  2466. },
  2467. {
  2468. id: 0,
  2469. node_id: 0,
  2470. name: _tr("To Max"),
  2471. type: "VALUE",
  2472. color: 0xffa1a1a1,
  2473. default_value: 1.0
  2474. }
  2475. ],
  2476. outputs: [
  2477. {
  2478. id: 0,
  2479. node_id: 0,
  2480. name: _tr("Value"),
  2481. type: "VALUE",
  2482. color: 0xffa1a1a1,
  2483. default_value: 0.0
  2484. }
  2485. ],
  2486. buttons: [
  2487. {
  2488. name: _tr("use_clamp"),
  2489. type: "BOOL",
  2490. default_value: false,
  2491. output: 0
  2492. }
  2493. ]
  2494. },
  2495. {
  2496. id: 0,
  2497. name: _tr("Math"),
  2498. type: "MATH",
  2499. x: 0,
  2500. y: 0,
  2501. color: 0xff62676d,
  2502. inputs: [
  2503. {
  2504. id: 0,
  2505. node_id: 0,
  2506. name: _tr("Value"),
  2507. type: "VALUE",
  2508. color: 0xffa1a1a1,
  2509. default_value: 0.5
  2510. },
  2511. {
  2512. id: 0,
  2513. node_id: 0,
  2514. name: _tr("Value"),
  2515. type: "VALUE",
  2516. color: 0xffa1a1a1,
  2517. default_value: 0.5
  2518. }
  2519. ],
  2520. outputs: [
  2521. {
  2522. id: 0,
  2523. node_id: 0,
  2524. name: _tr("Value"),
  2525. type: "VALUE",
  2526. color: 0xffa1a1a1,
  2527. default_value: 0.0
  2528. }
  2529. ],
  2530. buttons: [
  2531. {
  2532. name: _tr("operation"),
  2533. type: "ENUM",
  2534. data: [_tr("Add"), _tr("Subtract"), _tr("Multiply"), _tr("Divide"), _tr("Power"), _tr("Logarithm"), _tr("Square Root"), _tr("Inverse Square Root"), _tr("Absolute"), _tr("Exponent"), _tr("Minimum"), _tr("Maximum"), _tr("Less Than"), _tr("Greater Than"), _tr("Sign"), _tr("Round"), _tr("Floor"), _tr("Ceil"), _tr("Truncate"), _tr("Fraction"), _tr("Modulo"), _tr("Snap"), _tr("Ping-Pong"), _tr("Sine"), _tr("Cosine"), _tr("Tangent"), _tr("Arcsine"), _tr("Arccosine"), _tr("Arctangent"), _tr("Arctan2"), _tr("Hyperbolic Sine"), _tr("Hyperbolic Cosine"), _tr("Hyperbolic Tangent"), _tr("To Radians"), _tr("To Degrees")],
  2535. default_value: 0,
  2536. output: 0
  2537. },
  2538. {
  2539. name: _tr("use_clamp"),
  2540. type: "BOOL",
  2541. default_value: false,
  2542. output: 0
  2543. }
  2544. ]
  2545. },
  2546. {
  2547. id: 0,
  2548. name: _tr("RGB to BW"),
  2549. type: "RGBTOBW",
  2550. x: 0,
  2551. y: 0,
  2552. color: 0xff62676d,
  2553. inputs: [
  2554. {
  2555. id: 0,
  2556. node_id: 0,
  2557. name: _tr("Color"),
  2558. type: "RGBA",
  2559. color: 0xffc7c729,
  2560. default_value: f32([0.0, 0.0, 0.0, 0.0])
  2561. }
  2562. ],
  2563. outputs: [
  2564. {
  2565. id: 0,
  2566. node_id: 0,
  2567. name: _tr("Val"),
  2568. type: "VALUE",
  2569. color: 0xffa1a1a1,
  2570. default_value: 0.0
  2571. }
  2572. ],
  2573. buttons: []
  2574. },
  2575. {
  2576. id: 0,
  2577. name: _tr("Separate HSV"),
  2578. type: "SEPHSV",
  2579. x: 0,
  2580. y: 0,
  2581. color: 0xff62676d,
  2582. inputs: [
  2583. {
  2584. id: 0,
  2585. node_id: 0,
  2586. name: _tr("Color"),
  2587. type: "RGBA",
  2588. color: 0xffc7c729,
  2589. default_value: f32([0.5, 0.5, 0.5, 1.0])
  2590. }
  2591. ],
  2592. outputs: [
  2593. {
  2594. id: 0,
  2595. node_id: 0,
  2596. name: _tr("H"),
  2597. type: "VALUE",
  2598. color: 0xffa1a1a1,
  2599. default_value: 0.0
  2600. },
  2601. {
  2602. id: 0,
  2603. node_id: 0,
  2604. name: _tr("S"),
  2605. type: "VALUE",
  2606. color: 0xffa1a1a1,
  2607. default_value: 0.0
  2608. },
  2609. {
  2610. id: 0,
  2611. node_id: 0,
  2612. name: _tr("V"),
  2613. type: "VALUE",
  2614. color: 0xffa1a1a1,
  2615. default_value: 0.0
  2616. }
  2617. ],
  2618. buttons: []
  2619. },
  2620. {
  2621. id: 0,
  2622. name: _tr("Separate RGB"),
  2623. type: "SEPRGB",
  2624. x: 0,
  2625. y: 0,
  2626. color: 0xff62676d,
  2627. inputs: [
  2628. {
  2629. id: 0,
  2630. node_id: 0,
  2631. name: _tr("Color"),
  2632. type: "RGBA",
  2633. color: 0xffc7c729,
  2634. default_value: f32([0.8, 0.8, 0.8, 1.0])
  2635. }
  2636. ],
  2637. outputs: [
  2638. {
  2639. id: 0,
  2640. node_id: 0,
  2641. name: _tr("R"),
  2642. type: "VALUE",
  2643. color: 0xffa1a1a1,
  2644. default_value: 0.0
  2645. },
  2646. {
  2647. id: 0,
  2648. node_id: 0,
  2649. name: _tr("G"),
  2650. type: "VALUE",
  2651. color: 0xffa1a1a1,
  2652. default_value: 0.0
  2653. },
  2654. {
  2655. id: 0,
  2656. node_id: 0,
  2657. name: _tr("B"),
  2658. type: "VALUE",
  2659. color: 0xffa1a1a1,
  2660. default_value: 0.0
  2661. }
  2662. ],
  2663. buttons: []
  2664. },
  2665. {
  2666. id: 0,
  2667. name: _tr("Separate XYZ"),
  2668. type: "SEPXYZ",
  2669. x: 0,
  2670. y: 0,
  2671. color: 0xff62676d,
  2672. inputs: [
  2673. {
  2674. id: 0,
  2675. node_id: 0,
  2676. name: _tr("Vector"),
  2677. type: "VECTOR",
  2678. color: 0xff6363c7,
  2679. default_value: f32([0.0, 0.0, 0.0])
  2680. }
  2681. ],
  2682. outputs: [
  2683. {
  2684. id: 0,
  2685. node_id: 0,
  2686. name: _tr("X"),
  2687. type: "VALUE",
  2688. color: 0xffa1a1a1,
  2689. default_value: 0.0
  2690. },
  2691. {
  2692. id: 0,
  2693. node_id: 0,
  2694. name: _tr("Y"),
  2695. type: "VALUE",
  2696. color: 0xffa1a1a1,
  2697. default_value: 0.0
  2698. },
  2699. {
  2700. id: 0,
  2701. node_id: 0,
  2702. name: _tr("Z"),
  2703. type: "VALUE",
  2704. color: 0xffa1a1a1,
  2705. default_value: 0.0
  2706. }
  2707. ],
  2708. buttons: []
  2709. },
  2710. {
  2711. id: 0,
  2712. name: _tr("Vector Math"),
  2713. type: "VECT_MATH",
  2714. x: 0,
  2715. y: 0,
  2716. color: 0xff62676d,
  2717. inputs: [
  2718. {
  2719. id: 0,
  2720. node_id: 0,
  2721. name: _tr("Vector"),
  2722. type: "VECTOR",
  2723. color: 0xff6363c7,
  2724. default_value: f32([0.0, 0.0, 0.0])
  2725. },
  2726. {
  2727. id: 0,
  2728. node_id: 0,
  2729. name: _tr("Vector"),
  2730. type: "VECTOR",
  2731. color: 0xff6363c7,
  2732. default_value: f32([0.0, 0.0, 0.0])
  2733. }
  2734. ],
  2735. outputs: [
  2736. {
  2737. id: 0,
  2738. node_id: 0,
  2739. name: _tr("Vector"),
  2740. type: "VECTOR",
  2741. color: 0xff6363c7,
  2742. default_value: f32([0.0, 0.0, 0.0])
  2743. },
  2744. {
  2745. id: 0,
  2746. node_id: 0,
  2747. name: _tr("Value"),
  2748. type: "VALUE",
  2749. color: 0xffa1a1a1,
  2750. default_value: 0.0
  2751. }
  2752. ],
  2753. buttons: [
  2754. {
  2755. name: _tr("operation"),
  2756. type: "ENUM",
  2757. data: [_tr("Add"), _tr("Subtract"), _tr("Multiply"), _tr("Divide"), _tr("Average"), _tr("Cross Product"), _tr("Project"), _tr("Reflect"), _tr("Dot Product"), _tr("Distance"), _tr("Length"), _tr("Scale"), _tr("Normalize"), _tr("Absolute"), _tr("Minimum"), _tr("Maximum"), _tr("Floor"), _tr("Ceil"), _tr("Fraction"), _tr("Modulo"), _tr("Snap"), _tr("Sine"), _tr("Cosine"), _tr("Tangent")],
  2758. default_value: 0,
  2759. output: 0
  2760. }
  2761. ]
  2762. }
  2763. ],
  2764. [ // Input
  2765. {
  2766. id: 0,
  2767. name: _tr("New Group"),
  2768. type: "GROUP",
  2769. x: 0,
  2770. y: 0,
  2771. color: 0xffb34f5a,
  2772. inputs: [],
  2773. outputs: [],
  2774. buttons: [
  2775. {
  2776. name: "arm.shader.NodesMaterial.newGroupButton",
  2777. type: "CUSTOM",
  2778. height: 1
  2779. }
  2780. ]
  2781. }
  2782. ]
  2783. ];
  2784. @:keep
  2785. @:access(zui.Zui)
  2786. public static function vectorCurvesButton(ui: Zui, nodes: Nodes, node: TNode) {
  2787. var but = node.buttons[0];
  2788. var nhandle = Id.handle().nest(node.id);
  2789. ui.row([1 / 3, 1 / 3, 1 / 3]);
  2790. ui.radio(nhandle.nest(0).nest(1), 0, "X");
  2791. ui.radio(nhandle.nest(0).nest(1), 1, "Y");
  2792. ui.radio(nhandle.nest(0).nest(1), 2, "Z");
  2793. // Preview
  2794. var axis = nhandle.nest(0).nest(1).position;
  2795. var val: Array<kha.arrays.Float32Array> = but.default_value[axis]; // [ [[x, y], [x, y], ..], [[x, y]], ..]
  2796. var num = val.length;
  2797. // for (i in 0...num) { ui.line(); }
  2798. ui._y += nodes.LINE_H() * 5;
  2799. // Edit
  2800. ui.row([1 / 5, 1 / 5, 3 / 5]);
  2801. if (ui.button("+")) {
  2802. var f32 = new kha.arrays.Float32Array(2);
  2803. f32[0] = 0; f32[1] = 0;
  2804. val.push(f32);
  2805. }
  2806. if (ui.button("-")) {
  2807. if (val.length > 2) val.pop();
  2808. }
  2809. var ihandle = nhandle.nest(0).nest(2).nest(axis, {position: 0});
  2810. var i = Std.int(ui.slider(ihandle, "Index", 0, num - 1, false, 1, true, Left));
  2811. if (i >= val.length || i < 0) ihandle.value = i = val.length - 1; // Stay in bounds
  2812. ui.row([1 / 2, 1 / 2]);
  2813. nhandle.nest(0).nest(3).value = val[i][0];
  2814. nhandle.nest(0).nest(4).value = val[i][1];
  2815. val[i][0] = ui.slider(nhandle.nest(0).nest(3, {value: 0}), "X", -1, 1, true, 100, true, Left);
  2816. val[i][1] = ui.slider(nhandle.nest(0).nest(4, {value: 0}), "Y", -1, 1, true, 100, true, Left);
  2817. }
  2818. @:keep
  2819. @:access(zui.Zui)
  2820. public static function colorRampButton(ui: Zui, nodes: Nodes, node: TNode) {
  2821. var but = node.buttons[0];
  2822. var nhandle = Id.handle().nest(node.id);
  2823. var nx = ui._x;
  2824. var ny = ui._y;
  2825. // Preview
  2826. var vals: Array<kha.arrays.Float32Array> = but.default_value; // [[r, g, b, a, pos], ..]
  2827. var sw = ui._w / nodes.SCALE();
  2828. for (val in vals) {
  2829. var pos = val[4];
  2830. var col = kha.Color.fromFloats(val[0], val[1], val[2]);
  2831. ui.fill(pos * sw, 0, (1.0 - pos) * sw, nodes.LINE_H() - 2 * nodes.SCALE(), col);
  2832. }
  2833. ui._y += nodes.LINE_H();
  2834. // Edit
  2835. var ihandle = nhandle.nest(0).nest(2);
  2836. ui.row([1 / 4, 1 / 4, 2 / 4]);
  2837. if (ui.button("+")) {
  2838. var last = vals[vals.length - 1];
  2839. var f32 = new kha.arrays.Float32Array(5);
  2840. f32[0] = last[0];
  2841. f32[1] = last[1];
  2842. f32[2] = last[2];
  2843. f32[3] = last[3];
  2844. f32[4] = 1.0;
  2845. vals.push(f32);
  2846. ihandle.value += 1;
  2847. }
  2848. if (ui.button("-") && vals.length > 1) {
  2849. vals.pop();
  2850. ihandle.value -= 1;
  2851. }
  2852. but.data = ui.combo(nhandle.nest(0).nest(1, {position: but.data}), [tr("Linear"), tr("Constant")], tr("Interpolate"));
  2853. ui.row([1 / 2, 1 / 2]);
  2854. var i = Std.int(ui.slider(ihandle, "Index", 0, vals.length - 1, false, 1, true, Left));
  2855. if (i >= vals.length || i < 0) ihandle.value = i = vals.length - 1; // Stay in bounds
  2856. var val = vals[i];
  2857. nhandle.nest(0).nest(3).value = val[4];
  2858. val[4] = ui.slider(nhandle.nest(0).nest(3), "Pos", 0, 1, true, 100, true, Left);
  2859. if (val[4] > 1.0) val[4] = 1.0; // Stay in bounds
  2860. else if (val[4] < 0.0) val[4] = 0.0;
  2861. var chandle = nhandle.nest(0).nest(4);
  2862. chandle.color = kha.Color.fromFloats(val[0], val[1], val[2]);
  2863. if (ui.text("", Right, chandle.color) == Started) {
  2864. var rx = nx + ui._w - nodes.p(37);
  2865. var ry = ny - nodes.p(5);
  2866. nodes._inputStarted = ui.inputStarted = false;
  2867. nodes.rgbaPopup(ui, chandle, val, Std.int(rx), Std.int(ry + ui.ELEMENT_H()));
  2868. }
  2869. val[0] = chandle.color.R;
  2870. val[1] = chandle.color.G;
  2871. val[2] = chandle.color.B;
  2872. }
  2873. @:keep
  2874. public static function newGroupButton(ui: Zui, nodes: Nodes, node: TNode) {
  2875. if (node.name == "New Group") {
  2876. for (i in 1...999) {
  2877. node.name = tr("Group") + " " + i;
  2878. var found = false;
  2879. for (g in Project.materialGroups) {
  2880. if (g.canvas.name == node.name) {
  2881. found = true;
  2882. break;
  2883. }
  2884. }
  2885. if (!found) break;
  2886. }
  2887. var canvas: TNodeCanvas = {
  2888. name: node.name,
  2889. nodes: [
  2890. {
  2891. id: 0,
  2892. x: 50,
  2893. y: 200,
  2894. name: _tr("Group Input"),
  2895. type: "GROUP_INPUT",
  2896. inputs: [],
  2897. outputs: [],
  2898. buttons: [
  2899. {
  2900. name: "arm.shader.NodesMaterial.groupInputButton",
  2901. type: "CUSTOM",
  2902. height: 1
  2903. }
  2904. ],
  2905. color: 0xff448c6d
  2906. },
  2907. {
  2908. id: 1,
  2909. x: 450,
  2910. y: 200,
  2911. name: _tr("Group Output"),
  2912. type: "GROUP_OUTPUT",
  2913. inputs: [],
  2914. outputs: [],
  2915. buttons: [
  2916. {
  2917. name: "arm.shader.NodesMaterial.groupOutputButton",
  2918. type: "CUSTOM",
  2919. height: 1
  2920. }
  2921. ],
  2922. color: 0xff448c6d
  2923. }
  2924. ],
  2925. links: []
  2926. };
  2927. Project.materialGroups.push({ canvas: canvas, nodes: new Nodes() });
  2928. }
  2929. var group: TNodeGroup = null;
  2930. for (g in Project.materialGroups) {
  2931. if (g.canvas.name == node.name) {
  2932. group = g;
  2933. break;
  2934. }
  2935. }
  2936. if (ui.button(tr("Nodes"))) {
  2937. arm.ui.UINodes.inst.groupStack.push(group);
  2938. }
  2939. }
  2940. @:keep
  2941. public static function groupInputButton(ui: Zui, nodes: Nodes, node: TNode) {
  2942. addSocketButton(ui, nodes, node, node.outputs);
  2943. }
  2944. @:keep
  2945. public static function groupOutputButton(ui: Zui, nodes: Nodes, node: TNode) {
  2946. addSocketButton(ui, nodes, node, node.inputs);
  2947. }
  2948. static function addSocketButton(ui: Zui, nodes: Nodes, node: TNode, sockets: Array<TNodeSocket>) {
  2949. if (ui.button(tr("Add"))) {
  2950. arm.ui.UIMenu.draw(function(ui: Zui) {
  2951. ui.text(tr("Socket"), Right, ui.t.HIGHLIGHT_COL);
  2952. var groupStack = arm.ui.UINodes.inst.groupStack;
  2953. var c = groupStack[groupStack.length - 1].canvas;
  2954. if (ui.button(tr("RGBA"), Left)) {
  2955. sockets.push(createSocket(nodes, node, null, "RGBA", c));
  2956. syncSockets(node);
  2957. }
  2958. if (ui.button(tr("Vector"), Left)) {
  2959. sockets.push(createSocket(nodes, node, null, "VECTOR", c));
  2960. syncSockets(node);
  2961. }
  2962. if (ui.button(tr("Value"), Left)) {
  2963. sockets.push(createSocket(nodes, node, null, "VALUE", c));
  2964. syncSockets(node);
  2965. }
  2966. }, 4);
  2967. }
  2968. }
  2969. public static function syncSockets(node: TNode) {
  2970. var groupStack = arm.ui.UINodes.inst.groupStack;
  2971. var c = groupStack[groupStack.length - 1].canvas;
  2972. for (m in Project.materials) syncGroupSockets(m.canvas, c.name, node);
  2973. for (g in Project.materialGroups) syncGroupSockets(g.canvas, c.name, node);
  2974. }
  2975. static function syncGroupSockets(canvas: TNodeCanvas, groupName: String, node: TNode) {
  2976. for (n in canvas.nodes) {
  2977. if (n.type == "GROUP" && n.name == groupName) {
  2978. var isInputs = node.name == "Group Input";
  2979. var oldSockets = isInputs ? n.inputs : n.outputs;
  2980. var sockets = Json.parse(Json.stringify(isInputs ? node.outputs : node.inputs));
  2981. isInputs ? n.inputs = sockets : n.outputs = sockets;
  2982. for (s in sockets) s.node_id = n.id;
  2983. var numSockets = sockets.length < oldSockets.length ? sockets.length : oldSockets.length;
  2984. for (i in 0...numSockets) {
  2985. if (sockets[i].type == oldSockets[i].type) {
  2986. sockets[i].default_value = oldSockets[i].default_value;
  2987. }
  2988. }
  2989. }
  2990. }
  2991. }
  2992. public static inline function get_socket_color(type: String): Int {
  2993. return type == "RGBA" ? 0xffc7c729 : type == "VECTOR" ? 0xff6363c7 : 0xffa1a1a1;
  2994. }
  2995. public static inline function get_socket_default_value(type: String): Dynamic {
  2996. return type == "RGBA" ? f32([0.8, 0.8, 0.8, 1.0]) : type == "VECTOR" ? f32([0.0, 0.0, 0.0]) : 0.0;
  2997. }
  2998. public static inline function get_socket_name(type: String): String {
  2999. return type == "RGBA" ? _tr("Color") : type == "VECTOR" ? _tr("Vector") : _tr("Value");
  3000. }
  3001. public static function createSocket(nodes: Nodes, node: TNode, name: String, type: String, canvas: TNodeCanvas, min = 0.0, max = 1.0, default_value: Dynamic = null): TNodeSocket {
  3002. return {
  3003. id: nodes.getSocketId(canvas.nodes),
  3004. node_id: node.id,
  3005. name: name == null ? get_socket_name(type) : name,
  3006. type: type,
  3007. color: get_socket_color(type),
  3008. default_value: default_value == null ? get_socket_default_value(type) : default_value,
  3009. min: min,
  3010. max: max
  3011. }
  3012. }
  3013. public static function getTNode(nodeType: String): TNode {
  3014. for (c in list) for (n in c) if (n.type == nodeType) return n;
  3015. return null;
  3016. }
  3017. public static function createNode(nodeType: String, group: TNodeGroup = null): TNode {
  3018. var n = getTNode(nodeType);
  3019. if (n == null) return null;
  3020. var canvas = group != null ? group.canvas : Context.material.canvas;
  3021. var nodes = group != null ? group.nodes : Context.material.nodes;
  3022. var node = arm.ui.UINodes.makeNode(n, nodes, canvas);
  3023. canvas.nodes.push(node);
  3024. return node;
  3025. }
  3026. static function f32(ar: Array<kha.FastFloat>): kha.arrays.Float32Array {
  3027. var res = new kha.arrays.Float32Array(ar.length);
  3028. for (i in 0...ar.length) res[i] = ar[i];
  3029. return res;
  3030. }
  3031. }