@@ -22,11 +22,12 @@ PLUGIN_ID = 1053134
22
22
23
23
class CustomIconObjectData (c4d .plugins .ObjectData ):
24
24
25
- def Init (self , node ):
25
+ def Init (self , node , isCloneInit = False ):
26
26
"""Called by Cinema 4D to initialize the instance.
27
27
28
28
Args:
29
29
node (c4d.GeListNode): The instance of the ObjectData.
30
+ isCloneInit (bool): True if the object data is a copy of another one.
30
31
31
32
Returns:
32
33
bool: True on success, otherwise False.
@@ -43,10 +44,6 @@ class CustomIconObjectData(c4d.plugins.ObjectData):
43
44
# Defines the custom color mode used with the previously created BaseContainer already filled
44
45
iconSettings .SetContainer (0 , iconSpecialModes )
45
46
46
- # Since we are going to use our custom MSG_GETCUSTOMICONS code,
47
- # set this to True so parent object (e.g. BaseObject) will ignore MSG_GETCUSTOMICONS messages.
48
- iconSettings .SetBool (c4d .ID_ICONCHOOSER_SETTINGS_PARENT_IGNORE , True )
49
-
50
47
# Sets icon settings container into the current Object instance data container
51
48
node .GetDataInstance ().SetContainer (c4d .ID_ICONCHOOSER_SETTINGS , iconSettings )
52
49
@@ -93,7 +90,7 @@ class CustomIconObjectData(c4d.plugins.ObjectData):
93
90
settings ._specialColors = arr
94
91
95
92
# Fills the CustomIconSettings with the passed BaseContainer object
96
- c4d .CustomIconSettings .FillCustomIconSettingsFromBaseList2D (settings , node .GetData (), node .GetType (), True )
93
+ c4d .CustomIconSettings .FillCustomIconSettingsFromBaseList2D (settings , node .GetDataInstance (), node .GetType (), True )
97
94
98
95
# Finally fills the icon Data settings with the CustomIconSettings
99
96
c4d .CustomIconSettings .GetCustomIcon (data , settings , True )
@@ -115,9 +112,11 @@ if __name__ == "__main__":
115
112
raise MemoryError ("Failed to initialize the BaseBitmap." )
116
113
117
114
# Registers the object plugin
115
+ # Since we are going to use our custom MSG_GETCUSTOMICONS code,
116
+ # set TAG_ICONCHOOSER_PARENT_IGNORE o parent object (e.g. BaseObject) will ignore MSG_GETCUSTOMICONS messages.
118
117
c4d .plugins .RegisterObjectPlugin (id = PLUGIN_ID ,
119
118
str = "py-Custom Icon Object Data" ,
120
119
g = CustomIconObjectData ,
121
120
description = "py_custom_icon" ,
122
121
icon = bmp ,
123
- info = c4d .OBJECT_GENERATOR )
122
+ info = c4d .OBJECT_GENERATOR | c4d . TAG_ICONCHOOSER_PARENT_IGNORE )
0 commit comments