override protected NPVoxModel CreateProduct(NPVoxModel reuse = null) { if (Input == null) { return(NPVoxModel.NewInvalidInstance(reuse, "No Input Setup")); } NPVoxModel model = ((NPVoxIModelFactory)Input).GetProduct(); if (model is NPVoxBoneModel) { Debug.LogError("cannot create bone model on top of another bone model"); return(model); } NPVoxBoneModel newModel = NPVoxBoneModel.NewInstance(model.Size, reuse as NPVoxBoneModel); newModel.CopyOver(model); // setup bone masks newModel.AllBones = NPVoxBone.CloneBones(AllBones); for (int i = 0; i < AllBones.Length; i++) { NPVoxBone bone = AllBones[i]; List <NPVoxBox> boxes = AllBoxes[i].Boxes; if (boxes != null) { foreach (NPVoxBox box in boxes) { foreach (NPVoxCoord coord in box.Enumerate()) { newModel.AddBoneMask(coord, 1u << (bone.ID - 1)); } } } } return(newModel); }