Skip to content

Commit 13f9d2a

Browse files
committed
R24 Initial Release
Update for R24 version. Change to google doc string format Example for the Node API will come later.
1 parent 8489bf2 commit 13f9d2a

File tree

214 files changed

+1621
-2461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+1621
-2461
lines changed

plugins/py-custom_icon_r21/py-custom_icon_r21.pyp

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright: MAXON Computer GmbH
33
Author: Maxime Adam
44
55
Description:
6-
- Demonstrates how to define custom icon color according to the new Cinema 4D R21 icon features.
6+
- Demonstrates how to define a custom icon color according to the new Cinema 4D R21 icon features.
77
88
Class/method highlighted:
99
- MSG_GETCUSTOMICON
@@ -12,10 +12,6 @@ Class/method highlighted:
1212
- maxon.Color
1313
- c4d.CustomIconSettings.FillCustomIconSettingsFromBaseList2D()
1414
- c4d.CustomIconSettings.GetCustomIcon()
15-
16-
Compatible:
17-
- Win / Mac
18-
- R21
1915
"""
2016
import os
2117
import c4d
@@ -27,13 +23,14 @@ PLUGIN_ID = 1053134
2723
class CustomIconObjectData(c4d.plugins.ObjectData):
2824

2925
def Init(self, node):
30-
"""
31-
Called when Cinema 4D Initialize the ObjectData (used to define, default values)
32-
:param node: The instance of the ObjectData.
33-
:type node: c4d.GeListNode
34-
:return: True on success, otherwise False.
35-
"""
26+
"""Called by Cinema 4D to initialize the instance.
3627
28+
Args:
29+
node (c4d.GeListNode): The instance of the ObjectData.
30+
31+
Returns:
32+
bool: True on success, otherwise False.
33+
"""
3734
# Creates a BaseContainer to store all custom color mode
3835
iconSpecialModes = c4d.BaseContainer()
3936

@@ -59,29 +56,27 @@ class CustomIconObjectData(c4d.plugins.ObjectData):
5956
return True
6057

6158
def GetVirtualObjects(self, node, hh):
62-
"""
63-
This method is called automatically when Cinema 4D ask for the cache of an object. This is also the place
64-
where objects have to be marked as input object by Touching them (destroy their cache in order to disable them in Viewport)
65-
66-
:param node: The Python Generator
67-
:type node: c4d.BaseObject.
68-
:param hh: The hierarchy helper.
69-
:type hh: c4d.HierarchyHelp (currently a PyObject).
70-
:return: The Representing object
59+
"""This method is called automatically when Cinema 4D asks for the cache of an object. This is also the place where objects have to be marked as input object by touching them (destroy their cache in order to disable them in Viewport).
60+
61+
Args:
62+
node (c4d.BaseObject): The Python generator.
63+
hh (c4d.HierarchyHelp): The hierarchy helper.
64+
65+
Returns:
66+
c4d.BaseObject: The represented object.
7167
"""
7268
return c4d.BaseObject(c4d.Onull)
7369

7470
def Message(self, node, msgId, data):
75-
"""
76-
Called by Cinema 4D part to notify the object to a special event
77-
78-
:param node: The instance of the ObjectData.
79-
:type node: c4d.BaseObject
80-
:param msgId: The message ID type.
81-
:type msgId: int
82-
:param data: The message data.
83-
:type data: Any, depends of the message passed.
84-
:return: Depends of the message type, most of the time True.
71+
"""Called by Cinema 4D part to notify the object to a special event.
72+
73+
Args:
74+
node (c4d.BaseObject): The instance of the ObjectData.
75+
msgId (int): The message ID type.
76+
data (Any): The message data.
77+
78+
Returns:
79+
Any: Depends of the message type, most of the time True.
8580
"""
8681
if msgId == c4d.MSG_GETCUSTOMICON:
8782
settings = c4d.CustomIconSettings()

plugins/py-cv_rss_r23/py-cv_rss_r23.pyp

Lines changed: 53 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ Class/method highlighted:
1717
- GeDialog.InitValues()
1818
- GeDialog.Timer()
1919
- GeDialog.Command()
20-
21-
Compatible:
22-
- Win / Mac
23-
- R23
2420
"""
2521
import c4d
2622
import os
@@ -90,9 +86,7 @@ class MyDialog(c4d.gui.GeDialog):
9086
self.CVRssData = None
9187

9288
def CreateLayout(self):
93-
"""
94-
This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog.
95-
"""
89+
"""This Method is called by Cinema 4D to retrieve the layout of the dialog."""
9690
# Defines the title
9791
self.SetTitle("Cineversity RSS")
9892

@@ -161,10 +155,10 @@ class MyDialog(c4d.gui.GeDialog):
161155
return True
162156

163157
def InitValues(self):
164-
"""
165-
Called after CreateLayout being called to define the values in the UI
166-
:return: True if successful, or False to signalize an error.
167-
:rtype: bool
158+
"""Called after CreateLayout() has been called to set the starting values in the UI.
159+
160+
Returns:
161+
bool: True if successful, or False to signalize an error.
168162
"""
169163
# Retrieves saved values from the world container of this plugin
170164
self.CVRssData = c4d.plugins.GetWorldPluginData(PLUGIN_ID)
@@ -184,18 +178,16 @@ class MyDialog(c4d.gui.GeDialog):
184178
return True
185179

186180
def Timer(self, msg):
187-
"""
188-
This method is called automatically by Cinema 4D according to the timer set with GeDialog.SetTimer method.
189-
:param msg: The timer message
190-
:type msg: c4d.BaseContainer
181+
"""Called by Cinema 4D in intervals defined by the GeDialog.SetTimer() method.
182+
183+
Args:
184+
msg (c4d.BaseContainer): The timer message
191185
"""
192186
# Scroll RSS function
193187
self.UpdateToNextRss()
194188

195189
def UpdateToNextRss(self):
196-
"""
197-
Called to update the Dialog Title with the next Title available in the RSS feed.
198-
"""
190+
"""Called to update the dialog title with the next title available in the RSS feed."""
199191

200192
# If updates time has been reached
201193
if c4d.GeGetTimer() < self.last_update + self.update_time:
@@ -218,9 +210,7 @@ class MyDialog(c4d.gui.GeDialog):
218210
self.current_item = 0
219211

220212
def UpdateRss(self):
221-
"""
222-
Retrieves the RSS Feed, updates internal data and UI if needed
223-
"""
213+
"""Retrieves the RSS feed, updates internal data and UI if needed."""
224214

225215
# Retrieves the RSS Url and parse its XML
226216
print("Updating... " + self.rss_url)
@@ -259,20 +249,20 @@ class MyDialog(c4d.gui.GeDialog):
259249
self.UpdateToNextRss()
260250

261251
def GoToUrl(self):
262-
"""
263-
Opens the web browser to the current displayed rss page
264-
"""
252+
"""Opens the web browser to the currently displayed RSS page."""
265253
url = self.rss_items[self.current_item-1]['link'].encode('utf-8')
266254
webbrowser.open(url, 2, True)
267255
return True
268256

269257
def Command(self, id, msg):
270-
"""
271-
This Method is called automatically when the user clicks on a gadget and/or changes its value this function will be called.
272-
It is also called when a string menu item is selected.
273-
:param id: The ID of the gadget that triggered the event.
274-
:param msg: The original message container
275-
:return: False if there was an error, otherwise True.
258+
"""This Method is called automatically when the user clicks on a gadget and/or changes its value this function will be called. It is also called when a string menu item is selected.
259+
260+
Args:
261+
id (int): The ID of the gadget that triggered the event.
262+
msg (c4d.BaseContainer): The original message container.
263+
264+
Returns:
265+
bool: False if there was an error, otherwise True.
276266
"""
277267

278268
# Clicks on any items of Scroll menu
@@ -359,9 +349,10 @@ class MyDialog(c4d.gui.GeDialog):
359349
return True
360350

361351
def SetFeedUrl(self, private):
362-
"""
363-
Sets the url feed
364-
:param private: the url feed to set, if empty asks for it
352+
"""Sets the url feed.
353+
354+
Args:
355+
private (str): The url feed to set, if empty, asks for it.
365356
"""
366357

367358
# If private is empty ask for it in a popup dialog
@@ -380,9 +371,10 @@ class MyDialog(c4d.gui.GeDialog):
380371
return True
381372

382373
def SetScrollItems(self, private):
383-
"""
384-
Sets scroll_items variable
385-
:param private: how many items to scroll through.
374+
"""Sets scroll_items variable.
375+
376+
Args:
377+
private (int): How many items to scroll through.
386378
"""
387379
self.scroll_items = private
388380

@@ -391,9 +383,10 @@ class MyDialog(c4d.gui.GeDialog):
391383
return True
392384

393385
def SetScrollTime(self, private):
394-
"""
395-
# Sets the amount of time to show each item
396-
:param private: time in seconds
386+
"""Sets the amount of time to show each item.
387+
388+
Args:
389+
private (int): Time in seconds.
397390
"""
398391
# Translates time in milliseconds
399392
self.scroll_time = private * 1000
@@ -406,9 +399,10 @@ class MyDialog(c4d.gui.GeDialog):
406399
return True
407400

408401
def SetUpdateTime(self, private):
409-
"""
410-
Sets the amount of time between updating RSS
411-
:param private: time in minutes
402+
"""Sets the amount of time between updating RSS.
403+
404+
Args:
405+
private (int): Time in minutes.
412406
"""
413407
# Translates time in milliseconds
414408
self.update_time = private*1000*60
@@ -418,16 +412,12 @@ class MyDialog(c4d.gui.GeDialog):
418412
return True
419413

420414
def About(self):
421-
"""
422-
Opens the About dialog
423-
"""
415+
"""Opens the About dialog"""
424416
c4d.gui.MessageDialog("Cineversity RSS v0.7\nby Rick Barrett (SDG)", c4d.GEMB_OK)
425417
return True
426418

427419
def UpdatePrefs(self):
428-
"""
429-
Updates the data stored in the world container (used to retrieve settings when Cinema 4D leaves)
430-
"""
420+
"""Updates the data stored in the world container."""
431421
self.CVRssData.SetString(FEED, self.rss_url)
432422
self.CVRssData.SetInt32(ITEMS, self.scroll_items)
433423
self.CVRssData.SetInt32(SCROLL, self.scroll_time)
@@ -436,17 +426,17 @@ class MyDialog(c4d.gui.GeDialog):
436426

437427

438428
class CVRss(c4d.plugins.CommandData):
439-
"""
440-
Command Data class that holds the CVRssDialog instance.
441-
"""
429+
"""Command Data class that holds the CVRssDialog instance."""
442430
dialog = None
443431

444432
def Execute(self, doc):
445-
"""
446-
Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu)
447-
:param doc: the current active document
448-
:type doc: c4d.documents.BaseDocument
449-
:return: True if the command success
433+
"""Called when the user executes a command via either CallCommand() or a click on the Command from the plugin menu.
434+
435+
Args:
436+
doc (c4d.documents.BaseDocument): The current active document.
437+
438+
Returns:
439+
bool: True if the command success.
450440
"""
451441
# Creates the dialog if its not already exists
452442
if self.dialog is None:
@@ -456,11 +446,13 @@ class CVRss(c4d.plugins.CommandData):
456446
return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaultw=400, defaulth=32)
457447

458448
def RestoreLayout(self, sec_ref):
459-
"""
460-
Used to restore an asynchronous dialog that has been placed in the users layout.
461-
:param sec_ref: The data that needs to be passed to the dlg (almost no use of it).
462-
:type sec_ref: PyCObject
463-
:return: True if the restore success
449+
"""Used to restore an asynchronous dialog that has been placed in the users layout.
450+
451+
Args:
452+
sec_ref (PyCObject): The data that needs to be passed to the dialog.
453+
454+
Returns:
455+
bool: True if the restore success
464456
"""
465457
# Creates the dialog if its not already exists
466458
if self.dialog is None:

0 commit comments

Comments
 (0)