zoukankan      html  css  js  c++  java
  • 编辑器的一些批处理脚本

    // Automatically change the name of the selected object via a text field
    class EditorGUILayoutTextField extends EditorWindow {
            //折叠页变量
            var tag_layer : boolean = true;
            var addCol : boolean = true;
            
            var selectedTag : String = "Untagged";   
            var selectedLayer : int = 0;
              
            var addToChild : boolean = false;
             
            @MenuItem("EditorTools/BeachTools")   
            static function beatchWorking() {
               /*
                var g:GameObject = GameObject.FindWithTag ("Finish");
                for(var i : GameObject in Selection.gameObjects){
                     
                     
                   if(!i.GetComponent ("get")){
                     i.AddComponent ("get");
                     i.GetComponent("get").k = g;
                     i.transform.tag = "wwerwer";
                  }else{
                   
                    i.transform.tag = "Player";
                    i.GetComponent("get").k = g;
                  }
                 }
                
                */
                    var window = GetWindow(EditorGUILayoutTextField);       
                    window.Show();
            } 
             
            function OnGUI(){
                         
                   tag_layer = EditorGUI.Foldout(Rect(3,3,position.width-6,15),tag_layer,"tag_layer");
                   if(tag_layer){
                  
                          selectedTag = EditorGUI.TagField(Rect(3,23,position.width/2-10, 50),"Tags:",selectedTag);                        
                          selectedLayer = EditorGUI.LayerField(Rect(position.width/2,23, position.width/2-5, 20),"Layers:",selectedLayer);
                                      
                        
                             
                          if(GUI.Button(Rect(6,45,190,25),"Change Tag")){
                             if(Selection.activeGameObject) {
                                if(addToChild){
                               
                                     var fu01 : Transform = Selection.activeTransform as Transform;
              for(var j=0;j<fu01.childCount;j++)
                   fu01.GetChild(j).gameObject.tag = selectedTag;
                               
                                }else{              
                             for(var go : GameObject in Selection.gameObjects)                   
                             go.tag = selectedTag;
                           }
                           }
                          }
                                                 
                          if(GUI.Button(Rect(position.width-196,45,190,25),"Change Layer")){
                              if(Selection.activeGameObject) {              
                            for(var go : GameObject in Selection.gameObjects)                   
                            go.layer = selectedLayer;
                        }
                          }       
                   }
                 
                   addCol = EditorGUI.Foldout(Rect(3,80,position.width-6,15),addCol,"add_Collider");
                   if(addCol){
                      
                        
                         if(GUI.Button(Rect(5,100,190,25),"Add Collider")){
                              if(Selection.activeGameObject){
                                if(addToChild){
                               
                                  var fu : Transform = Selection.activeTransform as Transform;
                for(var i=0;i<fu.childCount;i++)
                fu.GetChild(i).gameObject.AddComponent("MeshCollider");
                  
                             }else{
                            for(var z : GameObject in Selection.gameObjects)
                            z.AddComponent("MeshCollider");   
                             }
                         }
                         }
                   
                   }
                   
                   addToChild = EditorGUI.Toggle(Rect(0,270,position.width,20),"Add to Child",addToChild);
                    //GUILayout.Label("Select an object in the hierarchy view");       
                    //if(Selection.activeGameObject)           
                    //Selection.activeGameObject.tag =          
                          //EditorGUILayout.TextField("Object Name: ", Selection.activeGameObject.tag);       
                   this.Repaint();
     
              }  
    }

  • 相关阅读:
    opencv 读写图像文件
    opencv 图像透明
    c# 异步事件
    c++读写文件
    Delphi XE UniGUI UniSession文件下载的方式(SendFile、SendStream )
    Delphi XE UniGUI ExtJS [8] 自定义JavaScript文件调用
    Delphi XE UniGUI ExtJS [7] Delhi 动态添加 ClientEvents.ExtEvents 事件
    Delphi XE UniGUI ExtJS [6] fireEvent 事件 模拟按键点击(JS、ExtJS、Delphi)
    Delphi XE UniGUI ExtJS [5] 鼠标和Key事件
    Delphi XE UniGUI ExtJS [4] Ajax、Response(响应) 的使用
  • 原文地址:https://www.cnblogs.com/softimagewht/p/2613778.html
Copyright © 2011-2022 走看看