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

Strategy request: Target block coding at OpenSCAD capabilities #326

Open
goatchurchprime opened this issue Dec 5, 2024 · 1 comment
Open

Comments

@goatchurchprime
Copy link

What Happened

Godot now has the same CSG (Computational Solid Geometry) engine as OpenSCAD. The reason OpenSCAD is so widely known and used is it solves a real problem of being able to quickly generate shapes for 3D printing with a gentle learning curve. (However, speaking from experience, things get unmaintainably complex once you go much further.)

Block coding would be an perfect interface to this CSG engine, and the result would be more tangible since the operations are expressed in the Godot node-tree where they are easy to tinker with.

I've managed to implement a basic demo of the Menger Sponge using codeblocks (see below) without too many contrived functions at the top level called EXF.

The extra features I need to make this work properly are:

  • Function calls with arguments
  • Creating and parenting of new CSG nodes
  • Setting and getting of CSG attributes (the library currently only handles Node2Ds as a special case)

To get round this I have called into EXF level functions push_s() and pop_s() to implement a stack due to the lack of local function variables, and create_csg() to make a new object, push_child() to parent the last object under the previous one, duplicate_push_last() a contrived compound function for this case, and set_last_orientation().

Once you can do function calls, the EXF level functions are a good place to stage any features in order to discover what is minimal.

I note that function names are text lines, while variables are drag and drop. It's not clear how to reconcile this. Although the text lines are more versatile, the drag and drop of names in bubbles is satisfying. An in-between method is to drag a bubble onto a text line to fill that text line.

Screenshot from 2024-12-05 10-30-50
Screenshot from 2024-12-05 10-32-10

How to Reproduce

Project is here csgmanifoldcodeblockstest.zip

Block Coding Plugin Version

v0.7.1

Godot Engine Version

v4.4.dev7 (not yet released)

Operating System

Linux

Logs or command-line output

N/A

Anything else?

My long term goal is to find something as effective as Protoflux in [Resonite](https://resonite.com/features.html] where I often see multiple people working socially on the same complex visual script in VR.

Doing this for the generation of CSG objects that are to be 3D printed is an achievable goal where there is a realistic and good possibility of it becoming a notable success.

@manuq
Copy link
Contributor

manuq commented Dec 6, 2024

@goatchurchprime very impressive!

The extra features I need to make this work properly are:

  • Function calls with arguments

Yes, this needs to be implemented, tracked in #126 . This should be implemented as a new mini editor for the function definition, similar to the current one for defining variables:

image

  • Creating and parenting of new CSG nodes

Before adding more blocks it would be nice to have an "Advanced" filter. #282 . For preventing the interface to be too cluttered, and keep it for educational purposes.

In case you would like "3d printing" custom blocks to be shipped separately, see how custom blocks can be defined dynamically in scripts with func setup_custom_blocks(). Which is not great and can be improved: #329 .

  • Setting and getting of CSG attributes (the library currently only handles Node2Ds as a special case)

I'm happy to say that v0.8 (just released) comes with a feature to drag any property from the inspector to create a block for the attribute. See https://github.com/endlessm/godot-block-coding/releases/tag/v0.8.0

Still, you will probably need Vector3 support: #330

I note that function names are text lines, while variables are drag and drop. It's not clear how to reconcile this. Although the text lines are more versatile, the drag and drop of names in bubbles is satisfying. An in-between method is to drag a bubble onto a text line to fill that text line.

Yes, this can certainly be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants