On 16/10/2015 at 05:07, xxxxxxxx wrote:
Hello!
I'm trying to write my first experimental lines of Python code in C4D.
Allow me to first explain what I'm after:
Unfortunately, C4D has no "working pivot" yet, like XSI or 3ds Max.
For those unfamiliar - it allows for simple and non-destructive repositioning of any object selection, without changing any axes.
In C4D's component mode, the Axis pretty much already works like this.
Yet, in object mode, when the selection contains not only editable meshes but also parametric objects like primitives, nulls or generators, moving the Axis in Axis mode can lead to undesirable offsets of those parametric objects.
Also, there seems to be no decent way to utilize snapping as needed.
A workaround could be to temporarily group the objects, and moving the parent null, but that could rip objects out of their hierarchy.
So, here's the script idea:
- Create a null, call it "TempAxis", create a second null as it's child.
- Create a Parent Constraint on each selected object, Link the target to the child null.
- Select the TempAxis, enter Axis mode - script ends here.
Now the user can now snap the TempAxis null to a first position, leave Axis mode, move to the second postion, and the selected objects follow. Voilá, a working pivot - theoretically.
(To avoid cluttering the scene with lots of Parent Constraint Tags, some cleaning up would be done beforehand in the script.)
Here's the problem:
I figured how to create the Parent Constraint Tag...
#oSel = some object
oTag = oSel.MakeTag(1019364)
oTag[c4d.ID_BASELIST_NAME]='_TEMP_'
oTag[c4d.ID_CA_CONSTRAINT_TAG_PARENT] = True
... how do I link the target to an object (the child null)?
Many thanks!!
Eugen