*/}}

ournodes.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. /*
  2. * Our Paint: A light weight GPU powered painting program.
  3. * Copyright (C) 2022 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "ourpaint.h"
  19. extern LA MAIN;
  20. extern tnsMain* T;
  21. extern OurPaint *Our;
  22. laBaseNodeType OUR_IDN_BRUSH_SETTINGS;
  23. laBaseNodeType OUR_IDN_BRUSH_OUTPUTS;
  24. laBaseNodeType OUR_IDN_BRUSH_DEVICE;
  25. laPropContainer* OUR_PC_IDN_BRUSH_SETTINGS;
  26. laPropContainer* OUR_PC_IDN_BRUSH_OUTPUTS;
  27. laPropContainer* OUR_PC_IDN_BRUSH_DEVICE;
  28. void IDN_BrushSettingsInit(OurBrushSettingsNode* n, int NoCreate){
  29. if(!NoCreate){
  30. n->CanvasScale=laCreateOutSocket(n,"Canvas Scale",LA_PROP_FLOAT);
  31. n->Size=laCreateOutSocket(n,"SIZE",LA_PROP_FLOAT);
  32. n->Transparency=laCreateOutSocket(n,"TRANSP",LA_PROP_FLOAT);
  33. n->Hardness=laCreateOutSocket(n,"HARD",LA_PROP_FLOAT);
  34. n->Smudge=laCreateOutSocket(n,"SMUDGE",LA_PROP_FLOAT);
  35. n->SmudgeLength=laCreateOutSocket(n,"LEN",LA_PROP_FLOAT);
  36. n->DabsPerSize=laCreateOutSocket(n,"Dabs Per Size",LA_PROP_FLOAT);
  37. n->Slender=laCreateOutSocket(n,"SLENDER",LA_PROP_FLOAT);
  38. n->Angle=laCreateOutSocket(n,"ANGLE",LA_PROP_FLOAT);
  39. n->Color=laCreateOutSocket(n,"COLOR",LA_PROP_FLOAT|LA_PROP_ARRAY);
  40. strSafeSet(&n->Base.Name, "Brush Settings");
  41. }
  42. n->CanvasScale->Data=&n->rCanvasScale;
  43. n->Size->Data=&n->rSize;
  44. n->Transparency->Data=&n->rTransparency;
  45. n->Hardness->Data=&n->rHardness;
  46. n->Smudge->Data=&n->rSmudge;
  47. n->SmudgeLength->Data=&n->rSmudgeLength;
  48. n->DabsPerSize->Data=&n->rDabsPerSize;
  49. n->Slender->Data=&n->rSlender;
  50. n->Angle->Data=&n->rAngle;
  51. n->Color->Data=Our->CurrentColor; n->Color->ArrLen=3;
  52. }
  53. void IDN_BrushSettingsDestroy(OurBrushSettingsNode* n){
  54. laDestroyOutSocket(n->Size); laDestroyOutSocket(n->Transparency); laDestroyOutSocket(n->Hardness); laDestroyOutSocket(n->Smudge);
  55. laDestroyOutSocket(n->SmudgeLength); laDestroyOutSocket(n->DabsPerSize); laDestroyOutSocket(n->Slender); laDestroyOutSocket(n->Angle);
  56. laDestroyOutSocket(n->CanvasScale); strSafeDestroy(&n->Base.Name);
  57. }
  58. int IDN_BrushSettingsVisit(OurBrushSettingsNode* n, laListHandle* l){
  59. LA_GUARD_THIS_NODE(n); n->Base.Eval=LA_DAG_FLAG_PERM; lstAppendPointer(l, n);
  60. return LA_DAG_FLAG_PERM;
  61. }
  62. int IDN_BrushSettingsEval(OurBrushSettingsNode* n){
  63. if(!Our->CurrentBrush){ return 0; } // unlikely;
  64. n->rCanvasScale = Our->CurrentScale;
  65. n->rSize = Our->CurrentBrush->Size;
  66. n->rTransparency = Our->CurrentBrush->Transparency;
  67. n->rHardness = Our->CurrentBrush->Hardness;
  68. n->rSmudge = Our->CurrentBrush->Smudge;
  69. n->rSmudgeLength = Our->CurrentBrush->SmudgeResampleLength;
  70. n->rDabsPerSize = Our->CurrentBrush->DabsPerSize;
  71. n->rSlender = Our->CurrentBrush->Slender;
  72. n->rAngle = Our->CurrentBrush->Angle;
  73. return 1;
  74. }
  75. void ui_BrushSettingsNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context){
  76. laColumn* c=laFirstColumn(uil); OurBrushSettingsNode*n=This->EndInstance;
  77. laUiItem* b,*u;
  78. LA_BASE_NODE_HEADER(uil,c,This);
  79. b=laBeginRow(uil,c,0,0);
  80. laShowSeparator(uil,c)->Expand=1;
  81. laShowNodeSocket(uil,c,This,"size",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  82. laShowNodeSocket(uil,c,This,"transparency",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  83. laShowNodeSocket(uil,c,This,"hardness",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  84. laShowNodeSocket(uil,c,This,"slender",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  85. laShowNodeSocket(uil,c,This,"angle",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  86. laShowNodeSocket(uil,c,This,"color",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  87. laEndRow(uil,b);
  88. b=laBeginRow(uil,c,0,0);
  89. laShowSeparator(uil,c)->Expand=1;
  90. laShowNodeSocket(uil,c,This,"smudge_length",0)->Flags|=LA_UI_SOCKET_LABEL_W;
  91. laShowNodeSocket(uil,c,This,"smudge",0)->Flags|=LA_UI_SOCKET_LABEL_W;
  92. laEndRow(uil,b);
  93. b=laBeginRow(uil,c,0,0); u=laShowLabel(uil,c,"Canvas Scale",0,0);u->Flags|=LA_TEXT_ALIGN_RIGHT; u->Expand=1; laShowNodeSocket(uil,c,This,"canvas_scale",0);
  94. u=laShowLabel(uil,c,"Dabs Per Size",0,0);u->Flags|=LA_TEXT_ALIGN_RIGHT; u->Expand=1; laShowNodeSocket(uil,c,This,"dabs_per_size",0); laEndRow(uil,b);
  95. }
  96. void IDN_BrushOutputsInit(OurBrushOutputsNode* n, int NoCreate){
  97. if(NoCreate){ return; }
  98. n->Offset=laCreateInSocket("OFFSET",LA_PROP_FLOAT);
  99. n->Size=laCreateInSocket("SIZE",LA_PROP_FLOAT);
  100. n->Transparency=laCreateInSocket("TRANSP",LA_PROP_FLOAT);
  101. n->Hardness=laCreateInSocket("HRAD",LA_PROP_FLOAT);
  102. n->Smudge=laCreateInSocket("SMUDGE",LA_PROP_FLOAT);
  103. n->SmudgeLength=laCreateInSocket("LENGTH",LA_PROP_FLOAT);
  104. n->DabsPerSize=laCreateInSocket("Dabs Per Size",LA_PROP_FLOAT);
  105. n->Slender=laCreateInSocket("SLENDER",LA_PROP_FLOAT);
  106. n->Angle=laCreateInSocket("ANGLE",LA_PROP_FLOAT);
  107. n->Color=laCreateInSocket("COLOR",LA_PROP_FLOAT);
  108. strSafeSet(&n->Base.Name, "Brush Outputs");
  109. }
  110. void IDN_BrushOutputsDestroy(OurBrushOutputsNode* n){
  111. laDestroyInSocket(n->Offset);
  112. laDestroyInSocket(n->Size); laDestroyInSocket(n->Transparency); laDestroyInSocket(n->Hardness); laDestroyInSocket(n->Smudge);
  113. laDestroyInSocket(n->SmudgeLength); laDestroyInSocket(n->DabsPerSize); laDestroyInSocket(n->Slender); laDestroyInSocket(n->Angle);
  114. laDestroyInSocket(n->Color);
  115. strSafeDestroy(&n->Base.Name);
  116. }
  117. int IDN_BrushOutputsVisit(OurBrushOutputsNode* n, laListHandle* l){
  118. LA_GUARD_THIS_NODE(n);
  119. #define BRUSH_OUT_VISIT(a)\
  120. if(LA_SRC_AND_PARENT(n->a)){ laBaseNode*bn=n->a->Source->Parent; LA_VISIT_NODE(bn); }
  121. BRUSH_OUT_VISIT(Offset)
  122. BRUSH_OUT_VISIT(Size)
  123. BRUSH_OUT_VISIT(Transparency)
  124. BRUSH_OUT_VISIT(Hardness)
  125. BRUSH_OUT_VISIT(Smudge)
  126. BRUSH_OUT_VISIT(SmudgeLength)
  127. BRUSH_OUT_VISIT(DabsPerSize)
  128. BRUSH_OUT_VISIT(Slender)
  129. BRUSH_OUT_VISIT(Angle)
  130. BRUSH_OUT_VISIT(Color)
  131. #undef BRUSH_OUT_VISIT
  132. n->Base.Eval=LA_DAG_FLAG_PERM; lstAppendPointer(l, n);
  133. return LA_DAG_FLAG_PERM;
  134. }
  135. int IDN_BrushOutputsEval(OurBrushOutputsNode* n){
  136. if(!Our->CurrentBrush) return 0;
  137. #define BRUSH_OUT_EVAL(a)\
  138. if(LA_SRC_AND_PARENT(n->a) && (n->a->Source->DataType&LA_PROP_FLOAT)){ Our->CurrentBrush->Eval##a=*((real*)n->a->Source->Data); }
  139. if(LA_SRC_AND_PARENT(n->Offset) && (n->Offset->Source->DataType&LA_PROP_FLOAT|LA_PROP_ARRAY) && n->Offset->Source->ArrLen>=2){
  140. Our->CurrentBrush->EvalOffset[0]=((real*)n->Offset->Source->Data)[0];
  141. Our->CurrentBrush->EvalOffset[1]=((real*)n->Offset->Source->Data)[1];
  142. }
  143. if(LA_SRC_AND_PARENT(n->Color) && (n->Color->Source->DataType&LA_PROP_FLOAT|LA_PROP_ARRAY) && n->Color->Source->ArrLen>=3){
  144. Our->CurrentBrush->EvalColor[0]=((real*)n->Color->Source->Data)[0];
  145. Our->CurrentBrush->EvalColor[1]=((real*)n->Color->Source->Data)[1];
  146. Our->CurrentBrush->EvalColor[2]=((real*)n->Color->Source->Data)[2];
  147. }
  148. BRUSH_OUT_EVAL(Size)
  149. BRUSH_OUT_EVAL(Transparency)
  150. BRUSH_OUT_EVAL(Hardness)
  151. BRUSH_OUT_EVAL(Smudge)
  152. BRUSH_OUT_EVAL(SmudgeLength)
  153. BRUSH_OUT_EVAL(DabsPerSize)
  154. BRUSH_OUT_EVAL(Slender)
  155. BRUSH_OUT_EVAL(Angle)
  156. #undef BRUSH_OUT_EVAL
  157. return 1;
  158. }
  159. void ui_BrushOutputsNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context){
  160. laColumn* c=laFirstColumn(uil); OurBrushOutputsNode*n=This->EndInstance;
  161. laUiItem* b,*u;
  162. LA_BASE_NODE_HEADER(uil,c,This);
  163. b=laBeginRow(uil,c,0,0);
  164. laShowNodeSocket(uil,c,This,"offset",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  165. laShowNodeSocket(uil,c,This,"size",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  166. laShowNodeSocket(uil,c,This,"transparency",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  167. laShowNodeSocket(uil,c,This,"hardness",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  168. laShowNodeSocket(uil,c,This,"slender",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  169. laShowNodeSocket(uil,c,This,"angle",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  170. laShowNodeSocket(uil,c,This,"color",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  171. laEndRow(uil,b);
  172. b=laBeginRow(uil,c,0,0);
  173. laShowNodeSocket(uil,c,This,"smudge",0)->Flags|=LA_UI_SOCKET_LABEL_E;
  174. laShowNodeSocket(uil,c,This,"smudge_length",0)->Flags|=LA_UI_SOCKET_LABEL_E;
  175. laEndRow(uil,b);
  176. b=laBeginRow(uil,c,0,0); laShowNodeSocket(uil,c,This,"dabs_per_size",0); laShowLabel(uil,c,"Dabs Per Size",0,0); laEndRow(uil,b);
  177. }
  178. void IDN_BrushDeviceInit(OurBrushDeviceNode* n, int NoCreate){
  179. if(!NoCreate){
  180. n->Pressure=laCreateOutSocket(n,"PRESSURE",LA_PROP_FLOAT);
  181. n->Tilt=laCreateOutSocket(n,"TILT",LA_PROP_FLOAT|LA_PROP_ARRAY);
  182. n->IsEraser=laCreateOutSocket(n,"ERASER",LA_PROP_INT);
  183. n->Position=laCreateOutSocket(n,"POS",LA_PROP_FLOAT|LA_PROP_ARRAY);
  184. n->Speed=laCreateOutSocket(n,"SPD",LA_PROP_FLOAT);
  185. n->Angle=laCreateOutSocket(n,"ANGLE",LA_PROP_FLOAT);
  186. n->Length=laCreateOutSocket(n,"LENGTH",LA_PROP_FLOAT);
  187. n->LengthAccum=laCreateOutSocket(n,"ACUM",LA_PROP_FLOAT);
  188. strSafeSet(&n->Base.Name, "Brush Device");
  189. }
  190. n->Pressure->Data=&n->rPressure;
  191. n->Tilt->Data=n->rTilt; n->Tilt->ArrLen=2;
  192. n->IsEraser->Data=&n->rIsEraser;
  193. n->Position->Data=n->rPosition; n->Position->ArrLen=2;
  194. n->Speed->Data=&n->rSpeed;
  195. n->Angle->Data=&n->rAngle;
  196. n->Length->Data=&n->rLength;
  197. n->LengthAccum->Data=&n->rLengthAccum;
  198. }
  199. void IDN_BrushDeviceDestroy(OurBrushDeviceNode* n){
  200. laDestroyOutSocket(n->Pressure); laDestroyOutSocket(n->Tilt); laDestroyOutSocket(n->Position); laDestroyOutSocket(n->IsEraser); laDestroyOutSocket(n->Speed);
  201. laDestroyOutSocket(n->Angle); laDestroyOutSocket(n->Length); laDestroyOutSocket(n->LengthAccum);
  202. strSafeDestroy(&n->Base.Name);
  203. }
  204. int IDN_BrushDeviceVisit(OurBrushDeviceNode* n, laListHandle* l){
  205. LA_GUARD_THIS_NODE(n); n->Base.Eval=LA_DAG_FLAG_PERM; lstAppendPointer(l, n);
  206. return LA_DAG_FLAG_PERM;
  207. }
  208. int IDN_BrushDeviceEval(OurBrushDeviceNode* n){
  209. if(!Our->CurrentBrush){ return 0; } // unlikely;
  210. tnsVectorSet2v(n->rPosition, Our->CurrentBrush->EvalPosition);
  211. tnsVectorSet2v(n->rTilt, Our->CurrentBrush->EvalTilt);
  212. n->rAngle=Our->CurrentBrush->EvalStrokeAngle;
  213. n->rIsEraser = Our->CurrentBrush->EvalIsEraser;
  214. n->rPressure = Our->CurrentBrush->EvalPressure;
  215. n->rSpeed = Our->CurrentBrush->EvalSpeed;
  216. n->rLength = Our->CurrentBrush->EvalStrokeLength;
  217. n->rLengthAccum = Our->CurrentBrush->EvalStrokeLengthAccum;
  218. return 1;
  219. }
  220. void ui_BrushDeviceNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context){
  221. laColumn* c=laFirstColumn(uil); OurBrushDeviceNode*n=This->EndInstance;
  222. laUiItem* b,*u;
  223. LA_BASE_NODE_HEADER(uil,c,This);
  224. b=laBeginRow(uil,c,0,0);
  225. laShowSeparator(uil,c)->Expand=1;
  226. laShowNodeSocket(uil,c,This,"position",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  227. laShowNodeSocket(uil,c,This,"speed",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  228. laShowNodeSocket(uil,c,This,"angle",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  229. laShowNodeSocket(uil,c,This,"pressure",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  230. laShowNodeSocket(uil,c,This,"tilt",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  231. laShowNodeSocket(uil,c,This,"is_eraser",0)->Flags|=LA_UI_SOCKET_LABEL_N;
  232. laEndRow(uil,b);
  233. b=laBeginRow(uil,c,0,0); laShowSeparator(uil,c)->Expand=1;
  234. laShowNodeSocket(uil,c,This,"length_accum",0)->Flags|=LA_UI_SOCKET_LABEL_W; laShowNodeSocket(uil,c,This,"length",0)->Flags|=LA_UI_SOCKET_LABEL_W; laEndRow(uil,b);
  235. }
  236. int ourEvalBrush(){
  237. for(laListItemPointer*lip=Our->BrushEval.pFirst;lip;lip=lip->pNext){
  238. laBaseNode* n=lip->p; if(!n->InitDone){ n->Type->Init(n,1); n->InitDone=1; } n->Type->Eval(n);
  239. }
  240. return 1;
  241. }
  242. int ourRebuildBrushEval(){
  243. while(lstPopPointer(&Our->BrushEval));
  244. if(!Our->CurrentBrush || !Our->CurrentBrush->Rack) return LA_DAG_FLAG_PERM;
  245. laListHandle pending={0}; laRackPage* rp=Our->CurrentBrush->Rack; if(!rp)return LA_DAG_FLAG_PERM;
  246. for(laNodeRack* ir=rp->Racks.pFirst;ir;ir=ir->Item.pNext){
  247. for(laBaseNode*bn=ir->Nodes.pFirst;bn;bn=bn->Item.pNext){ if(!bn->InitDone){ bn->Type->Init(bn,1); bn->InitDone=1; } lstAppendPointer(&pending,bn); bn->Eval=0; }
  248. }
  249. laBaseNode*n;int result=LA_DAG_FLAG_PERM; laListItemPointer*NextLip;
  250. for(laListItemPointer*lip=pending.pFirst;lip;lip=NextLip){ n=lip->p; NextLip=lip->pNext;
  251. if(n->Eval&LA_DAG_FLAG_PERM) continue;
  252. result=n->Type->Visit(n,&Our->BrushEval); if(result==LA_DAG_FLAG_ERR){ while(lstPopPointer(&pending)); break; }
  253. }
  254. if(result==LA_DAG_FLAG_ERR){ while(lstPopPointer(&MAIN.InputMapping->Eval)); return LA_DAG_FLAG_ERR; }
  255. return LA_DAG_FLAG_PERM;
  256. }
  257. void ourRegisterNodes(){
  258. laPropContainer *pc; laProp *p;
  259. laOperatorType *at;
  260. laEnumProp *ep;
  261. pc=laAddPropertyContainer("our_node_brush_settings", "Brush Settings", "Brush settings node to read from",0,ui_BrushSettingsNode,sizeof(OurBrushSettingsNode),lapost_Node,0,1);
  262. OUR_PC_IDN_BRUSH_SETTINGS=pc; laPropContainerExtraFunctions(pc,0,0,0,0,laui_DefaultNodeOperationsPropUiDefine);
  263. laAddSubGroup(pc,"base","Base","Base node","la_base_node",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
  264. laAddSubGroup(pc,"canvas_scale", "Canvas scale","Canvas scale","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,CanvasScale),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  265. laAddSubGroup(pc,"size", "Size","Size","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,Size),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  266. laAddSubGroup(pc,"transparency", "Transparency","Transparency","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,Transparency),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  267. laAddSubGroup(pc,"hardness", "Hardness","Hardness","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,Hardness),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  268. laAddSubGroup(pc,"smudge", "Smudge","Smudge","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,Smudge),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  269. laAddSubGroup(pc,"smudge_length", "Smudge Length","Smudge length","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,SmudgeLength),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  270. laAddSubGroup(pc,"dabs_per_size", "Dabs Per Size","Dabs per size","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,DabsPerSize),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  271. laAddSubGroup(pc,"slender", "Slender","Slender","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,Slender),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  272. laAddSubGroup(pc,"angle", "Angle","Angle","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,Angle),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  273. laAddSubGroup(pc,"color", "Color","Color","la_out_socket",0,0,0,offsetof(OurBrushSettingsNode,Color),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  274. pc=laAddPropertyContainer("our_node_brush_outputs", "Brush Outputs", "Brush outputs to draw actual dabs",0,ui_BrushOutputsNode,sizeof(OurBrushOutputsNode),lapost_Node,0,1);
  275. OUR_PC_IDN_BRUSH_OUTPUTS=pc; laPropContainerExtraFunctions(pc,0,0,0,0,laui_DefaultNodeOperationsPropUiDefine);
  276. laAddSubGroup(pc,"base","Base","Base node","la_base_node",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
  277. laAddSubGroup(pc,"offset", "Offset","Offset","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Offset),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  278. laAddSubGroup(pc,"size", "Size","Size","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Size),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  279. laAddSubGroup(pc,"transparency", "Transparency","Transparency","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Transparency),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  280. laAddSubGroup(pc,"hardness", "Hardness","Hardness","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Hardness),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  281. laAddSubGroup(pc,"smudge", "Smudge","Smudge","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Smudge),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  282. laAddSubGroup(pc,"smudge_length", "Smudge Length","Smudge length","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,SmudgeLength),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  283. laAddSubGroup(pc,"dabs_per_size", "Dabs Per Size","Dabs per size","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,DabsPerSize),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  284. laAddSubGroup(pc,"slender", "Slender","Slender","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Slender),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  285. laAddSubGroup(pc,"angle", "Angle","Angle","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Angle),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  286. laAddSubGroup(pc,"color", "Color","Color","la_in_socket",0,0,0,offsetof(OurBrushOutputsNode,Color),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  287. pc=laAddPropertyContainer("our_node_brush_device", "Brush Device", "Brush device input",0,ui_BrushDeviceNode,sizeof(OurBrushDeviceNode),lapost_Node,0,1);
  288. OUR_PC_IDN_BRUSH_DEVICE =pc; laPropContainerExtraFunctions(pc,0,0,0,0,laui_DefaultNodeOperationsPropUiDefine);
  289. laAddSubGroup(pc,"base","Base","Base node","la_base_node",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
  290. laAddSubGroup(pc,"pressure","Pressure","Pressure of the input","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,Pressure),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  291. laAddSubGroup(pc,"tilt", "Tilt","Pen tilt vector","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,Tilt),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  292. laAddSubGroup(pc,"is_eraser", "Is Eraser","Input event is from an eraser","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,IsEraser),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  293. laAddSubGroup(pc,"position", "Dab position","Interpolated dab position","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,Position),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  294. laAddSubGroup(pc,"speed","Speed","Speed on the canvas","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,Speed),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  295. laAddSubGroup(pc,"angle","Angle","Direction of the brush","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,Angle),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  296. laAddSubGroup(pc,"length","Length","Length of this brush stroke","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,Length),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  297. laAddSubGroup(pc,"length_accum","Accumulated Length","Accumulated stroke length","la_out_socket",0,0,0,offsetof(OurBrushDeviceNode,LengthAccum),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  298. LA_IDN_REGISTER("Brush Settings",L'🖌',OUR_IDN_BRUSH_SETTINGS,OUR_PC_IDN_BRUSH_SETTINGS, IDN_BrushSettingsInit, IDN_BrushSettingsDestroy, IDN_BrushSettingsVisit, IDN_BrushSettingsEval, OurBrushSettingsNode);
  299. LA_IDN_REGISTER("Brush Outputs",L'🖌',OUR_IDN_BRUSH_OUTPUTS,OUR_PC_IDN_BRUSH_OUTPUTS, IDN_BrushOutputsInit, IDN_BrushOutputsDestroy, IDN_BrushOutputsVisit, IDN_BrushOutputsEval, OurBrushOutputsNode);
  300. LA_IDN_REGISTER("Brush Device",L'🖳',OUR_IDN_BRUSH_DEVICE,OUR_PC_IDN_BRUSH_DEVICE, IDN_BrushDeviceInit, IDN_BrushDeviceDestroy, IDN_BrushDeviceVisit, IDN_BrushDeviceEval, OurBrushDeviceNode);
  301. laNodeCategory* nc=laAddNodeCategory("Our Paint",0,LA_RACK_TYPE_DRIVER);
  302. laNodeCategoryAddNodeTypes(LA_NODE_CATEGORY_DRIVER, &OUR_IDN_BRUSH_OUTPUTS,0);
  303. laNodeCategoryAddNodeTypes(nc, &OUR_IDN_BRUSH_DEVICE, 0);
  304. laNodeCategoryAddNodeTypes(nc, &OUR_IDN_BRUSH_SETTINGS, 0);
  305. }