Skip to content

Add on_generated_sprite_mesh signal#12

Closed
Joy-less wants to merge 0 commit into
98teg:masterfrom
Joy-less:add-generated-signal
Closed

Add on_generated_sprite_mesh signal#12
Joy-less wants to merge 0 commit into
98teg:masterfrom
Joy-less:add-generated-signal

Conversation

@Joy-less

@Joy-less Joy-less commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

This is useful if you want to connect your own tool script to modify the material after it's generated.

@98teg

98teg commented Dec 15, 2025

Copy link
Copy Markdown
Owner

Not sure of the use case of this one, could you provide an example?

@Joy-less

Copy link
Copy Markdown
Contributor Author

Not sure of the use case of this one, could you provide an example?

In my own project, I created a wrapper tool script that further customises the SpriteMesh on top of what customization the SpriteMesh is able to provide.

SpriteMeshInstance.Connect(StringName("on_generated_sprite_mesh"), Callable.From(CustomizeMaterial));
public void CustomizeMaterial() {
    StandardMaterial3D StandardMaterial = (StandardMaterial3D)SpriteMeshInstance.GetSurfaceOverrideMaterial(0);
    StandardMaterial.DiffuseMode = BaseMaterial3D.DiffuseModeEnum.Toon;
    StandardMaterial.SpecularMode = BaseMaterial3D.SpecularModeEnum.Toon;
    StandardMaterial.RimEnabled = true;
    StandardMaterial.Rim = 1.0f;
}

Since the SpriteMesh is generated after a delay, it's not simple to do this without a signal.

@98teg

98teg commented Jan 5, 2026

Copy link
Copy Markdown
Owner

I think this should be at inside
func _generate_sprite_mesh()

@Joy-less

Joy-less commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

I think this should be at inside func _generate_sprite_mesh()

You are right, unfortunately C# classes can't extend GDScript classes.

@98teg

98teg commented Jan 6, 2026

Copy link
Copy Markdown
Owner

I meant that the emitted signal should be inside func _generate_sprite_mesh() in order for this change to be merged, sorry for the confusion

@Joy-less Joy-less closed this Jan 6, 2026
@Joy-less Joy-less force-pushed the add-generated-signal branch from 19a8f20 to ede6b57 Compare January 6, 2026 15:15
@Joy-less

Joy-less commented Jan 6, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, GitHub made a mess out of this.
I will open a new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants