def comb_the_hair(self, hair, curve, index): count = len(hair.hair_keys) for i in range(0, count): percent = i / (count - 1) #TODO_01 this coordinate has to fixed by difrent of two objects cordinate coord = point_on_curve(curve, index, percent) hair.hair_keys[i].co = coord
def set_location(self, obj, path, time): p = point_on_curve(path, 0, time) p.x *= path.scale.x**2 p.y *= path.scale.y**2 p.z *= path.scale.z**2 location = p @ path.matrix_world.inverted() + path.location obj.location = location
def execute(self, ctx): objs = ctx.selected_objects.copy() path = ctx.active_object if path.type == 'CURVE': if len(objs) > 0 and path != None: if path in objs: objs.remove(path) count = len(objs) close = path.data.splines[0].use_cyclic_u for i in range(count): t = i / count if close else i / (count - 1) p = point_on_curve(path, 0, t) p.x *= path.scale.x**2 p.y *= path.scale.y**2 p.z *= path.scale.z**2 location = p @ path.matrix_world.inverted() + path.location objs[i].location = location self.report({'INFO'}, "bpy.ops.object.pathsort()") return {"FINISHED"}