Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export buildGraph #3051

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/API/additional-exports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ nav: 9
| addEffect | Adds a global render callback which is called each frame |
| addAfterEffect | Adds a global after-render callback which is called each frame |
| addTail | Adds a global callback which is called when rendering stops |
| buildGraph | Collects nodes and materials from a THREE.Object3D |
| flushGlobalEffects | Flushes global render-effects for when manually driving a loop |
| invalidate | Forces view global invalidation |
| advance | Advances the frameloop (given that it's set to 'never') |
Expand Down
3 changes: 2 additions & 1 deletion packages/fiber/src/core/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
Camera,
updateCamera,
getColorManagement,
hasColorSpace,
buildGraph,
} from './utils'
import { useStore } from './hooks'
import type { Properties } from '../three-types'
Expand Down Expand Up @@ -513,7 +513,7 @@
...rest,
} as RootState
},
[state],

Check warning on line 516 in packages/fiber/src/core/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test

React Hook React.useCallback has missing dependencies: 'container', 'events', 'pointer', 'previousRoot', 'raycaster', 'rest', and 'size'. Either include them or remove the dependency array
)

const [usePortalStore] = React.useState(() => {
Expand Down Expand Up @@ -546,11 +546,11 @@
unsub()
usePortalStore.destroy()
}
}, [])

Check warning on line 549 in packages/fiber/src/core/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test

React Hook React.useEffect has missing dependencies: 'inject', 'previousRoot', and 'usePortalStore'. Either include them or remove the dependency array

React.useEffect(() => {
usePortalStore.setState((injectState) => inject(previousRoot.getState(), injectState))
}, [inject])

Check warning on line 553 in packages/fiber/src/core/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test

React Hook React.useEffect has missing dependencies: 'previousRoot' and 'usePortalStore'. Either include them or remove the dependency array

return (
<>
Expand Down Expand Up @@ -590,5 +590,6 @@
flushGlobalEffects,
getRootState,
act,
buildGraph,
roots as _roots,
}
4 changes: 3 additions & 1 deletion packages/fiber/src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ export const is = {
},
}

// Collects nodes and materials from a THREE.Object3D
/**
* Collects nodes and materials from a THREE.Object3D.
*/
export function buildGraph(object: THREE.Object3D) {
const data: ObjectMap = { nodes: {}, materials: {} }
if (object) {
Expand Down
Loading