public void ModifyObject() { if (Enabled && mods != null) { dirtyChannels = MegaModChannel.None; //if ( GrabVerts ) //{ //if ( sverts.Length < mesh.vertexCount ) //sverts = new Vector3[mesh.vertexCount]; //verts = mesh.vertices; //} VertsSource = true; UVsSource = true; modContext.mod = this; selection = null; for (int i = 0; i < mods.Length; i++) { MegaModifier mod = mods[i]; if (mod != null && mod.ModEnabled) { // **group** if (mod.instance) { // Actually dont even do this have a GetValues method mod.SetValues(mod.instance); } if ((mod.ChannelsReq() & MegaModChannel.Verts) != 0) // should be changed { mod.verts = GetSourceVerts(); mod.sverts = GetDestVerts(); } modContext.Offset = mod.Offset; modContext.bbox = mod.bbox; mod.SetTM(); if (mod.ModLateUpdate(modContext)) { if (selection != null) { mod.ModifyWeighted(this); if (UpdateMesh < 1) { UpdateMesh = 1; } } else { if (UpdateMesh < 1) { mod.Modify(this); UpdateMesh = 1; } else { mod.Modify(this); } } dirtyChannels |= mod.ChannelsChanged(); mod.ModEnd(this); } } } if (UpdateMesh == 1) { SetMesh(ref sverts); UpdateMesh = 0; } else { if (UpdateMesh == 0) { SetMesh(ref verts); UpdateMesh = -1; // Dont need to set verts again until a mod is enabled } } } }