Defold Polygon Editor

I hope you feel inspired to contribute more, you are clearly skilled. We all appreciate you! :slight_smile:

8 Likes

Hey all,
Someone bugged me on Github a few days ago, so I took a bit and fixed some issues with the polygon editor. To be honest I’m not sure how it ever worked! It’s amazing what I didn’t know when I originally made this.

  • Fixed it constantly having errors when you created vertices…
  • Fixed concave vertices not getting set back to white when they cease to be concave.
  • Hacked in native file dialogs on Linux using Zenity, so it can be usable on Linux.
    • It works on my machine: Linux Mint 20.1, with Zenity installed, but no guarantees that it works for everyone.
    • Added a fallback so you can still save polygons into the application folder on Linux if Zenity doesn’t work.
  • Made the message alerts actually last long enough to read them. :slight_smile:
  • Added a readme with a screenshot to the github repo.
15 Likes

Thank you for the great update! I created a feature request for an HTML5 version and I’ll try to contribute with a PR this week.

4 Likes

@britzl Awesome, thanks! I will look forward to that.

I made a couple other little tweaks today, made the snap increment adjustable, etc.

While my enthusiasm for this is active, are there any other feature requests or bug fixes that I should look at? Anything that would change the editor from Pointless --> Useful?

I submitted a PR for saving from HTML5 a few minutes ago.

I think it is useful as it is!

2 Likes

Ah! Nice, I’ll take a look.

[Edit] Awesome. Merged. Thanks!

1 Like

I’ve submitted a PR for drag’n’drop of an overlay image in HTML5 builds. Try it here:

https://britzl.github.io/DefoldPolygonEditor/index.html

1 Like

Awesome, thanks a lot!

Your web version isn’t working for me, though the console isn’t putting out any errors, so I’m not sure why. I did have to make a little fix to how the buttons are disabled on web.

I put up my own web version here: https://rossgrams.itch.io/defold-polygon-editor

There is a bug with the mouse coordinates on startup on some platforms (web and mac it seems?) that I haven’t figured out yet. On the web version you can just click the fullscreen button and escape back out and it seems to work. I’ll try to fix this soon. [Edit: Fixed]

2 Likes

Great! One thing I noticed on the HTML5 version is that mouse wheel scroll should be prevented on the page since it is used for zoom in/out in the tool.

1 Like

Alright, fixed the issue with the mouse coordinates and the mouse wheel scrolling the web page. It seems pretty solid now.

7 Likes

Thanks a lot for your work, that’s really simple and awesome, everything I needed!
You saved my life!

2 Likes

Haha, you’re welcome and thanks! I’m glad you’re alive! :grin:

1 Like

We still need an actually convenient / reliable 2D concave shape maker that will automatically efficiently split into multiple convex shapes. Would be nice if there was support for concave and it automatically was cut up. 2D spline rectangle chunk support would be nice too.

The editor currently doesn’t render custom custom .convexshape ! :sob:

Why is there a 16 point limit for shapes?

RUBE has a nice auto trace for images feature.

2024-03-29 22_23_05-RUBE editor tutorial 18_18 - Samplers - YouTube

I wonder if this would be easier to try and get to work with Chipmunk. That has not been updated in 6 years, but looks like it’s only 1 version behind.

This seems way more convenient for just making collision shape tracings from images… but… aghh!!! Doesn’t support Defold for easy export!!!

This is a box2d limitation, and actually I think our version has modified this value, the original b2 limits were 8 or something like that

1 Like

This is the kind of weird random shapes I want to be able to generate collision shapes for.

box2d.txt (19.8 KB)

Here’s an example output of this shape from PhysicsEditor. Box2D Generic XML.

Now how to convert this so it’s actually useful in Defold?

@totebo did you go anywhere further with this?

I’m going to try Chipmunk too. Here’s a sample export.

chipmunk.txt (34.9 KB)

I don’t know if current Defold Chipmunk can load the exported plists… I assume it’s not implemented yet though.

@britzl Could you please look into this? They have some sample files for importing the plist for Chipmunk.

I sent CodeAndWeb support a request to see if they can add Defold support for physics components.

Imagine if we could do this in the Defold editor? That would be great!

1 Like

I am looking into this more now. It looks like you did provide some files to add an exporter from PhysicsEditor to Defold convex shapes.

defold.zip (1.8 KB)

Would go into the folder like

C:\Program Files\CodeAndWeb\PhysicsEditor\resources\exporters

But my web browsers are claiming that the main binary in Defpolys.zip is a virus and refusing to let me download that, and there isn’t actually the source for the “Defpolys” app in the repo it appears just a test project?

Chrome/Edge claim they are a virus but won’t be specific. Firefox let me download and virustotal says it didn’t detect anything VirusTotal I think Chrome is detecting something as a false positive since in the zip you uploaded it has unnecessary build files?

Here’s what’s being claimed to be detected “Trojan:Script/Sabsik.FL.A!ml” must be old false positive.

Defpolys.zip->Defpolys/.internal/cache/engine-archives/x86_64-win32/build.zip

It looks like what the Defpolys program is supposed to do is cut up the .convexshapes file into multiple .convexshape files and then create a .go that already has them in it. I’ll try to make a simple Python script that can do this too.