A tool for Cave Engine that resize the UV of Material
July 31, 2025 at 05:16 PM
July 31, 2025 at 05:16 PM
63 views
2 replies

July 31, 2025 at 05:16 PM
Description
I've had developed a tool that resize the UV Material on Cave Engine, is a simple tool, but, very useful.
To use, is just create a Python Component and Put the code below inside of script and register as a tool.
This tool resizes the Material's UV using the object's scale.
Important
To this tool work with you material, the object needs to have this property "Prototype"
#editoronly
import cave
class ResizeMaterialUV(cave.ui.DebugTab):
material: cave.Material = None
def draw(self):
if ui.button("Resize All Prototypes UV"):
scene = cave.getScene()
entities = scene.getEntities()
for entity in entities:
e: cave.Entity = entity
if e.hasProperty('Prototype'):
material: cave.Material = e.get("Mesh").getFinalMaterial()
if material is not None:
curScale = e.getTransform().getScale()
scale = 1
if curScale.x > curScale.z:
scale = curScale.x
else:
scale = curScale.z
material.uniforms.set("m_uvScale", cave.Vector2(scale, curScale.y))
material.updateUniforms()
Replies (2)

August 01, 2025 at 10:26 AM
Oh nice, keep the cave tools coming!

August 12, 2025 at 02:28 AM
This is sweet, I did notice cave hadn't this native yet, very appreciated my friend, may the force be with you.