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()
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)
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, auto_width=True, ), max_height=64 ) scroll_box.add_slot(vertical) window.set_content(scroll_box)
def build_combo_box(self): self.combo_box = SPythonComboBox(options_source=self.items, on_generate_widget=self.generate_combo_box_widget, content=STextBlock(text=self.get_current_item)) self.box.set_content(self.combo_box)
def generate_combo_box_widget(self, item): return STextBlock(text=item)
dynamic_combo_box = DynamicComboBox(['one','two', 'three']) # the final backslash is required for the 'pretty syntax' 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'),
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))
def fn_resettable(self): table_padding = (10, 5, 10, 5) btn_padding = (4, 4, 4, 4) # 기본 리스트 설정 self.chk_grid.add_slot( SBorder(padding=table_padding, h_align=2, v_align=2)(STextBlock(text=ctext.tableHeader_01)), column=0, row=0) self.chk_grid.add_slot( SBorder(padding=table_padding, h_align=2, v_align=2)(STextBlock(text=ctext.listHeader_01)), column=1, row=0) self.chk_grid.add_slot( SBorder(padding=table_padding, h_align=2, v_align=2)(STextBlock(text=ctext.listHeader_02)), column=2, row=0) self.chk_grid.add_slot( SBorder(padding=table_padding, h_align=2, v_align=2)(STextBlock(text=ctext.listHeader_03)), column=3, row=0) self.chk_grid.add_slot( SBorder(padding=table_padding, h_align=2, v_align=2)(STextBlock(text=ctext.listHeader_04)), column=4, row=0) # 테이블에서 엑셀 경로 가져오기 listxx = fn_Dafultxlsx(table_path.get_text()) if listxx == None: return None #ue.log(listxx) # 리스트 생성 for i in range(0, len(listxx)): bntlists.append(SetButtontlist(i)) i = 1 x = 0 for ttable in listxx: d = i name = ttable[0] #'엑셀파일 이름' sname = ttable[1] #'시트 이름' cname = ttable[2] #'컬럼 이름' uesasset = ttable[3] #'리소스 경로' self.chk_grid.add_slot(SBorder(padding=table_padding, h_align=2, v_align=2)( SEditableTextBox(text=str(i))), 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=sname)), column=2, row=i) self.chk_grid.add_slot(SBorder(padding=table_padding, h_align=2, v_align=2)(STextBlock(text=cname)), column=3, row=i) # 버튼 리스트 ADD self.chk_grid.add_slot(SBorder(padding=btn_padding, v_align=2)(bntlists[i - 1].set_bnt), column=4, row=i) i += 1 self.scroll.add_slot(self.chk_grid, auto_width=True, auto_hight=True)
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)
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) grid.add_slot(box, 0, 1) grid.add_slot(editor, 0, 2) horizontal.add_slot(grid, v_align=2,