Whenever you use the default Redshift installer it automatically uninstalls any previous version that you had installed. If you want to use multiple versions of Redshift on one machine, or if you want to facilitate centralized deployments of Redshift, then custom install procedures are solutions for this. We will take a look at a few different methods of doing this. In all these cases we will take a look at Custom installation procedures using Redshift 3.5.02 (we are discussing here how to do this for an older version on purpose) together with Cinema 4D version R22.
Index:
- A simple custom install for Redshift for Cinema 4D R22 on Windows
- 1.1) Method 1 - An example using the Windows 'environment variable' panel
- 1.2) Method 2 - An example using a .bat file
- 1.3) Method 3 - An example using a pathconfig.xml file.
- 1.4) Method 4 - An example using a custom python script
Note: You don't need to use these 4 methods. You only need to use one of these methods to realize a custom installation procedure. We are only showing multiple methods to showcase some options and to highlight differences for the exact same case scenario.
1) A simple custom install for Redshift for Cinema 4D R22
1.1) Method 1 - An example using the Windows 'environment variable' panel
Let's take a scenario where you have the latest Redshift installed in the latest version of C4D. But an older customer requested you to change something that was created in an older Redshift version inside Cinema 4D R22. In our example, we will pretend that the task at hand requires an older version of Redshift as well, for example, 3.5.02.
In that case, you can apply the following 'recipe'.
- Download the zero-install folder from the Redshift forum and unzip it somewhere on your machine
- Click the prepare_c4d.bat file.
- Add two environment variables on your machine. (These will tell c4d what Redshift version to use.)
- You can now start using that combination of C4D R22 together with Redshift 3.5.02
let's take a look at how to do that in more detail.
1) Download the zero-install folder from the Redshift forum and unzip it somewhere on your machine.
(All Redshift 3.5.* version installers can be found here - https://redshift.maxon.net/category/44/new-version-announcements-customer-3-5-builds)
Let's say that you created a folder called C:/Redshift to house all your 'zero-install folders'. If you unpack that zip file in there you will find the following folder:
And inside that folder:
2) Click the prepare_c4d.bat file.
Inside the plugin folder (in our example "C:\Redshift\redshift_v3.5.02\Redshift\Plugins\C4D") you will find a prepare_c4d.bat file. Double-click that bat file in order to run it.
This file will copy several .dll files from the bin folder to the plugin folder.
3) Add two environment variables to your machine. These will tell c4d what Redshift version to use.
Now we want to add a few environment variables on the machine to make your render engine show up in Cinema 4D and work as usual.
Inside the Windows settings, search for the "Edit environment variables for your account" panel.
Adding the REDSHIFT_COREDATAPATH environment variable
Inside that panel, you can click "New" and start adding an environment variable called
REDSHIFT_COREDATAPATH
And we can point that to the unzipped zero-install folder that we now have on our machine.
Now that we have done this, the machine will know where to look for the Redshift coredata folder. Without this environment variable, it would otherwise have looked to a default install location: C:\ProgramData\Redshift
Adding the g_additionalModulePath environment variable
In a similar way, also add another environment variable. This time we will add one that will tell C4D where to look for the Redshift plugin. This environment variable is called g_additionalModulePath. This needs to point to the correct Redshift plugin folder that you want C4D to use.
In our case:
In our case that would be:
C:\Redshift\redshift_v3.5.19\Redshift\Plugins\C4D\R22
That is because the following folder contains the Redshift plugin folder for all supported C4D versions.
The result after clicking OK again should look something look this:
Now that we have both environment variables added, the custom install procedure, using the Windows environment variables panel is complete. Redshift will now show up in C4D R22.
1.2) Method 2 - An example using a .bat file
Alternatively, instead of using the Windows environment variable panel, you can also create a custom .bat file, which you only need to double-click to automatically add these environment variables, and open Cinema 4D R22.
In order to start, just create a .txt file, and rename it to open.bat (or whatever name you would like to give it, as long as it ends on .bat)
Let's take a look at what this .bat file would look like in our example.
1.3) method 3 - An example using a pathconfig.xml file.
In our example, C:\Redshift\redshift_v3.5.02\Redshift\Plugins\C4D\R22\Redshift
And create an empty .xml file in there called pathconfig.xml
In our example, we can do that by typing:
1.4) Method 4 - An example using a Python script.
Alternatively, you can also use python in order to perform these Redshift custom installation steps.
The code below for example will first add the two environment variables based on the paths we have been using so far. It will utilize the OS library for that.
It will then open Cinema 4D using the subprocess library.
You can set environment variables in Python using the os
module, and then you can launch Cinema 4D using the subprocess
module. Here's a step-by-step guide to accomplish this:
Code:
import os
import subprocess
import time
def store_vars():
# Define the values for the environment variables
g_additionalModulePath = r'C:\Redshift\redshift_v3.5.02\Redshift\Plugins\C4D\R22'
REDSHIFT_COREDATAPATH = r'C:\Redshift\redshift_v3.5.02\Redshift'
# Set the environment variables in the current process
os.environ['g_additionalModulePath'] = g_additionalModulePath
os.environ['REDSHIFT_COREDATAPATH'] = REDSHIFT_COREDATAPATH
print("Environment variables set successfully.")
def launch_c4d():
# Specify the path to the Cinema 4D executable
cinema4d_executable_path = r'C:\Program Files\Maxon Cinema 4D R22\Cinema 4D.exe'
# Launch Cinema 4D using subprocess
subprocess.Popen([cinema4d_executable_path])
time.sleep(5) # Wait for Cinema 4D to start
store_vars()
launch_c4d()
# Get all environment current variables
env_vars = os.environ
# Print each environment variable to double-check if they were stored correctly
for key, value in env_vars.items():
print(f'{key} = {value}')
In this example, we are setting the two environment variables. And then opening Cinema 4D right after (with a small 5 second delay)
Comments
0 comments
Article is closed for comments.