nodes_material.ts 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348
  1. let nodes_material_categories: string[] = [
  2. _tr("Input"),
  3. _tr("Texture"),
  4. _tr("Color"),
  5. _tr("Vector"),
  6. _tr("Converter"),
  7. _tr("Group")
  8. ];
  9. let nodes_material_input: ui_node_t[] = [
  10. {
  11. id: 0,
  12. name: _tr("Attribute"),
  13. type: "ATTRIBUTE",
  14. x: 0,
  15. y: 0,
  16. color: 0xffb34f5a,
  17. inputs: [],
  18. outputs: [
  19. {
  20. id: 0,
  21. node_id: 0,
  22. name: _tr("Color"),
  23. type: "RGBA",
  24. color: 0xffc7c729,
  25. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  26. min: 0.0,
  27. max: 1.0,
  28. precision: 100,
  29. display: 0
  30. },
  31. {
  32. id: 0,
  33. node_id: 0,
  34. name: _tr("Vector"),
  35. type: "VECTOR",
  36. color: 0xff6363c7,
  37. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  38. min: 0.0,
  39. max: 1.0,
  40. precision: 100,
  41. display: 0
  42. },
  43. {
  44. id: 0,
  45. node_id: 0,
  46. name: _tr("Fac"),
  47. type: "VALUE",
  48. color: 0xffa1a1a1,
  49. default_value: f32_array_create_x(0.0),
  50. min: 0.0,
  51. max: 1.0,
  52. precision: 100,
  53. display: 0
  54. }
  55. ],
  56. buttons: [
  57. {
  58. name: _tr("Name"),
  59. type: "STRING",
  60. output: -1,
  61. default_value: f32_array_create_x(0),
  62. data: null,
  63. min: 0.0,
  64. max: 1.0,
  65. precision: 100,
  66. height: 0
  67. }
  68. ],
  69. width: 0
  70. },
  71. {
  72. id: 0,
  73. name: _tr("Camera Data"),
  74. type: "CAMERA",
  75. x: 0,
  76. y: 0,
  77. color: 0xffb34f5a,
  78. inputs: [],
  79. outputs: [
  80. {
  81. id: 0,
  82. node_id: 0,
  83. name: _tr("View Vector"),
  84. type: "VECTOR",
  85. color: 0xff6363c7,
  86. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  87. min: 0.0,
  88. max: 1.0,
  89. precision: 100,
  90. display: 0
  91. },
  92. {
  93. id: 0,
  94. node_id: 0,
  95. name: _tr("View Z Depth"),
  96. type: "VALUE",
  97. color: 0xffa1a1a1,
  98. default_value: f32_array_create_x(0.0),
  99. min: 0.0,
  100. max: 1.0,
  101. precision: 100,
  102. display: 0
  103. },
  104. {
  105. id: 0,
  106. node_id: 0,
  107. name: _tr("View Distance"),
  108. type: "VALUE",
  109. color: 0xffa1a1a1,
  110. default_value: f32_array_create_x(0.0),
  111. min: 0.0,
  112. max: 1.0,
  113. precision: 100,
  114. display: 0
  115. }
  116. ],
  117. buttons: [],
  118. width: 0
  119. },
  120. {
  121. id: 0,
  122. name: _tr("Fresnel"),
  123. type: "FRESNEL",
  124. x: 0,
  125. y: 0,
  126. color: 0xffb34f5a,
  127. inputs: [
  128. {
  129. id: 0,
  130. node_id: 0,
  131. name: _tr("IOR"),
  132. type: "VALUE",
  133. color: 0xffa1a1a1,
  134. default_value: f32_array_create_x(1.45),
  135. min: 0.0,
  136. max: 3.0,
  137. precision: 100,
  138. display: 0
  139. },
  140. {
  141. id: 0,
  142. node_id: 0,
  143. name: _tr("Normal"),
  144. type: "VECTOR",
  145. color: 0xff6363c7,
  146. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  147. min: 0.0,
  148. max: 1.0,
  149. precision: 100,
  150. display: 0
  151. }
  152. ],
  153. outputs: [
  154. {
  155. id: 0,
  156. node_id: 0,
  157. name: _tr("Fac"),
  158. type: "VALUE",
  159. color: 0xffa1a1a1,
  160. default_value: f32_array_create_x(0.0),
  161. min: 0.0,
  162. max: 1.0,
  163. precision: 100,
  164. display: 0
  165. }
  166. ],
  167. buttons: [],
  168. width: 0
  169. },
  170. {
  171. id: 0,
  172. name: _tr("Geometry"),
  173. type: "NEW_GEOMETRY",
  174. x: 0,
  175. y: 0,
  176. color: 0xffb34f5a,
  177. inputs: [],
  178. outputs: [
  179. {
  180. id: 0,
  181. node_id: 0,
  182. name: _tr("Position"),
  183. type: "VECTOR",
  184. color: 0xff6363c7,
  185. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  186. min: 0.0,
  187. max: 1.0,
  188. precision: 100,
  189. display: 0
  190. },
  191. {
  192. id: 0,
  193. node_id: 0,
  194. name: _tr("Normal"),
  195. type: "VECTOR",
  196. color: 0xff6363c7,
  197. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  198. min: 0.0,
  199. max: 1.0,
  200. precision: 100,
  201. display: 0
  202. },
  203. {
  204. id: 0,
  205. node_id: 0,
  206. name: _tr("Tangent"),
  207. type: "VECTOR",
  208. color: 0xff6363c7,
  209. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  210. min: 0.0,
  211. max: 1.0,
  212. precision: 100,
  213. display: 0
  214. },
  215. {
  216. id: 0,
  217. node_id: 0,
  218. name: _tr("True Normal"),
  219. type: "VECTOR",
  220. color: 0xff6363c7,
  221. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  222. min: 0.0,
  223. max: 1.0,
  224. precision: 100,
  225. display: 0
  226. },
  227. {
  228. id: 0,
  229. node_id: 0,
  230. name: _tr("Incoming"),
  231. type: "VECTOR",
  232. color: 0xff6363c7,
  233. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  234. min: 0.0,
  235. max: 1.0,
  236. precision: 100,
  237. display: 0
  238. },
  239. {
  240. id: 0,
  241. node_id: 0,
  242. name: _tr("Parametric"),
  243. type: "VECTOR",
  244. color: 0xff6363c7,
  245. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  246. min: 0.0,
  247. max: 1.0,
  248. precision: 100,
  249. display: 0
  250. },
  251. {
  252. id: 0,
  253. node_id: 0,
  254. name: _tr("Backfacing"),
  255. type: "VALUE",
  256. color: 0xffa1a1a1,
  257. default_value: f32_array_create_x(0.0),
  258. min: 0.0,
  259. max: 1.0,
  260. precision: 100,
  261. display: 0
  262. },
  263. {
  264. id: 0,
  265. node_id: 0,
  266. name: _tr("Pointiness"),
  267. type: "VALUE",
  268. color: 0xffa1a1a1,
  269. default_value: f32_array_create_x(0.0),
  270. min: 0.0,
  271. max: 1.0,
  272. precision: 100,
  273. display: 0
  274. },
  275. {
  276. id: 0,
  277. node_id: 0,
  278. name: _tr("Random Per Island"),
  279. type: "VALUE",
  280. color: 0xffa1a1a1,
  281. default_value: f32_array_create_x(0.0),
  282. min: 0.0,
  283. max: 1.0,
  284. precision: 100,
  285. display: 0
  286. }
  287. ],
  288. buttons: [],
  289. width: 0
  290. },
  291. {
  292. id: 0,
  293. name: _tr("Layer"),
  294. type: "LAYER", // extension
  295. x: 0,
  296. y: 0,
  297. color: 0xff4982a0,
  298. inputs: [],
  299. outputs: [
  300. {
  301. id: 0,
  302. node_id: 0,
  303. name: _tr("Base Color"),
  304. type: "RGBA",
  305. color: 0xffc7c729,
  306. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  307. min: 0.0,
  308. max: 1.0,
  309. precision: 100,
  310. display: 0
  311. },
  312. {
  313. id: 0,
  314. node_id: 0,
  315. name: _tr("Opacity"),
  316. type: "VALUE",
  317. color: 0xffa1a1a1,
  318. default_value: f32_array_create_x(1.0),
  319. min: 0.0,
  320. max: 1.0,
  321. precision: 100,
  322. display: 0
  323. },
  324. {
  325. id: 0,
  326. node_id: 0,
  327. name: _tr("Occlusion"),
  328. type: "VALUE",
  329. color: 0xffa1a1a1,
  330. default_value: f32_array_create_x(1.0),
  331. min: 0.0,
  332. max: 1.0,
  333. precision: 100,
  334. display: 0
  335. },
  336. {
  337. id: 0,
  338. node_id: 0,
  339. name: _tr("Roughness"),
  340. type: "VALUE",
  341. color: 0xffa1a1a1,
  342. default_value: f32_array_create_x(1.0),
  343. min: 0.0,
  344. max: 1.0,
  345. precision: 100,
  346. display: 0
  347. },
  348. {
  349. id: 0,
  350. node_id: 0,
  351. name: _tr("Metallic"),
  352. type: "VALUE",
  353. color: 0xffa1a1a1,
  354. default_value: f32_array_create_x(1.0),
  355. min: 0.0,
  356. max: 1.0,
  357. precision: 100,
  358. display: 0
  359. },
  360. {
  361. id: 0,
  362. node_id: 0,
  363. name: _tr("Normal Map"),
  364. type: "VECTOR",
  365. color: -10238109,
  366. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  367. min: 0.0,
  368. max: 1.0,
  369. precision: 100,
  370. display: 0
  371. },
  372. {
  373. id: 0,
  374. node_id: 0,
  375. name: _tr("Emission"),
  376. type: "VALUE",
  377. color: 0xffa1a1a1,
  378. default_value: f32_array_create_x(1.0),
  379. min: 0.0,
  380. max: 1.0,
  381. precision: 100,
  382. display: 0
  383. },
  384. {
  385. id: 0,
  386. node_id: 0,
  387. name: _tr("Height"),
  388. type: "VALUE",
  389. color: 0xffa1a1a1,
  390. default_value: f32_array_create_x(1.0),
  391. min: 0.0,
  392. max: 1.0,
  393. precision: 100,
  394. display: 0
  395. },
  396. {
  397. id: 0,
  398. node_id: 0,
  399. name: _tr("Subsurface"),
  400. type: "VALUE",
  401. color: 0xffa1a1a1,
  402. default_value: f32_array_create_x(1.0),
  403. min: 0.0,
  404. max: 1.0,
  405. precision: 100,
  406. display: 0
  407. }
  408. ],
  409. buttons: [
  410. {
  411. name: _tr("Layer"),
  412. type: "ENUM",
  413. output: -1,
  414. default_value: f32_array_create_x(0),
  415. data: u8_array_create_from_string(""),
  416. min: 0.0,
  417. max: 1.0,
  418. precision: 100,
  419. height: 0
  420. }
  421. ],
  422. width: 0
  423. },
  424. {
  425. id: 0,
  426. name: _tr("Layer Mask"),
  427. type: "LAYER_MASK", // extension
  428. x: 0,
  429. y: 0,
  430. color: 0xff4982a0,
  431. inputs: [],
  432. outputs: [
  433. {
  434. id: 0,
  435. node_id: 0,
  436. name: _tr("Value"),
  437. type: "VALUE",
  438. color: 0xffa1a1a1,
  439. default_value: f32_array_create_x(0.0),
  440. min: 0.0,
  441. max: 1.0,
  442. precision: 100,
  443. display: 0
  444. }
  445. ],
  446. buttons: [
  447. {
  448. name: _tr("Layer"),
  449. type: "ENUM",
  450. output: -1,
  451. default_value: f32_array_create_x(0),
  452. data: u8_array_create_from_string(""),
  453. min: 0.0,
  454. max: 1.0,
  455. precision: 100,
  456. height: 0
  457. }
  458. ],
  459. width: 0
  460. },
  461. {
  462. id: 0,
  463. name: _tr("Layer Weight"),
  464. type: "LAYER_WEIGHT",
  465. x: 0,
  466. y: 0,
  467. color: 0xffb34f5a,
  468. inputs: [
  469. {
  470. id: 0,
  471. node_id: 0,
  472. name: _tr("Blend"),
  473. type: "VALUE",
  474. color: 0xffa1a1a1,
  475. default_value: f32_array_create_x(0.5),
  476. min: 0.0,
  477. max: 1.0,
  478. precision: 100,
  479. display: 0
  480. },
  481. {
  482. id: 0,
  483. node_id: 0,
  484. name: _tr("Normal"),
  485. type: "VECTOR",
  486. color: 0xff6363c7,
  487. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  488. min: 0.0,
  489. max: 1.0,
  490. precision: 100,
  491. display: 0
  492. }
  493. ],
  494. outputs: [
  495. {
  496. id: 0,
  497. node_id: 0,
  498. name: _tr("Fresnel"),
  499. type: "VALUE",
  500. color: 0xffa1a1a1,
  501. default_value: f32_array_create_x(0.0),
  502. min: 0.0,
  503. max: 1.0,
  504. precision: 100,
  505. display: 0
  506. },
  507. {
  508. id: 0,
  509. node_id: 0,
  510. name: _tr("Facing"),
  511. type: "VALUE",
  512. color: 0xffa1a1a1,
  513. default_value: f32_array_create_x(0.0),
  514. min: 0.0,
  515. max: 1.0,
  516. precision: 100,
  517. display: 0
  518. }
  519. ],
  520. buttons: [],
  521. width: 0
  522. },
  523. {
  524. id: 0,
  525. name: _tr("Material"),
  526. type: "MATERIAL", // extension
  527. x: 0,
  528. y: 0,
  529. color: 0xff4982a0,
  530. inputs: [],
  531. outputs: [
  532. {
  533. id: 0,
  534. node_id: 0,
  535. name: _tr("Base Color"),
  536. type: "RGBA",
  537. color: 0xffc7c729,
  538. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  539. min: 0.0,
  540. max: 1.0,
  541. precision: 100,
  542. display: 0
  543. },
  544. {
  545. id: 0,
  546. node_id: 0,
  547. name: _tr("Opacity"),
  548. type: "VALUE",
  549. color: 0xffa1a1a1,
  550. default_value: f32_array_create_x(1.0),
  551. min: 0.0,
  552. max: 1.0,
  553. precision: 100,
  554. display: 0
  555. },
  556. {
  557. id: 0,
  558. node_id: 0,
  559. name: _tr("Occlusion"),
  560. type: "VALUE",
  561. color: 0xffa1a1a1,
  562. default_value: f32_array_create_x(1.0),
  563. min: 0.0,
  564. max: 1.0,
  565. precision: 100,
  566. display: 0
  567. },
  568. {
  569. id: 0,
  570. node_id: 0,
  571. name: _tr("Roughness"),
  572. type: "VALUE",
  573. color: 0xffa1a1a1,
  574. default_value: f32_array_create_x(1.0),
  575. min: 0.0,
  576. max: 1.0,
  577. precision: 100,
  578. display: 0
  579. },
  580. {
  581. id: 0,
  582. node_id: 0,
  583. name: _tr("Metallic"),
  584. type: "VALUE",
  585. color: 0xffa1a1a1,
  586. default_value: f32_array_create_x(1.0),
  587. min: 0.0,
  588. max: 1.0,
  589. precision: 100,
  590. display: 0
  591. },
  592. {
  593. id: 0,
  594. node_id: 0,
  595. name: _tr("Normal Map"),
  596. type: "VECTOR",
  597. color: -10238109,
  598. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  599. min: 0.0,
  600. max: 1.0,
  601. precision: 100,
  602. display: 0
  603. },
  604. {
  605. id: 0,
  606. node_id: 0,
  607. name: _tr("Emission"),
  608. type: "VALUE",
  609. color: 0xffa1a1a1,
  610. default_value: f32_array_create_x(1.0),
  611. min: 0.0,
  612. max: 1.0,
  613. precision: 100,
  614. display: 0
  615. },
  616. {
  617. id: 0,
  618. node_id: 0,
  619. name: _tr("Height"),
  620. type: "VALUE",
  621. color: 0xffa1a1a1,
  622. default_value: f32_array_create_x(1.0),
  623. min: 0.0,
  624. max: 1.0,
  625. precision: 100,
  626. display: 0
  627. },
  628. {
  629. id: 0,
  630. node_id: 0,
  631. name: _tr("Subsurface"),
  632. type: "VALUE",
  633. color: 0xffa1a1a1,
  634. default_value: f32_array_create_x(1.0),
  635. min: 0.0,
  636. max: 1.0,
  637. precision: 100,
  638. display: 0
  639. }
  640. ],
  641. buttons: [
  642. {
  643. name: _tr("Material"),
  644. type: "ENUM",
  645. output: -1,
  646. default_value: f32_array_create_x(0),
  647. data: u8_array_create_from_string(""),
  648. min: 0.0,
  649. max: 1.0,
  650. precision: 100,
  651. height: 0
  652. }
  653. ],
  654. width: 0
  655. },
  656. {
  657. id: 0,
  658. name: _tr("Object Info"),
  659. type: "OBJECT_INFO",
  660. x: 0,
  661. y: 0,
  662. color: 0xffb34f5a,
  663. inputs: [],
  664. outputs: [
  665. {
  666. id: 0,
  667. node_id: 0,
  668. name: _tr("Location"),
  669. type: "VECTOR",
  670. color: 0xff6363c7,
  671. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  672. min: 0.0,
  673. max: 1.0,
  674. precision: 100,
  675. display: 0
  676. },
  677. {
  678. id: 0,
  679. node_id: 0,
  680. name: _tr("Color"),
  681. type: "RGBA",
  682. color: 0xffc7c729,
  683. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  684. min: 0.0,
  685. max: 1.0,
  686. precision: 100,
  687. display: 0
  688. },
  689. {
  690. id: 0,
  691. node_id: 0,
  692. name: _tr("Object Index"),
  693. type: "VALUE",
  694. color: 0xffa1a1a1,
  695. default_value: f32_array_create_x(0.0),
  696. min: 0.0,
  697. max: 1.0,
  698. precision: 100,
  699. display: 0
  700. },
  701. {
  702. id: 0,
  703. node_id: 0,
  704. name: _tr("Material Index"),
  705. type: "VALUE",
  706. color: 0xffa1a1a1,
  707. default_value: f32_array_create_x(0.0),
  708. min: 0.0,
  709. max: 1.0,
  710. precision: 100,
  711. display: 0
  712. },
  713. {
  714. id: 0,
  715. node_id: 0,
  716. name: _tr("Random"),
  717. type: "VALUE",
  718. color: 0xffa1a1a1,
  719. default_value: f32_array_create_x(0.0),
  720. min: 0.0,
  721. max: 1.0,
  722. precision: 100,
  723. display: 0
  724. }
  725. ],
  726. buttons: [],
  727. width: 0
  728. },
  729. {
  730. id: 0,
  731. name: _tr("Picker"),
  732. type: "PICKER", // extension
  733. x: 0,
  734. y: 0,
  735. color: 0xff4982a0,
  736. inputs: [],
  737. outputs: [
  738. {
  739. id: 0,
  740. node_id: 0,
  741. name: _tr("Base Color"),
  742. type: "RGBA",
  743. color: 0xffc7c729,
  744. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  745. min: 0.0,
  746. max: 1.0,
  747. precision: 100,
  748. display: 0
  749. },
  750. {
  751. id: 0,
  752. node_id: 0,
  753. name: _tr("Opacity"),
  754. type: "VALUE",
  755. color: 0xffa1a1a1,
  756. default_value: f32_array_create_x(1.0),
  757. min: 0.0,
  758. max: 1.0,
  759. precision: 100,
  760. display: 0
  761. },
  762. {
  763. id: 0,
  764. node_id: 0,
  765. name: _tr("Occlusion"),
  766. type: "VALUE",
  767. color: 0xffa1a1a1,
  768. default_value: f32_array_create_x(1.0),
  769. min: 0.0,
  770. max: 1.0,
  771. precision: 100,
  772. display: 0
  773. },
  774. {
  775. id: 0,
  776. node_id: 0,
  777. name: _tr("Roughness"),
  778. type: "VALUE",
  779. color: 0xffa1a1a1,
  780. default_value: f32_array_create_x(1.0),
  781. min: 0.0,
  782. max: 1.0,
  783. precision: 100,
  784. display: 0
  785. },
  786. {
  787. id: 0,
  788. node_id: 0,
  789. name: _tr("Metallic"),
  790. type: "VALUE",
  791. color: 0xffa1a1a1,
  792. default_value: f32_array_create_x(1.0),
  793. min: 0.0,
  794. max: 1.0,
  795. precision: 100,
  796. display: 0
  797. },
  798. {
  799. id: 0,
  800. node_id: 0,
  801. name: _tr("Normal Map"),
  802. type: "VECTOR",
  803. color: -10238109,
  804. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  805. min: 0.0,
  806. max: 1.0,
  807. precision: 100,
  808. display: 0
  809. },
  810. {
  811. id: 0,
  812. node_id: 0,
  813. name: _tr("Emission"),
  814. type: "VALUE",
  815. color: 0xffa1a1a1,
  816. default_value: f32_array_create_x(1.0),
  817. min: 0.0,
  818. max: 1.0,
  819. precision: 100,
  820. display: 0
  821. },
  822. {
  823. id: 0,
  824. node_id: 0,
  825. name: _tr("Height"),
  826. type: "VALUE",
  827. color: 0xffa1a1a1,
  828. default_value: f32_array_create_x(1.0),
  829. min: 0.0,
  830. max: 1.0,
  831. precision: 100,
  832. display: 0
  833. },
  834. {
  835. id: 0,
  836. node_id: 0,
  837. name: _tr("Subsurface"),
  838. type: "VALUE",
  839. color: 0xffa1a1a1,
  840. default_value: f32_array_create_x(1.0),
  841. min: 0.0,
  842. max: 1.0,
  843. precision: 100,
  844. display: 0
  845. }
  846. ],
  847. buttons: [],
  848. width: 0
  849. },
  850. {
  851. id: 0,
  852. name: _tr("RGB"),
  853. type: "RGB",
  854. x: 0,
  855. y: 0,
  856. color: 0xffb34f5a,
  857. inputs: [],
  858. outputs: [
  859. {
  860. id: 0,
  861. node_id: 0,
  862. name: _tr("Color"),
  863. type: "RGBA",
  864. color: 0xffc7c729,
  865. default_value: f32_array_create_xyzw(0.5, 0.5, 0.5, 1.0),
  866. min: 0.0,
  867. max: 1.0,
  868. precision: 100,
  869. display: 0
  870. }
  871. ],
  872. buttons: [
  873. {
  874. name: _tr("default_value"),
  875. type: "RGBA",
  876. output: 0,
  877. default_value: f32_array_create_x(0),
  878. data: null,
  879. min: 0.0,
  880. max: 1.0,
  881. precision: 100,
  882. height: 0
  883. }
  884. ],
  885. width: 0
  886. },
  887. {
  888. id: 0,
  889. name: _tr("Script"),
  890. type: "SCRIPT_CPU", // extension
  891. x: 0,
  892. y: 0,
  893. color: 0xffb34f5a,
  894. inputs: [],
  895. outputs: [
  896. {
  897. id: 0,
  898. node_id: 0,
  899. name: _tr("Value"),
  900. type: "VALUE",
  901. color: 0xffa1a1a1,
  902. default_value: f32_array_create_x(0.5),
  903. min: 0.0,
  904. max: 1.0,
  905. precision: 100,
  906. display: 0
  907. }
  908. ],
  909. buttons: [
  910. {
  911. name: " ",
  912. type: "STRING",
  913. output: -1,
  914. default_value: f32_array_create_x(0), // "",
  915. data: null,
  916. min: 0.0,
  917. max: 1.0,
  918. precision: 100,
  919. height: 0
  920. }
  921. ],
  922. width: 0
  923. },
  924. {
  925. id: 0,
  926. name: _tr("Shader"),
  927. type: "SHADER_GPU", // extension
  928. x: 0,
  929. y: 0,
  930. color: 0xffb34f5a,
  931. inputs: [],
  932. outputs: [
  933. {
  934. id: 0,
  935. node_id: 0,
  936. name: _tr("Value"),
  937. type: "VALUE",
  938. color: 0xffa1a1a1,
  939. default_value: f32_array_create_x(0.5),
  940. min: 0.0,
  941. max: 1.0,
  942. precision: 100,
  943. display: 0
  944. }
  945. ],
  946. buttons: [
  947. {
  948. name: " ",
  949. type: "STRING",
  950. output: -1,
  951. default_value: f32_array_create_x(0), // "",
  952. data: null,
  953. min: 0.0,
  954. max: 1.0,
  955. precision: 100,
  956. height: 0
  957. }
  958. ],
  959. width: 0
  960. },
  961. {
  962. id: 0,
  963. name: _tr("Tangent"),
  964. type: "TANGENT",
  965. x: 0,
  966. y: 0,
  967. color: 0xffb34f5a,
  968. inputs: [],
  969. outputs: [
  970. {
  971. id: 0,
  972. node_id: 0,
  973. name: _tr("Tangent"),
  974. type: "VECTOR",
  975. color: 0xff6363c7,
  976. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  977. min: 0.0,
  978. max: 1.0,
  979. precision: 100,
  980. display: 0
  981. }
  982. ],
  983. buttons: [],
  984. width: 0
  985. },
  986. {
  987. id: 0,
  988. name: _tr("Texture Coordinate"),
  989. type: "TEX_COORD",
  990. x: 0,
  991. y: 0,
  992. color: 0xffb34f5a,
  993. inputs: [],
  994. outputs: [
  995. {
  996. id: 0,
  997. node_id: 0,
  998. name: _tr("Generated"),
  999. type: "VECTOR",
  1000. color: 0xff6363c7,
  1001. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1002. min: 0.0,
  1003. max: 1.0,
  1004. precision: 100,
  1005. display: 0
  1006. },
  1007. {
  1008. id: 0,
  1009. node_id: 0,
  1010. name: _tr("Normal"),
  1011. type: "VECTOR",
  1012. color: 0xff6363c7,
  1013. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1014. min: 0.0,
  1015. max: 1.0,
  1016. precision: 100,
  1017. display: 0
  1018. },
  1019. {
  1020. id: 0,
  1021. node_id: 0,
  1022. name: _tr("UV"),
  1023. type: "VECTOR",
  1024. color: 0xff6363c7,
  1025. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1026. min: 0.0,
  1027. max: 1.0,
  1028. precision: 100,
  1029. display: 0
  1030. },
  1031. {
  1032. id: 0,
  1033. node_id: 0,
  1034. name: _tr("Object"),
  1035. type: "VECTOR",
  1036. color: 0xff6363c7,
  1037. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1038. min: 0.0,
  1039. max: 1.0,
  1040. precision: 100,
  1041. display: 0
  1042. },
  1043. {
  1044. id: 0,
  1045. node_id: 0,
  1046. name: _tr("Camera"),
  1047. type: "VECTOR",
  1048. color: 0xff6363c7,
  1049. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1050. min: 0.0,
  1051. max: 1.0,
  1052. precision: 100,
  1053. display: 0
  1054. },
  1055. {
  1056. id: 0,
  1057. node_id: 0,
  1058. name: _tr("Window"),
  1059. type: "VECTOR",
  1060. color: 0xff6363c7,
  1061. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1062. min: 0.0,
  1063. max: 1.0,
  1064. precision: 100,
  1065. display: 0
  1066. },
  1067. {
  1068. id: 0,
  1069. node_id: 0,
  1070. name: _tr("Reflection"),
  1071. type: "VECTOR",
  1072. color: 0xff6363c7,
  1073. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1074. min: 0.0,
  1075. max: 1.0,
  1076. precision: 100,
  1077. display: 0
  1078. }
  1079. ],
  1080. buttons: []
  1081. },
  1082. {
  1083. id: 0,
  1084. name: _tr("UV Map"),
  1085. type: "UVMAP",
  1086. x: 0,
  1087. y: 0,
  1088. color: 0xffb34f5a,
  1089. inputs: [],
  1090. outputs: [
  1091. {
  1092. id: 0,
  1093. node_id: 0,
  1094. name: _tr("UV"),
  1095. type: "VECTOR",
  1096. color: 0xff6363c7,
  1097. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1098. min: 0.0,
  1099. max: 1.0,
  1100. precision: 100,
  1101. display: 0
  1102. }
  1103. ],
  1104. buttons: [],
  1105. width: 0
  1106. },
  1107. {
  1108. id: 0,
  1109. name: _tr("Value"),
  1110. type: "VALUE",
  1111. x: 0,
  1112. y: 0,
  1113. color: 0xffb34f5a,
  1114. inputs: [],
  1115. outputs: [
  1116. {
  1117. id: 0,
  1118. node_id: 0,
  1119. name: _tr("Value"),
  1120. type: "VALUE",
  1121. color: 0xffa1a1a1,
  1122. default_value: f32_array_create_x(0.5),
  1123. min: 0.0,
  1124. max: 1.0,
  1125. precision: 100,
  1126. display: 0
  1127. }
  1128. ],
  1129. buttons: [
  1130. {
  1131. name: _tr("default_value"),
  1132. type: "VALUE",
  1133. output: 0,
  1134. default_value: f32_array_create_x(0),
  1135. data: null,
  1136. min: 0.0,
  1137. max: 10.0,
  1138. precision: 100,
  1139. height: 0
  1140. }
  1141. ],
  1142. width: 0
  1143. },
  1144. {
  1145. id: 0,
  1146. name: _tr("Vertex Color"),
  1147. type: "VERTEX_COLOR",
  1148. x: 0,
  1149. y: 0,
  1150. color: 0xffb34f5a,
  1151. inputs: [],
  1152. outputs: [
  1153. {
  1154. id: 0,
  1155. node_id: 0,
  1156. name: _tr("Color"),
  1157. type: "RGBA",
  1158. color: 0xffc7c729,
  1159. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  1160. min: 0.0,
  1161. max: 1.0,
  1162. precision: 100,
  1163. display: 0
  1164. },
  1165. {
  1166. id: 0,
  1167. node_id: 0,
  1168. name: _tr("Alpha"),
  1169. type: "VALUE",
  1170. color: 0xffa1a1a1,
  1171. default_value: f32_array_create_x(0.0),
  1172. min: 0.0,
  1173. max: 1.0,
  1174. precision: 100,
  1175. display: 0
  1176. }
  1177. ],
  1178. buttons: [],
  1179. width: 0
  1180. },
  1181. {
  1182. id: 0,
  1183. name: _tr("Wireframe"),
  1184. type: "WIREFRAME",
  1185. x: 0,
  1186. y: 0,
  1187. color: 0xffb34f5a,
  1188. inputs: [
  1189. {
  1190. id: 0,
  1191. node_id: 0,
  1192. name: _tr("Size"),
  1193. type: "VALUE",
  1194. color: 0xffa1a1a1,
  1195. default_value: f32_array_create_x(0.01),
  1196. min: 0.0,
  1197. max: 0.1,
  1198. precision: 100,
  1199. display: 0
  1200. },
  1201. ],
  1202. outputs: [
  1203. {
  1204. id: 0,
  1205. node_id: 0,
  1206. name: _tr("Fac"),
  1207. type: "VALUE",
  1208. color: 0xffa1a1a1,
  1209. default_value: f32_array_create_x(0.0),
  1210. min: 0.0,
  1211. max: 1.0,
  1212. precision: 100,
  1213. display: 0
  1214. }
  1215. ],
  1216. buttons: [
  1217. {
  1218. name: _tr("Pixel Size"),
  1219. type: "BOOL",
  1220. output: 0,
  1221. default_value: f32_array_create_x(0),
  1222. data: null,
  1223. min: 0.0,
  1224. max: 1.0,
  1225. precision: 100,
  1226. height: 0
  1227. }
  1228. ],
  1229. width: 0
  1230. },
  1231. ];
  1232. // let nodes_material_output: ui_node_t[] = [
  1233. // {
  1234. // id: 0,
  1235. // name: _tr("Material Output"),
  1236. // type: "OUTPUT_MATERIAL_PBR",
  1237. // x: 0,
  1238. // y: 0,
  1239. // color: 0xffb34f5a,
  1240. // inputs: [
  1241. // {
  1242. // id: 0,
  1243. // node_id: 0,
  1244. // name: _tr("Base Color"),
  1245. // type: "RGBA",
  1246. // color: 0xffc7c729,
  1247. // default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  1248. // min: 0.0,
  1249. // max: 1.0,
  1250. // precision: 100,
  1251. // display: 0
  1252. // },
  1253. // {
  1254. // id: 0,
  1255. // node_id: 0,
  1256. // name: _tr("Opacity"),
  1257. // type: "VALUE",
  1258. // color: 0xffa1a1a1,
  1259. // default_value: f32_array_create_x(1.0),
  1260. // min: 0.0,
  1261. // max: 1.0,
  1262. // precision: 100,
  1263. // display: 0
  1264. // },
  1265. // {
  1266. // id: 0,
  1267. // node_id: 0,
  1268. // name: _tr("Occlusion"),
  1269. // type: "VALUE",
  1270. // color: 0xffa1a1a1,
  1271. // default_value: f32_array_create_x(1.0),
  1272. // min: 0.0,
  1273. // max: 1.0,
  1274. // precision: 100,
  1275. // display: 0
  1276. // },
  1277. // {
  1278. // id: 0,
  1279. // node_id: 0,
  1280. // name: _tr("Roughness"),
  1281. // type: "VALUE",
  1282. // color: 0xffa1a1a1,
  1283. // default_value: f32_array_create_x(0.1),
  1284. // min: 0.0,
  1285. // max: 1.0,
  1286. // precision: 100,
  1287. // display: 0
  1288. // },
  1289. // {
  1290. // id: 0,
  1291. // node_id: 0,
  1292. // name: _tr("Metallic"),
  1293. // type: "VALUE",
  1294. // color: 0xffa1a1a1,
  1295. // default_value: f32_array_create_x(0.0),
  1296. // min: 0.0,
  1297. // max: 1.0,
  1298. // precision: 100,
  1299. // display: 0
  1300. // },
  1301. // {
  1302. // id: 0,
  1303. // node_id: 0,
  1304. // name: _tr("Normal Map"),
  1305. // type: "VECTOR",
  1306. // color: -10238109,
  1307. // default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  1308. // min: 0.0,
  1309. // max: 1.0,
  1310. // precision: 100,
  1311. // display: 0
  1312. // },
  1313. // {
  1314. // id: 0,
  1315. // node_id: 0,
  1316. // name: _tr("Emission"),
  1317. // type: "VALUE",
  1318. // color: 0xffa1a1a1,
  1319. // default_value: f32_array_create_x(0.0),
  1320. // min: 0.0,
  1321. // max: 1.0,
  1322. // precision: 100,
  1323. // display: 0
  1324. // },
  1325. // {
  1326. // id: 0,
  1327. // node_id: 0,
  1328. // name: _tr("Height"),
  1329. // type: "VALUE",
  1330. // color: 0xffa1a1a1,
  1331. // default_value: f32_array_create_x(0.0),
  1332. // min: 0.0,
  1333. // max: 1.0,
  1334. // precision: 100,
  1335. // display: 0
  1336. // },
  1337. // {
  1338. // id: 0,
  1339. // node_id: 0,
  1340. // name: _tr("Subsurface"),
  1341. // type: "VALUE",
  1342. // color: 0xffa1a1a1,
  1343. // default_value: f32_array_create_x(0.0),
  1344. // min: 0.0,
  1345. // max: 1.0,
  1346. // precision: 100,
  1347. // display: 0
  1348. // }
  1349. // ],
  1350. // outputs: [],
  1351. // buttons: [],
  1352. // width: 0
  1353. // }
  1354. // ];
  1355. let nodes_material_texture: ui_node_t[] = [
  1356. {
  1357. id: 0,
  1358. name: _tr("Brick Texture"),
  1359. type: "TEX_BRICK",
  1360. x: 0,
  1361. y: 0,
  1362. color: 0xff4982a0,
  1363. inputs: [
  1364. {
  1365. id: 0,
  1366. node_id: 0,
  1367. name: _tr("Vector"),
  1368. type: "VECTOR",
  1369. color: 0xff6363c7,
  1370. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1371. min: 0.0,
  1372. max: 1.0,
  1373. precision: 100,
  1374. display: 0
  1375. },
  1376. {
  1377. id: 0,
  1378. node_id: 0,
  1379. name: _tr("Color 1"),
  1380. type: "RGBA",
  1381. color: 0xffc7c729,
  1382. default_value: f32_array_create_xyz(0.8, 0.8, 0.8),
  1383. min: 0.0,
  1384. max: 1.0,
  1385. precision: 100,
  1386. display: 0
  1387. },
  1388. {
  1389. id: 0,
  1390. node_id: 0,
  1391. name: _tr("Color 2"),
  1392. type: "RGBA",
  1393. color: 0xffc7c729,
  1394. default_value: f32_array_create_xyz(0.2, 0.2, 0.2),
  1395. min: 0.0,
  1396. max: 1.0,
  1397. precision: 100,
  1398. display: 0
  1399. },
  1400. {
  1401. id: 0,
  1402. node_id: 0,
  1403. name: _tr("Mortar"),
  1404. type: "RGBA",
  1405. color: 0xffc7c729,
  1406. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1407. min: 0.0,
  1408. max: 1.0,
  1409. precision: 100,
  1410. display: 0
  1411. },
  1412. {
  1413. id: 0,
  1414. node_id: 0,
  1415. name: _tr("Scale"),
  1416. type: "VALUE",
  1417. color: 0xffa1a1a1,
  1418. default_value: f32_array_create_x(5.0),
  1419. min: 0.0,
  1420. max: 10.0,
  1421. precision: 100,
  1422. display: 0
  1423. }
  1424. ],
  1425. outputs: [
  1426. {
  1427. id: 0,
  1428. node_id: 0,
  1429. name: _tr("Color"),
  1430. type: "RGBA",
  1431. color: 0xffc7c729,
  1432. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  1433. min: 0.0,
  1434. max: 1.0,
  1435. precision: 100,
  1436. display: 0
  1437. },
  1438. {
  1439. id: 0,
  1440. node_id: 0,
  1441. name: _tr("Fac"),
  1442. type: "VALUE",
  1443. color: 0xffa1a1a1,
  1444. default_value: f32_array_create_x(1.0),
  1445. min: 0.0,
  1446. max: 1.0,
  1447. precision: 100,
  1448. display: 0
  1449. }
  1450. ],
  1451. buttons: [],
  1452. width: 0
  1453. },
  1454. {
  1455. id: 0,
  1456. name: _tr("Checker Texture"),
  1457. type: "TEX_CHECKER",
  1458. x: 0,
  1459. y: 0,
  1460. color: 0xff4982a0,
  1461. inputs: [
  1462. {
  1463. id: 0,
  1464. node_id: 0,
  1465. name: _tr("Vector"),
  1466. type: "VECTOR",
  1467. color: 0xff6363c7,
  1468. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1469. min: 0.0,
  1470. max: 1.0,
  1471. precision: 100,
  1472. display: 0
  1473. },
  1474. {
  1475. id: 0,
  1476. node_id: 0,
  1477. name: _tr("Color 1"),
  1478. type: "RGBA",
  1479. color: 0xffc7c729,
  1480. default_value: f32_array_create_xyz(0.8, 0.8, 0.8),
  1481. min: 0.0,
  1482. max: 1.0,
  1483. precision: 100,
  1484. display: 0
  1485. },
  1486. {
  1487. id: 0,
  1488. node_id: 0,
  1489. name: _tr("Color 2"),
  1490. type: "RGBA",
  1491. color: 0xffc7c729,
  1492. default_value: f32_array_create_xyz(0.2, 0.2, 0.2),
  1493. min: 0.0,
  1494. max: 1.0,
  1495. precision: 100,
  1496. display: 0
  1497. },
  1498. {
  1499. id: 0,
  1500. node_id: 0,
  1501. name: _tr("Scale"),
  1502. type: "VALUE",
  1503. color: 0xffa1a1a1,
  1504. default_value: f32_array_create_x(5.0),
  1505. min: 0.0,
  1506. max: 10.0,
  1507. precision: 100,
  1508. display: 0
  1509. }
  1510. ],
  1511. outputs: [
  1512. {
  1513. id: 0,
  1514. node_id: 0,
  1515. name: _tr("Color"),
  1516. type: "RGBA",
  1517. color: 0xffc7c729,
  1518. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  1519. min: 0.0,
  1520. max: 1.0,
  1521. precision: 100,
  1522. display: 0
  1523. },
  1524. {
  1525. id: 0,
  1526. node_id: 0,
  1527. name: _tr("Fac"),
  1528. type: "VALUE",
  1529. color: 0xffa1a1a1,
  1530. default_value: f32_array_create_x(1.0),
  1531. min: 0.0,
  1532. max: 1.0,
  1533. precision: 100,
  1534. display: 0
  1535. }
  1536. ],
  1537. buttons: [],
  1538. width: 0
  1539. },
  1540. {
  1541. id: 0,
  1542. name: _tr("Curvature Bake"),
  1543. type: "BAKE_CURVATURE",
  1544. x: 0,
  1545. y: 0,
  1546. color: 0xff4982a0,
  1547. inputs: [
  1548. {
  1549. id: 0,
  1550. node_id: 0,
  1551. name: _tr("Strength"),
  1552. type: "VALUE",
  1553. color: 0xffa1a1a1,
  1554. default_value: f32_array_create_x(1.0),
  1555. min: 0.0,
  1556. max: 2.0,
  1557. precision: 100,
  1558. display: 0
  1559. },
  1560. {
  1561. id: 0,
  1562. node_id: 0,
  1563. name: _tr("Radius"),
  1564. type: "VALUE",
  1565. color: 0xffa1a1a1,
  1566. default_value: f32_array_create_x(1.0),
  1567. min: 0.0,
  1568. max: 2.0,
  1569. precision: 100,
  1570. display: 0
  1571. },
  1572. {
  1573. id: 0,
  1574. node_id: 0,
  1575. name: _tr("Offset"),
  1576. type: "VALUE",
  1577. color: 0xffa1a1a1,
  1578. default_value: f32_array_create_x(0.0),
  1579. min: -2.0,
  1580. max: 2.0,
  1581. precision: 100,
  1582. display: 0
  1583. }
  1584. ],
  1585. outputs: [
  1586. {
  1587. id: 0,
  1588. node_id: 0,
  1589. name: _tr("Value"),
  1590. type: "VALUE",
  1591. color: 0xffa1a1a1,
  1592. default_value: f32_array_create_x(1.0),
  1593. min: 0.0,
  1594. max: 1.0,
  1595. precision: 100,
  1596. display: 0
  1597. }
  1598. ],
  1599. buttons: [],
  1600. width: 0
  1601. },
  1602. {
  1603. id: 0,
  1604. name: _tr("Gradient Texture"),
  1605. type: "TEX_GRADIENT",
  1606. x: 0,
  1607. y: 0,
  1608. color: 0xff4982a0,
  1609. inputs: [
  1610. {
  1611. id: 0,
  1612. node_id: 0,
  1613. name: _tr("Vector"),
  1614. type: "VECTOR",
  1615. color: 0xff6363c7,
  1616. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1617. min: 0.0,
  1618. max: 1.0,
  1619. precision: 100,
  1620. display: 0
  1621. }
  1622. ],
  1623. outputs: [
  1624. {
  1625. id: 0,
  1626. node_id: 0,
  1627. name: _tr("Color"),
  1628. type: "RGBA",
  1629. color: 0xffc7c729,
  1630. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  1631. min: 0.0,
  1632. max: 1.0,
  1633. precision: 100,
  1634. display: 0
  1635. },
  1636. {
  1637. id: 0,
  1638. node_id: 0,
  1639. name: _tr("Fac"),
  1640. type: "VALUE",
  1641. color: 0xffa1a1a1,
  1642. default_value: f32_array_create_x(1.0),
  1643. min: 0.0,
  1644. max: 1.0,
  1645. precision: 100,
  1646. display: 0
  1647. }
  1648. ],
  1649. buttons: [
  1650. {
  1651. name: _tr("gradient_type"),
  1652. type: "ENUM",
  1653. output: 0,
  1654. default_value: f32_array_create_x(0),
  1655. data: u8_array_create_from_string(_tr("Linear") + "\n" + _tr("Diagonal") + "\n" + _tr("Radial") + "\n" + _tr("Spherical")),
  1656. min: 0.0,
  1657. max: 1.0,
  1658. precision: 100,
  1659. height: 0
  1660. }
  1661. ],
  1662. width: 0
  1663. },
  1664. {
  1665. id: 0,
  1666. name: _tr("Image Texture"),
  1667. type: "TEX_IMAGE",
  1668. x: 0,
  1669. y: 0,
  1670. color: 0xff4982a0,
  1671. inputs: [
  1672. {
  1673. id: 0,
  1674. node_id: 0,
  1675. name: _tr("Vector"),
  1676. type: "VECTOR",
  1677. color: 0xff6363c7,
  1678. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1679. min: 0.0,
  1680. max: 1.0,
  1681. precision: 100,
  1682. display: 0
  1683. }
  1684. ],
  1685. outputs: [
  1686. {
  1687. id: 0,
  1688. node_id: 0,
  1689. name: _tr("Color"),
  1690. type: "RGBA",
  1691. color: 0xffc7c729,
  1692. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  1693. min: 0.0,
  1694. max: 1.0,
  1695. precision: 100,
  1696. display: 0
  1697. },
  1698. {
  1699. id: 0,
  1700. node_id: 0,
  1701. name: _tr("Alpha"),
  1702. type: "VALUE",
  1703. color: 0xffa1a1a1,
  1704. default_value: f32_array_create_x(1.0),
  1705. min: 0.0,
  1706. max: 1.0,
  1707. precision: 100,
  1708. display: 0
  1709. }
  1710. ],
  1711. buttons: [
  1712. {
  1713. name: _tr("File"),
  1714. type: "ENUM",
  1715. output: -1,
  1716. default_value: f32_array_create_x(0),
  1717. data: u8_array_create_from_string(""),
  1718. min: 0.0,
  1719. max: 1.0,
  1720. precision: 100,
  1721. height: 0
  1722. },
  1723. {
  1724. name: _tr("Color Space"),
  1725. type: "ENUM",
  1726. output: -1,
  1727. default_value: f32_array_create_x(0),
  1728. data: u8_array_create_from_string(_tr("Auto") + "\n" + _tr("Linear") + "\n" + _tr("sRGB") + "\n" + _tr("DirectX Normal Map")),
  1729. min: 0.0,
  1730. max: 1.0,
  1731. precision: 100,
  1732. height: 0
  1733. }
  1734. ],
  1735. width: 0
  1736. },
  1737. {
  1738. id: 0,
  1739. name: _tr("Text Texture"),
  1740. type: "TEX_TEXT", // extension
  1741. x: 0,
  1742. y: 0,
  1743. color: 0xff4982a0,
  1744. inputs: [
  1745. {
  1746. id: 0,
  1747. node_id: 0,
  1748. name: _tr("Vector"),
  1749. type: "VECTOR",
  1750. color: 0xff6363c7,
  1751. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1752. min: 0.0,
  1753. max: 1.0,
  1754. precision: 100,
  1755. display: 0
  1756. }
  1757. ],
  1758. outputs: [
  1759. {
  1760. id: 0,
  1761. node_id: 0,
  1762. name: _tr("Color"),
  1763. type: "RGBA",
  1764. color: 0xffc7c729,
  1765. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  1766. min: 0.0,
  1767. max: 1.0,
  1768. precision: 100,
  1769. display: 0
  1770. },
  1771. {
  1772. id: 0,
  1773. node_id: 0,
  1774. name: _tr("Alpha"),
  1775. type: "VALUE",
  1776. color: 0xffa1a1a1,
  1777. default_value: f32_array_create_x(1.0),
  1778. min: 0.0,
  1779. max: 1.0,
  1780. precision: 100,
  1781. display: 0
  1782. }
  1783. ],
  1784. buttons: [
  1785. {
  1786. name: "text",
  1787. type: "STRING",
  1788. output: -1,
  1789. default_value: f32_array_create_x(0), // "",
  1790. data: null,
  1791. min: 0.0,
  1792. max: 1.0,
  1793. precision: 100,
  1794. height: 0
  1795. }
  1796. ],
  1797. width: 0
  1798. },
  1799. {
  1800. id: 0,
  1801. name: _tr("Magic Texture"),
  1802. type: "TEX_MAGIC",
  1803. x: 0,
  1804. y: 0,
  1805. color: 0xff4982a0,
  1806. inputs: [
  1807. {
  1808. id: 0,
  1809. node_id: 0,
  1810. name: _tr("Vector"),
  1811. type: "VECTOR",
  1812. color: 0xff6363c7,
  1813. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1814. min: 0.0,
  1815. max: 1.0,
  1816. precision: 100,
  1817. display: 0
  1818. },
  1819. {
  1820. id: 0,
  1821. node_id: 0,
  1822. name: _tr("Scale"),
  1823. type: "VALUE",
  1824. color: 0xffa1a1a1,
  1825. default_value: f32_array_create_x(5.0),
  1826. min: 0.0,
  1827. max: 10.0,
  1828. precision: 100,
  1829. display: 0
  1830. }
  1831. ],
  1832. outputs: [
  1833. {
  1834. id: 0,
  1835. node_id: 0,
  1836. name: _tr("Color"),
  1837. type: "RGBA",
  1838. color: 0xffc7c729,
  1839. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  1840. min: 0.0,
  1841. max: 1.0,
  1842. precision: 100,
  1843. display: 0
  1844. },
  1845. {
  1846. id: 0,
  1847. node_id: 0,
  1848. name: _tr("Fac"),
  1849. type: "VALUE",
  1850. color: 0xffa1a1a1,
  1851. default_value: f32_array_create_x(1.0),
  1852. min: 0.0,
  1853. max: 1.0,
  1854. precision: 100,
  1855. display: 0
  1856. }
  1857. ],
  1858. buttons: [],
  1859. width: 0
  1860. },
  1861. {
  1862. id: 0,
  1863. name: _tr("Musgrave Texture"),
  1864. type: "TEX_MUSGRAVE",
  1865. x: 0,
  1866. y: 0,
  1867. color: 0xff4982a0,
  1868. inputs: [
  1869. {
  1870. id: 0,
  1871. node_id: 0,
  1872. name: _tr("Vector"),
  1873. type: "VECTOR",
  1874. color: 0xff6363c7,
  1875. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1876. min: 0.0,
  1877. max: 1.0,
  1878. precision: 100,
  1879. display: 0
  1880. },
  1881. {
  1882. id: 0,
  1883. node_id: 0,
  1884. name: _tr("Scale"),
  1885. type: "VALUE",
  1886. color: 0xffa1a1a1,
  1887. default_value: f32_array_create_x(5.0),
  1888. min: 0.0,
  1889. max: 10.0,
  1890. precision: 100,
  1891. display: 0
  1892. }
  1893. ],
  1894. outputs: [
  1895. {
  1896. id: 0,
  1897. node_id: 0,
  1898. name: _tr("Height"),
  1899. type: "VALUE",
  1900. color: 0xffa1a1a1,
  1901. default_value: f32_array_create_x(1.0),
  1902. min: 0.0,
  1903. max: 1.0,
  1904. precision: 100,
  1905. display: 0
  1906. }
  1907. ],
  1908. buttons: [],
  1909. width: 0
  1910. },
  1911. {
  1912. id: 0,
  1913. name: _tr("Noise Texture"),
  1914. type: "TEX_NOISE",
  1915. x: 0,
  1916. y: 0,
  1917. color: 0xff4982a0,
  1918. inputs: [
  1919. {
  1920. id: 0,
  1921. node_id: 0,
  1922. name: _tr("Vector"),
  1923. type: "VECTOR",
  1924. color: 0xff6363c7,
  1925. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1926. min: 0.0,
  1927. max: 1.0,
  1928. precision: 100,
  1929. display: 0
  1930. },
  1931. {
  1932. id: 0,
  1933. node_id: 0,
  1934. name: _tr("Scale"),
  1935. type: "VALUE",
  1936. color: 0xffa1a1a1,
  1937. default_value: f32_array_create_x(5.0),
  1938. min: 0.0,
  1939. max: 10.0,
  1940. precision: 100,
  1941. display: 0
  1942. }
  1943. ],
  1944. outputs: [
  1945. {
  1946. id: 0,
  1947. node_id: 0,
  1948. name: _tr("Color"),
  1949. type: "RGBA",
  1950. color: 0xffc7c729,
  1951. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  1952. min: 0.0,
  1953. max: 1.0,
  1954. precision: 100,
  1955. display: 0
  1956. },
  1957. {
  1958. id: 0,
  1959. node_id: 0,
  1960. name: _tr("Fac"),
  1961. type: "VALUE",
  1962. color: 0xffa1a1a1,
  1963. default_value: f32_array_create_x(1.0),
  1964. min: 0.0,
  1965. max: 1.0,
  1966. precision: 100,
  1967. display: 0
  1968. }
  1969. ],
  1970. buttons: [],
  1971. width: 0
  1972. },
  1973. {
  1974. id: 0,
  1975. name: _tr("Voronoi Texture"),
  1976. type: "TEX_VORONOI",
  1977. x: 0,
  1978. y: 0,
  1979. color: 0xff4982a0,
  1980. inputs: [
  1981. {
  1982. id: 0,
  1983. node_id: 0,
  1984. name: _tr("Vector"),
  1985. type: "VECTOR",
  1986. color: 0xff6363c7,
  1987. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  1988. min: 0.0,
  1989. max: 1.0,
  1990. precision: 100,
  1991. display: 0
  1992. },
  1993. {
  1994. id: 0,
  1995. node_id: 0,
  1996. name: _tr("Scale"),
  1997. type: "VALUE",
  1998. color: 0xffa1a1a1,
  1999. default_value: f32_array_create_x(5.0),
  2000. min: 0.0,
  2001. max: 10.0,
  2002. precision: 100,
  2003. display: 0
  2004. }
  2005. ],
  2006. outputs: [
  2007. {
  2008. id: 0,
  2009. node_id: 0,
  2010. name: _tr("Color"),
  2011. type: "RGBA",
  2012. color: 0xffc7c729,
  2013. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2014. min: 0.0,
  2015. max: 1.0,
  2016. precision: 100,
  2017. display: 0
  2018. },
  2019. {
  2020. id: 0,
  2021. node_id: 0,
  2022. name: _tr("Fac"),
  2023. type: "VALUE",
  2024. color: 0xffa1a1a1,
  2025. default_value: f32_array_create_x(1.0),
  2026. min: 0.0,
  2027. max: 1.0,
  2028. precision: 100,
  2029. display: 0
  2030. }
  2031. ],
  2032. buttons: [
  2033. {
  2034. name: _tr("coloring"),
  2035. type: "ENUM",
  2036. output: 0,
  2037. default_value: f32_array_create_x(0),
  2038. data: u8_array_create_from_string(_tr("Intensity") + "\n" + _tr("Cells")),
  2039. min: 0.0,
  2040. max: 1.0,
  2041. precision: 100,
  2042. height: 0
  2043. }
  2044. ],
  2045. width: 0
  2046. },
  2047. {
  2048. id: 0,
  2049. name: _tr("Wave Texture"),
  2050. type: "TEX_WAVE",
  2051. x: 0,
  2052. y: 0,
  2053. color: 0xff4982a0,
  2054. inputs: [
  2055. {
  2056. id: 0,
  2057. node_id: 0,
  2058. name: _tr("Vector"),
  2059. type: "VECTOR",
  2060. color: 0xff6363c7,
  2061. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2062. min: 0.0,
  2063. max: 1.0,
  2064. precision: 100,
  2065. display: 0
  2066. },
  2067. {
  2068. id: 0,
  2069. node_id: 0,
  2070. name: _tr("Scale"),
  2071. type: "VALUE",
  2072. color: 0xffa1a1a1,
  2073. default_value: f32_array_create_x(5.0),
  2074. min: 0.0,
  2075. max: 10.0,
  2076. precision: 100,
  2077. display: 0
  2078. }
  2079. ],
  2080. outputs: [
  2081. {
  2082. id: 0,
  2083. node_id: 0,
  2084. name: _tr("Color"),
  2085. type: "RGBA",
  2086. color: 0xffc7c729,
  2087. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2088. min: 0.0,
  2089. max: 1.0,
  2090. precision: 100,
  2091. display: 0
  2092. },
  2093. {
  2094. id: 0,
  2095. node_id: 0,
  2096. name: _tr("Fac"),
  2097. type: "VALUE",
  2098. color: 0xffa1a1a1,
  2099. default_value: f32_array_create_x(1.0),
  2100. min: 0.0,
  2101. max: 1.0,
  2102. precision: 100,
  2103. display: 0
  2104. }
  2105. ],
  2106. buttons: [],
  2107. width: 0
  2108. }
  2109. ];
  2110. let nodes_material_color: ui_node_t[] = [
  2111. {
  2112. id: 0,
  2113. name: _tr("Blur"),
  2114. type: "BLUR", // extension
  2115. x: 0,
  2116. y: 0,
  2117. color: 0xff448c6d,
  2118. inputs: [
  2119. {
  2120. id: 0,
  2121. node_id: 0,
  2122. name: _tr("Color"),
  2123. type: "RGBA",
  2124. color: 0xffc7c729,
  2125. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2126. min: 0.0,
  2127. max: 1.0,
  2128. precision: 100,
  2129. display: 0
  2130. },
  2131. {
  2132. id: 0,
  2133. node_id: 0,
  2134. name: _tr("Strength"),
  2135. type: "VALUE",
  2136. color: 0xffa1a1a1,
  2137. default_value: f32_array_create_x(0.5),
  2138. min: 0.0,
  2139. max: 1.0,
  2140. precision: 100,
  2141. display: 0
  2142. }
  2143. ],
  2144. outputs: [
  2145. {
  2146. id: 0,
  2147. node_id: 0,
  2148. name: _tr("Color"),
  2149. type: "RGBA",
  2150. color: 0xffc7c729,
  2151. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2152. min: 0.0,
  2153. max: 1.0,
  2154. precision: 100,
  2155. display: 0
  2156. }
  2157. ],
  2158. buttons: [],
  2159. width: 0
  2160. },
  2161. {
  2162. id: 0,
  2163. name: _tr("Brightness/Contrast"),
  2164. type: "BRIGHTCONTRAST",
  2165. x: 0,
  2166. y: 0,
  2167. color: 0xff448c6d,
  2168. inputs: [
  2169. {
  2170. id: 0,
  2171. node_id: 0,
  2172. name: _tr("Color"),
  2173. type: "RGBA",
  2174. color: 0xffc7c729,
  2175. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2176. min: 0.0,
  2177. max: 1.0,
  2178. precision: 100,
  2179. display: 0
  2180. },
  2181. {
  2182. id: 0,
  2183. node_id: 0,
  2184. name: _tr("Bright"),
  2185. type: "VALUE",
  2186. color: 0xffa1a1a1,
  2187. default_value: f32_array_create_x(0.0),
  2188. min: 0.0,
  2189. max: 1.0,
  2190. precision: 100,
  2191. display: 0
  2192. },
  2193. {
  2194. id: 0,
  2195. node_id: 0,
  2196. name: _tr("Contrast"),
  2197. type: "VALUE",
  2198. color: 0xffa1a1a1,
  2199. default_value: f32_array_create_x(0.0),
  2200. min: 0.0,
  2201. max: 1.0,
  2202. precision: 100,
  2203. display: 0
  2204. }
  2205. ],
  2206. outputs: [
  2207. {
  2208. id: 0,
  2209. node_id: 0,
  2210. name: _tr("Color"),
  2211. type: "RGBA",
  2212. color: 0xffc7c729,
  2213. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2214. min: 0.0,
  2215. max: 1.0,
  2216. precision: 100,
  2217. display: 0
  2218. }
  2219. ],
  2220. buttons: [],
  2221. width: 0
  2222. },
  2223. {
  2224. id: 0,
  2225. name: _tr("Gamma"),
  2226. type: "GAMMA",
  2227. x: 0,
  2228. y: 0,
  2229. color: 0xff448c6d,
  2230. inputs: [
  2231. {
  2232. id: 0,
  2233. node_id: 0,
  2234. name: _tr("Color"),
  2235. type: "RGBA",
  2236. color: 0xffc7c729,
  2237. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2238. min: 0.0,
  2239. max: 1.0,
  2240. precision: 100,
  2241. display: 0
  2242. },
  2243. {
  2244. id: 0,
  2245. node_id: 0,
  2246. name: _tr("Gamma"),
  2247. type: "VALUE",
  2248. color: 0xffa1a1a1,
  2249. default_value: f32_array_create_x(1.0),
  2250. min: 0.0,
  2251. max: 1.0,
  2252. precision: 100,
  2253. display: 0
  2254. }
  2255. ],
  2256. outputs: [
  2257. {
  2258. id: 0,
  2259. node_id: 0,
  2260. name: _tr("Color"),
  2261. type: "RGBA",
  2262. color: 0xffc7c729,
  2263. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2264. min: 0.0,
  2265. max: 1.0,
  2266. precision: 100,
  2267. display: 0
  2268. }
  2269. ],
  2270. buttons: [],
  2271. width: 0
  2272. },
  2273. {
  2274. id: 0,
  2275. name: _tr("Hue/Saturation/Value"),
  2276. type: "HUE_SAT",
  2277. x: 0,
  2278. y: 0,
  2279. color: 0xff448c6d,
  2280. inputs: [
  2281. {
  2282. id: 0,
  2283. node_id: 0,
  2284. name: _tr("Hue"),
  2285. type: "VALUE",
  2286. color: 0xffa1a1a1,
  2287. default_value: f32_array_create_x(0.5),
  2288. min: 0.0,
  2289. max: 1.0,
  2290. precision: 100,
  2291. display: 0
  2292. },
  2293. {
  2294. id: 0,
  2295. node_id: 0,
  2296. name: _tr("Saturation"),
  2297. type: "VALUE",
  2298. color: 0xffa1a1a1,
  2299. default_value: f32_array_create_x(1.0),
  2300. min: 0.0,
  2301. max: 1.0,
  2302. precision: 100,
  2303. display: 0
  2304. },
  2305. {
  2306. id: 0,
  2307. node_id: 0,
  2308. name: _tr("Value"),
  2309. type: "VALUE",
  2310. color: 0xffa1a1a1,
  2311. default_value: f32_array_create_x(1.0),
  2312. min: 0.0,
  2313. max: 1.0,
  2314. precision: 100,
  2315. display: 0
  2316. },
  2317. {
  2318. id: 0,
  2319. node_id: 0,
  2320. name: _tr("Fac"),
  2321. type: "VALUE",
  2322. color: 0xffa1a1a1,
  2323. default_value: f32_array_create_x(1.0),
  2324. min: 0.0,
  2325. max: 1.0,
  2326. precision: 100,
  2327. display: 0
  2328. },
  2329. {
  2330. id: 0,
  2331. node_id: 0,
  2332. name: _tr("Color"),
  2333. type: "RGBA",
  2334. color: 0xffc7c729,
  2335. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2336. min: 0.0,
  2337. max: 1.0,
  2338. precision: 100,
  2339. display: 0
  2340. }
  2341. ],
  2342. outputs: [
  2343. {
  2344. id: 0,
  2345. node_id: 0,
  2346. name: _tr("Color"),
  2347. type: "RGBA",
  2348. color: 0xffc7c729,
  2349. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2350. min: 0.0,
  2351. max: 1.0,
  2352. precision: 100,
  2353. display: 0
  2354. }
  2355. ],
  2356. buttons: [],
  2357. width: 0
  2358. },
  2359. {
  2360. id: 0,
  2361. name: _tr("Invert"),
  2362. type: "INVERT",
  2363. x: 0,
  2364. y: 0,
  2365. color: 0xff448c6d,
  2366. inputs: [
  2367. {
  2368. id: 0,
  2369. node_id: 0,
  2370. name: _tr("Fac"),
  2371. type: "VALUE",
  2372. color: 0xffa1a1a1,
  2373. default_value: f32_array_create_x(1.0),
  2374. min: 0.0,
  2375. max: 1.0,
  2376. precision: 100,
  2377. display: 0
  2378. },
  2379. {
  2380. id: 0,
  2381. node_id: 0,
  2382. name: _tr("Color"),
  2383. type: "RGBA",
  2384. color: 0xffc7c729,
  2385. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  2386. min: 0.0,
  2387. max: 1.0,
  2388. precision: 100,
  2389. display: 0
  2390. }
  2391. ],
  2392. outputs: [
  2393. {
  2394. id: 0,
  2395. node_id: 0,
  2396. name: _tr("Color"),
  2397. type: "RGBA",
  2398. color: 0xffc7c729,
  2399. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2400. min: 0.0,
  2401. max: 1.0,
  2402. precision: 100,
  2403. display: 0
  2404. }
  2405. ],
  2406. buttons: [],
  2407. width: 0
  2408. },
  2409. {
  2410. id: 0,
  2411. name: _tr("Mix Color"),
  2412. type: "MIX_RGB",
  2413. x: 0,
  2414. y: 0,
  2415. color: 0xff448c6d,
  2416. inputs: [
  2417. {
  2418. id: 0,
  2419. node_id: 0,
  2420. name: _tr("Fac"),
  2421. type: "VALUE",
  2422. color: 0xffa1a1a1,
  2423. default_value: f32_array_create_x(0.5),
  2424. min: 0.0,
  2425. max: 1.0,
  2426. precision: 100,
  2427. display: 0
  2428. },
  2429. {
  2430. id: 0,
  2431. node_id: 0,
  2432. name: _tr("Color 1"),
  2433. type: "RGBA",
  2434. color: 0xffc7c729,
  2435. default_value: f32_array_create_xyzw(0.5, 0.5, 0.5, 1.0),
  2436. min: 0.0,
  2437. max: 1.0,
  2438. precision: 100,
  2439. display: 0
  2440. },
  2441. {
  2442. id: 0,
  2443. node_id: 0,
  2444. name: _tr("Color 2"),
  2445. type: "RGBA",
  2446. color: 0xffc7c729,
  2447. default_value: f32_array_create_xyzw(0.5, 0.5, 0.5, 1.0),
  2448. min: 0.0,
  2449. max: 1.0,
  2450. precision: 100,
  2451. display: 0
  2452. }
  2453. ],
  2454. outputs: [
  2455. {
  2456. id: 0,
  2457. node_id: 0,
  2458. name: _tr("Color"),
  2459. type: "RGBA",
  2460. color: 0xffc7c729,
  2461. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2462. min: 0.0,
  2463. max: 1.0,
  2464. precision: 100,
  2465. display: 0
  2466. }
  2467. ],
  2468. buttons: [
  2469. {
  2470. name: _tr("blend_type"),
  2471. type: "ENUM",
  2472. output: 0,
  2473. default_value: f32_array_create_x(0),
  2474. data: u8_array_create_from_string(_tr("Mix") + "\n" + _tr("Darken") + "\n" + _tr("Multiply") + "\n" + _tr("Burn") + "\n" + _tr("Lighten") + "\n" + _tr("Screen") + "\n" + _tr("Dodge") + "\n" + _tr("Add") + "\n" + _tr("Overlay") + "\n" + _tr("Soft Light") + "\n" + _tr("Linear Light") + "\n" + _tr("Difference") + "\n" + _tr("Subtract") + "\n" + _tr("Divide") + "\n" + _tr("Hue") + "\n" + _tr("Saturation") + "\n" + _tr("Color") + "\n" + _tr("Value")),
  2475. min: 0.0,
  2476. max: 1.0,
  2477. precision: 100,
  2478. height: 0
  2479. },
  2480. {
  2481. name: _tr("use_clamp"),
  2482. type: "BOOL",
  2483. output: 0,
  2484. default_value: f32_array_create_x(0),
  2485. data: null,
  2486. min: 0.0,
  2487. max: 1.0,
  2488. precision: 100,
  2489. height: 0
  2490. }
  2491. ],
  2492. width: 0
  2493. },
  2494. {
  2495. id: 0,
  2496. name: _tr("Quantize"),
  2497. type: "QUANTIZE", // extension
  2498. x: 0,
  2499. y: 0,
  2500. color: 0xff448c6d,
  2501. inputs: [
  2502. {
  2503. id: 0,
  2504. node_id: 0,
  2505. name: _tr("Strength"),
  2506. type: "VALUE",
  2507. color: 0xffa1a1a1,
  2508. default_value: f32_array_create_x(0.1),
  2509. min: 0.0,
  2510. max: 1.0,
  2511. precision: 100,
  2512. display: 0
  2513. },
  2514. {
  2515. id: 0,
  2516. node_id: 0,
  2517. name: _tr("Color"),
  2518. type: "RGBA",
  2519. color: 0xffc7c729,
  2520. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  2521. min: 0.0,
  2522. max: 1.0,
  2523. precision: 100,
  2524. display: 0
  2525. }
  2526. ],
  2527. outputs: [
  2528. {
  2529. id: 0,
  2530. node_id: 0,
  2531. name: _tr("Color"),
  2532. type: "RGBA",
  2533. color: 0xffc7c729,
  2534. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2535. min: 0.0,
  2536. max: 1.0,
  2537. precision: 100,
  2538. display: 0
  2539. }
  2540. ],
  2541. buttons: [],
  2542. width: 0
  2543. },
  2544. {
  2545. id: 0,
  2546. name: _tr("Replace Color"),
  2547. type: "REPLACECOL", // extension
  2548. x: 0,
  2549. y: 0,
  2550. color: 0xff448c6d,
  2551. inputs: [
  2552. {
  2553. id: 0,
  2554. node_id: 0,
  2555. name: _tr("Color"),
  2556. type: "RGBA",
  2557. color: 0xffc7c729,
  2558. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0)
  2559. },
  2560. {
  2561. id: 0,
  2562. node_id: 0,
  2563. name: _tr("Old Color"),
  2564. type: "RGBA",
  2565. color: 0xffc7c729,
  2566. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0)
  2567. },
  2568. {
  2569. id: 0,
  2570. node_id: 0,
  2571. name: _tr("New Color"),
  2572. type: "RGBA",
  2573. color: 0xffc7c729,
  2574. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0)
  2575. },
  2576. {
  2577. id: 0,
  2578. node_id: 0,
  2579. name: _tr("Radius"),
  2580. type: "VALUE",
  2581. color: 0xffa1a1a1,
  2582. default_value: f32_array_create_x(0.1),
  2583. min: 0.0,
  2584. max: 1.74,
  2585. precision: 100,
  2586. display: 0
  2587. },
  2588. {
  2589. id: 0,
  2590. node_id: 0,
  2591. name: _tr("Fuzziness"),
  2592. type: "VALUE",
  2593. color: 0xffa1a1a1,
  2594. default_value: f32_array_create_x(0.0),
  2595. min: 0.0,
  2596. max: 1.0,
  2597. precision: 100,
  2598. display: 0
  2599. }
  2600. ],
  2601. outputs: [
  2602. {
  2603. id: 0,
  2604. node_id: 0,
  2605. name: _tr("Color"),
  2606. type: "RGBA",
  2607. color: 0xffc7c729,
  2608. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0)
  2609. }
  2610. ],
  2611. buttons: []
  2612. },
  2613. {
  2614. id: 0,
  2615. name: _tr("Warp"),
  2616. type: "DIRECT_WARP", // extension
  2617. x: 0,
  2618. y: 0,
  2619. color: 0xff448c6d,
  2620. inputs: [
  2621. {
  2622. id: 0,
  2623. node_id: 0,
  2624. name: _tr("Color"),
  2625. type: "RGBA",
  2626. color: 0xffc7c729,
  2627. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2628. min: 0.0,
  2629. max: 1.0,
  2630. precision: 100,
  2631. display: 0
  2632. },
  2633. {
  2634. id: 0,
  2635. node_id: 0,
  2636. name: _tr("Angle"),
  2637. type: "VALUE",
  2638. color: 0xffa1a1a1,
  2639. default_value: f32_array_create_x(0.0),
  2640. min: 0.0,
  2641. max: 360.0,
  2642. precision: 100,
  2643. display: 0
  2644. },
  2645. {
  2646. id: 0,
  2647. node_id: 0,
  2648. name: _tr("Mask"),
  2649. type: "VALUE",
  2650. color: 0xffa1a1a1,
  2651. default_value: f32_array_create_x(0.5),
  2652. min: 0.0,
  2653. max: 1.0,
  2654. precision: 100,
  2655. display: 0
  2656. }
  2657. ],
  2658. outputs: [
  2659. {
  2660. id: 0,
  2661. node_id: 0,
  2662. name: _tr("Color"),
  2663. type: "RGBA",
  2664. color: 0xffc7c729,
  2665. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  2666. min: 0.0,
  2667. max: 1.0,
  2668. precision: 100,
  2669. display: 0
  2670. }
  2671. ],
  2672. buttons: [],
  2673. width: 0
  2674. }
  2675. ];
  2676. let nodes_material_vector: ui_node_t[] = [
  2677. {
  2678. id: 0,
  2679. name: _tr("Bump"),
  2680. type: "BUMP",
  2681. x: 0,
  2682. y: 0,
  2683. color: 0xff522c99,
  2684. inputs: [
  2685. {
  2686. id: 0,
  2687. node_id: 0,
  2688. name: _tr("Strength"),
  2689. type: "VALUE",
  2690. color: 0xffa1a1a1,
  2691. default_value: f32_array_create_x(1.0),
  2692. min: 0.0,
  2693. max: 1.0,
  2694. precision: 100,
  2695. display: 0
  2696. },
  2697. {
  2698. id: 0,
  2699. node_id: 0,
  2700. name: _tr("Distance"),
  2701. type: "VALUE",
  2702. color: 0xffa1a1a1,
  2703. default_value: f32_array_create_x(0.0),
  2704. min: 0.0,
  2705. max: 1.0,
  2706. precision: 100,
  2707. display: 0
  2708. },
  2709. {
  2710. id: 0,
  2711. node_id: 0,
  2712. name: _tr("Height"),
  2713. type: "VALUE",
  2714. color: 0xffa1a1a1,
  2715. default_value: f32_array_create_x(1.0),
  2716. min: 0.0,
  2717. max: 1.0,
  2718. precision: 100,
  2719. display: 0
  2720. },
  2721. {
  2722. id: 0,
  2723. node_id: 0,
  2724. name: _tr("Normal"),
  2725. type: "VECTOR",
  2726. color: 0xff6363c7,
  2727. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2728. min: 0.0,
  2729. max: 1.0,
  2730. precision: 100,
  2731. display: 0
  2732. }
  2733. ],
  2734. outputs: [
  2735. {
  2736. id: 0,
  2737. node_id: 0,
  2738. name: _tr("Normal Map"),
  2739. type: "VECTOR",
  2740. color: -10238109,
  2741. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2742. min: 0.0,
  2743. max: 1.0,
  2744. precision: 100,
  2745. display: 0
  2746. }
  2747. ],
  2748. buttons: [],
  2749. width: 0
  2750. },
  2751. {
  2752. id: 0,
  2753. name: _tr("Mapping"),
  2754. type: "MAPPING",
  2755. x: 0,
  2756. y: 0,
  2757. color: 0xff522c99,
  2758. inputs: [
  2759. {
  2760. id: 0,
  2761. node_id: 0,
  2762. name: _tr("Vector"),
  2763. type: "VECTOR",
  2764. color: 0xff6363c7,
  2765. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2766. min: 0.0,
  2767. max: 1.0,
  2768. precision: 100,
  2769. display: 0
  2770. },
  2771. {
  2772. id: 0,
  2773. node_id: 0,
  2774. name: _tr("Location"),
  2775. type: "VECTOR",
  2776. color: 0xff6363c7,
  2777. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2778. min: 0.0,
  2779. max: 1.0,
  2780. precision: 100,
  2781. display: 1
  2782. },
  2783. {
  2784. id: 0,
  2785. node_id: 0,
  2786. name: _tr("Rotation"),
  2787. type: "VECTOR",
  2788. color: 0xff6363c7,
  2789. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2790. min: 0.0,
  2791. max: 360.0,
  2792. precision: 100,
  2793. display: 1
  2794. },
  2795. {
  2796. id: 0,
  2797. node_id: 0,
  2798. name: _tr("Scale"),
  2799. type: "VECTOR",
  2800. color: 0xff6363c7,
  2801. default_value: f32_array_create_xyz(1.0, 1.0, 1.0),
  2802. min: 0.0,
  2803. max: 1.0,
  2804. precision: 100,
  2805. display: 1
  2806. }
  2807. ],
  2808. outputs: [
  2809. {
  2810. id: 0,
  2811. node_id: 0,
  2812. name: _tr("Vector"),
  2813. type: "VECTOR",
  2814. color: 0xff6363c7,
  2815. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2816. min: 0.0,
  2817. max: 1.0,
  2818. precision: 100,
  2819. display: 0
  2820. }
  2821. ],
  2822. buttons: [],
  2823. width: 0
  2824. },
  2825. {
  2826. id: 0,
  2827. name: _tr("Mix Normal Map"),
  2828. type: "MIX_NORMAL_MAP", // extension
  2829. x: 0,
  2830. y: 0,
  2831. color: 0xff522c99,
  2832. inputs: [
  2833. {
  2834. id: 0,
  2835. node_id: 0,
  2836. name: _tr("Normal Map 1"),
  2837. type: "VECTOR",
  2838. color: -10238109,
  2839. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  2840. min: 0.0,
  2841. max: 1.0,
  2842. precision: 100,
  2843. display: 0
  2844. },
  2845. {
  2846. id: 0,
  2847. node_id: 0,
  2848. name: _tr("Normal Map 2"),
  2849. type: "VECTOR",
  2850. color: -10238109,
  2851. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  2852. min: 0.0,
  2853. max: 1.0,
  2854. precision: 100,
  2855. display: 0
  2856. }
  2857. ],
  2858. outputs: [
  2859. {
  2860. id: 0,
  2861. node_id: 0,
  2862. name: _tr("Normal Map"),
  2863. type: "VECTOR",
  2864. color: -10238109,
  2865. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  2866. min: 0.0,
  2867. max: 1.0,
  2868. precision: 100,
  2869. display: 0
  2870. }
  2871. ],
  2872. buttons: [
  2873. {
  2874. name: _tr("blend_type"),
  2875. type: "ENUM",
  2876. output: 0,
  2877. default_value: f32_array_create_x(0),
  2878. data: u8_array_create_from_string(_tr("Partial Derivative") + "\n" + _tr("Whiteout") + "\n" + _tr("Reoriented")),
  2879. min: 0.0,
  2880. max: 1.0,
  2881. precision: 100,
  2882. height: 0
  2883. }
  2884. ],
  2885. width: 0
  2886. },
  2887. {
  2888. id: 0,
  2889. name: _tr("Normal"),
  2890. type: "NORMAL",
  2891. x: 0,
  2892. y: 0,
  2893. color: 0xff522c99,
  2894. inputs: [
  2895. {
  2896. id: 0,
  2897. node_id: 0,
  2898. name: _tr("Normal"),
  2899. type: "VECTOR",
  2900. color: 0xff6363c7,
  2901. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2902. min: 0.0,
  2903. max: 1.0,
  2904. precision: 100,
  2905. display: 0
  2906. }
  2907. ],
  2908. outputs: [
  2909. {
  2910. id: 0,
  2911. node_id: 0,
  2912. name: _tr("Normal"),
  2913. type: "VECTOR",
  2914. color: 0xff6363c7,
  2915. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2916. min: 0.0,
  2917. max: 1.0,
  2918. precision: 100,
  2919. display: 0
  2920. },
  2921. {
  2922. id: 0,
  2923. node_id: 0,
  2924. name: _tr("Dot"),
  2925. type: "VALUE",
  2926. color: 0xffa1a1a1,
  2927. default_value: f32_array_create_x(1.0),
  2928. min: 0.0,
  2929. max: 1.0,
  2930. precision: 100,
  2931. display: 0
  2932. }
  2933. ],
  2934. buttons: [
  2935. {
  2936. name: _tr("Vector"),
  2937. type: "VECTOR",
  2938. output: 0,
  2939. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  2940. data: null,
  2941. min: 0.0,
  2942. max: 1.0,
  2943. precision: 100,
  2944. height: 0
  2945. }
  2946. ],
  2947. width: 0
  2948. },
  2949. {
  2950. id: 0,
  2951. name: _tr("Normal Map"),
  2952. type: "NORMAL_MAP",
  2953. x: 0,
  2954. y: 0,
  2955. color: 0xff522c99,
  2956. inputs: [
  2957. {
  2958. id: 0,
  2959. node_id: 0,
  2960. name: _tr("Strength"),
  2961. type: "VALUE",
  2962. color: 0xffa1a1a1,
  2963. default_value: f32_array_create_x(1.0),
  2964. min: 0.0,
  2965. max: 2.0,
  2966. precision: 100,
  2967. display: 0
  2968. },
  2969. {
  2970. id: 0,
  2971. node_id: 0,
  2972. name: _tr("Normal Map"),
  2973. type: "VECTOR",
  2974. color: -10238109,
  2975. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  2976. min: 0.0,
  2977. max: 1.0,
  2978. precision: 100,
  2979. display: 0
  2980. }
  2981. ],
  2982. outputs: [
  2983. {
  2984. id: 0,
  2985. node_id: 0,
  2986. name: _tr("Normal Map"),
  2987. type: "VECTOR",
  2988. color: -10238109,
  2989. default_value: f32_array_create_xyz(0.5, 0.5, 1.0),
  2990. min: 0.0,
  2991. max: 1.0,
  2992. precision: 100,
  2993. display: 0
  2994. }
  2995. ],
  2996. buttons: [],
  2997. width: 0
  2998. },
  2999. {
  3000. id: 0,
  3001. name: _tr("Vector Curves"),
  3002. type: "CURVE_VEC",
  3003. x: 0,
  3004. y: 0,
  3005. color: 0xff522c99,
  3006. inputs: [
  3007. {
  3008. id: 0,
  3009. node_id: 0,
  3010. name: _tr("Fac"),
  3011. type: "VALUE",
  3012. color: 0xffa1a1a1,
  3013. default_value: f32_array_create_x(1.0),
  3014. min: 0.0,
  3015. max: 1.0,
  3016. precision: 100,
  3017. display: 0
  3018. },
  3019. {
  3020. id: 0,
  3021. node_id: 0,
  3022. name: _tr("Vector"),
  3023. type: "VECTOR",
  3024. color: 0xff6363c7,
  3025. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  3026. min: 0.0,
  3027. max: 1.0,
  3028. precision: 100,
  3029. display: 0
  3030. }
  3031. ],
  3032. outputs: [
  3033. {
  3034. id: 0,
  3035. node_id: 0,
  3036. name: _tr("Vector"),
  3037. type: "VECTOR",
  3038. color: 0xff6363c7,
  3039. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  3040. min: 0.0,
  3041. max: 1.0,
  3042. precision: 100,
  3043. display: 0
  3044. }
  3045. ],
  3046. buttons: [
  3047. {
  3048. name: "nodes_material_vector_curves_button",
  3049. type: "CUSTOM",
  3050. output: 0,
  3051. default_value: f32_array_create(96 + 3), // x - [0, 32], y - [33, 64], z - [65, 96], x_len, y_len, z_len
  3052. data: null,
  3053. min: 0.0,
  3054. max: 1.0,
  3055. precision: 100,
  3056. height: 8.5
  3057. }
  3058. ],
  3059. width: 0
  3060. }
  3061. ];
  3062. let nodes_material_converter: ui_node_t[] = [
  3063. {
  3064. id: 0,
  3065. name: _tr("Clamp"),
  3066. type: "CLAMP",
  3067. x: 0,
  3068. y: 0,
  3069. color: 0xff62676d,
  3070. inputs: [
  3071. {
  3072. id: 0,
  3073. node_id: 0,
  3074. name: _tr("Value"),
  3075. type: "VALUE",
  3076. color: 0xffa1a1a1,
  3077. default_value: f32_array_create_x(0.5),
  3078. min: 0.0,
  3079. max: 1.0,
  3080. precision: 100,
  3081. display: 0
  3082. },
  3083. {
  3084. id: 0,
  3085. node_id: 0,
  3086. name: _tr("Min"),
  3087. type: "VALUE",
  3088. color: 0xffa1a1a1,
  3089. default_value: f32_array_create_x(0.0),
  3090. min: 0.0,
  3091. max: 1.0,
  3092. precision: 100,
  3093. display: 0
  3094. },
  3095. {
  3096. id: 0,
  3097. node_id: 0,
  3098. name: _tr("Max"),
  3099. type: "VALUE",
  3100. color: 0xffa1a1a1,
  3101. default_value: f32_array_create_x(1.0),
  3102. min: 0.0,
  3103. max: 1.0,
  3104. precision: 100,
  3105. display: 0
  3106. }
  3107. ],
  3108. outputs: [
  3109. {
  3110. id: 0,
  3111. node_id: 0,
  3112. name: _tr("Value"),
  3113. type: "VALUE",
  3114. color: 0xffa1a1a1,
  3115. default_value: f32_array_create_x(0.0),
  3116. min: 0.0,
  3117. max: 1.0,
  3118. precision: 100,
  3119. display: 0
  3120. }
  3121. ],
  3122. buttons: [
  3123. {
  3124. name: _tr("operation"),
  3125. type: "ENUM",
  3126. output: 0,
  3127. default_value: f32_array_create_x(0),
  3128. data: u8_array_create_from_string(_tr("Min Max") + "\n" + _tr("Range")),
  3129. min: 0.0,
  3130. max: 1.0,
  3131. precision: 100,
  3132. height: 0
  3133. }
  3134. ],
  3135. width: 0
  3136. },
  3137. {
  3138. id: 0,
  3139. name: _tr("Color Ramp"),
  3140. type: "VALTORGB",
  3141. x: 0,
  3142. y: 0,
  3143. color: 0xff62676d,
  3144. inputs: [
  3145. {
  3146. id: 0,
  3147. node_id: 0,
  3148. name: _tr("Fac"),
  3149. type: "VALUE",
  3150. color: 0xffa1a1a1,
  3151. default_value: f32_array_create_x(0.5),
  3152. min: 0.0,
  3153. max: 1.0,
  3154. precision: 100,
  3155. display: 0
  3156. }
  3157. ],
  3158. outputs: [
  3159. {
  3160. id: 0,
  3161. node_id: 0,
  3162. name: _tr("Color"),
  3163. type: "RGBA",
  3164. color: 0xffc7c729,
  3165. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 1.0),
  3166. min: 0.0,
  3167. max: 1.0,
  3168. precision: 100,
  3169. display: 0
  3170. },
  3171. {
  3172. id: 0,
  3173. node_id: 0,
  3174. name: _tr("Alpha"),
  3175. type: "VALUE",
  3176. color: 0xffa1a1a1,
  3177. default_value: f32_array_create_x(0.0),
  3178. min: 0.0,
  3179. max: 1.0,
  3180. precision: 100,
  3181. display: 0
  3182. }
  3183. ],
  3184. buttons: [
  3185. {
  3186. name: "nodes_material_color_ramp_button",
  3187. type: "CUSTOM",
  3188. output: 0,
  3189. default_value: f32_array_create_xyzwv(1.0, 1.0, 1.0, 1.0, 0.0),
  3190. data: u8_array_create(1),
  3191. min: 0.0,
  3192. max: 1.0,
  3193. precision: 100,
  3194. height: 4.5
  3195. }
  3196. ],
  3197. width: 0
  3198. },
  3199. {
  3200. id: 0,
  3201. name: _tr("Color Mask"),
  3202. type: "COLMASK", // extension
  3203. x: 0,
  3204. y: 0,
  3205. color: 0xff62676d,
  3206. inputs: [
  3207. {
  3208. id: 0,
  3209. node_id: 0,
  3210. name: _tr("Color"),
  3211. type: "RGBA",
  3212. color: 0xffc7c729,
  3213. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  3214. min: 0.0,
  3215. max: 1.0,
  3216. precision: 100,
  3217. display: 0
  3218. },
  3219. {
  3220. id: 0,
  3221. node_id: 0,
  3222. name: _tr("Mask Color"),
  3223. type: "RGBA",
  3224. color: 0xffc7c729,
  3225. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  3226. min: 0.0,
  3227. max: 1.0,
  3228. precision: 100,
  3229. display: 0
  3230. },
  3231. {
  3232. id: 0,
  3233. node_id: 0,
  3234. name: _tr("Radius"),
  3235. type: "VALUE",
  3236. color: 0xffa1a1a1,
  3237. default_value: f32_array_create_x(0.1),
  3238. min: 0.0,
  3239. max: 1.74,
  3240. precision: 100,
  3241. display: 0
  3242. },
  3243. {
  3244. id: 0,
  3245. node_id: 0,
  3246. name: _tr("Fuzziness"),
  3247. type: "VALUE",
  3248. color: 0xffa1a1a1,
  3249. default_value: f32_array_create_x(0.0),
  3250. min: 0.0,
  3251. max: 1.0,
  3252. precision: 100,
  3253. display: 0
  3254. }
  3255. ],
  3256. outputs: [
  3257. {
  3258. id: 0,
  3259. node_id: 0,
  3260. name: _tr("Mask"),
  3261. type: "VALUE",
  3262. color: 0xffa1a1a1,
  3263. default_value: f32_array_create_x(0.0),
  3264. min: 0.0,
  3265. max: 1.0,
  3266. precision: 100,
  3267. display: 0
  3268. }
  3269. ],
  3270. buttons: [],
  3271. width: 0
  3272. },
  3273. {
  3274. id: 0,
  3275. name: _tr("Combine HSV"),
  3276. type: "COMBHSV",
  3277. x: 0,
  3278. y: 0,
  3279. color: 0xff62676d,
  3280. inputs: [
  3281. {
  3282. id: 0,
  3283. node_id: 0,
  3284. name: _tr("H"),
  3285. type: "VALUE",
  3286. color: 0xffa1a1a1,
  3287. default_value: f32_array_create_x(0.0),
  3288. min: 0.0,
  3289. max: 1.0,
  3290. precision: 100,
  3291. display: 0
  3292. },
  3293. {
  3294. id: 0,
  3295. node_id: 0,
  3296. name: _tr("S"),
  3297. type: "VALUE",
  3298. color: 0xffa1a1a1,
  3299. default_value: f32_array_create_x(0.0),
  3300. min: 0.0,
  3301. max: 1.0,
  3302. precision: 100,
  3303. display: 0
  3304. },
  3305. {
  3306. id: 0,
  3307. node_id: 0,
  3308. name: _tr("V"),
  3309. type: "VALUE",
  3310. color: 0xffa1a1a1,
  3311. default_value: f32_array_create_x(0.0),
  3312. min: 0.0,
  3313. max: 1.0,
  3314. precision: 100,
  3315. display: 0
  3316. }
  3317. ],
  3318. outputs: [
  3319. {
  3320. id: 0,
  3321. node_id: 0,
  3322. name: _tr("Color"),
  3323. type: "RGBA",
  3324. color: 0xffc7c729,
  3325. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  3326. min: 0.0,
  3327. max: 1.0,
  3328. precision: 100,
  3329. display: 0
  3330. }
  3331. ],
  3332. buttons: [],
  3333. width: 0
  3334. },
  3335. {
  3336. id: 0,
  3337. name: _tr("Combine RGB"),
  3338. type: "COMBRGB",
  3339. x: 0,
  3340. y: 0,
  3341. color: 0xff62676d,
  3342. inputs: [
  3343. {
  3344. id: 0,
  3345. node_id: 0,
  3346. name: _tr("R"),
  3347. type: "VALUE",
  3348. color: 0xffa1a1a1,
  3349. default_value: f32_array_create_x(0.0),
  3350. min: 0.0,
  3351. max: 1.0,
  3352. precision: 100,
  3353. display: 0
  3354. },
  3355. {
  3356. id: 0,
  3357. node_id: 0,
  3358. name: _tr("G"),
  3359. type: "VALUE",
  3360. color: 0xffa1a1a1,
  3361. default_value: f32_array_create_x(0.0),
  3362. min: 0.0,
  3363. max: 1.0,
  3364. precision: 100,
  3365. display: 0
  3366. },
  3367. {
  3368. id: 0,
  3369. node_id: 0,
  3370. name: _tr("B"),
  3371. type: "VALUE",
  3372. color: 0xffa1a1a1,
  3373. default_value: f32_array_create_x(0.0),
  3374. min: 0.0,
  3375. max: 1.0,
  3376. precision: 100,
  3377. display: 0
  3378. }
  3379. ],
  3380. outputs: [
  3381. {
  3382. id: 0,
  3383. node_id: 0,
  3384. name: _tr("Color"),
  3385. type: "RGBA",
  3386. color: 0xffc7c729,
  3387. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  3388. min: 0.0,
  3389. max: 1.0,
  3390. precision: 100,
  3391. display: 0
  3392. }
  3393. ],
  3394. buttons: [],
  3395. width: 0
  3396. },
  3397. {
  3398. id: 0,
  3399. name: _tr("Combine XYZ"),
  3400. type: "COMBXYZ",
  3401. x: 0,
  3402. y: 0,
  3403. color: 0xff62676d,
  3404. inputs: [
  3405. {
  3406. id: 0,
  3407. node_id: 0,
  3408. name: _tr("X"),
  3409. type: "VALUE",
  3410. color: 0xffa1a1a1,
  3411. default_value: f32_array_create_x(0.0),
  3412. min: 0.0,
  3413. max: 1.0,
  3414. precision: 100,
  3415. display: 0
  3416. },
  3417. {
  3418. id: 0,
  3419. node_id: 0,
  3420. name: _tr("Y"),
  3421. type: "VALUE",
  3422. color: 0xffa1a1a1,
  3423. default_value: f32_array_create_x(0.0),
  3424. min: 0.0,
  3425. max: 1.0,
  3426. precision: 100,
  3427. display: 0
  3428. },
  3429. {
  3430. id: 0,
  3431. node_id: 0,
  3432. name: _tr("Z"),
  3433. type: "VALUE",
  3434. color: 0xffa1a1a1,
  3435. default_value: f32_array_create_x(0.0),
  3436. min: 0.0,
  3437. max: 1.0,
  3438. precision: 100,
  3439. display: 0
  3440. }
  3441. ],
  3442. outputs: [
  3443. {
  3444. id: 0,
  3445. node_id: 0,
  3446. name: _tr("Vector"),
  3447. type: "VECTOR",
  3448. color: 0xff6363c7,
  3449. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  3450. min: 0.0,
  3451. max: 1.0,
  3452. precision: 100,
  3453. display: 0
  3454. }
  3455. ],
  3456. buttons: [],
  3457. width: 0
  3458. },
  3459. {
  3460. id: 0,
  3461. name: _tr("Map Range"),
  3462. type: "MAPRANGE",
  3463. x: 0,
  3464. y: 0,
  3465. color: 0xff62676d,
  3466. inputs: [
  3467. {
  3468. id: 0,
  3469. node_id: 0,
  3470. name: _tr("Value"),
  3471. type: "VALUE",
  3472. color: 0xffa1a1a1,
  3473. default_value: f32_array_create_x(0.5),
  3474. min: 0.0,
  3475. max: 1.0,
  3476. precision: 100,
  3477. display: 0
  3478. },
  3479. {
  3480. id: 0,
  3481. node_id: 0,
  3482. name: _tr("From Min"),
  3483. type: "VALUE",
  3484. color: 0xffa1a1a1,
  3485. default_value: f32_array_create_x(0.0),
  3486. min: 0.0,
  3487. max: 1.0,
  3488. precision: 100,
  3489. display: 0
  3490. },
  3491. {
  3492. id: 0,
  3493. node_id: 0,
  3494. name: _tr("From Max"),
  3495. type: "VALUE",
  3496. color: 0xffa1a1a1,
  3497. default_value: f32_array_create_x(1.0),
  3498. min: 0.0,
  3499. max: 1.0,
  3500. precision: 100,
  3501. display: 0
  3502. },
  3503. {
  3504. id: 0,
  3505. node_id: 0,
  3506. name: _tr("To Min"),
  3507. type: "VALUE",
  3508. color: 0xffa1a1a1,
  3509. default_value: f32_array_create_x(0.0),
  3510. min: 0.0,
  3511. max: 1.0,
  3512. precision: 100,
  3513. display: 0
  3514. },
  3515. {
  3516. id: 0,
  3517. node_id: 0,
  3518. name: _tr("To Max"),
  3519. type: "VALUE",
  3520. color: 0xffa1a1a1,
  3521. default_value: f32_array_create_x(1.0),
  3522. min: 0.0,
  3523. max: 1.0,
  3524. precision: 100,
  3525. display: 0
  3526. }
  3527. ],
  3528. outputs: [
  3529. {
  3530. id: 0,
  3531. node_id: 0,
  3532. name: _tr("Value"),
  3533. type: "VALUE",
  3534. color: 0xffa1a1a1,
  3535. default_value: f32_array_create_x(0.0),
  3536. min: 0.0,
  3537. max: 1.0,
  3538. precision: 100,
  3539. display: 0
  3540. }
  3541. ],
  3542. buttons: [
  3543. {
  3544. name: _tr("use_clamp"),
  3545. type: "BOOL",
  3546. output: 0,
  3547. default_value: f32_array_create_x(0),
  3548. data: null,
  3549. min: 0.0,
  3550. max: 1.0,
  3551. precision: 100,
  3552. height: 0
  3553. }
  3554. ],
  3555. width: 0
  3556. },
  3557. {
  3558. id: 0,
  3559. name: _tr("Math"),
  3560. type: "MATH",
  3561. x: 0,
  3562. y: 0,
  3563. color: 0xff62676d,
  3564. inputs: [
  3565. {
  3566. id: 0,
  3567. node_id: 0,
  3568. name: _tr("Value"),
  3569. type: "VALUE",
  3570. color: 0xffa1a1a1,
  3571. default_value: f32_array_create_x(0.5),
  3572. min: 0.0,
  3573. max: 1.0,
  3574. precision: 100,
  3575. display: 0
  3576. },
  3577. {
  3578. id: 0,
  3579. node_id: 0,
  3580. name: _tr("Value"),
  3581. type: "VALUE",
  3582. color: 0xffa1a1a1,
  3583. default_value: f32_array_create_x(0.5),
  3584. min: 0.0,
  3585. max: 1.0,
  3586. precision: 100,
  3587. display: 0
  3588. }
  3589. ],
  3590. outputs: [
  3591. {
  3592. id: 0,
  3593. node_id: 0,
  3594. name: _tr("Value"),
  3595. type: "VALUE",
  3596. color: 0xffa1a1a1,
  3597. default_value: f32_array_create_x(0.0),
  3598. min: 0.0,
  3599. max: 1.0,
  3600. precision: 100,
  3601. display: 0
  3602. }
  3603. ],
  3604. buttons: [
  3605. {
  3606. name: _tr("operation"),
  3607. type: "ENUM",
  3608. output: 0,
  3609. default_value: f32_array_create_x(0),
  3610. data: u8_array_create_from_string(_tr("Add") + "\n" + _tr("Subtract") + "\n" + _tr("Multiply") + "\n" + _tr("Divide") + "\n" + _tr("Power") + "\n" + _tr("Logarithm") + "\n" + _tr("Square Root") + "\n" + _tr("Inverse Square Root") + "\n" + _tr("Absolute") + "\n" + _tr("Exponent") + "\n" + _tr("Minimum") + "\n" + _tr("Maximum") + "\n" + _tr("Less Than") + "\n" + _tr("Greater Than") + "\n" + _tr("Sign") + "\n" + _tr("Round") + "\n" + _tr("Floor") + "\n" + _tr("Ceil") + "\n" + _tr("Truncate") + "\n" + _tr("Fraction") + "\n" + _tr("Modulo") + "\n" + _tr("Snap") + "\n" + _tr("Ping-Pong") + "\n" + _tr("Sine") + "\n" + _tr("Cosine") + "\n" + _tr("Tangent") + "\n" + _tr("Arcsine") + "\n" + _tr("Arccosine") + "\n" + _tr("Arctangent") + "\n" + _tr("Arctan2") + "\n" + _tr("Hyperbolic Sine") + "\n" + _tr("Hyperbolic Cosine") + "\n" + _tr("Hyperbolic Tangent") + "\n" + _tr("To Radians") + "\n" + _tr("To Degrees")),
  3611. min: 0.0,
  3612. max: 1.0,
  3613. precision: 100,
  3614. height: 0
  3615. },
  3616. {
  3617. name: _tr("use_clamp"),
  3618. type: "BOOL",
  3619. output: 0,
  3620. default_value: f32_array_create_x(0),
  3621. data: null,
  3622. min: 0.0,
  3623. max: 1.0,
  3624. precision: 100,
  3625. height: 0
  3626. }
  3627. ],
  3628. width: 0
  3629. },
  3630. {
  3631. id: 0,
  3632. name: _tr("RGB to BW"),
  3633. type: "RGBTOBW",
  3634. x: 0,
  3635. y: 0,
  3636. color: 0xff62676d,
  3637. inputs: [
  3638. {
  3639. id: 0,
  3640. node_id: 0,
  3641. name: _tr("Color"),
  3642. type: "RGBA",
  3643. color: 0xffc7c729,
  3644. default_value: f32_array_create_xyzw(0.0, 0.0, 0.0, 0.0),
  3645. min: 0.0,
  3646. max: 1.0,
  3647. precision: 100,
  3648. display: 0
  3649. }
  3650. ],
  3651. outputs: [
  3652. {
  3653. id: 0,
  3654. node_id: 0,
  3655. name: _tr("Val"),
  3656. type: "VALUE",
  3657. color: 0xffa1a1a1,
  3658. default_value: f32_array_create_x(0.0),
  3659. min: 0.0,
  3660. max: 1.0,
  3661. precision: 100,
  3662. display: 0
  3663. }
  3664. ],
  3665. buttons: [],
  3666. width: 0
  3667. },
  3668. {
  3669. id: 0,
  3670. name: _tr("Separate HSV"),
  3671. type: "SEPHSV",
  3672. x: 0,
  3673. y: 0,
  3674. color: 0xff62676d,
  3675. inputs: [
  3676. {
  3677. id: 0,
  3678. node_id: 0,
  3679. name: _tr("Color"),
  3680. type: "RGBA",
  3681. color: 0xffc7c729,
  3682. default_value: f32_array_create_xyzw(0.5, 0.5, 0.5, 1.0),
  3683. min: 0.0,
  3684. max: 1.0,
  3685. precision: 100,
  3686. display: 0
  3687. }
  3688. ],
  3689. outputs: [
  3690. {
  3691. id: 0,
  3692. node_id: 0,
  3693. name: _tr("H"),
  3694. type: "VALUE",
  3695. color: 0xffa1a1a1,
  3696. default_value: f32_array_create_x(0.0),
  3697. min: 0.0,
  3698. max: 1.0,
  3699. precision: 100,
  3700. display: 0
  3701. },
  3702. {
  3703. id: 0,
  3704. node_id: 0,
  3705. name: _tr("S"),
  3706. type: "VALUE",
  3707. color: 0xffa1a1a1,
  3708. default_value: f32_array_create_x(0.0),
  3709. min: 0.0,
  3710. max: 1.0,
  3711. precision: 100,
  3712. display: 0
  3713. },
  3714. {
  3715. id: 0,
  3716. node_id: 0,
  3717. name: _tr("V"),
  3718. type: "VALUE",
  3719. color: 0xffa1a1a1,
  3720. default_value: f32_array_create_x(0.0),
  3721. min: 0.0,
  3722. max: 1.0,
  3723. precision: 100,
  3724. display: 0
  3725. }
  3726. ],
  3727. buttons: [],
  3728. width: 0
  3729. },
  3730. {
  3731. id: 0,
  3732. name: _tr("Separate RGB"),
  3733. type: "SEPRGB",
  3734. x: 0,
  3735. y: 0,
  3736. color: 0xff62676d,
  3737. inputs: [
  3738. {
  3739. id: 0,
  3740. node_id: 0,
  3741. name: _tr("Color"),
  3742. type: "RGBA",
  3743. color: 0xffc7c729,
  3744. default_value: f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  3745. min: 0.0,
  3746. max: 1.0,
  3747. precision: 100,
  3748. display: 0
  3749. }
  3750. ],
  3751. outputs: [
  3752. {
  3753. id: 0,
  3754. node_id: 0,
  3755. name: _tr("R"),
  3756. type: "VALUE",
  3757. color: 0xffa1a1a1,
  3758. default_value: f32_array_create_x(0.0),
  3759. min: 0.0,
  3760. max: 1.0,
  3761. precision: 100,
  3762. display: 0
  3763. },
  3764. {
  3765. id: 0,
  3766. node_id: 0,
  3767. name: _tr("G"),
  3768. type: "VALUE",
  3769. color: 0xffa1a1a1,
  3770. default_value: f32_array_create_x(0.0),
  3771. min: 0.0,
  3772. max: 1.0,
  3773. precision: 100,
  3774. display: 0
  3775. },
  3776. {
  3777. id: 0,
  3778. node_id: 0,
  3779. name: _tr("B"),
  3780. type: "VALUE",
  3781. color: 0xffa1a1a1,
  3782. default_value: f32_array_create_x(0.0),
  3783. min: 0.0,
  3784. max: 1.0,
  3785. precision: 100,
  3786. display: 0
  3787. }
  3788. ],
  3789. buttons: [],
  3790. width: 0
  3791. },
  3792. {
  3793. id: 0,
  3794. name: _tr("Separate XYZ"),
  3795. type: "SEPXYZ",
  3796. x: 0,
  3797. y: 0,
  3798. color: 0xff62676d,
  3799. inputs: [
  3800. {
  3801. id: 0,
  3802. node_id: 0,
  3803. name: _tr("Vector"),
  3804. type: "VECTOR",
  3805. color: 0xff6363c7,
  3806. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  3807. min: 0.0,
  3808. max: 1.0,
  3809. precision: 100,
  3810. display: 0
  3811. }
  3812. ],
  3813. outputs: [
  3814. {
  3815. id: 0,
  3816. node_id: 0,
  3817. name: _tr("X"),
  3818. type: "VALUE",
  3819. color: 0xffa1a1a1,
  3820. default_value: f32_array_create_x(0.0),
  3821. min: 0.0,
  3822. max: 1.0,
  3823. precision: 100,
  3824. display: 0
  3825. },
  3826. {
  3827. id: 0,
  3828. node_id: 0,
  3829. name: _tr("Y"),
  3830. type: "VALUE",
  3831. color: 0xffa1a1a1,
  3832. default_value: f32_array_create_x(0.0),
  3833. min: 0.0,
  3834. max: 1.0,
  3835. precision: 100,
  3836. display: 0
  3837. },
  3838. {
  3839. id: 0,
  3840. node_id: 0,
  3841. name: _tr("Z"),
  3842. type: "VALUE",
  3843. color: 0xffa1a1a1,
  3844. default_value: f32_array_create_x(0.0),
  3845. min: 0.0,
  3846. max: 1.0,
  3847. precision: 100,
  3848. display: 0
  3849. }
  3850. ],
  3851. buttons: [],
  3852. width: 0
  3853. },
  3854. {
  3855. id: 0,
  3856. name: _tr("Vector Math"),
  3857. type: "VECT_MATH",
  3858. x: 0,
  3859. y: 0,
  3860. color: 0xff62676d,
  3861. inputs: [
  3862. {
  3863. id: 0,
  3864. node_id: 0,
  3865. name: _tr("Vector"),
  3866. type: "VECTOR",
  3867. color: 0xff6363c7,
  3868. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  3869. min: 0.0,
  3870. max: 1.0,
  3871. precision: 100,
  3872. display: 0
  3873. },
  3874. {
  3875. id: 0,
  3876. node_id: 0,
  3877. name: _tr("Vector"),
  3878. type: "VECTOR",
  3879. color: 0xff6363c7,
  3880. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  3881. min: 0.0,
  3882. max: 1.0,
  3883. precision: 100,
  3884. display: 0
  3885. }
  3886. ],
  3887. outputs: [
  3888. {
  3889. id: 0,
  3890. node_id: 0,
  3891. name: _tr("Vector"),
  3892. type: "VECTOR",
  3893. color: 0xff6363c7,
  3894. default_value: f32_array_create_xyz(0.0, 0.0, 0.0),
  3895. min: 0.0,
  3896. max: 1.0,
  3897. precision: 100,
  3898. display: 0
  3899. },
  3900. {
  3901. id: 0,
  3902. node_id: 0,
  3903. name: _tr("Value"),
  3904. type: "VALUE",
  3905. color: 0xffa1a1a1,
  3906. default_value: f32_array_create_x(0.0),
  3907. min: 0.0,
  3908. max: 1.0,
  3909. precision: 100,
  3910. display: 0
  3911. }
  3912. ],
  3913. buttons: [
  3914. {
  3915. name: _tr("operation"),
  3916. type: "ENUM",
  3917. output: 0,
  3918. default_value: f32_array_create_x(0),
  3919. data: u8_array_create_from_string(_tr("Add") + "\n" + _tr("Subtract") + "\n" + _tr("Multiply") + "\n" + _tr("Divide") + "\n" + _tr("Average") + "\n" + _tr("Cross Product") + "\n" + _tr("Project") + "\n" + _tr("Reflect") + "\n" + _tr("Dot Product") + "\n" + _tr("Distance") + "\n" + _tr("Length") + "\n" + _tr("Scale") + "\n" + _tr("Normalize") + "\n" + _tr("Absolute") + "\n" + _tr("Minimum") + "\n" + _tr("Maximum") + "\n" + _tr("Floor") + "\n" + _tr("Ceil") + "\n" + _tr("Fraction") + "\n" + _tr("Modulo") + "\n" + _tr("Snap") + "\n" + _tr("Sine") + "\n" + _tr("Cosine") + "\n" + _tr("Tangent")),
  3920. min: 0.0,
  3921. max: 1.0,
  3922. precision: 100,
  3923. height: 0
  3924. }
  3925. ],
  3926. width: 0
  3927. }
  3928. ];
  3929. let nodes_material_group: ui_node_t[] = [
  3930. {
  3931. id: 0,
  3932. name: _tr("New Group"),
  3933. type: "GROUP",
  3934. x: 0,
  3935. y: 0,
  3936. color: 0xffb34f5a,
  3937. inputs: [],
  3938. outputs: [],
  3939. buttons: [
  3940. {
  3941. name: "nodes_material_new_group_button",
  3942. type: "CUSTOM",
  3943. output: -1,
  3944. default_value: f32_array_create_x(0),
  3945. data: null,
  3946. min: 0.0,
  3947. max: 1.0,
  3948. precision: 100,
  3949. height: 1
  3950. }
  3951. ],
  3952. width: 0
  3953. }
  3954. ];
  3955. type node_list_t = ui_node_t[];
  3956. let nodes_material_list: node_list_t[] = [
  3957. nodes_material_input,
  3958. nodes_material_texture,
  3959. nodes_material_color,
  3960. nodes_material_vector,
  3961. nodes_material_converter,
  3962. nodes_material_group
  3963. ];
  3964. let _nodes_material_nodes: ui_nodes_t;
  3965. let _nodes_material_node: ui_node_t;
  3966. let _nodes_material_sockets: ui_node_socket_t[];
  3967. function nodes_material_init() {
  3968. map_set(ui_nodes_custom_buttons, "nodes_material_vector_curves_button", nodes_material_vector_curves_button);
  3969. map_set(ui_nodes_custom_buttons, "nodes_material_color_ramp_button", nodes_material_color_ramp_button);
  3970. map_set(ui_nodes_custom_buttons, "nodes_material_new_group_button", nodes_material_new_group_button);
  3971. map_set(ui_nodes_custom_buttons, "nodes_material_group_input_button", nodes_material_group_input_button);
  3972. map_set(ui_nodes_custom_buttons, "nodes_material_group_output_button", nodes_material_group_output_button);
  3973. }
  3974. function nodes_material_vector_curves_button(node_id: i32) {
  3975. let ui: ui_t = ui_nodes_ui;
  3976. let nodes: ui_nodes_t = ui_nodes_get_nodes();
  3977. let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id);
  3978. let but: ui_node_button_t = node.buttons[0];
  3979. let nhandle: ui_handle_t = ui_nest(ui_handle(__ID__), node.id);
  3980. ui_row3();
  3981. ui_radio(ui_nest(ui_nest(nhandle, 0), 1), 0, "X");
  3982. ui_radio(ui_nest(ui_nest(nhandle, 0), 1), 1, "Y");
  3983. ui_radio(ui_nest(ui_nest(nhandle, 0), 1), 2, "Z");
  3984. // Preview
  3985. let axis: i32 = ui_nest(ui_nest(nhandle, 0), 1).position;
  3986. let val: f32[] = but.default_value;
  3987. ui._y += UI_LINE_H() * 5;
  3988. let num: i32 = val[96 + axis];
  3989. if (num == 0) {
  3990. // Init
  3991. val[96 + 0] = 1;
  3992. val[96 + 1] = 1;
  3993. val[96 + 2] = 1;
  3994. }
  3995. // Edit
  3996. let row: f32[] = [1 / 5, 1 / 5, 3 / 5];
  3997. ui_row(row);
  3998. if (ui_button("+")) {
  3999. val[axis * 32 + num * 2 + 0] = 0.0;
  4000. val[axis * 32 + num * 2 + 1] = 0.0;
  4001. num++;
  4002. val[96 + axis] = num;
  4003. }
  4004. if (ui_button("-")) {
  4005. if (num > 1) {
  4006. num--;
  4007. val[96 + axis] = num;
  4008. }
  4009. }
  4010. let ihandle: ui_handle_t = ui_nest(ui_nest(ui_nest(nhandle, 0), 2), axis);
  4011. if (ihandle.init) {
  4012. ihandle.position = 0;
  4013. }
  4014. let i: i32 = math_floor(ui_slider(ihandle, "Index", 0, num - 1, false, 1, true, ui_align_t.LEFT));
  4015. if (i >= num || i < 0) {
  4016. ihandle.value = i = num - 1; // Stay in bounds
  4017. }
  4018. ui_row2();
  4019. ui_nest(ui_nest(nhandle, 0), 3).value = val[axis * 32 + i * 2 + 0];
  4020. ui_nest(ui_nest(nhandle, 0), 4).value = val[axis * 32 + i * 2 + 1];
  4021. let h1: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 3);
  4022. if (h1.init) {
  4023. h1.value = 0.0;
  4024. }
  4025. let h2: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 4);
  4026. if (h2.init) {
  4027. h2.value = 0.0;
  4028. }
  4029. val[axis * 32 + i * 2 + 0] = ui_slider(h1, "X", -1, 1, true, 100, true, ui_align_t.LEFT);
  4030. val[axis * 32 + i * 2 + 1] = ui_slider(h2, "Y", -1, 1, true, 100, true, ui_align_t.LEFT);
  4031. }
  4032. function nodes_material_color_ramp_button(node_id: i32) {
  4033. let ui: ui_t = ui_nodes_ui;
  4034. let nodes: ui_nodes_t = ui_nodes_get_nodes();
  4035. let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id);
  4036. let but: ui_node_button_t = node.buttons[0];
  4037. let nhandle: ui_handle_t = ui_nest(ui_handle(__ID__), node.id);
  4038. let nx: f32 = ui._x;
  4039. let ny: f32 = ui._y;
  4040. // Preview
  4041. let vals: f32[] = but.default_value; // [r, g, b, a, pos, r, g, b, a, pos, ..]
  4042. let sw: f32 = ui._w / UI_NODES_SCALE();
  4043. for (let i: i32 = 0; i < vals.length / 5; ++i) {
  4044. let pos: f32 = vals[i * 5 + 4];
  4045. let col: i32 = color_from_floats(vals[i * 5 + 0], vals[i * 5 + 1], vals[i * 5 + 2], 1.0);
  4046. ui_fill(pos * sw, 0, (1.0 - pos) * sw, UI_LINE_H() - 2 * UI_NODES_SCALE(), col);
  4047. }
  4048. ui._y += UI_LINE_H();
  4049. // Edit
  4050. let ihandle: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 2);
  4051. let row: f32[] = [1 / 4, 1 / 4, 2 / 4];
  4052. ui_row(row);
  4053. if (ui_button("+")) {
  4054. array_push(vals, vals[vals.length - 5]); // r
  4055. array_push(vals, vals[vals.length - 5]); // g
  4056. array_push(vals, vals[vals.length - 5]); // b
  4057. array_push(vals, vals[vals.length - 5]); // a
  4058. array_push(vals, 1.0); // pos
  4059. ihandle.value += 1;
  4060. }
  4061. if (ui_button("-") && vals.length > 5) {
  4062. array_pop(vals);
  4063. array_pop(vals);
  4064. array_pop(vals);
  4065. array_pop(vals);
  4066. array_pop(vals);
  4067. ihandle.value -= 1;
  4068. }
  4069. let h: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 1);
  4070. if (h.init) {
  4071. h.position = but.data[0];
  4072. }
  4073. let interpolate_combo: string[] = [tr("Linear"), tr("Constant")];
  4074. but.data[0] = ui_combo(h, interpolate_combo, tr("Interpolate"));
  4075. ui_row2();
  4076. let i: i32 = math_floor(ui_slider(ihandle, "Index", 0, (vals.length / 5) - 1, false, 1, true, ui_align_t.LEFT));
  4077. if (i >= (vals.length * 5) || i < 0) {
  4078. ihandle.value = i = (vals.length / 5) - 1; // Stay in bounds
  4079. }
  4080. ui_nest(ui_nest(nhandle, 0), 3).value = vals[i * 5 + 4];
  4081. vals[i * 5 + 4] = ui_slider(ui_nest(ui_nest(nhandle, 0), 3), "Pos", 0, 1, true, 100, true, ui_align_t.LEFT);
  4082. if (vals[i * 5 + 4] > 1.0) {
  4083. vals[i * 5 + 4] = 1.0; // Stay in bounds
  4084. }
  4085. else if (vals[i * 5 + 4] < 0.0) {
  4086. vals[i * 5 + 4] = 0.0;
  4087. }
  4088. let chandle: ui_handle_t = ui_nest(ui_nest(nhandle, 0), 4);
  4089. chandle.color = color_from_floats(vals[i * 5 + 0], vals[i * 5 + 1], vals[i * 5 + 2], 1.0);
  4090. if (ui_text("", ui_align_t.RIGHT, chandle.color) == ui_state_t.STARTED) {
  4091. let rx: f32 = nx + ui._w - ui_p(37);
  4092. let ry: f32 = ny - ui_p(5);
  4093. nodes._input_started = ui.input_started = false;
  4094. ui_nodes_rgba_popup(chandle, vals.buffer + i * 5, math_floor(rx), math_floor(ry + ui_ELEMENT_H(ui)));
  4095. }
  4096. vals[i * 5 + 0] = color_get_rb(chandle.color) / 255;
  4097. vals[i * 5 + 1] = color_get_gb(chandle.color) / 255;
  4098. vals[i * 5 + 2] = color_get_bb(chandle.color) / 255;
  4099. }
  4100. function nodes_material_new_group_button(node_id: i32) {
  4101. let ui: ui_t = ui_nodes_ui;
  4102. let nodes: ui_nodes_t = ui_nodes_get_nodes();
  4103. let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id);
  4104. if (node.name == "New Group") {
  4105. for (let i: i32 = 1; i < 999; ++i) {
  4106. node.name = tr("Group") + " " + i;
  4107. let found: bool = false;
  4108. for (let i: i32 = 0; i < project_material_groups.length; ++i) {
  4109. let g: node_group_t = project_material_groups[i];
  4110. let cname: string = g.canvas.name;
  4111. if (cname == node.name) {
  4112. found = true;
  4113. break;
  4114. }
  4115. }
  4116. if (!found) {
  4117. break;
  4118. }
  4119. }
  4120. let canvas: ui_node_canvas_t = {
  4121. name: node.name,
  4122. nodes: [
  4123. {
  4124. id: 0,
  4125. name: _tr("Group Input"),
  4126. type: "GROUP_INPUT",
  4127. x: 50,
  4128. y: 200,
  4129. color: 0xff448c6d,
  4130. inputs: [],
  4131. outputs: [],
  4132. buttons: [
  4133. {
  4134. name: "nodes_material_group_input_button",
  4135. type: "CUSTOM",
  4136. height: 1
  4137. }
  4138. ]
  4139. },
  4140. {
  4141. id: 1,
  4142. name: _tr("Group Output"),
  4143. type: "GROUP_OUTPUT",
  4144. x: 450,
  4145. y: 200,
  4146. color: 0xff448c6d,
  4147. inputs: [],
  4148. outputs: [],
  4149. buttons: [
  4150. {
  4151. name: "nodes_material_group_output_button",
  4152. type: "CUSTOM",
  4153. height: 1
  4154. }
  4155. ]
  4156. }
  4157. ],
  4158. links: []
  4159. };
  4160. let ng: node_group_t = {
  4161. canvas: canvas,
  4162. nodes: ui_nodes_create()
  4163. };
  4164. array_push(project_material_groups, ng);
  4165. }
  4166. let group: node_group_t = null;
  4167. for (let i: i32 = 0; i < project_material_groups.length; ++i) {
  4168. let g: node_group_t = project_material_groups[i];
  4169. let cname: string = g.canvas.name;
  4170. if (cname == node.name) {
  4171. group = g;
  4172. break;
  4173. }
  4174. }
  4175. if (ui_button(tr("Nodes"))) {
  4176. array_push(ui_nodes_group_stack, group);
  4177. }
  4178. }
  4179. function nodes_material_group_input_button(node_id: i32) {
  4180. let ui: ui_t = ui_nodes_ui;
  4181. let nodes: ui_nodes_t = ui_nodes_get_nodes();
  4182. let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id);
  4183. nodes_material_add_socket_button(ui, nodes, node, node.outputs);
  4184. }
  4185. function nodes_material_group_output_button(node_id: i32) {
  4186. let ui: ui_t = ui_nodes_ui;
  4187. let nodes: ui_nodes_t = ui_nodes_get_nodes();
  4188. let node: ui_node_t = ui_get_node(ui_nodes_get_canvas(true).nodes, node_id);
  4189. nodes_material_add_socket_button(ui, nodes, node, node.inputs);
  4190. }
  4191. function nodes_material_add_socket_button(ui: ui_t, nodes: ui_nodes_t, node: ui_node_t, sockets: ui_node_socket_t[]) {
  4192. if (ui_button(tr("Add"))) {
  4193. _nodes_material_nodes = nodes;
  4194. _nodes_material_node = node;
  4195. _nodes_material_sockets = sockets;
  4196. ui_menu_draw(function (ui: ui_t) {
  4197. let nodes: ui_nodes_t = _nodes_material_nodes;
  4198. let node: ui_node_t = _nodes_material_node;
  4199. let sockets: ui_node_socket_t[] = _nodes_material_sockets;
  4200. let group_stack: node_group_t[] = ui_nodes_group_stack;
  4201. let c: ui_node_canvas_t = group_stack[group_stack.length - 1].canvas;
  4202. if (ui_menu_button(tr("RGBA"))) {
  4203. array_push(sockets, nodes_material_create_socket(nodes, node, null, "RGBA", c));
  4204. nodes_material_sync_sockets(node);
  4205. }
  4206. if (ui_menu_button(tr("Vector"))) {
  4207. array_push(sockets, nodes_material_create_socket(nodes, node, null, "VECTOR", c));
  4208. nodes_material_sync_sockets(node);
  4209. }
  4210. if (ui_menu_button(tr("Value"))) {
  4211. array_push(sockets, nodes_material_create_socket(nodes, node, null, "VALUE", c));
  4212. nodes_material_sync_sockets(node);
  4213. }
  4214. });
  4215. }
  4216. }
  4217. function nodes_material_sync_sockets(node: ui_node_t) {
  4218. let group_stack: node_group_t[] = ui_nodes_group_stack;
  4219. let c: ui_node_canvas_t = group_stack[group_stack.length - 1].canvas;
  4220. for (let i: i32 = 0; i < project_materials.length; ++i) {
  4221. let m: slot_material_t = project_materials[i];
  4222. nodes_material_sync_group_sockets(m.canvas, c.name, node);
  4223. }
  4224. for (let i: i32 = 0; i < project_material_groups.length; ++i) {
  4225. let g: node_group_t = project_material_groups[i];
  4226. nodes_material_sync_group_sockets(g.canvas, c.name, node);
  4227. }
  4228. }
  4229. function nodes_material_sync_group_sockets(canvas: ui_node_canvas_t, group_name: string, node: ui_node_t) {
  4230. for (let i: i32 = 0; i < canvas.nodes.length; ++i) {
  4231. let n: ui_node_t = canvas.nodes[i];
  4232. if (n.type == "GROUP" && n.name == group_name) {
  4233. let is_inputs: bool = node.name == "Group Input";
  4234. let old_sockets: ui_node_socket_t[] = is_inputs ? n.inputs : n.outputs;
  4235. let sockets: ui_node_socket_t[] = util_clone_canvas_sockets(is_inputs ? node.outputs : node.inputs);
  4236. if (is_inputs) {
  4237. n.inputs = sockets;
  4238. }
  4239. else {
  4240. n.outputs = sockets;
  4241. }
  4242. for (let i: i32 = 0; i < sockets.length; ++i) {
  4243. let s: ui_node_socket_t = sockets[i];
  4244. s.node_id = n.id;
  4245. }
  4246. let num_sockets: i32 = sockets.length < old_sockets.length ? sockets.length : old_sockets.length;
  4247. for (let i: i32 = 0; i < num_sockets; ++i) {
  4248. if (sockets[i].type == old_sockets[i].type) {
  4249. sockets[i].default_value = old_sockets[i].default_value;
  4250. }
  4251. }
  4252. }
  4253. }
  4254. }
  4255. function nodes_material_get_socket_color(type: string): i32 {
  4256. return type == "RGBA" ? 0xffc7c729 : type == "VECTOR" ? 0xff6363c7 : 0xffa1a1a1;
  4257. }
  4258. function nodes_material_get_socket_default_value(type: string): f32_array_t {
  4259. return type == "RGBA" ? f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0) : type == "VECTOR" ? f32_array_create_xyz(0.0, 0.0, 0.0) : f32_array_create_x(0.0);
  4260. }
  4261. function nodes_material_get_socket_name(type: string): string {
  4262. return type == "RGBA" ? _tr("Color") : type == "VECTOR" ? _tr("Vector") : _tr("Value");
  4263. }
  4264. function nodes_material_create_socket(nodes: ui_nodes_t, node: ui_node_t, name: string, type: string, canvas: ui_node_canvas_t, min: f32 = 0.0, max: f32 = 1.0, default_value: any = null): ui_node_socket_t {
  4265. let soc: ui_node_socket_t = {
  4266. id: ui_get_socket_id(canvas.nodes),
  4267. node_id: node.id,
  4268. name: name == null ? nodes_material_get_socket_name(type) : name,
  4269. type: type,
  4270. color: nodes_material_get_socket_color(type),
  4271. default_value: default_value == null ? nodes_material_get_socket_default_value(type) : default_value,
  4272. min: min,
  4273. max: max
  4274. };
  4275. return soc;
  4276. }
  4277. function nodes_material_get_node_t(node_type: string): ui_node_t {
  4278. for (let i: i32 = 0; i < nodes_material_list.length; ++i) {
  4279. let c: ui_node_t[] = nodes_material_list[i];
  4280. for (let i: i32 = 0; i < c.length; ++i) {
  4281. let n: ui_node_t = c[i];
  4282. if (n.type == node_type) {
  4283. return n;
  4284. }
  4285. }
  4286. }
  4287. return null;
  4288. }
  4289. function nodes_material_create_node(node_type: string, group: node_group_t = null): ui_node_t {
  4290. let n: ui_node_t = nodes_material_get_node_t(node_type);
  4291. if (n == null) {
  4292. return null;
  4293. }
  4294. let canvas: ui_node_canvas_t = group != null ? group.canvas : context_raw.material.canvas;
  4295. let nodes: ui_nodes_t = group != null ? group.nodes : context_raw.material.nodes;
  4296. let node: ui_node_t = ui_nodes_make_node(n, nodes, canvas);
  4297. array_push(canvas.nodes, node);
  4298. return node;
  4299. }