
In this video let’s talk about Buttons that you can add to User Data interfaces to make your rigs and scene setups more convinient.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
You may find this Cinema 4D plugins useful
Hello I wanted to know if it is possible to apply this script using not the user data object but the user data tag thank you very much
Do you want to place the Button to User Data Tag?
Hi, This script is what I was looking for. Thank you for sharing. I have one question. how do I control a volume object’s cache button using a user data button?
Thanks
Did you mean cache layer like here?
https://youtu.be/N4agF-hJ-VM
yes, the cache layer button.
This probably doesn’t work in Xpresso using Python node. I can’t get it to work here.
Yes, it tested only with tags