On Tuesday, March 8, 2016 at 3:41:12 AM UTC-6, Edward K. Ream wrote:
>> Is there a way to combine
[two different sets of clones] so that they really are clones of the
exact same node?
> There is always a way, given the proper script.
But *neither* of the first two scripts are even close to correct.
The second script won't change the outline at all! Which is a good thing,
as it turns out.
The problem is harder than it first appears because it involves *replacing*
a node by another node. Leo doesn't presently have a direct way to do
this, and it probably *shouldn't*. It's hard in general because the two
nodes could have children.
On second thought, perhaps a clone-find would be a better approach. Here
is the general approach:
Use c.cloneFindByPredicate to find all *parent *nodes of the deprecated
clones:
# set deprecated_clone to the position of any deprecated clone.
def isParentOfDeprecatedClone(p):
return any([z.v == deprecated_clone.v for z in p.children()])
c.cloneFindByPredicate(
generator=c.all_unique_positions,
predicate=isParentOfDeprecatedClone,
flatten=True)
Now you have a list of parents. For each parent, swap the desired clone
for the unwanted clone. Probably best to do this by hand.
HTH.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.