godotengine / godotengine/godot-docs

Add `defined macro_name` (without parentheses) syntax to shader preprocessor page

Open
#10,035 0 comments 0 reactions 0 assignees View on GitHub
area:manual enhancement topic:shaders
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** v4.3.stable.flathub [77dcf97d8]

**Issue description:**
The way the page is written, one will not realize the more succinct `defined macro_name` syntax (without the parentheses) is also possible. This is specially true because of the wording ("function" implies the parentheses are required):
> Using the `defined()` *preprocessor function*, you can check whether the passed identifier is defined ~~a by~~ `#define` placed above that directive.

- Add examples without the parentheses too
- Use "preprocessor keyword" or "preprocessor operator" instead of "preprocessor function". It is indeed a keyword, since you shouldn't try to define macros named "defined".
- Fix the typo "a by" to "by a"

**URL to the documentation page (if already existing):** [Shader preprocessor #if](https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/shader_preprocessor.html#if)

---
EDIT: Actually it's better to not add this to the docs just yet, since the current implementation of this syntax is not exactly right, see https://github.com/godotengine/godot/issues/96504#issuecomment-2390154574

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.