-
Notifications
You must be signed in to change notification settings - Fork 3
Add basic SpotLight instancing #249
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
base: main
Are you sure you want to change the base?
Changes from all commits
0783382
30d30ce
2d87b5d
cf2a1ea
9201da5
175af9e
0491f08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,3 +62,4 @@ godot-cpp/CMakeFiles/godot-cpp.dir/gen/src/classes | |
|
|
||
| build-*/ | ||
| /.codex | ||
| /.antigravitycli | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| @tool | ||
| extends SpotLight3D | ||
|
|
||
| var meshes_on: Array[Node3D] = [] | ||
| var meshes_off: Array[Node3D] = [] | ||
|
|
||
| @export var enabled: bool = true: | ||
| set(v): | ||
| enabled = v | ||
| _update_state() | ||
|
|
||
| func _ready(): | ||
| _update_state() | ||
|
|
||
| func _update_state(): | ||
| var parent = get_parent() | ||
| if parent == null: | ||
| return | ||
| var light_root = parent.get_parent() | ||
| var is_end = parent.name.begins_with("end") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about this parent-child relation and hardcoded names of related nodes.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Me neither, but that's the best I could come up with. Also
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (!is_end): | ||
| var base_name = parent.name.trim_suffix("_on") | ||
| var lamp_off_node = light_root.get_node_or_null(NodePath(base_name + "_off")) | ||
| parent.visible = enabled | ||
| if lamp_off_node != null: | ||
| lamp_off_node.visible = !enabled | ||
| else: | ||
| parent.visible = enabled | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://d0k5foqnxfdhu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the high level API for lights control should be on E3DModelInstance, which is a node proxy for instancer and a reference holder for a e3d model.
Optimised instancer will not use this node. It will control lights by calling RenderingServer directly.