Replace object and links
-
On 13/08/2013 at 03:47, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) :---------
I want to replace an object in a hierarchy and adjust all BaseLinks pointing to it. Is this possible? I
couldn't find a way to do it.Thanks!
-niklas -
On 13/08/2013 at 04:24, xxxxxxxx wrote:
hi niklas,
i am not sure if do understand you correctly, but i did something similar recently in python (replace
object type a with object type b in a document, while maintainaing all qualities of object A). first of
all there is the built in replace with function in c4d, which might do what you want without any
further struggle. if you do need more control here are my python results :1. replacing the track, containder/userdata data works pretty straight forward.
2. for replacing the links i did:
> - collect all nodes to be replaced
>
> - generate a replacement node list in the same order
>
> - temp insert the replacement list into the document
>
> - overwrite the BaseLinks
>
> - remove the old nodes
>
> - move the replacement nodes to their final destination.
3. which does work ok. however for BaseLinks stored in the userdata container my method does
not work, i am not 100% sure why.if you are looking for an automated way to get hold of all BaseLinks pointing to a BaseList2D i am
afraid there is no such method. You will have to iterate through your documents nodes and their
data containers yourself.here is some code. the relevant method would be replaceContainerReference().
http://codepad.org/ne4v1nBN -
On 13/08/2013 at 06:30, xxxxxxxx wrote:
Thank you very much for your answer Ferdinand, appreciate it.
What is this automated "replace with" function you mentioned? I can't find something
like this neither in the C++ SDK nor in the Python SDK. Maybe I am searching with the
wrong keywords.I'll try to replicate your Python code in C++.
Thanks!
-Niklas -
On 13/08/2013 at 07:05, xxxxxxxx wrote:
Howdy,
I think the function you're trying to find is BaseList2D::TransferGoal().
Adios,
Cactus Dan -
On 13/08/2013 at 07:20, xxxxxxxx wrote:
That's exactly what I searched for, Dan! Thank you very much!
Best,
-Niklas -
On 13/08/2013 at 07:27, xxxxxxxx wrote:
Howdy,
You're welcome.
Adios,
Cactus Dan -
On 13/08/2013 at 14:19, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Thank you very much for your answer Ferdinand, appreciate it.
What is this automated "replace with" function you mentioned? I can't find something
like this neither in the C++ SDK nor in the Python SDK. Maybe I am searching with the
wrong keywords.I'll try to replicate your Python code in C++.
Thanks!
-Niklasi meant the CA command which is buried somewhere in the CA tools menu. but it is good to
know about BaseList2D.TransferGoal(). Something learned again today