A python plugin and library for Cinema 4D R24+ allowing users to render previews to preset locations and perform actions after a render completes.
Developed at Brand New School.
You can use git to install review4d by cloning it into your c4d plugins directory.
Alternatively you can download a release and extract it into your c4d plugins directory.
-
Use the Render for Review command in the Extensions menu to pull up the render dialog.
-
Adjust the settings in the dialog. Review4d will add new render settings to your document called Review Settings. You can use the Edit Review Settings button to edit the viewport settings in the Render Settings window.
-
If you have ShotGrid toolkit and the accompanying tk-cinema app running in your Cinema4D session you can enable the Upload to ShotGrid checkbox. After the render finishes a dialog will appear to let you upload it to ShotGrid.
review4d allows customization through the use of plugins. Create a python module and place it in the review4d/plugins
folder. Alternatively, you can add a custom path to the environment variable REVIEW4D_PLUGINS
and place your python modules there. Subclass one of the plugin types like PathPreset, ContextCollector, or PostRender and register them in a module level register function.
ContextCollector plugins are used to extract useful data from document paths. But you can include any data in the context that you want. The extracted context is then passed to PathPreset plugins to generate output file paths.
import review4d
import getpass
import datetime
class MyContextCollector(review4d.ContextCollector):
'''Adds user and date fields to context.'''
def execute(self, file, ctx):
ctx['user'] = getpass.getuser()
ctx['date'] = datetime.datetime.now().strftime('%Y-%m-%d')
return ctx
def register():
review4d.register_plugin(ContextCollector)
Let's use the user and date context collected in MyContextCollector in a new PathPreset plugin.
...
class MyPathPreset(review4d.PathPreset):
def execute(self, ctx):
filename = '{}_{}.mp4'.format(
ctx['filename'].rsplit('.', 1)[0],
ctx['user'],
)
path = review4d.normalize(
'/Project/Dailies/',
ctx['date'],
filename,
)
return path
def register():
...
review4d.register_plugin(MyPathPreset)
Finally we can create a PostRender plugin to show the rendered file in windows explorer or finder.
...
import sys
import subprocess
...
class ShowInFileBrowser(review4d.PostRender):
label = 'Show in File Browser'
enabled = True # Enable the checkbox in the UI by default
def is_available(self):
# You can return False here if your plugin has some required resources
# that are unavailable. See the `review4d/plugins/shotgrid.py` for an example.
return True
def execute(self, render_path):
if sys.platform == 'darwin':
subprocess.run(['open', '-R', render_path])
elif sys.platform == 'linux2':
subprocess.run(['xdg-open', os.path.dirname(render_path)])
elif sys.platform == 'win32':
subprocess.run(['explorer', '/select,', render_path.replace('/', '\\')])
Contributions are welcome.
- Fork this repository.
- Make your changes.
- Add tests to validate your changes.
- Run tests.
c4dpy -m tests
- Create a pull request.