def open_collada_wizard(self):
        def cancel_import():
            self.wizard.request_destroy()

        def confirm_import():
            self.do_import = True
            self.wizard.request_destroy()

        self.wizard = SWindow(
            title='Collada Import Options', modal=True,
            sizing_rule=1)(SVerticalBox()(
                ue.create_detail_view(self.ImportOptions),
                auto_height=True,
                padding=10)(
                    SHorizontalBox()(SButton(
                        text='Cancel',
                        on_clicked=cancel_import,
                        h_align=EHorizontalAlignment.HAlign_Center))(SButton(
                            text='Import',
                            on_clicked=confirm_import,
                            h_align=EHorizontalAlignment.HAlign_Center)),
                    auto_height=True,
                    padding=4,
                ), )
        self.wizard.add_modal()
def show():
    #Data
    saveDir = r"\\vietsap002\projects\R6\04_WIP\tools\perforce\proxyCheck"
    rootDir = ue.get_content_dir()
    matchType = compile(r'\.uasset\Z')
    allstaticmeshes = ue.get_assets_by_class("StaticMesh")
    uassetfolders = ((root,files) for root, subdirs, files in os.walk(rootDir)
        if any(matchType.search(file) for file in files))
    filterstaticmeshfolder = ((folder, list(
            staticmesh for staticmesh in allstaticmeshes
            if any(match("^{}".format(staticmesh.get_name()), ufile) for ufile in ufiles )))
        for folder, ufiles in uassetfolders)
    staticmeshfolder = ((folder, files) for folder, files in filterstaticmeshfolder if files)
    #UI
    window = SWindow().resize(512,1024).set_title("Export Static Mesh")
    vertical = SVerticalBox()
    #style = ButtonStyle(Normal=SlateBrush(TintColor=SlateColor(SpecifiedColor=FLinearColor(1, 0, 0))))
    #picker = SFilePathPicker(browse_title='Export To', browse_button_style=style, on_path_picked=path_picked)
    button = SButton().set_content(STextBlock().set_text("Export All").set_v_align(2)
    vertical.add_slot(button, v_align=0, h_align=0)
    vertical.add_slot(STextBlock().set_text("Export Folders:"), v_align=0, h_align=0)
    vertical.add_slot(picker, v_align=0, h_align=0)
    vertical.add_slot(STextBlock().set_text("Static Mesh Folders:"), v_align=0, h_align=0)
    for folder, ufiles in staticmeshfolder:
        button = SButton().set_content(STextBlock().set_text(os.path.relpath(folder, rootDir))).set_v_align(2)
        button.bind_on_clicked(partial(export, ufiles, saveDir))
        #vertical.add_slot(button, v_align=2, h_align=2)
        vertical.add_slot(button, v_align=0, h_align=0)
    window.set_content(vertical)
    #window.set_modal(True)
show()
示例#3
0
    def split_hips(self, animation, bone='Hips'):
        self.choosen_skeleton = None
        # first ask for which skeleton to use:
        self.window = SWindow(title='Choose your new Skeleton', modal=True, sizing_rule=1)(
                     SObjectPropertyEntryBox(allowed_class=Skeleton, on_object_changed=self.set_skeleton)
                 )
        self.window.add_modal()
        if not self.choosen_skeleton:
            raise DialogException('Please specify a Skeleton for retargeting')

        factory = AnimSequenceFactory()
        factory.TargetSkeleton = self.choosen_skeleton
        
        base_path = animation.get_path_name()
        package_name = ue.get_path(base_path)
        object_name = ue.get_base_filename(base_path)

        new_anim = factory.factory_create_new(package_name + '/' + object_name + '_rooted')

        new_anim.NumFrames = animation.NumFrames
        new_anim.SequenceLength = animation.SequenceLength

        # first step is generatin the 'root' track
        # we need to do it before anything else, as the 'root' track must be the 0 one
        for index, name in enumerate(animation.AnimationTrackNames):
            if name == bone:
                data = animation.get_raw_animation_track(index)
                # extract root motion
                root_motion = [(position - data.pos_keys[0]) for position in data.pos_keys]

                # create a new track (the root motion one)
                root_data = FRawAnimSequenceTrack()
                root_data.pos_keys = root_motion
                # ensure empty rotations !
                root_data.rot_keys = [FQuat()]
        
                # add  the track
                new_anim.add_new_raw_track('root', root_data)
                break
        else:
            raise DialogException('Unable to find bone {0}'.format(bone))
           
        # now append the original tracks, but removes the position keys
        # from the original root bone
        for index, name in enumerate(animation.AnimationTrackNames):
            data = animation.get_raw_animation_track(index)
            if name == bone:
                # remove root motion from original track
                data.pos_keys = [data.pos_keys[0]]
                new_anim.add_new_raw_track(name, data)
            else:
                new_anim.add_new_raw_track(name, data)

        new_anim.save_package()
示例#4
0
def show():
    rootDir = ue.get_content_dir()
    matchType = compile(r'\.uasset\Z')
    folders = (root for root, subdirs, files in os.walk(rootDir) if any(matchType.search(file) for file in files))
    window = SWindow().resize(512,1024).set_title("Export Static Mesh")
    vertical = SVerticalBox()
    vertical.add_slot(STextBlock().set_text("Export Folders:"), v_align=2, h_align=0)
    for folder in folders:
        button = SButton().set_content(STextBlock().set_text(os.path.relpath(folder, rootDir))).set_v_align(2)
        #vertical.add_slot(button, v_align=2, h_align=2)
        vertical.add_slot(button, v_align=0, h_align=0)
    window.set_content(vertical)
    #window.set_modal(True)
import unreal_engine as ue
from unreal_engine.classes import StaticMesh
from unreal_engine import SWindow, SScrollBox, SVerticalBox, SHorizontalBox, SImage, STextBlock, FARFilter
from unreal_engine.enums import EPixelFormat

_filter = FARFilter()
_filter.class_names = ['StaticMesh']

thumbnails = []

for static_mesh in ue.get_assets_by_filter(_filter):
    thumbnails.append((static_mesh.get_full_name(), static_mesh.get_thumbnail()))


window = SWindow(client_size=(1024, 512), title='StaticMeshes thumbnails')
scroll_box = SScrollBox()

vertical = SVerticalBox()

for name, thumbnail in thumbnails:
    texture = ue.create_transient_texture(thumbnail.get_image_width(), thumbnail.get_image_height())
    texture.texture_set_data(thumbnail.get_uncompressed_image_data())
    vertical.add_slot(
        SHorizontalBox()
        (
            SImage().set_texture(texture),
            max_width=64
        )
        (
            STextBlock(text=name),
            padding=4,
from unreal_engine import SWindow, SProgressBar, SButton, SVerticalBox
import unreal_engine as ue

progress_bar = SProgressBar()
canceled = False


def cancel_operation():
    global canceled
    ue.log_warning('slow operation canceled')
    canceled = True


SWindow(title='slow task', sizing_rule=1)(SVerticalBox()(progress_bar)(SButton(
    text='cancel', on_clicked=cancel_operation)))

for i in range(0, 10000):
    progress_bar.set_percent(1 / 10000 * i)
    ue.log('slow task iteration: {0}'.format(i))
    if canceled:
        break
    ue.slate_tick()
示例#7
0
SWindow(client_size=(1024, 576), title='DynamicComboBox')\
(
    SBorder(color_and_opacity=FLinearColor(0, 1, 0, 1), border_background_color=SlateColor(SpecifiedColor=FLinearColor(1, 0, 0, 1)))
    (
        SBox(h_align=EHorizontalAlignment.HAlign_Center, v_align=EVerticalAlignment.VAlign_Center)
        (
            SBorder(color_and_opacity=FLinearColor(0, 1, 0, 1), border_background_color=SlateColor(SpecifiedColor=FLinearColor(0, 1, 0, 1)))
            (
                SVerticalBox()
                (
                    STextBlock(text='Hello 1', tool_tip_text='Test Tool Tip')
                )
                (
                    STextBlock(text='Hello 2')
                )
                (
                    dynamic_combo_box.get_widget()
                )
                (
                    SHorizontalBox()
                    (
                        SEditableTextBox(text=lambda: '', on_text_committed=dynamic_combo_box.append),
                        fill_width=0.8
                    )
                    (
                        SButton(text='Ok'),
                        fill_width=0.2
                    )
                )
            )
        )
    )
)
import unreal_engine as ue
from unreal_engine import SFilePathPicker, SWindow, FLinearColor
from unreal_engine.structs import ButtonStyle, SlateBrush, SlateColor

# a style is required for the file picker
style = ButtonStyle(Normal=SlateBrush(TintColor=SlateColor(
    SpecifiedColor=FLinearColor(1, 0, 0))))

window = SWindow(client_size=(576, 576), title='Hello', modal=True)


def path_picked(path):
    print(path)
    window.request_destroy()


picker = SFilePathPicker(browse_title='Hello',
                         browse_button_style=style,
                         on_path_picked=path_picked)
window.set_content(picker)

window.add_modal()
示例#9
0
    def __init__(self):
        self.window = SWindow(client_size=(680, 530),
                              title='Resource List Check',
                              sizing_rule=0)
        self.hori_0 = SHorizontalBox()
        self.hori_0_0 = SHorizontalBox()
        self.hori_1_0 = SHorizontalBox()
        self.hori_2 = SHorizontalBox()
        self.hori_2_0 = SHorizontalBox()
        #self.hori_3_0 = SHorizontalBox()
        self.vert_0 = SVerticalBox()
        #self.vert_2 = SVerticalBox()
        self.main_vertical = SVerticalBox()

        self.scroll = SScrollBox(orientation=EOrientation.Orient_Vertical)
        self.chk_grid = SGridPanel()

        top_vertical = (0, 0, 0, 0)
        mid_vertical = (0, -400, 0, -390)
        bot_vertical = (0, 390, 0, 0)
        #zero_padding = (0,0,0,0)

        self.newindex = []
        self.newint = []

        self.txt_01 = STextBlock(text='엑셀 테이블 경로 : ')
        self.etb = SEditableTextBox().assign('table_path')

        self.hori_0.add_slot(self.txt_01, fill_width=0.1)
        self.hori_0.add_slot(self.etb, fill_width=0.4)
        self.hori_0.add_slot(SButton(text='...',
                                     fill_width=0.1,
                                     on_clicked=lambda: self.fn_sp()),
                             auto_width=True)
        self.hori_0.add_slot(SButton(text='@',
                                     fill_width=0.1,
                                     on_clicked=lambda: self.fn_test()),
                             auto_width=True)
        self.hori_0_0.add_slot(SBorder()(self.hori_0),
                               padding=top_vertical,
                               v_align=EVerticalAlignment.VAlign_Top)

        self.hori_1_0.add_slot(SBorder()(self.vert_0),
                               padding=mid_vertical,
                               v_align=EVerticalAlignment.VAlign_Fill)

        self.hori_2.add_slot(
            SButton(text='선택리스트 저장-TXT',
                    h_align=2,
                    v_align=2,
                    fill_width=0.1,
                    on_clicked=lambda: fn_sel()))
        self.hori_2.add_slot(
            SButton(text='저장리스트 비교-TXT',
                    h_align=2,
                    v_align=2,
                    fill_width=0.1,
                    on_clicked=lambda: fn_readtext()))
        self.hori_2.add_slot(STextBlock(text='  매칭 리스트 정렬 '),
                             auto_width=True,
                             v_align=EVerticalAlignment.VAlign_Center)
        self.hori_2.add_slot(sort_bool, auto_width=True)
        self.hori_2.add_slot(STextBlock(text='  리스트에 없는 에셋만 표시 '),
                             auto_width=True,
                             v_align=EVerticalAlignment.VAlign_Center)
        self.hori_2.add_slot(checkbox_bool, auto_width=True)
        self.hori_2_0.add_slot(SBorder()(self.hori_2),
                               padding=bot_vertical,
                               v_align=EVerticalAlignment.VAlign_Fill)

        # 초기설정파일 셋팅
        if fn_OpenDefaultSetting() != None:
            table_path.set_text(fn_OpenDefaultSetting())
            #테이블 리스트 함수 - 설정 경로 바탕으로 리스트를 작성 합니다
            if self.fn_resettable() != None:
                self.fn_resettable()
        else:
            ue.log('설정 파일이 없습니다')

        self.main_vertical.add_slot(self.hori_0_0)
        self.main_vertical.add_slot(SBorder()(self.scroll),
                                    padding=mid_vertical,
                                    v_align=EVerticalAlignment.VAlign_Fill)
        self.main_vertical.add_slot(self.hori_2_0)

        self.window.set_content(SBorder()(self.main_vertical))
示例#10
0
    def __init__(self, text, textlist, tablename):
        tablenametext = tablename
        self.window = SWindow(client_size=(1024, 600),
                              title='리소스 검색 결과 창' + tablename)
        self.vertical = SVerticalBox()
        self.horizon = SHorizontalBox()
        self.scroll = SScrollBox(orientation=EOrientation.Orient_Vertical)

        self.chk_grid = SGridPanel()
        table_padding = (10, 5, 10, 5)
        btn_padding = (4, 4, 4, 4)
        savepath = ''
        savelist = []

        self.chk_grid.add_slot(SBorder(padding=btn_padding, v_align=2)(SButton(
            text='현재 리스트 TXT 파일로 저장',
            on_clicked=lambda: SaveText(textlist, tablenametext))),
                               column=0,
                               row=0,
                               column_span=2)
        self.chk_grid.add_slot(
            SBorder(padding=table_padding, h_align=2,
                    v_align=2)(STextBlock(text=text.tableHeader_01)),
            column=0,
            row=1)
        self.chk_grid.add_slot(
            SBorder(padding=table_padding, h_align=2,
                    v_align=2)(STextBlock(text=text.tableHeader_02)),
            column=1,
            row=1)
        self.chk_grid.add_slot(
            SBorder(padding=table_padding, h_align=2,
                    v_align=2)(STextBlock(text=text.tableHeader_05)),
            column=2,
            row=1)
        self.chk_grid.add_slot(
            SBorder(padding=table_padding, h_align=2,
                    v_align=2)(STextBlock(text=text.tableHeader_04)),
            column=3,
            row=1)
        self.chk_grid.add_slot(
            SBorder(padding=table_padding, h_align=2,
                    v_align=2)(STextBlock(text=text.tableHeader_03)),
            column=4,
            row=1)

        #두번째 row 부터 리스트를 작성 한다.
        i = 2

        for ttable in textlist:  #range(1, 120):
            d = i
            color_val = color_gray
            stringsplit = ttable.split(',')
            name = stringsplit[0]
            path = stringsplit[1]
            assetname = stringsplit[2]
            uesasset = stringsplit[3]

            if '없음' == uesasset:
                color_val = color_red

            self.chk_grid.add_slot(SBorder(padding=table_padding,
                                           h_align=2,
                                           v_align=2)(STextBlock(text=str(i -
                                                                          1))),
                                   column=0,
                                   row=i)
            self.chk_grid.add_slot(SBorder(padding=table_padding,
                                           h_align=2,
                                           v_align=2)(STextBlock(text=name)),
                                   column=1,
                                   row=i)
            self.chk_grid.add_slot(SBorder(padding=table_padding,
                                           h_align=2,
                                           v_align=2)(STextBlock(
                                               text=uesasset,
                                               color_and_opacity=color_val)),
                                   column=2,
                                   row=i)
            self.chk_grid.add_slot(SBorder(padding=table_padding,
                                           h_align=2,
                                           v_align=2)(
                                               STextBlock(text=assetname)),
                                   column=3,
                                   row=i)
            self.chk_grid.add_slot(SBorder(padding=btn_padding, v_align=2)(
                SEditableTextBox(text=path)),
                                   column=4,
                                   row=i)

            i += 1

        self.scroll.add_slot(self.chk_grid, auto_width=True, auto_hight=True)
        self.vertical.add_slot(SBorder()(self.scroll),
                               auto_hight=True,
                               padding=5)
        self.window.set_content(self.vertical)
示例#11
0
from unreal_engine.classes import Blueprint


def clicked(geometry, pointer_event):
    ue.log('Hello')
    ue.log(geometry.fields())
    ue.log(pointer_event.fields())
    return True


def clicked2():
    ue.log('Test')
    return True


window = SWindow().resize(1024, 576).set_title('Hello World')

horizontal = SHorizontalBox()

button = SButton().set_content(STextBlock().set_text('Click ME !'))
button.bind_on_mouse_button_down(clicked)
button.bind_on_clicked(clicked2)

box = SEditableTextBox()

editor = SMultiLineEditableText()
editor.set_text('Hello')

grid = SGridPanel()

grid.add_slot(button, 0, 0)
示例#12
0
from unreal_engine import SWindow, SButton, SHorizontalBox, FARFilter

# 한글 문자열 수집을 위해 필요함
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

#윈도우 하나만 사용 하자!!! // Error가 있음
#if window != None:
#	window.request_destroy()

window = SWindow(client_size=(330, 32),
                 title='Widget Blueprint To Text',
                 sizing_rule=0)(
                     SHorizontalBox()(SButton(
                         text='전체 WBP 추출', on_clicked=lambda: WBPall()))(
                             # 함수에 연결된 버튼
                             SButton(text='선택한 WBP 추출',
                                     on_clicked=lambda: WBPsel()))(SButton(
                                         text='WBP텍스트 지우기',
                                         on_clicked=lambda: Wtestxx())))


# 테스트설정
def Wtestxx():
    selbp = ue.get_selected_assets()
    for aa in selbp:
        aa.save_package()
        uw = aa.WidgetTree
        allwid = uw.AllWidgets
        for wb in allwid:
            if wb.get_class().get_name() == 'TextBlock':