Skip to content

Instantly share code, notes, and snippets.

@MikeUdin
Last active March 10, 2021 12:18
Show Gist options
  • Save MikeUdin/337e3dedb8e663098c1f6b9dcc358a40 to your computer and use it in GitHub Desktop.
Save MikeUdin/337e3dedb8e663098c1f6b9dcc358a40 to your computer and use it in GitHub Desktop.
import c4d,webbrowser
# Check tutorial and
# download project file here:
# https://mikeudin.net/?p=6900
#### 1 ####
#Python Tag placed User Data Button
def message(id,data):
if id == c4d.MSG_DESCRIPTION_CHECKUPDATE:
if len(data["descid"]) > 1 and data["descid"][1].dtype == c4d.DTYPE_BUTTON:
buttonID = data["descid"][1].id
if buttonID == 1:
createNew()
if buttonID == 11:
url = "https://mikeudin.net/donate/"
webbrowser.open(url, new=2, autoraise=True)
#### 2 ####
#Python Tags Object placed User Data Button
def message(msg_type, data):
if msg_type == c4d.MSG_NOTIFY_EVENT:
event_data = data['event_data']
if event_data['msg_id'] == c4d.MSG_DESCRIPTION_COMMAND:
desc_id = event_data['msg_data']['id']
if desc_id[1].id == 1:
print ("UD Button Pressed")
def main():
obj = op.GetObject()
bc = c4d.BaseContainer()
obj.AddEventNotification(op, c4d.NOTIFY_EVENT_MESSAGE, 0, bc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment