Solved Modifier dependencies

When a generator has dependencies that must be previously cached, we use the DependencyList APIs inside GetVirtualObjects().

What if a modifier also has dependencies?
Can it add more dependencies to the parent generator?
What's the best method to guarantee that a dependency is cached?

hi,

just to be sure, as you can see on this page, the generator must check the dirtyness of a child to know if it need to rebuild its own cache.

If you have multiple object you can use a dependence list.For example, GetAndCheckHierarchyClone is using it internally.

Technically, you could use AddDependence from everywhere, but it will/could be erase right after.

If your modifier must be sure that another object is updated, you have to do it by yourself using IsDirty/https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_c4_d_atom.html#a5ac82ad49ad02242398aa01ef731f524/GetHDirty

Inside a generator you can use CheckCache.

You probably have an idea/example where it could be necessary, could you tell us more ?

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

@m_magalhaes My modifier have a BaseLink that can receive polygons, which I use for various things such as collision.

In a modifier, where is the better place to create a dependence list and check dependencies? modifyObject() or CheckDirty()

hi,

Well, in that case you have no real way to be 100% sure that the cache of the linked object will be created and updated.

CheckDirty is call more often than ModifyObject so between the two I would go with CheckDIrty
Another function you could also use, is Execute.
By adding it to a real late moment on the scene execution you could maybe make your deformer to update at the end (op->SetDirty())

You could also use a Message where you can check any change on the scene and check if it's your object that have changed. (by storing it's dirtyState)

Finally, when the link is modified or when someone drop an object you could check what kind of object it is and change the execute priority accordingly.

I think that Execute is probably the best solution here.

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

hi,

any feedback on this one ?

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

Hi @m_magalhaes

This was research for a feature I'll start implementing soon, and possible refactor.
I'll mark as solved and if there's anything else I need I'll open it again.

Thanks.