Some attempts at nondestructive modeling
-
Hi:
I wrote a Python script that reads the object cache with the Python tag and recreates the cache object to achieve some sense of lossless modeling.But the script is very unstable and prone to program crashes, especially when reading Boolean generators.The script was inspired by the "Py-ParametricTools" plugin for @a_block .link text
The plug-in was completed in 2017, but when I touched it, I felt I could continue to optimize, so I wrote the script.
The reason why the script is unstable is that it is difficult to restore the N-Gons face, and many methods have been tried to solve the problem successfully, which also leads to the instability of the program.You can generate animation like a generator, but only for simple objects.Also, this does not apply to effectors because effectors do not cache objects.The following is an example:
-
Hi @x_nerve , thanks for reaching out us.
Thanks for the remarks but I'm a little bit puzzled by your post and I think I didn't really catch the overall sense of it.
A few questions that could help me better scope it:- is there a reason why you marked the thread as Solved? (by this way looks like you're not looking for support)
- if you're looking for support:
- what your plugin is actually trying to do?
- what is the actual issue you're facing?
- can you reproduce the issue outside of your plugin with some simple code?
Looking forward hearing more from you, give best.
-
Hi:
I know there's a function in the Python SDK that detects if the parameters of a subobject have changed, but I want to know if this can be used in Python tags for automatic updates.Python tag updates, which automatically update at the click of an object manager blank, are annoying.Is there a solution?
-
Hi @x_nerve to get evidence of a sub-object to have changed its parameters' value you can use
C4DAtom::GetHDirty()
and use theHDIRTYFLAGS::OBJECT
bit mask.
Please be also sure to invoke the above method on theBaseObject
returned byBaseTag::GetObject()
Cheers, R
-
Hi:
After a trial run, the script was tested successfully. By setting the name suffix of Python Tag, the problem of repeated running of Tag can be solved.
Taking c4d.DIRTYFLAGS_SELECT as an example, if the point, line, and surface selections change, it will execute, otherwise it won't.
The Python script code is as follows:
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.