Hi, I am trying to transform a mesh from it’s 4 first bounding box points to 4 other points that are not a 90 degree rectangle, is this easily possible?
Basically scripting moving cageedit with only corner points to a new location, but preferably faster than using the cageedit command.
Thanks, I was onto the path of using “FlowAlongSurface”, but I kind of expected there to be a much faster way
And I am not saying it isn’t fast, I just expected there to be a simpler (note easier) way that uses four points in an xform rather than a surfac-to-surface method…
Only downside is that the mesh is 1.1M faces, (each grass is one face only.)
But can be cool and maybe handy for those scenes when it’s needed.
Or carpets… None the less, a good exercise!
(And for that one person maybe who has read this and is still hungry for more: )
I use scripts to generate terrain from boundry curves (+ breaklines and holes) that automatically gives them a given thickness. Then another script to extract the top surfaces and combine those. After that I run QuadRemesh with target edge length.
And finally this new script to apply the mesh patch that I made with another script.
(I see that QuadRemesh messes up the far corner a little bit, making it too short and adding a triangular face, but that would be easy to fix manually if needed)
None and False are two different things. You can use both to end up with the same result, but since you’re either returning a mesh or nothing it makes semantically more sense to use None. Then actually testing for that is the biggest thing really that was missing from your code.
That looks neat! This is really what particle systems should be used for - to create this type of grass, fur and other scatter-like of similar items. But that is still daydreams.
edit: I hope that for this you’re “billboarding”. Have a couple of faces with textures on that are the grasses. Instead of having actual grass geometry per grass blade and a bunch of that per square.
I have only compared it like this, since that is what I have needed the last decade, but understanding more leads to more complex results faster, so this bakes nudles
bigMesh = False
if not bigMesh:
print "bigMesh does not exist"
bigMesh = None
if not bigMesh:
print "bigMesh does still not exist"
And the output is:
bigMesh does not exist
bigMesh does still not exist
This is not a very good thing to do, since there are more values that are falsey.
For instance if you have bigMesh = "" then if not bigMesh will still be true. That is also why it is better to explicitly test for if bigMesh is not None. None is an actual type you can test against. Make it a habit to return None for failure in your code where for success you’d return actual data (like a mesh, or brep, or some instance of a custom class you’ve implemented). Then test explicitly thing is not None. That way you can be sure you don’t fall accidentally in some of the false-true traps and have unintended logic.