Search Unity

ProtoShape 2D - Editor extension to easy create and edit 2D meshes

Discussion in 'Assets and Asset Store' started by Andrii, Apr 20, 2017.

  1. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Yes, it's possible to add some UI that will allow to do that. In fact I've recently created a separate extension that uses ProtoShape2D to allow to create and edit shapes in game mode. Though I didn't publish it anywhere and it doesn't reproduce all the features of ProtoShape 2D available in editor. You can email me if you're interested.

    shapemanager2.gif
     
  2. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I'm interested in using this to as the basis for an in-game editor as well. Would love to see the sample project you show in the vid. I'll email you.
     
  3. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Looks like this is a popular demand. I'll try to make an asset out of this in some time (probably in a few months).
     
  4. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    So, can I create an editor similar to what you sent using the current ProtoShape2D API? Do you have any code examples of the runtime editor? I didn't seen any code in what you sent.
     
  5. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Yes, it's totally possible to create such an application without modifying ProtoShape 2D code. I've written another script around it that creates all the additional UI elements and allows to manipulate and manage ProtoShape objects in-game.
     
  6. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Hey Andril,

    I've been testing ProtoShape2D again and things are really looking good. I did run into one small thing and I'd like to make a request.

    For the Anti Aliasing, would you mind exposing the aliasing width so we can adjust the thickness of the aliasing triangle strip? The default looks a bit fuzzier than I'd like and I would love to be able to tweak it a bit.

    -Jeff
     
  7. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Of course. I'll do it in a next release.
     
  8. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Hey Andril,

    Another request for you unless it's already possible and I'm just not aware.

    Can you add the ability to re-center the transform gizmo? When editing the nodes of a ProtoShape I sometimes end up with the transform gizmo being way off-center and even outside the shape. Would love to be able to click a button and have the gizmo re-centered.

    -Jeff
     
  9. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    It's already there, unless you meant something else. There's also the "Auto pivot" option that moves the gizmo every time you move the point (which is not actually as useful as a button and I'm thinking of removing it).
    GIF.gif
     
  10. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Yep, found that this morning. Exactly what I was looking for. Thx.
     
  11. Fortitude3D

    Fortitude3D

    Joined:
    Sep 7, 2017
    Posts:
    155
    Cute project, good work :)
     
    Andrii likes this.
  12. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    I just downloaded and it works amazing. I was working on an editor extension similar to this and found out that this asset already existed. I would love it if you could fix / add the following.

    Current Setup:
    iMac (Retina 5K)
    Unity 2017.2.1f1
    ProtoShape 2D V1.15

    Bugs:
    #1 When dragging a selected handle, the handle moves further then mouse moves. [due to screen pixel density]
    #2 Original shape does not seem to be a perfect square. [makes it annoying, if starting from that point]

    Feature Requests:
    #1 When clicking on the edge of a polygon and then dragging, add a point and then move the point with the mouse. [instead of clicking to add and then having to click to move]
    #2 Custom pivot. [place anywhere on the polygon]
    #3 Select one or more points and scale towards the centre or a defined point, when a curtain mode is selected.
    #4 Select one or more points and rotate around the centre or a defined point, when a curtain mode is selected.
    #5 Scriptable at runtime. [points / fill / fill type / sorting / collider / pivot]
    #6 UI support. [convert to and from ui version]

    Thanks for this wonderful asset!
     
  13. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Hey, thanks for using my asset!

    About retina displays. I've received feedback from few users that there are problems with my (and some other) assets on retina displays. I thought that I've already fixed that problem. I'll try to figure out what's happening there. One thing you can try is to open ProtoShape2DEditor.cs and try editing this line:

    point+=(point-dragOrigin)*(EditorGUIUtility.pixelsPerPoint-1f);

    Just remove the multiplication by pixelsPerPoint like this:

    point+=(point-dragOrigin);

    Maybe it was needed in older unity versions and is not needed anymore in latest. I have no way to test it on retina monitor.

    Concerning other features, I'll try to implement them in upcoming versions of the asset. I didn't update it for some time because I was busy with my work but I'm working on some new features and bug fixes.

    Thanks again for your suggestions and for using this asset!
     
    ChristopherMcLaughlin likes this.
  14. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    Hey, Andrii

    I tried removing the line stated above and replacing it with the line bellow but ended up with the same problem.
    I did however fix the issue by removing this line.
    point+=(point-dragOrigin)*(EditorGUIUtility.pixelsPerPoint-1f);

    After playing around with the plugin, I found 2 other bugs.

    Bugs:
    #1 Set the fill type to linear gradient and change color one alpha, it will change both the top and the bottom alpha.
    #2 Set the fill type to linear gradient and move a point on the x axis and it will adjust the scale of a linear gradient.

    Thanks for adding those extra features and for your fast reply!
     
    Andrii likes this.
  15. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    Hey, Andrii

    After using the plugin more extensively, I found another bug and have some more feature requests. Protoshape 2D is an extremely good asset and I am not trying to put this plugin in a bad light but rather help the plugin grow to a very successful one.

    Current Setup:
    iMac (Retina 5K)
    Unity 2017.2.1f1
    ProtoShape 2D V1.15

    Bug:
    #1 When opening the DemoGame.Unity File
    Invalid layer id. Please use the unique id of the layer (which is not the same as its index in the list).
    UnityEngine.Renderer:set_sortingLayerID(Int32)
    ProtoShape2D:Update() (at Assets/ProtoShape2D/Scripts/ProtoShape2D.cs:130)

    Feature Requests:
    #1 Select one or more points and be able to remove all selected points, instead of one by one.
    #2 Unity box selection [select points that are inside the box selection and de-select points that are outside the box selection]
    #3 Presets [allow the user to save polygon to a file location, in which all projects with Protoshape 2D installed can access]
    #4 Line segment [Able to draw a line segment]
    #5 All of the other mentioned feature requests on this forum would be amazing!

    Thanks for an amazing plugin. I hope this really helps you out!
     
    Andrii likes this.
  16. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Thanks again for helping me to improve this asset. Adding those to my list.
     
    ChristopherMcLaughlin likes this.
  17. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    Hey, Andrii

    I really appreciate your amazing support and willingness to add those features.
    It is really going to help my game!

    Thanks
     
  18. k3ndro

    k3ndro

    Joined:
    Dec 8, 2016
    Posts:
    28
    Hi, just bought today. Trying to figure out if can I make UI objects with it, too?
     
  19. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Hi, there's no option to create UI yet.
     
  20. k3ndro

    k3ndro

    Joined:
    Dec 8, 2016
    Posts:
    28
    Does this take up more in the .apk size compared to using PNG?
     
  21. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    It usually should be lighter, since it's just geometry. Depending on how many details you add.
     
  22. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    @Andrii

    It'd be very cool if you could create a version of ProtoShape2D that uses the new Unity SVG API.

    https://forum.unity.com/threads/vector-graphics-preview-package.529845/

    They've released an API that has some of the basic functionality I think you'd need but they don't have the tooling that you have in ProtoShape2D.

    Would love either a new tool for vector graphics or updates to ProtoShape2D to support vector graphics.

    -Thanks

    -Jeff
     
  23. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Wow, didn't see that before. I'll check it out. Thanks, Jeff.
     
  24. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    Hey, Andrii

    Do you have any ETA on those updates? What does your timeline look like?

    Feature Requests:
    #1 Select all / deselect all [control rounding on all controls at once]
    #2 Antialiasing support when using a border
    #3 Pre-made basic shapes [square, circle, triangle, pentagon, hexagon, diamond, star]

    Thanks for this amazing asset!
     
  25. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    Hey, Andrii

    Just thought of this.

    Feature Requests:
    #1 Multiobject editing

    Thanks
     
  26. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Hey Christopher,

    Thanks for using my asset and thanks a lot for your ideas and suggestions!
    I'm working on this asset in my spare time and I don't always have a lot of it, but I'm working on it. So my timeline varies a lot from month to month. Last few months I didn't add any new features but I want to pick the pace in ucoming weeks. Some of these suggestions are asier to implement than the others, I'll add them to my list and I'll see what can I do now. And I have a small list of bugs and improvements of my own. I hope to add a few of them next week.

    Thanks again for choosing this asset and for you input!
     
  27. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    Hey, Andrii

    I understand, thanks for the update and your willingness to add those extra features! I look forward to the updates of this amazing plugin.

    Thanks
     
  28. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi Andrii, just wanted to chime in and say I'm very impressed with your asset! Controls are intuitive and I'm finding that it integrates into my custom tools perfectly. I'm always wary with 3rd party assets due to my lengthy production time, but I'm really happy with this so far. Many thanks!
     
    Last edited: Jun 4, 2018
    Andrii likes this.
  29. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Hey! Thanks a lot! And thanks for using my asset!
    And it would be relly great and helpful if you could leave a review like this on the asset store :) It will help to make the asset more popular.
    Thanks again!
     
  30. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi Andrii, sure will do! I did have one question though. Protoshape seems to have issues when duplicating the gameobject (with CTRL-D). Since it seems like something you'd want to do quite often, is there anything that can be done about this? Right now when you duplicate the two objects seem to share UVW mapping and things go awry. Thanks!
     
  31. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    When it happens are you using the texture/gradient as a fill? If so, the problem is that the duplicate object is using the same material os the original which it shouldn't do. I've just submitted the fix for it and it will go live on asset store in a few days.
    If you don't want to wait for the fix, you can apply it yourself by replacing a piece of code in ProtoShape2D.cs starting on the line 106. Replace the whole "else" block with this code:
    Code (CSharp):
    1.         }else{
    2.             ProtoShape2D[] arr=GameObject.FindObjectsOfType<ProtoShape2D>();
    3.             for(int i=0;i<arr.Length;i++){
    4.                 if(arr[i].uniqueName==uniqueName){
    5.                     uniqueName=Random.Range(1000,999999).ToString();
    6.                     if(fillType==PS2DFillType.Color || fillType==PS2DFillType.None){
    7.                         SetSpriteMaterial();
    8.                     }else if(fillType==PS2DFillType.CustomMaterial){
    9.                         SetCustomMaterial();
    10.                     }else{
    11.                         //Since it's a copy of an object, we unset the references to original object's materials
    12.                         this.defaultMaterial=null;
    13.                         mr.sharedMaterial=null;
    14.                         //This will create the new default material instead of using material of the original object
    15.                         SetDefaultMaterial();
    16.                     }
    17.                 }
    18.             }
    19.         }
     
    Noogy likes this.
  32. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi Andrii, wonderful, that did the trick, thanks! And yes, I was using texture fill.

    I'm also digging through the shader included, admittedly my shader knowledge is extremely weak. I'm attempting to create a version that receives lighting and scene fog. I see a few properties below the shader tags but am not sure whether they have any effect.
     
  33. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    I'll look into this and I'll try to create such a version. This makes a lot of sense as a feature for this asset.
     
    Noogy likes this.
  34. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    I could provide my sprite shader if needed, it's a simple modification to the sprite/diffuse to accept fog. I just don't have the know-how to implement your other attributes.
     
  35. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    If you could send me your shader and the demo scene with fog and lighting to test in, that would be great. My email is zl56io@gmail.com. I don't know when I would add that feature, but I'll try to do it in terms of two weeks.
     
  36. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Sorry for the delayed response, sure I'll assemble something for you.

    Edit: Hi Andrii, E3 kept me pretty busy but I finally put together a sample project and sent it to your email. Thanks for any help!
     
    Last edited: Jun 24, 2018
  37. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    I may just be missing the obvious place where this is answered, but does this support outlines? I see you posted a twitter image of them at some point, but I don't actually see it listed as a feature or in any of the asset store images.

    What's the status of the runtime tools?
     
  38. ChristopherMcLaughlin

    ChristopherMcLaughlin

    Joined:
    Mar 1, 2016
    Posts:
    13
    Hey, Andrii

    I have a few questions for you:
    #1 Any updates on the features I recommended?
    #2 Can I modify the source myself to fit my projects needs, if the updates are still a long way out?

    Thanks
     
  39. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Hey @Andrii

    I just started a new Unity project (Latest version of Unity) and brought proto shape.

    I'm getting the following compile-time error. Any ideas?
    UnityBug.PNG UnityBug2.PNG
     
  40. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Nevermind. Made new proto shape and all is good.
     
    Last edited: Aug 24, 2018
  41. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    @Andrii

    Hey, just wondering if you are still around and working on ProtoShape?

    I asked a while back about getting the ability to adjust the aliasing factor in the inspector. Still need it, just wondering if I should add it myself or if you have something in the works.

    I understand if you have become busy with other stuff. Would just love to know the status of this project as I intend to use it heavily in my next game.

    -Jeff
     
  42. misterHallodri

    misterHallodri

    Joined:
    Sep 8, 2013
    Posts:
    4
    Love this asset! Is there a way to make the bezier handles snap to the grid as well?
     
  43. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    @Andrii I think I found a slight color bug.

    When you use the fill type "Color" the actual color you get isn't quite right... at least it doesn't appear to be.

    To test:

    -Set your camera background to be a solid color. Pick a non-white or black color.
    -Now create a protoshape, set it's fill to color, and pick the exact same color.

    You should see that they are not the same.

    An interesting additional note. If you select fill type Texture and Color.... and don't select a texture, the color is correct.

    Hope you can find the time to look into this. Or even point me in the right direction. I tried fixing it myself with no luck.

    -Jeff
     
  44. ResiduelGG

    ResiduelGG

    Joined:
    Sep 27, 2017
    Posts:
    4
    Hey @Andrii ! Really solid asset - loving it so far!

    I have one tricky problem so far - maybe You can help me solve it. I am adding custom material to the ProtoShape2D which forks fine. But i am implementing some shader logic into this material which as well works fine - only thing is my custom shader requires plenty of vertices to work and look properly. Protoshape basically tries to generate least amount of vertices possible for Mesh Renderer. Trying to digg into core code right now, but for now no success. Can You please suggest a way to adjust code to manually force to generate a lot more vertices when creating the shape, because my shader needs lots of small vertex to work with. I tried manually adding additional points and curves, which increase vertex counts, but then shape is not what i want as well as resulting vertex count is still not enough.

    Could really use some help on thso one :)

    Oh and regards to Proto Shape, i have a small suggestion for possibility to draw shappe and connect its edges to form a closed shape. This is not an issue as you can always just intersect shapes, but would be cool if we could join shape and make it a closed one.

    Thanks!
     
  45. Andrii

    Andrii

    Joined:
    Sep 23, 2013
    Posts:
    136
    Hey @ResiduelGG,

    Thanks for choosing my asset! I've looked at the code and I think I have a solution for you. At least if you only need more points at the edges of the object. Youc an go to ProtoShape2D.cs, line 257 and add "|| true" the the "if" condition there.

    Code (CSharp):
    1. if(points[i].curve>0f || points.Loop(i+1).curve>0f || true){
    This way it will treat all lines as curves and generate additional endge points based on Curve iterations property.

    But if you want to have more points inside the object, there's no easy way to do it right now current setup. And I don't think it would be easy to do the intersections with it.

    Thanks,
    Andrii
     
  46. ResiduelGG

    ResiduelGG

    Joined:
    Sep 27, 2017
    Posts:
    4
    Will give it a go. Thanks!
     
  47. son1cman

    son1cman

    Joined:
    Jan 2, 2015
    Posts:
    15
    Great asset!! Im wondering how can i extract all the points that conform the curve?,not just the control points but the points that actually creates the shape

    This is what i want to do:

    In photoshop you can stroke path, this help you to add your custom texture or your own brush to an existing path. i want to do the same with you curve, not just change the color but actually add my texture to the path(
    ).

    A work around is to extract all the points that conform the actual curve and try to add my own texture using that information.

    Second, Can i animate the control points?

    Thanks for you reply.
     
  48. _Jens

    _Jens

    Joined:
    Apr 26, 2015
    Posts:
    5
    Yes please. pre-build shapes (ellipse,rectangle,etc) would add great value to this asset and help/speed-up the modeling. I also wonder if shape scale/resize (by changing the shape point x,y positions) would be good idea ?
     
    Last edited: Jan 10, 2019
  49. Bromm

    Bromm

    Joined:
    Nov 18, 2014
    Posts:
    18
    Hi. Does Protoshape 2d support holes in meshes?
     
  50. johnsolo

    johnsolo

    Joined:
    Jan 12, 2014
    Posts:
    7
    Hi, first of all, great asset! I am trying to create an animation of the ProtoShape2D outline. I've created the animation and confirm other properties are changing (like transform scale etc). But when I add a ProtoShape2D property to the animation, it never seems to change. Is this supposed to work with animation? Thanks!