-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: comp_visual_preset #288
Conversation
We don't have any changes to it yet, but this way we're getting the latest and greatest, rather than just the old version on pypi
Getting a bit hacky here! Find a better solution later on...
Dev update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple suggestions with the code. For the fog controller, shouldn't it use the SetFogController
input for !player
?
transforms/comp_visual_preset.py
Outdated
if tonemappers: | ||
tonemapper = tonemappers[0] | ||
|
||
to_tm_outputs = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Output
with an entity is just a shortcut to using the targetname. Instead of using search()
, just use the name directly. Perhaps do the search to check they exist, but if it matches multiple that should be fine. Also not sure why you put them in a list first, just call add_out
only if tonemappers are found? Lastly, Output
's param
parameter calls str()
for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could do that, if the tonemapper doesn't exist it just wouldn't fire right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well you could do something like:
for found in vmf.search(name):
relay_ent.add_out(...)
break
Just using the for loop iteration to confirm at least one exists.
transforms/comp_visual_preset.py
Outdated
|
||
# Fog Controller | ||
|
||
LerpTo = "LerpTo" if vpreset["use_lerp", True] else "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to call srctools.conv_bool
on this, so it properly treats "false"
, "0"
etc as false.
transforms/comp_visual_preset.py
Outdated
vmf: VMF = ctx.vmf | ||
for vpreset in vmf.by_class["comp_visual_preset"]: | ||
vpreset.remove() | ||
LOGGER.log(0, f"Parsing visual preset: {vpreset['targetname']}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOGGER.log(0, f"Parsing visual preset: {vpreset['targetname']}") | |
LOGGER.debug("Parsing visual preset: {}", vpreset['targetname']) |
I'll update my code with your suggestions in a bit! |
Okay I've updated the code with your suggestions, but I don't think firing SetFogController to !player is necessary? |
Keep in mind Not sure I really see the point of this entity though, if you need to point it at a tonemapper/fog controller entity anyway? Why not just configure the fog controller directly in its own settings and activate that + the tonemapper inputs with a |
You cannot lerp between fogs with two fog controllers, besides this entity is supposed to be a wrapper around these 3 entities. If you dont find it useful its your case, I found it extremely useful to have. |
Whoops, didn't mean to do that, guess I have to make a clean PR now, |
This is a comp entity that allows users to set presets for tone mapping, fog and color correction, all handled by one entity.
For tone mapping this entity supports setting: AutoExposureMax, AutoExposureMin, Bloom, BloomExponent
For fog: Primary color, Fog Start, Fog End, Fog Max Density, Lerping (for the values specified before)
For CC: Filename (which gets specified as an actual filename, evaluates to:
materials/correction/<kv>.raw
)When Apply is fired to this entity, it fires respective IO to specified fog_controller, tonemapper and color_correction entity, as mentioned before it features lerping. It also automatically disables other comp_visual_presets making sure only one is active at a time.
Not specifying
cc_filename
,tonemapper
orfog_controller
just disables these features respectively.