Phil-L-101 / Figma2Unreal

Figma2Unreal uses the [Figma API](https://www.figma.com/developers/api) and python scripts to take assets created in Figma and create nested UMG widgets suitable for making more advanced prototypes.
MIT License
77 stars 13 forks source link

A Few Errors Resulting in Partial Functionality #4

Open tdidonna opened 1 year ago

tdidonna commented 1 year ago

Hello Phil,

Really excited about your plugin! I've gotten your Aug '22 release partially functional with UE5.0.3 / Python 3.6 / Requests-2.31 but am getting some significant blockers, despite increasingly simplifying my Figma project.

- Many items result in an 'Unable to Check Out From Source Control!" error
- Many errors related to:  createChildren ChildNode.writeToUnreal() or FileDocument.writeToUnreal()  self.Children = createChildren(self.ChildrenDict, self.Document, self)
- Getting many partial imports where many components of my Figma layout don't come through
- Some images are importing and other's aren't, but none of them connect to their widget after restarting as they did in your demo

I'm attaching a UE5 error log, if you have any ideas/suggestions about gaining functionality on any of these fronts, I'd be quite excited about using even a simple but functional version. I'll keep experimenting with further simplification of my Figma doc as well.

ImportFigmaErrorLogs.log

tdidonna commented 1 year ago

Update on this issue: I created a close replica to your Figma sample scene as a test, and that does import to UE 100% correctly. I believe the problem is your plug in is having difficulty handling more than a couple levels deep of parent/child hierarchy. Thanks!

Phil-L-101 commented 1 year ago

Hi, it looks like it's failing when it tries to download an image with an id that can't be found in the main map of rendered images: This part of the code: def downloadImage(self): FileResponse=requests.get("https://api.figma.com/v1/images/" + self.Document.FileID + "?ids=" + self.id, headers={"X-Figma-Token": self.Document.AccessToken}) File = json.loads(FileResponse.text) ImageURL = File["images"][self.id] ImageData = requests.get(ImageURL).content

This code gets a map of all the rendered image urls in the Figma file using the Figma API: https://www.figma.com/developers/api#get-images-endpoint

It then uses the id of the current node to download the associated image. It might be worth playing around with the endpoint above with your particular file and any potential problem components to see where the problem lies.