triplex icon indicating copy to clipboard operation
triplex copied to clipboard

Add code input for number props

Open benjamincloquet opened this issue 2 months ago • 4 comments

Experimenting on this issue https://github.com/pmndrs/triplex/issues/254

This PR aims to improve the regular number input (as seen for the position, rotation, scale props) by adding a toggle to allow the user to input simple code expressions. In this context, a valid expression is an expression that can be resolved in isolation, eg. 2 + 2, Math.PI / 2, Math.sqrt(2) and so on. If a prop contains an identifier from an external variable (myVariable * 2), it then falls under the standard unhandled category.

Recommended review path:

To be improved : there is no visible validation as of now, if an incorrect expression is saved, the prop value is silently replaced with undefined

benjamincloquet avatar Oct 26 '25 11:10 benjamincloquet

@benjamincloquet is attempting to deploy a commit to the Triplex Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 26 '25 11:10 vercel[bot]

Awesome mate I'll take a look asap :-) — feel free to make comments over the PR if you think there's areas of interest!

itsdouges avatar Oct 28 '25 22:10 itsdouges

@itsdouges hey Mike, back on this as I was away for the last weeks - I have an idea to improve this without needing a whole new component, just making the NumberInput smarter so that we don't need a manual toggle 👍 quick question, what's your preferred setup when it comes to logging debug info? I'm very new to extension development and I'm struggling to do my basic console logs. I somehow managed when I first jumped on this but I can't get it to work anymore 😭 any tips?

benjamincloquet avatar Nov 14 '25 09:11 benjamincloquet

Console logs and viewing the developer console when building :-)

Open it with command palette!

  • https://triplex.dev/docs/building-your-scene/console-logs/dev-tools
  • https://triplex.dev/docs/building-your-scene/console-logs/logs

itsdouges avatar Nov 14 '25 20:11 itsdouges