示例#1
0
        private bool AttachToExistingConstraints(Collection4 newConstraintsCollector, object
                                                 obj, bool onlyForPaths)
        {
            bool        found = false;
            IEnumerator j     = IterateConstraints();

            while (j.MoveNext())
            {
                QCon         existingConstraint = (QCon)j.Current;
                BooleanByRef removeExisting     = new BooleanByRef(false);
                if (!onlyForPaths || (existingConstraint is QConPath))
                {
                    QCon newConstraint = existingConstraint.ShareParent(obj, removeExisting);
                    if (newConstraint != null)
                    {
                        newConstraintsCollector.Add(newConstraint);
                        AddConstraint(newConstraint);
                        if (removeExisting.value)
                        {
                            RemoveConstraint(existingConstraint);
                        }
                        found = true;
                        if (!onlyForPaths)
                        {
                            break;
                        }
                    }
                }
            }
            return(found);
        }