I’ve created a custom material type as a ParticleProcessMaterial alternative.
It generates shader code, creates a shader and sets the shader/parameters through RenderingServer, mostly doing what a ShaderMaterial does.
The problem is that this type doesn’t show up as an option in “process_material” field of GPUParticles3D node in inspector.
As far as I understand, these options are filtered with PROPERTY_HINT_RESOURCE_TYPE property hint and allowed resources types are stored in hint_string.
For GPUParticles3D, it’s: “ParticleProcessMaterial,ShaderMaterial”. So is there any way that I can alter this hint string in my editor plugin?
I’m extending Material base class. My class is an alternative to those two classes, just as they are an alternative to each other so it doesn’t make sense to extend these two.
The easiest way to make it show in the list is to make it extend ShaderMaterial. You can hide its shader property to show in the inspector by implementing Object._validate_property() and change its usage to PROPERTY_USAGE_STORAGE for example.
I don’t think there’s a way to change the GPUParticles3D.process_materialhint_string (without adding a script to the GPUParticles3D and implementing the Object._validate_property() changing it)
That’s exactly what I was doing previously, but this makes the extended material type show up for any property that accepts a ShaderMaterial, particles or not.
But I guess this is the only way for the time being.