Deforming custom user data
rsodre last edited by rsodre
I've build a proof of concept project with very simple objects to understand how generators and modifiers work and then implement that workflow in my plugin. I miss a proper manual explaining how Generators and Deformers works in detail, it's been really time consuming learning curve, based on bits and pieces gathered from examples, api notes and forum posts.
My basic design is to have one base object, inside it one generator and a series of modifiers that will all act on a custom user data type, an in the end generate a spline or a polygon, depending on those modifiers. The generator reads a linked mesh and creates the initial custom data, which is passed from modifier to modifier. The last mod (or the base object) will then generate the spline or polygon. Looks like this (with borrowed icons from sdk examples):
Making this work raised many questions...
To pass down the user data, I thought I could just create a custom object containing the user data in TGenerator and pass down to the modifiers. But I discovered that only polygons and splines are cached and passed to modifiers. I solved that by creating an empty polygon, adding a tag with the custom data (empty splines won't go down either). My luck is that the cache preserved the tag, and I can read it on modifiers. Is there any way to cache custom objects, or preserve them in the cache? Is there an easier way to send custom user data to modifiers?
In my initial tests, when TObject was not generating anything, the modifiers were being consumed by TGenerator. When I added TGenerator as a dependency of TObject, the modifiers started being consumed by TObject, breaking that initial design. Now TGenerator cache is passed to TObject, and from there to the modifiers. This got too complicated and created many new problems. If I layout my objectes like this, everything works as I wish:
But to the user, the only difference from TGenerator and TModifiers is that generators comes first. If possible, I don't want to force that new hierarchy under TGenerator, and keep the workflow as simple as the first screenshot. In the original workflow, is there any way to force the modifiers to be consumed by TGenerator and not TObject?
You may suggest that TObject and TGenerator be one object, but I want to keep them separated because we can have different generators, and I wish to add some custom GUI to TObject to select and add new generators and modifiers, much like the new Group Field object.
Since the initial dummy polygon from TGenerator can change to a spline in the end, I found two options to do that. TObject just reads the final TGenerator cache and uses it (IDEAL), or TObject creates it anew from what we find in the final generator's cache. The achieve the first option, if a modifier receives a polygon, is it safe to delete it and add a spline instead?
If I generate a spline in TGenerator, modifiers receive the cache as a LineObject, and I can't modify it as spline anymore. How can I preserve the cache as a Spline?
I tried and failed to use Dependence lists on TObject to read the cache from TGenerator, so I'm using
GetAndCheckHierarchyClone()instead. How can I get the caches from the objects I added to the dependence lists? I tried using
GetDeformCache()on the added object, and it always returns null.
The Active Object Dialog plugin from the sdk example has been invaluable help to understand what's happening inside the objects, thanks for that!
we are terribly sorry, the preparation of our DevKitchen next week takes way more resources than expected. We will not be able to discuss this topic with you in depth until afterwards. Sorry!
I do hope you can understand.
In regards of passing data or attaching data, actually the TagData approach is the correct one. This is one of the main purposes of tags to attach additional data to objects and as you already found out, these will be preserved in caches.
Unfortunately I need to leave all the rest of your nicely detailed post open for now.
I turned this thread into a question, see Q&A Functionality.
rsodre last edited by
Sure, I understand. I actually got around most issues, but would like to know your opinion on each one when you have time.
I don't know what I did, but now the modifiers are being consumed by TGenerator, as I wished. I really would like to understand how it works.
I found no way to change a cached polygon to spline. My TGenerator is now looking into all the modifiers to determine if it at the end it will need a Spline or Polygon, and start with that.
rsodre last edited by
I got around issues 1 and 2. Now I have just one main generator and child modifiers. Simpler and effective.
But i really need answers to issues 3, 4 and 5.
Hi Roger, I'm jumping into this discussion simply because Andreas is busy at the moment.
- point 3: it's actually not possible to turn a polygon cache in a spline... you can only consider, but it's rather a hack more than an orthodox approach to use the caches points to create the line object which you would expect from a spline cache, but take it as "thinking loud".
- point 4: no chance to preserve the cache of a spline as a spline... it's like asking can i preserve the cache of a sphere as a sphere? Actually cache are meant to be the lowest-order geometry to be processed by the displaying pipeline. So surfaces gets tesselleted in points and triangles and mathematical curves in line segments.
- point 5: I don't get the point here, sorry: you said you used
GetAndCheckHierarchyClone()so which objects are you referring you added in the dependency list?