added method to create nodes from functions, wrapFunctionAsNode

This commit is contained in:
tamat
2018-03-28 16:35:52 +02:00
parent e54e2409d1
commit 7485fc68aa
11 changed files with 822 additions and 498 deletions

View File

@@ -39,7 +39,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 328,
"line": 377,
"description": "LGraph is the class that contain a full graph. We instantiate one and add nodes to it, and then we can run the execution loop.",
"is_constructor": 1
},
@@ -52,7 +52,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 1379,
"line": 1430,
"description": "Base Class for all the node type classes",
"params": [
{
@@ -71,7 +71,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 3074,
"line": 3134,
"description": "marks as dirty the canvas, this way it will be rendered again",
"is_constructor": 1,
"params": [
@@ -102,7 +102,7 @@
"plugin_for": [],
"extension_for": [],
"file": "../src/litegraph.js",
"line": 5814,
"line": 5876,
"description": "ContextMenu from LiteGUI",
"is_constructor": 1,
"params": [
@@ -144,6 +144,36 @@
{
"file": "../src/litegraph.js",
"line": 135,
"description": "create a new node type by passing a function, it wraps it with a propper class",
"itemtype": "method",
"name": "wrapFunctionAsNode",
"params": [
{
"name": "name",
"description": "node name with namespace (p.e.: 'math/sum')",
"type": "String"
},
{
"name": "func",
"description": "",
"type": "Function"
},
{
"name": "param_types",
"description": "[optional] an array containing the type of every parameter, otherwise parameters will accept any type",
"type": "Array"
},
{
"name": "return_type",
"description": "[optional] string with the return type, otherwise it will be generic",
"type": "String"
}
],
"class": "LiteGraph"
},
{
"file": "../src/litegraph.js",
"line": 164,
"description": "Adds this method to all nodetypes, existing and to be created\n(You can add it to LGraphNode.prototype but then existing node types wont have it)",
"itemtype": "method",
"name": "addNodeMethod",
@@ -158,7 +188,7 @@
},
{
"file": "../src/litegraph.js",
"line": 153,
"line": 182,
"description": "Create a node of a given type with a name. The node is not attached to any graph yet.",
"itemtype": "method",
"name": "createNode",
@@ -183,7 +213,7 @@
},
{
"file": "../src/litegraph.js",
"line": 196,
"line": 225,
"description": "Returns a registered node type with a given name",
"itemtype": "method",
"name": "getNodeType",
@@ -202,7 +232,7 @@
},
{
"file": "../src/litegraph.js",
"line": 209,
"line": 238,
"description": "Returns a list of node types matching one category",
"itemtype": "method",
"name": "getNodeType",
@@ -221,7 +251,7 @@
},
{
"file": "../src/litegraph.js",
"line": 231,
"line": 260,
"description": "Returns a list with all the node type categories",
"itemtype": "method",
"name": "getNodeTypesCategories",
@@ -233,7 +263,7 @@
},
{
"file": "../src/litegraph.js",
"line": 352,
"line": 403,
"description": "Removes all nodes from this graph",
"itemtype": "method",
"name": "clear",
@@ -241,7 +271,7 @@
},
{
"file": "../src/litegraph.js",
"line": 401,
"line": 452,
"description": "Attach Canvas to this graph",
"itemtype": "method",
"name": "attachCanvas",
@@ -256,7 +286,7 @@
},
{
"file": "../src/litegraph.js",
"line": 420,
"line": 471,
"description": "Detach Canvas from this graph",
"itemtype": "method",
"name": "detachCanvas",
@@ -271,7 +301,7 @@
},
{
"file": "../src/litegraph.js",
"line": 438,
"line": 489,
"description": "Starts running this graph every interval milliseconds.",
"itemtype": "method",
"name": "start",
@@ -286,7 +316,7 @@
},
{
"file": "../src/litegraph.js",
"line": 466,
"line": 517,
"description": "Stops the execution loop of the graph",
"itemtype": "method",
"name": "stop execution",
@@ -294,7 +324,7 @@
},
{
"file": "../src/litegraph.js",
"line": 488,
"line": 539,
"description": "Run N steps (cycles) of the graph",
"itemtype": "method",
"name": "runStep",
@@ -309,7 +339,7 @@
},
{
"file": "../src/litegraph.js",
"line": 567,
"line": 618,
"description": "Updates the graph execution order according to relevance of the nodes (nodes with only outputs have more relevance than\nnodes with only inputs.",
"itemtype": "method",
"name": "updateExecutionOrder",
@@ -317,7 +347,7 @@
},
{
"file": "../src/litegraph.js",
"line": 671,
"line": 722,
"description": "Returns the amount of time the graph has been running in milliseconds",
"itemtype": "method",
"name": "getTime",
@@ -329,7 +359,7 @@
},
{
"file": "../src/litegraph.js",
"line": 682,
"line": 733,
"description": "Returns the amount of time accumulated using the fixedtime_lapse var. This is used in context where the time increments should be constant",
"itemtype": "method",
"name": "getFixedTime",
@@ -341,7 +371,7 @@
},
{
"file": "../src/litegraph.js",
"line": 693,
"line": 744,
"description": "Returns the amount of time it took to compute the latest iteration. Take into account that this number could be not correct\nif the nodes are using graphical actions",
"itemtype": "method",
"name": "getElapsedTime",
@@ -353,7 +383,7 @@
},
{
"file": "../src/litegraph.js",
"line": 705,
"line": 756,
"description": "Sends an event to all the nodes, useful to trigger stuff",
"itemtype": "method",
"name": "sendEventToAllNodes",
@@ -373,7 +403,7 @@
},
{
"file": "../src/litegraph.js",
"line": 748,
"line": 799,
"description": "Adds a new node instasnce to this graph",
"itemtype": "method",
"name": "add",
@@ -388,7 +418,7 @@
},
{
"file": "../src/litegraph.js",
"line": 804,
"line": 855,
"description": "Removes a node from the graph",
"itemtype": "method",
"name": "remove",
@@ -403,7 +433,7 @@
},
{
"file": "../src/litegraph.js",
"line": 873,
"line": 924,
"description": "Returns a node by its id.",
"itemtype": "method",
"name": "getNodeById",
@@ -418,7 +448,7 @@
},
{
"file": "../src/litegraph.js",
"line": 886,
"line": 937,
"description": "Returns a list of nodes that matches a class",
"itemtype": "method",
"name": "findNodesByClass",
@@ -437,7 +467,7 @@
},
{
"file": "../src/litegraph.js",
"line": 902,
"line": 953,
"description": "Returns a list of nodes that matches a type",
"itemtype": "method",
"name": "findNodesByType",
@@ -456,7 +486,7 @@
},
{
"file": "../src/litegraph.js",
"line": 919,
"line": 970,
"description": "Returns a list of nodes that matches a name",
"itemtype": "method",
"name": "findNodesByName",
@@ -475,7 +505,7 @@
},
{
"file": "../src/litegraph.js",
"line": 935,
"line": 986,
"description": "Returns the top-most node in this position of the canvas",
"itemtype": "method",
"name": "getNodeOnPos",
@@ -504,7 +534,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1122,
"line": 1173,
"description": "Assigns a value to all the nodes that matches this name. This is used to create global variables of the node that\ncan be easily accesed from the outside of the graph",
"itemtype": "method",
"name": "setInputData",
@@ -524,7 +554,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1137,
"line": 1188,
"description": "Returns the value of the first node with this name. This is used to access global variables of the graph from the outside",
"itemtype": "method",
"name": "setInputData",
@@ -543,7 +573,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1177,
"line": 1228,
"description": "returns if the graph is in live mode",
"itemtype": "method",
"name": "isLive",
@@ -551,7 +581,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1214,
"line": 1265,
"description": "Creates a Object containing all the info about this graph, it can be serialized",
"itemtype": "method",
"name": "serialize",
@@ -563,7 +593,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1247,
"line": 1298,
"description": "Configure a graph from a JSON string",
"itemtype": "method",
"name": "configure",
@@ -578,7 +608,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1432,
"line": 1485,
"description": "configure a node from an object containing the serialized info",
"itemtype": "method",
"name": "configure",
@@ -586,7 +616,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1528,
"line": 1581,
"description": "serialize the content",
"itemtype": "method",
"name": "serialize",
@@ -594,7 +624,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1604,
"line": 1657,
"description": "serialize and stringify",
"itemtype": "method",
"name": "toString",
@@ -602,7 +632,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1616,
"line": 1669,
"description": "get the title string",
"itemtype": "method",
"name": "getTitle",
@@ -610,7 +640,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1629,
"line": 1682,
"description": "sets the output data",
"itemtype": "method",
"name": "setOutputData",
@@ -630,7 +660,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1665,
"line": 1718,
"description": "retrieves the input data (data traveling through the connection) from one slot",
"itemtype": "method",
"name": "getInputData",
@@ -654,7 +684,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1701,
"line": 1754,
"description": "tells you if there is a connection in one input slot",
"itemtype": "method",
"name": "isInputConnected",
@@ -673,7 +703,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1714,
"line": 1767,
"description": "tells you info about an input connection (which node, type, etc)",
"itemtype": "method",
"name": "getInputInfo",
@@ -692,7 +722,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1729,
"line": 1782,
"description": "returns the node connected in the input slot",
"itemtype": "method",
"name": "getInputNode",
@@ -711,7 +741,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1750,
"line": 1803,
"description": "tells you the last output data that went in that slot",
"itemtype": "method",
"name": "getOutputData",
@@ -730,7 +760,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1768,
"line": 1821,
"description": "tells you info about an output connection (which node, type, etc)",
"itemtype": "method",
"name": "getOutputInfo",
@@ -749,7 +779,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1784,
"line": 1837,
"description": "tells you if there is a connection in one output slot",
"itemtype": "method",
"name": "isOutputConnected",
@@ -768,7 +798,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1797,
"line": 1850,
"description": "retrieves all the nodes connected to this output slot",
"itemtype": "method",
"name": "getOutputNodes",
@@ -787,7 +817,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1830,
"line": 1883,
"description": "Triggers an event in this node, this will trigger any output with the same name",
"itemtype": "method",
"name": "trigger",
@@ -807,7 +837,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1853,
"line": 1906,
"description": "Triggers an slot event in this node",
"itemtype": "method",
"name": "triggerSlot",
@@ -827,7 +857,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1900,
"line": 1953,
"description": "add a new property to this node",
"itemtype": "method",
"name": "addProperty",
@@ -857,7 +887,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1926,
"line": 1979,
"description": "add a new output slot to use in this node",
"itemtype": "method",
"name": "addOutput",
@@ -882,7 +912,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1949,
"line": 2002,
"description": "add a new output slot to use in this node",
"itemtype": "method",
"name": "addOutputs",
@@ -897,7 +927,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1974,
"line": 2027,
"description": "remove an existing output slot",
"itemtype": "method",
"name": "removeOutput",
@@ -912,7 +942,7 @@
},
{
"file": "../src/litegraph.js",
"line": 1988,
"line": 2041,
"description": "add a new input slot to use in this node",
"itemtype": "method",
"name": "addInput",
@@ -937,7 +967,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2012,
"line": 2065,
"description": "add several new input slots in this node",
"itemtype": "method",
"name": "addInputs",
@@ -952,7 +982,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2037,
"line": 2090,
"description": "remove an existing input slot",
"itemtype": "method",
"name": "removeInput",
@@ -967,7 +997,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2051,
"line": 2104,
"description": "add an special connection to this node (used for special kinds of graphs)",
"itemtype": "method",
"name": "addConnection",
@@ -997,7 +1027,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2072,
"line": 2125,
"description": "computes the size of a node according to its inputs and output slots",
"itemtype": "method",
"name": "computeSize",
@@ -1016,7 +1046,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2123,
"line": 2176,
"description": "returns the bounding of the object, used for rendering purposes",
"itemtype": "method",
"name": "getBounding",
@@ -1028,7 +1058,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2133,
"line": 2191,
"description": "checks if a point is inside the shape of a node",
"itemtype": "method",
"name": "isPointInsideNode",
@@ -1052,7 +1082,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2157,
"line": 2215,
"description": "checks if a point is inside a node slot, and returns info about which slot",
"itemtype": "method",
"name": "getSlotInPosition",
@@ -1076,7 +1106,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2188,
"line": 2246,
"description": "returns the input slot with a given name (used for dynamic slots), -1 if not found",
"itemtype": "method",
"name": "findInputSlot",
@@ -1095,7 +1125,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2204,
"line": 2262,
"description": "returns the output slot with a given name (used for dynamic slots), -1 if not found",
"itemtype": "method",
"name": "findOutputSlot",
@@ -1114,7 +1144,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2219,
"line": 2277,
"description": "connect this node output to the input of another node",
"itemtype": "method",
"name": "connect",
@@ -1143,7 +1173,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2337,
"line": 2395,
"description": "disconnect one output to an specific node",
"itemtype": "method",
"name": "disconnectOutput",
@@ -1167,7 +1197,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2427,
"line": 2485,
"description": "disconnect one input",
"itemtype": "method",
"name": "disconnectInput",
@@ -1186,7 +1216,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2496,
"line": 2554,
"description": "returns the center of a connection point in canvas coords",
"itemtype": "method",
"name": "getConnectionPos",
@@ -1210,7 +1240,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2630,
"line": 2688,
"description": "Collapse the node to make it smaller on the canvas",
"itemtype": "method",
"name": "collapse",
@@ -1218,7 +1248,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2643,
"line": 2701,
"description": "Forces the node to do not move or realign on Z",
"itemtype": "method",
"name": "pin",
@@ -1226,7 +1256,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2733,
"line": 2793,
"description": "clears all the data inside",
"itemtype": "method",
"name": "clear",
@@ -1234,7 +1264,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2768,
"line": 2828,
"description": "assigns a graph, you can reasign graphs to the same canvas",
"itemtype": "method",
"name": "setGraph",
@@ -1249,7 +1279,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2799,
"line": 2859,
"description": "opens a graph contained inside a node in the current graph",
"itemtype": "method",
"name": "openSubgraph",
@@ -1264,7 +1294,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2826,
"line": 2886,
"description": "closes a subgraph contained inside a node",
"itemtype": "method",
"name": "closeSubgraph",
@@ -1279,7 +1309,7 @@
},
{
"file": "../src/litegraph.js",
"line": 2842,
"line": 2902,
"description": "assigns a canvas",
"itemtype": "method",
"name": "setCanvas",
@@ -1294,7 +1324,7 @@
},
{
"file": "../src/litegraph.js",
"line": 3090,
"line": 3150,
"description": "Used to attach the canvas in a popup",
"itemtype": "method",
"name": "getCanvasWindow",
@@ -1306,7 +1336,7 @@
},
{
"file": "../src/litegraph.js",
"line": 3104,
"line": 3164,
"description": "starts rendering the content of the canvas when needed",
"itemtype": "method",
"name": "startRendering",
@@ -1314,7 +1344,7 @@
},
{
"file": "../src/litegraph.js",
"line": 3128,
"line": 3188,
"description": "stops rendering the content of the canvas (to save resources)",
"itemtype": "method",
"name": "stopRendering",