The Skinned Mesh filter.

상속: Renderer
예제 #1
2
    // TODO: Put this into Misc class?
    private void CreateBlendMesh(SkinnedMeshRenderer skinnedMeshRenderer, Mesh skinnedMesh, string name, bool convex)
    {
        // Detecting how many BlendShapes we have.
        int blendShapeCount = 0;
        blendShapeCount = skinnedMesh.blendShapeCount;
        Debug.Log("BlendShape count bottom: " + blendShapeCount);

        // Applying BlendShapes.
        if (blendShapeCount != 0)
            skinnedMeshRenderer.SetBlendShapeWeight(0, size * 100);

        // Creates a snapshot of the SkinnedMeshRenderer and stores it in the mesh.
        // That skinned mesh renderer should have the shape with the BlendShapes applyied.
        Mesh bakedMesh = new Mesh();
        skinnedMeshRenderer.BakeMesh(bakedMesh);

        // Recalcultate the bounding volume of the mesh from the vertices.
        bakedMesh.RecalculateBounds();
        Debug.Log("Baked mesh bounds: " + bakedMesh.bounds.ToString());

        // Selecting part and destroying MeshCollider in case there is one.
        GameObject child = transform.FindChild(name).gameObject;
        DestroyImmediate(child.GetComponent<MeshCollider>());

        // Adding MeshCollider and assigning the bakedMesh.
        MeshCollider meshCollider = child.AddComponent<MeshCollider>();
        meshCollider.sharedMesh = bakedMesh;
        meshCollider.convex = convex;
    }
 public override void SetupGeometryAndAppearance()
 {
     Tip = part.FindModelTransform("Tip");
     Root = part.FindModelTransform("Root");
     SMRcontainer = part.FindModelTransform("Collider");
     wingSMR = SMRcontainer.GetComponent<SkinnedMeshRenderer>();
 }
예제 #3
0
    public void NewTarget(GameObject targ)
    {
        if ( target != targ )
        {
            target = targ;
            t = 0.0f;

            if ( target )
            {
                filter = (MeshFilter)target.GetComponent(typeof(MeshFilter));

                if ( filter != null )
                    center = filter.mesh.bounds.center;
                else
                {
                    render = (MeshRenderer)target.GetComponent(typeof(MeshRenderer));

                    if ( render != null )
                        center = render.bounds.center;
                    else
                    {
                        srender = (SkinnedMeshRenderer)target.GetComponent(typeof(SkinnedMeshRenderer));

                        if ( srender != null )
                            center = srender.bounds.center;
                    }
                }
            }
        }
    }
예제 #4
0
 private void Start()
 {
     this.pVis = base.transform.root.GetComponent<netPlayerVis>();
     this.tr = base.transform;
     this.skin = base.transform.GetComponent<SkinnedMeshRenderer>();
     this.setup = base.transform.root.GetComponentInChildren<playerScriptSetup>();
 }
예제 #5
0
		private void SetBaseMesh(string assetPath)
		{
			var curDir = System.IO.Directory.GetCurrentDirectory().Replace('\\', '/');
			if (assetPath.StartsWith(curDir, System.StringComparison.InvariantCultureIgnoreCase))
			{
				assetPath = assetPath.Remove(0, curDir.Length + 1);
			}
			var asset = AssetDatabase.LoadMainAssetAtPath(assetPath);
			if (asset is GameObject)
			{
				RaceGO = Instantiate(asset) as GameObject;
				RaceSMR = RaceGO.GetComponentInChildren<SkinnedMeshRenderer>();
				if (RaceSMR != null)
				{
					if (SlotSMR != null)
					{
						PerformValidation();
					}
					else
					{
						NextPage();
					}
				}
				else
				{
					Destroy(RaceGO);
				}
			}
		}
예제 #6
0
 public override void changeColor()
 {
     r = body.GetComponent<SkinnedMeshRenderer>();
     Material[] mats = r.materials;
     if (element == "Fire") {
         mats[2] = Fire[0];
         mats[0] = Fire[1];
     }
     if (element == "Frost") {
         mats[2] = Frost[0];
         mats[0] = Frost[1];
     }
     if (element == "Cloud") {
         mats[2] = Cloud[0];
         mats[0] = Cloud[1];
     }
     if (element == "Earth") {
         mats[2] = Earth[0];
         mats[0] = Earth[1];
     }
     if (element == "Dark") {
         mats[2] = Dark[0];
         mats[0] = Dark[1];
         mats [5].color = Color.black;
         mats [3].color = Color.yellow;
     }
     else {
         mats [5].color = Color.white;
         mats [3].color = Color.red;
     }
     r.materials = mats;
 }
 public BlendShapeTarget(string name, int shapeIndex, SkinnedMeshRenderer targetMesh)
     : base(name, targetMesh.transform)
 {
     Index = shapeIndex;
     TargetMesh = targetMesh;
     AnimationType = typeof(SkinnedMeshRenderer);
 }
    public void OnGUI() {
        skin = (SkinnedMeshRenderer)EditorGUILayout.ObjectField("Skin", skin, typeof(SkinnedMeshRenderer), true);

        if (skin != null && skin.bones.Length > 0) {
            GUI.color = (isPainting) ? Color.green : Color.white;

            if (GUILayout.Button("Paint")) {
                isPainting = !isPainting;
                if (isPainting) {
                    Selection.objects = new GameObject[] { skin.gameObject };
                }
                SceneView.currentDrawingSceneView.Repaint();
            }

            GUI.color = Color.white;

            brushSize = EditorGUILayout.FloatField("Brush size", brushSize * 2) / 2;
            weight = Mathf.Clamp(EditorGUILayout.FloatField("Weight", weight), 0, 1);
            mode = (PaintingMode)EditorGUILayout.EnumPopup("Mode", mode);

            string[] bones = skin.bones.Select(b => b.gameObject.name).ToArray();
			boneIndex = EditorGUILayout.Popup("Bone", boneIndex, bones);
            colorTransparency = Mathf.Clamp(EditorGUILayout.FloatField("Color Transparency", colorTransparency), 0, 1);

        } else {
			EditorGUILayout.HelpBox("SkinnedMeshRenderer not assigned to any bones, Recalculate Bone Weights.", MessageType.Error);
			if (SceneView.currentDrawingSceneView != null)
				SceneView.currentDrawingSceneView.Repaint();
		}
    }
예제 #9
0
 void Start()
 {
     skinnedMeshRend = GetComponent<SkinnedMeshRenderer>();
     clothMesh = GetComponent<SkinnedMeshRenderer>().sharedMesh;
     shapeCount = clothMesh.blendShapeCount;
     skinnedMeshRend.updateWhenOffscreen = false;
 }
 // Use this for initialization
 void Start()
 {
     timer = 0f;
     timeToUpdate = 1 / updatesPerSecond;
     particleSystem = GetComponent<ParticleSystem> ();
     skin = objectToPutParticlesOn.GetComponent<SkinnedMeshRenderer>();
 }
예제 #11
0
    public void Start()
    {
        smrenderer = gameObject.GetComponentInChildren<SkinnedMeshRenderer>();

        int i = rnd.Next(_materials.Length);
        smrenderer.material = _materials[i];
    }
예제 #12
0
파일: MeshContainer.cs 프로젝트: ZepLI/U3D
 public MeshContainer(SkinnedMeshRenderer skinnedRenderer)
 {
     Mesh = skinnedRenderer.sharedMesh;
     transform = skinnedRenderer.GetComponent<Transform>();
     bones = skinnedRenderer.bones;
     isAnimated = true;
 }
예제 #13
0
	// Use this for initialization
	void Start () {
		GameObject face = Instantiate(Face) as GameObject;
		face.transform.parent = transform;
		FaceRenderer = face.GetComponentInChildren<SkinnedMeshRenderer>();

		GameObject body = Instantiate(Body) as GameObject;
		body.transform.parent = transform;
		BodyRenderer = body.GetComponentInChildren<SkinnedMeshRenderer>();
		
		CombinedRenderer = gameObject.GetComponent<SkinnedMeshRenderer>();
		// 重组Mesh后删除原始GO
		Mesh faceMesh = FaceRenderer.sharedMesh;
		Mesh bodyMesh = BodyRenderer.sharedMesh;

		CombineInstance[] combineInstances = new CombineInstance[2];
		combineInstances[0].mesh = faceMesh;
		combineInstances[0].transform = FaceRenderer.transform.localToWorldMatrix;
		combineInstances[1].mesh = bodyMesh;
		combineInstances[1].transform = BodyRenderer.transform.localToWorldMatrix;

		CombinedRenderer.sharedMesh = new Mesh();
		CombinedRenderer.sharedMesh.CombineMeshes(combineInstances);
		
		// 组合材质球引用
		Material[] sharedMats = new Material[2];
		sharedMats[0] = FaceRenderer.sharedMaterial;
		sharedMats[1] = BodyRenderer.sharedMaterial;
		CombinedRenderer.sharedMaterials = sharedMats;

		// Mesh和材质的关联是按照材质在数组中的顺序的,重组Mesh势必会产生一个新的材质球次序
	}
예제 #14
0
	// Use this for initialization
	void Awake () 
	{
		player = GameObject.FindGameObjectWithTag ("Player");
		lightVisibilityCheck = GameObject.Find ("LightVisibilityChecker").transform;
		pointLight = GetComponent<Light> ();
		_renderer = GameObject.Find("vincent_Casual_Male_Lod_1").GetComponent<SkinnedMeshRenderer> ();
	}
예제 #15
0
 public BlendShapeMapper(SkinnedMeshRenderer face, Transform headJoint, Transform leftEyeJoint, Transform rightEyeJoint)
 {
     this.face = face;
     this.headJoint = headJoint;
     this.leftEye = leftEyeJoint;
     this.rightEye = rightEyeJoint;
 }
 static public int constructor(IntPtr l)
 {
     UnityEngine.SkinnedMeshRenderer o;
     o = new UnityEngine.SkinnedMeshRenderer();
     pushObject(l, o);
     return(1);
 }
예제 #17
0
 void Awake()
 {
     filter = GetComponent<MeshFilter>();
     skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
     if(filter==null && skinnedMeshRenderer == null)
         Destroy(this);
 }
    static public void FastSetter(this UnityEngine.SkinnedMeshRenderer o, string propertyName, object value)
    {
        switch (propertyName)
        {
        case "bones":
            o.bones = (UnityEngine.Transform[])value; return;

        case "rootBone":
            o.rootBone = (UnityEngine.Transform)value; return;

        case "quality":
            o.quality = (UnityEngine.SkinQuality)value; return;

        case "sharedMesh":
            o.sharedMesh = (UnityEngine.Mesh)value; return;

        case "updateWhenOffscreen":
            o.updateWhenOffscreen = (System.Boolean)value; return;

        case "skinnedMotionVectors":
            o.skinnedMotionVectors = (System.Boolean)value; return;

        case "localBounds":
            o.localBounds = (UnityEngine.Bounds)value; return;

        case "tag":
            o.tag = (System.String)value; return;
        }
        LBoot.LogUtil.Error("UnityEngine.SkinnedMeshRenderer no Setter Found : " + propertyName);
    }
예제 #19
0
	void buildMech(Mech m) {
		string[] parts = new string[9]{ m.Core, m.Arms, m.Legs, m.Head, m.Booster, m.Weapon1L, m.Weapon1R, m.Weapon2L, m.Weapon2R };
	
		// Create new array to store skinned mesh renderers 
		SkinnedMeshRenderer[] newSMR = new SkinnedMeshRenderer[5];

		Material[] materials = new Material[5];
		for (int i = 0; i < 5; i++) {
			// Load mech part
			GameObject part = Resources.Load (parts [i], typeof(GameObject)) as GameObject;

			// Extract Skinned Mesh
			newSMR [i] = part.GetComponentInChildren<SkinnedMeshRenderer> () as SkinnedMeshRenderer;

			// Load texture
			materials [i] = Resources.Load (parts [i] + "mat", typeof(Material)) as Material;
		}

		// Replace all
		SkinnedMeshRenderer[] curSMR = GetComponentsInChildren<SkinnedMeshRenderer> ();
		for (int i = 0; i < curSMR.Length; i++){
			curSMR[i].sharedMesh = newSMR[i].sharedMesh;
			curSMR[i].material = materials[i];
			curSMR[i].enabled = true;
		}

		// Make weapons
		buildWeapons (new string[4]{parts[5],parts[6],parts[7],parts[8]});
	}
    // Use this for initialization
    void Start ()
    {
        colorObjMng = rsc.coloredObjectsMng;
        voxelPool = rsc.poolMng.voxelPool;
        voxelColliderPool = rsc.poolMng.voxelColliderPool;

        mat = colorObjMng.GetVoxelRandomMaterial();

        if (!includeChildren)
        {
            transf = gameObject.transform;
            rend = gameObject.GetComponent<Renderer>();
            meshFilter = gameObject.GetComponent<MeshFilter>();
            sRend = gameObject.GetComponent<SkinnedMeshRenderer>();
        }
        else
        {
            transforms = new List<Transform>();
            renderers = new List<Renderer>();
            isSkinedMeshRenderer = new List<bool>();
            meshFilters = new List<MeshFilter>();
            meshes = new List<Mesh>();

            PopulateLists(gameObject);
        }

        voxelScale = new Vector3(voxelSideSize, voxelSideSize, voxelSideSize);
    }
예제 #21
0
    virtual public void Initialize(Ilife lifeData, string resourcePath, AssetType resourceType)
    {
        m_LifeData = lifeData;
        m_iInstanceId = lifeData.GetInstanceId();

        m_ObjectInstance = GameObject.Instantiate(ResourceManager.Instance.LoadBuildInResource<GameObject>(resourcePath, resourceType));

        //load material
        string localpath = resourcePath.Substring(0, resourcePath.LastIndexOf('/'));
        m_NormalMaterial = ResourceManager.Instance.LoadBuildInResource<Material>(localpath + "/Normal", AssetType.Char);
        m_HighlightMaterial = ResourceManager.Instance.LoadBuildInResource<Material>(localpath + "/SelectedHighlight", AssetType.Char);
        m_MeshRender = ComponentTool.FindChildComponent<SkinnedMeshRenderer>("Body", m_ObjectInstance);
        if (null == m_NormalMaterial || null == m_HighlightMaterial || null == m_MeshRender)
        {
            Debuger.LogWarning("can't load mesh render or normal&highlight materials !");
        }

        //mark transform
        m_CharContainer = m_ObjectInstance.AddComponent<CharTransformContainer>();
        m_CharContainer.Initialize(lifeData.GetInstanceId(), lifeData);

        if (null == m_ObjectInstance)
        {
            Debuger.LogError("Can't load resource " + resourcePath);
        }
        m_AnimatorAgent = new AnimatorAgent(m_ObjectInstance);
    }
예제 #22
0
    //    private AnotherScript anotherScript;
    //private GameObject otherScript;
    //OtherScript = GetComponent(OtherScript);
    //public GameObject objectToAccess;
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        cartucho = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006");
        m =cartucho.GetComponent<SkinnedMeshRenderer>();

        m.enabled = false;
        //Instantiate(flash,);
        casquillos = animator.GetInteger ("casquillos");

        //GameObject Object1 = GameObject.Find ("armas");
        //Component anotherScript = Object1.GetComponent<disparosDelJugador> ();
        disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> ();
        disparo.disparo (3);
        anim = GameObject.Find ("animacionColt44-40").GetComponent<Animator> ();

        anim.SetInteger ("cartuchos",anim.GetInteger("cartuchos")-1);
        //Transform bone = GetComponent<Animator>().avatar.GetBone(BoneType.LeftShoulder);

        objetin = GameObject.FindGameObjectsWithTag ("canionColt");
        posicionHueso = objetin [0].transform;
        Debug.Log("Posicion del hgueso -----------------"+posicionHueso.position+"----------------------");

        Instantiate (esfera, posicionHueso.position,posicionHueso.rotation);
        //		Script1.disparo ();
        /*abtenemos posicion del
        posicion = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/marco").GetComponent<Transform>();
        Debug.Log ("+++++++++++ la poscion del flash es:   " + posicion.position + "+++++++++++++++++++");canion*/

        /*obtenemos un hueso*/
    }
예제 #23
0
 // Use this for initialization
 void Start()
 {
     if (gameObject.layer == 8) {
         rend = transform.GetChild (0).transform.GetChild (1).GetComponent<SkinnedMeshRenderer> ();
     }
     flag = true;
 }
// fields

// properties
    static void SkinnedMeshRenderer_bones(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.SkinnedMeshRenderer _this = (UnityEngine.SkinnedMeshRenderer)vc.csObj;
            var result = _this.bones;
            var arrRet = result;
            for (int i = 0; arrRet != null && i < arrRet.Length; i++)
            {
                JSMgr.datax.setObject((int)JSApi.SetType.SaveAndTempTrace, arrRet[i]);
                JSApi.moveSaveID2Arr(i);
            }
            JSApi.setArrayS((int)JSApi.SetType.Rval, (arrRet != null ? arrRet.Length : 0), true);
        }
        else
        {
            UnityEngine.Transform[] arg0 = JSDataExchangeMgr.GetJSArg <UnityEngine.Transform[]>(() =>
            {
                int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
                int length  = JSApi.getArrayLength(jsObjID);
                var ret     = new UnityEngine.Transform[length];
                for (var i = 0; i < length; i++)
                {
                    JSApi.getElement(jsObjID, i);
                    ret[i] = (UnityEngine.Transform)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
                }
                return(ret);
            });
            UnityEngine.SkinnedMeshRenderer _this = (UnityEngine.SkinnedMeshRenderer)vc.csObj;
            _this.bones = arg0;
        }
    }
예제 #25
0
 protected virtual void Awake()
 {
     creatureActions = GetComponent<CreatureActions>();
     animator = GetComponentInChildren<Animator>();
     particleSystem = GetComponentInChildren<ParticleSystem>();
     meshRenderer = GetComponentInChildren<SkinnedMeshRenderer>();
 }
예제 #26
0
    private void OnGUI()
    {
        EditorGUI.BeginChangeCheck();
        skinnedMeshRenderer =
            (SkinnedMeshRenderer) EditorGUILayout.ObjectField(skinnedMeshRenderer, typeof (SkinnedMeshRenderer), true);
        EditorGUI.EndChangeCheck();

        if (skinnedMeshRenderer != null)
        {
            var mesh = skinnedMeshRenderer.sharedMesh;

            var sb = new StringBuilder();
            sb.AppendLine("public enum BlendShapes : int");
            sb.AppendLine("{");
            sb.AppendLine(string.Format("\t{0} = {1},", "Unknown", -1));
            sb.AppendLine();
            for (var i = 0; i < mesh.blendShapeCount; i++)
                sb.AppendLine(string.Format("\t{0} = {1},", mesh.GetBlendShapeName(i).Replace('.', '_'), i));
            sb.AppendLine();
            sb.AppendLine(string.Format("\t{0} = {1}", "LastBlendShape", mesh.blendShapeCount));
            sb.AppendLine("}");

            scroll = EditorGUILayout.BeginScrollView(scroll);
            EditorGUILayout.TextArea(sb.ToString());
            EditorGUILayout.EndScrollView();
        }
    }
예제 #27
0
    public static void CreateControlPoints(SkinnedMeshRenderer skin) {
        if (skin.sharedMesh != null)
		{
			for (int i = 0; i < skin.sharedMesh.vertices.Length; i++)
			{
				GameObject b = new GameObject("Control Point");
				// Unparent the skin temporarily before adding the control point
				Transform skinParent = skin.transform.parent;
				skin.transform.parent = null;

				// Reset the rotation before creating the mesh so the UV's will align properly
				Quaternion localRotation = skin.transform.localRotation;
				skin.transform.localRotation = Quaternion.identity;

				b.transform.position = new Vector3(skin.transform.position.x + (skin.sharedMesh.vertices[i].x * skin.transform.localScale.x), skin.transform.position.y + (skin.sharedMesh.vertices[i].y * skin.transform.localScale.y), skin.transform.position.z + (skin.sharedMesh.vertices[i].z * skin.transform.localScale.z));
				b.transform.parent = skin.transform;
				ControlPoint[] points = b.transform.parent.transform.GetComponentsInChildren<ControlPoint>();
				if (points != null && points.Length > 0)
				{
					b.gameObject.name = b.gameObject.name + points.Length;
				}
				Undo.RegisterCreatedObjectUndo(b, "Add control point");
				ControlPoint controlPoint = b.AddComponent<ControlPoint>();
				controlPoint.index = i;
				controlPoint.skin = skin;
				controlPoint.originalPosition = b.transform.localPosition;

				// Reset the rotations of the object
				skin.transform.localRotation = localRotation;
				skin.transform.parent = skinParent;
			}
		}
    }
        public override void OnEnter()
        {
            GameObject go =	gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;
            if (go!=null)
            {
                _skr = go.GetComponent<SkinnedMeshRenderer>();
            }

            if (_skr == null)
            {
                LogWarning("Missing component SkinnedMeshRenderer");
                Finish();
                return;
            }

            if (! orBlendShapeName.IsNone)
            {
                _blendShapeIndex = _skr.sharedMesh.GetBlendShapeIndex(orBlendShapeName.Value);
            }else{
                _blendShapeIndex = blendShapeIndex.Value;
            }

            DoGetBlendShapeWeight();

            if (!everyFrame)
            {
                Finish();
            }
        }
    public void OnGUI() {
        skin = (SkinnedMeshRenderer)EditorGUILayout.ObjectField("Skin", skin, typeof(SkinnedMeshRenderer), true);

        if (skin != null) {
            GUI.color = (isPainting) ? Color.green : Color.white;

            if (GUILayout.Button("Paint")) {
                isPainting = !isPainting;
                if (isPainting) {
                    Selection.objects = new GameObject[] { skin.gameObject };
                }
                SceneView.currentDrawingSceneView.Repaint();
            }

            GUI.color = Color.white;

            brushSize = EditorGUILayout.FloatField("Brush size", brushSize * 2) / 2;
            weight = Mathf.Clamp(EditorGUILayout.FloatField("Weight", weight), 0, 1);
            mode = (PaintingMode)EditorGUILayout.EnumPopup("Mode", mode);

            string[] bones = skin.bones.Select(b => b.gameObject.name).ToArray();
            bone = EditorGUILayout.Popup("Bone", bone, bones);

        }
    }
    // Use this for initialization
    void Start () {
        //voxelPool = mng.poolManager.voxelPool;
        voxelScriptPool = mng.poolManager.voxelControllerPool;
        voxelColliderPool = mng.poolManager.voxelColliderPool;

        mat = redMaterial;

        if (!includeChildren)
        {
            transf = gameObject.transform;
            rend = gameObject.GetComponent<Renderer>();
            meshFilter = gameObject.GetComponent<MeshFilter>();
            sRend = gameObject.GetComponent<SkinnedMeshRenderer>();
        }
        else
        {
            transforms = new List<Transform>();
            renderers = new List<Renderer>();
            isSkinedMeshRenderer = new List<bool>();
            meshFilters = new List<MeshFilter>();
            meshes = new List<Mesh>();

            PopulateLists(gameObject);
        }

        voxelScale = new Vector3(voxelSideSize, voxelSideSize, voxelSideSize);
    }
예제 #31
0
	public void buildMech(string c, string a, string l, string h, string b, string w1l, string w1r, string w2l, string w2r) {
		findHands ();
		string[] parts = new string[9]{ c, a, l, h, b, w1l, w1r, w2l, w2r };
		for (int i = 0; i < parts.Length; i++) {
			parts [i] = parts [i] == null ? defaultParts [i] : parts [i];
		}
			
		// Create new array to store skinned mesh renderers 
		SkinnedMeshRenderer[] newSMR = new SkinnedMeshRenderer[5];

		Material[] materials = new Material[5];
		for (int i = 0; i < 5; i++) {
			// Load mech part
			GameObject part = Resources.Load (parts [i], typeof(GameObject)) as GameObject;

			// Extract Skinned Mesh
			newSMR [i] = part.GetComponentInChildren<SkinnedMeshRenderer> () as SkinnedMeshRenderer;

			// Load texture
			materials [i] = Resources.Load (parts [i] + "mat", typeof(Material)) as Material;
		}

		// Replace all
		SkinnedMeshRenderer[] curSMR = GetComponentsInChildren<SkinnedMeshRenderer> ();
		for (int i = 0; i < curSMR.Length; i++){
			curSMR[i].sharedMesh = newSMR[i].sharedMesh;
			curSMR[i].material = materials[i];
			curSMR[i].enabled = true;
		}

		// Replace weapons
		buildWeapons (new string[4]{parts[5],parts[6],parts[7],parts[8]});
	}
예제 #32
0
    public void Refresh()
    {
        if(transform.parent)
            if(transform.parent.GetComponent<SkinnedMeshRenderer>())
                meshRenderer = transform.parent.GetComponent<SkinnedMeshRenderer>();
	        BoneWeight[] boneWeights = mesh.boneWeights;

        if(Bone0)
            boneWeights[vertNumber].boneIndex0 = boneIndex0;
        if(Bone1)
            boneWeights[vertNumber].boneIndex1 = boneIndex1;
        if(Bone2)
            boneWeights[vertNumber].boneIndex2 = boneIndex2;
        if(Bone3)
            boneWeights[vertNumber].boneIndex3 = boneIndex3;

        boneWeights[vertNumber].weight0 = Weight0;
        boneWeights[vertNumber].weight1 = Weight1;
        boneWeights[vertNumber].weight2 = Weight2;
        boneWeights[vertNumber].weight3 = Weight3;

        mesh.boneWeights = boneWeights;
        if(meshRenderer != null)
            meshRenderer.sharedMesh = mesh;
    }
예제 #33
0
	    void OnGUI()
	    {
			GUILayout.Label("UMA Slot Builder");
			GUILayout.Space(20);
			normalReferenceMesh = EditorGUILayout.ObjectField("Seams Mesh (Optional)", normalReferenceMesh, typeof(SkinnedMeshRenderer), false) as SkinnedMeshRenderer;
	        slotMesh = EditorGUILayout.ObjectField("Slot Mesh", slotMesh, typeof(SkinnedMeshRenderer), false) as SkinnedMeshRenderer;
			slotMaterial = EditorGUILayout.ObjectField("UMAMaterial", slotMaterial, typeof(UMAMaterial), false) as UMAMaterial;
	        slotFolder = EditorGUILayout.ObjectField("Slot Destination Folder", slotFolder, typeof(UnityEngine.Object), false) as UnityEngine.Object;
			EnforceFolder(ref slotFolder);
			slotName = EditorGUILayout.TextField("Element Name", slotName);
			
	        if (GUILayout.Button("Create Slot"))
	        {
	            Debug.Log("Processing...");
	            if (CreateSlot() != null)
	            {
	                Debug.Log("Success.");
	            }
	        }
	      
	        GUILayout.Label("", EditorStyles.boldLabel);
	        Rect dropArea = GUILayoutUtility.GetRect(0.0f, 50.0f, GUILayout.ExpandWidth(true));
	        GUI.Box(dropArea, "Drag meshes here");
	        GUILayout.Label("Automatic Drag and Drop processing", EditorStyles.boldLabel);
	        relativeFolder = EditorGUILayout.ObjectField("Relative Folder", relativeFolder, typeof(UnityEngine.Object), false) as UnityEngine.Object;
	        EnforceFolder(ref relativeFolder);

	        DropAreaGUI(dropArea);
	    }
예제 #34
0
 static public int set_rootBone(IntPtr l)
 {
     UnityEngine.SkinnedMeshRenderer o = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
     UnityEngine.Transform           v;
     checkType(l, 2, out v);
     o.rootBone = v;
     return(0);
 }
예제 #35
0
 static public int set_localBounds(IntPtr l)
 {
     UnityEngine.SkinnedMeshRenderer o = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
     UnityEngine.Bounds v;
     checkType(l, 2, out v);
     o.localBounds = v;
     return(0);
 }
예제 #36
0
 static public int set_sharedMesh(IntPtr l)
 {
     UnityEngine.SkinnedMeshRenderer o = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
     UnityEngine.Mesh v;
     checkType(l, 2, out v);
     o.sharedMesh = v;
     return(0);
 }
예제 #37
0
 static public int set_quality(IntPtr l)
 {
     UnityEngine.SkinnedMeshRenderer o = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
     UnityEngine.SkinQuality         v;
     checkEnum(l, 2, out v);
     o.quality = v;
     return(0);
 }
예제 #38
0
    static public int set_updateWhenOffscreen(IntPtr l)
    {
        UnityEngine.SkinnedMeshRenderer o = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.updateWhenOffscreen = v;
        return(0);
    }
 static public void FastSetter(this UnityEngine.SkinnedMeshRenderer o, string propertyName, UnityEngine.Transform value)
 {
     switch (propertyName)
     {
     case "rootBone":
         o.rootBone = value; return;
     }
     LBoot.LogUtil.Error("UnityEngine.SkinnedMeshRenderer no Setter Found : " + propertyName);
 }
 public static int  obj_hash(long L)
 {
     UnityEngine.SkinnedMeshRenderer obj = FCGetObj.GetObj <UnityEngine.SkinnedMeshRenderer>(L);
     if (obj != null)
     {
         return(obj.GetHashCode());
     }
     return(0);
 }
 static public void FastSetter(this UnityEngine.SkinnedMeshRenderer o, string propertyName, UnityEngine.SkinQuality value)
 {
     switch (propertyName)
     {
     case "quality":
         o.quality = value; return;
     }
     LBoot.LogUtil.Error("UnityEngine.SkinnedMeshRenderer no Setter Found : " + propertyName);
 }
예제 #42
0
 static public int get_bones(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         pushValue(l, self.bones);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #43
0
 static public int get_quality(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         pushEnum(l, (int)self.quality);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #44
0
 static public int get_updateWhenOffscreen(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         pushValue(l, self.updateWhenOffscreen);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #45
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer o;
         o = new UnityEngine.SkinnedMeshRenderer();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    static public void FastSetter(this UnityEngine.SkinnedMeshRenderer o, string propertyName, System.Boolean value)
    {
        switch (propertyName)
        {
        case "updateWhenOffscreen":
            o.updateWhenOffscreen = value; return;

        case "skinnedMotionVectors":
            o.skinnedMotionVectors = value; return;
        }
        LBoot.LogUtil.Error("UnityEngine.SkinnedMeshRenderer no Setter Found : " + propertyName);
    }
예제 #47
0
파일: Actor.cs 프로젝트: lge-ros2/cloisim
            void Start()
            {
                capsuleCollider  = GetComponentInChildren <UE.CapsuleCollider>();
                skinMeshRenderer = GetComponentInChildren <UE.SkinnedMeshRenderer>();

                if (script != null && script.auto_start && HasWayPoints)
                {
                    StartWaypointFollowing();
                }

                StartCoroutine(SetAgentColliderSize());
            }
 static public int get_localBounds(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.localBounds);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #49
0
 static public int get_localBounds(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         pushValue(l, self.localBounds);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
예제 #50
0
 static public int set_localBounds(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         UnityEngine.Bounds v;
         checkValueType(l, 2, out v);
         self.localBounds = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #51
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.SkinnedMeshRenderer o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.SkinnedMeshRenderer();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
예제 #52
0
 static public int set_bones(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         UnityEngine.Transform[]         v;
         checkType(l, 2, out v);
         self.bones = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #53
0
 static public int set_updateWhenOffscreen(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.updateWhenOffscreen = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #54
0
 static public int BakeMesh(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         UnityEngine.Mesh a1;
         checkType(l, 2, out a1);
         self.BakeMesh(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #55
0
 static public int set_skinnedMotionVectors(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.skinnedMotionVectors = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #56
0
 static public int set_quality(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         UnityEngine.SkinQuality         v;
         checkEnum(l, 2, out v);
         self.quality = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #57
0
 static public int set_sharedMesh(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         UnityEngine.Mesh v;
         checkType(l, 2, out v);
         self.sharedMesh = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #58
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer o;
         o = new UnityEngine.SkinnedMeshRenderer();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
예제 #59
0
 static public int set_rootBone(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         UnityEngine.Transform           v;
         checkType(l, 2, out v);
         self.rootBone = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
예제 #60
0
 static public int set_localBounds(IntPtr l)
 {
     try {
         UnityEngine.SkinnedMeshRenderer self = (UnityEngine.SkinnedMeshRenderer)checkSelf(l);
         UnityEngine.Bounds v;
         checkType(l, 2, out v);
         self.localBounds = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }