Skip to content

Commit

Permalink
[v1.7.17] Merge pull request #303 from bridge-core/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Joelant05 authored Jan 10, 2021
2 parents 3d4a24b + b4a7871 commit 1eaac1b
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 22 deletions.
12 changes: 11 additions & 1 deletion app/renderer/src/UI/Toolbar/Category/help.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { IAppMenu } from '../create'
import AboutWindow from '../../../../windows/About'
import { shell } from 'electron'
import { remote, shell } from 'electron'
import os from 'os'
import path from 'path'

export const HelpMenu: IAppMenu = {
displayName: 'Help',
Expand Down Expand Up @@ -51,5 +53,13 @@ export const HelpMenu: IAppMenu = {
'https://bridge-core.github.io/editor-docs/faq/'
),
},
{
displayName: 'Open Global Plugins Folder',
displayIcon: 'mdi-folder-cog',
onClick: () =>
remote.shell.showItemInFolder(
path.join(os.homedir(), '.bridge/data/plugins')
),
},
],
}
15 changes: 14 additions & 1 deletion app/renderer/src/autoCompletions/Components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,20 @@ export default class ComponentProvider {
path_arr: string[],
current: any
) {
for (let component of COMPONENTS) {
for (const component of COMPONENTS) {
if (component.confirm(provider, key, path_arr, current))
return component.process(provider, key, path_arr, current)
}
}

static processWithoutLoad(
provider: Provider,
key: string,
path_arr: string[],
current: any
) {
for (let i = 1; i < COMPONENTS.length; i++) {
const component = COMPONENTS[i]
if (component.confirm(provider, key, path_arr, current))
return component.process(provider, key, path_arr, current)
}
Expand Down
23 changes: 23 additions & 0 deletions app/renderer/src/autoCompletions/Dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,29 @@ export const DYNAMIC = {
return []
}
},
textures() {
try {
return walkSync(path.join(CURRENT.RP_PATH, 'textures')).map(
e => {
let tmp = e
.replace(
RP_BASE_PATH.replace(/\//g, '\\') +
Store.state.Explorer.project.resource_pack +
'\\',
''
)
.replace(/\\/g, '/')
if (tmp.endsWith('.json')) return
return `${path.dirname(tmp)}/${path.basename(
tmp,
path.extname(tmp)
)}`
}
)
} catch (e) {
return []
}
},
entity_textures() {
try {
return walkSync(
Expand Down
36 changes: 19 additions & 17 deletions app/renderer/src/autoCompletions/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,28 +369,30 @@ class Provider {
if (res !== undefined) {
return res
} else if (current !== LIB) {
for (let k of Object.keys(current)) {
if (k[0] === '$' && !REMOVE_LIST.includes(k)) {
for (let i = 0; i < path_arr.length + 1; i++)
CONTEXT_UP()
let { object, value } = this.omegaExpression(k)
for (let i = 0; i < path_arr.length + 1; i++)
CONTEXT_DOWN()
object = this.parseObjectCompletions(object, value)

if (
value.includes(key) ||
object.includes(key) ||
value.includes('@wildcard')
)
return this.walk(path_arr, current[k])
}
}
return this.resolveDynamicReferences(path_arr, key, current)
}
}
return this.walk(path_arr, current[key])
}

resolveDynamicReferences(pathArr: string[], key: string, current: any) {
for (let k of Object.keys(current)) {
if (k[0] === '$' && !REMOVE_LIST.includes(k)) {
for (let i = 0; i < pathArr.length + 1; i++) CONTEXT_UP()
let { object, value } = this.omegaExpression(k)
for (let i = 0; i < pathArr.length + 1; i++) CONTEXT_DOWN()
object = this.parseObjectCompletions(object, value)

if (
value.includes(key) ||
object.includes(key) ||
value.includes('@wildcard')
)
return this.walk(pathArr, current[k])
}
}
}

omegaExpression(expression: string) {
// console.log(expression, Omega.eval(expression))
return Omega.eval(expression)
Expand Down
8 changes: 7 additions & 1 deletion app/renderer/src/autoCompletions/components/Load.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ComponentProvider from '../Components'
import Provider from '../Provider'

export class Load {
Expand All @@ -7,7 +8,11 @@ export class Load {
path_arr: string[],
current: any
) {
return current.$load !== undefined
if (!current.$load) return false

const { object = {}, value = [] } =
this.process(provider, key, [...path_arr], current) ?? {}
return Object.keys(object).length > 0 || value.length > 0
}
static process(
provider: Provider,
Expand All @@ -22,6 +27,7 @@ export class Load {
path_arr.unshift(key)
return provider.walk(path_arr, object)
}

static walk(path_arr: string[], arg1: any): any {
throw new Error('Method not implemented.')
}
Expand Down
5 changes: 5 additions & 0 deletions app/renderer/windows/About.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ export default class AboutWindow extends TabWindow {
'GitHub',
'https://github.com/solvedDev/bridge./'
),
new Link(
'bridge. Homepage:',
'Website',
'https://bridge-core.github.io/'
),
new Link('Bedrock ', 'Documentation', 'https://bedrock.dev/'),
new Link(
'',
Expand Down
2 changes: 1 addition & 1 deletion app/shared/app_version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Current bridge. app version
*/
export default 'v1.7.16'
export default 'v1.7.17'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bridge",
"version": "1.7.16",
"version": "1.7.17",
"author": "solvedDev <solveddev@gmail.com>",
"description": "A powerful add-on editor",
"license": "GNU",
Expand Down
1 change: 1 addition & 0 deletions static/data/RP/textures_list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions static/data/create_project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"RP/biomes_client.json": "biomes_client.json",
"RP/blocks.json": "blocks.json",
"RP/sounds.json": "sounds.json",
"RP/textures_list.json": "textures/textures_list.json",
"RP/terrain_texture.json": "textures/terrain_texture.json",
"RP/flipbook_textures.json": "textures/flipbook_textures.json",
"RP/item_texture.json": "textures/item_texture.json",
Expand Down

0 comments on commit 1eaac1b

Please sign in to comment.