Beispiel #1
0
def ui_elements(op: Boss_OT_base_ui):
    UICreator.deleteAllUi(op)

    global sels
    sels = bpy.context.selected_objects

    mouse_x,mouse_y = UICreator.mouse_xy(op)

    initX = mouse_x
    initY = mouse_y

    rd = RectData(
        initX,
        initY - element_height,
        element_width,
        element_height
    )

    reg_height = UICreator.rr(op).height - screen_margin[1]

    for o in sels:
        rd = rd.getTop(5)
        if rd.yMax > reg_height:
            initX += (element_width + element_space)
            rd.setPosition(initX, screen_margin[0])

        RTextField(op, rd, value=o.name, param=o, onValueChange=renameObj)

    bpy.ops.object.select_all(action='DESELECT')
Beispiel #2
0
def ui_elements(op: Boss_OT_base_ui):
    op.uip.deleteAllUi()

    global sels
    sels = bpy.context.selected_objects

    uip = op.uip

    initX = op.uip.mouse_x if start_point[0] == -1 else start_point[0]
    initY = op.uip.mouse_y if start_point[1] == -1 else start_point[1]

    rd = RectData(initX, initY - element_height, element_width, element_height)

    reg_height = uip.region_rect.height - screen_margin[1]

    for o in sels:
        rd = rd.getTop(5)
        if rd.yMax > reg_height:
            initX += (element_width + element_space)
            rd.setPosition(initX, screen_margin[0])

        UICreator.textField(op,
                            rd,
                            value=o.name,
                            param=o,
                            onValueChange=renameObj)
        RTextField(op, rd, value=o.name, param=o, onValueChange=renameObj)

    bpy.ops.object.select_all(action='DESELECT')
Beispiel #3
0
def ui_elements(op: Boss_OT_base_ui):
    UICreator.deleteAllUi(op)  #  delete any existing UI

    o = bpy.context.object

    mouse_x, mouse_y = UICreator.mouse_xy(op)

    rd = (mouse_x, mouse_y - 25, 200, 25)

    UICreator.textField(op, rd, text=o.name, param=o, onValueChange=renameObj)
def ui_elements(op):
    UICreator.deleteAllUi(op)  # to delete all existing ui

    btn_width, btn_height = 100, 40

    mouse_x, mouse_y = UICreator.mouse_xy(op)

    rd = (mouse_x, mouse_y - btn_height, btn_width, btn_height)

    UICreator.button(op, rd, 'btn_text', onClick)
Beispiel #5
0
def ui_elements(op):
    UICreator.deleteAllUi(op)  # to delete all existing ui

    btn_width, btn_height = 100, 40

    rr = UICreator.rr(op)  # region_rect:rr

    rd = (rr.width / 2 - btn_width / 2, rr.height / 2 - btn_height / 2,
          btn_width, btn_height)

    UICreator.button(op, rd, 'text', onClick)
Beispiel #6
0
def ui_elements(op):
    UICreator.deleteAllUi(op)  # to delete all existing ui
    btn_width, btn_height = 100, 40

    rr = UICreator.rr(op)  # region_rect(rr)

    rd = (rr.width / 2 - btn_width / 2, rr.height / 2 - btn_height / 2,
          btn_width, btn_height)
    UICreator.textField(op,
                        rectData=rd,
                        text='Cube',
                        onEnterPress=onEnterPress)
Beispiel #7
0
def ui_elements(op):
    # op.uip.deleteAllUi() # to delete all existing ui
    btn_width, btn_height = 100, 40

    rr = op.uip.region_rect

    rd = (rr.width / 2 - btn_width / 2, rr.height / 2 - btn_height / 2,
          btn_width, btn_height)
    UICreator.textField(op,
                        rectData=rd,
                        text='Cube',
                        onTextChange=None,
                        onValueChange=None,
                        onEnterPress=onEnterPress)
Beispiel #8
0
def ui_elements(op):
    cc.deleteAllUi(op)  # to delete all existing ui
    mouse_x, mouse_y = cc.mouse_xy(op)
    btn_height, btn_width = 50, 200

    rd = RectData(mouse_x, mouse_y - 50, btn_width, btn_height)

    btn_title = cc.button(op, rd, text='Title Bar')

    space = 10

    rd = rd.getBottom(space)

    cc.button(
        op,
        rd,
        text='button 1',
        buttonData=onClick,
        parent=btn_title,
        canDrag=False,
    )

    rd = rd.getBottom(space)

    cc.button(
        op,
        rd,
        text='button 2',
        buttonData=onClick,
        parent=btn_title,
        canDrag=False,
    )
def ui_elements_inCircle(op: Boss_OT_base_ui):
    """duplicated selected objects in order in new collection"""

    C = bpy.context
    objs = C.selected_objects

    if len(objs) < 1:
        return {'no object selected, select something'}

    vff_pivotPos = UICreator.vectorFloatField(op, (0, 0, 100, 50),
                                              (0.0, 0.0, 0.0), resetPositions)

    ff_angle = UICreator.floatField(op, vff_pivotPos.rectData.getTop(5), 0.0,
                                    resetPositions)
    tf_axis = UICreator.textField(op, ff_angle.button.rectData.getTop(5), 'z',
                                  resetPositions)

    vff_rotation = UICreator.vectorFloatField(
        op, tf_axis.button.rectData.getTop(5), (0.0, 0.0, 0.0), resetPositions)
    vff_scale = UICreator.vectorFloatField(op, vff_rotation.rectData.getTop(5),
                                           (0.0, 0.0, 0.0), resetPositions)

    cb_inNewCollection = UICreator.checkBox(op, vff_scale.rectData.getTop(5),
                                            'new collection', True)

    cb_collectionUnderScene = UICreator.checkBox(
        op, cb_inNewCollection.button.rectData.getTop(5), 'under the scene',
        True)

    if_copies = UICreator.intField(op,
                                   cb_collectionUnderScene.button.getTop(5), 1)
Beispiel #10
0
def ui_elements(op):
    def onClicked():
        print('Button is Clicked')

    def dragging(some_param):
        print(some_param)

    def onWheel(caller, addby):
        caller.param += addby
        print('param is now', caller.param)

    buttonData=ButtonData(
                onClick=onClicked,
                onMouseEnter=lambda :print('mouse entered'),
                onMouseExit=lambda :print('mouse exited'),
                onWheelUp=(onWheel, 1),
                onWheelDown=(onWheel, -1),
                onDragBegin=(dragging, 'dragging is started'),
                onDrag=(dragging, "it's being dragged"),
                onDragEnd=(dragging, 'dragging is ended')
            )
    button = UICreator.button(
            op=op,
            rectData=RectData(10, 110, 200, 100),
            text='ButtonText',
            buttonData=buttonData,
            ttt='tool tip text',
            param=100
        )
Beispiel #11
0
def ui_elements(op: Boss_OT_base_ui):
    # UICreator.deleteAllUi(op)  # to delete all existing ui
    btn_width, btn_height = 150, 40
    space = 10

    rd = RectData(op.uip.mouse_x, op.uip.mouse_y - btn_height, btn_width,
                  btn_height)

    vbf = UICreator.vectorBooleanField(op,
                                       rectData=rd,
                                       value=(True, False, True),
                                       onValueChange=onValueChanged,
                                       param='This can be any python object')
    # can also be used
    # vbf.add_onValueChange(onValueChanged)

    rd = rd.getBottom(space)

    vff = UICreator.vectorFloatField(op,
                                     rectData=rd,
                                     value=(0.0, 0.0, 0.0),
                                     onValueChange=onValueChanged,
                                     onTextChange=onTextChanged,
                                     onEnterPress=onEnterPressed,
                                     param='This can be any python object')
    # can also be used
    # vff.add_onTextChange(onTextChanged)
    # vff.add_onValueChange(onValueChanged)
    # vff.add_onEnterPress(onEnterPressed)

    rd = rd.getBottom(space)

    vif = UICreator.vectorIntField(
        op,
        rectData=rd,
        value=(0, 0, 0),
        # can also be used
        # onValueChange=onValueChanged,
        # onTextChange=onTextChanged,
        # onEnterPress=onEnterPressed,
        param='This can be any python object')
    vif.add_onTextChange(onTextChanged)
    vif.add_onValueChange(onValueChanged)
    vif.add_onEnterPress(onEnterPressed)
Beispiel #12
0
def ui_elements(op: Boss_OT_base_ui):
    UICreator.button(op=op,
                     rectData=RectData(10, 110, 200, 100),
                     text='ButtonText',
                     buttonData=ButtonData(
                         onClick=onClicked,
                         onMouseEnter=lambda: print('mouse entered'),
                         onMouseExit=lambda: print('mouse exited'),
                         onWheelUp=(onWheel, 1),
                         onWheelDown=(onWheel, -1),
                         onDragBegin=(dragging, 'dragging is started'),
                         onDrag=(dragging, "it's being dragged"),
                         onDragEnd=(dragging, 'dragging is ended')),
                     ttt='tool tip text',
                     tti='',
                     canDrag=True,
                     parent=None,
                     rectIsLocal=False,
                     param=100)
Beispiel #13
0
def ui_elements(op: Boss_OT_base_ui):
    # UICreator.deleteAllUi(op)  # to delete all existing ui
    btn_width, btn_height = 150, 40
    rd = RectData(op.uip.mouse_x, op.uip.mouse_y - btn_height, btn_width,
                  btn_height)

    textField = UICreator.textField(op,
                                    rectData=rd,
                                    onTextChange=onTextChanged,
                                    onValueChange=onValueChanged,
                                    onEnterPress=onEnterPressed)
Beispiel #14
0
def ui_elements(op: Boss_OT_base_ui):
    button = UICreator.button(op=op,
                              rectData=RectData(10, 110, 200, 100),
                              text='ButtonText',
                              buttonData=ButtonData(onClick=onClicked),
                              ttt='tool tip text',
                              param=(1, 'two', 3.0))
    # This adds callback
    button.add_onClick(onClicked1, 1, 'two', 3.0)
    button.add_onClick(onClicked2)
    button.add_onClick(onClicked3, 1, 'two', 3.0)
    button.add_onClick(lambda caller: print('lambda-', caller, caller.param))
def ui_elements(op: Boss_OT_base_ui):
    button = UICreator.button(op=op,
                              rectData=RectData(10, 110, 200, 100),
                              text='ButtonText',
                              buttonData=None,
                              ttt='tool tip text',
                              param=100)

    button.add_onClick(onClicked)
    button.add_onMouseEnter(lambda: print('mouse entered'))
    button.add_onMouseExit(lambda: print('mouse exited'))
    button.add_onWheelUp((onWheel, 1))
    button.add_onWheelDown((onWheel, -1))
    button.add_onDragBegin((dragging, 'dragging is started'))
    button.add_onDrag((dragging, "it's being dragged"))
    button.add_onDragEnd((dragging, 'dragging is ended'))
Beispiel #16
0
def ui_elements(op):
    UICreator.deleteAllUi(op)
    mouse_x, mouse_y = UICreator.mouse_xy(op)

    rd = RectData(mouse_x,mouse_y-50,200,50)
    btn_title = UICreator.button(op,rd,'Turntable')

    rd = rd.getBottom(5)
    if_frame_start = UICreator.intField(
        op,rd,1,parent=btn_title,canDrag=False,ttt='start frame')

    rd = rd.getBottom(5)

    if_frame_end = UICreator.intField(
        op, rd, 150,parent=btn_title,canDrag=False,ttt='end frame')

    rd = rd.getBottom(5)

    param = if_frame_start, if_frame_end
    btn_create = UICreator.button(
        op, rd, 'Create', turnTable, param=param, parent=btn_title, canDrag=False)
Beispiel #17
0
def ui_elements(op: Boss_OT_base_ui):
    UICreator.deleteAllUi(op)

    sel_obj = create_grid()

    fv = FieldValue(value=(3, 3, 1),
                    min=(0, 0, 0),
                    max=(10, 10, 10),
                    changeBy=(1, 1, 1))
    vif_cnt = UICreator.vectorIntField(op,
                                       RectData(100,
                                                UICreator.rr(op).height - 150,
                                                200, 50),
                                       value=fv,
                                       onValueChange=onCountChanged,
                                       param=sel_obj)

    UICreator.button(op,
                     vif_cnt.rectData.getBottom(5),
                     text='Apply',
                     buttonData=apply_mods,
                     param=sel_obj)
Beispiel #18
0
def ui_elements(op: Boss_OT_base_ui):
    UICreator.deleteAllUi(op)  # to delete all existing ui
    btn_width, btn_height = 150, 40
    space = 10
    rr = UICreator.rr(op)
    rd = RectData(
        op.uip.mouse_x,
        rr.height - 150,
        # op.uip.mouse_y - btn_height,
        btn_width,
        btn_height
    )

    UICreator.button(
        op=op,
        rectData=rd,
        text='btn_text',
        buttonData=None,
        ttt='button tooltip',
        tti=r'C:\Users\abc\Desktop\boss_location.png',
        canDrag=True,
        parent=None,
        rectIsLocal=False,
        param=None
    )

    rd = rd.getBottom(space)
    UICreator.textField(
        op,
        rectData=rd,
        onTextChange=onTextField_TextChanged,
        onValueChange=onTextField_ValueChanged,
        onEnterPress=onTextField_EnterPressed,
        ttt='This is tool_tip_text (ttt)',
        tti=r'C:\Users\abc\Desktop\boss_location.png',
        canDrag=True,
        parent=None,
        rectIsLocal=False
    )

    rd = rd.getBottom(space)
    UICreator.intField(
        op,
        rectData=rd,
        value=1,
        onTextChange=onTextChange,
        onValueChange=onValueChange,
        onEnterPress=onEnterPress,
        ttt='This is tool_tip_text (ttt)',
        tti=r'C:\Users\abc\Desktop\boss_location.png',
        canDrag=True,
        parent=None,
        rectIsLocal=False

    )

    rd = rd.getBottom(space)
    UICreator.floatField(
        op,
        rectData=rd,
        value=0.0,
        onTextChange=onTextChange,
        onValueChange=onValueChange,
        onEnterPress=onEnterPress,
        ttt= 'This is tool_tip_text (ttt)',
        tti = r'C:\Users\abc\Desktop\boss_location.png',
        canDrag = True,
        parent = None,
        rectIsLocal = False
    )

    rd = rd.getBottom(space)
    UICreator.checkBox(
        op=op,
        rectData=rd,
        text='checkBox',
        value=False,
        onValueChange=None,
        ttt='checkBox',
        tti=r'C:\Users\abc\Desktop\boss_location.png',
        canDrag=True,
        parent=None,
        rectIsLocal=False,
        param=None
    )
    rd = rd.getBottom(space)

    UICreator.vectorBooleanField(
        op,
        rectData=rd,
        value=(True, False, True),
        onValueChange=onValueChange,
        ttt='This is tool_tip_text (ttt)',
        tti=r'C:\Users\abc\Desktop\boss_location.png',
        canDrag=True,
        parent=None,
        rectIsLocal=False

    )

    rd = rd.getBottom(space)

    UICreator.vectorFloatField(
        op,
        rectData=rd,
        value=(0.0, 0.0, 0.0),
        onValueChange=onValueChange,
        onTextChange=onTextChange,
        onEnterPress=onEnterPress,
        ttt='This is tool_tip_text (ttt)',
        tti=r'C:\Users\abc\Desktop\boss_location.png',
        canDrag=True,
        parent=None,
        rectIsLocal=False
    )

    rd = rd.getBottom(space)

    UICreator.vectorIntField(
        op,
        rectData=rd,
        value=(0, 0, 0),
        onValueChange=onValueChange,
        onTextChange=onTextChange,
        onEnterPress=onEnterPress,
        ttt='This is tool_tip_text (ttt)',
        tti=r'C:\Users\abc\Desktop\boss_location.png',
        canDrag=True,
        parent=None,
        rectIsLocal=False
    )
Beispiel #19
0
def ui_elements(op):
    # Button(op, RectData(10,10,100,50))
    # or
    UICreator.button(op, RectData(10, 10, 100, 50))
def ui_elements_inCircle(op: Boss_OT_base_ui):
    """ duplicated selected objects in order in new collection """

    objs = bpy.context.selected_objects
    if len(objs) < 1:
        return {'no object selected, select something'}

    global vff_pivotPos
    global ff_angle
    global tf_axis
    global cb_inNewCollection
    global cb_collectionUnderScene
    global if_copies

    vff_pivotPos = UICreator.vectorFloatField(op, (0, 0, 100, 50),
                                              (0.0, 0.0, 0.0), placeObjects)

    ff_angle = UICreator.floatField(op, vff_pivotPos.rectData.getTop(5), 30.0,
                                    placeObjects)

    tf_axis = UICreator.textField(op, ff_angle.button.rectData.getTop(5), 'Z')

    cb_inNewCollection = UICreator.checkBox(op,
                                            tf_axis.button.rectData.getTop(5),
                                            'new collection', False,
                                            onNewCollectionChanged)

    cb_collectionUnderScene = UICreator.checkBox(
        op, cb_inNewCollection.button.rectData.getTop(5), 'under the scene',
        False, onUnderSceneCollectionPressed)

    if_copies = UICreator.intField(op,
                                   cb_collectionUnderScene.button.getTop(5), 3,
                                   onCopiesChanged)

    global copies
    global dict_createdObj
    global dict_collections

    copies = if_copies.value

    # create collections in the beginning

    dict_collections = {obj: getCollection(obj) for obj in objs}

    dict_createdObj.update({o: [] for o in objs})
    dict_objsToDelete.update({o: [] for o in objs})

    # Create new objects and link those to collection
    for (obj, coll), createdObjList in zip(dict_collections.items(),
                                           dict_createdObj.values()):
        for i in range(copies):
            ob = copyObj(obj, False, False, True)
            ob.name = obj.name + '_dupli_' + str(i)
            coll.objects.link(ob)
            createdObjList.append(ob)

    # place objects
    placeObjects()

    op.onCancel.append(cleanup)
Beispiel #21
0
def ui_elements(op):
    cc.deleteAllUi(op)  # to delete all existing ui
    mouse_x, mouse_y = cc.mouse_xy(op)
    btn_height, btn_width = 50, 200

    rd = RectData(mouse_x, mouse_y - 50, btn_width, btn_height)

    btn_title = cc.button(op, rd, text='Title Bar',
                                 ttt='This is a button, you can drag it'
                                 )

    space = 0#10

    rd = rd.getBottom(space)

    cc.button(
        op,rd,
        text='text',
        buttonData=onClick,
        parent = btn_title,
        canDrag = False,
        ttt='This is a button'
    )

    rd = rd.getBottom(space)
    cc.textField(
        op,rd,
        onTextChange=onTextField_TextChanged,
        onValueChange=onTextField_ValueChanged,
        onEnterPress=onTextField_EnterPressed,
        parent = btn_title,
        canDrag = False,
        ttt='This is a TextField'
    )

    rd = rd.getBottom(space)
    cc.intField(
        op,rd,
        value=1,
        onTextChange=onTextChange,
        onValueChange=onValueChange,
        onEnterPress=onEnterPress,
        parent = btn_title,
        canDrag = False,
        ttt='This is a IntField'

    )

    rd = rd.getBottom(space)
    cc.floatField(
        op,rd,
        value=0.0,
        onTextChange=onTextChange,
        onValueChange=onValueChange,
        onEnterPress=onEnterPress,
        parent = btn_title,
        canDrag = False,
        ttt='This is a FloatField'
    )

    rd = rd.getBottom(space)
    cc.checkBox(
        op,rd,
        text='text',
        value=True,
        onValueChange=onValueChange,
        parent = btn_title,
        canDrag = False,
        ttt='This is a Checkbox(boolean)'
    )
    rd = rd.getBottom(space)

    cc.vectorBooleanField(
        op,rd,
        value=(True, False, True),
        onValueChange=onValueChange,
        parent = btn_title,
        canDrag = False,
        ttt='This is VectorBooleanField'
    )

    rd = rd.getBottom(space)

    cc.vectorFloatField(
        op,rd,
        value=(0.0, 0.0, 0.0),
        onValueChange=onValueChange,
        onTextChange=onTextChange,
        onEnterPress=onEnterPress,
        parent = btn_title,
        canDrag = False,
        ttt='This is VectorFloatField'
    )

    rd = rd.getBottom(space)

    cc.vectorIntField(
        op, rd,
        value=(0, 0, 0),
        onValueChange=onValueChange,
        onTextChange=onTextChange,
        onEnterPress=onEnterPress,
        parent = btn_title,
        canDrag = False,
        ttt='This is VectorIntField'
    )