repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
effects-runtime
github_2023
galacean
typescript
ExampleAppConsole.TextEditCallbackStub
static TextEditCallbackStub (data: ImGui.InputTextCallbackData<ExampleAppConsole>): int { const console: ExampleAppConsole | null = data.UserData; ImGui.ASSERT(console); return console.TextEditCallback(data); }
// In C++11 you'd be better off using lambdas for this sort of forwarding callbacks
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6123-L6129
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ExampleAppLog.constructor
constructor () { this.AutoScroll = true; this.Clear(); }
// Keep scrolling if already at the bottom.
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6249-L6252
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppLog
function ShowExampleAppLog (p_open: ImGui.Access<boolean>): void { const log = STATIC<ExampleAppLog>(UNIQUE('log#64c1f1c1'), new ExampleAppLog()); // For the demo: add a debug button _BEFORE_ the normal log window contents // We take advantage of a rarely used feature: multiple calls to Begin()/End() are appendi...
// Demonstrate creating a simple log window with basic filtering.
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6360-L6385
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppLayout
function ShowExampleAppLayout (p_open: ImGui.Access<boolean>): void { ImGui.SetNextWindowSize(new ImGui.Vec2(500, 440), ImGui.Cond.FirstUseEver); if (ImGui.Begin('Example: Simple layout', p_open, ImGui.WindowFlags.MenuBar)) { if (ImGui.BeginMenuBar()) { if (ImGui.BeginMenu('File')) { if (ImGui.Men...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6392-L6442
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowPlaceholderObject
function ShowPlaceholderObject (prefix: string, uid: int): void { // Use object uid as identifier. Most commonly you could also use the object pointer as a base ID. ImGui.PushID(uid); // Text and Tree nodes are less high than framed widgets, using AlignTextToFramePadding() we add vertical spacing to make the tre...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6448-L6487
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppPropertyEditor
function ShowExampleAppPropertyEditor (p_open: ImGui.Access<boolean>): void { ImGui.SetNextWindowSize(new ImGui.Vec2(430, 450), ImGui.Cond.FirstUseEver); if (!ImGui.Begin('Example: Property editor', p_open)) { ImGui.End(); return; } HelpMarker( 'This example shows how you may implement a property ...
// Demonstrate create a simple property editor.
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6490-L6515
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppLongText
function ShowExampleAppLongText (p_open: ImGui.Access<boolean>): void { ImGui.SetNextWindowSize(new ImGui.Vec2(520, 600), ImGui.Cond.FirstUseEver); if (!ImGui.Begin('Example: Long text display', p_open)) { ImGui.End(); return; } const test_type = STATIC<int>(UNIQUE('test_type#744ee350'), 0); const l...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6522-L6578
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppAutoResize
function ShowExampleAppAutoResize (p_open: ImGui.Access<boolean>): void { if (!ImGui.Begin('Example: Auto-resizing window', p_open, ImGui.WindowFlags.AlwaysAutoResize)) { ImGui.End(); return; } const lines = STATIC<int>(UNIQUE('lines#5ebf3fd4'), 10); ImGui.TextUnformatted( 'Window will resize eve...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6585-L6601
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppConstrainedResize
function ShowExampleAppConstrainedResize (p_open: ImGui.Access<boolean>): void { class CustomConstraints { // Helper functions to demonstrate programmatic constraints static Square<T>(data: ImGui.SizeCallbackData<T>): void { data.DesiredSize.x = data.DesiredSize.y = IM_MAX(data.DesiredSize.x, data.DesiredSize...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6608-L6656
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
CustomConstraints.Square
static Square<T>(data: ImGui.SizeCallbackData<T>): void { data.DesiredSize.x = data.DesiredSize.y = IM_MAX(data.DesiredSize.x, data.DesiredSize.y); }
// Helper functions to demonstrate programmatic constraints
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6611-L6611
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppSimpleOverlay
function ShowExampleAppSimpleOverlay (p_open: ImGui.Access<boolean>): void { const DISTANCE: float = 10.0; const corner = STATIC<int>(UNIQUE('corner#63044b6f'), 0); const io: ImGui.IO = ImGui.GetIO(); let window_flags: ImGui.WindowFlags = ImGui.WindowFlags.NoDecoration | ImGui.WindowFlags.AlwaysAutoResize | ImG...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6664-L6693
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppWindowTitles
function ShowExampleAppWindowTitles (p_open: ImGui.Access<boolean>): void { // By default, Windows are uniquely identified by their title. // You can use the "##" and "###" markers to manipulate the display/ID. // Using "##" to display same title but have unique identifier. ImGui.SetNextWindowPos(new ImGui.Vec...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6702-L6724
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppCustomRendering
function ShowExampleAppCustomRendering (p_open: ImGui.Access<boolean>): void { if (!ImGui.Begin('Example: Custom rendering', p_open)) { ImGui.End(); return; } // Tip: If you do a lot of custom rendering, you probably want to use your own geometrical types and benefit of // overloaded operators, etc. D...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6731-L6962
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppDockspace
function ShowExampleAppDockspace (p_open: ImGui.Access<boolean>): void { // In 99% case you should be able to just call DockSpaceOverViewport() and ignore all the code below! // In this specific demo, we are not using DockSpaceOverViewport() because: // - we allow the host window to be floating/moveable instead o...
//-----------------------------------------------------------------------------
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L6982-L7082
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ShowExampleAppDockspaceAlt
function ShowExampleAppDockspaceAlt (p_open: ImGui.Access<boolean>): void { const dockspace_flags = STATIC('dockspace_flags#dockspace', ImGui.DockNodeFlags.None); // DockSpace const io = ImGui.GetIO(); if (ImGui.BeginMainMenuBar()) { if (ImGui.BeginMenu('Options')) { if (ImGui.MenuItem('Flag: NoSpli...
// An alternative way of creating a main dockspace.
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L7085-L7138
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MyDocument.constructor
constructor (name: string, open: boolean = true, color: ImGui.Vec4 = new ImGui.Vec4(1.0, 1.0, 1.0, 1.0)) { this.ID = MyDocument.ID++; this.Name = name; this.Open = this.OpenPrev = open; this.Dirty = false; this.WantClose = false; this.Color = color; }
// An arbitrary variable associated to the document
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L7155-L7162
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MyDocument.DisplayContents
static DisplayContents (doc: MyDocument): void { ImGui.PushID(doc.ID); ImGui.Text(`Document "${doc.Name}"`); ImGui.PushStyleColor(ImGui.Col.Text, doc.Color); ImGui.TextWrapped('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'); ...
// Display placeholder contents for the Document
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L7169-L7180
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MyDocument.DisplayContextMenu
static DisplayContextMenu (doc: MyDocument): void { if (!ImGui.BeginPopupContextItem()) {return;} const buf: string = `Save ${doc.Name}`; if (ImGui.MenuItem(buf, 'CTRL+S', false, doc.Open)) {doc.DoSave();} if (ImGui.MenuItem('Close', 'CTRL+W', false, doc.Open)) {doc.DoQueueClose();} ImGui.EndPopup...
// Display context menu for the Document
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L7183-L7191
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
NotifyOfDocumentsClosedElsewhere
function NotifyOfDocumentsClosedElsewhere (app: ExampleAppDocuments): void { for (let doc_n = 0; doc_n < app.Documents.Size; doc_n++) { const doc: MyDocument = app.Documents[doc_n]; if (!doc.Open && doc.OpenPrev) {ImGui.SetTabItemClosed(doc.Name);} doc.OpenPrev = doc.Open; } }
// [Optional] Notify the system of Tabs/Windows closure that happened outside the regular tab interface.
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_demo.ts#L7215-L7222
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MemoryEditor.DrawWindow
public DrawWindow (title: string, mem_data: ArrayBuffer, mem_size: number = mem_data.byteLength, base_display_addr: number = 0x0000): void { const s: MemoryEditor.Sizes = new MemoryEditor.Sizes(); this.CalcSizes(s, mem_size, base_display_addr); ImGui.SetNextWindowSizeConstraints(new ImGui.Vec2(0.0, 0.0), n...
// Standalone Memory Editor window
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L159-L175
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MemoryEditor.DrawContents
public DrawContents (mem_data: ArrayBuffer, mem_size: number = mem_data.byteLength, base_display_addr: number = 0x0000): void { if (this.Cols < 1) {this.Cols = 1;} // ImU8* mem_data = (ImU8*)mem_data_void; const s: MemoryEditor.Sizes = new MemoryEditor.Sizes(); this.CalcSizes(s, mem_size, base_display...
// void DrawContents(void* mem_data_void, size_t mem_size, size_t base_display_addr = 0x0000)
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L179-L432
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
format_address
const format_address = (n: number, a: number): string => { let s = a.toString(16).padStart(n, '0'); if (this.OptUpperCaseHex) { s = s.toUpperCase(); } return s; };
// const char* format_address = this.OptUpperCaseHex ? "%0*" _PRISizeT "X: " : "%0*" _PRISizeT "x: ";
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L242-L248
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
format_data
const format_data = (n: number, a: number): string => { let s = a.toString(16).padStart(n, '0'); if (this.OptUpperCaseHex) { s = s.toUpperCase(); } return s; };
// const char* format_data = this.OptUpperCaseHex ? "%0*" _PRISizeT "X" : "%0*" _PRISizeT "x";
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L250-L256
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
format_byte
const format_byte = (b: number): string => { let s = b.toString(16).padStart(2, '0'); if (this.OptUpperCaseHex) { s = s.toUpperCase(); } return s; };
// const char* format_byte = this.OptUpperCaseHex ? "%02X" : "%02x";
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L258-L264
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
format_byte_space
const format_byte_space = (b: number): string => { return `${format_byte(b)} `; };
// const char* format_byte_space = this.OptUpperCaseHex ? "%02X " : "%02x ";
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L266-L268
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
UserData.Callback
static Callback (data: ImGui.InputTextCallbackData<UserData>) { const user_data: UserData | null = data.UserData; ImGui.ASSERT(user_data !== null); if (!data.HasSelection()) {user_data.CursorPos = data.CursorPos;} if (data.SelectionStart === 0 && data.SelectionEn...
// FIXME: We should have a way to retrieve the text edit cursor position more easily in the API, this is rather tedious. This is such a ugly mess we may be better off not using InputText() at all here.
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L316-L331
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
format_range
const format_range = (n_min: number, a_min: number, n_max: number, a_max: number): string => { let s_min = a_min.toString(16).padStart(n_min, '0'); let s_max = a_max.toString(16).padStart(n_max, '0'); if (this.OptUpperCaseHex) { s_min = s_min.toUpperCase(); s_max = s_max.toUpperCase()...
// const char* format_range = OptUpperCaseHex ? "Range %0*" _PRISizeT "X..%0*" _PRISizeT "X" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x";
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L438-L448
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MemoryEditor.DrawPreviewLine
DrawPreviewLine (s: MemoryEditor.Sizes, mem_data: ArrayBuffer, mem_size: size_t, base_display_addr: size_t): void { // IM_UNUSED(base_display_addr); // ImU8* mem_data = (ImU8*)mem_data_void; const style: ImGui.Style = ImGui.GetStyle(); ImGui.AlignTextToFramePadding(); ImGui.Text('Preview as:'); ...
// void DrawPreviewLine(const Sizes& s, void* mem_data_void, size_t mem_size, size_t base_display_addr)
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L495-L528
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MemoryEditor.DataTypeGetDesc
DataTypeGetDesc (data_type: ImGui.DataType): string { const descs: string[] = ['Int8', 'Uint8', 'Int16', 'Uint16', 'Int32', 'Uint32', 'Int64', 'Uint64', 'Float', 'Double']; ImGui.ASSERT(data_type >= 0 && data_type < ImGui.DataType.COUNT); return descs[data_type]; }
// Utilities for Data Preview
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L531-L537
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
MemoryEditor.DrawPreviewData
DrawPreviewData (addr: size_t, mem_data: ArrayBuffer, mem_size: size_t, data_type: ImGui.DataType, data_format: MemoryEditor.DataFormat, out_buf: ImGui.StringBuffer, out_buf_size: size_t): void { // uint8_t buf[8]; const buf = new Uint8Array(8); const elem_size: size_t = this.DataTypeGetSize(data_type); ...
// [Internal]
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/imgui/imgui_memory_editor.ts#L623-L867
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
AssetLock.acquire
async acquire (): Promise<void> { if (this.isLocked) { await new Promise<void>(resolve => this.waitingResolvers.push(resolve)); } this.isLocked = true; }
// 尝试获取锁,如果锁被占用则返回一个会等待锁释放的 Promise
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/project.ts#L23-L28
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
AssetLock.release
release (): void { if (!this.isLocked) { throw new Error('Lock is not acquired yet.'); } this.isLocked = false; const resolve = this.waitingResolvers.shift(); if (resolve) { resolve(); } }
// 释放锁,并通知下一个等待者(如果有的话)
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/project.ts#L31-L43
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
NodeStyle.constructor
constructor ( header_bg: number, header_title_color: ImColor, radius: number ) { this.header_bg = header_bg; this.header_title_color = header_title_color; this.radius = radius; this.padding = new ImGui.ImVec4(13.7, 6.0, 13.7, 2.0); }
// Border thickness when selected
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/base-node.ts#L30-L39
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
NodeStyle.cyan
static cyan (): NodeStyle { return new NodeStyle( ImGui.IM_COL32(71, 142, 173, 255), new ImColor(233, 241, 244, 255), 6.5 ); }
// Static methods for default styles
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/base-node.ts#L42-L48
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
Link.destroy
destroy (): void { this.m_isDestroyed = true; this.m_left.deleteLink(); }
/** * Destruction of a link * Deletes references of this links from connected pins */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/link.ts#L27-L30
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
Link.update
update (): void { const start: ImGui.ImVec2 = this.m_left.pinPoint(); const end: ImGui.ImVec2 = this.m_right.pinPoint(); const windowPos = ImGui.GetWindowPos(); start.x += windowPos.x; start.y += windowPos.y; end.x += windowPos.x; end.y += windowPos.y; let thickness: number = this.m_le...
/** * Main update function * Draws the Link and updates Hovering and Selected status. */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/link.ts#L39-L84
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
Link.getLeft
getLeft (): Pin { return this.m_left; }
/** * Get Left pin of the link * @returns Pointer to the Pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/link.ts#L90-L92
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
Link.getRight
getRight (): Pin { return this.m_right; }
/** * Get Right pin of the link * @returns Pointer to the Pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/link.ts#L98-L100
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
Link.isHovered
isHovered (): boolean { return this.m_hovered; }
/** * Get hovering status * @returns TRUE If the link is hovered in the current frame */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/link.ts#L106-L108
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
Link.isSelected
isSelected (): boolean { return this.m_selected; }
/** * Get selected status * @returns TRUE If the link is selected in the current frame */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/link.ts#L114-L116
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ContainedContext.destroy
destroy (): void { if (this.m_ctx) { ImGui.DestroyContext(this.m_ctx); this.m_ctx = null; } }
/** * 析构函数,用于清理ImGui上下文 */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L77-L82
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ContainedContext.begin
begin (): void { // ImGui.PushID(this.getid); // 使用对象引用作为ID ImGui.PushStyleColor(ImGui.Col.ChildBg, this.m_config.color); // ImGui.BeginChild('view_port', this.m_config.size.clone(), false, ImGuiWindowFlags.NoMove); ImGui.PopStyleColor(); this.m_pos = ImGui.GetWindowPos(); this.m_size = ImGui.G...
/** * 开始渲染一个封闭的ImGui窗口 */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L87-L127
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ContainedContext.end
end (): void { this.m_anyWindowHovered = ImGui.IsWindowHovered(ImGui.HoveredFlags.AnyWindow); if (this.m_config.extra_window_wrapper && ImGui.IsWindowHovered()) { this.m_anyWindowHovered = false; } this.m_anyItemActive = ImGui.IsAnyItemActive(); // if (this.m_config.extra_window_wrapper) { ...
/** * 结束渲染封闭的ImGui窗口 */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L132-L207
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ContainedContext.config
config (): ContainedContextConfig { return this.m_config; }
/** * 获取配置 */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L216-L218
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ContainedContext.scale
scale (): number { return this.m_scale; }
/** * 获取当前缩放比例 */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L223-L225
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ContainedContext.scroll
scroll (): ImVec2 { return this.m_scroll; }
/** * 获取当前滚动偏移 */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L230-L232
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ContainedContext.size
size (): ImVec2 { return this.m_size; }
/** * 获取绘制区域大小 */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L237-L239
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.update
update (): void { // Reset hovered node and dragging status this.m_hovering = null; this.m_hoveredNode = null; this.m_draggingNode = this.m_draggingNodeNext; this.m_singleUseClick = ImGui.IsMouseClicked(ImGui.ImGuiMouseButton.Left); // Begin ImGui context this.m_context.begin(); // ImGu...
/** * Handler loop * Main update function. Refreshes all the logic and draws everything. Must be called every frame. */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L310-L447
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.addNode
addNode<T extends BaseNode>(type: { new(m_inf: ImNodeFlow, ...args: any[]): T }, pos: ImGui.ImVec2, ...args: any[]): T { const node: T = new type(this, ...args); node.setPos(pos); node.setHandler(this); if (!node.getStyle()) { node.setStyle(NodeStyle.cyan()); } node.setUID(this.generateU...
/** * Add a node to the grid * @param type Class constructor of the node * @param pos Position of the Node in grid coordinates * @param args Optional arguments to be forwarded to derived class ctor * @returns Instance of the newly added node */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L456-L469
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.placeNodeAt
placeNodeAt<T extends BaseNode>(type: { new(...args: any[]): T }, pos: ImGui.ImVec2, ...args: any[]): T { return this.addNode(type, this.screen2grid(pos), ...args); }
/** * Add a node to the grid at specific position */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L474-L476
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.placeNode
placeNode<T extends BaseNode>(type: { new(...args: any[]): T }, ...args: any[]): T { const mousePos = new ImGui.ImVec2(ImGui.GetIO().MousePos.x, ImGui.GetIO().MousePos.y); const nodePos = this.screen2grid(mousePos); return this.addNode(type, nodePos, ...args); }
/** * Add a node to the grid using mouse position */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L481-L486
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.addLink
addLink (link: Link): void { this.m_links.push(link); }
/** * Add link to the handler internal list * @param link Reference to the link */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L492-L494
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.droppedLinkPopUpContent
droppedLinkPopUpContent (content: (dragged: Pin) => void, key: ImGui.ImGuiKey = 0): void { this.m_droppedLinkPopUp = content; this.m_droppedLinkPupUpComboKey = key; }
/** * Pop-up when link is "dropped" * @param content Function containing the contents of the pop-up and subsequent logic * @param key Optional key required in order to open the pop-up */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L501-L504
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.rightClickPopUpContent
rightClickPopUpContent (content: (node: BaseNode) => void): void { this.m_rightClickPopUp = content; }
/** * Pop-up when right-clicking * @param content Function containing the contents of the pop-up and subsequent logic */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L510-L512
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getSingleUseClick
getSingleUseClick (): boolean { return this.m_singleUseClick; }
/** * Get mouse clicking status * @returns TRUE if mouse is clicked and click hasn't been consumed */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L518-L520
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.consumeSingleUseClick
consumeSingleUseClick (): void { this.m_singleUseClick = false; }
/** * Consume the click for the given frame */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L525-L527
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getName
getName (): string { return this.m_name; }
/** * Get editor's name * @returns Name of the editor */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L533-L535
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getPos
getPos (): ImGui.ImVec2 { return this.m_context.origin(); }
/** * Get editor's position * @returns Position in screen coordinates */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L541-L543
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getScroll
getScroll (): ImGui.ImVec2 { return this.m_context.scroll(); }
/** * Get editor's grid scroll * @returns Scroll offset from the origin of the grid */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L549-L551
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getNodes
getNodes (): Map<NodeUID, BaseNode> { return this.m_nodes; }
/** * Get editor's list of nodes * @returns Internal nodes list */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L557-L559
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getNodesCount
getNodesCount (): number { return this.m_nodes.size; }
/** * Get nodes count * @returns Number of nodes present in the editor */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L565-L567
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getLinks
getLinks (): Link[] { return this.m_links; }
/** * Get editor's list of links * @returns Internal links list */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L573-L575
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getGrid
getGrid (): ContainedContext { return this.m_context; }
/** * Get zooming viewport * @returns Internal viewport for zoom support */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L581-L583
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.isNodeDragged
isNodeDragged (): boolean { return this.m_draggingNode; }
/** * Get dragging status * @returns TRUE if a Node is being dragged around the grid */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L589-L591
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.getStyle
getStyle (): InfStyler { return this.m_style; }
/** * Get current style * @returns Style variables */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L597-L599
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.setSize
setSize (size: ImGui.ImVec2): void { this.m_context.config().size = size; }
/** * Set editor's size * @param size Editor's size. Set to (0, 0) to auto-fit. */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L605-L607
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.draggingNode
draggingNode (state: boolean): void { this.m_draggingNodeNext = state; }
/** * Set dragging status * @param state New dragging state */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L613-L615
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.hovering
hovering (hovering: Pin | null): void { this.m_hovering = hovering; }
/** * Set what pin is being hovered * @param hovering Pointer to the hovered pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L621-L623
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.hoveredNode
hoveredNode (hovering: BaseNode | null): void { this.m_hoveredNode = hovering; }
/** * Set what node is being hovered * @param hovering Pointer to the hovered node */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L629-L631
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.screen2grid
screen2grid (p: ImGui.ImVec2): ImGui.ImVec2 { const currentContext = ImGui.GetCurrentContext(); if (currentContext === this.m_context.getRawContext()) { return new ImGui.ImVec2(p.x - this.m_context.scroll().x, p.y - this.m_context.scroll().y); } else { return new ImGui.ImVec2( p.x - thi...
/** * Convert coordinates from screen to grid * @param p Point in screen coordinates to be converted * @returns Point in grid's coordinates */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L638-L649
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.grid2screen
grid2screen (p: ImGui.ImVec2): ImGui.ImVec2 { const currentContext = ImGui.GetCurrentContext(); if (currentContext === this.m_context.getRawContext()) { return new ImGui.ImVec2(p.x + this.m_context.scroll().x, p.y + this.m_context.scroll().y); } else { return new ImGui.ImVec2( p.x + thi...
/** * Convert coordinates from grid to screen * @param p Point in grid's coordinates to be converted * @returns Point in screen coordinates */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L656-L667
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.on_selected_node
on_selected_node (): boolean { for (const [uid, node] of this.m_nodes) { if (node.isSelected() && node.isHovered()) { return true; } } return false; }
/** * Check if mouse is on selected node * @returns TRUE if the mouse is hovering a selected node */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L673-L681
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.on_free_space
on_free_space (): boolean { for (const [uid, node] of this.m_nodes) { if (node.isHovered()) {return false;} } for (const link of this.m_links) { if (link.isHovered()) {return false;} } return true; }
/** * Check if mouse is on a free point on the grid * @returns TRUE if the mouse is not hovering a node or a link */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L687-L696
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.generateUID
private generateUID (): NodeUID { return ImNodeFlow.m_instances++; }
/** * Generate unique UID for nodes * @returns Unique NodeUID */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L702-L704
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
ImNodeFlow.hashString
private hashString (str: string): number { let hash = 0; for (let i = 0; i < str.length; i++) { const chr = str.charCodeAt(i); hash = ((hash << 5) - hash) + chr; hash |= 0; // Convert to 32bit integer } return Math.abs(hash); }
// Hash Function (Simplistic)
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/node-flow.ts#L708-L719
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
PinStyle.constructor
constructor ( color: number, socket_shape: number, socket_radius: number, socket_hovered_radius: number, socket_connected_radius: number, socket_thickness: number ) { this.color = color; this.socket_shape = socket_shape; this.socket_radius = socket_radius; this.socket_hovered_r...
// List of less common properties
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L57-L87
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
PinStyle.cyan
static cyan (): PinStyle { return new PinStyle( ImGui.IM_COL32(87, 155, 185, 255), 0, 4.0, 4.67, 3.7, 1.0 ); }
// Static methods for default styles
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L90-L99
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.createLink
createLink (other: Pin): void { if (other.getType() !== PinType.Output) {return;} if (!this.m_allowSelfConnection && this.m_parent === other.getParent()) {return;} if (this.m_link && this.m_link.getLeft() === other) { return; } if (!this.m_filter(other, this)) {return;} this.m_link = new...
/** * Create link between pins * @param other Pointer to the other pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L469-L482
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.deleteLink
deleteLink (): void { this.m_link?.destroy(); this.m_link = null; }
/** * Delete the link connected to the pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L487-L490
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.allowSameNodeConnections
allowSameNodeConnections (state: boolean): void { this.m_allowSelfConnection = state; }
/** * Specify if connections from an output on the same node are allowed * @param state New state of the flag */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L496-L498
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.isConnected
isConnected (): boolean { return this.m_link !== null; }
/** * Get connected status * @returns TRUE if pin is connected to a link */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L504-L506
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.getLink
getLink (): Link | null { return this.m_link; }
/** * Get pin's link * @returns Link connected to the pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L512-L514
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.getFilter
getFilter (): (out: Pin, input: Pin) => boolean { return this.m_filter; }
/** * Get InPin's connection filter * @returns InPin's connection filter configuration */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L520-L522
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.getDataType
getDataType (): string { return typeof this.m_emptyVal; }
/** * Get pin's data type (aka: <T>) * @returns String containing unique information identifying the data type */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L528-L530
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.pinPoint
pinPoint (): ImGui.ImVec2 { return new ImGui.ImVec2( this.m_pos.x - this.m_style.extra.socket_padding, this.m_pos.y + this.m_size.y / 2 ); }
/** * Get pin's link attachment point (socket) * @returns Grid coordinates to the attachment point between the link and the pin's socket */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L536-L541
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
InPin.val
val (): T { if (this.m_link) { const outPin = this.m_link.getLeft(); if (outPin instanceof OutPin) { return outPin.val(); } } return this.m_emptyVal; }
/** * Get value carried by the connected link * @returns Reference to the value of the connected OutPin. Or the default value if not connected */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L547-L557
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.destroy
destroy (): void { this.m_links.forEach(link => { const otherPin = link.getRight(); otherPin.deleteLink(); }); this.m_links.length = 0; }
/** * When parent gets deleted, remove the links */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L582-L589
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.createLink
createLink (other: Pin): void { if (other.getType() !== PinType.Input) {return;} other.createLink(this); }
/** * Create link between pins * @param other Pointer to the other pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L595-L599
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.setLink
setLink (link: Link): void { this.m_links.push(link); }
/** * Add a connected link to the internal list * @param link Link to add */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L605-L607
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.deleteLink
deleteLink (): void { this.m_links = this.m_links.filter(link => !link.isDestroyed()); }
/** * Delete any expired weak pointers to a (now deleted) link */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L616-L618
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.isConnected
isConnected (): boolean { return this.m_links.length > 0; }
/** * Get connected status * @returns TRUE if pin is connected to one or more links */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L624-L626
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.pinPoint
pinPoint (): ImGui.ImVec2 { return new ImGui.ImVec2( this.m_pos.x + this.m_size.x + this.m_style.extra.socket_padding, this.m_pos.y + this.m_size.y / 2 ); }
/** * Get pin's link attachment point (socket) * @returns Grid coordinates to the attachment point between the link and the pin's socket */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L632-L637
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.val
val (): T { if (this.m_behaviour) { return this.m_behaviour(); } if (this.m_val !== null) { return this.m_val; } throw new Error('No value defined for this OutPin'); }
/** * Get output value * @returns Internal value of the pin */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L643-L651
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.behaviour
behaviour (func: () => T): this { this.m_behaviour = func; return this; }
/** * Set logic to calculate output value * @param func Function or lambda expression used to calculate output value */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L657-L661
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.getDataType
getDataType (): string { return typeof (this.m_val as any); }
/** * Get pin's data type (aka: <T>) * @returns String containing unique information identifying the data type */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L667-L669
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
OutPin.resolve
resolve (): void { if (this.m_behaviour) { this.m_val = this.m_behaviour(); } }
/** * Used by output pins to calculate their values */
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/imgui-demo/src/panels/node-graph/pin.ts#L674-L678
20512f4406e62c400b2b4255576cfa628db74a22
effects-runtime
github_2023
galacean
typescript
generateTexture
function generateTexture (engine: Engine) { const writePixelData = [255, 100, 50, 0]; const buffer = new Uint8Array([1, 2, ...writePixelData, 3, 4]); return Texture.createWithData(engine, { width: 1, height: 1, data: new Uint8Array(buffer.buffer, 2 * Uint8Array.BYTES_PER_ELEMENT, 4), }, { format: glCon...
// function generateMeshAndUBO (
https://github.com/galacean/effects-runtime/blob/20512f4406e62c400b2b4255576cfa628db74a22/web-packages/test/unit/src/effects-webgl/gl-material.spec.ts#L1671-L1681
20512f4406e62c400b2b4255576cfa628db74a22
reactjs-template
github_2023
Telegram-Mini-Apps
typescript
ErrorBoundary.getDerivedStateFromError
static getDerivedStateFromError: GetDerivedStateFromError<ErrorBoundaryProps, ErrorBoundaryState> = (error) => ({ error })
// eslint-disable-next-line max-len
https://github.com/Telegram-Mini-Apps/reactjs-template/blob/345709d1bb8350fe523ef2de05662716136b8196/src/components/ErrorBoundary.tsx
345709d1bb8350fe523ef2de05662716136b8196
cloudypad
github_2023
PierreBeucher
typescript
DataRootDirManager.getEnvironmentDataRootDir
static getEnvironmentDataRootDir(): string { if (process.env.CLOUDYPAD_HOME) { return process.env.CLOUDYPAD_HOME } else { if (!process.env.HOME){ throw new Error("Neither CLOUDYPAD_HOME nor HOME environment variable is set. Could not define Cloudy Pad data root di...
/** * Return current environments Cloudy Pad data root dir, by order of priority: * - $CLOUDYPAD_HOME environment variable * - $HOME/.cloudypad * - Fails is neither CLOUDYPAD_HOME nor HOME is set * * This function is used by all components with side effects in Cloudy Pad data root dir (ak...
https://github.com/PierreBeucher/cloudypad/blob/f476990dedf0a856b1a8ce7dc82d28382ca67f7c/src/core/data-dir.ts#L14-L24
f476990dedf0a856b1a8ce7dc82d28382ca67f7c
cloudypad
github_2023
PierreBeucher
typescript
InteractiveInstanceInitializer.initializeInstance
async initializeInstance(cliArgs: A, options?: InstancerInitializationOptions): Promise<void> { try { this.analyticsEvent("create_instance_start") this.logger.debug(`Initializing instance from CLI args ${JSON.stringify(cliArgs)} and options ${JSON.stringify(options)}`) ...
/** * Interactively initialize a new instance from CLI args: * - Parse CLI args into known Input interface * - Interactively prompt for missing args * - Run instance initialization */
https://github.com/PierreBeucher/cloudypad/blob/f476990dedf0a856b1a8ce7dc82d28382ca67f7c/src/core/initializer.ts#L45-L74
f476990dedf0a856b1a8ce7dc82d28382ca67f7c