Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

[RELEASED] Free Prefab Painter (GitHub)

Discussion in 'Assets and Asset Store' started by alexanderameye, Nov 25, 2017.

  1. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Prefab Painter

    Hello, I have put a free, open source prefab painter on GitHub.


    - the main UI of the prefab painter -​

    GitHub: https://github.com/AlexanderAmeye/prefab-painter

    Important! The prefabs need colliders in order for the tool to work.

    Usage
    Import the project into Unity3D and open the prefab brush tool by clicking Tools -> Prefab Painter.

    Features

    - Paint on every type of surface (plane, terrain, sphere,...)
    - Paint multiple types of prefabs at once
    - Paint with random prefab rotations
    - Paint with random prefab sizes
    - Prefab previewer
    - Customizable brush size, density
    - Paint on selected layers
    - Palette/presets functionality with useful toolbar

    + more info on GitHub!
     
    Last edited: May 24, 2019
    romatallinn, Mark_01, zwcloud and 5 others like this.
  2. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    There is now a 'palette' feature that always you to export/import 'presets' of prefab collections that you want to paint with.

    Thank you @romatallinn for adding this feature and making the project compatible with 2018.3.
     
    Last edited: Feb 5, 2019
    romatallinn and Mark_01 like this.
  3. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Project updated with a new 'palette' toolbar. You can load, save, edit and remove palettes and you can also use the drop down on the right to see all the loaded palettes for easy access.

     
    HoneyButterAlmond likes this.
  4. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Reworking the prefab UI. Will be updated on GitHub in the next week.

     
    Last edited: Feb 15, 2019
  5. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    294
    Looks great!
    Looks great! Let me know when you have updated it.
     
  6. Ivoryjw

    Ivoryjw

    Joined:
    May 20, 2018
    Posts:
    31
    Thank you for working and sharing this asset for the public. Well done!
     
  7. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,273
    very nice!
     
  8. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    You're welcome. I enjoy working on it :)
     
  9. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Wanted to show one more thing that's not very clear in the last video. You can select prefabs in the list and then the settings for it will be displayed. There is a label that shows the name of the currently selected prefab.

     
    MCrafterzz and Mark_01 like this.
  10. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    @MCrafterzz GitHub was updated with new prefab list. https://github.com/AlexanderAmeye/prefab-painter

    Another thing I'm working on at the moment is the ability to save the palettes using a file explorer window. Before the tool would pick the name of the palette but now you can choose the name, save location etc. Now also renaming palettes will not cause any issues. I've added some warning and info messages to make the tool more user friendly.



     
  11. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,273
    Can you make a feature that is like this: rotate painted objects to align with paint direction.
    So when painting a fence or stripes on a road they will be aligned to the painted troke.
     
  12. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Ahh, not sure how to implement but sounds cool. Will take a look at it for sure.
     
    Lars-Steenhoff likes this.
  13. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,273
    Its like in this video align to stroke at 2:10 time

     
  14. PT_Zef

    PT_Zef

    Joined:
    Feb 10, 2019
    Posts:
    9
    upload_2019-3-5_16-53-11.png

    Hello, I don't know if I did something wrong when importing this tool, or if I'm just not using it right, but ctrl + left click doesn't do anything. I just have that text in the editor, as you can see.
     
  15. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Hmm, could you tell me a bit more about the mesh you are painting on or the objects you are painting with? Do they have colliders on them?
     
  16. PT_Zef

    PT_Zef

    Joined:
    Feb 10, 2019
    Posts:
    9
    The mesh is a collection of small meshes put together and sculpted a bit to look like mountains and valleys. The prefabs I am trying to paint do not have colliders. I'm really hoping you can help me get this working, it looks like an amazing tool that'll save me so much time.
     
  17. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    I'm pretty sure that the object you're painting on needs a collider. The tool shoots raycasts down from the mouse to determine if it can place an object. So try to add a collider to your terrain and I think that will solve it.
     
  18. PT_Zef

    PT_Zef

    Joined:
    Feb 10, 2019
    Posts:
    9
    My terrain has a collider but the plants that i am trying to paint onto the mesh do not have a collider. Could the issue be that I'm not zoomed in enough to the mesh?
     
  19. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Yeah it's a weird issue. I don't think that the plants would need a collider but I'm not 100% sure. I've had some issues too with some objects not painting. What happens if you paint basic stuff like cubes or spheres, do they work?
     
  20. PT_Zef

    PT_Zef

    Joined:
    Feb 10, 2019
    Posts:
    9
    Give me a second to try, I'll post a screen shot.
     
  21. PT_Zef

    PT_Zef

    Joined:
    Feb 10, 2019
    Posts:
    9
    upload_2019-3-6_11-54-48.png

    No, same issue, I don't get the circle to paint with like I should. I just get that text locked to my cursor. Should I try reinstalling the package?
     
  22. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Yeah I don't think that the issue is with the installation. I just think it's an issue with the script or the setup. The script wants to draw the gizmo on the hitpoint and it doesn't seem to be finding it. Or maybe the scale is just off? What happens when you change the size of the gizmo?
     
  23. PT_Zef

    PT_Zef

    Joined:
    Feb 10, 2019
    Posts:
    9
    Still sort of new to Unity, how does one do that?
     
  24. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    No it's something from my tool. I think ctrl+scroll will resize it. Also if you want you could pm me? Might be easier to talk.
     
  25. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    The issue above was due to the layer settings not being set correctly. Some surfaces were on a layer that was not accessible to the prefab painter.
     
  26. Vallar

    Vallar

    Joined:
    Oct 18, 2012
    Posts:
    166
    Hey, I recently came across your tool and I imported it in the project (downloaded from GitHub and imported it). I can confirm you can't place objects without colliders on them (i.e. trees on a plane, both need a collider). However I came across a weird issue. I have a mesh collider on a mostly flat mesh (imported from Blender) and the tool detects some areas (i.e. the cyan circle for paint appears) and doesn't detect others (the circle disappears and I can't paint).

    Moreover, when I try to paint a prefab that is imported from Blender with wrong rotation (it is fixed in the prefab by rotating it 90 degrees), it still paints with the wrong rotation.

    Any ideas what are the causes for this?

    Thanks.
     
  27. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    I'm not sure what's causing the painting surface issue and for the moment I can't really give you an answer. I'm a bit short on time but I'll try to give the painting code a good look + cleanup in the coming weeks and I'll give you a decent answer afterwards if I find something.

    The rotation code should be fixable in the code. It's probably assigning rotations to it (for example 0,90,0) when painting without taking into account an initial rotation offset. I will look at this too when I get the time.

    I am accepting pull requests so if someone manages to fix these issues or improve the tool, let me know!

    Alex
     
  28. Vallar

    Vallar

    Joined:
    Oct 18, 2012
    Posts:
    166
    Great, thanks. No rush.
     
  29. Koamr

    Koamr

    Joined:
    Jul 19, 2013
    Posts:
    6
    Hi @alexanderameye

    I installed Prefab Painter via package-manager using github URL. I set up layers as needed. I added my prefabs to pallete. I can see the blue-circle brush on the collider I want to paint on.

    But when I hit ctrl+click nothing happens. Do you have some idea why it's not working or how would I start debugging it? I am attaching a screenshot.
     

    Attached Files:

  30. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Hm I'm not too sure. What happens if you add a box collider instead of a mesh collider to the object you want to paint on?
     
  31. Koamr

    Koamr

    Joined:
    Jul 19, 2013
    Posts:
    6
  32. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
  33. Romaleks360

    Romaleks360

    Joined:
    Sep 9, 2017
    Posts:
    29
    @alexanderameye Why aren't my prefabs spawning? I'm trying to spawn some prefabs with SpriteRenderer on terrain, they appear in the prefab painter palette window, but they just don't get spawned - this "Paint" transform remains empty
    Do I need colliders on prefabs?

    P.S. yeah I needed colliders sorry for this dumb question but can you mention it somewhere for some other dumbs like me
     
  34. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Hey! So the issue was fixed? I edited the main post as well as the github page mentioning the colliders.
     
  35. Brandt333

    Brandt333

    Joined:
    May 27, 2019
    Posts:
    3
    Hey @alexanderameye

    I edited the code so that all prefabs spawn perfectly vertical regardless of the normal of the hit rotation because I didn't want trees on a hill to be tilted at an angle. If you have the time I think a check box for the prefab being normal to the terrain slope or not may be a useful feature.

    Also in addition to needing colliders, the colliders must also cover the origin of the prefab to work
     
    Last edited: May 29, 2019
  36. Brandt333

    Brandt333

    Joined:
    May 27, 2019
    Posts:
    3
    I realize this is quite an old post but I will say it anyway just in case and for those who may encounter similar issues. The reason your prefabs are at 90 degrees is because Blender has the Z-axis as up, where as Unity has the Y-axis as up. The issue is usually due to objects being parented which causes Unity to inherit the parents rotation. If you simply add an empty object to the blender model (I.E. add a cube and delete all vertices) that has no parent relation Unity will automatically encapsulate all non-parented objects and apply standard Unity orientation
     
  37. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Ah I just see there is a pull request, was that you? I'll take a look at it next month because I have a lot of work right now.
     
  38. Brandt333

    Brandt333

    Joined:
    May 27, 2019
    Posts:
    3
    It wasn’t me, I’m not that well-versed in Github.
     
  39. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    29
    Does this work with 2017?
     
  40. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    Should work with Unity 2017 yes, I'm not sure if it works with Unity 2019 though, will check this all this summer :)
     
  41. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    294
    Can you please update it to work in 2019.1! Thanks! Now that's it's summer, do you have time to tick some stuff of the roadmap? ;)
     
  42. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    927
    This project is definitely not at the top of my priority list but tomorrow I'll take a look at making it work with 2019.x.
     
    MCrafterzz likes this.