How to make add an xref in Object Plugin
-
On 08/08/2013 at 16:29, xxxxxxxx wrote:
Quick question that I'm banging my head trying to figure out today:
Can I create an xref within an object plugin?
Here's a snippet of what I have:
xrefName = myData.GetData(11000) baseNull = c4d.BaseObject(c4d.Onull) myXref = c4d.BaseObject(c4d.Oxref) myXref.InsertUnder(baseNull) myXref[c4d.ID_CA_XREF_FILE] = xrefName c4d.EventAdd() return baseNull
The xref does not show up inside my plugin when I make it editable.
Any idea of what I am doing wrong, or if I can even access an xref in a plugin?Thanks,
David -
On 09/09/2013 at 02:45, xxxxxxxx wrote:
Hi David,
I'll ask the developers if it is possible, and how, to change the path of an XRef. Until then, there's
still your thread from 2012https://developers.maxon.net/forum/topic/6694/7299_rename-xref-problem
-
On 09/09/2013 at 10:45, xxxxxxxx wrote:
Thanks for your reply Niklas. I have figured out a work around to get this to work, as I mentioned in my old post. I import an xref (new style) that has anything in it's path in with Generator checked on. I can then copy my legacy xref object path to this new xref. Presently I'm stuck trying to figure out how to turn Generator mode off in the new xref. Apparently it is not possible.
This does not have any effect: newXref[c4d.ID_CA_XREF_GENERATOR] = 0
My end goal is to have a script that automates converting all our legacy xref's to new ones to take advantage of the new Team Render. So far my tests with Team Render with legacy xrefs are not working, but the new xrefs do.
Anyone have success with this?
-
On 26/02/2014 at 01:56, xxxxxxxx wrote:
The Xref file seems broken to edit. I don't find any way to change the file loaded, even in Python, C++, Xpresso...
Is it a right way to create a Xref object ?
I tried to create my own loader generator with Python and LoadDocument(), but it's less powerfull than the Xref, my generator reload the file on each cache build event (like when we do an Ctrl + Z), it's very annoying when we load a big file. : /
-
On 07/07/2014 at 17:46, xxxxxxxx wrote:
Still nothing on this?
I am trying every logical method I can think of and am yet to modify my XRef settings via Python. I can manually modify anything, but the object seems dead to Python. Is there a SetXXX() method that I am to use?
TIA
-
On 18/07/2014 at 11:43, xxxxxxxx wrote:
+1 request for info on how to create XRefs in Python. I can't find much in the docs about scripting with XRefs.
-
On 02/11/2017 at 01:59, xxxxxxxx wrote:
Is this issue fixed by now?
I can't seem to edit xrefs in code when they are not in Generator mode.
As xrefs seem to break a lot, I would love to code a way to fix them with one button instead of taking hours to repair my broken animation files.Also I know MAXON has a hard time with the legacy XREF-Code internally, so it would be great to know if this gets fixed sometime or if we should try to find some time to code our own XREF-functionality. It is no problem, I just need to know and will share what I come up with
-
On 02/11/2017 at 10:14, xxxxxxxx wrote:
Actually you can create and/or modify Xref parameters (e.g. set the file parameter).
The thing is to mark the change of the parameter as an user interaction.So, make sure the Xref is inserted in a document (will crash without).
And then set the parameter like so:xref.SetParameter(c4d.ID_CA_XREF_FILE, 'myfile.c4d', c4d.DESCFLAGS_SET_USERINTERACTION)
This works independently of generator mode.
But unfortunately there's another culprit with changing the file parameter. A requester will pop up, if the user wants to change the referenced file. And I see no way to suppress it. -
On 06/11/2017 at 05:54, xxxxxxxx wrote:
Ah this will work in my case, thanks a lot Andreas.
It's faster and more robust to let the user click yes a few times than letting them search for each single reference on their file-system.