You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could use a function to check if RenderingServer is already aware of a global shader parameter, such as when it was added to the project settings interface or via script.
Trying to get a property by name and checking for null doesn't work for objects, like the sampler2d type—those return null if they're simply not set, even when they are registered in the project settings. Example workaround code that doesn't work as a result:
func_set_global(global_name: String, global_type: RenderingServer.GlobalShaderParameterType, value):
varexisting=RenderingServer.global_shader_parameter_get(global_name)
# Only add globals if they have already been created in the project settings# This fails on objects, like textures, which may be null in settingsifexisting==null:
RenderingServer.global_shader_parameter_add(global_name, global_type, value)
else:
RenderingServer.global_shader_parameter_set(global_name, value)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I could use a function to check if
RenderingServer
is already aware of a global shader parameter, such as when it was added to the project settings interface or via script.Trying to get a property by name and checking for null doesn't work for objects, like the sampler2d type—those return null if they're simply not set, even when they are registered in the project settings. Example workaround code that doesn't work as a result:
Beta Was this translation helpful? Give feedback.
All reactions