본문 바로가기

Code/cinema4d & 3dsmax

[c4d python] object

 

오브젝트 가져오기

 

for obj in doc.GetObjects():
	children = object.GetChildren()

 

 

import c4d
from c4d import gui


def test():
    o = doc.GetActiveObject() # Only one object
    # o = doc.GetActiveObjects(0) # return list

    if not o:
        return

    o.SetName('test')
    c4d.EventAdd()


if __name__ == '__main__':
    test()

 

import c4d
from c4d import gui


def test():
    print 'hello'
    o = doc.GetActiveObjects(0)

    if o == []:
        return
    newName = c4d.gui.InputDialog("New name:")
    sNumber = int(c4d.gui.InputDialog("Start number:"))


    for i in range(len(o)):
        o[i].SetName(newName+str(sNumber))
        sNumber = sNumber + 1

    c4d.EventAdd()


if __name__ == '__main__':
    test()

 

 

 

참고 자료:

c4d.BaseList2D:

developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/C4DAtom/GeListNode/BaseList2D/index.html?highlight=gettypename#BaseList2D.GetTypeName

 

c4d.BaseList2D — Cinema 4D SDK 23.110 documentation

data (dict{solo: bool, view: bool, render: bool, manager: bool, locked: bool, generators: bool, expressions: bool, animation: bool, color: c4d.Vector, xref: bool}) – The new layer data. it is possible to leave values in the dictionary out.

developers.maxon.net

c4d.BaseObject: c4d.BaseList2D 의 자식

developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/C4DAtom/GeListNode/BaseList2D/BaseObject/index.html#c4d.BaseObject

 

c4d.BaseObject — Cinema 4D SDK 23.110 documentation

Note The ID generation for cache objects is based on GetUniqueIP(), so if two cache objects have the same IP, they will probably also get the same GUID (unless they are point objects or polygon objects with different point or poly count).

developers.maxon.net

 

c4d.GeListNode;

developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/C4DAtom/GeListNode/index.html?highlight=getchildren#GeListNode.GetChildren

 

c4d.GeListNode — Cinema 4D SDK 23.110 documentation

c4d.GeListNode class c4d.GeListNode The base class of many other classes. This class is also a linked list which enables you to link several objects with each other. Methods Signatures Magic Methods Hierarchy Navigation Methods Insertion Methods N-Bit Meth

developers.maxon.net