Archive for May, 2014
Motionbuilder parent constraint tool
I’m currently working on the ultimate parent constraint tool for Motionbuilder.
So far the tool is very simple: select the child, select the parent and you have your constraint. In the future I want to add the option to automatically key the weight values before and after a certain range and choose the type of constraint as well.
This is what it looks like in action:
Motionbuilder python tool: parent constraint from Francesco Sternativo on Vimeo.
And this is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
''' Tool: Parent constraint tool V1.0 Owner: Francesco Sternativo www.sternativo.com ''' from pyfbsdk import * def parentConstraint(): #list the selected object displaying their name lSelectedObjects = [] selectedModels = FBModelList() FBGetSelectedModels (selectedModels, None, True, True) lSelectedObjects = [lModels.LongName for lModels in selectedModels] print 'the selected models are: ' + str(lSelectedObjects) def constraint (Name, Weight): CONSTRAINT_TYPE_AIM = 0 CONSTRAINT_TYPE_EXPRESSION = 1 CONSTRAINT_TYPE_MULTI_REFERENTIAL = 2 CONSTRAINT_TYPE_PARENT_CHILD = 3 CONSTRAINT_TYPE_PATH = 4 CONSTRAINT_TYPE_POSITION = 5 CONSTRAINT_TYPE_RANGE = 6 CONSTRAINT_TYPE_RELATION = 7 CONSTRAINT_TYPE_RIGID_BODY = 8 CONSTRAINT_TYPE_3_POINTS = 9 CONSTRAINT_TYPE_ROTATION = 10 CONSTRAINT_TYPE_SCALE = 11 CONSTRAINT_TYPE_MAPPING = 12 CONSTRAINT_TYPE_CHAIN_IK = 13 #constraint creation with type and name myManager = FBConstraintManager() myCons = myManager.TypeCreateConstraint(CONSTRAINT_TYPE_PARENT_CHILD) myCons.Name = Name #adding elements to the constraint slots for index, element in enumerate(lSelectedObjects): myCons.ReferenceAdd ( min(index, 1), FBFindModelByName(element)) #if I add an index > 1, it wont be added to the slot(dont know why) #setting up the snap option, so the elements will keep their position myCons.Snap() #weight of the constraint myCons.Weight = 100 print "constrained: " + str(lSelectedObjects[0])+ " to " +str(lSelectedObjects[1]) constraint("parent constraint", 100) parentConstraint() |
Diving in Lanzarote
A couple of weeks ago I’ve been in Lanzarote with one of my mates. We hang around Playa Blanca diving for four days and this is what that adventure looked like. I filmed the dives with my beloved and modified gopro hero 1. I think I’ve pushed it to the limit with this session…I guess I really have to upgrade my equipment!
Diving in Lanzarote 2014 from Francesco Sternativo on Vimeo.
Hey!
I usually build a new personal website, then delete it, make an another one and so on…hopefully this one will last quite a while!
I’m going to post some links of existing things I’ve made, just to fill it a bit. Hopefully in the next days I’ll post some new stuff like what I’ve been doing with python and motionbuilder 🙂