Skip to content

Commit

Permalink
Merge pull request #119 from FailSpy/viewmodel-clipping-experiment
Browse files Browse the repository at this point in the history
Automatic shader tools for easy disabled clipping on viewmodels (ViewmodelSpace)
  • Loading branch information
Phazorknight authored Mar 18, 2024
2 parents e841b91 + 2faeb99 commit 918805a
Show file tree
Hide file tree
Showing 12 changed files with 1,034 additions and 6 deletions.
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

0 comments on commit 918805a

Please sign in to comment.