# Easy Lattice editing addon, you are going to like the way you lattice

(kkar) #1

Hi

I created this addon which creates a lattice and lets you edit your meshes with the lattice quickly. This is proof of concept/working model however I am intending to make it more advanced when I more time.

Sometimes the bounding box may not fit well into your selection, so you probably will need to edit your lattice object in object level manually. However it is vastly easier than doing all by hand. Right now the size and the direction of the lattice calculated based on simple bounding box, but it will respect to rotations at object level. I probably will implement a selection aligned version later.

Here is a quick video that shows basic points of the addon.

• the lattice object
• associated lattice deformer
• and associated temporary selection weight group

how to use

-Select some verts in edit mode

-Press space bar and type “easy” as you type it will show up in the list

-It will create the lattice based on the selection and put you in lattice edit mode.

-Once you are done you can either apply the modifier yourself, or if you create a new easy lattice it will apply the previous one and create a new one.

You can also use it with full selection mode (all verts selected) to create a lattice that covers the whole thing

EDIT 5_3_2013 7:50pm :

thanks

k

(Spirou4D) #2

Great Thanks my Friend!
Spirou4D

(patmo141) #3

that’s awesome. I wrote a BBox to lattice script a few months ago but never got around to using it. This takes that one…(two three four ha ha) steps further. Well done!

-Patrick

(patmo141) #4

For your next improvement, I would align the BBox to the best fit plane of the selection and calc the BBox with that orientation. For a good best fit plane calculator, check out the source of the loop tools add on.

def bbox_to_lattice(scene, ob):

mx = ob.matrix_world
loc = get_bbox_center(ob, world=True)  #my own helper function..but you can figure that out
size = Vector((ob.dimensions[0], ob.dimensions[1], ob.dimensions[2]))

lat_data = bpy.data.lattices.new(ob.name[0:2] + "_control")
lat = bpy.data.objects.new(lat_data.name, lat_data)
lat.location = loc
lat.scale = 1.05*size
if lat.rotation_mode != 'QUATERNION':
lat.rotation_mode = 'QUATERNION'
lat.rotation_quaternion = mx.to_quaternion()
lat.data.points_u = 3
lat.data.points_v = 3
lat.data.points_w = 3
return lat

(SilverWolvie) #5

Yes something I really needed thank you.
why this was never in blender lol …

Anyways will it also work in 2.67?

(kkar) #6

Hi

I am glad that people find this stuff useful.

I created the addon based on my needs but I am sure that there will be some cases the placements will be wrong. So i will be improving to make sure the lattice placement is proper in all cases. Please make sure you are subscribed to this thread if you are interested in.

(kkar) #7

+++++UPDATE+++++
I added a new version, check the first post for details. This version should calculate the lattice center better hopefully.

(kkar) #8

patmo141

Aligned bbox is one of my original goals, I mentioned in my first post. So I am with you on that one it would be great if it aligns to the selection. That will be my next goal after making sure the lattice is placed/scaled correctly on all occasions.

k

(3Duaun) #9

very useful addon! thanks for creating sharing!

(masterxeon1001) #10

this add on is beyond cool. I am blown away kkar. Excellent work. I have always dreamed of some sort of soft setup for making modifications like this. I am very impressed and hope it can be a permanent part of blender. Long ago I wrote a list of things I wanted to learn in Blender and modelling utilizing lattices on the fly was one of them. You made my day sir.

(kkar) #11

masterxeon1001

Unfortunately we do not have easy to use/controllable modeling deformers in Blender but I believe this lattice addon(when it is mature) will be able to take care of most soft deforming needs. The nice thing about the lattice is that it can be used as a linear deformer(when used 2 control points) or soft deformer (more than 2 points on each axis).

The only thing I wish the lattice tool had is being able to use proportional editing with lattice points. Unfortunately proportional editing works only with mesh points. I might end up creating a Blender patch one day.

(masterxeon1001) #12

it would also be cool if instead of a box it was two lines that then allowed the x parameter then another set to make the y. Kinda like the behavior of the measure tool and how you can make angles. I see so many possibilities with this tool but my skills arent up to snuff with blender python but I’m definitely gonna get there. I’m actually working on integrating the Leap with Python and making a more interactive experience in Blender.

I would love to make this a part of it as well. Imagine the possibilities. But unfortunately I am fighting with modal operators and stuff like that.

(masterxeon1001) #13

is there any way it can be a button on the T panel? That would rock.

(kkar) #14

Here is my current todo list for the future versions.

masterxeon1001

I have not heard about Leap before, but it looks interesting and good luckc with the integration. There are lot helpful Blender devs around , I am sure you will be able to get up to speed with Blender development. You can also try the irc channel for devs when you need help with stuff.

k

(patmo141) #15

happy to code review. looks good so far

(spirit) #16

looks awesome. I have a question for you not releated to this addon, but Ive seen some morph modifier on your vimeo page - what it is about and how it is different from tha native shapekeys workflow - from what Ive seen there is nothing that can be done with shapekeys… sorry for bumping the thread…

(kkar) #17

spirit,

The morph modifier is a Blender patch. It is a modifier so you can stack in the modifier list. Shapekeys in Blender happens before anything else so you cannot change the order. Also this modifier lets you morph to another mesh (assuming that they have the same vert order), meanwhile the morphing held in shapekeys data is implicit. My modifier makes things a little bit tangible. It is not a replacement for the shapekeys in any means, they have different uses.

k

(mill) #18

This is awesome.
Now I do not need to bring a mesh to Maya when I use a lattice deformer.
There is one question though.
When I use the easy lattice addon, I can see a crease which never show up when I use a normal lattice.
It is noticeable if mesh has high poly count.
Is it possible to fix this?

(kkar) #19

mill

You can try changing lattice options (in item level). I generally use linear,m but there are other smoother options like spline, bezier etc. That could be it.

(mill) #20

Thank you very much.
It has solved the problem.

I prefer Bspline as a default interpolation.
Because when I usually add a lattice, Bspline is the default interpolation.