Hi:
Assuming that you are creating a Python plug-in instead of a C++ plug-in, there are two solutions.
The first is to compare the variable data after the control is updated after the plug-in's name stores the previous variable data.If the data is not the same, it is executed to avoid repeated runs.
The second is to create a polygon cache, for example by storing the previous variable data with the local coordinates of the first point, and comparing variable data after the control is updated.If the data is not the same, it is executed to avoid repeated runs.
Python plug-ins actually update automatically, even with every click of the mouse, which often leads to very heavy delays.All dirty systems can be used to detect if an update has occurred.
There should be a better solution to your problem.
Here are examples of Python tags and links to examples : link text
import c4d
#e-mail: [email protected]
def main():
Name = op.GetName()
Objects = op.GetObject()
Changed = Objects.GetDirty(c4d.DIRTYFLAGS_SELECT)
Text = ["xit" + str(Changed)[-1]]
if str(Name).count(Text[0][:-1]) != 0 :
if str(Name).find(Text[0][:-1]) != str(Name).rfind(Text[0][:-1]) :
if str(Name)[str(Name).rfind(Text[0][:-1]):] == Text[0] :
if str(Name).find(Text[0][:-1]) <= 0:
#Do not execute, exit the program.
print ("Does not perform.")
op.SetName(str(Text[0]))
return
else:
#Do not execute, exit the program.
op.SetName(str(Name)[:str(Name).find(Text[0][:-1])] + str(Text[0]))
print ("Does not perform.")
return
else:
if str(Name).find(Text[0][:-1]) <= 0:
op.SetName(str(Text[0]))
print ("Perform.")
else:
op.SetName(str(Name)[:str(Name).find(Text[0][:-1])] + str(Text[0]))
print ("Perform.")
else:
if str(Name)[str(Name).rfind(Text[0][:-1]):] == Text[0] :
#Do not execute, exit the program.
print ("Does not perform.")
return
else:
op.SetName(str(Name)[:str(Name).find(Text[0][:-1])] + str(Text[0]))
print ("Perform.")
else:
print ("Perform.")
op.SetName(str(Name) + str(Text[0]))
print ("pass")
#The next thing to execute.