示例#1
0
        protected override void DrawActorInfo()
        {
            if (cloth.clothMesh == null)
            {
                return;
            }

            Material mat = ObiEditorUtils.GetRequiredEditorResource("Obi/PropertyGradientMaterial.mat") as Material;

            if (mat.SetPass(0))
            {
                // hide wireframe
                EditorUtility.SetSelectedWireframeHidden(cloth.GetComponent <Renderer>(), true);

                Mesh gradientMesh = GameObject.Instantiate(cloth.clothMesh);

                Color[] colors = new Color[gradientMesh.vertexCount];

                for (int i = 0; i < gradientMesh.vertexCount; i++)
                {
                    // get particle index for this vertex:
                    int particle = cloth.topology.visualMap[i];

                    // calculate vertex color:
                    if (selectionMask && !selectionStatus[particle])
                    {
                        colors[i] = Color.black;
                    }
                    else
                    {
                        colors[i] = GetPropertyValueGradient(GetPropertyValue(currentProperty, particle));
                    }
                }

                gradientMesh.colors = colors;

                Graphics.DrawMeshNow(gradientMesh, cloth.ActorLocalToWorldMatrix);
            }

            DrawParticleRadii();

            if (!paintBrush)
            {
                EditorUtility.SetSelectedWireframeHidden(cloth.GetComponent <Renderer>(), false);
                DrawParticles();
            }
        }
示例#2
0
        public override void OnEnable()
        {
            base.OnEnable();
            cloth = (ObiTearableCloth)target;

            particlePropertyNames.AddRange(new string[] { "Tear Resistance" });

            // show wireframe
            EditorUtility.SetSelectedWireframeHidden(cloth.GetComponent <Renderer>(), false);
        }