Package imgui.extension.nodeditor
Class NodeEditor
java.lang.Object
imgui.extension.nodeditor.NodeEditor
Bindings for Imgui Node Editor (https://github.com/thedmd/imgui-node-editor)
Original library author - Michał Cichoń (https://github.com/thedmd)
An implementation of node editor with ImGui-like API. Project purpose is to serve as a basis for more complex solutions like blueprint editors.
Refer to the library's Github page for examples and support
Before you can start drawing editor you have to create ImNodeEditorContext (either by invoking constructor directly or using ImNodeEditor.createEditor()) and switch current editor via ImNodeEditor.setCurrentEditor(NodeEditorContext)
Binding notice: instead of special types for ids of nodes, links and pins which used in native library we use longs to reduce boilerplate and garbage production
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanstatic booleanstatic booleanstatic booleanacceptDeletedItem(boolean deleteDependencies) static booleanstatic booleanstatic booleanacceptNewItem(float colorX, float colorY, float colorZ, float colorW) static booleanacceptNewItem(float colorX, float colorY, float colorZ, float colorW, float thickness) static booleanacceptNewItem(ImVec4 color) static booleanacceptNewItem(ImVec4 color, float thickness) static booleanstatic booleanstatic voidstatic voidstatic voidstatic booleanstatic booleanbeginCreate(float thickness) static booleanbeginCreate(float colorX, float colorY, float colorZ, float colorW) static booleanbeginCreate(float colorX, float colorY, float colorZ, float colorW, float thickness) static booleanbeginCreate(ImVec4 color) static booleanbeginCreate(ImVec4 color, float thickness) static booleanstatic booleanbeginGroupHint(long nodeId) static voidbeginNode(long id) static voidbeginPin(long id, int kind) static booleanstatic intbreakLinksNode(long nodeId) static intbreakLinksPin(long pinId) static ImVec2canvasToScreen(float posX, float posY) static ImVec2canvasToScreen(ImVec2 pos) static voidcanvasToScreen(ImVec2 dst, float posX, float posY) static voidcanvasToScreen(ImVec2 dst, ImVec2 pos) static floatcanvasToScreenX(ImVec2 pos) static floatcanvasToScreenY(ImVec2 pos) static voidcenterNodeOnScreen(long nodeId) static voidstatic NodeEditorContextstatic NodeEditorContextcreateEditor(NodeEditorConfig config) static booleandeleteLink(long linkId) static booleandeleteNode(long nodeId) static voiddeselectLink(long linkId) static voiddeselectNode(long nodeId) static voidstatic voidenableShortcuts(boolean enable) static voidend()static voidstatic voidstatic voidstatic voidendNode()static voidendPin()static voidstatic voidflow(long linkId) static voidflow(long linkId, int direction) static intgetActionContextLinks(long[] links, int size) static intgetActionContextNodes(long[] nodes, int size) static intstatic NodeEditorContextstatic floatstatic longstatic longstatic longstatic ImVec2static voidgetGroupMax(ImVec2 dst) static floatstatic floatstatic ImVec2static voidgetGroupMin(ImVec2 dst) static floatstatic floatstatic ImDrawListstatic ImDrawListstatic longstatic longstatic longstatic booleangetLinkPins(long linkId, ImLong startPinId, ImLong endPinId) static longstatic ImDrawListgetNodeBackgroundDrawList(long nodeId) static intstatic ImVec2getNodePosition(long nodeId) static voidgetNodePosition(ImVec2 dst, long nodeId) static floatgetNodePositionX(long nodeId) static floatgetNodePositionY(long nodeId) static ImVec2getNodeSize(long nodeId) static voidgetNodeSize(ImVec2 dst, long nodeId) static floatgetNodeSizeX(long nodeId) static floatgetNodeSizeY(long nodeId) static longstatic floatgetNodeZPosition(long nodeId) static intgetOrderedNodeIds(long[] nodes, int size) static longstatic ImVec2static voidgetScreenSize(ImVec2 dst) static floatstatic floatstatic intgetSelectedLinks(long[] links, int size) static intgetSelectedNodes(long[] nodes, int size) static intstatic NodeEditorStylegetStyle()static StringgetStyleColorName(int colorIndex) static voidgroup(float sizeX, float sizeY) static voidstatic booleanhasAnyLinksNode(long nodeId) static booleanhasAnyLinksPin(long pinId) static booleanstatic booleanisActive()static booleanstatic booleanstatic booleanisLinkSelected(long linkId) static booleanisNodeSelected(long nodeId) static booleanstatic booleanlink(long id, long startPinId, long endPinId) static booleanlink(long id, long startPinId, long endPinId, float thickness) static booleanlink(long id, long startPinId, long endPinId, float colorX, float colorY, float colorZ, float colorW) static booleanlink(long id, long startPinId, long endPinId, float colorX, float colorY, float colorZ, float colorW, float thickness) static booleanstatic booleanstatic voidstatic voidnavigateToContent(float duration) static voidstatic voidnavigateToSelection(boolean zoomIn) static voidnavigateToSelection(boolean zoomIn, float duration) static voidnavigateToSelection(float duration) static booleanpinHadAnyLinks(long pinId) static voidpinPivotAlignment(float alignmentX, float alignmentY) static voidpinPivotAlignment(ImVec2 alignment) static voidpinPivotRect(float aX, float aY, float bX, float bY) static voidpinPivotRect(ImVec2 a, ImVec2 b) static voidpinPivotScale(float scaleX, float scaleY) static voidpinPivotScale(ImVec2 scale) static voidpinPivotSize(float sizeX, float sizeY) static voidpinPivotSize(ImVec2 size) static voidpinRect(float aX, float aY, float bX, float bY) static voidstatic voidstatic voidpopStyleColor(int count) static voidstatic voidpopStyleVar(int count) static voidpushStyleColor(int colorIndex, float colorX, float colorY, float colorZ, float colorW) static voidpushStyleColor(int colorIndex, ImVec4 color) static voidpushStyleVar(int varIndex, float value) static voidpushStyleVar(int varIndex, float valueX, float valueY) static voidpushStyleVar(int varIndex, float valueX, float valueY, float valueZ, float valueW) static voidpushStyleVar(int varIndex, ImVec2 value) static voidpushStyleVar(int varIndex, ImVec4 value) static booleanqueryDeletedLink(ImLong linkId) static booleanqueryDeletedLink(ImLong linkId, ImLong startId) static booleanqueryDeletedLink(ImLong linkId, ImLong startId, ImLong endId) static booleanqueryDeletedNode(ImLong nodeId) static booleanqueryNewLink(ImLong startId, ImLong endId) static booleanqueryNewLink(ImLong startId, ImLong endId, float colorX, float colorY, float colorZ, float colorW) static booleanqueryNewLink(ImLong startId, ImLong endId, float colorX, float colorY, float colorZ, float colorW, float thickness) static booleanqueryNewLink(ImLong startId, ImLong endId, ImVec4 color) static booleanqueryNewLink(ImLong startId, ImLong endId, ImVec4 color, float thickness) static booleanqueryNewNode(ImLong pinId) static booleanqueryNewNode(ImLong pinId, float colorX, float colorY, float colorZ, float colorW) static booleanqueryNewNode(ImLong pinId, float colorX, float colorY, float colorZ, float colorW, float thickness) static booleanqueryNewNode(ImLong pinId, ImVec4 color) static booleanqueryNewNode(ImLong pinId, ImVec4 color, float thickness) static voidstatic voidstatic voidrejectNewItem(float colorX, float colorY, float colorZ, float colorW) static voidrejectNewItem(float colorX, float colorY, float colorZ, float colorW, float thickness) static voidrejectNewItem(ImVec4 color) static voidrejectNewItem(ImVec4 color, float thickness) static voidrestoreNodeState(long nodeId) static voidresume()static ImVec2screenToCanvas(float posX, float posY) static ImVec2screenToCanvas(ImVec2 pos) static voidscreenToCanvas(ImVec2 dst, float posX, float posY) static voidscreenToCanvas(ImVec2 dst, ImVec2 pos) static floatscreenToCanvasX(ImVec2 pos) static floatscreenToCanvasY(ImVec2 pos) static voidselectLink(long linkId) static voidselectLink(long linkId, boolean append) static voidselectNode(long nodeId) static voidselectNode(long nodeId, boolean append) static voidstatic voidsetGroupSize(long nodeId, float sizeX, float sizeY) static voidsetGroupSize(long nodeId, ImVec2 size) static voidsetNodePosition(long nodeId, float editorPositionX, float editorPositionY) static voidsetNodePosition(long nodeId, ImVec2 editorPosition) static voidsetNodeZPosition(long nodeId, float z) static booleanstatic booleanshowLinkContextMenu(ImLong linkId) static booleanshowNodeContextMenu(ImLong nodeId) static booleanshowPinContextMenu(ImLong pinId) static voidsuspend()
-
Method Details
-
setCurrentEditor
-
getCurrentEditor
-
createEditor
-
createEditor
-
destroyEditor
-
getStyle
-
getStyleColorName
-
pushStyleColor
-
pushStyleColor
public static void pushStyleColor(int colorIndex, float colorX, float colorY, float colorZ, float colorW) -
popStyleColor
public static void popStyleColor() -
popStyleColor
public static void popStyleColor(int count) -
pushStyleVar
public static void pushStyleVar(int varIndex, float value) -
pushStyleVar
-
pushStyleVar
public static void pushStyleVar(int varIndex, float valueX, float valueY) -
pushStyleVar
-
pushStyleVar
public static void pushStyleVar(int varIndex, float valueX, float valueY, float valueZ, float valueW) -
popStyleVar
public static void popStyleVar() -
popStyleVar
public static void popStyleVar(int count) -
begin
-
begin
-
begin
-
end
public static void end() -
beginNode
public static void beginNode(long id) -
beginPin
public static void beginPin(long id, int kind) -
pinRect
-
pinRect
public static void pinRect(float aX, float aY, float bX, float bY) -
pinPivotRect
-
pinPivotRect
public static void pinPivotRect(float aX, float aY, float bX, float bY) -
pinPivotSize
-
pinPivotSize
public static void pinPivotSize(float sizeX, float sizeY) -
pinPivotScale
-
pinPivotScale
public static void pinPivotScale(float scaleX, float scaleY) -
pinPivotAlignment
-
pinPivotAlignment
public static void pinPivotAlignment(float alignmentX, float alignmentY) -
endPin
public static void endPin() -
group
-
group
public static void group(float sizeX, float sizeY) -
endNode
public static void endNode() -
beginGroupHint
public static boolean beginGroupHint(long nodeId) -
getGroupMin
-
getGroupMinX
public static float getGroupMinX() -
getGroupMinY
public static float getGroupMinY() -
getGroupMin
-
getGroupMax
-
getGroupMaxX
public static float getGroupMaxX() -
getGroupMaxY
public static float getGroupMaxY() -
getGroupMax
-
getHintForegroundDrawList
-
getHintBackgroundDrawList
-
endGroupHint
public static void endGroupHint() -
getNodeBackgroundDrawList
-
link
public static boolean link(long id, long startPinId, long endPinId) -
link
-
link
public static boolean link(long id, long startPinId, long endPinId, float colorX, float colorY, float colorZ, float colorW) -
link
-
link
public static boolean link(long id, long startPinId, long endPinId, float colorX, float colorY, float colorZ, float colorW, float thickness) -
link
public static boolean link(long id, long startPinId, long endPinId, float thickness) -
flow
public static void flow(long linkId) -
flow
public static void flow(long linkId, int direction) -
beginCreate
public static boolean beginCreate() -
beginCreate
-
beginCreate
public static boolean beginCreate(float colorX, float colorY, float colorZ, float colorW) -
beginCreate
-
beginCreate
public static boolean beginCreate(float colorX, float colorY, float colorZ, float colorW, float thickness) -
beginCreate
public static boolean beginCreate(float thickness) -
queryNewLink
-
queryNewLink
-
queryNewLink
-
queryNewLink
-
queryNewLink
-
queryNewNode
-
queryNewNode
-
queryNewNode
public static boolean queryNewNode(ImLong pinId, float colorX, float colorY, float colorZ, float colorW) -
queryNewNode
-
queryNewNode
public static boolean queryNewNode(ImLong pinId, float colorX, float colorY, float colorZ, float colorW, float thickness) -
acceptNewItem
public static boolean acceptNewItem() -
acceptNewItem
-
acceptNewItem
public static boolean acceptNewItem(float colorX, float colorY, float colorZ, float colorW) -
acceptNewItem
-
acceptNewItem
public static boolean acceptNewItem(float colorX, float colorY, float colorZ, float colorW, float thickness) -
rejectNewItem
public static void rejectNewItem() -
rejectNewItem
-
rejectNewItem
public static void rejectNewItem(float colorX, float colorY, float colorZ, float colorW) -
rejectNewItem
-
rejectNewItem
public static void rejectNewItem(float colorX, float colorY, float colorZ, float colorW, float thickness) -
endCreate
public static void endCreate() -
beginDelete
public static boolean beginDelete() -
queryDeletedLink
-
queryDeletedLink
-
queryDeletedLink
-
queryDeletedNode
-
acceptDeletedItem
public static boolean acceptDeletedItem() -
acceptDeletedItem
public static boolean acceptDeletedItem(boolean deleteDependencies) -
rejectDeletedItem
public static void rejectDeletedItem() -
endDelete
public static void endDelete() -
setNodePosition
-
setNodePosition
public static void setNodePosition(long nodeId, float editorPositionX, float editorPositionY) -
setGroupSize
-
setGroupSize
public static void setGroupSize(long nodeId, float sizeX, float sizeY) -
getNodePosition
-
getNodePositionX
public static float getNodePositionX(long nodeId) -
getNodePositionY
public static float getNodePositionY(long nodeId) -
getNodePosition
-
getNodeSize
-
getNodeSizeX
public static float getNodeSizeX(long nodeId) -
getNodeSizeY
public static float getNodeSizeY(long nodeId) -
getNodeSize
-
centerNodeOnScreen
public static void centerNodeOnScreen(long nodeId) -
setNodeZPosition
public static void setNodeZPosition(long nodeId, float z) -
getNodeZPosition
public static float getNodeZPosition(long nodeId) -
restoreNodeState
public static void restoreNodeState(long nodeId) -
suspend
public static void suspend() -
resume
public static void resume() -
isSuspended
public static boolean isSuspended() -
isActive
public static boolean isActive() -
hasSelectionChanged
public static boolean hasSelectionChanged() -
getSelectedObjectCount
public static int getSelectedObjectCount() -
getSelectedNodes
public static int getSelectedNodes(long[] nodes, int size) -
getSelectedLinks
public static int getSelectedLinks(long[] links, int size) -
isNodeSelected
public static boolean isNodeSelected(long nodeId) -
isLinkSelected
public static boolean isLinkSelected(long linkId) -
clearSelection
public static void clearSelection() -
selectNode
public static void selectNode(long nodeId) -
selectNode
public static void selectNode(long nodeId, boolean append) -
selectLink
public static void selectLink(long linkId) -
selectLink
public static void selectLink(long linkId, boolean append) -
deselectNode
public static void deselectNode(long nodeId) -
deselectLink
public static void deselectLink(long linkId) -
deleteNode
public static boolean deleteNode(long nodeId) -
deleteLink
public static boolean deleteLink(long linkId) -
hasAnyLinksNode
public static boolean hasAnyLinksNode(long nodeId) -
hasAnyLinksPin
public static boolean hasAnyLinksPin(long pinId) -
breakLinksNode
public static int breakLinksNode(long nodeId) -
breakLinksPin
public static int breakLinksPin(long pinId) -
showNodeContextMenu
-
showPinContextMenu
-
showLinkContextMenu
-
getNodeWithContextMenu
public static long getNodeWithContextMenu() -
getPinWithContextMenu
public static long getPinWithContextMenu() -
getLinkWithContextMenu
public static long getLinkWithContextMenu() -
showBackgroundContextMenu
public static boolean showBackgroundContextMenu() -
enableShortcuts
public static void enableShortcuts(boolean enable) -
areShortcutsEnabled
public static boolean areShortcutsEnabled() -
beginShortcut
public static boolean beginShortcut() -
acceptCut
public static boolean acceptCut() -
acceptCopy
public static boolean acceptCopy() -
acceptPaste
public static boolean acceptPaste() -
acceptDuplicate
public static boolean acceptDuplicate() -
acceptCreateNode
public static boolean acceptCreateNode() -
getActionContextSize
public static int getActionContextSize() -
getActionContextNodes
public static int getActionContextNodes(long[] nodes, int size) -
getActionContextLinks
public static int getActionContextLinks(long[] links, int size) -
endShortcut
public static void endShortcut() -
getCurrentZoom
public static float getCurrentZoom() -
getHoveredNode
public static long getHoveredNode() -
getHoveredPin
public static long getHoveredPin() -
getHoveredLink
public static long getHoveredLink() -
getDoubleClickedNode
public static long getDoubleClickedNode() -
getDoubleClickedPin
public static long getDoubleClickedPin() -
getDoubleClickedLink
public static long getDoubleClickedLink() -
isBackgroundClicked
public static boolean isBackgroundClicked() -
isBackgroundDoubleClicked
public static boolean isBackgroundDoubleClicked() -
getLinkPins
-
pinHadAnyLinks
public static boolean pinHadAnyLinks(long pinId) -
getScreenSize
-
getScreenSizeX
public static float getScreenSizeX() -
getScreenSizeY
public static float getScreenSizeY() -
getScreenSize
-
screenToCanvas
-
screenToCanvas
-
screenToCanvasX
-
screenToCanvasY
-
screenToCanvas
-
screenToCanvas
-
canvasToScreen
-
canvasToScreen
-
canvasToScreenX
-
canvasToScreenY
-
canvasToScreen
-
canvasToScreen
-
getNodeCount
public static int getNodeCount() -
getOrderedNodeIds
public static int getOrderedNodeIds(long[] nodes, int size)
-