Skip to content
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

Automatic shader tools for easy disabled clipping on viewmodels (ViewmodelSpace) #119

Merged
merged 5 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions COGITO/Assets/Shader/ConvertedStandardMaterial3D.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends ShaderMaterial
class_name ConvertedMaterial
## See Material3DConversion. Any changes made to this will not stick if you go back to the regular models by unbaking!

@export var original_material : String
@export var original_material_cache : StandardMaterial3D

func cache(mat : StandardMaterial3D):
if Engine.is_editor_hint():
if (not mat.resource_path) or '.tscn' in mat.resource_path:
print("WARNING: Material ",str(mat), " is not saved to disk. Storing in memory. Recommend un-baking, save to disk, then re-bake")
original_material_cache = mat
else:
original_material = mat.resource_path

func get_original_material() -> StandardMaterial3D:
var mat = original_material_cache
if not mat:
mat = load(original_material)
return mat
Loading