def poll(self, ctx): if ctx.active_object != None: obj = ctx.active_object if obj.type in ['CAMERA', 'LIGHT'] and has_constraint( obj, 'TRACK_TO'): return True return False
def execute(self, ctx): shape, joy = None, None for obj in ctx.selected_objects: if obj.type == 'EMPTY' and has_constraint(obj, 'LIMIT_LOCATION'): joy = obj if obj.active_shape_key_index > 0: shape = obj if joy != None and shape != None: mode = JoyStickCreator.direction if mode in [1, 2, 3, 4, 6, 7, 8, 9]: index = shape.active_shape_key_index key_block = shape.data.shape_keys.key_blocks[index] #TODO delet older driver driver = key_block.driver_add("value") driver.driver.type = 'SCRIPTED' if mode in [2, 4, 6, 8]: target = add_var(driver, 'var', joy) if mode in [2, 8]: target.transform_type = 'LOC_Y' else: target.transform_type = 'LOC_X' if mode in [1, 3, 7, 9]: targetx = add_var(driver, 'varx', joy) targetx.transform_type = 'LOC_X' targety = add_var(driver, 'vary', joy) targety.transform_type = 'LOC_Y' driver.driver.expression = get_expration(mode, joy) if index < len(shape.data.shape_keys.key_blocks) - 1: shape.active_shape_key_index = index + 1 self.report({'INFO'}, 'bpy.ops.rigg.joystick_shapekey_connector()') return {"FINISHED"}
def execute(self, ctx): cam = ctx.scene.camera if cam != None: bpy.ops.object.select_all(action='DESELECT') if self.selcam: cam.select_set(state=True) if self.seltrg: if has_constraint(cam, 'TRACK_TO'): targ = cam.constraints["Track To"].target targ.select_set(state=True) return {'FINISHED'}
def poll(self, ctx): if ctx.active_object != None: obj = ctx.active_object if obj.type == 'CAMERA' and not has_constraint(obj, 'TRACK_TO'): return True return False