nodes_material.ts 80 KB

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