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

Scene premade instance injection -> setting the root_scene / scene in afterUpdate(...) is wrong #131

Closed
vatro opened this issue Aug 10, 2022 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@vatro
Copy link
Owner

vatro commented Aug 10, 2022

Fix it, see:

$: if (root_scene === undefined) {
root_scene = get_root_scene(getContext("scene"))
if (root_scene === scene) {
// we are the root scene
root_scene = null
root_scene_obj.value = root_scene
scene_obj.value = scene
} else {
scene.userData.root_scene = root_scene
scene_obj.value = scene
}
}

if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
if (root_scene) {
// prevent an additional component update by not accessing the `scene` prop directly.
root_scene_obj.value.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
} else {
// prevent an additional component update by not accessing the `scene` prop directly.
scene_obj.value.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render_auto(scene)
}
}

root_scene_obj.value is undefined in afterUpdate(...) on instance injection.
... also the comments should be fixed.

@vatro vatro added the bug Something isn't working label Aug 10, 2022
@vatro vatro added this to the 1.0.0-next.1 milestone Aug 10, 2022
@vatro vatro self-assigned this Aug 10, 2022
@vatro vatro closed this as completed in 53c74b5 Aug 10, 2022
@vatro
Copy link
Owner Author

vatro commented Aug 10, 2022

... also: scene_obj.value has to be updated on instance change!

@vatro vatro reopened this Aug 10, 2022
@vatro vatro closed this as completed in dda3105 Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant