From 0c51968e276eeec368a1a85e4522a6246841f784 Mon Sep 17 00:00:00 2001 From: FedFod Date: Tue, 3 Aug 2021 17:10:49 +0200 Subject: [PATCH 01/18] Added Curvature e NURBS order to reference --- docs/jit.gl.meshwarp.maxref.xml | 21 +++++++++- help/jit.gl.meshwarp.maxhelp | 74 ++++++++++++++++++++++++--------- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/docs/jit.gl.meshwarp.maxref.xml b/docs/jit.gl.meshwarp.maxref.xml index 1064504..167cf88 100644 --- a/docs/jit.gl.meshwarp.maxref.xml +++ b/docs/jit.gl.meshwarp.maxref.xml @@ -113,6 +113,15 @@ The color of the mesh (default = 1. 1. 1. 1.) + + + + Set both the x and y NURBS order. + + + A quick way to set both the X and y NURBS order, which determines the curvature of the underlying canvas mesh (range 0. to 1.) + + @@ -142,7 +151,7 @@ When set to active, the scale attribute will only respond to the second attribute argument (y scale). - + Dimension of UI mesh (default = 4 4) @@ -151,6 +160,16 @@ Dimension of the UI mesh. Sets the number of clickable vertices displayed (default = 4 4) + + + + Set the X and Y order of the NURBS canvas mesh (default = 1 1). + + + Set the X and Y order of the underlying NURBS canvas mesh. + The order determines the curvature of the canvas mesh (default = 1 1). + + diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index 359988c..b81a573 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 34.0, 87.0, 882.0, 573.0 ], + "rect" : [ 164.0, 262.0, 882.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -94,7 +94,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 538.0, 121.0, 202.0, 33.0 ], + "patching_rect" : [ 538.0, 121.0, 202.0, 34.0 ], "text" : "use layer to control the drawing order when shapes are unselected" } @@ -252,7 +252,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 21.5, 27.0, 417.0, 33.0 ], + "patching_rect" : [ 21.5, 27.0, 417.0, 34.0 ], "text" : "You can use multiple \"jit.gl.meshwarp\" objects at the same time.\nTo select one click on the shape in the rendering window using the mouse. " } @@ -459,7 +459,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 21.5, 27.0, 609.0, 33.0 ], + "patching_rect" : [ 21.5, 27.0, 609.0, 34.0 ], "text" : "Save all the parameters of a jit.gl.meshwarp on a JSON file using the \"save\" message.\nLoad the JSON file in the jit.gl.meshwarp object with the \"read\" message to bring the object back the saved state." } @@ -629,7 +629,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 882.0, 547.0 ], + "rect" : [ 164.0, 288.0, 882.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1340,7 +1340,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 43.666666666666515, 32.190485954284668, 557.0, 74.0 ], + "patching_rect" : [ 43.666666666666515, 32.190485954284668, 557.0, 75.0 ], "text" : "- Blue Circle: move the mesh.\n- Yellow Circles: scale the mesh.\n- Move individual vertices with mouse when Red Circle appears.\n- Click and Drag: select multiple vertices. \nAfter selecting the vertices you can move them all in bulk by clicking and dragging on a selected vertex." } @@ -1352,7 +1352,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 552.857139945030212, 276.119050145149231, 199.0, 33.0 ], + "patching_rect" : [ 552.857139945030212, 276.119050145149231, 199.0, 34.0 ], "text" : "Use this abstraction to move single vertices by index." } @@ -1628,7 +1628,7 @@ } , "classnamespace" : "box", - "rect" : [ 34.0, 113.0, 882.0, 547.0 ], + "rect" : [ 0.0, 26.0, 882.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1664,7 +1664,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 569.238093376159668, 201.619042873382568, 169.0, 60.0 ], + "patching_rect" : [ 569.238093376159668, 201.619042873382568, 169.0, 62.0 ], "text" : "Also undo via cmd+z or ctl+z and redo via shift+cmd+z or ctl+y when interacting in the render window" } @@ -1760,7 +1760,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 21.0, 69.0, 516.0, 33.0 ], + "patching_rect" : [ 21.0, 69.0, 516.0, 34.0 ], "text" : "The jit.gl.meshwarp allows to deform visual material projected on a two-dimensional mesh.\nIt can be used either for video-mapping or as a creative tool." } @@ -1773,7 +1773,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 21.0, 19.0, 241.0, 42.0 ], + "patching_rect" : [ 21.0, 19.0, 241.0, 43.0 ], "text" : "jit.gl.meshwarp" } @@ -1823,7 +1823,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 115.142860054969788, 222.738093018531799, 80.0, 35.0 ] + "patching_rect" : [ 115.142860054969788, 222.738093018531799, 80.0, 36.0 ] } } @@ -2040,34 +2040,34 @@ "dependency_cache" : [ { "name" : "jit.gl.meshwarp.maxhelp.maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", - "patcherrelativepath" : "../../../../Documents/Max 8/Snapshots", + "patcherrelativepath" : "../../../Snapshots", "type" : "mx@s", "implicit" : 1 } , { - "name" : "Aspect[1].maxsnap", + "name" : "jit.gl.meshwarp.maxhelp[2].maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", - "patcherrelativepath" : "../../../../Documents/Max 8/Snapshots", + "patcherrelativepath" : "../../../Snapshots", "type" : "mx@s", "implicit" : 1 } , { "name" : "jit.gl.meshwarp.maxpat", - "bootpath" : "~/dev/cycling/meshwarp/patchers", + "bootpath" : "~/Documents/Max 8/Packages/meshwarp/patchers", "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { "name" : "meshwarp.js", - "bootpath" : "~/dev/cycling/meshwarp/code", - "patcherrelativepath" : "../code", + "bootpath" : "~/Documents/Max 8/Packages/meshwarp/javascript", + "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "meshwarp.vertex.edit.maxpat", - "bootpath" : "~/dev/cycling/meshwarp/patchers", + "bootpath" : "~/Documents/Max 8/Packages/meshwarp/patchers", "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 @@ -2766,6 +2766,42 @@ "snapshotfileid" : "bf78636150be0ed0ab4db74ac8f937c4" } + } +, { + "filetype" : "C74Snapshot", + "version" : 2, + "minorversion" : 0, + "name" : "jit.gl.meshwarp.maxhelp[2]", + "origin" : "jit.gl.meshwarp.maxhelp", + "type" : "patcher", + "subtype" : "Undefined", + "embed" : 0, + "fileref" : { + "name" : "jit.gl.meshwarp.maxhelp[2]", + "filename" : "jit.gl.meshwarp.maxhelp[2].maxsnap", + "filepath" : "~/Documents/Max 8/Snapshots", + "filepos" : -1, + "snapshotfileid" : "4082200465cf287508e1e68d1bb2e6d2" + } + + } +, { + "filetype" : "C74Snapshot", + "version" : 2, + "minorversion" : 0, + "name" : "jit.gl.meshwarp.maxhelp", + "origin" : "jit.gl.meshwarp.maxhelp", + "type" : "patcher", + "subtype" : "Undefined", + "embed" : 0, + "fileref" : { + "name" : "jit.gl.meshwarp.maxhelp", + "filename" : "jit.gl.meshwarp.maxhelp.maxsnap", + "filepath" : "~/Documents/Max 8/Snapshots", + "filepos" : -1, + "snapshotfileid" : "0e9c7d4d0916d1bebe103ade4eaffa6d" + } + } ] } From 2ac2d7dcfcd75c3dde179a5d3c3d8efbcc513397 Mon Sep 17 00:00:00 2001 From: FedFod Date: Wed, 4 Aug 2021 20:35:32 +0200 Subject: [PATCH 02/18] Removed Array.prototype bug and moved mouseIsOnMesh init --- help/jit.gl.meshwarp.maxhelp | 9 ++------- javascript/Global_Obj.js | 2 +- javascript/Meshwarp_Utilities.js | 12 ++++++------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index b81a573..61f092a 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 164.0, 262.0, 882.0, 573.0 ], + "rect" : [ 124.0, 347.0, 882.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -629,7 +629,7 @@ } , "classnamespace" : "box", - "rect" : [ 164.0, 288.0, 882.0, 547.0 ], + "rect" : [ 124.0, 373.0, 882.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -2040,35 +2040,30 @@ "dependency_cache" : [ { "name" : "jit.gl.meshwarp.maxhelp.maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", - "patcherrelativepath" : "../../../Snapshots", "type" : "mx@s", "implicit" : 1 } , { "name" : "jit.gl.meshwarp.maxhelp[2].maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", - "patcherrelativepath" : "../../../Snapshots", "type" : "mx@s", "implicit" : 1 } , { "name" : "jit.gl.meshwarp.maxpat", "bootpath" : "~/Documents/Max 8/Packages/meshwarp/patchers", - "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { "name" : "meshwarp.js", "bootpath" : "~/Documents/Max 8/Packages/meshwarp/javascript", - "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "meshwarp.vertex.edit.maxpat", "bootpath" : "~/Documents/Max 8/Packages/meshwarp/patchers", - "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } diff --git a/javascript/Global_Obj.js b/javascript/Global_Obj.js index 220e622..4e38e46 100644 --- a/javascript/Global_Obj.js +++ b/javascript/Global_Obj.js @@ -1,8 +1,8 @@ // GLOBAL OBJECT gGlobal = new Global("gMeshwarp"); -gGlobal.mouseIsOnMesh = {}; if(gGlobal.inited === undefined) { + gGlobal.mouseIsOnMesh = {}; gGlobal.inited = true; gGlobal.currentlySelected = -1; gGlobal.latestAction = GUI_ELEMENTS.NOTHING; diff --git a/javascript/Meshwarp_Utilities.js b/javascript/Meshwarp_Utilities.js index 62f617e..2c96680 100644 --- a/javascript/Meshwarp_Utilities.js +++ b/javascript/Meshwarp_Utilities.js @@ -186,10 +186,10 @@ if (!Math.sign) { } } -Array.prototype.max = function() { - return Math.max.apply(null, this); - }; +// Array.prototype.max = function() { +// return Math.max.apply(null, this); +// }; - Array.prototype.min = function() { - return Math.min.apply(null, this); - }; +// Array.prototype.min = function() { +// return Math.min.apply(null, this); +// }; From 561c28f9904bc090f397e33c4b109019e8bf16d6 Mon Sep 17 00:00:00 2001 From: FedFod Date: Wed, 4 Aug 2021 21:01:15 +0200 Subject: [PATCH 03/18] Found and fixed bug with array.max/min. Added possibility to change color for more GUI elements --- help/jit.gl.meshwarp.maxhelp | 114 +++++++++++++++++++++---- javascript/GraphicElements.js | 8 ++ javascript/Mesh_mouse_routine.js | 2 +- javascript/Meshwarp_Utilities.js | 12 +-- javascript/Set_Attributes_Functions.js | 11 +++ javascript/meshwarp.js | 3 + 6 files changed, 127 insertions(+), 23 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index 61f092a..8e21544 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 124.0, 347.0, 882.0, 573.0 ], + "rect" : [ 124.0, 347.0, 964.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -58,7 +58,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 882.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -423,7 +423,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 882.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -629,7 +629,7 @@ } , "classnamespace" : "box", - "rect" : [ 124.0, 373.0, 882.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1227,7 +1227,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 882.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1257,6 +1257,56 @@ "showontab" : 1, "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-13", + "maxclass" : "swatch", + "numinlets" : 3, + "numoutlets" : 2, + "outlettype" : [ "", "float" ], + "parameter_enable" : 0, + "patching_rect" : [ 647.30952672163653, 210.119050145149231, 128.0, 32.0 ], + "saturation" : 1.0 + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 647.30952672163653, 253.119050145149231, 184.0, 22.0 ], + "text" : "prepend multiple_selection_color" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "swatch", + "numinlets" : 3, + "numoutlets" : 2, + "outlettype" : [ "", "float" ], + "parameter_enable" : 0, + "patching_rect" : [ 647.30952672163653, 132.119050145149231, 128.0, 32.0 ], + "saturation" : 1.0 + } + + } +, { + "box" : { + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 647.30952672163653, 175.119050145149231, 136.0, 22.0 ], + "text" : "prepend selection_color" + } + + } +, { "box" : { "format" : 6, "id" : "obj-12", @@ -1266,7 +1316,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 238.0, 288.0, 50.0, 22.0 ] + "patching_rect" : [ 189.0, 299.0, 50.0, 22.0 ] } } @@ -1280,7 +1330,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 137.0, 288.0, 50.0, 22.0 ] + "patching_rect" : [ 88.0, 299.0, 50.0, 22.0 ] } } @@ -1291,7 +1341,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 238.0, 320.0, 73.0, 22.0 ], + "patching_rect" : [ 189.0, 331.0, 73.0, 22.0 ], "text" : "grid_size $1" } @@ -1303,7 +1353,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 137.0, 320.0, 79.0, 22.0 ], + "patching_rect" : [ 88.0, 331.0, 79.0, 22.0 ], "text" : "point_size $1" } @@ -1352,7 +1402,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 552.857139945030212, 276.119050145149231, 199.0, 34.0 ], + "patching_rect" : [ 404.857139945030212, 287.0, 199.0, 34.0 ], "text" : "Use this abstraction to move single vertices by index." } @@ -1364,7 +1414,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 418.5, 288.119050145149231, 122.0, 22.0 ], + "patching_rect" : [ 277.5, 298.119050145149231, 122.0, 22.0 ], "text" : "r from_meshwarp_01" } @@ -1385,7 +1435,7 @@ "numoutlets" : 1, "offset" : [ 0.0, 0.0 ], "outlettype" : [ "" ], - "patching_rect" : [ 418.5, 316.047614336013794, 313.0, 86.952385663986206 ], + "patching_rect" : [ 277.5, 326.047614336013794, 313.0, 86.952385663986206 ], "viewvisibility" : 1 } @@ -1480,6 +1530,14 @@ "source" : [ "obj-1", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "midpoints" : [ 656.80952672163653, 198.0, 633.0, 198.0, 633.0, 254.0, 53.166666666666515, 254.0 ], + "source" : [ "obj-10", 0 ] + } + } , { "patchline" : { @@ -1494,6 +1552,13 @@ "source" : [ "obj-12", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-15", 0 ], + "source" : [ "obj-13", 0 ] + } + } , { "patchline" : { @@ -1502,6 +1567,14 @@ "source" : [ "obj-14", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "midpoints" : [ 656.80952672163653, 441.0, 53.166666666666515, 441.0 ], + "source" : [ "obj-15", 0 ] + } + } , { "patchline" : { @@ -1536,10 +1609,17 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 428.0, 431.0, 53.166666666666515, 431.0 ], + "midpoints" : [ 287.0, 442.0, 53.166666666666515, 442.0 ], "source" : [ "obj-4", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-10", 0 ], + "source" : [ "obj-5", 0 ] + } + } , { "patchline" : { @@ -1566,6 +1646,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], + "midpoints" : [ 97.5, 441.0, 53.166666666666515, 441.0 ], "source" : [ "obj-7", 0 ] } @@ -1573,6 +1654,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], + "midpoints" : [ 198.5, 441.0, 53.166666666666515, 441.0 ], "source" : [ "obj-8", 0 ] } @@ -1628,7 +1710,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 882.0, 547.0 ], + "rect" : [ 124.0, 373.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -2026,8 +2108,8 @@ ], "lines" : [ ], "parameters" : { - "obj-4::obj-41::obj-8" : [ "meshwarpjs[1]", "meshwarpjs[1]", 0 ], - "obj-4::obj-43::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[2]", 0 ], + "obj-4::obj-41::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[1]", 0 ], + "obj-4::obj-43::obj-8" : [ "meshwarpjs[3]", "meshwarpjs[3]", 0 ], "obj-51::obj-1::obj-8" : [ "meshwarpjs", "meshwarpjs", 0 ], "obj-51::obj-9" : [ "toggle", "toggle", 0 ], "parameterbanks" : { diff --git a/javascript/GraphicElements.js b/javascript/GraphicElements.js index ba265cf..2860572 100644 --- a/javascript/GraphicElements.js +++ b/javascript/GraphicElements.js @@ -80,4 +80,12 @@ function GraphicElements(nodectx) { this.sketch.layer = FRONT+val+1; this.sketch2.layer = FRONT+val; } + + this.setSingleSelectionCircleColor = function(color) { + this.sketch.color = color; + } + + this.setMultipleSelectionCirclesColor = function(color) { + this.sketch2.color = color; + } } \ No newline at end of file diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index a91c468..115eae2 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -83,7 +83,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { } } if (foundLayers.length > 1) { - if (foundLayers.max() == layer) { + if (getMaxFromArray(foundLayers) == layer) { assignThisAsCurrentlySelectedToGlobal(); } } else { diff --git a/javascript/Meshwarp_Utilities.js b/javascript/Meshwarp_Utilities.js index 2c96680..18f04b1 100644 --- a/javascript/Meshwarp_Utilities.js +++ b/javascript/Meshwarp_Utilities.js @@ -186,10 +186,10 @@ if (!Math.sign) { } } -// Array.prototype.max = function() { -// return Math.max.apply(null, this); -// }; +function getMaxFromArray(arr) { + return Math.max.apply(Math, arr); +}; -// Array.prototype.min = function() { -// return Math.min.apply(null, this); -// }; +function getMinFromArray(arr) { +return Math.min.apply(Math, arr); +}; diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index ffd27a1..9eccde0 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -83,6 +83,17 @@ function setUIGridColor() { ui_grid_color = arrayfromargs(arguments); gMesh.setUIGridColor(ui_grid_color); } +setUIGridColor.local = 1; + +function setSingleCircleColor() { + gGraphics.setSingleSelectionCircleColor(arrayfromargs(arguments)); +} +setSingleCircleColor.local = 1; + +function setMultipleCirclesColor() { + gGraphics.setMultipleSelectionCirclesColor(arrayfromargs(arguments)); +} +setSingleCircleColor.local = 1; function setRotatez(rotZ) { var angleRad = (rotZ / 180) * 3.1459; diff --git a/javascript/meshwarp.js b/javascript/meshwarp.js index 2c254b1..8a9cd4f 100644 --- a/javascript/meshwarp.js +++ b/javascript/meshwarp.js @@ -57,6 +57,9 @@ declareattribute("color", null, "setColor", 0); var ui_grid_color = randomColor(); declareattribute("ui_grid_color", null, "setUIGridColor", 0); +declareattribute("selection_color", null, "setSingleCircleColor", 0); +declareattribute("multiple_selection_color", null, "setMultipleCirclesColor", 0); + var show_ui = 1; declareattribute("show_ui", null, "showUI", 0); From d17663d69bb6c3740430b68da4e09d662c7f9d97 Mon Sep 17 00:00:00 2001 From: FedFod Date: Wed, 4 Aug 2021 21:26:22 +0200 Subject: [PATCH 04/18] Added possibility to change selection circles size --- help/jit.gl.meshwarp.maxhelp | 153 ++++++++++++++++++++----- javascript/GraphicElements.js | 11 +- javascript/Mesh_mouse_routine.js | 1 + javascript/Set_Attributes_Functions.js | 6 +- javascript/meshwarp.js | 1 + 5 files changed, 143 insertions(+), 29 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index 8e21544..da5a318 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 124.0, 347.0, 964.0, 573.0 ], + "rect" : [ 128.0, 377.0, 964.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -629,7 +629,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 128.0, 403.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1257,6 +1257,44 @@ "showontab" : 1, "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-23", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 472.0, 498.0, 68.0, 22.0 ], + "text" : "jit.gl.sketch" + } + + } +, { + "box" : { + "format" : 6, + "id" : "obj-21", + "maxclass" : "flonum", + "minimum" : 0.0, + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "bang" ], + "parameter_enable" : 0, + "patching_rect" : [ 276.5, 299.0, 50.0, 22.0 ] + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 276.5, 331.0, 87.0, 22.0 ], + "text" : "circles_size $1" + } + + } +, { "box" : { "id" : "obj-13", "maxclass" : "swatch", @@ -1402,7 +1440,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 404.857139945030212, 287.0, 199.0, 34.0 ], + "patching_rect" : [ 615.857139945030212, 296.0, 199.0, 34.0 ], "text" : "Use this abstraction to move single vertices by index." } @@ -1414,7 +1452,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 277.5, 298.119050145149231, 122.0, 22.0 ], + "patching_rect" : [ 488.5, 307.119050145149231, 122.0, 22.0 ], "text" : "r from_meshwarp_01" } @@ -1435,7 +1473,7 @@ "numoutlets" : 1, "offset" : [ 0.0, 0.0 ], "outlettype" : [ "" ], - "patching_rect" : [ 277.5, 326.047614336013794, 313.0, 86.952385663986206 ], + "patching_rect" : [ 488.5, 335.047614336013794, 313.0, 86.952385663986206 ], "viewvisibility" : 1 } @@ -1571,7 +1609,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 656.80952672163653, 441.0, 53.166666666666515, 441.0 ], + "midpoints" : [ 656.80952672163653, 276.0, 53.166666666666515, 276.0 ], "source" : [ "obj-15", 0 ] } @@ -1582,6 +1620,21 @@ "source" : [ "obj-20", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-21", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "midpoints" : [ 286.0, 441.0, 53.166666666666515, 441.0 ], + "source" : [ "obj-22", 0 ] + } + } , { "patchline" : { @@ -1609,7 +1662,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 287.0, 442.0, 53.166666666666515, 442.0 ], + "midpoints" : [ 498.0, 442.0, 53.166666666666515, 442.0 ], "source" : [ "obj-4", 0 ] } @@ -1710,7 +1763,7 @@ } , "classnamespace" : "box", - "rect" : [ 124.0, 373.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -2125,6 +2178,18 @@ "type" : "mx@s", "implicit" : 1 } +, { + "name" : "Aspect[1]_20210728.maxsnap", + "bootpath" : "~/Documents/Max 8/Snapshots", + "type" : "mx@s", + "implicit" : 1 + } +, { + "name" : "Zigzag[1].maxsnap", + "bootpath" : "~/Documents/Max 8/Snapshots", + "type" : "mx@s", + "implicit" : 1 + } , { "name" : "jit.gl.meshwarp.maxhelp[2].maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", @@ -2166,10 +2231,10 @@ "toggle" : 1.0, "blob" : { "meshwarpjs" : [ { - "meshdim" : [ 10, 4 ], - "nurbs_order" : [ 9, 3 ], + "meshdim" : [ 5, 4 ], + "nurbs_order" : [ 1, 1 ], "layer" : 0, - "lock_to_aspect" : 0, + "lock_to_aspect" : 1, "color" : [ 1, 1, 1, 1 ], "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, @@ -2177,13 +2242,13 @@ "grid_size" : 3, "windowRatio" : 1.333333333333333, "positionMat" : { - "scale" : [ 1.244444444444445, 0.7 ], - "center" : [ 0, 0 ], + "scale" : [ 0.358333349227905, 0.358333349227905 ], + "center" : [ -0.845833322033286, -0.499999998137355 ], "rotatez" : 0, "planecount" : 3, "type" : "float32", - "dimensions" : [ 10, 4 ], - "vertices" : "[[-1.244444489479065,-0.699999988079071,0],[-1.244444489479065,-0.23333333432674408,0],[-1.244444489479065,0.23333333432674408,0],[-1.244444489479065,0.699999988079071,0],[-0.9701646566390991,-0.6425103545188904,0],[-0.9701646566390991,-0.17584361135959625,0],[-0.9701646566390991,0.2908230423927307,0],[-0.9701646566390991,0.7574896216392517,0],[-0.6953189969062805,-0.5993930697441101,0],[-0.6953189969062805,-0.13272632658481598,0],[-0.6953189969062805,0.3339403569698334,0],[-0.6953189969062805,0.800606906414032,0],[-0.4199073910713196,-0.570648193359375,0],[-0.4199073910713196,-0.10398146510124207,0],[-0.4199073910713196,0.3626852333545685,0],[-0.4199073910713196,0.8293517231941223,0],[-0.14393000304698944,-0.5562757253646851,0],[-0.14393000304698944,-0.08960902690887451,0],[-0.14393000304698944,0.37705764174461365,0],[-0.14393000304698944,0.8437241911888123,0],[0.13261322677135468,-0.5562757253646851,0],[0.13261322677135468,-0.08960902690887451,0],[0.13261322677135468,0.37705764174461365,0],[0.13261322677135468,0.8437241911888123,0],[0.40972229838371277,-0.570648193359375,0],[0.40972229838371277,-0.10398146510124207,0],[0.40972229838371277,0.3626852333545685,0],[0.40972229838371277,0.8293517231941223,0],[0.6873971819877625,-0.5993930697441101,0],[0.6873971819877625,-0.13272632658481598,0],[0.6873971819877625,0.3339403569698334,0],[0.6873971819877625,0.800606906414032,0],[0.9656379222869873,-0.6425103545188904,0],[0.9656379222869873,-0.17584361135959625,0],[0.9656379222869873,0.2908230423927307,0],[0.9656379222869873,0.7574896216392517,0],[1.244444489479065,-0.699999988079071,0],[1.244444489479065,-0.23333333432674408,0],[1.244444489479065,0.23333333432674408,0],[1.244444489479065,0.699999988079071,0]]" + "dimensions" : [ 5, 4 ], + "vertices" : "[[-1.2041665315628052,-0.8583332896232605,0],[-1.2041665315628052,-0.6194444298744202,0],[-1.2041665315628052,-0.38055554032325745,0],[-1.2041665315628052,-0.14166665077209473,0],[-1.024999976158142,-0.8583332896232605,0],[-1.024999976158142,-0.6194444298744202,0],[-1.024999976158142,-0.38055554032325745,0],[-1.024999976158142,-0.14166665077209473,0],[-0.8458333015441895,-0.8583332896232605,0],[-0.8458333015441895,-0.6194444298744202,0],[-0.8458333015441895,-0.38055554032325745,0],[-0.8458333015441895,-0.14166665077209473,0],[-0.6666666865348816,-0.8583332896232605,0],[-0.6666666865348816,-0.6194444298744202,0],[-0.6666666865348816,-0.38055554032325745,0],[-0.6666666865348816,-0.14166665077209473,0],[-0.48749998211860657,-0.8583332896232605,0],[-0.48749998211860657,-0.6194444298744202,0],[-0.48749998211860657,-0.38055554032325745,0],[-0.48749998211860657,-0.14166665077209473,0]]" } } @@ -2195,18 +2260,18 @@ "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], - "show_ui" : 0, + "show_ui" : 1, "point_size" : 10, "grid_size" : 3, - "windowRatio" : 1, + "windowRatio" : 1.333333333333333, "positionMat" : { - "scale" : [ 1, 1 ], - "center" : [ 0, 0 ], + "scale" : [ 0.370833337306976, 0.370833337306976 ], + "center" : [ -0.033333379775286, 0.474999903701246 ], "rotatez" : 0, "planecount" : 3, "type" : "float32", "dimensions" : [ 5, 4 ], - "vertices" : "[[-1,-1,0],[-1,-0.3333333432674408,0],[-1,0.3333333432674408,0],[-1,1,0],[-0.5,-1,0],[-0.5,-0.3333333432674408,0],[-0.5,0.3333333432674408,0],[-0.5,1,0],[0,-1,0],[0,-0.3333333432674408,0],[0,0.3333333432674408,0],[0,1,0],[0.5,-1,0],[0.5,-0.3333333432674408,0],[0.5,0.3333333432674408,0],[0.5,1,0],[1,-1,0],[1,-0.3333333432674408,0],[1,0.3333333432674408,0],[1,1,0]]" + "vertices" : "[[-0.4041667580604553,0.10416656732559204,0],[-0.4041667580604553,0.3513887822628021,0],[-0.4041667580604553,0.5986109972000122,0],[-0.4041667580604553,0.8458331823348999,0],[-0.2187500298023224,0.10416656732559204,0],[-0.2187500298023224,0.3513887822628021,0],[-0.2187500298023224,0.5986109972000122,0],[-0.2187500298023224,0.8458331823348999,0],[-0.03333337977528572,0.10416656732559204,0],[-0.03333337977528572,0.3513887822628021,0],[-0.03333337977528572,0.5986109972000122,0],[-0.03333337977528572,0.8458331823348999,0],[0.15208330750465393,0.10416656732559204,0],[0.15208330750465393,0.3513887822628021,0],[0.15208330750465393,0.5986109972000122,0],[0.15208330750465393,0.8458331823348999,0],[0.3374999165534973,0.10416656732559204,0],[0.3374999165534973,0.3513887822628021,0],[0.3374999165534973,0.5986109972000122,0],[0.3374999165534973,0.8458331823348999,0]]" } } @@ -2218,18 +2283,18 @@ "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], - "show_ui" : 0, + "show_ui" : 1, "point_size" : 10, "grid_size" : 3, - "windowRatio" : 1, + "windowRatio" : 1.333333333333333, "positionMat" : { - "scale" : [ 1, 1 ], - "center" : [ 0, 0 ], + "scale" : [ 0.362500011920929, 0.362500011920929 ], + "center" : [ 0.787499845027924, -0.491666704416275 ], "rotatez" : 0, "planecount" : 3, "type" : "float32", "dimensions" : [ 5, 4 ], - "vertices" : "[[-1,-1,0],[-1,-0.3333333432674408,0],[-1,0.3333333432674408,0],[-1,1,0],[-0.5,-1,0],[-0.5,-0.3333333432674408,0],[-0.5,0.3333333432674408,0],[-0.5,1,0],[0,-1,0],[0,-0.3333333432674408,0],[0,0.3333333432674408,0],[0,1,0],[0.5,-1,0],[0.5,-0.3333333432674408,0],[0.5,0.3333333432674408,0],[0.5,1,0],[1,-1,0],[1,-0.3333333432674408,0],[1,0.3333333432674408,0],[1,1,0]]" + "vertices" : "[[0.42499983310699463,-0.8541667461395264,0],[0.42499983310699463,-0.6125000715255737,0],[0.42499983310699463,-0.3708333671092987,0],[0.42499983310699463,-0.12916669249534607,0],[0.6062498092651367,-0.8541667461395264,0],[0.6062498092651367,-0.6125000715255737,0],[0.6062498092651367,-0.3708333671092987,0],[0.6062498092651367,-0.12916669249534607,0],[0.7874998450279236,-0.8541667461395264,0],[0.7874998450279236,-0.6125000715255737,0],[0.7874998450279236,-0.3708333671092987,0],[0.7874998450279236,-0.12916669249534607,0],[0.9687498807907104,-0.8541667461395264,0],[0.9687498807907104,-0.6125000715255737,0],[0.9687498807907104,-0.3708333671092987,0],[0.9687498807907104,-0.12916669249534607,0],[1.1499998569488525,-0.8541667461395264,0],[1.1499998569488525,-0.6125000715255737,0],[1.1499998569488525,-0.3708333671092987,0],[1.1499998569488525,-0.12916669249534607,0]]" } } @@ -2243,7 +2308,7 @@ } , "snapshotlist" : { - "current_snapshot" : 1, + "current_snapshot" : 3, "entries" : [ { "filetype" : "C74Snapshot", "version" : 2, @@ -2879,6 +2944,42 @@ "snapshotfileid" : "0e9c7d4d0916d1bebe103ade4eaffa6d" } + } +, { + "filetype" : "C74Snapshot", + "version" : 2, + "minorversion" : 0, + "name" : "Zigzag", + "origin" : "jit.gl.meshwarp.maxhelp", + "type" : "patcher", + "subtype" : "Undefined", + "embed" : 0, + "fileref" : { + "name" : "Zigzag", + "filename" : "Aspect[1]_20210728.maxsnap", + "filepath" : "~/Documents/Max 8/Snapshots", + "filepos" : -1, + "snapshotfileid" : "702c95b617335e4d15f13ce0bbcfdf15" + } + + } +, { + "filetype" : "C74Snapshot", + "version" : 2, + "minorversion" : 0, + "name" : "Squares", + "origin" : "jit.gl.meshwarp.maxhelp", + "type" : "patcher", + "subtype" : "Undefined", + "embed" : 0, + "fileref" : { + "name" : "Squares", + "filename" : "Zigzag[1].maxsnap", + "filepath" : "~/Documents/Max 8/Snapshots", + "filepos" : -1, + "snapshotfileid" : "594b9a14dc7b2604ba9a24d306a1d169" + } + } ] } diff --git a/javascript/GraphicElements.js b/javascript/GraphicElements.js index 2860572..20f0805 100644 --- a/javascript/GraphicElements.js +++ b/javascript/GraphicElements.js @@ -4,7 +4,7 @@ function GraphicElements(nodectx) { this.sketch.depth_enable = 0; this.sketch.layer = FRONT+2; this.sketch.color = RED; - this.sketch.line_width = 2; + this.sketch.line_width = 3; this.circleRadius = 0.03; @@ -81,11 +81,18 @@ function GraphicElements(nodectx) { this.sketch2.layer = FRONT+val; } - this.setSingleSelectionCircleColor = function(color) { + this.setSingleCircleAndFrameColor = function(color) { this.sketch.color = color; } this.setMultipleSelectionCirclesColor = function(color) { this.sketch2.color = color; } + + this.setCirclesAndFrameSize = function(val) { + this.sketch.shapeslice(val*50); + this.circleRadius = val*0.06; + this.sketch.line_width = val*3; + this.sketch2.line_width = val*3; + } } \ No newline at end of file diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index 115eae2..eefe7ef 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -83,6 +83,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { } } if (foundLayers.length > 1) { + print("test "+getMaxFromArray(foundLayers)) if (getMaxFromArray(foundLayers) == layer) { assignThisAsCurrentlySelectedToGlobal(); } diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index 9eccde0..9f02132 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -86,7 +86,7 @@ function setUIGridColor() { setUIGridColor.local = 1; function setSingleCircleColor() { - gGraphics.setSingleSelectionCircleColor(arrayfromargs(arguments)); + gGraphics.setSingleCircleAndFrameColor(arrayfromargs(arguments)); } setSingleCircleColor.local = 1; @@ -95,6 +95,10 @@ function setMultipleCirclesColor() { } setSingleCircleColor.local = 1; +function setCirclesAndFrameLineSize(val) { + gGraphics.setCirclesAndFrameSize(val); +} + function setRotatez(rotZ) { var angleRad = (rotZ / 180) * 3.1459; rotatez = rotZ; diff --git a/javascript/meshwarp.js b/javascript/meshwarp.js index 8a9cd4f..f1dcb22 100644 --- a/javascript/meshwarp.js +++ b/javascript/meshwarp.js @@ -59,6 +59,7 @@ declareattribute("ui_grid_color", null, "setUIGridColor", 0); declareattribute("selection_color", null, "setSingleCircleColor", 0); declareattribute("multiple_selection_color", null, "setMultipleCirclesColor", 0); +declareattribute("circles_size", null, "setCirclesAndFrameLineSize", 0); var show_ui = 1; declareattribute("show_ui", null, "showUI", 0); From 59c0ca3024107055f51afad437e627fd8c61b4c9 Mon Sep 17 00:00:00 2001 From: FedFod Date: Wed, 4 Aug 2021 21:39:31 +0200 Subject: [PATCH 05/18] Fixed bug with scale and selection of mesh --- help/jit.gl.meshwarp.maxhelp | 4 ++-- javascript/Mesh_mouse_routine.js | 4 ++-- javascript/Mesh_save_load.js | 3 +-- javascript/Mesh_scale.js | 5 +++-- javascript/PrivateFunctions.js | 6 ------ javascript/Set_Attributes_Functions.js | 8 +++++++- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index da5a318..0a33fc8 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -2161,8 +2161,8 @@ ], "lines" : [ ], "parameters" : { - "obj-4::obj-41::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[1]", 0 ], - "obj-4::obj-43::obj-8" : [ "meshwarpjs[3]", "meshwarpjs[3]", 0 ], + "obj-4::obj-41::obj-8" : [ "meshwarpjs[1]", "meshwarpjs[1]", 0 ], + "obj-4::obj-43::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[3]", 0 ], "obj-51::obj-1::obj-8" : [ "meshwarpjs", "meshwarpjs", 0 ], "obj-51::obj-9" : [ "toggle", "toggle", 0 ], "parameterbanks" : { diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index eefe7ef..7495a80 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -17,7 +17,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { var mouseClicked = mouseState[2]; if (this.showMeshUI) { - var oldMouseClicked = oldMouseState_[2]; + // var oldMouseClicked = oldMouseState_[2]; if (mouseClicked) { // gGraphics.drawID(this.getMeshCenter(this.positionMat)); @@ -50,7 +50,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { } else { // mouse is released if (this.latestAction == GUI_ELEMENTS.WAS_SCALED) { - this.setLatestScale(); + this.setLatestScale_calcBoundsMat(); } else if (this.latestAction == GUI_ELEMENTS.WAS_MOVED_VERTICES) { this.deselectVertices(); diff --git a/javascript/Mesh_save_load.js b/javascript/Mesh_save_load.js index f0caf32..7233e3f 100644 --- a/javascript/Mesh_save_load.js +++ b/javascript/Mesh_save_load.js @@ -94,9 +94,8 @@ Mesh.prototype.applyHistory = function() { arrayToJitMat(this.positionMat, state.posMat); this.currentScale = state.scale.slice(); this.currentPos = state.position.slice(); - this.setLatestScale(); + this.setLatestScale_calcBoundsMat_calcBoundsMat(); this.applyMeshTransformation(); - this.calcMeshBoundsMat(); this.updateGUI(); } diff --git a/javascript/Mesh_scale.js b/javascript/Mesh_scale.js index 18e7790..975318a 100644 --- a/javascript/Mesh_scale.js +++ b/javascript/Mesh_scale.js @@ -31,13 +31,14 @@ Mesh.prototype.scaleToTextureRatio = function(val) { this.useAspectRatio = val; this.meshRatio = this.textureRatio; this.scaleMesh(this.currentScale[0], this.currentScale[1]); - this.setLatestScale(); + this.setLatestScale_calcBoundsMat(); this.updateGUI(); } -Mesh.prototype.setLatestScale = function() { +Mesh.prototype.setLatestScale_calcBoundsMat = function() { this.latestScale = this.currentScale.slice(); this.setMeshRatio(); + this.calcMeshBoundsMat(); } Mesh.prototype.setMeshRatio = function() { diff --git a/javascript/PrivateFunctions.js b/javascript/PrivateFunctions.js index 4c23d0d..71f1aea 100644 --- a/javascript/PrivateFunctions.js +++ b/javascript/PrivateFunctions.js @@ -38,12 +38,6 @@ nodeCamera.ortho = 2; // } // calculateBoundingCells.local = 1; -function setScaleRelativeToAspect(val) { - lock_to_aspect = val; - gMesh.scaleToTextureRatio(val); -} -setScaleRelativeToAspect.local = 1; - function setWindowRatio(dims) { gWindowRatio = dims[0] / dims[1]; } diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index 9f02132..6dc847b 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -166,6 +166,12 @@ function loadFromDict(saveDict) { } loadFromDict.local = 1; +function setScaleRelativeToAspect(val) { + lock_to_aspect = val; + gMesh.scaleToTextureRatio(val); +} +setScaleRelativeToAspect.local = 1; + function setTexturesMeshes() { if (arguments.length > 0) { texture = (arrayfromargs(arguments)); @@ -177,7 +183,7 @@ setTexturesMeshes.local = 1; function setScale(scaleX, scaleY) { gMesh.scaleMesh(scaleX, scaleY); - gMesh.setLatestScale(); + gMesh.setLatestScale_calcBoundsMat(); } setScale.local = 1; From e109b76b1ae3d00e082cc0cd7cf05806c248f134 Mon Sep 17 00:00:00 2001 From: FedFod Date: Wed, 4 Aug 2021 21:54:32 +0200 Subject: [PATCH 06/18] Reset doesn't return the mesh to square, but returns it to aspect ratio is "lock_to_aspect" is flagged --- help/jit.gl.meshwarp.maxhelp | 6 +++--- javascript/Mesh.js | 4 ++-- javascript/Set_Attributes_Functions.js | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index 0a33fc8..c6ee19c 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 128.0, 377.0, 964.0, 573.0 ], + "rect" : [ 105.0, 240.0, 964.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -629,7 +629,7 @@ } , "classnamespace" : "box", - "rect" : [ 128.0, 403.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1763,7 +1763,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 105.0, 266.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, diff --git a/javascript/Mesh.js b/javascript/Mesh.js index 5a52a48..3531a38 100644 --- a/javascript/Mesh.js +++ b/javascript/Mesh.js @@ -91,8 +91,8 @@ function Mesh(ID) { this.initScaleHandles(drawto_); // this.initPhysBody(); this.initTextureProxy(); - this.calcMeshBoundsMat(); + this.calcMeshBoundsMat(); this.assignPositionMatToMesh(); this.initAndAssignTextureCoordMat(); // init texture coord mat this.triggerNURBSOutput(); @@ -110,7 +110,7 @@ function Mesh(ID) { this.latestScale = this.currentScale.slice(); this.latestRotation = 0; this.useNurbs = 1; - this.useAspectRatio = 0; + // this.useAspectRatio = 0; this.undoRedoLevels = []; this.undoPointer = 0; this.latestAction = GUI_ELEMENTS.NOTHING; diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index 6dc847b..474e86f 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -18,6 +18,7 @@ function reset() { gGraphics.resetSingleCircle(); gGraphics.resetSelected(); gMesh.initMesh(nodeCTX.name); + gMesh.scaleMesh(gMesh.currentScale[0], gMesh.currentScale[1]); assignThisAsCurrentlySelectedToGlobal(); } From 164ac6c3e25f9cd78ccbfeb75b3e6704ee98c6c2 Mon Sep 17 00:00:00 2001 From: FedFod Date: Thu, 5 Aug 2021 12:55:58 +0200 Subject: [PATCH 07/18] Inverted order of Y indices for vertices when using the "move_vertex" message --- help/jit.gl.meshwarp.maxhelp | 54 ++++++++++---------------- javascript/Mesh_movement.js | 2 +- javascript/Set_Attributes_Functions.js | 2 +- 3 files changed, 23 insertions(+), 35 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index c6ee19c..9fc309c 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 105.0, 240.0, 964.0, 573.0 ], + "rect" : [ 160.0, 245.0, 964.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1227,7 +1227,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 160.0, 271.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1257,18 +1257,6 @@ "showontab" : 1, "assistshowspatchername" : 0, "boxes" : [ { - "box" : { - "id" : "obj-23", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 472.0, 498.0, 68.0, 22.0 ], - "text" : "jit.gl.sketch" - } - - } -, { "box" : { "format" : 6, "id" : "obj-21", @@ -1763,7 +1751,7 @@ } , "classnamespace" : "box", - "rect" : [ 105.0, 266.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -2231,10 +2219,10 @@ "toggle" : 1.0, "blob" : { "meshwarpjs" : [ { - "meshdim" : [ 5, 4 ], - "nurbs_order" : [ 1, 1 ], + "meshdim" : [ 10, 4 ], + "nurbs_order" : [ 9, 3 ], "layer" : 0, - "lock_to_aspect" : 1, + "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, @@ -2242,13 +2230,13 @@ "grid_size" : 3, "windowRatio" : 1.333333333333333, "positionMat" : { - "scale" : [ 0.358333349227905, 0.358333349227905 ], - "center" : [ -0.845833322033286, -0.499999998137355 ], + "scale" : [ 1.244444444444445, 0.7 ], + "center" : [ 0, 0 ], "rotatez" : 0, "planecount" : 3, "type" : "float32", - "dimensions" : [ 5, 4 ], - "vertices" : "[[-1.2041665315628052,-0.8583332896232605,0],[-1.2041665315628052,-0.6194444298744202,0],[-1.2041665315628052,-0.38055554032325745,0],[-1.2041665315628052,-0.14166665077209473,0],[-1.024999976158142,-0.8583332896232605,0],[-1.024999976158142,-0.6194444298744202,0],[-1.024999976158142,-0.38055554032325745,0],[-1.024999976158142,-0.14166665077209473,0],[-0.8458333015441895,-0.8583332896232605,0],[-0.8458333015441895,-0.6194444298744202,0],[-0.8458333015441895,-0.38055554032325745,0],[-0.8458333015441895,-0.14166665077209473,0],[-0.6666666865348816,-0.8583332896232605,0],[-0.6666666865348816,-0.6194444298744202,0],[-0.6666666865348816,-0.38055554032325745,0],[-0.6666666865348816,-0.14166665077209473,0],[-0.48749998211860657,-0.8583332896232605,0],[-0.48749998211860657,-0.6194444298744202,0],[-0.48749998211860657,-0.38055554032325745,0],[-0.48749998211860657,-0.14166665077209473,0]]" + "dimensions" : [ 10, 4 ], + "vertices" : "[[-1.244444489479065,-0.699999988079071,0],[-1.244444489479065,-0.23333333432674408,0],[-1.244444489479065,0.23333333432674408,0],[-1.244444489479065,0.699999988079071,0],[-0.9701646566390991,-0.6425103545188904,0],[-0.9701646566390991,-0.17584361135959625,0],[-0.9701646566390991,0.2908230423927307,0],[-0.9701646566390991,0.7574896216392517,0],[-0.6953189969062805,-0.5993930697441101,0],[-0.6953189969062805,-0.13272632658481598,0],[-0.6953189969062805,0.3339403569698334,0],[-0.6953189969062805,0.800606906414032,0],[-0.4199073910713196,-0.570648193359375,0],[-0.4199073910713196,-0.10398146510124207,0],[-0.4199073910713196,0.3626852333545685,0],[-0.4199073910713196,0.8293517231941223,0],[-0.14393000304698944,-0.5562757253646851,0],[-0.14393000304698944,-0.08960902690887451,0],[-0.14393000304698944,0.37705764174461365,0],[-0.14393000304698944,0.8437241911888123,0],[0.13261322677135468,-0.5562757253646851,0],[0.13261322677135468,-0.08960902690887451,0],[0.13261322677135468,0.37705764174461365,0],[0.13261322677135468,0.8437241911888123,0],[0.40972229838371277,-0.570648193359375,0],[0.40972229838371277,-0.10398146510124207,0],[0.40972229838371277,0.3626852333545685,0],[0.40972229838371277,0.8293517231941223,0],[0.6873971819877625,-0.5993930697441101,0],[0.6873971819877625,-0.13272632658481598,0],[0.6873971819877625,0.3339403569698334,0],[0.6873971819877625,0.800606906414032,0],[0.9656379222869873,-0.6425103545188904,0],[0.9656379222869873,-0.17584361135959625,0],[0.9656379222869873,0.2908230423927307,0],[0.9656379222869873,0.7574896216392517,0],[1.244444489479065,-0.699999988079071,0],[1.244444489479065,-0.23333333432674408,0],[1.244444489479065,0.23333333432674408,0],[1.244444489479065,0.699999988079071,0]]" } } @@ -2260,18 +2248,18 @@ "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], - "show_ui" : 1, + "show_ui" : 0, "point_size" : 10, "grid_size" : 3, - "windowRatio" : 1.333333333333333, + "windowRatio" : 1, "positionMat" : { - "scale" : [ 0.370833337306976, 0.370833337306976 ], - "center" : [ -0.033333379775286, 0.474999903701246 ], + "scale" : [ 1, 1 ], + "center" : [ 0, 0 ], "rotatez" : 0, "planecount" : 3, "type" : "float32", "dimensions" : [ 5, 4 ], - "vertices" : "[[-0.4041667580604553,0.10416656732559204,0],[-0.4041667580604553,0.3513887822628021,0],[-0.4041667580604553,0.5986109972000122,0],[-0.4041667580604553,0.8458331823348999,0],[-0.2187500298023224,0.10416656732559204,0],[-0.2187500298023224,0.3513887822628021,0],[-0.2187500298023224,0.5986109972000122,0],[-0.2187500298023224,0.8458331823348999,0],[-0.03333337977528572,0.10416656732559204,0],[-0.03333337977528572,0.3513887822628021,0],[-0.03333337977528572,0.5986109972000122,0],[-0.03333337977528572,0.8458331823348999,0],[0.15208330750465393,0.10416656732559204,0],[0.15208330750465393,0.3513887822628021,0],[0.15208330750465393,0.5986109972000122,0],[0.15208330750465393,0.8458331823348999,0],[0.3374999165534973,0.10416656732559204,0],[0.3374999165534973,0.3513887822628021,0],[0.3374999165534973,0.5986109972000122,0],[0.3374999165534973,0.8458331823348999,0]]" + "vertices" : "[[-1,-1,0],[-1,-0.3333333432674408,0],[-1,0.3333333432674408,0],[-1,1,0],[-0.5,-1,0],[-0.5,-0.3333333432674408,0],[-0.5,0.3333333432674408,0],[-0.5,1,0],[0,-1,0],[0,-0.3333333432674408,0],[0,0.3333333432674408,0],[0,1,0],[0.5,-1,0],[0.5,-0.3333333432674408,0],[0.5,0.3333333432674408,0],[0.5,1,0],[1,-1,0],[1,-0.3333333432674408,0],[1,0.3333333432674408,0],[1,1,0]]" } } @@ -2283,18 +2271,18 @@ "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], - "show_ui" : 1, + "show_ui" : 0, "point_size" : 10, "grid_size" : 3, - "windowRatio" : 1.333333333333333, + "windowRatio" : 1, "positionMat" : { - "scale" : [ 0.362500011920929, 0.362500011920929 ], - "center" : [ 0.787499845027924, -0.491666704416275 ], + "scale" : [ 1, 1 ], + "center" : [ 0, 0 ], "rotatez" : 0, "planecount" : 3, "type" : "float32", "dimensions" : [ 5, 4 ], - "vertices" : "[[0.42499983310699463,-0.8541667461395264,0],[0.42499983310699463,-0.6125000715255737,0],[0.42499983310699463,-0.3708333671092987,0],[0.42499983310699463,-0.12916669249534607,0],[0.6062498092651367,-0.8541667461395264,0],[0.6062498092651367,-0.6125000715255737,0],[0.6062498092651367,-0.3708333671092987,0],[0.6062498092651367,-0.12916669249534607,0],[0.7874998450279236,-0.8541667461395264,0],[0.7874998450279236,-0.6125000715255737,0],[0.7874998450279236,-0.3708333671092987,0],[0.7874998450279236,-0.12916669249534607,0],[0.9687498807907104,-0.8541667461395264,0],[0.9687498807907104,-0.6125000715255737,0],[0.9687498807907104,-0.3708333671092987,0],[0.9687498807907104,-0.12916669249534607,0],[1.1499998569488525,-0.8541667461395264,0],[1.1499998569488525,-0.6125000715255737,0],[1.1499998569488525,-0.3708333671092987,0],[1.1499998569488525,-0.12916669249534607,0]]" + "vertices" : "[[-1,-1,0],[-1,-0.3333333432674408,0],[-1,0.3333333432674408,0],[-1,1,0],[-0.5,-1,0],[-0.5,-0.3333333432674408,0],[-0.5,0.3333333432674408,0],[-0.5,1,0],[0,-1,0],[0,-0.3333333432674408,0],[0,0.3333333432674408,0],[0,1,0],[0.5,-1,0],[0.5,-0.3333333432674408,0],[0.5,0.3333333432674408,0],[0.5,1,0],[1,-1,0],[1,-0.3333333432674408,0],[1,0.3333333432674408,0],[1,1,0]]" } } @@ -2308,7 +2296,7 @@ } , "snapshotlist" : { - "current_snapshot" : 3, + "current_snapshot" : 1, "entries" : [ { "filetype" : "C74Snapshot", "version" : 2, diff --git a/javascript/Mesh_movement.js b/javascript/Mesh_movement.js index ac6b8ef..1082eb8 100644 --- a/javascript/Mesh_movement.js +++ b/javascript/Mesh_movement.js @@ -314,6 +314,6 @@ Mesh.prototype.getSelectedVertexIndex = function() { } Mesh.prototype.outputSelectedVertex = function(vertexPos) { - outlet(0, "selected_vertex", this.selectedVertexIndex[0], this.selectedVertexIndex[1], vertexPos[0], vertexPos[1]); + outlet(0, "selected_vertex", this.selectedVertexIndex[0], (this.positionMat.dim[1]-1)-this.selectedVertexIndex[1], vertexPos[0], vertexPos[1]); } diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index 474e86f..b6132d6 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -24,7 +24,7 @@ function reset() { function move_vertex(indexX, indexY, posX, posY) { var tempPos = [posX, posY]; - var tempIndex = [indexX, indexY]; + var tempIndex = [indexX, (gMesh.positionMat.dim[1]-1)-indexY]; if (checkIfVec2AreDifferent(tempIndex, gMesh.selectedVertexIndex)) { var tempPos = gMesh.getPositionMatCell(tempIndex); } From b298da5512f303715f7c241129086e8181ed3686 Mon Sep 17 00:00:00 2001 From: FedFod Date: Thu, 5 Aug 2021 16:56:40 +0200 Subject: [PATCH 08/18] Added possibility of moving mesh using ctrl+drag anywhere inside the mesh --- help/jit.gl.meshwarp.maxhelp | 10 ++++----- javascript/Mesh.js | 2 ++ javascript/Mesh_mouse_routine.js | 11 +++++++--- javascript/Mesh_movement.js | 15 ++++++++++++-- javascript/Mesh_save_load.js | 3 ++- javascript/PrivateFunctions.js | 1 + javascript/Set_Attributes_Functions.js | 2 +- javascript/meshwarp.js | 1 + patchers/jit.gl.meshwarp.maxpat | 28 +++++--------------------- 9 files changed, 38 insertions(+), 35 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index 9fc309c..c24949e 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 160.0, 245.0, 964.0, 573.0 ], + "rect" : [ 151.0, 174.0, 964.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1227,7 +1227,7 @@ } , "classnamespace" : "box", - "rect" : [ 160.0, 271.0, 964.0, 547.0 ], + "rect" : [ 151.0, 200.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -2009,7 +2009,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 51.642860054969788, 446.047614336013794, 300.0, 22.0 ], + "patching_rect" : [ 51.642860054969788, 450.047614336013794, 300.0, 22.0 ], "text" : "jit.gl.meshwarp @show_ui 1 @meshdim 10 4 @layer 0", "varname" : "jit.gl.meshwarp" } @@ -2149,8 +2149,8 @@ ], "lines" : [ ], "parameters" : { - "obj-4::obj-41::obj-8" : [ "meshwarpjs[1]", "meshwarpjs[1]", 0 ], - "obj-4::obj-43::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[3]", 0 ], + "obj-4::obj-41::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[1]", 0 ], + "obj-4::obj-43::obj-8" : [ "meshwarpjs[3]", "meshwarpjs[3]", 0 ], "obj-51::obj-1::obj-8" : [ "meshwarpjs", "meshwarpjs", 0 ], "obj-51::obj-9" : [ "toggle", "toggle", 0 ], "parameterbanks" : { diff --git a/javascript/Mesh.js b/javascript/Mesh.js index 3531a38..fa6de53 100644 --- a/javascript/Mesh.js +++ b/javascript/Mesh.js @@ -39,6 +39,7 @@ function Mesh(ID) { this.latestScale = this.currentScale.slice(); this.meshRatio = 1; this.currentPos = [0,0]; + this.latestCurrentPos = this.currentPos.slice(); this.nurbsLstnr = null; this.hasNurbsMat = 0; this.textureNames = [""]; @@ -106,6 +107,7 @@ function Mesh(ID) { this.latestMousePos = [0, 0]; this.mouseOffset = [0,0]; this.currentPos = [0,0]; + this.latestCurrentPos = [0,0]; this.currentScale = [1, 1]; this.latestScale = this.currentScale.slice(); this.latestRotation = 0; diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index 7495a80..93b3642 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -47,6 +47,9 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { default: break; } + if (gCTRLPressed) { + this.moveMeshWithCtrl(mouseWorld); + } } else { // mouse is released if (this.latestAction == GUI_ELEMENTS.WAS_SCALED) { @@ -55,7 +58,10 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { else if (this.latestAction == GUI_ELEMENTS.WAS_MOVED_VERTICES) { this.deselectVertices(); } - if (this.mouseIsCloseTo != GUI_ELEMENTS.NOTHING) { + else if (this.latestAction == GUI_ELEMENTS.WAS_MOVED_MESH) { + this.storeLatestMeshPos(); + } + if (this.latestAction != GUI_ELEMENTS.NOTHING) { this.saveUndoRedoPositionMat(); this.calcMeshBoundsMat(); } @@ -68,7 +74,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { // SELECT MESH GLOBALLY if (mouseClicked) { if (this.checkIfMouseIsInsideMesh(mouseWorld) == this.ID) { - setToGlobalIfMouseIsOnMesh(true); + setToGlobalIfMouseIsOnMesh(true); } else { setToGlobalIfMouseIsOnMesh(false); } @@ -83,7 +89,6 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { } } if (foundLayers.length > 1) { - print("test "+getMaxFromArray(foundLayers)) if (getMaxFromArray(foundLayers) == layer) { assignThisAsCurrentlySelectedToGlobal(); } diff --git a/javascript/Mesh_movement.js b/javascript/Mesh_movement.js index 1082eb8..bce05f3 100644 --- a/javascript/Mesh_movement.js +++ b/javascript/Mesh_movement.js @@ -47,7 +47,7 @@ Mesh.prototype.checkIfMouseIsCloseToVertex = function(mouseWorld) { this.mouseOffset = subVec2D(cell, mouseWorld); this.selectedVertexIndex = coords; this.mouseIsCloseTo = GUI_ELEMENTS.VERTEX; - this.outputSelectedVertex(cell); + // this.outputSelectedVertex(cell); return this.mouseIsCloseTo; } @@ -108,7 +108,7 @@ Mesh.prototype.moveSelectedVertices = function(mouseWorld) { this.setVertexPosInMat(newPos, this.selectedVerticesIndices[i]); gGraphics.drawSelectedCircles(newPos); } - this.latestMousePos = mouseWorld.slice(); + this.setLatestMousePos(mouseWorld); this.applyMeshTransformation(); this.latestAction = GUI_ELEMENTS.WAS_MOVED_VERTICES; } @@ -121,6 +121,13 @@ Mesh.prototype.moveMeshWithHandle = function(mouseWorld) { } } +Mesh.prototype.moveMeshWithCtrl = function(mouseWorld) { + this.mouseOffset = subVec2D(this.latestCurrentPos, this.latestMousePos); + var offset = sumVec2D(mouseWorld, this.mouseOffset); + this.setMeshPosition(offset); + // this.mouseIsCloseTo = GUI_ELEMENTS.MOVE_HANDLE; +} + Mesh.prototype.setMeshPosition = function(offset) { var newPos = subVec2D(offset, this.currentPos); this.positionMat.op("+", [newPos[0], newPos[1]]); @@ -309,6 +316,10 @@ Mesh.prototype.getLatestMousePos = function() { return this.latestMousePos.slice(); } +Mesh.prototype.storeLatestMeshPos = function() { + this.latestCurrentPos = this.currentPos; +} + Mesh.prototype.getSelectedVertexIndex = function() { return this.selectedVertexIndex; } diff --git a/javascript/Mesh_save_load.js b/javascript/Mesh_save_load.js index 7233e3f..e154b0a 100644 --- a/javascript/Mesh_save_load.js +++ b/javascript/Mesh_save_load.js @@ -36,6 +36,7 @@ Mesh.prototype.loadDataFromDict = function(dict) { this.posMatDim = dict.get("positionMat::dimensions"); this.currentScale = dict.get("positionMat::scale"); this.currentPos = dict.get("positionMat::center"); + this.latestCurrentPos = this.currentPos.slice(); setRotatez(dict.get("positionMat::rotatez")); this.latestScale = this.currentScale.slice(); @@ -94,7 +95,7 @@ Mesh.prototype.applyHistory = function() { arrayToJitMat(this.positionMat, state.posMat); this.currentScale = state.scale.slice(); this.currentPos = state.position.slice(); - this.setLatestScale_calcBoundsMat_calcBoundsMat(); + this.setLatestScale_calcBoundsMat(); this.applyMeshTransformation(); this.updateGUI(); } diff --git a/javascript/PrivateFunctions.js b/javascript/PrivateFunctions.js index 71f1aea..4471de8 100644 --- a/javascript/PrivateFunctions.js +++ b/javascript/PrivateFunctions.js @@ -67,6 +67,7 @@ function checkModifiersKeyDown() { gShiftPressed = max.shiftkeydown; gMesh.setMeshRatio(); } + gCTRLPressed = max.cmdkeydown; } checkModifiersKeyDown.local = 1; diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index b6132d6..6a3eb51 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -36,7 +36,7 @@ function jit_gl_texture(texName) { } function write(path) { - debug(DEBUG.GENERAL, "saveing to " + path); + debug(DEBUG.GENERAL, "saving to " + path); saveDictToPath(path); } diff --git a/javascript/meshwarp.js b/javascript/meshwarp.js index f1dcb22..7738ca9 100644 --- a/javascript/meshwarp.js +++ b/javascript/meshwarp.js @@ -88,6 +88,7 @@ var gWindowRatio = 1; var gWindowPrevRatio = gWindowRatio; var gIsMouseInsideWindow = false; var gShiftPressed = false; +var gCTRLPressed = false; var gMaxUndo = 100; var gMesh = new Mesh(gGlobal.meshCount++); diff --git a/patchers/jit.gl.meshwarp.maxpat b/patchers/jit.gl.meshwarp.maxpat index 69985c6..54215a8 100644 --- a/patchers/jit.gl.meshwarp.maxpat +++ b/patchers/jit.gl.meshwarp.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 35.0, 87.0, 720.0, 547.0 ], + "rect" : [ 425.0, 88.0, 720.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -746,7 +746,7 @@ "box" : { "comment" : "", "id" : "obj-19", - "index" : 0, + "index" : 1, "maxclass" : "outlet", "numinlets" : 1, "numoutlets" : 0, @@ -885,11 +885,11 @@ "box" : { "comment" : "", "id" : "obj-5", - "index" : 0, + "index" : 1, "maxclass" : "inlet", "numinlets" : 0, "numoutlets" : 1, - "outlettype" : [ "" ], + "outlettype" : [ "jit_gl_texture" ], "patching_rect" : [ 111.0, 36.0, 30.0, 30.0 ] } @@ -1191,25 +1191,7 @@ } } - ], - "parameters" : { - "obj-8" : [ "meshwarpjs", "meshwarpjs", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "meshwarp.js", - "bootpath" : "~/dev/cycling/meshwarp/code", - "patcherrelativepath" : "../code", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 + ] } } From a8b300192bc896356cdf412793a79e412f4c3e94 Mon Sep 17 00:00:00 2001 From: FedFod Date: Thu, 5 Aug 2021 20:44:09 +0200 Subject: [PATCH 09/18] syncing help file patch --- help/jit.gl.meshwarp.maxhelp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index c24949e..23298aa 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 151.0, 174.0, 964.0, 573.0 ], + "rect" : [ 92.0, 170.0, 964.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1227,7 +1227,7 @@ } , "classnamespace" : "box", - "rect" : [ 151.0, 200.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1751,7 +1751,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 92.0, 196.0, 964.0, 547.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, From 68d5d40c79351c643cd424c27ad11318a97edbdd Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Fri, 13 Aug 2021 15:17:18 -0400 Subject: [PATCH 10/18] rename attr to grid_color --- docs/jit.gl.meshwarp.maxref.xml | 2 +- help/jit.gl.meshwarp.maxhelp | 46 +++++++++++++------------- javascript/Mesh.js | 2 +- javascript/Mesh_save_load.js | 2 +- javascript/Set_Attributes_Functions.js | 8 ++--- javascript/meshwarp.js | 4 +-- patchers/jit.gl.meshwarp.maxpat | 2 +- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/jit.gl.meshwarp.maxref.xml b/docs/jit.gl.meshwarp.maxref.xml index 167cf88..2fa3dab 100644 --- a/docs/jit.gl.meshwarp.maxref.xml +++ b/docs/jit.gl.meshwarp.maxref.xml @@ -235,7 +235,7 @@ The name of the texture to be applied (default = none). - + Set the color of the UI mesh grid (default = random); diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index 23298aa..b38c27a 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -1405,7 +1405,7 @@ "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 502.30952672163653, 175.119050145149231, 125.0, 22.0 ], - "text" : "prepend ui_grid_color" + "text" : "prepend grid_color" } } @@ -2224,7 +2224,7 @@ "layer" : 0, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], + "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2247,7 +2247,7 @@ "layer" : 2, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], + "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2270,7 +2270,7 @@ "layer" : 3, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], + "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2317,7 +2317,7 @@ "layer" : 0, "lock_to_aspect" : 1, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], + "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2340,7 +2340,7 @@ "layer" : 2, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], + "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2363,7 +2363,7 @@ "layer" : 3, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], + "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2413,11 +2413,11 @@ "blob" : { "meshwarpjs" : [ { "meshdim" : [ 10, 4 ], - "nurbs_order" : [ 9, 3 ], + "nurbs_order" : [ 1, 1 ], "layer" : 0, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], + "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2440,7 +2440,7 @@ "layer" : 2, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], + "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2463,7 +2463,7 @@ "layer" : 3, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], + "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2517,7 +2517,7 @@ "layer" : 0, "lock_to_aspect" : 1, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], + "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2540,7 +2540,7 @@ "layer" : 2, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], + "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2563,7 +2563,7 @@ "layer" : 3, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], + "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2617,7 +2617,7 @@ "layer" : 0, "lock_to_aspect" : 1, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], + "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2640,7 +2640,7 @@ "layer" : 2, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], + "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2663,7 +2663,7 @@ "layer" : 3, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], + "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2717,7 +2717,7 @@ "layer" : 0, "lock_to_aspect" : 1, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], + "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2740,7 +2740,7 @@ "layer" : 2, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], + "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2763,7 +2763,7 @@ "layer" : 3, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], + "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2817,7 +2817,7 @@ "layer" : 0, "lock_to_aspect" : 1, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], + "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, "point_size" : 10, "grid_size" : 3, @@ -2840,7 +2840,7 @@ "layer" : 2, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], + "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, @@ -2863,7 +2863,7 @@ "layer" : 3, "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], - "ui_grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], + "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], "show_ui" : 0, "point_size" : 10, "grid_size" : 3, diff --git a/javascript/Mesh.js b/javascript/Mesh.js index fa6de53..e7506ea 100644 --- a/javascript/Mesh.js +++ b/javascript/Mesh.js @@ -211,7 +211,7 @@ function Mesh(ID) { this.meshGrid.draw_mode = "quad_grid"; this.meshGrid.depth_enable = 0; this.meshGrid.layer = MIDDLE; - this.meshGrid.color = ui_grid_color; + this.meshGrid.color = grid_color; this.meshGrid.poly_mode = [1, 1]; this.meshGrid.line_width = grid_size; this.meshGrid.drawto = drawto_; diff --git a/javascript/Mesh_save_load.js b/javascript/Mesh_save_load.js index e154b0a..d1325b9 100644 --- a/javascript/Mesh_save_load.js +++ b/javascript/Mesh_save_load.js @@ -19,7 +19,7 @@ Mesh.prototype.loadDict = function(saveDict_) { setScaleRelativeToAspect(lock_to_aspect); //setBlendEnable(blend_enable); gMesh.setColor(color); - gMesh.setUIGridColor(ui_grid_color); + gMesh.setUIGridColor(grid_color); showUI(show_ui); setPointSize(point_size); setGridSize(grid_size); diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index 6a3eb51..5ae4118 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -81,8 +81,8 @@ function setColor() { setColor.local = 1; function setUIGridColor() { - ui_grid_color = arrayfromargs(arguments); - gMesh.setUIGridColor(ui_grid_color); + grid_color = arrayfromargs(arguments); + gMesh.setUIGridColor(grid_color); } setUIGridColor.local = 1; @@ -121,7 +121,7 @@ function buildSaveDict() { saveDict.replace("lock_to_aspect", lock_to_aspect); //saveDict.replace("blend_enable", blend_enable); saveDict.replace("color", color); - saveDict.replace("ui_grid_color", ui_grid_color); + saveDict.replace("grid_color", grid_color); saveDict.replace("show_ui", show_ui); saveDict.replace("point_size", point_size); saveDict.replace("grid_size", grid_size); @@ -154,7 +154,7 @@ function loadFromDict(saveDict) { lock_to_aspect = saveDict.get("lock_to_aspect"); //blend_enable = saveDict.get("blend_enable"); color = saveDict.get("color"); - ui_grid_color = saveDict.get("ui_grid_color"); + grid_color = saveDict.get("grid_color"); show_ui = saveDict.get("show_ui"); point_size = saveDict.get("point_size"); grid_size = saveDict.get("grid_size"); diff --git a/javascript/meshwarp.js b/javascript/meshwarp.js index 7738ca9..9b5f6a1 100644 --- a/javascript/meshwarp.js +++ b/javascript/meshwarp.js @@ -54,8 +54,8 @@ declareattribute("lock_to_aspect", null, "setScaleRelativeToAspect", 0); var color = WHITE; declareattribute("color", null, "setColor", 0); -var ui_grid_color = randomColor(); -declareattribute("ui_grid_color", null, "setUIGridColor", 0); +var grid_color = randomColor(); +declareattribute("grid_color", null, "setUIGridColor", 0); declareattribute("selection_color", null, "setSingleCircleColor", 0); declareattribute("multiple_selection_color", null, "setMultipleCirclesColor", 0); diff --git a/patchers/jit.gl.meshwarp.maxpat b/patchers/jit.gl.meshwarp.maxpat index 54215a8..db0429c 100644 --- a/patchers/jit.gl.meshwarp.maxpat +++ b/patchers/jit.gl.meshwarp.maxpat @@ -665,7 +665,7 @@ } , { "box" : { - "attr" : "ui_grid_color", + "attr" : "grid_color", "displaymode" : 6, "id" : "obj-33", "maxclass" : "attrui", From 5e36eb8102bc6042b73a0ca68a469503ed64eef6 Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Fri, 13 Aug 2021 15:57:34 -0400 Subject: [PATCH 11/18] rename help s/r fix snapshot enable proper ? menu help support code comments ref updates --- docs/jit.gl.meshwarp.maxref.xml | 6 +- help/jit.gl.meshwarp.maxhelp | 541 +++++++++++++++++++------------- javascript/GetContext.js | 6 +- 3 files changed, 333 insertions(+), 220 deletions(-) diff --git a/docs/jit.gl.meshwarp.maxref.xml b/docs/jit.gl.meshwarp.maxref.xml index 2fa3dab..93433a9 100644 --- a/docs/jit.gl.meshwarp.maxref.xml +++ b/docs/jit.gl.meshwarp.maxref.xml @@ -8,7 +8,7 @@ - The jit.gl.meshwarp allows to deform visual material projected on a two-dimensional mesh. + The jit.gl.meshwarp object deforms visual material projected on a two-dimensional mesh. It can be used for video-mapping or other creative applications. @@ -73,7 +73,7 @@ Redo latest undone UI changes. - Redo latest undone UI changes. Can be also called by pressing "ctrl/cmd + y" on the keyboard. + Redo latest undone UI changes. Can be also called by pressing "ctrl + y/cmd + shift + z" on the keyboard. @@ -120,6 +120,8 @@ A quick way to set both the X and y NURBS order, which determines the curvature of the underlying canvas mesh (range 0. to 1.) + Sets both dims of nurbs_order, based on the current mesh_dim. The attribute is float type, however + output is clamped to int values and therefore may look choppy when adjusting. diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index b38c27a..6ea0f61 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 92.0, 170.0, 964.0, 573.0 ], + "rect" : [ 34.0, 79.0, 882.0, 581.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -42,6 +42,23 @@ "helpsidebarclosed" : 1, "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 128.0, 288.0, 172.0, 22.0 ], + "saved_object_attributes" : { + "filename" : "helpstarter.js", + "parameter_enable" : 0 + } +, + "text" : "js helpstarter.js jit.gl.meshwarp" + } + + } +, { "box" : { "id" : "obj-4", "maxclass" : "newobj", @@ -58,7 +75,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 882.0, 555.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -94,7 +111,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 538.0, 121.0, 202.0, 34.0 ], + "patching_rect" : [ 538.0, 121.0, 202.0, 33.0 ], "text" : "use layer to control the drawing order when shapes are unselected" } @@ -252,7 +269,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 21.5, 27.0, 417.0, 34.0 ], + "patching_rect" : [ 21.5, 27.0, 417.0, 33.0 ], "text" : "You can use multiple \"jit.gl.meshwarp\" objects at the same time.\nTo select one click on the shape in the rendering window using the mouse. " } @@ -394,7 +411,7 @@ ] } , - "patching_rect" : [ 421.0, 56.0, 133.0, 22.0 ], + "patching_rect" : [ 371.0, 85.0, 133.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -423,7 +440,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 882.0, 555.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -459,7 +476,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 21.5, 27.0, 609.0, 34.0 ], + "patching_rect" : [ 21.5, 27.0, 609.0, 33.0 ], "text" : "Save all the parameters of a jit.gl.meshwarp on a JSON file using the \"save\" message.\nLoad the JSON file in the jit.gl.meshwarp object with the \"read\" message to bring the object back the saved state." } @@ -540,8 +557,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 54.642860054969788, 244.119050145149231, 110.0, 22.0 ], - "text" : "s to_meshwarp_01" + "patching_rect" : [ 54.642860054969788, 244.119050145149231, 90.0, 22.0 ], + "text" : "s to_meshwarp" } } @@ -600,7 +617,7 @@ ] } , - "patching_rect" : [ 294.0, 56.0, 102.0, 22.0 ], + "patching_rect" : [ 244.0, 85.0, 102.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -629,7 +646,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 34.0, 105.0, 882.0, 555.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -659,6 +676,52 @@ "showontab" : 1, "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-15", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 713.0, 344.619035601615906, 150.0, 33.0 ], + "presentation_linecount" : 2, + "text" : "when scaling, preserve original aspect ratio" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 280.0, 301.0, 150.0, 20.0 ], + "text" : "mesh structure attributes " + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 657.0, 88.0, 67.0, 20.0 ], + "text" : "mesh color" + } + + } +, { + "box" : { + "id" : "obj-10", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 198.0, 56.0, 150.0, 20.0 ], + "text" : "mesh transform attributes " + } + + } +, { "box" : { "format" : 6, "id" : "obj-11", @@ -669,7 +732,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 484.666666666666515, 256.119035601615906, 50.0, 22.0 ] + "patching_rect" : [ 496.666666666666515, 350.119035601615906, 50.0, 22.0 ] } } @@ -680,7 +743,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 484.666666666666515, 295.619042873382568, 75.0, 22.0 ], + "patching_rect" : [ 496.666666666666515, 389.619042873382568, 75.0, 22.0 ], "text" : "curvature $1" } @@ -694,7 +757,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 408.666666666666742, 256.119035601615906, 50.0, 22.0 ] + "patching_rect" : [ 420.666666666666742, 350.119035601615906, 50.0, 22.0 ] } } @@ -707,7 +770,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 355.166666666666742, 256.119035601615906, 50.0, 22.0 ] + "patching_rect" : [ 367.166666666666742, 350.119035601615906, 50.0, 22.0 ] } } @@ -718,7 +781,7 @@ "numinlets" : 3, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 301.666666666666742, 295.619042873382568, 126.0, 22.0 ], + "patching_rect" : [ 313.666666666666742, 389.619042873382568, 126.0, 22.0 ], "text" : "pak nurbs_order 1 1" } @@ -731,7 +794,7 @@ "numoutlets" : 1, "outlettype" : [ "int" ], "parameter_enable" : 0, - "patching_rect" : [ 601.5, 255.119035601615906, 24.0, 24.0 ] + "patching_rect" : [ 678.5, 349.119035601615906, 24.0, 24.0 ] } } @@ -742,32 +805,10 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 601.5, 295.619042873382568, 105.0, 22.0 ], + "patching_rect" : [ 678.5, 389.619042873382568, 105.0, 22.0 ], "text" : "lock_to_aspect $1" } - } -, { - "box" : { - "id" : "obj-32", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 219.666666666666515, 236.499992728233337, 69.0, 20.0 ], - "text" : "vertical dim" - } - - } -, { - "box" : { - "id" : "obj-31", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 133.166666666666515, 236.523813247680664, 83.0, 20.0 ], - "text" : "horizontal dim" - } - } , { "box" : { @@ -778,7 +819,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 225.666666666666515, 259.619042873382568, 50.0, 22.0 ] + "patching_rect" : [ 237.666666666666515, 353.619042873382568, 50.0, 22.0 ] } } @@ -791,7 +832,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 149.666666666666515, 259.619042873382568, 50.0, 22.0 ] + "patching_rect" : [ 161.666666666666515, 353.619042873382568, 50.0, 22.0 ] } } @@ -802,7 +843,7 @@ "numinlets" : 3, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 73.666666666666515, 295.619042873382568, 171.0, 22.0 ], + "patching_rect" : [ 85.666666666666515, 389.619042873382568, 171.0, 22.0 ], "text" : "pak meshdim 4 4" } @@ -816,7 +857,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 411.666666666666686, 103.85714316368103, 50.0, 22.0 ] + "patching_rect" : [ 423.666666666666686, 154.85714316368103, 50.0, 22.0 ] } } @@ -827,7 +868,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 411.666666666666686, 146.119050145149231, 62.0, 22.0 ], + "patching_rect" : [ 423.666666666666686, 197.119050145149231, 62.0, 22.0 ], "text" : "rotatez $1" } @@ -841,7 +882,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 80.541666666666515, 62.119050145149231, 50.0, 22.0 ] + "patching_rect" : [ 92.541666666666515, 113.119050145149231, 50.0, 22.0 ] } } @@ -853,7 +894,7 @@ "numoutlets" : 2, "outlettype" : [ "", "float" ], "parameter_enable" : 0, - "patching_rect" : [ 548.30952672163653, 103.119050145149231, 128.0, 32.0 ], + "patching_rect" : [ 560.30952672163653, 154.119050145149231, 128.0, 32.0 ], "saturation" : 1.0 } @@ -865,7 +906,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 548.30952672163653, 146.119050145149231, 82.0, 22.0 ], + "patching_rect" : [ 560.30952672163653, 197.119050145149231, 82.0, 22.0 ], "text" : "prepend color" } @@ -877,7 +918,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 762.142860054969788, 118.500007271766663, 55.0, 24.0 ], + "patching_rect" : [ 774.142860054969788, 169.500007271766663, 55.0, 24.0 ], "text" : "alpha" } @@ -893,7 +934,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 710.142860054969788, 118.500007271766663, 50.0, 22.0 ] + "patching_rect" : [ 722.142860054969788, 169.500007271766663, 50.0, 22.0 ] } } @@ -904,7 +945,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 710.142860054969788, 146.119050145149231, 81.0, 22.0 ], + "patching_rect" : [ 722.142860054969788, 197.119050145149231, 81.0, 22.0 ], "text" : "color 1 1 1 $1" } @@ -918,7 +959,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 324.666666666666686, 103.85714316368103, 50.0, 22.0 ] + "patching_rect" : [ 336.666666666666686, 154.85714316368103, 50.0, 22.0 ] } } @@ -931,7 +972,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 261.166666666666686, 103.85714316368103, 50.0, 22.0 ] + "patching_rect" : [ 273.166666666666686, 154.85714316368103, 50.0, 22.0 ] } } @@ -942,7 +983,7 @@ "numinlets" : 3, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 197.666666666666686, 146.119050145149231, 146.0, 22.0 ], + "patching_rect" : [ 209.666666666666686, 197.119050145149231, 146.0, 22.0 ], "text" : "pak position f f" } @@ -956,7 +997,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 134.166666666666515, 112.119050145149231, 50.0, 22.0 ] + "patching_rect" : [ 146.166666666666515, 163.119050145149231, 50.0, 22.0 ] } } @@ -969,7 +1010,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 80.541666666666515, 112.119050145149231, 50.0, 22.0 ] + "patching_rect" : [ 92.541666666666515, 163.119050145149231, 50.0, 22.0 ] } } @@ -980,7 +1021,7 @@ "numinlets" : 3, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 27.916666666666515, 146.119050145149231, 124.25, 22.0 ], + "patching_rect" : [ 39.916666666666515, 197.119050145149231, 124.25, 22.0 ], "text" : "pak scale 1. 1." } @@ -991,8 +1032,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 27.916666666666515, 396.119050145149231, 110.0, 22.0 ], - "text" : "s to_meshwarp_01" + "patching_rect" : [ 39.916666666666515, 463.119050145149231, 90.0, 22.0 ], + "text" : "s to_meshwarp" } } @@ -1014,7 +1055,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 421.166666666666686, 193.0, 37.416666666666515, 193.0 ], + "midpoints" : [ 433.166666666666686, 244.0, 49.416666666666515, 244.0 ], "source" : [ "obj-14", 0 ] } @@ -1022,7 +1063,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 37.416666666666515, 171.0, 37.416666666666515, 171.0 ], + "midpoints" : [ 49.416666666666515, 222.0, 49.416666666666515, 222.0 ], "source" : [ "obj-17", 0 ] } @@ -1037,7 +1078,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 311.166666666666742, 367.8690465092659, 37.416666666666515, 367.8690465092659 ], + "midpoints" : [ 323.166666666666742, 434.8690465092659, 49.416666666666515, 434.8690465092659 ], "source" : [ "obj-2", 0 ] } @@ -1066,7 +1107,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 207.166666666666686, 193.0, 37.416666666666515, 193.0 ], + "midpoints" : [ 219.166666666666686, 244.0, 49.416666666666515, 244.0 ], "source" : [ "obj-29", 0 ] } @@ -1081,7 +1122,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 719.642860054969788, 192.0, 37.416666666666515, 192.0 ], + "midpoints" : [ 731.642860054969788, 243.0, 49.416666666666515, 243.0 ], "source" : [ "obj-45", 0 ] } @@ -1103,7 +1144,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 83.166666666666515, 367.8690465092659, 37.416666666666515, 367.8690465092659 ], + "midpoints" : [ 95.166666666666515, 434.8690465092659, 49.416666666666515, 434.8690465092659 ], "source" : [ "obj-5", 0 ] } @@ -1125,7 +1166,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 557.80952672163653, 192.0, 37.416666666666515, 192.0 ], + "midpoints" : [ 569.80952672163653, 243.0, 49.416666666666515, 243.0 ], "source" : [ "obj-55", 0 ] } @@ -1147,7 +1188,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 611.0, 367.8690465092659, 37.416666666666515, 367.8690465092659 ], + "midpoints" : [ 688.0, 434.8690465092659, 49.416666666666515, 434.8690465092659 ], "source" : [ "obj-64", 0 ] } @@ -1171,7 +1212,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 494.166666666666515, 367.8690465092659, 37.416666666666515, 367.8690465092659 ], + "midpoints" : [ 506.166666666666515, 434.8690465092659, 49.416666666666515, 434.8690465092659 ], "source" : [ "obj-9", 0 ] } @@ -1198,7 +1239,7 @@ ] } , - "patching_rect" : [ 186.0, 56.0, 48.0, 22.0 ], + "patching_rect" : [ 136.0, 85.0, 48.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -1227,7 +1268,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 882.0, 555.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1261,6 +1302,7 @@ "format" : 6, "id" : "obj-21", "maxclass" : "flonum", + "maximum" : 2.0, "minimum" : 0.0, "numinlets" : 1, "numoutlets" : 2, @@ -1416,7 +1458,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 43.666666666666515, 32.190485954284668, 557.0, 75.0 ], + "patching_rect" : [ 43.666666666666515, 32.190485954284668, 557.0, 74.0 ], "text" : "- Blue Circle: move the mesh.\n- Yellow Circles: scale the mesh.\n- Move individual vertices with mouse when Red Circle appears.\n- Click and Drag: select multiple vertices. \nAfter selecting the vertices you can move them all in bulk by clicking and dragging on a selected vertex." } @@ -1428,7 +1470,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 615.857139945030212, 296.0, 199.0, 34.0 ], + "patching_rect" : [ 615.857139945030212, 296.0, 199.0, 33.0 ], "text" : "Use this abstraction to move single vertices by index." } @@ -1441,7 +1483,7 @@ "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 488.5, 307.119050145149231, 122.0, 22.0 ], - "text" : "r from_meshwarp_01" + "text" : "r from_meshwarp" } } @@ -1544,8 +1586,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 43.666666666666515, 455.119050145149231, 110.0, 22.0 ], - "text" : "s to_meshwarp_01" + "patching_rect" : [ 43.666666666666515, 455.119050145149231, 90.0, 22.0 ], + "text" : "s to_meshwarp" } } @@ -1722,7 +1764,7 @@ ] } , - "patching_rect" : [ 121.0, 56.0, 40.0, 22.0 ], + "patching_rect" : [ 71.0, 85.0, 40.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -1736,7 +1778,7 @@ } , { "box" : { - "id" : "obj-51", + "id" : "obj-10", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 0, @@ -1751,14 +1793,14 @@ } , "classnamespace" : "box", - "rect" : [ 92.0, 196.0, 964.0, 547.0 ], + "rect" : [ 0.0, 26.0, 882.0, 555.0 ], "bglocked" : 0, "openinpresentation" : 0, - "default_fontsize" : 12.0, + "default_fontsize" : 13.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], + "gridsize" : [ 5.0, 5.0 ], "gridsnaponopen" : 1, "objectsnaponopen" : 1, "statusbarvisible" : 2, @@ -1777,17 +1819,30 @@ "digest" : "", "tags" : "", "style" : "", - "subpatcher_template" : "", + "subpatcher_template" : "Template_Grid", "showontab" : 1, "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-4", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 389.642860054969788, 436.547614336013794, 146.0, 50.0 ], + "presentation_linecount" : 3, + "text" : "Open abstraction (double-click) to view current attribute state" + } + + } +, { "box" : { "id" : "obj-14", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 569.238093376159668, 201.619042873382568, 169.0, 62.0 ], + "patching_rect" : [ 569.238093376159668, 219.619042873382568, 182.0, 65.0 ], "text" : "Also undo via cmd+z or ctl+z and redo via shift+cmd+z or ctl+y when interacting in the render window" } @@ -1799,8 +1854,23 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "int" ], - "parameter_enable" : 0, - "patching_rect" : [ 314.666666666666742, 143.619042873382568, 24.0, 24.0 ] + "parameter_enable" : 1, + "patching_rect" : [ 219.666666666666742, 368.0, 24.0, 24.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_enum" : [ "off", "on" ], + "parameter_initial" : [ 1 ], + "parameter_initial_enable" : 1, + "parameter_invisible" : 2, + "parameter_longname" : "toggle[1]", + "parameter_mmax" : 1, + "parameter_shortname" : "toggle[1]", + "parameter_type" : 2 + } + + } +, + "varname" : "toggle[1]" } } @@ -1811,7 +1881,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 314.666666666666742, 169.619042873382568, 61.0, 22.0 ], + "patching_rect" : [ 219.666666666666742, 394.0, 66.0, 23.0 ], "text" : "enable $1" } @@ -1821,10 +1891,11 @@ "bubble" : 1, "bubbleside" : 3, "id" : "obj-6", + "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 760.0, 271.738093018531799, 120.0, 24.0 ], + "patching_rect" : [ 800.0, 268.619042873382568, 81.0, 40.0 ], "text" : "Snapshot support" } @@ -1835,8 +1906,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 51.642860054969788, 497.095228672027588, 124.0, 22.0 ], - "text" : "s from_meshwarp_01" + "patching_rect" : [ 51.642860054969788, 497.095228672027588, 112.0, 23.0 ], + "text" : "s from_meshwarp" } } @@ -1847,8 +1918,8 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 556.238093376159668, 169.619042873382568, 174.0, 24.0 ], - "text" : "Undo / redo mesh GUI edits" + "patching_rect" : [ 567.238093376159668, 168.619042873382568, 200.0, 25.0 ], + "text" : "Undo / redo mesh GUI actions" } } @@ -1859,7 +1930,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.238093376159668, 169.619042873382568, 33.0, 22.0 ], + "patching_rect" : [ 526.238093376159668, 169.619042873382568, 35.0, 23.0 ], "text" : "redo" } @@ -1871,45 +1942,20 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 484.238093376159668, 169.619042873382568, 35.0, 22.0 ], + "patching_rect" : [ 484.238093376159668, 169.619042873382568, 37.0, 23.0 ], "text" : "undo" } } , { "box" : { - "id" : "obj-12", - "linecount" : 2, - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 21.0, 69.0, 516.0, 34.0 ], - "text" : "The jit.gl.meshwarp allows to deform visual material projected on a two-dimensional mesh.\nIt can be used either for video-mapping or as a creative tool." - } - - } -, { - "box" : { - "fontface" : 1, - "fontsize" : 32.0, - "id" : "obj-7", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 21.0, 19.0, 241.0, 43.0 ], - "text" : "jit.gl.meshwarp" - } - - } -, { - "box" : { - "id" : "obj-4", + "id" : "obj-8", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 90.642860054969788, 394.0, 108.0, 22.0 ], - "text" : "r to_meshwarp_01" + "patching_rect" : [ 90.642860054969788, 394.0, 94.0, 23.0 ], + "text" : "r to_meshwarp" } } @@ -1919,8 +1965,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 414.142860054969788, 268.619042873382568, 110.0, 22.0 ], - "text" : "s to_meshwarp_01" + "patching_rect" : [ 414.142860054969788, 268.619042873382568, 97.0, 23.0 ], + "text" : "s to_meshwarp" } } @@ -1931,7 +1977,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "jit_gl_texture", "" ], - "patching_rect" : [ 51.642860054969788, 346.619042873382568, 335.0, 22.0 ], + "patching_rect" : [ 51.642860054969788, 330.619042873382568, 362.0, 23.0 ], "text" : "jit.movie @output_texture 1 @vol 0 @moviefile chickens.mp4" } @@ -1946,25 +1992,25 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 115.142860054969788, 222.738093018531799, 80.0, 36.0 ] + "patching_rect" : [ 115.142860054969788, 222.738093018531799, 80.0, 35.0 ] } } , { "box" : { - "id" : "obj-8", + "id" : "obj-9", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 414.142860054969788, 169.619042873382568, 35.0, 22.0 ], + "patching_rect" : [ 414.142860054969788, 169.619042873382568, 37.0, 23.0 ], "text" : "reset" } } , { "box" : { - "id" : "obj-9", + "id" : "obj-11", "maxclass" : "toggle", "numinlets" : 1, "numoutlets" : 1, @@ -1992,12 +2038,12 @@ "rect" : [ 952, 53, 1592, 533 ] } , - "id" : "obj-2", + "id" : "obj-15", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 3, "outlettype" : [ "jit_matrix", "bang", "" ], - "patching_rect" : [ 43.642860054969788, 191.738093018531799, 162.0, 22.0 ], + "patching_rect" : [ 43.642860054969788, 191.738093018531799, 162.0, 23.0 ], "text" : "jit.world @fsaa 1" } @@ -2009,11 +2055,27 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 51.642860054969788, 450.047614336013794, 300.0, 22.0 ], + "patching_rect" : [ 51.642860054969788, 450.047614336013794, 325.0, 23.0 ], "text" : "jit.gl.meshwarp @show_ui 1 @meshdim 10 4 @layer 0", "varname" : "jit.gl.meshwarp" } + } +, { + "box" : { + "border" : 0, + "filename" : "helpdetails.js", + "id" : "obj-2", + "ignoreclick" : 1, + "jsarguments" : [ "jit.gl.meshwarp" ], + "maxclass" : "jsui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "parameter_enable" : 0, + "patching_rect" : [ 10.0, 10.0, 546.238093376159668, 118.0 ] + } + } , { "box" : { @@ -2050,11 +2112,18 @@ "source" : [ "obj-10", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-15", 0 ], + "source" : [ "obj-11", 0 ] + } + } , { "patchline" : { "destination" : [ "obj-16", 0 ], - "source" : [ "obj-2", 1 ] + "source" : [ "obj-15", 1 ] } } @@ -2069,7 +2138,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 530.738093376159668, 229.619042873382568, 423.642860054969788, 229.619042873382568 ], + "midpoints" : [ 535.738093376159668, 229.619042873382568, 423.642860054969788, 229.619042873382568 ], "source" : [ "obj-27", 0 ] } @@ -2077,14 +2146,7 @@ , { "patchline" : { "destination" : [ "obj-1", 0 ], - "source" : [ "obj-4", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-3", 0 ], - "midpoints" : [ 324.166666666666742, 233.619042873382568, 423.642860054969788, 233.619042873382568 ], + "midpoints" : [ 229.166666666666742, 437.619042873382568, 61.142860054969788, 437.619042873382568 ], "source" : [ "obj-60", 0 ] } @@ -2098,15 +2160,15 @@ } , { "patchline" : { - "destination" : [ "obj-3", 0 ], - "midpoints" : [ 423.642860054969788, 253.0, 423.642860054969788, 253.0 ], + "destination" : [ "obj-1", 0 ], "source" : [ "obj-8", 0 ] } } , { "patchline" : { - "destination" : [ "obj-2", 0 ], + "destination" : [ "obj-3", 0 ], + "midpoints" : [ 423.642860054969788, 253.0, 423.642860054969788, 253.0 ], "source" : [ "obj-9", 0 ] } @@ -2133,26 +2195,107 @@ ] } , - "patching_rect" : [ 43.0, 56.0, 47.0, 22.0 ], + "patching_rect" : [ 10.0, 85.0, 50.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", + "fontsize" : 13.0, "globalpatchername" : "", "tags" : "" } , "text" : "p basic", - "varname" : "basic" + "varname" : "basic_tab" + } + + } +, { + "box" : { + "border" : 0, + "filename" : "helpname.js", + "id" : "obj-12", + "ignoreclick" : 1, + "jsarguments" : [ "jit.gl.meshwarp" ], + "maxclass" : "jsui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "parameter_enable" : 0, + "patching_rect" : [ 10.0, 10.0, 322.232025146484375, 57.599853515625 ] + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 0, + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 2, + "revision" : 0, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 0.0, 26.0, 882.0, 555.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "Template_Grid", + "showontab" : 1, + "assistshowspatchername" : 0, + "boxes" : [ ], + "lines" : [ ] + } +, + "patching_rect" : [ 514.0, 86.0, 50.0, 22.0 ], + "saved_object_attributes" : { + "description" : "", + "digest" : "", + "globalpatchername" : "", + "tags" : "" + } +, + "text" : "p ?", + "varname" : "q_tab" } } ], "lines" : [ ], "parameters" : { - "obj-4::obj-41::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[1]", 0 ], - "obj-4::obj-43::obj-8" : [ "meshwarpjs[3]", "meshwarpjs[3]", 0 ], - "obj-51::obj-1::obj-8" : [ "meshwarpjs", "meshwarpjs", 0 ], - "obj-51::obj-9" : [ "toggle", "toggle", 0 ], + "obj-10::obj-11" : [ "toggle", "toggle", 0 ], + "obj-10::obj-1::obj-8" : [ "meshwarpjs", "meshwarpjs", 0 ], + "obj-10::obj-62" : [ "toggle[1]", "toggle[1]", 0 ], + "obj-4::obj-41::obj-8" : [ "meshwarpjs[1]", "meshwarpjs[1]", 0 ], + "obj-4::obj-43::obj-8" : [ "meshwarpjs[2]", "meshwarpjs[3]", 0 ], "parameterbanks" : { } @@ -2163,45 +2306,63 @@ "dependency_cache" : [ { "name" : "jit.gl.meshwarp.maxhelp.maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", + "patcherrelativepath" : "../../../../Documents/Max 8/Snapshots", "type" : "mx@s", "implicit" : 1 } , { - "name" : "Aspect[1]_20210728.maxsnap", + "name" : "Aspect[1].maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", + "patcherrelativepath" : "../../../../Documents/Max 8/Snapshots", "type" : "mx@s", "implicit" : 1 } , { - "name" : "Zigzag[1].maxsnap", + "name" : "Aspect[1]_20210728_1.maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", + "patcherrelativepath" : "../../../../Documents/Max 8/Snapshots", "type" : "mx@s", "implicit" : 1 } , { - "name" : "jit.gl.meshwarp.maxhelp[2].maxsnap", - "bootpath" : "~/Documents/Max 8/Snapshots", - "type" : "mx@s", + "name" : "helpname.js", + "bootpath" : "C74:/help/resources", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "helpdetails.js", + "bootpath" : "C74:/help/resources", + "type" : "TEXT", "implicit" : 1 } , { "name" : "jit.gl.meshwarp.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/meshwarp/patchers", + "bootpath" : "~/dev/cycling/meshwarp/patchers", + "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { "name" : "meshwarp.js", - "bootpath" : "~/Documents/Max 8/Packages/meshwarp/javascript", + "bootpath" : "~/dev/cycling/meshwarp/javascript", + "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "meshwarp.vertex.edit.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/meshwarp/patchers", + "bootpath" : "~/dev/cycling/meshwarp/patchers", + "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } +, { + "name" : "helpstarter.js", + "bootpath" : "C74:/help/resources", + "type" : "TEXT", + "implicit" : 1 + } ], "autosave" : 0, "snapshot" : { @@ -2219,10 +2380,10 @@ "toggle" : 1.0, "blob" : { "meshwarpjs" : [ { - "meshdim" : [ 10, 4 ], - "nurbs_order" : [ 9, 3 ], + "meshdim" : [ 5, 4 ], + "nurbs_order" : [ 1, 1 ], "layer" : 0, - "lock_to_aspect" : 0, + "lock_to_aspect" : 1, "color" : [ 1, 1, 1, 1 ], "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, @@ -2235,8 +2396,8 @@ "rotatez" : 0, "planecount" : 3, "type" : "float32", - "dimensions" : [ 10, 4 ], - "vertices" : "[[-1.244444489479065,-0.699999988079071,0],[-1.244444489479065,-0.23333333432674408,0],[-1.244444489479065,0.23333333432674408,0],[-1.244444489479065,0.699999988079071,0],[-0.9701646566390991,-0.6425103545188904,0],[-0.9701646566390991,-0.17584361135959625,0],[-0.9701646566390991,0.2908230423927307,0],[-0.9701646566390991,0.7574896216392517,0],[-0.6953189969062805,-0.5993930697441101,0],[-0.6953189969062805,-0.13272632658481598,0],[-0.6953189969062805,0.3339403569698334,0],[-0.6953189969062805,0.800606906414032,0],[-0.4199073910713196,-0.570648193359375,0],[-0.4199073910713196,-0.10398146510124207,0],[-0.4199073910713196,0.3626852333545685,0],[-0.4199073910713196,0.8293517231941223,0],[-0.14393000304698944,-0.5562757253646851,0],[-0.14393000304698944,-0.08960902690887451,0],[-0.14393000304698944,0.37705764174461365,0],[-0.14393000304698944,0.8437241911888123,0],[0.13261322677135468,-0.5562757253646851,0],[0.13261322677135468,-0.08960902690887451,0],[0.13261322677135468,0.37705764174461365,0],[0.13261322677135468,0.8437241911888123,0],[0.40972229838371277,-0.570648193359375,0],[0.40972229838371277,-0.10398146510124207,0],[0.40972229838371277,0.3626852333545685,0],[0.40972229838371277,0.8293517231941223,0],[0.6873971819877625,-0.5993930697441101,0],[0.6873971819877625,-0.13272632658481598,0],[0.6873971819877625,0.3339403569698334,0],[0.6873971819877625,0.800606906414032,0],[0.9656379222869873,-0.6425103545188904,0],[0.9656379222869873,-0.17584361135959625,0],[0.9656379222869873,0.2908230423927307,0],[0.9656379222869873,0.7574896216392517,0],[1.244444489479065,-0.699999988079071,0],[1.244444489479065,-0.23333333432674408,0],[1.244444489479065,0.23333333432674408,0],[1.244444489479065,0.699999988079071,0]]" + "dimensions" : [ 5, 4 ], + "vertices" : "[[-1.244444489479065,-0.699999988079071,0],[-1.244444489479065,-0.23333333432674408,0],[-1.244444489479065,0.23333333432674408,0],[-1.244444489479065,0.699999988079071,0],[-0.6222222447395325,-0.699999988079071,0],[-0.6222222447395325,-0.23333333432674408,0],[-0.6222222447395325,0.23333333432674408,0],[-0.6222222447395325,0.699999988079071,0],[0,-0.699999988079071,0],[0,-0.23333333432674408,0],[0,0.23333333432674408,0],[0,0.699999988079071,0],[0.6222222447395325,-0.699999988079071,0],[0.6222222447395325,-0.23333333432674408,0],[0.6222222447395325,0.23333333432674408,0],[0.6222222447395325,0.699999988079071,0],[1.244444489479065,-0.699999988079071,0],[1.244444489479065,-0.23333333432674408,0],[1.244444489479065,0.23333333432674408,0],[1.244444489479065,0.699999988079071,0]]" } } @@ -2296,7 +2457,7 @@ } , "snapshotlist" : { - "current_snapshot" : 1, + "current_snapshot" : 0, "entries" : [ { "filetype" : "C74Snapshot", "version" : 2, @@ -2896,24 +3057,6 @@ "snapshotfileid" : "bf78636150be0ed0ab4db74ac8f937c4" } - } -, { - "filetype" : "C74Snapshot", - "version" : 2, - "minorversion" : 0, - "name" : "jit.gl.meshwarp.maxhelp[2]", - "origin" : "jit.gl.meshwarp.maxhelp", - "type" : "patcher", - "subtype" : "Undefined", - "embed" : 0, - "fileref" : { - "name" : "jit.gl.meshwarp.maxhelp[2]", - "filename" : "jit.gl.meshwarp.maxhelp[2].maxsnap", - "filepath" : "~/Documents/Max 8/Snapshots", - "filepos" : -1, - "snapshotfileid" : "4082200465cf287508e1e68d1bb2e6d2" - } - } , { "filetype" : "C74Snapshot", @@ -2932,42 +3075,6 @@ "snapshotfileid" : "0e9c7d4d0916d1bebe103ade4eaffa6d" } - } -, { - "filetype" : "C74Snapshot", - "version" : 2, - "minorversion" : 0, - "name" : "Zigzag", - "origin" : "jit.gl.meshwarp.maxhelp", - "type" : "patcher", - "subtype" : "Undefined", - "embed" : 0, - "fileref" : { - "name" : "Zigzag", - "filename" : "Aspect[1]_20210728.maxsnap", - "filepath" : "~/Documents/Max 8/Snapshots", - "filepos" : -1, - "snapshotfileid" : "702c95b617335e4d15f13ce0bbcfdf15" - } - - } -, { - "filetype" : "C74Snapshot", - "version" : 2, - "minorversion" : 0, - "name" : "Squares", - "origin" : "jit.gl.meshwarp.maxhelp", - "type" : "patcher", - "subtype" : "Undefined", - "embed" : 0, - "fileref" : { - "name" : "Squares", - "filename" : "Zigzag[1].maxsnap", - "filepath" : "~/Documents/Max 8/Snapshots", - "filepos" : -1, - "snapshotfileid" : "594b9a14dc7b2604ba9a24d306a1d169" - } - } ] } diff --git a/javascript/GetContext.js b/javascript/GetContext.js index 5ed0aa6..78b35a5 100644 --- a/javascript/GetContext.js +++ b/javascript/GetContext.js @@ -33,8 +33,12 @@ function dosetdrawto(newdrawto) { gGlobal.proxy.name = newdrawto; //postln("drawto class " + proxy.class); if(gGlobal.proxy.class !== undefined) { - if(gGlobal.proxy.class != "jit_gl_context_view") { // what class is that? + // drawto may be root render or sub-node + // if root the class will return jit_gl_context_view + if(gGlobal.proxy.class != "jit_gl_context_view") { + // class is a sub-node, get the drawto on that proxydrawto = gGlobal.proxy.send("getdrawto"); + // recurse until we get root // important! drawto is an array so get first element return dosetdrawto(proxydrawto[0]); } From 071b5e4fa975d8b34b348076ca4d92191fbe1881 Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Fri, 13 Aug 2021 17:47:47 -0400 Subject: [PATCH 12/18] attempt at fixing UI with multiple contexts, still not quite working --- javascript/Global_Obj.js | 44 ++++++++++++++++++++------------ javascript/GraphicElements.js | 8 +++--- javascript/Mesh_mouse_routine.js | 7 +++++ javascript/Mesh_movement.js | 6 +++-- javascript/Mesh_save_load.js | 2 +- javascript/Meshwarp_Utilities.js | 2 +- 6 files changed, 44 insertions(+), 25 deletions(-) diff --git a/javascript/Global_Obj.js b/javascript/Global_Obj.js index 4e38e46..07b493e 100644 --- a/javascript/Global_Obj.js +++ b/javascript/Global_Obj.js @@ -4,7 +4,6 @@ gGlobal = new Global("gMeshwarp"); if(gGlobal.inited === undefined) { gGlobal.mouseIsOnMesh = {}; gGlobal.inited = true; - gGlobal.currentlySelected = -1; gGlobal.latestAction = GUI_ELEMENTS.NOTHING; gGlobal.contexts = {}; gGlobal.meshCount = 0; @@ -13,14 +12,18 @@ if(gGlobal.inited === undefined) { } } -function notify_selected_meshwarp(currentlySelected) { - if (nodeCTX.name != currentlySelected) { +function notify_selected_meshwarp(currentlySelected, selectedContext) { + if (drawto == selectedContext && nodeCTX.name != currentlySelected) { deselectThisFromGlobal(); } } +function ctxInGlobal() { + return (gGlobal.contexts[drawto] !== undefined && gGlobal.contexts[drawto] !== null); +} + gGlobal.checkIfItIsGloballySelected = function(nodeName) { - return (gGlobal.currentlySelected == nodeName); + return (ctxInGlobal() && gGlobal.contexts[drawto].currentlySelected == nodeName); } gGlobal.getMaxLayer = function() { @@ -34,14 +37,16 @@ gGlobal.getMaxLayer = function() { } function assignThisAsCurrentlySelectedToGlobal() { - gGlobal.currentlySelected = nodeCTX.name; + if(ctxInGlobal()) { + gGlobal.contexts[drawto].currentlySelected = nodeCTX.name; assignLatestActionToGlobal(GUI_ELEMENTS.NOTHING); gMesh.setMeshAsSelected(true); var maxLayer = gGlobal.getMaxLayer(); setVideoplaneLayer(maxLayer+1); gGraphics.setLayer(maxLayer+2); - outlet(0, "notify_selected_meshwarp",nodeCTX.name); + outlet(0, "notify_selected_meshwarp", nodeCTX.name, drawto); + } } assignThisAsCurrentlySelectedToGlobal.local = 1; @@ -86,28 +91,35 @@ function addToGlobalCtxMap() { debug(DEBUG.GENERAL, "addToGlobalCtxMap : " + drawto + ", " + nodeCTX.name); // check if context in map, if not create it var ctxOb = null; - if(gGlobal.contexts.drawto === undefined || gGlobal.contexts.drawto == null) { + if(gGlobal.contexts[drawto] === undefined || gGlobal.contexts[drawto] == null) { debug(DEBUG.GENERAL, "create global context " + drawto); - gGlobal.contexts.drawto = {}; - ctxOb = gGlobal.contexts.drawto; + gGlobal.contexts[drawto] = {}; + ctxOb = gGlobal.contexts[drawto]; ctxOb.objects = []; ctxOb.requestInit = true; + ctxOb.currentlySelected = -1; // ctxOb.physWorldName = drawto + "_physworld"; } else { - ctxOb = gGlobal.contexts.drawto; + ctxOb = gGlobal.contexts[drawto]; // gMesh.setPhysWorldNameToMeshBody(ctxOb.physWorldName); } ctxOb.objects.push(nodeCTX.name); setToGlobalIfMouseIsOnMesh(false); assignThisAsCurrentlySelectedToGlobal(); + + // print("addToGlobalCtxMap") + // for (var c in gGlobal.contexts) { + // print (c); + // print(gGlobal.contexts[c]); + // } } // called by notifyDeleted function removeFromGlobalCtxMap() { debug(DEBUG.GENERAL, "removeFromGlobalCtxMap : " + drawto + ", " + nodeCTX.name); - if(drawto !== "" && gGlobal.contexts.drawto !== undefined) { - var obs = gGlobal.contexts.drawto.objects; + if(drawto !== "" && gGlobal.contexts[drawto] !== undefined) { + var obs = gGlobal.contexts[drawto].objects; var index = obs.indexOf(nodeCTX.name); if (index != -1) { obs.splice(index, 1); @@ -116,18 +128,18 @@ function removeFromGlobalCtxMap() { debug(DEBUG.GENERAL, "Objects Length : "+obs.length) if (obs.length == 0) { debug(DEBUG.GENERAL, "freed global objects"); - gGlobal.contexts.drawto.ctxNode.freepeer(); + gGlobal.contexts[drawto].ctxNode.freepeer(); // gGlobal.contexts.drawto.physDraw.freepeer(); // gGlobal.contexts.drawto.physWorld.freepeer(); - gGlobal.contexts.drawto.ctxCamera.freepeer(); + gGlobal.contexts[drawto].ctxCamera.freepeer(); gGlobal.inited = null; - gGlobal.contexts.drawto = null; + gGlobal.contexts[drawto] = null; } } removeFromGlobalCtxMap.local = 1; if(gGlobal.checkIfItIsGloballySelected(nodeCTX.name)) { - gGlobal.currentlySelected = -1; + gGlobal.contexts[drawto].currentlySelected = -1; gGlobal.mouseIsOnMesh[nodeCTX.name].isOnMesh = false; } diff --git a/javascript/GraphicElements.js b/javascript/GraphicElements.js index 20f0805..a134c56 100644 --- a/javascript/GraphicElements.js +++ b/javascript/GraphicElements.js @@ -30,11 +30,9 @@ function GraphicElements(nodectx) { } this.drawCircle = function(coordsWorld) { - if (gGlobal.checkIfItIsGloballySelected(nodeCTX.name)) { - this.sketch.reset(); - this.sketch.moveto(coordsWorld); - this.sketch.framecircle(this.circleRadius); - } + this.sketch.reset(); + this.sketch.moveto(coordsWorld); + this.sketch.framecircle(this.circleRadius); } this.highlightCircle = function(cellIndex) { diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index 93b3642..d703141 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -1,5 +1,6 @@ Mesh.prototype.mouseIdleRoutine = function(mouseWorld) { if (this.showMeshUI) { + print(" showMeshUI mouse idle " + drawto); this.latestAction = GUI_ELEMENTS.NOTHING; this.checkIfMouseIsCloseToMoveHandle(mouseWorld); this.setLatestMousePos(mouseWorld); @@ -20,6 +21,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { // var oldMouseClicked = oldMouseState_[2]; if (mouseClicked) { + print(" showMeshUI mouse clicked"); // gGraphics.drawID(this.getMeshCenter(this.positionMat)); //if (!oldMouseClicked && this.mouseIsCloseTo != GUI_ELEMENTS.NOTHING) { //this.saveUndoRedoPositionMat(); @@ -73,15 +75,19 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { // SELECT MESH GLOBALLY if (mouseClicked) { + if (this.checkIfMouseIsInsideMesh(mouseWorld) == this.ID) { + print("mouse clicked true") setToGlobalIfMouseIsOnMesh(true); } else { + print("mouse clicked false") setToGlobalIfMouseIsOnMesh(false); } } if (!mouseClicked && gGlobal.latestAction === GUI_ELEMENTS.NOTHING) { if (gGlobal.mouseIsOnMesh[nodeCTX.name].isOnMesh) { + print("mouse clicked mouseIsOnMesh") var foundLayers = []; for (var mesh in gGlobal.mouseIsOnMesh) { if (gGlobal.mouseIsOnMesh[mesh].isOnMesh) { @@ -96,6 +102,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { assignThisAsCurrentlySelectedToGlobal(); } } else if (gGlobal.latestAction === GUI_ELEMENTS.NOTHING) { + print("mouse clicked deselectThisFromGlobal") deselectThisFromGlobal(); setToGlobalIfMouseIsOnMesh(false); } diff --git a/javascript/Mesh_movement.js b/javascript/Mesh_movement.js index bce05f3..7b3c9f4 100644 --- a/javascript/Mesh_movement.js +++ b/javascript/Mesh_movement.js @@ -41,7 +41,7 @@ Mesh.prototype.checkIfMouseIsCloseToVertex = function(mouseWorld) { currVertexPos = this.getPositionMatCell(coords); i = coords[0]; j = coords[1]; - + print("gGraphics.drawCircle(currVertexPos)"); gGraphics.drawCircle(currVertexPos); var cell = this.positionMat.getcell(i,j); this.mouseOffset = subVec2D(cell, mouseWorld); @@ -151,7 +151,9 @@ Mesh.prototype.moveVertex = function(coordsWorld, cellIndex) { this.setVertexPosInMat(coordsWorld, cellIndex); this.applyMeshTransformation(); this.latestAction = GUI_ELEMENTS.WAS_MOVED_SINGLE_VERTEX; - gGraphics.drawCircle(coordsWorld); + if (this.showMeshUI) { + gGraphics.drawCircle(coordsWorld); + } this.outputSelectedVertex(coordsWorld); } } diff --git a/javascript/Mesh_save_load.js b/javascript/Mesh_save_load.js index d1325b9..7da25da 100644 --- a/javascript/Mesh_save_load.js +++ b/javascript/Mesh_save_load.js @@ -25,7 +25,7 @@ Mesh.prototype.loadDict = function(saveDict_) { setGridSize(grid_size); this.updateGUI(); - assignThisAsCurrentlySelectedToGlobal() + //assignThisAsCurrentlySelectedToGlobal() this.saveUndoRedoPositionMat(); } diff --git a/javascript/Meshwarp_Utilities.js b/javascript/Meshwarp_Utilities.js index 18f04b1..a2d0e98 100644 --- a/javascript/Meshwarp_Utilities.js +++ b/javascript/Meshwarp_Utilities.js @@ -35,7 +35,7 @@ var DEBUG = { GENERAL: 3 } -var gWhatToDebug = DEBUG.NONE; +var gWhatToDebug = DEBUG.GENERAL; function debug(what, val) { if (gWhatToDebug === what) { From de0764108a739ed365c7efebedd3930aa09672a9 Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Mon, 16 Aug 2021 11:10:27 -0400 Subject: [PATCH 13/18] fix mouse UI with multiple contexts we move the gGlobal latestAction flag into individual gClobal context object. seems to be the last piece of the puzzle for per-context mouse UI logic. --- javascript/Global_Obj.js | 14 +++++++++----- javascript/Mesh_mouse_routine.js | 16 ++++++++-------- javascript/Mesh_movement.js | 1 - javascript/Meshwarp_Utilities.js | 2 +- javascript/Set_Attributes_Functions.js | 2 +- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/javascript/Global_Obj.js b/javascript/Global_Obj.js index 07b493e..5b5ce01 100644 --- a/javascript/Global_Obj.js +++ b/javascript/Global_Obj.js @@ -4,7 +4,6 @@ gGlobal = new Global("gMeshwarp"); if(gGlobal.inited === undefined) { gGlobal.mouseIsOnMesh = {}; gGlobal.inited = true; - gGlobal.latestAction = GUI_ELEMENTS.NOTHING; gGlobal.contexts = {}; gGlobal.meshCount = 0; if(max.version >= 820) { @@ -12,6 +11,13 @@ if(gGlobal.inited === undefined) { } } +function initGlobalContextOb(ctxOb) { + ctxOb.objects = []; + ctxOb.requestInit = true; + ctxOb.currentlySelected = -1; + ctxOb.latestAction = GUI_ELEMENTS.NOTHING; +} + function notify_selected_meshwarp(currentlySelected, selectedContext) { if (drawto == selectedContext && nodeCTX.name != currentlySelected) { deselectThisFromGlobal(); @@ -95,9 +101,7 @@ function addToGlobalCtxMap() { debug(DEBUG.GENERAL, "create global context " + drawto); gGlobal.contexts[drawto] = {}; ctxOb = gGlobal.contexts[drawto]; - ctxOb.objects = []; - ctxOb.requestInit = true; - ctxOb.currentlySelected = -1; + initGlobalContextOb(ctxOb); // ctxOb.physWorldName = drawto + "_physworld"; } else { @@ -147,7 +151,7 @@ function removeFromGlobalCtxMap() { } function assignLatestActionToGlobal(latestAction) { - gGlobal.latestAction = latestAction; + gGlobal.contexts[drawto].latestAction = latestAction; } assignLatestActionToGlobal.local = 1; diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index d703141..3ec01b0 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -1,6 +1,6 @@ Mesh.prototype.mouseIdleRoutine = function(mouseWorld) { if (this.showMeshUI) { - print(" showMeshUI mouse idle " + drawto); + //print(" showMeshUI mouse idle " + drawto); this.latestAction = GUI_ELEMENTS.NOTHING; this.checkIfMouseIsCloseToMoveHandle(mouseWorld); this.setLatestMousePos(mouseWorld); @@ -21,7 +21,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { // var oldMouseClicked = oldMouseState_[2]; if (mouseClicked) { - print(" showMeshUI mouse clicked"); + debug(DEBUG.GLOBAL_SELECTION + "showMeshUI mouse clicked"); // gGraphics.drawID(this.getMeshCenter(this.positionMat)); //if (!oldMouseClicked && this.mouseIsCloseTo != GUI_ELEMENTS.NOTHING) { //this.saveUndoRedoPositionMat(); @@ -77,17 +77,17 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { if (mouseClicked) { if (this.checkIfMouseIsInsideMesh(mouseWorld) == this.ID) { - print("mouse clicked true") + debug(DEBUG.GLOBAL_SELECTION + "mouse clicked true") setToGlobalIfMouseIsOnMesh(true); } else { - print("mouse clicked false") + debug(DEBUG.GLOBAL_SELECTION + "mouse clicked false") setToGlobalIfMouseIsOnMesh(false); } } - if (!mouseClicked && gGlobal.latestAction === GUI_ELEMENTS.NOTHING) { + if (!mouseClicked && gGlobal.contexts[drawto].latestAction === GUI_ELEMENTS.NOTHING) { if (gGlobal.mouseIsOnMesh[nodeCTX.name].isOnMesh) { - print("mouse clicked mouseIsOnMesh") + debug(DEBUG.GLOBAL_SELECTION + "mouse clicked mouseIsOnMesh") var foundLayers = []; for (var mesh in gGlobal.mouseIsOnMesh) { if (gGlobal.mouseIsOnMesh[mesh].isOnMesh) { @@ -101,8 +101,8 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { } else { assignThisAsCurrentlySelectedToGlobal(); } - } else if (gGlobal.latestAction === GUI_ELEMENTS.NOTHING) { - print("mouse clicked deselectThisFromGlobal") + } else if (gGlobal.contexts[drawto].latestAction === GUI_ELEMENTS.NOTHING) { + debug(DEBUG.GLOBAL_SELECTION + "mouse clicked deselectThisFromGlobal") deselectThisFromGlobal(); setToGlobalIfMouseIsOnMesh(false); } diff --git a/javascript/Mesh_movement.js b/javascript/Mesh_movement.js index 7b3c9f4..311e1fe 100644 --- a/javascript/Mesh_movement.js +++ b/javascript/Mesh_movement.js @@ -41,7 +41,6 @@ Mesh.prototype.checkIfMouseIsCloseToVertex = function(mouseWorld) { currVertexPos = this.getPositionMatCell(coords); i = coords[0]; j = coords[1]; - print("gGraphics.drawCircle(currVertexPos)"); gGraphics.drawCircle(currVertexPos); var cell = this.positionMat.getcell(i,j); this.mouseOffset = subVec2D(cell, mouseWorld); diff --git a/javascript/Meshwarp_Utilities.js b/javascript/Meshwarp_Utilities.js index a2d0e98..18f04b1 100644 --- a/javascript/Meshwarp_Utilities.js +++ b/javascript/Meshwarp_Utilities.js @@ -35,7 +35,7 @@ var DEBUG = { GENERAL: 3 } -var gWhatToDebug = DEBUG.GENERAL; +var gWhatToDebug = DEBUG.NONE; function debug(what, val) { if (gWhatToDebug === what) { diff --git a/javascript/Set_Attributes_Functions.js b/javascript/Set_Attributes_Functions.js index 5ae4118..c36fb50 100644 --- a/javascript/Set_Attributes_Functions.js +++ b/javascript/Set_Attributes_Functions.js @@ -63,7 +63,7 @@ function setEnable(val) { showUI(val); gMesh.setEnable(val); if(!enable) { - gGlobal.latestAction = GUI_ELEMENTS.NOTHING; + assignLatestActionToGlobal(GUI_ELEMENTS.NOTHING); setToGlobalIfMouseIsOnMesh(false); } } From 19df7e1ae3e3f1e27caf05ed782f57b36ece0898 Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Mon, 16 Aug 2021 15:35:56 -0400 Subject: [PATCH 14/18] fix mouse UI with multiple contexts also need to move mouseIsOnMesh logic into context object --- javascript/Global_Obj.js | 38 +++++++++++++++++--------------- javascript/Mesh_mouse_routine.js | 29 ++++++++++-------------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/javascript/Global_Obj.js b/javascript/Global_Obj.js index 5b5ce01..356d5ad 100644 --- a/javascript/Global_Obj.js +++ b/javascript/Global_Obj.js @@ -2,7 +2,6 @@ gGlobal = new Global("gMeshwarp"); if(gGlobal.inited === undefined) { - gGlobal.mouseIsOnMesh = {}; gGlobal.inited = true; gGlobal.contexts = {}; gGlobal.meshCount = 0; @@ -16,6 +15,9 @@ function initGlobalContextOb(ctxOb) { ctxOb.requestInit = true; ctxOb.currentlySelected = -1; ctxOb.latestAction = GUI_ELEMENTS.NOTHING; + ctxOb.mouseIsOnMesh = {}; + ctxOb.ctxNode = null; + ctxOb.ctxCamera = null; } function notify_selected_meshwarp(currentlySelected, selectedContext) { @@ -32,22 +34,19 @@ gGlobal.checkIfItIsGloballySelected = function(nodeName) { return (ctxInGlobal() && gGlobal.contexts[drawto].currentlySelected == nodeName); } -gGlobal.getMaxLayer = function() { - var maxLayer = -1000; - for (var meshwarp in gGlobal.mouseIsOnMesh) { - if (gGlobal.mouseIsOnMesh[meshwarp].layer > maxLayer) { - maxLayer = gGlobal.mouseIsOnMesh[meshwarp].layer; - } - } - return maxLayer; -} - function assignThisAsCurrentlySelectedToGlobal() { if(ctxInGlobal()) { gGlobal.contexts[drawto].currentlySelected = nodeCTX.name; assignLatestActionToGlobal(GUI_ELEMENTS.NOTHING); gMesh.setMeshAsSelected(true); - var maxLayer = gGlobal.getMaxLayer(); + + var maxLayer = -1000; + var ctxOb = gGlobal.contexts[drawto]; + for (var m in ctxOb.mouseIsOnMesh) { + if (ctxOb.mouseIsOnMesh[m].layer > maxLayer) { + maxLayer = ctxOb.mouseIsOnMesh[m].layer; + } + } setVideoplaneLayer(maxLayer+1); gGraphics.setLayer(maxLayer+2); @@ -122,6 +121,7 @@ function addToGlobalCtxMap() { // called by notifyDeleted function removeFromGlobalCtxMap() { debug(DEBUG.GENERAL, "removeFromGlobalCtxMap : " + drawto + ", " + nodeCTX.name); + var deleteCtxOb = false; if(drawto !== "" && gGlobal.contexts[drawto] !== undefined) { var obs = gGlobal.contexts[drawto].objects; var index = obs.indexOf(nodeCTX.name); @@ -133,20 +133,22 @@ function removeFromGlobalCtxMap() { if (obs.length == 0) { debug(DEBUG.GENERAL, "freed global objects"); gGlobal.contexts[drawto].ctxNode.freepeer(); - // gGlobal.contexts.drawto.physDraw.freepeer(); - // gGlobal.contexts.drawto.physWorld.freepeer(); gGlobal.contexts[drawto].ctxCamera.freepeer(); - gGlobal.inited = null; - gGlobal.contexts[drawto] = null; + deleteCtxOb = true; } } removeFromGlobalCtxMap.local = 1; if(gGlobal.checkIfItIsGloballySelected(nodeCTX.name)) { gGlobal.contexts[drawto].currentlySelected = -1; - gGlobal.mouseIsOnMesh[nodeCTX.name].isOnMesh = false; + gGlobal.contexts[drawto].mouseIsOnMesh[nodeCTX.name].isOnMesh = false; } + if(deleteCtxOb) { + debug(DEBUG.GENERAL, "delete Context Ob : " + drawto); + delete gGlobal.contexts[drawto]; + } + gGlobal.meshCount--; } @@ -156,7 +158,7 @@ function assignLatestActionToGlobal(latestAction) { assignLatestActionToGlobal.local = 1; function setToGlobalIfMouseIsOnMesh(val) { - gGlobal.mouseIsOnMesh[nodeCTX.name] = {isOnMesh: val, layer: videoplane.layer}; + gGlobal.contexts[drawto].mouseIsOnMesh[nodeCTX.name] = {isOnMesh: val, layer: videoplane.layer}; } diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index 3ec01b0..c879e56 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -16,16 +16,12 @@ Mesh.prototype.mouseIdleRoutine = function(mouseWorld) { Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { var mouseWorld = gGraphics.transformMouseToWorld(gMousePosScreen); var mouseClicked = mouseState[2]; + var ctxOb = gGlobal.contexts[drawto]; if (this.showMeshUI) { - // var oldMouseClicked = oldMouseState_[2]; if (mouseClicked) { - debug(DEBUG.GLOBAL_SELECTION + "showMeshUI mouse clicked"); - // gGraphics.drawID(this.getMeshCenter(this.positionMat)); - //if (!oldMouseClicked && this.mouseIsCloseTo != GUI_ELEMENTS.NOTHING) { - //this.saveUndoRedoPositionMat(); - //} + debug(DEBUG.GLOBAL_SELECTION, "showMeshUI mouse clicked"); switch (this.mouseIsCloseTo) { case (GUI_ELEMENTS.MOVE_HANDLE): this.moveMeshWithHandle(mouseWorld); @@ -75,23 +71,22 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { // SELECT MESH GLOBALLY if (mouseClicked) { - if (this.checkIfMouseIsInsideMesh(mouseWorld) == this.ID) { - debug(DEBUG.GLOBAL_SELECTION + "mouse clicked true") + debug(DEBUG.GLOBAL_SELECTION, "mouse clicked true") setToGlobalIfMouseIsOnMesh(true); } else { - debug(DEBUG.GLOBAL_SELECTION + "mouse clicked false") + debug(DEBUG.GLOBAL_SELECTION, "mouse clicked false") setToGlobalIfMouseIsOnMesh(false); } } - if (!mouseClicked && gGlobal.contexts[drawto].latestAction === GUI_ELEMENTS.NOTHING) { - if (gGlobal.mouseIsOnMesh[nodeCTX.name].isOnMesh) { - debug(DEBUG.GLOBAL_SELECTION + "mouse clicked mouseIsOnMesh") + if (!mouseClicked && ctxOb.latestAction === GUI_ELEMENTS.NOTHING) { + if (ctxOb.mouseIsOnMesh[nodeCTX.name].isOnMesh) { + debug(DEBUG.GLOBAL_SELECTION, "mouse clicked mouseIsOnMesh") var foundLayers = []; - for (var mesh in gGlobal.mouseIsOnMesh) { - if (gGlobal.mouseIsOnMesh[mesh].isOnMesh) { - foundLayers.push(gGlobal.mouseIsOnMesh[mesh].layer) + for (var mesh in ctxOb.mouseIsOnMesh) { + if (ctxOb.mouseIsOnMesh[mesh].isOnMesh) { + foundLayers.push(ctxOb.mouseIsOnMesh[mesh].layer) } } if (foundLayers.length > 1) { @@ -101,8 +96,8 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { } else { assignThisAsCurrentlySelectedToGlobal(); } - } else if (gGlobal.contexts[drawto].latestAction === GUI_ELEMENTS.NOTHING) { - debug(DEBUG.GLOBAL_SELECTION + "mouse clicked deselectThisFromGlobal") + } else if (ctxOb.latestAction === GUI_ELEMENTS.NOTHING) { + debug(DEBUG.GLOBAL_SELECTION, "mouse clicked deselectThisFromGlobal") deselectThisFromGlobal(); setToGlobalIfMouseIsOnMesh(false); } From 5fedb947b911b94d05ae649415d9156caa9fd99f Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Mon, 16 Aug 2021 16:06:04 -0400 Subject: [PATCH 15/18] a little extra logic to keep multi-vertex selection post move --- javascript/Mesh_mouse_routine.js | 10 ++++++++-- javascript/Mesh_movement.js | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/javascript/Mesh_mouse_routine.js b/javascript/Mesh_mouse_routine.js index c879e56..437c574 100644 --- a/javascript/Mesh_mouse_routine.js +++ b/javascript/Mesh_mouse_routine.js @@ -31,7 +31,13 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { break; case (GUI_ELEMENTS.VERTEX): if (this.selectedVerticesIndices.length > 1) { - this.moveSelectedVertices(mouseWorld); + if(this.isCurVertexInSelected()) { + this.moveSelectedVertices(mouseWorld); + } + else { + this.deselectVertices(); + this.moveVertexWithMouse(mouseWorld); + } } else { this.moveVertexWithMouse(mouseWorld); gGraphics.resetSelected(); @@ -54,7 +60,7 @@ Mesh.prototype.mouseClickedRoutine = function(mouseState, oldMouseState_) { this.setLatestScale_calcBoundsMat(); } else if (this.latestAction == GUI_ELEMENTS.WAS_MOVED_VERTICES) { - this.deselectVertices(); + //this.deselectVertices(); } else if (this.latestAction == GUI_ELEMENTS.WAS_MOVED_MESH) { this.storeLatestMeshPos(); diff --git a/javascript/Mesh_movement.js b/javascript/Mesh_movement.js index 311e1fe..c068ab5 100644 --- a/javascript/Mesh_movement.js +++ b/javascript/Mesh_movement.js @@ -329,3 +329,14 @@ Mesh.prototype.outputSelectedVertex = function(vertexPos) { outlet(0, "selected_vertex", this.selectedVertexIndex[0], (this.positionMat.dim[1]-1)-this.selectedVertexIndex[1], vertexPos[0], vertexPos[1]); } +Mesh.prototype.isCurVertexInSelected = function() { + for(var i = 0; i < this.selectedVerticesIndices.length; i++) { + if( + (this.selectedVertexIndex[0] == this.selectedVerticesIndices[i][0]) && + (this.selectedVertexIndex[1] == this.selectedVerticesIndices[i][1]) + ) { + return true; + } + } + return false; +} \ No newline at end of file From b78aac94c2903a0385835ee0918de4baca0f77f2 Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Mon, 16 Aug 2021 16:15:56 -0400 Subject: [PATCH 16/18] typo --- docs/jit.gl.meshwarp.maxref.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jit.gl.meshwarp.maxref.xml b/docs/jit.gl.meshwarp.maxref.xml index 93433a9..ac74ae0 100644 --- a/docs/jit.gl.meshwarp.maxref.xml +++ b/docs/jit.gl.meshwarp.maxref.xml @@ -38,7 +38,7 @@ - The name drawing context in which to draw (default = none). A named drawing context + The named drawing context in which to draw (default = none). A named drawing context is a named instance of a jit.world, jit.pworld or jit.gl.node object. If no argument is provided the object will find a context implicitly. From 6cd30bb8a576812be2c43f919c39394c4998cd94 Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Mon, 16 Aug 2021 16:50:30 -0400 Subject: [PATCH 17/18] bugfix by checking if gGlobal context is valid prior to accessing --- javascript/Global_Obj.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/javascript/Global_Obj.js b/javascript/Global_Obj.js index 356d5ad..a329b34 100644 --- a/javascript/Global_Obj.js +++ b/javascript/Global_Obj.js @@ -136,12 +136,11 @@ function removeFromGlobalCtxMap() { gGlobal.contexts[drawto].ctxCamera.freepeer(); deleteCtxOb = true; } - } - removeFromGlobalCtxMap.local = 1; - if(gGlobal.checkIfItIsGloballySelected(nodeCTX.name)) { - gGlobal.contexts[drawto].currentlySelected = -1; - gGlobal.contexts[drawto].mouseIsOnMesh[nodeCTX.name].isOnMesh = false; + if(gGlobal.checkIfItIsGloballySelected(nodeCTX.name)) { + gGlobal.contexts[drawto].currentlySelected = -1; + gGlobal.contexts[drawto].mouseIsOnMesh[nodeCTX.name].isOnMesh = false; + } } if(deleteCtxOb) { @@ -151,14 +150,19 @@ function removeFromGlobalCtxMap() { gGlobal.meshCount--; } +removeFromGlobalCtxMap.local = 1; function assignLatestActionToGlobal(latestAction) { - gGlobal.contexts[drawto].latestAction = latestAction; + if(ctxInGlobal()) { + gGlobal.contexts[drawto].latestAction = latestAction; + } } assignLatestActionToGlobal.local = 1; function setToGlobalIfMouseIsOnMesh(val) { - gGlobal.contexts[drawto].mouseIsOnMesh[nodeCTX.name] = {isOnMesh: val, layer: videoplane.layer}; + if(ctxInGlobal()) { + gGlobal.contexts[drawto].mouseIsOnMesh[nodeCTX.name] = {isOnMesh: val, layer: videoplane.layer}; + } } From 00644523f0b0808043900cf261cb70ab56f28ff8 Mon Sep 17 00:00:00 2001 From: Robert Ramirez Date: Mon, 16 Aug 2021 16:51:25 -0400 Subject: [PATCH 18/18] few more helpfile tweaks as requested in the binge doc --- help/jit.gl.meshwarp.maxhelp | 381 +++++++++++++++++++---------------- 1 file changed, 211 insertions(+), 170 deletions(-) diff --git a/help/jit.gl.meshwarp.maxhelp b/help/jit.gl.meshwarp.maxhelp index 6ea0f61..4672bee 100644 --- a/help/jit.gl.meshwarp.maxhelp +++ b/help/jit.gl.meshwarp.maxhelp @@ -105,13 +105,37 @@ "showontab" : 1, "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 518.642860054969788, 241.119050145149231, 96.0, 22.0 ], + "text" : "r to_meshwarpB" + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 69.642860054969788, 241.119050145149231, 96.0, 22.0 ], + "text" : "r to_meshwarpA" + } + + } +, { "box" : { "id" : "obj-13", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 538.0, 121.0, 202.0, 33.0 ], + "patching_rect" : [ 553.0, 121.0, 202.0, 33.0 ], "text" : "use layer to control the drawing order when shapes are unselected" } @@ -124,7 +148,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 454.5, 121.0, 50.0, 22.0 ] + "patching_rect" : [ 469.5, 121.0, 50.0, 22.0 ] } } @@ -135,7 +159,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 454.5, 145.0, 51.0, 22.0 ], + "patching_rect" : [ 469.5, 145.0, 51.0, 22.0 ], "text" : "layer $1" } @@ -148,7 +172,7 @@ "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 250.0, 121.0, 50.0, 22.0 ] + "patching_rect" : [ 265.0, 121.0, 50.0, 22.0 ] } } @@ -159,7 +183,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 250.0, 145.0, 51.0, 22.0 ], + "patching_rect" : [ 265.0, 145.0, 51.0, 22.0 ], "text" : "layer $1" } @@ -171,7 +195,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 185.0, 145.0, 35.0, 22.0 ], + "patching_rect" : [ 200.0, 145.0, 35.0, 22.0 ], "text" : "reset" } @@ -183,7 +207,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 114.5, 145.0, 61.0, 22.0 ], + "patching_rect" : [ 129.5, 145.0, 61.0, 22.0 ], "text" : "enable $1" } @@ -196,7 +220,7 @@ "numoutlets" : 1, "outlettype" : [ "int" ], "parameter_enable" : 0, - "patching_rect" : [ 21.5, 95.0, 24.0, 24.0 ] + "patching_rect" : [ 36.5, 95.0, 24.0, 24.0 ] } } @@ -207,7 +231,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 21.5, 145.0, 77.0, 22.0 ], + "patching_rect" : [ 36.5, 145.0, 77.0, 22.0 ], "text" : "automatic $1" } @@ -219,7 +243,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 454.5, 226.666657209396362, 355.0, 22.0 ], + "patching_rect" : [ 469.5, 285.666657209396362, 355.0, 22.0 ], "text" : "jit.gl.meshwarp @show_ui 1 @meshdim 5 4 @layer 3 @enable 0", "varname" : "jit.gl.meshwarp[2]" } @@ -232,7 +256,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 21.5, 226.666657209396362, 355.0, 22.0 ], + "patching_rect" : [ 36.5, 285.666657209396362, 355.0, 22.0 ], "text" : "jit.gl.meshwarp @show_ui 1 @meshdim 5 4 @layer 2 @enable 0", "varname" : "jit.gl.meshwarp[1]" } @@ -245,7 +269,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "jit_gl_texture", "" ], - "patching_rect" : [ 454.5, 193.619042873382568, 391.0, 22.0 ], + "patching_rect" : [ 469.5, 193.619042873382568, 391.0, 22.0 ], "text" : "jit.movie @output_texture 1 @vol 0 @moviefile bball.mov @automatic 0" } @@ -257,7 +281,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "jit_gl_texture", "" ], - "patching_rect" : [ 21.5, 193.619042873382568, 417.0, 22.0 ], + "patching_rect" : [ 36.5, 193.619042873382568, 417.0, 22.0 ], "text" : "jit.movie @output_texture 1 @vol 0 @moviefile sunflower.mp4 @automatic 0" } @@ -269,7 +293,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 21.5, 27.0, 417.0, 33.0 ], + "patching_rect" : [ 36.5, 27.0, 417.0, 33.0 ], "text" : "You can use multiple \"jit.gl.meshwarp\" objects at the same time.\nTo select one click on the shape in the rendering window using the mouse. " } @@ -278,15 +302,29 @@ "lines" : [ { "patchline" : { "destination" : [ "obj-43", 0 ], - "midpoints" : [ 464.0, 180.0, 445.0, 180.0, 445.0, 219.0, 464.0, 219.0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-43", 0 ], + "midpoints" : [ 479.0, 180.0, 460.0, 180.0, 460.0, 219.0, 479.0, 219.0 ], "source" : [ "obj-10", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-41", 0 ], + "source" : [ "obj-14", 0 ] + } + } , { "patchline" : { "destination" : [ "obj-22", 0 ], - "midpoints" : [ 31.0, 170.0, 31.0, 170.0 ], + "midpoints" : [ 46.0, 170.0, 46.0, 170.0 ], "order" : 1, "source" : [ "obj-2", 0 ] } @@ -295,7 +333,7 @@ , { "patchline" : { "destination" : [ "obj-38", 0 ], - "midpoints" : [ 31.0, 179.0, 464.0, 179.0 ], + "midpoints" : [ 46.0, 179.0, 479.0, 179.0 ], "order" : 0, "source" : [ "obj-2", 0 ] } @@ -311,7 +349,7 @@ , { "patchline" : { "destination" : [ "obj-41", 0 ], - "midpoints" : [ 194.5, 180.0, 6.0, 180.0, 6.0, 222.0, 31.0, 222.0 ], + "midpoints" : [ 209.5, 180.0, 21.0, 180.0, 21.0, 222.0, 46.0, 222.0 ], "order" : 1, "source" : [ "obj-3", 0 ] } @@ -320,7 +358,7 @@ , { "patchline" : { "destination" : [ "obj-43", 0 ], - "midpoints" : [ 194.5, 180.0, 445.0, 180.0, 445.0, 219.0, 464.0, 219.0 ], + "midpoints" : [ 209.5, 180.0, 460.0, 180.0, 460.0, 219.0, 479.0, 219.0 ], "order" : 0, "source" : [ "obj-3", 0 ] } @@ -352,7 +390,7 @@ , { "patchline" : { "destination" : [ "obj-41", 0 ], - "midpoints" : [ 124.0, 179.0, 8.119046568870544, 179.0, 8.119046568870544, 221.0, 31.0, 221.0 ], + "midpoints" : [ 139.0, 179.0, 23.119046568870544, 179.0, 23.119046568870544, 221.0, 46.0, 221.0 ], "order" : 1, "source" : [ "obj-5", 0 ] } @@ -361,7 +399,7 @@ , { "patchline" : { "destination" : [ "obj-43", 0 ], - "midpoints" : [ 124.0, 179.0, 444.119046568870544, 179.0, 444.119046568870544, 221.0, 464.0, 221.0 ], + "midpoints" : [ 139.0, 179.0, 459.119046568870544, 179.0, 459.119046568870544, 221.0, 479.0, 221.0 ], "order" : 0, "source" : [ "obj-5", 0 ] } @@ -370,7 +408,7 @@ , { "patchline" : { "destination" : [ "obj-41", 0 ], - "midpoints" : [ 259.5, 180.0, 6.0, 180.0, 6.0, 222.0, 31.0, 222.0 ], + "midpoints" : [ 274.5, 180.0, 21.0, 180.0, 21.0, 222.0, 46.0, 222.0 ], "source" : [ "obj-6", 0 ] } @@ -411,7 +449,7 @@ ] } , - "patching_rect" : [ 371.0, 85.0, 133.0, 22.0 ], + "patching_rect" : [ 204.0, 84.0, 133.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -470,6 +508,104 @@ "showontab" : 1, "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "bubble" : 1, + "bubbleside" : 3, + "bubbleusescolors" : 1, + "id" : "obj-9", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 669.0, 301.619042873382568, 207.0, 64.0 ], + "presentation_linecount" : 3, + "text" : "An alternative approach is to use Snapshots to save and restore multiple meshwarp configurations for all the objects in your patch" + } + + } +, { + "box" : { + "id" : "obj-5", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 236.642860054969788, 310.119042873382568, 349.0, 47.0 ], + "text" : "Each json file describes a single jit.gl.meshwarp configuration. These messages referencing meshwarpA and meshwarpB are sent to the meshwarp objects in the \"multiple meshwarps\" tab" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 51.642860054969788, 371.619042873382568, 177.0, 22.0 ], + "text" : "write Desktop:/meshwarpB.json" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 236.642860054969788, 371.619042873382568, 175.0, 22.0 ], + "text" : "read Desktop:/meshwarpB.json" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 51.642860054969788, 426.119050145149231, 98.0, 22.0 ], + "text" : "s to_meshwarpB" + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 51.642860054969788, 265.619042873382568, 177.0, 22.0 ], + "text" : "write Desktop:/meshwarpA.json" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 236.642860054969788, 265.619042873382568, 175.0, 22.0 ], + "text" : "read Desktop:/meshwarpA.json" + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 51.642860054969788, 316.119050145149231, 98.0, 22.0 ], + "text" : "s to_meshwarpA" + } + + } +, { "box" : { "id" : "obj-12", "linecount" : 2, @@ -477,7 +613,7 @@ "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 21.5, 27.0, 609.0, 33.0 ], - "text" : "Save all the parameters of a jit.gl.meshwarp on a JSON file using the \"save\" message.\nLoad the JSON file in the jit.gl.meshwarp object with the \"read\" message to bring the object back the saved state." + "text" : "Save all the parameters of a jit.gl.meshwarp in a JSON file using the \"save\" message.\nLoad the JSON file in the jit.gl.meshwarp object with the \"read\" message to bring the object back the saved state." } } @@ -488,7 +624,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 468.0, 113.619042873382568, 33.0, 22.0 ], + "patching_rect" : [ 465.0, 122.619042873382568, 33.0, 22.0 ], "text" : "read" } @@ -500,7 +636,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 432.0, 113.619042873382568, 34.0, 22.0 ], + "patching_rect" : [ 429.0, 122.619042873382568, 34.0, 22.0 ], "text" : "write" } @@ -511,7 +647,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 270.0, 91.619042873382568, 112.0, 20.0 ], + "patching_rect" : [ 267.0, 100.619042873382568, 112.0, 20.0 ], "text" : "Read from Dekstop" } @@ -522,7 +658,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 73.0, 91.619042873382568, 95.0, 20.0 ], + "patching_rect" : [ 70.0, 100.619042873382568, 95.0, 20.0 ], "text" : "Write to dekstop" } @@ -534,7 +670,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 54.642860054969788, 113.619042873382568, 169.0, 22.0 ], + "patching_rect" : [ 51.642860054969788, 122.619042873382568, 169.0, 22.0 ], "text" : "write Desktop:/meshwarp.json" } @@ -546,7 +682,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 239.642860054969788, 113.619042873382568, 167.0, 22.0 ], + "patching_rect" : [ 236.642860054969788, 122.619042873382568, 167.0, 22.0 ], "text" : "read Desktop:/meshwarp.json" } @@ -557,24 +693,53 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 54.642860054969788, 244.119050145149231, 90.0, 22.0 ], + "patching_rect" : [ 51.642860054969788, 190.119050145149231, 90.0, 22.0 ], "text" : "s to_meshwarp" } } ], "lines" : [ { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "midpoints" : [ 246.142860054969788, 301.0, 61.142860054969788, 301.0 ], + "source" : [ "obj-13", 0 ] + } + + } +, { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 249.142860054969788, 231.0, 64.142860054969788, 231.0 ], + "midpoints" : [ 246.142860054969788, 177.0, 61.142860054969788, 177.0 ], "source" : [ "obj-15", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-20", 0 ], + "source" : [ "obj-18", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 0 ], + "midpoints" : [ 246.142860054969788, 411.0, 61.142860054969788, 411.0 ], + "source" : [ "obj-19", 0 ] + } + } , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 64.142860054969788, 138.0, 64.142860054969788, 138.0 ], "source" : [ "obj-6", 0 ] } @@ -582,7 +747,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 441.5, 231.0, 64.142860054969788, 231.0 ], + "midpoints" : [ 438.5, 177.0, 61.142860054969788, 177.0 ], "source" : [ "obj-7", 0 ] } @@ -590,7 +755,7 @@ , { "patchline" : { "destination" : [ "obj-3", 0 ], - "midpoints" : [ 477.5, 231.0, 64.142860054969788, 231.0 ], + "midpoints" : [ 474.5, 177.0, 61.142860054969788, 177.0 ], "source" : [ "obj-8", 0 ] } @@ -617,7 +782,7 @@ ] } , - "patching_rect" : [ 244.0, 85.0, 102.0, 22.0 ], + "patching_rect" : [ 359.0, 84.0, 102.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -646,7 +811,7 @@ } , "classnamespace" : "box", - "rect" : [ 34.0, 105.0, 882.0, 555.0 ], + "rect" : [ 0.0, 26.0, 882.0, 555.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -683,7 +848,6 @@ "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 713.0, 344.619035601615906, 150.0, 33.0 ], - "presentation_linecount" : 2, "text" : "when scaling, preserve original aspect ratio" } @@ -878,6 +1042,7 @@ "format" : 6, "id" : "obj-7", "maxclass" : "flonum", + "minimum" : 0.0, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], @@ -993,6 +1158,7 @@ "format" : 6, "id" : "obj-26", "maxclass" : "flonum", + "minimum" : 0.0, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], @@ -1006,6 +1172,7 @@ "format" : 6, "id" : "obj-19", "maxclass" : "flonum", + "minimum" : 0.0, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], @@ -1793,7 +1960,7 @@ } , "classnamespace" : "box", - "rect" : [ 0.0, 26.0, 882.0, 555.0 ], + "rect" : [ 34.0, 105.0, 882.0, 555.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 13.0, @@ -1830,7 +1997,6 @@ "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 389.642860054969788, 436.547614336013794, 146.0, 50.0 ], - "presentation_linecount" : 3, "text" : "Open abstraction (double-click) to view current attribute state" } @@ -1895,7 +2061,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 800.0, 268.619042873382568, 81.0, 40.0 ], + "patching_rect" : [ 800.0, 268.619042873382568, 84.0, 40.0 ], "text" : "Snapshot support" } @@ -2304,13 +2470,6 @@ } , "dependency_cache" : [ { - "name" : "jit.gl.meshwarp.maxhelp.maxsnap", - "bootpath" : "~/Documents/Max 8/Snapshots", - "patcherrelativepath" : "../../../../Documents/Max 8/Snapshots", - "type" : "mx@s", - "implicit" : 1 - } -, { "name" : "Aspect[1].maxsnap", "bootpath" : "~/Documents/Max 8/Snapshots", "patcherrelativepath" : "../../../../Documents/Max 8/Snapshots", @@ -2380,10 +2539,10 @@ "toggle" : 1.0, "blob" : { "meshwarpjs" : [ { - "meshdim" : [ 5, 4 ], + "meshdim" : [ 10, 4 ], "nurbs_order" : [ 1, 1 ], "layer" : 0, - "lock_to_aspect" : 1, + "lock_to_aspect" : 0, "color" : [ 1, 1, 1, 1 ], "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], "show_ui" : 1, @@ -2396,8 +2555,8 @@ "rotatez" : 0, "planecount" : 3, "type" : "float32", - "dimensions" : [ 5, 4 ], - "vertices" : "[[-1.244444489479065,-0.699999988079071,0],[-1.244444489479065,-0.23333333432674408,0],[-1.244444489479065,0.23333333432674408,0],[-1.244444489479065,0.699999988079071,0],[-0.6222222447395325,-0.699999988079071,0],[-0.6222222447395325,-0.23333333432674408,0],[-0.6222222447395325,0.23333333432674408,0],[-0.6222222447395325,0.699999988079071,0],[0,-0.699999988079071,0],[0,-0.23333333432674408,0],[0,0.23333333432674408,0],[0,0.699999988079071,0],[0.6222222447395325,-0.699999988079071,0],[0.6222222447395325,-0.23333333432674408,0],[0.6222222447395325,0.23333333432674408,0],[0.6222222447395325,0.699999988079071,0],[1.244444489479065,-0.699999988079071,0],[1.244444489479065,-0.23333333432674408,0],[1.244444489479065,0.23333333432674408,0],[1.244444489479065,0.699999988079071,0]]" + "dimensions" : [ 10, 4 ], + "vertices" : "[[-1.244444489479065,-0.699999988079071,0],[-1.244444489479065,-0.23333333432674408,0],[-1.244444489479065,0.23333333432674408,0],[-1.244444489479065,0.699999988079071,0],[-0.9701646566390991,-0.6425103545188904,0],[-0.9701646566390991,-0.17584361135959625,0],[-0.9701646566390991,0.2908230423927307,0],[-0.9701646566390991,0.7574896216392517,0],[-0.6953189969062805,-0.5993930697441101,0],[-0.6953189969062805,-0.13272632658481598,0],[-0.6953189969062805,0.3339403569698334,0],[-0.6953189969062805,0.800606906414032,0],[-0.4199073910713196,-0.570648193359375,0],[-0.4199073910713196,-0.10398146510124207,0],[-0.4199073910713196,0.3626852333545685,0],[-0.4199073910713196,0.8293517231941223,0],[-0.14393000304698944,-0.5562757253646851,0],[-0.14393000304698944,-0.08960902690887451,0],[-0.14393000304698944,0.37705764174461365,0],[-0.14393000304698944,0.8437241911888123,0],[0.13261322677135468,-0.5562757253646851,0],[0.13261322677135468,-0.08960902690887451,0],[0.13261322677135468,0.37705764174461365,0],[0.13261322677135468,0.8437241911888123,0],[0.40972229838371277,-0.570648193359375,0],[0.40972229838371277,-0.10398146510124207,0],[0.40972229838371277,0.3626852333545685,0],[0.40972229838371277,0.8293517231941223,0],[0.6873971819877625,-0.5993930697441101,0],[0.6873971819877625,-0.13272632658481598,0],[0.6873971819877625,0.3339403569698334,0],[0.6873971819877625,0.800606906414032,0],[0.9656379222869873,-0.6425103545188904,0],[0.9656379222869873,-0.17584361135959625,0],[0.9656379222869873,0.2908230423927307,0],[0.9656379222869873,0.7574896216392517,0],[1.244444489479065,-0.699999988079071,0],[1.244444489479065,-0.23333333432674408,0],[1.244444489479065,0.23333333432674408,0],[1.244444489479065,0.699999988079071,0]]" } } @@ -2459,106 +2618,6 @@ "snapshotlist" : { "current_snapshot" : 0, "entries" : [ { - "filetype" : "C74Snapshot", - "version" : 2, - "minorversion" : 0, - "name" : "jit.gl.meshwarp.maxhelp", - "origin" : "jit.gl.meshwarp.maxhelp", - "type" : "patcher", - "subtype" : "Undefined", - "embed" : 1, - "snapshot" : { - "valuedictionary" : { - "parameter_values" : { - "toggle" : 1.0, - "blob" : { - "meshwarpjs" : [ { - "meshdim" : [ 5, 4 ], - "nurbs_order" : [ 1, 1 ], - "layer" : 0, - "lock_to_aspect" : 1, - "color" : [ 1, 1, 1, 1 ], - "grid_color" : [ 0.761174128706606, 0.551500914033326, 0.239160861127834, 1 ], - "show_ui" : 1, - "point_size" : 10, - "grid_size" : 3, - "windowRatio" : 1.333333333333333, - "positionMat" : { - "scale" : [ 1.244444444444445, 0.7 ], - "center" : [ 0, 0 ], - "rotatez" : 0, - "planecount" : 3, - "type" : "float32", - "dimensions" : [ 5, 4 ], - "vertices" : "[[-1.244444489479065,-0.699999988079071,0],[-1.244444489479065,-0.23333333432674408,0],[-1.244444489479065,0.23333333432674408,0],[-1.244444489479065,0.699999988079071,0],[-0.6222222447395325,-0.699999988079071,0],[-0.6222222447395325,-0.23333333432674408,0],[-0.6222222447395325,0.23333333432674408,0],[-0.6222222447395325,0.699999988079071,0],[0,-0.699999988079071,0],[0,-0.23333333432674408,0],[0,0.23333333432674408,0],[0,0.699999988079071,0],[0.6222222447395325,-0.699999988079071,0],[0.6222222447395325,-0.23333333432674408,0],[0.6222222447395325,0.23333333432674408,0],[0.6222222447395325,0.699999988079071,0],[1.244444489479065,-0.699999988079071,0],[1.244444489479065,-0.23333333432674408,0],[1.244444489479065,0.23333333432674408,0],[1.244444489479065,0.699999988079071,0]]" - } - - } - ], - "meshwarpjs[1]" : [ { - "meshdim" : [ 5, 4 ], - "nurbs_order" : [ 1, 1 ], - "layer" : 2, - "lock_to_aspect" : 0, - "color" : [ 1, 1, 1, 1 ], - "grid_color" : [ 0.527467168596617, 0.572063340247159, 0.822540228100381, 1 ], - "show_ui" : 0, - "point_size" : 10, - "grid_size" : 3, - "windowRatio" : 1, - "positionMat" : { - "scale" : [ 1, 1 ], - "center" : [ 0, 0 ], - "rotatez" : 0, - "planecount" : 3, - "type" : "float32", - "dimensions" : [ 5, 4 ], - "vertices" : "[[-1,-1,0],[-1,-0.3333333432674408,0],[-1,0.3333333432674408,0],[-1,1,0],[-0.5,-1,0],[-0.5,-0.3333333432674408,0],[-0.5,0.3333333432674408,0],[-0.5,1,0],[0,-1,0],[0,-0.3333333432674408,0],[0,0.3333333432674408,0],[0,1,0],[0.5,-1,0],[0.5,-0.3333333432674408,0],[0.5,0.3333333432674408,0],[0.5,1,0],[1,-1,0],[1,-0.3333333432674408,0],[1,0.3333333432674408,0],[1,1,0]]" - } - - } - ], - "meshwarpjs[2]" : [ { - "meshdim" : [ 5, 4 ], - "nurbs_order" : [ 1, 1 ], - "layer" : 3, - "lock_to_aspect" : 0, - "color" : [ 1, 1, 1, 1 ], - "grid_color" : [ 0.610534554316207, 0.972926125300246, 0.967845341685442, 1 ], - "show_ui" : 0, - "point_size" : 10, - "grid_size" : 3, - "windowRatio" : 1, - "positionMat" : { - "scale" : [ 1, 1 ], - "center" : [ 0, 0 ], - "rotatez" : 0, - "planecount" : 3, - "type" : "float32", - "dimensions" : [ 5, 4 ], - "vertices" : "[[-1,-1,0],[-1,-0.3333333432674408,0],[-1,0.3333333432674408,0],[-1,1,0],[-0.5,-1,0],[-0.5,-0.3333333432674408,0],[-0.5,0.3333333432674408,0],[-0.5,1,0],[0,-1,0],[0,-0.3333333432674408,0],[0,0.3333333432674408,0],[0,1,0],[0.5,-1,0],[0.5,-0.3333333432674408,0],[0.5,0.3333333432674408,0],[0.5,1,0],[1,-1,0],[1,-0.3333333432674408,0],[1,0.3333333432674408,0],[1,1,0]]" - } - - } - ] - } - - } - - } - - } -, - "fileref" : { - "name" : "jit.gl.meshwarp.maxhelp", - "filename" : "jit.gl.meshwarp.maxhelp.maxsnap", - "filepath" : "~/Documents/Max 8/Snapshots", - "filepos" : -1, - "snapshotfileid" : "fc3a50681efa11820184747794183978" - } - - } -, { "filetype" : "C74Snapshot", "version" : 2, "minorversion" : 0, @@ -3057,24 +3116,6 @@ "snapshotfileid" : "bf78636150be0ed0ab4db74ac8f937c4" } - } -, { - "filetype" : "C74Snapshot", - "version" : 2, - "minorversion" : 0, - "name" : "jit.gl.meshwarp.maxhelp", - "origin" : "jit.gl.meshwarp.maxhelp", - "type" : "patcher", - "subtype" : "Undefined", - "embed" : 0, - "fileref" : { - "name" : "jit.gl.meshwarp.maxhelp", - "filename" : "jit.gl.meshwarp.maxhelp.maxsnap", - "filepath" : "~/Documents/Max 8/Snapshots", - "filepos" : -1, - "snapshotfileid" : "0e9c7d4d0916d1bebe103ade4eaffa6d" - } - } ] }