def get_bow_points(self): bow_obj = bpy.data.objects["bow"] #only do this once, for efficency vertex_groups = utils.getVertGroups(bow_obj) frog = utils.mean_of_vertex_group(bow_obj, vertex_groups, "hair-frog") tip = utils.mean_of_vertex_group(bow_obj, vertex_groups, "hair-point") wind = utils.mean_of_vertex_group(bow_obj, vertex_groups, "wrapping") return frog, tip, wind
def get_string_coords(self): """ gets the coordinates of the strings at bridge and nut, using relative coordinates to the violin body. """ string_coords = [] for i, st in enumerate(STRINGS): string_object = self.get_string_obj(i) # only do this once per string, for efficency vertex_groups = utils.getVertGroups(string_object) # support two naming schemes if "bridge-mark" in string_object.vertex_groups: bridge = utils.mean_of_vertex_group(string_object,vertex_groups, "bridge-mark") nut = utils.mean_of_vertex_group(string_object,vertex_groups, "nut-mark") else: bridge = utils.mean_of_vertex_group(string_object,vertex_groups, st+"-bridge-mark") nut = utils.mean_of_vertex_group(string_object,vertex_groups, st+"-nut-mark") bridge = string_object.matrix_local * bridge nut = string_object.matrix_local * nut string_coords.append( StringEnds(bridge, nut) ) return string_coords