Skip to main content
Search
Search This Blog
Leegoonz game Developer blog.
Visual strategy development lab Technical Art Director. Now working atAllegorithmic.
페이지
Home
About Leegoonz
LEEGOONZ.COM
ADVANCED SHADER DOT COM
ADVANCED SHADER FACEBOOK COMMUNITY
Substance user group in korea
More…
Share
Get link
Facebook
X
Pinterest
Email
Other Apps
Labels
programming
May 21, 2013
맥스 스크립트. 플레이너리 BG 유틸. 버전.0.95
--//=====================================================================================================//-- --//======================================== DEFINE VARIABLES =========================================//-- global iconPath = (GetDir #scripts + "\\PLAYNERY\\" + "playnery.bmp") if not doesFileExist (iconPath) then iconPath = "" --//=====================================================================================================//-- --//======================================= FUNCTIONS PROPERTICES =========================================//-- fn MakeBoxDisRendererOff bool= --가이드메시의 렌더링 속성과 디스플레이 속성을 변경 합니다.(렌더러블 오프 , 디스플레이 박스 온) ( local sels = #() local eventsels = select $'doorevent*' if eventsels != 0 do ( selectMore $'envmap*' sels = selection as array for i in sels do --루프를 돌려서 버튼 리플레시 안되는 것을 해결. ( sels.renderable = off sels.boxmode = on ) ) clearselection() ) fn MakeBoxDisRendererOn bool= --가이드 메시의 변경 된 속성을 원상복귀 시킵니다.(렌더러블 온 , 디스플레이 박스 오프) ( local sels = #() local eventsels = select $'doorevent*' if eventsels != 0 do ( selectMore $'envmap*' sels = selection as array for i in sels do --루프를 돌려서 버튼 리플레시 안되는 것을 해결. ( sels.renderable = on sels.boxmode = off ) ) clearselection() ) --//======================================= FUNCTIONS MATERIALS =========================================//-- fn ApplyMapEnabler bool = ( local objs = #() objs = objects as array for o in objs do ( if classof o.material == Standardmaterial do ( o.material.diffuseMapEnable = bool ) ) ) fn ApplyMM_MapEnabler bool = ( /*a = #() a=$.material.materialList.count */ mySlot = medit.GetActiveMtlSlot() myMaterial = getMeditMaterial mySlot mySubs = myMaterial.numsubs for i = 1 to mySubs do ( myMaterial.materialList[i].diffuseMapEnable = bool myMaterial.materialList[i].ambientMapEnable = bool myMaterial.materialList[i].specularLevelMapEnable = bool --myMaterial.materialList[i].bumpMapEnable = bool ) ) fn CleanMultiMatSort bool = ( sels = selection as array if sels.count ==0 do return undefined --선택 객체가 없으면 undefined 을 리턴하여 예외처리. ( sels = Clean_MultiMaterial.MMCleanActions.CleanMaterailsAll() macros.run "Medit Tools" "condense_medit_slots" --클린업 후 메트리얼 슬롯을 초기화 합니다. ) ) --//=============================================================================================================//-- --//=============================================== DEFINE ROLLOUTS ==========================================//-- screenHeight = sysInfo.desktopSize[2] --the second value in the point2 is the height screenMiddle = screenHeight / 2 if PlayneryBG_Tools_MasterFloater != undefined then CloseRolloutFloater PlayneryBG_Tools_MasterFloater PlayneryBG_Tools_MasterFloater = newRolloutFloater "PlayneryBG_Tools Toolbox" 420 900 1745 (screenMiddle-650) --******************************************************************************************************************- --**********************************************인포메이션 롤아웃 ***************************************************- rollout info_rollout "Version 0.15" category:1 ( bitmap Banner_Btmp "Bitmap" width:300 height:60 border:0 fileName:(iconPath) HyperLink Hypl_homepage "PLAYNERY" align:#center width:65 height:15 address:"http://playnery.com" color:(color 255 0 0) hovercolor:(color 255 255 255) visitedcolor:(color 255 0 0) label email_label "jp.lee@playnery.com" align:#right ) --******************************************************************************************************************- --*******************************************메시프러퍼티 롤아웃 ***************************************************- rollout Propertices_rollout "Propertices" category:2 ( Group "메시 프러퍼티 체인지 메니저" ( label meshmanagerName1 "Tip:선택 한 메시의 프로퍼티를 일괄 수정 합니다." align:#left editText LayerName "Layer name: " width:130 height:15 text:"collider" button ApplyLayerBtn "Make Layer Group" pos:[150,45] width:138 height:16 tooltip:"충돌메시 레이어 그룹을 만들어 적용 합니다." ) on ApplyLayerBtn pressed do --선택한 오브젝트를 콜리션 레이어를 만들고 넣어 준다. ( local sels = #() sels = selection as array if sels.count == 0 then ( messagebox "콜리션 오브젝트를 선택 하세요." return undefined ) else ( newLayer = LayerManager.newLayerFromName(LayerName.text) --신규레이어를 생성합니다. -- collLayer = LayerManager.getLayerFromName "collider" for x in sels do ( newLayer.addNode x ) ) ) Group "가이드메시 속성관리" ( label mesh_ropertices_info1 "Tip: 해당 씬 안의 관련 오브젝트를 선택 할 필요 없습니다." align:#left withd:25 label mesh_ropertices_info2 "자동처리 되니 버튼만 원 클릭!" align:#left withd:25 button ApplyBoxDisBtn "Env/event mesh Propertices [Renderer off]" pos:[10,130] ; width:220 height:24 tooltip:"씬 안의 env 와 event 메시의 렌더링 속성과 박스디스플레이로 일괄 변경" button ApplyBoxDisRevertBtn "Revert Propertices" pos:[235,130] width:100 height:24 tooltip:"씬 안의 env 와 event 메시의 렌더링 속성을 원상태로 복원" ) on ApplyBoxDisBtn pressed do ( MakeBoxDisRendererOff true print "Debug.Log: MakeBoxDisRendererOff" ) on ApplyBoxDisRevertBtn pressed do ( MakeBoxDisRendererOn true print "Debug.Log: MakeBoxDisRendererOff" ) ) --******************************************************************************************************************- --*********************************************던전메니저 롤아웃 ***************************************************- rollout DunManager_rollout "Dungeon data manager" category:3 ( Group "어태치 디테치 원클릭 기능" ( label DungeonManagerTipName "Tip: 던전 모델링의 바닥 메시를 제외 하고 어태치 시켜줍니다." align:#left dropdownlist sel_ID "" items: #("6") pos:[10 ,50] width:35 button DetatchBtn "DetatchOBJ" pos:[50 , 50] editText etBaseName "As:" text:"_out" heigh: 25 fieldWidth:70 across:2 pos:[135,50] button ClearRemoveVertBtn "Clear Unused Vert. " pos:[230 , 50] ) --//=====================================================================================================//-- --++++++++++++++++++++++++++++ 인버스 셀렉션 디테쳐 ++++++++++++++++++++++++++++++++++-- --// 디테치 오브젝트 전역 변수 선언 global rltElementsToObjects --try destroyDialog rltElementsToObjects catch() local start_objs = objects as array --//지역변수 선언. local DetachPolyElements_fn fn DetachPolyElements_fn SourceOBJ = --//디테치 실제 런타임 함수. ( MasterObj = SourceOBJ faceCount = MasterObj.getnumfaces() FaceTest = ((MasterObj.getnumfaces()) != 0) for i in 1 to faceCount while FaceTest do --ends loop when there are no faces left to select (--start element detach loop newName = (uniquename (MasterObj.name as string)) setName = newName + etBaseName.text --tempMaster.name = (MasterObj.name + etBaseName.text + (i as string)) MasterObj.EditablePoly.SetSelection #Face #{1} MasterObj.selectElement() TargetElement = polyop.getFaceSelection MasterObj polyop.detachFaces MasterObj TargetElement asNode:true name:setName NewObj = getnodebyname setName resetXForm NewObj convertTo NewObj (Editable_Poly) ResetTransform NewObj ResetScale NewObj ResetPivot NewObj --centerpivot NewObj FaceTest = ((MasterObj.getnumfaces()) != 0) )--end element detach loop delete MasterObj ) on DetatchBtn pressed do --선택 한 메트리얼 아이디를 가지고 엘리먼트를 선택 후 나머지를 디테치 한다. ( --local ID_Listh = #() --ID_List= sel_ID.items as int local OBJ = selection as array local selOBJ = selection as array --local mat = selOBJ.material if OBJ.count == 0 then ( messagebox "하나 이상의 오브젝트를 선택 하세요." return undefined ) else ( max modify mode --모디파이 모드로 리플레쉬 해야 합니다. 모디파이 코멘드가 없으면 subObjectLevel = 5 가 동작 하지 않습니다. subObjectLevel = 5 $.EditablePoly.selectByMaterial 6 --일단 임시로 ID 를 고정으로 박아서 구현. 차 후 아이템 리스트의 스트링 값을 인트값으로 바꿔서 셋. max select invert --선택 된 엘리먼트에서 반전 선택 합니다. --max create mode --if (classof SourceOBJ == editable_poly) then (DetachPolyElements_fn SourceOBJ) --ObjsSource = getCurrentSelection() --create array of all selected objects /* for obj in 1 to ObjsSource.count do with redraw off (--start Object loop SourceOBJ = ObjsSource[obj] if (classof SourceOBJ == editable_poly) then (DetachPolyElements_fn SourceOBJ) -- operates only on those objects that are editable polys )--end Object loop */ --max views redraw ) ) --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- --+++++++++++++++++++++++선택 한 메시 오브젝트의 사용하지 않는 정점과 사용하지 않는 UV 버택스를 삭제한다.****-- on ClearRemoveVertBtn pressed do ( selOBJ = selection as array selOBJ = classof editable_poly if selection.count == 0 then ( messagebox "정리 할 오브젝트를 선택 해야 합니다." return undefined ) else ( $.EditablePoly.deleteIsoVerts () true $.EditablePoly.DeleteIsoMapVerts() true Messagebox "메시가 깨끗하게 정리 되었습니다." ) ) ) --******************************************************************************************************************- --**********************************************컬러팔레트 롤아웃 ***************************************************- rollout ColorPalette_rollout "Color Palette Manager" category:4 ( colorpicker theColor1 "Way Ambient:" color:[7,12,44] modal:false align:#right pos:[10, 5] button applyColorTo_theColor1_btn "적용" pos:[125 , 5] width:32 tooltip:"조명을 선택하고 Apply 버튼을 클릭하면 컬러가 적용 됩니다." colorpicker theColor2 "Way Edge:" color:[94,153,242] modal:false align:#right pos:[174, 5] button applyColorTo_theColor2_btn "적용" pos:[275 , 5] width:32 tooltip:"조명을 선택하고 Apply 버튼을 클릭하면 컬러가 적용 됩니다." colorpicker theColor3 "Tourch:" color:[173,85,7] modal:false align:#right pos:[41, 30] button applyColorTo_theColor3_btn "적용" pos:[125 , 30] width:32 tooltip:"조명을 선택하고 Apply 버튼을 클릭하면 컬러가 적용 됩니다." colorpicker theColor4 "Tourch Hot:" color:[221,168,7] modal:false align:#right pos:[170, 30] button applyColorTo_theColor4_btn "적용" pos:[275 , 30] width:32 tooltip:"조명을 선택하고 Apply 버튼을 클릭하면 컬러가 적용 됩니다." colorpicker theColor5 "Room Tint:" color:[127,127,127] modal:false align:#right pos:[27,56] button applyColorTo_theColor5_btn "적용" pos:[125 , 56] width:32 tooltip:"조명을 선택하고 Apply 버튼을 클릭하면 컬러가 적용 됩니다." --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- --******************************************** 라이트 적용 인보크 구현 ************************************************************-- on applyColorTo_theColor1_btn pressed do --웨이 암비언트 칼러 ( objArray = selection if selection.count == 0 then ( messagebox "변경 할 라이트를 선택 하세요." return undefined ) for obj in objArray do ( --if objArray!=light do (print "라이트가 아닙니다.") try obj.rgb = theColor1.color catch() ) ) on applyColorTo_theColor2_btn pressed do -- 웨이 엣지 칼라 ( local objArray = selection if selection.count == 0 then ( messagebox "변경 할 라이트를 선택 하세요." return undefined ) for obj in objArray do ( --if objArray!=light do (print "라이트가 아닙니다.") try obj.rgb = theColor2.color catch() ) ) on applyColorTo_theColor3_btn pressed do --토치 메인컬러 ( local objArray = selection if selection.count == 0 then ( messagebox "변경 할 라이트를 선택 하세요." return undefined ) for obj in objArray do ( --if objArray!=light do (print "라이트가 아닙니다.") try obj.rgb = theColor3.color catch() ) ) on applyColorTo_theColor4_btn pressed do --토치 핫라이트 컬러 ( local objArray = selection if selection.count == 0 then ( messagebox "변경 할 라이트를 선택 하세요." return undefined ) for obj in objArray do ( --if objArray!=light do (print "라이트가 아닙니다.") try obj.rgb = theColor4.color catch() ) ) on applyColorTo_theColor5_btn pressed do --룸 틴트 컬러. (암비언트 컬러에 적용 하도록 변경. ) ( local objArray = selection if selection.count == 0 then ( messagebox "변경 할 라이트를 선택 하세요." return undefined ) for obj in objArray do ( --if objArray!=light do (print "라이트가 아닙니다.") try obj.rgb = theColor5.color catch() ) ) ) --******************************************************************************************************************- --************************************************메트리얼 롤아웃 ***************************************************- rollout material_rollout "material manager" category:5 ( Group "범프값 통일 및 멀티메트리얼 최적화" ( spinner GlobalBumpValue_spinner "Bump Value" range:[1,100,80] type:#float scale:1 fieldwidth:50 height:30 pos:[10 , 25] --button GlobalBumpValue_ApplyBtn "Apply" width:60 height:16 tooltip:"설정한 범프 벨류를 일괄 적용 합니다." pos:[130 , 25] button CleanMat_btn "Unused multiSub material clean with ID sorting" pos:[130 , 25] align:#left tooltip:"사용하지 않는 메티리얼 ID 를 클린업 하고 ID 순으로 정렬 합니다." ) Group "싱글 메트리얼의 텍스쳐 슬롯 활성을 제어" ( button btnTextureOn "Texture On" pos:[50,80] width:142 height:30 tooltip:"스텐다드 메트리얼의 텍스쳐 슬롯을 켭니다." button btnTextureOff "Texture Off" pos:[220,80] width:142 height:30 tooltip:"스텐다드 메트리얼의 텍스쳐 슬롯을 끕니다." ) Group "멀티 메트리얼의 텍스쳐 슬롯 활성을 제어" ( checkbox checkBumpToggle "Bump Slot" checked:false button btnMMTextureOn "(MM)TextureOn" pos:[50,160] width:142 height:30 tooltip:"멀티메트리얼 ID 안의 메트리얼의 텍스쳐 슬롯을 켭니다." button btnMMTextureOff "(MM)TextureOff" pos:[220,160] width:142 height:30 tooltip:"멀티메트리얼 ID 안의 메트리얼의 텍스쳐 슬롯을 끕니다." ) /*-----------------------------------------------글로벌 메니저 그룹 함수 인보크 구현------------------------------------------------------------*/ on GlobalBumpValue_spinner changed val do ( mySlot = medit.GetActiveMtlSlot() --멀티메트리얼 에서 엑티브 된 슬롯을 변수에 집어 넣는다. myMaterial = getMeditMaterial mySlot mySubs = myMaterial.numsubs --mySubs 변수에 메트리얼에디터에서 가져온 메트리얼 리스트를 콜렉션으로 집어 넣는다. if classof myMaterial == Standardmaterial then ( messagebox "장면 안에 하나 이상의 멀티메트리만 가능 합니다.." return undefined ) else ( for i = 1 to mySubs do ( try myMaterial.materialList[i].bumpMapAmount = val catch() ) ) ) on CleanMat_btn pressed do ( CleanMultiMatSort true print "Debug.Log: CleanMultiMatSort" ) /*-----------------------------------------------싱글 메트리얼 메니저 함수 인보크 구현------------------------------------------------------------*/ on btnTextureOn pressed do ( ApplyMapEnabler true ) on btnTextureOff pressed do ( ApplyMapEnabler false ) /*-----------------------------------------------멀티 메트리얼 메니저 함수 인보크 구현------------------------------------------------------------*/ on btnMMTextureOn pressed do ( ApplyMM_MapEnabler true ) on btnMMTextureOff pressed do ( ApplyMM_MapEnabler false ) on material_rollout rolledUp state do ( if state == true then PlayneryBG_Tools_MasterFloater.size =[PlayneryBG_Tools_MasterFloater.size[1], (PlayneryBG_Tools_MasterFloater.size[2] + 260)] if state == false then PlayneryBG_Tools_MasterFloater.size =[PlayneryBG_Tools_MasterFloater.size[1], (PlayneryBG_Tools_MasterFloater.size[2] - 260)] ) ) --***************************************************************************************************************- --*******************************************오브젝트매니저 롤아웃 *****************************************************- rollout merge_rollout "merge manager" category:6 ( Group "오브젝트 머지 메니저" ( label basename1 "서로 다른 맥스 간에 오브젝트를 클립보드 형식으로 카피 페이스트 합니다." button btnCopyObj "Copy" pos:[50,45] width:142 height:30 tooltip:"씬 안에서 선택 한 어떤 오브젝트라도 클립보드에 복사 합니다." button btnPasteObj "Paste" pos:[220,45] width:142 height:30 tooltip:"클립보드에 복사 한 오브젝트를 해당 씬으로 Merge 합니다." progressbar doit_prog color:red ) on btnCopyObj pressed do ( local file = GetDir #export + "\\tempObjCopy.max" --C:\Users\daniel.lee\Documents\3dsMax\export ? ??? sels = selection as array if sels.count ==0 do return undefined -- undefined ? ??. saveNodes sels file quiet:true ) on btnPasteObj pressed do ( local file = GetDir #export + "//tempObjCopy.max" --C:\Users\daniel.lee\Documents\3dsMax\export ? ??? if not doesFileExist file do return undefined -- undefined ? ??. mergeMAXFile file #select #mergeDups #renameMTLDups quite:true ) on merge_rollout rolledUp state do ( if state == true then PlayneryBG_Tools_MasterFloater.size =[PlayneryBG_Tools_MasterFloater.size[1], (PlayneryBG_Tools_MasterFloater.size[2] + 350)] if state == false then PlayneryBG_Tools_MasterFloater.size =[PlayneryBG_Tools_MasterFloater.size[1], (PlayneryBG_Tools_MasterFloater.size[2] - 350)] ) ) --*******************************************롤아웃 엔드***************************************************- try ( addRollout Propertices_rollout PlayneryBG_Tools_MasterFloater rolledUp: false addRollout info_rollout PlayneryBG_Tools_MasterFloater rolledUp: false addRollout material_rollout PlayneryBG_Tools_MasterFloater rolledUp: false addRollout ColorPalette_rollout PlayneryBG_Tools_MasterFloater rolledUp: false addRollout DunManager_rollout PlayneryBG_Tools_MasterFloater rolloutUp: false addRollout merge_rollout PlayneryBG_Tools_MasterFloater rolledUp: false ) catch()
Game Developer Leegoon copyright all right reserved since 2010.
Comments
Popular Posts
December 14, 2013
AO with Gamma Control for Matcap bump Unlit shader
July 19, 2016
Anim.Compression type如果是Optimal的话
Comments
Post a Comment
덧글쓰기 기능 있는거 아시죠? ㅋㅋ