Beispiel #1
0
    def test_duplicate_and_reconstruct(self):
        test_utils.new_scene()
        self._head_and_cameras()
        settings = get_main_settings()
        headnum = settings.get_last_headnum()
        test_utils.deselect_all()
        test_utils.select_camera(headnum, 0)
        test_utils.out_pinmode()

        headobj = test_utils.select_by_headnum(headnum)
        bpy.ops.object.duplicate_move(
            OBJECT_OT_duplicate={
                "linked": False,
                "mode": 'TRANSLATION'
            },
            TRANSFORM_OT_translate={"value": (-4.0, 0, 0)})
        test_utils.save_scene(filename='before.blend')

        op = get_operator(Config.fb_reconstruct_head_idname)
        op('EXEC_DEFAULT')
        headnum2 = settings.get_last_headnum()
        head_new = settings.get_head(headnum2)
        # Two heads in scene
        self.assertEqual(1, settings.get_last_headnum())
        # Three cameras created
        self.assertEqual(2, head_new.get_last_camnum())
    def execute(self, context):
        filename_info = pkt.core_filename_info(self.filepath)
        warning = None

        if not filename_info.is_zip:
            warning = 'We distribute our Core Library as a ZIP-file. ' +\
                      'The selected file appears to be of a different type'
        elif not filename_info.is_keentools_core:
            warning = 'The selected file name appears to be different from Core library file name'
        elif filename_info.version != pkt.MINIMUM_VERSION_REQUIRED:

            def _version_to_string(version):
                return str(version[0]) + '.' + str(version[1]) + '.' + str(
                    version[2])
            warning = 'Core library version %s doesn\'t match the add-on version %s' %\
                      (_version_to_string(filename_info.version),
                       _version_to_string(pkt.MINIMUM_VERSION_REQUIRED))
        elif filename_info.os != pkt.os_name():
            warning = 'Your OS is %s, you\'re trying to install the core library for %s' %\
                      (pkt.os_name(), filename_info.os)
        elif filename_info.is_nightly:
            warning = 'You\'re installing an unstable nightly build, is this what you really want?'

        if warning is not None:
            install_with_warning = get_operator(
                PREF_OT_InstalFromFilePktWithWarning.bl_idname)
            install_with_warning('INVOKE_DEFAULT',
                                 filepath=self.filepath,
                                 filename=filename_info.filename,
                                 warning=warning)
            return {'FINISHED'}

        InstallationProgress.start_zip_install(self.filepath)
        return {'FINISHED'}
def test_duplicate_and_reconstruct():
    bpy.ops.object.select_all(action='DESELECT')
    bpy.ops.object.duplicate_move(
        OBJECT_OT_duplicate={"linked": False, "mode": 'TRANSLATION'},
        TRANSFORM_OT_translate={"value": (-3.0, 0, 0)})

    op = get_operator(Config.fb_history_actor_idname)
    op('EXEC_DEFAULT', action='reconstruct_by_head')
Beispiel #4
0
def create_camera(headnum, filepath):
    filename = os.path.basename(filepath)
    dir = os.path.dirname(filepath)
    op = get_operator(Config.fb_multiple_filebrowser_idname)
    op('EXEC_DEFAULT',
       headnum=headnum,
       directory=dir,
       files=({
           'name': filename
       }, ))
 def execute(self, context):
     if self.action == "print_work":
         test_print_work()
     elif self.action == "test_create_head_and_cameras":
         test_create_head_and_cameras()
     elif self.action == "test_move_pins":
         test_move_pins()
     elif self.action == "test_delete_last_сamera":
         test_delete_last_camera()
     elif self.action == "test_duplicate_and_reconstruct":
         test_duplicate_and_reconstruct()
     elif self.action == "test_error_message":
         warn = get_operator(Config.fb_warning_idname)
         warn('INVOKE_DEFAULT', msg=self.error_type)
     return {'FINISHED'}
def test_move_pins():
    # test_create_head_and_cameras()
    # Switch to PinMode
    select_camera(0, 0)

    fake_context = get_fake_context()

    brect = tuple(coords.get_camera_border(fake_context))
    arect = (396.5, -261.9, 1189.5, 1147.9)

    move_pin(793, 421, 651, 425, arect, brect)
    move_pin(732, 478, 826, 510, arect, brect)
    move_pin(542, 549, 639, 527, arect, brect)
    move_pin(912, 412, 911, 388, arect, brect)

    # Coloring wireframe
    op = get_operator(Config.fb_wireframe_color_idname)
    op('EXEC_DEFAULT', action='wireframe_green')
def move_pin(start_x, start_y, end_x, end_y, arect, brect,
             headnum=0, camnum=0):
    # Registered Operator call
    op = get_operator(Config.fb_movepin_idname)
    # Move pin
    x, y = coords.region_to_image_space(start_x, start_y, *arect)
    px, py = coords.image_space_to_region(x, y, *brect)
    print("P:", px, py)
    op('EXEC_DEFAULT', headnum=headnum, camnum=camnum,
       pinx=px, piny=py, test_action="add_pin")

    x, y = coords.region_to_image_space(end_x, end_y, *arect)
    px, py = coords.image_space_to_region(x, y, *brect)
    op('EXEC_DEFAULT', headnum=headnum, camnum=camnum,
       pinx=px, piny=py, test_action="mouse_move")

    # Stop pin
    op('EXEC_DEFAULT', headnum=headnum, camnum=camnum,
       pinx=px, piny=py, test_action="mouse_release")
Beispiel #8
0
def create_example_animation():
    op = get_operator(Config.fb_create_example_animation_idname)
    op('EXEC_DEFAULT')
Beispiel #9
0
def delete_blendshapes():
    op = get_operator(Config.fb_delete_blendshapes_idname)
    op('EXEC_DEFAULT')
Beispiel #10
0
def wireframe_coloring(action='wireframe_green'):
    op = get_operator(Config.fb_wireframe_color_idname)
    op('EXEC_DEFAULT', action=action)
Beispiel #11
0
def select_camera(headnum=0, camnum=0):
    op = get_operator(Config.fb_select_camera_idname)
    op('EXEC_DEFAULT', headnum=headnum, camnum=camnum)
Beispiel #12
0
def delete_camera(headnum, camnum):
    op = get_operator(Config.fb_delete_camera_idname)
    op('EXEC_DEFAULT', headnum=headnum, camnum=camnum)
Beispiel #13
0
 def test_wireframe_coloring(self):
     test_utils.new_scene()
     self._head_and_cameras()
     op = get_operator(Config.fb_wireframe_color_idname)
     op('EXEC_DEFAULT', action='wireframe_green')
Beispiel #14
0
def pickmode_start(headnum, camnum):
    op = get_operator(Config.fb_pickmode_starter_idname)
    op('EXEC_DEFAULT', headnum=headnum, camnum=camnum)
Beispiel #15
0
def create_head():
    # Create Head
    op = get_operator(Config.fb_add_head_operator_idname)
    op('EXEC_DEFAULT')
Beispiel #16
0
def pickmode_select(headnum, camnum, selected):
    op = get_operator(Config.fb_pickmode_idname)
    op('EXEC_DEFAULT', headnum=headnum, camnum=camnum, selected=selected)
def create_camera(dir, filename):
    headnum = get_last_headnum()
    op = get_operator(Config.fb_multiple_filebrowser_idname)
    op('EXEC_DEFAULT', headnum=headnum, directory=dir,
       files=({'name': filename},))