On 14/02/2018 at 09:12, xxxxxxxx wrote:
Hi,
thanks for the answer. For an artist with very basic coding skills it is not so easy to even know what to look for in the SDK. That is the structre I prefer to use since I have an overview in the code about the 2 objects that go together:
import c4d
from c4d import gui
import itertools
Nulls = ["Null1", "Null2" , "Null3" , "Null4"]
PositNull = ["N_Null1","N_Null2","N_Null3", "N_Null4"]
def main() :
for J,N in itertools.izip(Nulls,PositNull) :
obj = doc.SearchObject(J)
if obj is None: return False
matrix = obj.GetMg() #the global matrix
globalPos = matrix.off #get the position from the matrix
obj2 = doc.SearchObject(N)
if obj2 is None: return False
matrix2 = obj2.GetMg() #the global matrix
globalPos2 = matrix2.off #get the position from the matrix
m = matrix2
m.off = globalPos2 #get the position from the Object Matrix
obj.SetMg(m) #Sets the global matrix of 1 to 2
c4d.EventAdd()
if __name__=='__main__':
main()
Now I want to add the feature that the according objects align in OM hierarchy as well.