├── example ├── mergeMeshArray.PNG ├── mergeMeshArray.zip ├── StudyFE_CurveWrap.zip ├── StudyFE_FeatherTool.zip ├── MultiChannelWeightMap_canvas.mel └── MultiChannelWeightMap_splice.py ├── Exts ├── Math │ ├── Colors.kl │ └── Util.kl ├── Util │ ├── Valve.kl │ └── DijkstraAlgorithm.kl ├── Manipulation │ ├── Legacy │ │ └── Gizmos │ │ │ └── TransformManipulationCallback2.kl │ └── Painting │ │ ├── SkinWeightPaintExt.kl │ │ ├── MultiCh_SurfaceAttributeValuesDrawing.kl │ │ └── MultiCh_CastomCommand.kl └── Geometry │ └── PolygonMesh │ └── SpatialQuery.kl ├── DFG ├── PolygonMesh │ ├── EdgeList │ │ ├── EmptyEdgeList.canvas │ │ ├── GetEdgeCount.canvas │ │ ├── SetEdgeList.canvas │ │ ├── EdgeToLines.canvas │ │ ├── GetEdgePolygonIDs.canvas │ │ ├── GetAllSubEdgePointPositions.canvas │ │ ├── GetAllSubEdgePointIDs.canvas │ │ ├── GetEdgePointPositions.canvas │ │ ├── GetEdgePointID.canvas │ │ ├── GetAllEdgePolygonIDs.canvas │ │ ├── GetSubEdgePointPositions.canvas │ │ ├── GetSubEdgePointID.canvas │ │ ├── GetAllEdgePointIDs.canvas │ │ └── GetAllEdgePointPositions.canvas │ ├── BlendShape │ │ ├── EmptyBlendShape.canvas │ │ ├── RegisterAllTargetMesh.canvas │ │ ├── RegisterTargetMesh.canvas │ │ └── ApplyTo.canvas │ ├── MergeMeshArray │ │ ├── CompileMergedMeshArray.canvas │ │ └── Modifier │ │ │ └── UpdataXfos.canvas │ ├── Queries │ │ ├── GetClosestEdgeFromLocation.canvas │ │ └── GetAllCrossPositions.canvas │ └── Modeling │ │ ├── CrossDataToSplitPolygon2.canvas │ │ └── SplitPolygon2Array.canvas ├── Util │ ├── DijkstraAlgorithm │ │ ├── emptyDijkstraGraph.canvas │ │ ├── SetFromPolygonMesh.canvas │ │ └── GetRouteCostValue.canvas │ ├── Valve │ │ └── ToOpen.canvas │ └── String │ │ └── SplitAndDeleteBlank.canvas ├── Manipulation │ ├── ArrayValueManip │ │ ├── ArrayValueManipHandle.canvas │ │ ├── Save.canvas │ │ └── AddXfoOriArrayManip.canvas │ └── Painting │ │ ├── MultiChWeightMap_getNames.canvas │ │ ├── MultiChWeightMap_paintLock.canvas │ │ ├── MultiChWeightMap_normalize.canvas │ │ ├── MultiChWeightMap_setValues.canvas │ │ ├── MultiChWeightMap_getIndices.canvas │ │ ├── MultiChWeightMap_empty.canvas │ │ ├── MultiChWeightMap_getAllChValues.canvas │ │ ├── MultiChWeightMap_getValues.canvas │ │ └── MultiChWeightMap_save.canvas ├── Curves │ ├── GetSegmentCount.canvas │ ├── InverseSegmentValues.canvas │ ├── GetEachCurvePointPositions.canvas │ ├── AddMultipleLinearCurve.canvas │ ├── AddMultipleNURBS.canvas │ ├── CreateAttribute.canvas │ ├── AddMultipleBezier.canvas │ ├── AddNormalDirectionAttributeCurves.canvas │ ├── GetEvenlyDividedXfos.canvas │ ├── GetMultipliedCurvesValueByWeightsArray.canvas │ ├── MergeCurveClones.canvas │ ├── CreateCatenaryCurvesPointPositions.canvas │ └── GetMultipliedCurvesValueByWeights.canvas └── Math │ ├── Color │ └── MakeRandomColors.canvas │ ├── Vec3 │ ├── GetMultipliedVec3ValueByWeightsArray.canvas │ └── GetMultipliedVec3ValueByWeights.canvas │ └── Quat │ └── RadianToAngle.canvas ├── README.md ├── LICENSE.txt └── TKCM.fpm.json /example/mergeMeshArray.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TKCM/TKCM_Exts/HEAD/example/mergeMeshArray.PNG -------------------------------------------------------------------------------- /example/mergeMeshArray.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TKCM/TKCM_Exts/HEAD/example/mergeMeshArray.zip -------------------------------------------------------------------------------- /example/StudyFE_CurveWrap.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TKCM/TKCM_Exts/HEAD/example/StudyFE_CurveWrap.zip -------------------------------------------------------------------------------- /example/StudyFE_FeatherTool.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TKCM/TKCM_Exts/HEAD/example/StudyFE_FeatherTool.zip -------------------------------------------------------------------------------- /Exts/Math/Colors.kl: -------------------------------------------------------------------------------- 1 | inline Color[] MakeRandomColors(Color colors[], Integer count){ 2 | Color resultColors[]; 3 | resultColors.resize(colors.size()); 4 | for(Integer i=0; i 8 | 9 | ## MultiChannelWeightMap 10 | I customized basic WeightMap to multi channel weight map. 11 | And added some mouse events. example brushStrength, brushBlur, brushTypeSelection, and map value drawing with box object. 12 | Please check video for details. 13 | At the moment, the biggest problem is to can not Undo & Redo painting actions. 14 | 15 | 標準で提供されているウェイトマップをマルチチャンネルへ拡張を行いました。 16 | 更にブラシの強さ、ブラシのボケ足、ブラシタイプ(エアーブラシ、スタンプ、バケツ)の変更をマウスイベントに追加しました。 17 | またマップの濃さを視認しやすくすることを目的としたボックス表示の機能もマウスイベントに含めました。 18 | 詳しくは上記リンクの映像をご覧ください 19 | 現在の大きな問題としてUndo/Redoには対応できていません。 20 | 21 | ## CreateUVMesh 22 | Create mesh from UV. 23 | UVをメッシュ化します。 24 | 25 | ## DijkstraAlgorithm 26 | Calculate the distance on the mesh. 27 | メッシュ上の距離を計算します。 28 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2016 Masanori Takashima 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /DFG/PolygonMesh/EdgeList/GetEdgeCount.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "GetEdgeCount", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "edgeList", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "EdgeList" : null 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "EdgeList" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "result", 28 | "nodePortType" : "In", 29 | "defaultValues" : { 30 | "Size" : 0 31 | }, 32 | "execPortType" : "Out", 33 | "typeSpec" : "Size" 34 | } 35 | ], 36 | "extDeps" : { 37 | "TKCM" : "*" 38 | }, 39 | "presetGUID" : "59A2E6A354C92A13778850FD043AE3C2", 40 | "code" : "dfgEntry { 41 | result = edgeList.count(); 42 | } 43 | " 44 | } -------------------------------------------------------------------------------- /DFG/PolygonMesh/EdgeList/SetEdgeList.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "SetEdgeList", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "edgeList", 18 | "nodePortType" : "IO", 19 | "defaultValues" : { 20 | "EdgeList" : null 21 | }, 22 | "execPortType" : "IO", 23 | "typeSpec" : "EdgeList" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "mesh", 28 | "nodePortType" : "Out", 29 | "defaultValues" : { 30 | "PolygonMesh" : null 31 | }, 32 | "execPortType" : "In", 33 | "typeSpec" : "PolygonMesh" 34 | } 35 | ], 36 | "extDeps" : { 37 | "TKCM" : "*" 38 | }, 39 | "presetGUID" : "E87D73A289B53522900C66E694C21357", 40 | "code" : "dfgEntry { 41 | edgeList.set(mesh); 42 | } 43 | " 44 | } -------------------------------------------------------------------------------- /DFG/Curves/GetSegmentCount.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "GetSegmentCount", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "segmentValues", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "Vec2Array[]" : [] 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "Vec2Array[]" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "result", 28 | "nodePortType" : "In", 29 | "defaultValues" : { 30 | "Size" : 0 31 | }, 32 | "execPortType" : "Out", 33 | "typeSpec" : "Size" 34 | } 35 | ], 36 | "extDeps" : {}, 37 | "presetGUID" : "32BF9044CD14F2C479972426CFE65D2A", 38 | "code" : "dfgEntry { 39 | for(Integer i=0; i source_ref = source[i]; 58 | base[i].mergeMesh(source_ref); 59 | } 60 | } 61 | } 62 | " 63 | } -------------------------------------------------------------------------------- /DFG/PolygonMesh/EdgeList/GetAllEdgePolygonIDs.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "GetAllEdgePolygonIDs", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "edgeList", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "EdgeList" : null 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "EdgeList" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "leftPolygonIDs", 28 | "nodePortType" : "In", 29 | "defaultValues" : { 30 | "Size" : 0, 31 | "Size[]" : [] 32 | }, 33 | "execPortType" : "Out", 34 | "typeSpec" : "Size[]" 35 | }, 36 | { 37 | "objectType" : "ExecPort", 38 | "name" : "rightPolygonIDs", 39 | "nodePortType" : "In", 40 | "defaultValues" : { 41 | "Size" : 0, 42 | "Size[]" : [] 43 | }, 44 | "execPortType" : "Out", 45 | "typeSpec" : "Size[]" 46 | } 47 | ], 48 | "extDeps" : { 49 | "TKCM" : "*" 50 | }, 51 | "presetGUID" : "5963243F28A77FABA0F3A5A4B761D995", 52 | "code" : "operator GetEdgePolygonsTask<<>>(in EdgeList edgeList, io Size leftPolygonIDs[], io Size rightPolygonIDs[]){ 53 | edgeList.getEdgePolygons(i, leftPolygonIDs[i], rightPolygonIDs[i]); 54 | } 55 | 56 | dfgEntry { 57 | leftPolygonIDs.resize(edgeList.edge.size()); 58 | rightPolygonIDs.resize(edgeList.edge.size()); 59 | 60 | if(edgeList.edge.size() < 1000){ 61 | for(Integer i=0; i>>(edgeList, leftPolygonIDs, rightPolygonIDs); 66 | } 67 | } 68 | " 69 | } -------------------------------------------------------------------------------- /DFG/Manipulation/Painting/MultiChWeightMap_setValues.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "MultiChWeightMap_setValues", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "multiChWeightmap", 18 | "nodePortType" : "IO", 19 | "defaultValues" : { 20 | "MultiChWeightmap" : null 21 | }, 22 | "execPortType" : "IO", 23 | "typeSpec" : "MultiChWeightmap" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "mesh", 28 | "nodePortType" : "IO", 29 | "defaultValues" : { 30 | "PolygonMesh" : null 31 | }, 32 | "execPortType" : "IO", 33 | "typeSpec" : "PolygonMesh" 34 | }, 35 | { 36 | "objectType" : "ExecPort", 37 | "name" : "execute", 38 | "nodePortType" : "Out", 39 | "defaultValues" : { 40 | "Boolean" : false 41 | }, 42 | "execPortType" : "In", 43 | "typeSpec" : "Boolean" 44 | }, 45 | { 46 | "objectType" : "ExecPort", 47 | "metadata" : { 48 | "uiPersistValue" : "true" 49 | }, 50 | "name" : "setChannel", 51 | "nodePortType" : "Out", 52 | "defaultValues" : { 53 | "Index" : 0 54 | }, 55 | "execPortType" : "In", 56 | "typeSpec" : "Index" 57 | }, 58 | { 59 | "objectType" : "ExecPort", 60 | "name" : "values", 61 | "nodePortType" : "Out", 62 | "defaultValues" : { 63 | "Scalar[]" : [] 64 | }, 65 | "execPortType" : "In", 66 | "typeSpec" : "Scalar[]" 67 | } 68 | ], 69 | "extDeps" : { 70 | "TKCM" : "*" 71 | }, 72 | "presetGUID" : "0C33964580421508B658CC0EAB4CE326", 73 | "code" : "dfgEntry { 74 | if(execute){ 75 | multiChWeightmap.setValues(mesh, setChannel, values); 76 | } 77 | } 78 | ", 79 | "requiredPresets" : {} 80 | } -------------------------------------------------------------------------------- /DFG/PolygonMesh/BlendShape/ApplyTo.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "ApplyTo", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "blendShape", 18 | "nodePortType" : "IO", 19 | "defaultValues" : { 20 | "BlendShape" : null 21 | }, 22 | "execPortType" : "IO", 23 | "typeSpec" : "BlendShape" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "mesh", 28 | "nodePortType" : "Out", 29 | "defaultValues" : { 30 | "PolygonMesh" : null 31 | }, 32 | "execPortType" : "In", 33 | "typeSpec" : "PolygonMesh" 34 | }, 35 | { 36 | "objectType" : "ExecPort", 37 | "name" : "weight", 38 | "nodePortType" : "Out", 39 | "defaultValues" : { 40 | "Scalar[]" : [ 41 | 0, 42 | 0, 43 | 1.5 44 | ] 45 | }, 46 | "execPortType" : "In", 47 | "typeSpec" : "Scalar[]" 48 | }, 49 | { 50 | "objectType" : "ExecPort", 51 | "name" : "weightRev", 52 | "nodePortType" : "Out", 53 | "defaultValues" : { 54 | "Scalar[]" : [ 55 | 0, 56 | 0, 57 | 1 58 | ] 59 | }, 60 | "execPortType" : "In", 61 | "typeSpec" : "Scalar[]" 62 | }, 63 | { 64 | "objectType" : "ExecPort", 65 | "name" : "result", 66 | "nodePortType" : "In", 67 | "defaultValues" : { 68 | "PolygonMesh" : null 69 | }, 70 | "execPortType" : "Out", 71 | "typeSpec" : "PolygonMesh" 72 | } 73 | ], 74 | "extDeps" : { 75 | "TKCM" : "*" 76 | }, 77 | "presetGUID" : "316FA21638FB7524163C8917DADEFC63", 78 | "code" : "dfgEntry { 79 | result = mesh.clone(); 80 | blendShape.applyTo(result, weight, weightRev); 81 | } 82 | ", 83 | "requiredPresets" : {} 84 | } -------------------------------------------------------------------------------- /DFG/PolygonMesh/EdgeList/GetSubEdgePointPositions.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "GetSubEdgePointPositions", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "edgeList", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "EdgeList" : null 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "EdgeList" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "polyID", 28 | "nodePortType" : "Out", 29 | "defaultValues" : { 30 | "Size" : 50 31 | }, 32 | "execPortType" : "In", 33 | "typeSpec" : "Size" 34 | }, 35 | { 36 | "objectType" : "ExecPort", 37 | "name" : "subID", 38 | "nodePortType" : "Out", 39 | "defaultValues" : { 40 | "Size" : 0 41 | }, 42 | "execPortType" : "In", 43 | "typeSpec" : "Size" 44 | }, 45 | { 46 | "objectType" : "ExecPort", 47 | "name" : "firstPosition", 48 | "nodePortType" : "In", 49 | "defaultValues" : { 50 | "Vec3" : { 51 | "x" : 0, 52 | "y" : 0, 53 | "z" : 0 54 | } 55 | }, 56 | "execPortType" : "Out", 57 | "typeSpec" : "Vec3" 58 | }, 59 | { 60 | "objectType" : "ExecPort", 61 | "name" : "secondPosition", 62 | "nodePortType" : "In", 63 | "defaultValues" : { 64 | "Vec3" : { 65 | "x" : 0, 66 | "y" : 0, 67 | "z" : 0 68 | } 69 | }, 70 | "execPortType" : "Out", 71 | "typeSpec" : "Vec3" 72 | } 73 | ], 74 | "extDeps" : { 75 | "TKCM" : "*" 76 | }, 77 | "presetGUID" : "09126033A9F9058425E8AB363CF97893", 78 | "code" : "dfgEntry { 79 | firstPosition = edgeList.getSubEdgeFirstPointPosition(polyID, subID); 80 | secondPosition = edgeList.getSubEdgeSecondPointPosition(polyID, subID); 81 | } 82 | " 83 | } -------------------------------------------------------------------------------- /DFG/PolygonMesh/EdgeList/GetSubEdgePointID.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "GetSubEdgePointID", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "edgeList", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "EdgeList" : null 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "EdgeList" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "polyID", 28 | "nodePortType" : "Out", 29 | "defaultValues" : { 30 | "Size" : 50 31 | }, 32 | "execPortType" : "In", 33 | "typeSpec" : "Size" 34 | }, 35 | { 36 | "objectType" : "ExecPort", 37 | "name" : "subID", 38 | "nodePortType" : "Out", 39 | "defaultValues" : { 40 | "Size" : 0 41 | }, 42 | "execPortType" : "In", 43 | "typeSpec" : "Size" 44 | }, 45 | { 46 | "objectType" : "ExecPort", 47 | "name" : "firstPoint", 48 | "nodePortType" : "In", 49 | "defaultValues" : { 50 | "Vec3" : { 51 | "x" : 0, 52 | "y" : 0, 53 | "z" : 0 54 | }, 55 | "Size" : 0 56 | }, 57 | "execPortType" : "Out", 58 | "typeSpec" : "Size" 59 | }, 60 | { 61 | "objectType" : "ExecPort", 62 | "name" : "secondPoint", 63 | "nodePortType" : "In", 64 | "defaultValues" : { 65 | "Vec3" : { 66 | "x" : 0, 67 | "y" : 0, 68 | "z" : 0 69 | }, 70 | "Size" : 0 71 | }, 72 | "execPortType" : "Out", 73 | "typeSpec" : "Size" 74 | } 75 | ], 76 | "extDeps" : { 77 | "TKCM" : "*" 78 | }, 79 | "presetGUID" : "94B70DFDE20F104F9F676207E483C1C5", 80 | "code" : "dfgEntry { 81 | firstPoint = edgeList.getSubEdgeFirstPoint(polyID, subID); 82 | secondPoint = edgeList.getSubEdgeSecondPoint(polyID, subID); 83 | } 84 | " 85 | } -------------------------------------------------------------------------------- /DFG/PolygonMesh/EdgeList/GetAllEdgePointIDs.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "GetAllEdgePointIDs", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "edgeList", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "EdgeList" : null 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "EdgeList" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "firstPoints", 28 | "nodePortType" : "In", 29 | "defaultValues" : { 30 | "Vec3" : { 31 | "x" : 0, 32 | "y" : 0, 33 | "z" : 0 34 | }, 35 | "Vec3[]" : [], 36 | "Size[]" : [] 37 | }, 38 | "execPortType" : "Out", 39 | "typeSpec" : "Size[]" 40 | }, 41 | { 42 | "objectType" : "ExecPort", 43 | "name" : "secondPoints", 44 | "nodePortType" : "In", 45 | "defaultValues" : { 46 | "Vec3" : { 47 | "x" : 0, 48 | "y" : 0, 49 | "z" : 0 50 | }, 51 | "Vec3[]" : [], 52 | "Size[]" : [] 53 | }, 54 | "execPortType" : "Out", 55 | "typeSpec" : "Size[]" 56 | } 57 | ], 58 | "extDeps" : { 59 | "TKCM" : "*" 60 | }, 61 | "presetGUID" : "0EFB5B6EA8B1CE67BCBF5B9C8570989D", 62 | "code" : "operator GetEdgePointPosTask<<>>(in EdgeList edgeList, io Size firstPoints[], io Size secondPoints[]){ 63 | firstPoints[i] = edgeList.getEdgeFirstPoint(i); 64 | secondPoints[i] = edgeList.getEdgeSecondPoint(i); 65 | } 66 | 67 | dfgEntry { 68 | firstPoints.resize(edgeList.edge.size()); 69 | secondPoints.resize(edgeList.edge.size()); 70 | if(edgeList.edge.size() < 1000){ 71 | for(Integer i=0; i>>(edgeList, firstPoints, secondPoints); 76 | } 77 | } 78 | " 79 | } -------------------------------------------------------------------------------- /DFG/PolygonMesh/EdgeList/GetAllEdgePointPositions.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "GetAllEdgePointPositions", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "edgeList", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "EdgeList" : null 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "EdgeList" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "firstPositions", 28 | "nodePortType" : "In", 29 | "defaultValues" : { 30 | "Vec3" : { 31 | "x" : 0, 32 | "y" : 0, 33 | "z" : 0 34 | }, 35 | "Vec3[]" : [] 36 | }, 37 | "execPortType" : "Out", 38 | "typeSpec" : "Vec3[]" 39 | }, 40 | { 41 | "objectType" : "ExecPort", 42 | "name" : "secondPositions", 43 | "nodePortType" : "In", 44 | "defaultValues" : { 45 | "Vec3" : { 46 | "x" : 0, 47 | "y" : 0, 48 | "z" : 0 49 | }, 50 | "Vec3[]" : [] 51 | }, 52 | "execPortType" : "Out", 53 | "typeSpec" : "Vec3[]" 54 | } 55 | ], 56 | "extDeps" : { 57 | "TKCM" : "*" 58 | }, 59 | "presetGUID" : "3C3F74B4B07B0BB58FB51B7D5DE22659", 60 | "code" : "operator GetEdgePointPosTask<<>>(in EdgeList edgeList, io Vec3 firstPositions[], io Vec3 secondPositions[]){ 61 | firstPositions[i] = edgeList.getEdgeFirstPointPosition(i); 62 | secondPositions[i] = edgeList.getEdgeSecondPointPosition(i); 63 | } 64 | 65 | dfgEntry { 66 | firstPositions.resize(edgeList.edge.size()); 67 | secondPositions.resize(edgeList.edge.size()); 68 | if(edgeList.edge.size() < 1000){ 69 | for(Integer i=0; i>>(edgeList, firstPositions, secondPositions); 74 | } 75 | } 76 | " 77 | } -------------------------------------------------------------------------------- /Exts/Manipulation/Legacy/Gizmos/TransformManipulationCallback2.kl: -------------------------------------------------------------------------------- 1 | 2 | object TransformManipulationCallback2 : TransformManipulationCallback{ 3 | Integer evalType; // 1=non, 2=evalCanvasPort, (3=Canvas内のノードのポートへ直接値を設定) 4 | Integer setID; 5 | Integer dataType; //0=Vec3, 1=Quat, 6 | UInt32 evalID; 7 | Vec3 restVec3[]; 8 | Xfo restXfo[]; 9 | }; 10 | 11 | function TransformManipulationCallback2.onDrag!(io MouseEvent mouseEvent, Xfo space, Xfo delta, UInt32 flags){ 12 | Xfo invSpace = space.inverse(); 13 | for(Integer i=0; i 0 && hostName.length() > 0) { 38 | if(hostName == 'Canvas') { 39 | 40 | // Generate a command that will change the arg back in Canvas. 41 | /* 42 | ParamDict params = ParamDict(); 43 | params.setString('portName', this.portToDrive); 44 | params.setXfo('xfo', xfo); 45 | mouseEvent.getHost().callCustomCommand('setArg', params); 46 | */ 47 | 48 | } else if(hostName == 'Maya' && this.evalType == 2) { 49 | // eval Canvas port 50 | this.evalID++; 51 | String attr = this.graphName + '.' + this.portToDrive;; 52 | String args[]; 53 | args.push(attr); 54 | args.push(this.evalID); 55 | mouseEvent.getHost().callCustomCommand('setAttr', args); 56 | } 57 | }else{ 58 | setError(this.graphName+"."+this.portToDrive+" can not find."); 59 | } 60 | 61 | xfo = space * xfo; 62 | target.setGlobalXfo(j, xfo); 63 | this.command.newValues[i][j] = xfo; 64 | } 65 | } 66 | // Notify the system that data has changed, and that we should redraw 67 | mouseEvent.getHost().requestRedraw(); 68 | } -------------------------------------------------------------------------------- /DFG/Manipulation/ArrayValueManip/Save.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "Save", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "metadata" : { 8 | "uiPersistValue" : "true" 9 | }, 10 | "name" : "exec", 11 | "nodePortType" : "IO", 12 | "defaultValues" : { 13 | "Execute" : {} 14 | }, 15 | "execPortType" : "IO", 16 | "typeSpec" : "Execute" 17 | }, 18 | { 19 | "objectType" : "ExecPort", 20 | "metadata" : { 21 | "uiPersistValue" : "true" 22 | }, 23 | "name" : "this", 24 | "nodePortType" : "IO", 25 | "defaultValues" : { 26 | "MultiChWeightmap" : null, 27 | "ArrayValueManipHandle" : null 28 | }, 29 | "execPortType" : "IO", 30 | "typeSpec" : "ArrayValueManipHandle" 31 | }, 32 | { 33 | "objectType" : "ExecPort", 34 | "metadata" : { 35 | "uiPersistValue" : "true" 36 | }, 37 | "name" : "save_Enable", 38 | "nodePortType" : "Out", 39 | "defaultValues" : { 40 | "Boolean" : true 41 | }, 42 | "execPortType" : "In", 43 | "typeSpec" : "Boolean" 44 | }, 45 | { 46 | "objectType" : "ExecPort", 47 | "metadata" : { 48 | "uiPersistValue" : "true" 49 | }, 50 | "name" : "save_ExternalFile", 51 | "nodePortType" : "Out", 52 | "defaultValues" : { 53 | "Boolean" : false 54 | }, 55 | "execPortType" : "In", 56 | "typeSpec" : "Boolean" 57 | }, 58 | { 59 | "objectType" : "ExecPort", 60 | "metadata" : { 61 | "uiPersistValue" : "true" 62 | }, 63 | "name" : "save_FolderPath", 64 | "nodePortType" : "Out", 65 | "defaultValues" : { 66 | "FilePath" : { 67 | "handle" : true 68 | } 69 | }, 70 | "execPortType" : "In", 71 | "typeSpec" : "FilePath" 72 | }, 73 | { 74 | "objectType" : "ExecPort", 75 | "metadata" : { 76 | "uiPersistValue" : "true" 77 | }, 78 | "name" : "save_FileName", 79 | "nodePortType" : "Out", 80 | "defaultValues" : { 81 | "String" : "" 82 | }, 83 | "execPortType" : "In", 84 | "typeSpec" : "String" 85 | } 86 | ], 87 | "extDeps" : { 88 | "TKCM" : "*" 89 | }, 90 | "presetGUID" : "135D12D28F42C05B245F0914C5BCE285", 91 | "code" : "dfgEntry { 92 | if(this == null){ 93 | this = ArrayValueManipHandle(); 94 | } 95 | this.save(save_Enable, save_ExternalFile, save_FolderPath, save_FileName); 96 | } 97 | ", 98 | "requiredPresets" : {} 99 | } -------------------------------------------------------------------------------- /DFG/Curves/AddMultipleNURBS.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "AddMultipleNURBS", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "this", 18 | "nodePortType" : "IO", 19 | "defaultValues" : { 20 | "Curves" : null 21 | }, 22 | "execPortType" : "IO", 23 | "typeSpec" : "Curves" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "CurvePositions", 28 | "nodePortType" : "Out", 29 | "defaultValues" : { 30 | "GenericVec3ArrayValue[]" : [], 31 | "Vec3Array[]" : [] 32 | }, 33 | "execPortType" : "In", 34 | "typeSpec" : "Vec3Array[]" 35 | }, 36 | { 37 | "objectType" : "ExecPort", 38 | "metadata" : { 39 | "uiRange" : "(1, 7)" 40 | }, 41 | "name" : "degree", 42 | "nodePortType" : "Out", 43 | "defaultValues" : { 44 | "UInt8" : 2 45 | }, 46 | "execPortType" : "In", 47 | "typeSpec" : "UInt8" 48 | }, 49 | { 50 | "objectType" : "ExecPort", 51 | "metadata" : { 52 | "uiCombo" : "( \"open\", \"closed\", \"periodic\" )" 53 | }, 54 | "name" : "curveForm", 55 | "nodePortType" : "Out", 56 | "defaultValues" : { 57 | "UInt8" : 0 58 | }, 59 | "execPortType" : "In", 60 | "typeSpec" : "UInt8" 61 | }, 62 | { 63 | "objectType" : "ExecPort", 64 | "name" : "rationalWeight", 65 | "nodePortType" : "Out", 66 | "defaultValues" : { 67 | "Scalar" : 1 68 | }, 69 | "execPortType" : "In", 70 | "typeSpec" : "Scalar" 71 | } 72 | ], 73 | "extDeps" : {}, 74 | "presetGUID" : "6033398F52DCDAFB0B5E9423093709EB", 75 | "code" : "dfgEntry { 76 | if(CurvePositions.size() == 0){ return; } 77 | 78 | for(Integer i=0; i>>(io Scalar values[][], String str[]){ 7 | for(Integer j=0; j 1000){ 19 | StringArrayToSkinWeightValues_Task<<>>(result, str); 20 | }else{ 21 | for(Integer i=0; i>>(Scalar values[][], io Ref maps){ 47 | for(Integer j=0; j attr = maps.mesh.getAttribute(maps.chNames[j], ScalarAttribute); 49 | maps.mesh.setPointAttribute(i, attr, values[j][i]); 50 | } 51 | }*/ 52 | 53 | function MultiChWeightmap.connectSkinWeight!(io PolygonMesh mesh, Scalar values[][], Xfo meshTransform, Color colors[]){ 54 | this.prepareCh(values.size(), colors); 55 | this.oldChCount = this.chCount; 56 | if(!this.externalValuesConnected && this.temporaryLoadAttr.size() != 0){ 57 | this.temporaryLoadAttr.resize(values.size()); 58 | for(Integer i=0; i attr(); 73 | switch(type){ 74 | case 0: 75 | attr = curves.attributes.getOrCreateIntegerAttribute(attributeName); 76 | break; 77 | case 1: 78 | attr = curves.attributes.getOrCreateScalarAttribute(attributeName); 79 | break; 80 | case 2: 81 | attr = curves.attributes.getOrCreateVec2Attribute(attributeName); 82 | break; 83 | case 3: 84 | attr = curves.attributes.getOrCreateVec3Attribute(attributeName); 85 | break; 86 | case 4: 87 | attr = curves.attributes.getOrCreateVec4Attribute(attributeName); 88 | break; 89 | case 5: 90 | attr = curves.attributes.getOrCreateQuatAttribute(attributeName); 91 | break; 92 | case 6: 93 | attr = curves.attributes.getOrCreateMat33Attribute(attributeName); 94 | break; 95 | case 7: 96 | attr = curves.attributes.getOrCreateMat44Attribute(attributeName); 97 | break; 98 | case 8: 99 | attr = curves.attributes.getOrCreateColorAttribute(attributeName); 100 | break; 101 | case 9: 102 | attr = curves.attributes.getOrCreateRGBAttribute(attributeName); 103 | break; 104 | case 10: 105 | attr = curves.attributes.getOrCreateRGBAAttribute(attributeName); 106 | break; 107 | case 11: 108 | attr = curves.attributes.getOrCreateSkinningAttribute(attributeName); 109 | break; 110 | } 111 | success = attr != null; 112 | } 113 | ", 114 | "requiredPresets" : {} 115 | } -------------------------------------------------------------------------------- /DFG/Curves/AddMultipleBezier.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "AddMultipleBezier", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "this", 18 | "nodePortType" : "IO", 19 | "defaultValues" : { 20 | "Curves" : null 21 | }, 22 | "execPortType" : "IO", 23 | "typeSpec" : "Curves" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "name" : "CurvePositions", 28 | "nodePortType" : "Out", 29 | "defaultValues" : { 30 | "GenericVec3ArrayValue[]" : [], 31 | "Vec3Array[]" : [] 32 | }, 33 | "execPortType" : "In", 34 | "typeSpec" : "Vec3Array[]" 35 | }, 36 | { 37 | "objectType" : "ExecPort", 38 | "metadata" : { 39 | "uiCombo" : "(\"Normal\", \"Normal + Rational\", \"Cubic\", \"Cubic + Rational\", \"Quadratic\", \"Quadratic + Rational\")" 40 | }, 41 | "name" : "type", 42 | "nodePortType" : "Out", 43 | "defaultValues" : { 44 | "Integer" : 0 45 | }, 46 | "execPortType" : "In", 47 | "typeSpec" : "Integer" 48 | }, 49 | { 50 | "objectType" : "ExecPort", 51 | "metadata" : { 52 | "uiRange" : "(1, 7)" 53 | }, 54 | "name" : "degree", 55 | "nodePortType" : "Out", 56 | "defaultValues" : { 57 | "UInt8" : 3 58 | }, 59 | "execPortType" : "In", 60 | "typeSpec" : "UInt8" 61 | }, 62 | { 63 | "objectType" : "ExecPort", 64 | "name" : "rationalWeight", 65 | "nodePortType" : "Out", 66 | "defaultValues" : { 67 | "Scalar" : 1 68 | }, 69 | "execPortType" : "In", 70 | "typeSpec" : "Scalar" 71 | }, 72 | { 73 | "objectType" : "ExecPort", 74 | "name" : "isClosed", 75 | "nodePortType" : "Out", 76 | "defaultValues" : { 77 | "Boolean" : false 78 | }, 79 | "execPortType" : "In", 80 | "typeSpec" : "Boolean" 81 | } 82 | ], 83 | "extDeps" : {}, 84 | "presetGUID" : "9937F0F9927FA0B4C51C86823902A63B", 85 | "code" : "dfgEntry { 86 | if(CurvePositions.size() == 0){ return; } 87 | 88 | for(Integer i=0; i=\", \"border > \")" 85 | }, 86 | "name" : "logic", 87 | "nodePortType" : "Out", 88 | "defaultValues" : { 89 | "Integer" : 0 90 | }, 91 | "execPortType" : "In", 92 | "typeSpec" : "Integer" 93 | }, 94 | { 95 | "objectType" : "ExecPort", 96 | "metadata" : { 97 | "uiRange" : "(0, 1)" 98 | }, 99 | "name" : "border", 100 | "nodePortType" : "Out", 101 | "defaultValues" : { 102 | "Scalar" : 0 103 | }, 104 | "execPortType" : "In", 105 | "typeSpec" : "Scalar" 106 | }, 107 | { 108 | "objectType" : "ExecPort", 109 | "name" : "indices", 110 | "nodePortType" : "In", 111 | "defaultValues" : { 112 | "Index[]" : [] 113 | }, 114 | "execPortType" : "Out", 115 | "typeSpec" : "Index[]" 116 | } 117 | ], 118 | "extDeps" : { 119 | "TKCM" : "*" 120 | }, 121 | "presetGUID" : "3AFEB2191B98E16D871BDAE3FD053053", 122 | "code" : "dfgEntry { 123 | indices = multiChWeightMap.getIndices(mode, mapAttrSelect, mapAttr_Ch, mapAttr_Name, logic, border); 124 | }", 125 | "requiredPresets" : {} 126 | } -------------------------------------------------------------------------------- /Exts/Geometry/PolygonMesh/SpatialQuery.kl: -------------------------------------------------------------------------------- 1 | 2 | // ジオメトリロケーションから最も近いポリゴンエッジを取得する 3 | function PolygonMesh.getClosestEdgeFromLocation(in GeometryLocation loc, out Size polygon, out Size edgeFirstPoi, out Scalar ratio, out Scalar distance, out Vec3 pos){ 4 | if(!loc.isValid()){ 5 | return; 6 | } 7 | 8 | // ジオメトリロケーションのポリゴンID 9 | polygon = loc.index; 10 | // ポリゴンのエッジを線分としてジオメトリロケーションとの距離を計算していく 11 | // ポリゴンポイント最終番号と0番との線分の値をスタート値にする 12 | Vec3 p0, p1, pA; 13 | p0 = this.getPointPosition( this.getPolygonPoint(polygon, this.getPolygonSize(polygon)-1) ); 14 | p1 = this.getPointPosition( this.getPolygonPoint(polygon, 0) ); 15 | pA = this.getPositionAtLocation(loc); 16 | distance = distFromPointToSegment(pA, p0, p1); 17 | edgeFirstPoi = this.getPolygonSize(polygon)-1; 18 | pos = closestSegmentPoint(pA, p0, p1, ratio); 19 | // エッジを順番に計算していき線分(エッジ)との距離が短いものがあった場合は各種値(レシオや距離など)を更新する 20 | for(Integer i=0; i>>(io Vec3Array[] result, in Vec3[] pos, in UInt32 idList[]){ 91 | Size arrayID, startCnt; 92 | if(index < idList[0]){ 93 | arrayID = 0; 94 | startCnt = 0; 95 | }else{ 96 | for(Integer i=0; i>>(splitedPositions, positions, splitSizes); 135 | 136 | for(Integer i=0; i normalsAttr = sourceCurves.attributes.getAttribute(\"normalDirections\"); 94 | normal = normalsAttr.values[startID]; 95 | q.setFromDirectionAndUpvector(normal, tangent); 96 | gMat.setRotation(q); 97 | 98 | Vec3 sourceCervePoiPosLVec3[](sourceCurves.getPointCount(selectSourceCurveID)); 99 | Vec3 sourceCerveLNormal[](sourceCurves.getPointCount(selectSourceCurveID)); 100 | for(Integer j=0; j normalsAttr2 = this.attributes.getAttribute(\"normalDirections\"); 148 | for(Integer j=0; j attr; 22 | Vec3 pointPositions[]; 23 | }; 24 | 25 | function MultiCh_SurfaceAttributeValuesDrawing(){ 26 | this.name = 'MultiCh_SurfaceAttributeValuesDrawing'; 27 | this.color = Color(1.0,0.0,0.0); 28 | this.type = 0; 29 | } 30 | 31 | function MultiCh_SurfaceAttributeValuesDrawing.connect!( 32 | in PolygonMesh mesh, 33 | in Color color, 34 | ){ 35 | // setup the scene 36 | InlineDrawing drawing = OGLInlineDrawing_GetInstance(); 37 | this.color = color; 38 | if(!this.handle){ 39 | this.handle = DrawingHandle(); 40 | // setup shader & material 41 | InlineShader attributeValueDrawingShader = drawing.registerShader(OGLFlatShader( this.name+"DrawingShader")); 42 | this.attributeValueDrawingMaterial = attributeValueDrawingShader.getOrCreateMaterial("attributeValueDrawing"); 43 | InlineShader attributeValueDrawingWireShader = drawing.registerShader(OGLWireFrameShader('wireframe', OGLFlatShader())); 44 | this.attributeValueDrawingWireMaterial = attributeValueDrawingWireShader.getOrCreateMaterial("attributeValueDrawingWire"); 45 | 46 | // create a shape for the mesh 47 | this.shapes[0] = InlineDebugShape('shape_box').drawTrianglesCube(Xfo(), 1.0, 1.0, 1.0); 48 | drawing.registerShape(this.shapes[0]); 49 | 50 | this.shapes[1] = InlineDebugShape('shape_sphere').drawTrianglesSphere(Xfo(), 0.5, 3); 51 | drawing.registerShape(this.shapes[1]); 52 | 53 | // set vetexValueDrawings 54 | this.instanceDrawing.resize(mesh.pointCount()); 55 | this.instanceDrawingWire.resize(mesh.pointCount()); 56 | for(Size i=0; i activeWeiMapVal, 70 | in Color color, 71 | in Xfo meshTransform, 72 | ){ 73 | this.meshTransform = meshTransform; 74 | Mat44 meshTransformM44 = meshTransform.toMat44(); 75 | this.color = color; 76 | if(this.instanceDrawing.size() != 0){ 77 | for(Size i=0; i 0.5){ 98 | if(!this.instanceDrawing[0].hasMaterial(this.attributeValueDrawingMaterial)){ 99 | for(Size i=0; i0 && this.graphName.length()>0){ 84 | this.evalID++; 85 | String attr = this.graphName + '.' + this.portToDrive; 86 | String args[]; 87 | args.push(attr); 88 | args.push(this.evalID); 89 | mouseEvent.getHost().callCustomCommand('setAttr', args); 90 | }else{ 91 | setError("canvasGraphName or portName parameter is empty"); 92 | } 93 | break; 94 | case 2: 95 | String args[]; 96 | for(Integer i=0; i mapValData = this.mesh.getAttribute(this.chNames[j], ScalarAttribute); 99 | String val; 100 | if(mapValData.values[ this.pointIds[i] ] > 0){ 101 | args.push('-transformValue '); 102 | args.push(this.chSubNames[j]); //jointName 103 | val = mapValData.values[ this.pointIds[i] ]; //weightValue 104 | if(val.startsWith('+')){ 105 | val = val.leftStrip(1); 106 | } 107 | args.push(val); 108 | } 109 | } 110 | args.push('-normalize off '); 111 | args.push(this.attrPath); //skinCluster path 112 | args.push(this.meshName + '.vtx[' + this.pointIds[i] + ']'); //vartex ID 113 | if(i != this.pointIds.size()-1){ 114 | args.push('; skinPercent '); 115 | } 116 | } 117 | mouseEvent.getHost().callCustomCommand('skinPercent', args); 118 | break; 119 | 120 | case 3: 121 | for(Integer i=0; i blendMapValData = this.mesh.getAttribute("weightMap_ch"+(this.chNames.size()), ScalarAttribute); 128 | for(Integer j=0; j 0.001){ 136 | if(baseValue > 0.001){ 137 | Scalar added = baseValue + targetValue * blendMapValData.values[poiID]; 138 | sum += added; 139 | sumArray[j] = added; 140 | }else{ 141 | sum2 = targetValue * blendMapValData.values[poiID]; 142 | sVal = round(sum2*100)/100; 143 | if(sVal.startsWith('+')){ 144 | sVal = sVal.leftStrip(1); 145 | } 146 | args.push('-transformValue '); 147 | args.push(this.chSubNames[j]); 148 | args.push(sVal); 149 | } 150 | }else{ 151 | sVal = round(baseValue*100)/100; 152 | if(sVal.startsWith('+')){ 153 | sVal = sVal.leftStrip(1); 154 | } 155 | args.push('-transformValue '); 156 | args.push(this.chSubNames[j]); 157 | args.push(sVal); 158 | } 159 | } 160 | for(Integer j=0; j 0){ 164 | scaVal = round((sumArray[j] / sum)*(1.0-sum2) *100)/100; 165 | } 166 | if(scaVal > 0){ 167 | sVal = scaVal; 168 | if(sVal.startsWith('+')){ 169 | sVal = sVal.leftStrip(1); 170 | } 171 | args.push('-transformValue '); 172 | args.push(this.chSubNames[j]); 173 | args.push(sVal); 174 | } 175 | } 176 | args.push('-normalize on '); 177 | args.push(this.attrPath); //skinCluster path 178 | args.push(this.meshName + '.vtx[' + this.pointIds[i] + ']'); //vartex ID 179 | mouseEvent.getHost().callCustomCommand('skinPercent', args); 180 | } 181 | break; 182 | } 183 | 184 | } -------------------------------------------------------------------------------- /DFG/Curves/CreateCatenaryCurvesPointPositions.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "title" : "CreateCatenaryCurvesPointPositions", 4 | "ports" : [ 5 | { 6 | "objectType" : "ExecPort", 7 | "name" : "exec", 8 | "nodePortType" : "IO", 9 | "defaultValues" : { 10 | "Execute" : {} 11 | }, 12 | "execPortType" : "IO", 13 | "typeSpec" : "Execute" 14 | }, 15 | { 16 | "objectType" : "ExecPort", 17 | "name" : "startEndPosition", 18 | "nodePortType" : "Out", 19 | "defaultValues" : { 20 | "Vec3[]" : [] 21 | }, 22 | "execPortType" : "In", 23 | "typeSpec" : "Vec3[]" 24 | }, 25 | { 26 | "objectType" : "ExecPort", 27 | "metadata" : { 28 | "uiCombo" : "(\"[ 0-1 ][ 1-2 ][ 2-3 ]\", \"[ 0-1 ][ 2-3 ][ 4-5 ]\")" 29 | }, 30 | "name" : "createType", 31 | "nodePortType" : "Out", 32 | "defaultValues" : { 33 | "Integer" : 0 34 | }, 35 | "execPortType" : "In", 36 | "typeSpec" : "Integer" 37 | }, 38 | { 39 | "objectType" : "ExecPort", 40 | "metadata" : { 41 | "uiCombo" : "(\"W with H\", \"P with H\", \"W with F\")" 42 | }, 43 | "name" : "mode", 44 | "nodePortType" : "Out", 45 | "defaultValues" : { 46 | "Integer" : 1 47 | }, 48 | "execPortType" : "In", 49 | "typeSpec" : "Integer" 50 | }, 51 | { 52 | "objectType" : "ExecPort", 53 | "name" : "W_uniformlyDistributedLoad", 54 | "nodePortType" : "Out", 55 | "defaultValues" : { 56 | "Scalar" : -0.4000000059604645 57 | }, 58 | "execPortType" : "In", 59 | "typeSpec" : "Scalar" 60 | }, 61 | { 62 | "objectType" : "ExecPort", 63 | "name" : "P_concentratedLoad", 64 | "nodePortType" : "Out", 65 | "defaultValues" : { 66 | "Scalar" : -9.699999809265137 67 | }, 68 | "execPortType" : "In", 69 | "typeSpec" : "Scalar" 70 | }, 71 | { 72 | "objectType" : "ExecPort", 73 | "name" : "H_tension", 74 | "nodePortType" : "Out", 75 | "defaultValues" : { 76 | "Scalar" : 7.800000190734863 77 | }, 78 | "execPortType" : "In", 79 | "typeSpec" : "Scalar" 80 | }, 81 | { 82 | "objectType" : "ExecPort", 83 | "name" : "F_sag", 84 | "nodePortType" : "Out", 85 | "defaultValues" : { 86 | "Scalar" : 13.60000038146973 87 | }, 88 | "execPortType" : "In", 89 | "typeSpec" : "Scalar" 90 | }, 91 | { 92 | "objectType" : "ExecPort", 93 | "name" : "accuracy", 94 | "nodePortType" : "Out", 95 | "defaultValues" : { 96 | "Integer" : 30 97 | }, 98 | "execPortType" : "In", 99 | "typeSpec" : "Integer" 100 | }, 101 | { 102 | "objectType" : "ExecPort", 103 | "name" : "result", 104 | "nodePortType" : "In", 105 | "defaultValues" : { 106 | "GenericVec3ArrayValue[]" : [], 107 | "Vec3Array[]" : [] 108 | }, 109 | "execPortType" : "Out", 110 | "typeSpec" : "Vec3Array[]" 111 | } 112 | ], 113 | "extDeps" : {}, 114 | "presetGUID" : "72CE8275436FCE360AE01B8DE90D3070", 115 | "code" : "function Vec3[] CreateCatenaryCurvePositions( 116 | in Vec3 v0, 117 | in Vec3 v1, 118 | in Scalar W, 119 | in Scalar P, 120 | in Scalar inH, 121 | in Scalar F, 122 | in Integer accuracy, 123 | in Integer mode 124 | ){ 125 | Vec3 result[]; 126 | result.resize(accuracy+2); 127 | result[0] = v0; 128 | result[result.size()-1] = v1; 129 | 130 | Scalar l = v0.distanceTo(v1); 131 | Scalar m; 132 | Scalar H = inH; 133 | Vec3 catenary; 134 | 135 | switch(mode){ 136 | case 0: 137 | for(Integer i=1; i>>( 34 | io Ref dijkstra, 35 | in PolygonMeshTopology mesh, 36 | in Vec3 positions[], 37 | in Boolean includeAllPolygonPoints 38 | ){ 39 | // ポイントからエッジでつながった隣のポイントIDリストを取得 40 | // includeAllPolygonPointsはポリゴンの対角ポイントも含めるか否か 41 | mesh.getPointSurroundingPoints(index, includeAllPolygonPoints, dijkstra.vertex[index].surroundingVertex); 42 | // 取得した各ポイントへの距離を格納していく 43 | dijkstra.vertex[index].toVertexCost.resize( dijkstra.vertex[index].surroundingVertex.count ); 44 | for(Integer i=0; i posAttr = mesh.getAttributes().positionsAttribute; 67 | SetGraphFromPolygonMeshTask<<>>(this, mesh.topology, posAttr.values,, includeAllPolygonPoints); 68 | this.setedVertex = true; 69 | } 70 | // ダイクストラ法グラフのスタートを設定し、指定した距離内でバーテックスへの移動コストを計算し経路図を作る 71 | // 順次範囲を広げていきmaxDistanceの範囲外になった頂点は計算対象外になるので、不要な計算コストはかかっていない 72 | function DijkstraGraph.computeRouteCost!(String startVertexIDs[], Scalar maxDistance){ 73 | if(maxDistance <= 0.0){ 74 | return; 75 | } 76 | // グラフの生成が終わっていない場合はエラー 77 | if(!this.setedVertex){ 78 | setError("DijkstraGraph.computeRouteCost node : this DijkstraGraph not yet set vertex. have to do for example 'DijkstraGraph.setFromPolygonMesh'"); 79 | return; 80 | } 81 | // それぞれのスタート地点からコスト計算を行っていき、コストが小さくなる場合のみコストの更新を行う 82 | for(Integer h=0; h 0){ 157 | result.push(this[i]); 158 | } 159 | } 160 | this = result; 161 | } 162 | } 163 | " 164 | } 165 | } 166 | ], 167 | "connections" : { 168 | "this" : [ 169 | "Split_1.this" 170 | ], 171 | "separator" : [ 172 | "Split_1.separator" 173 | ], 174 | "deletBlank" : [ 175 | "DeleteBlank.deletBlank" 176 | ], 177 | "Split_1.result" : [ 178 | "DeleteBlank.this" 179 | ], 180 | "DeleteBlank.this" : [ 181 | "result" 182 | ] 183 | }, 184 | "requiredPresets" : { 185 | "Fabric.Exts.Util.String.Split" : { 186 | "objectType" : "Func", 187 | "metadata" : { 188 | "uiTooltip" : "splitting this string by a given separator\n\n Supported by String" 189 | }, 190 | "title" : "Split", 191 | "ports" : [ 192 | { 193 | "objectType" : "ExecPort", 194 | "name" : "exec", 195 | "nodePortType" : "IO", 196 | "execPortType" : "IO", 197 | "typeSpec" : "Execute" 198 | }, 199 | { 200 | "objectType" : "ExecPort", 201 | "name" : "this", 202 | "nodePortType" : "Out", 203 | "execPortType" : "In", 204 | "typeSpec" : "String" 205 | }, 206 | { 207 | "objectType" : "ExecPort", 208 | "name" : "separator", 209 | "nodePortType" : "Out", 210 | "execPortType" : "In", 211 | "typeSpec" : "String" 212 | }, 213 | { 214 | "objectType" : "ExecPort", 215 | "name" : "result", 216 | "nodePortType" : "In", 217 | "execPortType" : "Out", 218 | "typeSpec" : "String[]" 219 | } 220 | ], 221 | "extDeps" : { 222 | "Util" : "*" 223 | }, 224 | "presetGUID" : "E09CFC151D7658D0FD0EAA6DB4FFB18B", 225 | "code" : "require Util; 226 | 227 | dfgEntry { 228 | result = this.split(separator); 229 | } 230 | " 231 | } 232 | } 233 | } -------------------------------------------------------------------------------- /DFG/Manipulation/ArrayValueManip/AddXfoOriArrayManip.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "objectType" : "Func", 3 | "metadata" : { 4 | "uiDocUrl" : "http://docs.fabric-engine.com/FabricEngine/2.4.0/HTML/KLExtensionsGuide/Manipulation/ManipHandle.html", 5 | "uiTooltip" : "Registers a single position manipulator if it doesn't exist yet\n\nSupported types:\n this: ManipHandle\n name: String\n mesh: PolygonMesh\n pos: Vec3\n color: Color\n size: Scalar\n parentInstance: InlineInstance\n portToDrive: String\n hostGraphName: String\n instance: InlineInstance\n" 6 | }, 7 | "title" : "AddXfoOriArrayManip", 8 | "ports" : [ 9 | { 10 | "objectType" : "ExecPort", 11 | "name" : "exec", 12 | "nodePortType" : "IO", 13 | "defaultValues" : { 14 | "Execute" : {} 15 | }, 16 | "execPortType" : "IO", 17 | "typeSpec" : "Execute" 18 | }, 19 | { 20 | "objectType" : "ExecPort", 21 | "name" : "this", 22 | "nodePortType" : "IO", 23 | "defaultValues" : { 24 | "ArrayValueManipHandle" : null 25 | }, 26 | "execPortType" : "IO", 27 | "typeSpec" : "ArrayValueManipHandle" 28 | }, 29 | { 30 | "objectType" : "ExecPort", 31 | "name" : "XfoValues", 32 | "nodePortType" : "IO", 33 | "defaultValues" : { 34 | "Quat[]" : [], 35 | "Xfo[]" : [] 36 | }, 37 | "execPortType" : "IO", 38 | "typeSpec" : "Xfo[]" 39 | }, 40 | { 41 | "objectType" : "ExecPort", 42 | "name" : "manipulatorName", 43 | "nodePortType" : "Out", 44 | "defaultValues" : { 45 | "String" : "xfoOriManip" 46 | }, 47 | "execPortType" : "In", 48 | "typeSpec" : "String" 49 | }, 50 | { 51 | "objectType" : "ExecPort", 52 | "metadata" : { 53 | "uiCombo" : "(\"XYZ\", \"Axis\")" 54 | }, 55 | "name" : "manipulatorMode", 56 | "nodePortType" : "Out", 57 | "defaultValues" : { 58 | "Integer" : 1 59 | }, 60 | "execPortType" : "In", 61 | "typeSpec" : "Integer" 62 | }, 63 | { 64 | "objectType" : "ExecPort", 65 | "name" : "axis", 66 | "nodePortType" : "Out", 67 | "defaultValues" : { 68 | "Vec3" : { 69 | "x" : 0, 70 | "y" : 0, 71 | "z" : 1 72 | } 73 | }, 74 | "execPortType" : "In", 75 | "typeSpec" : "Vec3" 76 | }, 77 | { 78 | "objectType" : "ExecPort", 79 | "metadata" : { 80 | "uiColor" : "{\n \"r\" : 51,\n \"g\" : 1,\n \"b\" : 106\n }" 81 | }, 82 | "name" : "manipulatorMesh", 83 | "nodePortType" : "Out", 84 | "defaultValues" : { 85 | "PolygonMesh" : null 86 | }, 87 | "execPortType" : "In", 88 | "typeSpec" : "PolygonMesh" 89 | }, 90 | { 91 | "objectType" : "ExecPort", 92 | "metadata" : { 93 | "uiColor" : "{\n \"r\" : 255,\n \"g\" : 0,\n \"b\" : 0\n }" 94 | }, 95 | "name" : "manipulatorColor", 96 | "nodePortType" : "Out", 97 | "defaultValues" : { 98 | "Color" : { 99 | "r" : 0.04313725605607033, 100 | "g" : 0.4745098054409027, 101 | "b" : 1, 102 | "a" : 1 103 | } 104 | }, 105 | "execPortType" : "In", 106 | "typeSpec" : "Color" 107 | }, 108 | { 109 | "objectType" : "ExecPort", 110 | "name" : "manipulatorSize", 111 | "nodePortType" : "Out", 112 | "defaultValues" : { 113 | "Scalar" : 0.5 114 | }, 115 | "execPortType" : "In", 116 | "typeSpec" : "Scalar" 117 | }, 118 | { 119 | "objectType" : "ExecPort", 120 | "name" : "parentInstance", 121 | "nodePortType" : "Out", 122 | "defaultValues" : { 123 | "InlineInstance" : null 124 | }, 125 | "execPortType" : "In", 126 | "typeSpec" : "InlineInstance" 127 | }, 128 | { 129 | "objectType" : "ExecPort", 130 | "metadata" : { 131 | "uiCombo" : "(\"non\", \"evalCavasNode\")" 132 | }, 133 | "name" : "callCommand", 134 | "nodePortType" : "Out", 135 | "defaultValues" : { 136 | "Integer" : 0 137 | }, 138 | "execPortType" : "In", 139 | "typeSpec" : "Integer" 140 | }, 141 | { 142 | "objectType" : "ExecPort", 143 | "name" : "hostGraphName", 144 | "nodePortType" : "Out", 145 | "defaultValues" : { 146 | "String" : "canvasNode1" 147 | }, 148 | "execPortType" : "In", 149 | "typeSpec" : "String" 150 | }, 151 | { 152 | "objectType" : "ExecPort", 153 | "name" : "portName", 154 | "nodePortType" : "Out", 155 | "defaultValues" : { 156 | "String" : "eval" 157 | }, 158 | "execPortType" : "In", 159 | "typeSpec" : "String" 160 | }, 161 | { 162 | "objectType" : "ExecPort", 163 | "name" : "eval", 164 | "nodePortType" : "Out", 165 | "defaultValues" : { 166 | "Scalar" : 0 167 | }, 168 | "execPortType" : "In", 169 | "typeSpec" : "Scalar" 170 | }, 171 | { 172 | "objectType" : "ExecPort", 173 | "name" : "instance", 174 | "nodePortType" : "In", 175 | "defaultValues" : { 176 | "InlineInstance" : null 177 | }, 178 | "execPortType" : "Out", 179 | "typeSpec" : "InlineInstance" 180 | } 181 | ], 182 | "extDeps" : { 183 | "Manipulation" : "*", 184 | "TKCM" : "*" 185 | }, 186 | "presetGUID" : "E8755D025D6D5FBC531C15124C3AEA29", 187 | "code" : "dfgEntry { 188 | if(this == null){ 189 | this = ArrayValueManipHandle(); 190 | } 191 | 192 | switch(manipulatorMode){ 193 | case 0: // XYZ 194 | for(Integer i=0; i