본문 바로가기

Code/cinema4d & 3dsmax

baseContainer에 대해

그냥 데이터 저장하는 객체인데

 

c4d에서 사용되는 객체입니다.

 

 

여기에 값을 저장해서 len도 찍을수 있고,

저장해서 다른 함수로 넘길수도 있습니다.

저는 다른 스크립트로 값을 넘길때 baseContainer를 사용했습니다.

 

developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/BaseContainer/index.html?highlight=basecontainer

 

c4d.BaseContainer — Cinema 4D SDK 23.110 documentation

Once you’ve set a container value using one type you must neither try to access it using another type, nor overwrite it with a value of another type! Using the wrong access will not crash, but it is illegal.

developers.maxon.net

 

bc = c4d.BaseContainer()
bc[1000] = "hello"
bc[2000] = "world"

# Print content
print "Original:"
for dataid, data in bc:
    print data,

dataptr = bc.GetDataPointer(1000)
bc.InsDataAfter(3000, "beautiful", dataptr)

# Print content
print "Changed:"
for dataid, data in bc:
    print data,
print

이런식이나 setData를 통해서 값을 저장할수 있는데 이상한점은 list tuple 객체 같은건 값으로는 될수 없다.

그래서 subcontainer를 사용해야합니다.