Skip to content

feat(extra-natives/five): add support for configurable outline render technique#3365

Merged
prikolium-cfx merged 1 commit into
citizenfx:masterfrom
Yum1x:entity-outline
May 21, 2025
Merged

feat(extra-natives/five): add support for configurable outline render technique#3365
prikolium-cfx merged 1 commit into
citizenfx:masterfrom
Yum1x:entity-outline

Conversation

@Yum1x

@Yum1x Yum1x commented Apr 28, 2025

Copy link
Copy Markdown
Contributor

Goal of this PR

Allow developers to specify a custom shader technique group for entity outlines via a new native (SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE). This expands the flexibility of the outline rendering system, which was previously limited to the unlit technique, and addresses use cases beyond the intended FxDK environment, as some developers rely on this functionality in their own codebases.
image

Note: While not critical to FxDK usage, this native aims to improve flexibility for developers already relying on outline rendering in their projects.

How is this PR achieving the goal

Introduces the SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE native, allowing scripts to specify a custom shader technique group for entity outlines. The implementation updates the outline rendering system to use the provided technique group, with a fallback to the default "unlit" technique if none is specified. This expands the flexibility of outline rendering for both FxDK and community use cases.

This PR applies to the following area(s)

Natives, FxDK

Successfully tested on

Game builds: 1604, 3095, 3258, 3407

Platforms: Windows

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

@github-actions github-actions Bot added FxDK FxDK issues triage Needs a preliminary assessment to determine the urgency and required action labels Apr 28, 2025
@prikolium-cfx

Copy link
Copy Markdown
Collaborator

Could you please revert all formatting changes so we can see only real changes

@github-actions github-actions Bot added invalid Requires changes before it's considered valid and can be (re)triaged and removed triage Needs a preliminary assessment to determine the urgency and required action labels Apr 29, 2025
Comment thread code/components/extra-natives-five/src/GamePrimitives_Outlines.cpp Outdated
Comment thread code/components/extra-natives-five/src/GamePrimitives_Outlines.cpp Outdated
Comment thread code/components/extra-natives-five/src/GamePrimitives_Outlines.cpp Outdated
@github-actions github-actions Bot added triage Needs a preliminary assessment to determine the urgency and required action invalid Requires changes before it's considered valid and can be (re)triaged and removed invalid Requires changes before it's considered valid and can be (re)triaged triage Needs a preliminary assessment to determine the urgency and required action labels Apr 29, 2025
Comment thread ext/native-decls/sdk/SetEntityDrawOutlineRenderTechnique.md
@github-actions github-actions Bot added triage Needs a preliminary assessment to determine the urgency and required action and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Apr 29, 2025
… technique

Introduce `SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE` to allow specifying custom shader technique groups for entity outlines, with a fallback to the default "unlit" technique.

Introduce `RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE` native to restore the outline render technique to the default value.
@prikolium-cfx prikolium-cfx added ready-to-merge This PR is enqueued for merging needs manual verification PRs that need manual verification by testing the change locally labels Apr 30, 2025
@prikolium-cfx

Copy link
Copy Markdown
Collaborator

I've marked this PR as ready-to-merge, but looks like it needs manual testing as some part of code called in different thread and it can cause issues when setting global var.

@Yum1x

Yum1x commented May 1, 2025

Copy link
Copy Markdown
Contributor Author

@prikolium-cfx Do you have an approach in mind? I'm considering mutexes for thread safety, wdyt?


fx::ScriptEngine::RegisterNativeHandler("SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE", [](fx::ScriptContext& context)
{
std::string techniqueGroupId = context.GetArgument<const char*>(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string techniqueGroupId = context.GetArgument<const char*>(0);
std::string techniqueGroupId = context.CheckArgument<const char*>(0);

Using CheckArgument here will make this error if index 0 is null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I thought the type checking in natives would handle that. I'll do some tests and fix it in upcoming commits

@minsbat

minsbat commented May 8, 2025

Copy link
Copy Markdown

Bump to not stale

@prikolium-cfx prikolium-cfx merged commit 1b1645a into citizenfx:master May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FxDK FxDK issues needs manual verification PRs that need manual verification by testing the change locally ready-to-merge This PR is enqueued for merging triage Needs a preliminary assessment to determine the urgency and required action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants